@documenso/embed-vue 0.2.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +99 -98
- package/dist/update-document.vue.d.ts +1 -0
- package/dist/update-template.vue.d.ts +1 -0
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export { default as EmbedDirectTemplate } from './direct-template.vue';
|
|
2
2
|
export { default as EmbedSignDocument } from './sign-document.vue';
|
|
3
|
+
export { default as EmbedCreateDocumentV1 } from './create-document.vue';
|
|
4
|
+
export { default as EmbedCreateTemplateV1 } from './create-template.vue';
|
|
5
|
+
export { default as EmbedUpdateDocumentV1 } from './update-document.vue';
|
|
6
|
+
export { default as EmbedUpdateTemplateV1 } from './update-template.vue';
|
|
3
7
|
export { default as unstable_EmbedCreateDocument } from './create-document.vue';
|
|
4
8
|
export { default as unstable_EmbedCreateTemplate } from './create-template.vue';
|
|
5
9
|
export { default as unstable_EmbedUpdateDocument } from './update-document.vue';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export { default as EmbedDirectTemplate } from './direct-template.vue';
|
|
2
2
|
export { default as EmbedSignDocument } from './sign-document.vue';
|
|
3
|
+
export { default as EmbedCreateDocumentV1 } from './create-document.vue';
|
|
4
|
+
export { default as EmbedCreateTemplateV1 } from './create-template.vue';
|
|
5
|
+
export { default as EmbedUpdateDocumentV1 } from './update-document.vue';
|
|
6
|
+
export { default as EmbedUpdateTemplateV1 } from './update-template.vue';
|
|
3
7
|
export { default as unstable_EmbedCreateDocument } from './create-document.vue';
|
|
4
8
|
export { default as unstable_EmbedCreateTemplate } from './create-template.vue';
|
|
5
9
|
export { default as unstable_EmbedUpdateDocument } from './update-document.vue';
|
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"),f=["src"],k=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,a=t.ref();t.onMounted(()=>{window.addEventListener("message",s)}),t.onUnmounted(()=>{window.removeEventListener("message",s)});const r=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:r.value},null,10,f))}}),_=["src"],b=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,a=t.ref();t.onMounted(()=>{window.addEventListener("message",s)}),t.onUnmounted(()=>{window.removeEventListener("message",s)});const r=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:r.value},null,10,_))}}),y=["src"],m=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,a=t.ref();t.onMounted(()=>{window.addEventListener("message",s)}),t.onUnmounted(()=>{window.removeEventListener("message",s)});const r=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:r.value},null,10,y))}}),h=["src"],l=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,a=t.ref();t.onMounted(()=>{window.addEventListener("message",s)}),t.onUnmounted(()=>{window.removeEventListener("message",s)});const r=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:r.value},null,10,h))}}),D=["src"],i=t.defineComponent({__name:"update-document",props:{className:{},host:{},presignToken:{},documentId:{},externalId:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},features:{},onlyEditFields:{type:Boolean},additionalProps:{},onDocumentUpdated:{type:Function}},setup(d){const e=d,a=t.ref();t.onMounted(()=>{window.addEventListener("message",s)}),t.onUnmounted(()=>{window.removeEventListener("message",s)});const r=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,onlyEditFields:e.onlyEditFields,...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:r.value},null,10,D))}}),g=["src"],p=t.defineComponent({__name:"update-template",props:{className:{},host:{},presignToken:{},templateId:{},externalId:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},features:{},onlyEditFields:{type:Boolean},additionalProps:{},onTemplateUpdated:{type:Function}},setup(d){const e=d,a=t.ref();t.onMounted(()=>{window.addEventListener("message",s)}),t.onUnmounted(()=>{window.removeEventListener("message",s)});const r=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,onlyEditFields:e.onlyEditFields,...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:r.value},null,10,g))}}),w=["src"],E=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(d){const e=d,a=t.ref();t.onMounted(()=>{window.addEventListener("message",s)}),t.onUnmounted(()=>{window.removeEventListener("message",s)});const r=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 u of e.tokens)n.searchParams.append("token",u);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:r.value},null,10,w))}});exports.EmbedCreateDocumentV1=m;exports.EmbedCreateTemplateV1=l;exports.EmbedDirectTemplate=k;exports.EmbedSignDocument=b;exports.EmbedUpdateDocumentV1=i;exports.EmbedUpdateTemplateV1=p;exports.unstable_EmbedCreateDocument=m;exports.unstable_EmbedCreateTemplate=l;exports.unstable_EmbedMultiSignDocument=E;exports.unstable_EmbedUpdateDocument=i;exports.unstable_EmbedUpdateTemplate=p;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as r, ref as i, onMounted as m, onUnmounted as l, computed as p, createElementBlock as u, openBlock as _, normalizeClass as f } from "vue";
|
|
2
|
+
const b = ["src"], U = /* @__PURE__ */ r({
|
|
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 d =
|
|
30
|
+
const d = 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:
|
|
70
|
+
class: f(t.className),
|
|
72
71
|
src: d.value
|
|
73
|
-
}, null, 10,
|
|
72
|
+
}, null, 10, b));
|
|
74
73
|
}
|
|
75
|
-
}),
|
|
74
|
+
}), h = ["src"], M = /* @__PURE__ */ r({
|
|
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 d =
|
|
99
|
+
const d = 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:
|
|
135
|
+
class: f(t.className),
|
|
138
136
|
src: d.value
|
|
139
|
-
}, null, 10,
|
|
137
|
+
}, null, 10, h));
|
|
140
138
|
}
|
|
141
|
-
}),
|
|
139
|
+
}), y = ["src"], N = /* @__PURE__ */ r({
|
|
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 d =
|
|
160
|
+
const d = 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:
|
|
189
|
+
class: f(t.className),
|
|
193
190
|
src: d.value
|
|
194
|
-
}, null, 10,
|
|
191
|
+
}, null, 10, y));
|
|
195
192
|
}
|
|
196
|
-
}),
|
|
193
|
+
}), D = ["src"], R = /* @__PURE__ */ r({
|
|
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 d =
|
|
214
|
+
const d = 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:
|
|
243
|
+
class: f(t.className),
|
|
248
244
|
src: d.value
|
|
249
|
-
}, null, 10,
|
|
245
|
+
}, null, 10, D));
|
|
250
246
|
}
|
|
251
|
-
}),
|
|
247
|
+
}), g = ["src"], F = /* @__PURE__ */ r({
|
|
252
248
|
__name: "update-document",
|
|
253
249
|
props: {
|
|
254
250
|
className: {},
|
|
@@ -260,17 +256,18 @@ const y = ["src"], R = /* @__PURE__ */ l({
|
|
|
260
256
|
cssVars: {},
|
|
261
257
|
darkModeDisabled: { type: Boolean },
|
|
262
258
|
features: {},
|
|
259
|
+
onlyEditFields: { type: Boolean },
|
|
263
260
|
additionalProps: {},
|
|
264
261
|
onDocumentUpdated: { type: Function }
|
|
265
262
|
},
|
|
266
263
|
setup(c) {
|
|
267
|
-
const e = c, s =
|
|
268
|
-
|
|
264
|
+
const e = c, s = i();
|
|
265
|
+
m(() => {
|
|
269
266
|
window.addEventListener("message", o);
|
|
270
|
-
}),
|
|
267
|
+
}), l(() => {
|
|
271
268
|
window.removeEventListener("message", o);
|
|
272
269
|
});
|
|
273
|
-
const d =
|
|
270
|
+
const d = p(() => {
|
|
274
271
|
const t = e.host || "https://app.documenso.com", n = btoa(
|
|
275
272
|
encodeURIComponent(
|
|
276
273
|
JSON.stringify({
|
|
@@ -280,6 +277,7 @@ const y = ["src"], R = /* @__PURE__ */ l({
|
|
|
280
277
|
css: e.css,
|
|
281
278
|
cssVars: e.cssVars,
|
|
282
279
|
darkModeDisabled: e.darkModeDisabled,
|
|
280
|
+
onlyEditFields: e.onlyEditFields,
|
|
283
281
|
...e.additionalProps
|
|
284
282
|
})
|
|
285
283
|
)
|
|
@@ -290,25 +288,24 @@ const y = ["src"], R = /* @__PURE__ */ l({
|
|
|
290
288
|
return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
|
|
291
289
|
});
|
|
292
290
|
function o(t) {
|
|
293
|
-
|
|
294
|
-
if (((n = s.value) == null ? void 0 : n.contentWindow) === t.source)
|
|
291
|
+
if (s.value?.contentWindow === t.source)
|
|
295
292
|
switch (t.data.type) {
|
|
296
293
|
case "document-updated":
|
|
297
|
-
|
|
294
|
+
e.onDocumentUpdated?.({
|
|
298
295
|
documentId: t.data.documentId,
|
|
299
296
|
externalId: t.data.externalId
|
|
300
297
|
});
|
|
301
298
|
break;
|
|
302
299
|
}
|
|
303
300
|
}
|
|
304
|
-
return (t, n) => (
|
|
301
|
+
return (t, n) => (_(), u("iframe", {
|
|
305
302
|
ref_key: "__iframe",
|
|
306
303
|
ref: s,
|
|
307
|
-
class:
|
|
304
|
+
class: f(t.className),
|
|
308
305
|
src: d.value
|
|
309
|
-
}, null, 10,
|
|
306
|
+
}, null, 10, g));
|
|
310
307
|
}
|
|
311
|
-
}),
|
|
308
|
+
}), w = ["src"], x = /* @__PURE__ */ r({
|
|
312
309
|
__name: "update-template",
|
|
313
310
|
props: {
|
|
314
311
|
className: {},
|
|
@@ -320,17 +317,18 @@ const y = ["src"], R = /* @__PURE__ */ l({
|
|
|
320
317
|
cssVars: {},
|
|
321
318
|
darkModeDisabled: { type: Boolean },
|
|
322
319
|
features: {},
|
|
320
|
+
onlyEditFields: { type: Boolean },
|
|
323
321
|
additionalProps: {},
|
|
324
322
|
onTemplateUpdated: { type: Function }
|
|
325
323
|
},
|
|
326
324
|
setup(c) {
|
|
327
|
-
const e = c, s =
|
|
328
|
-
|
|
325
|
+
const e = c, s = i();
|
|
326
|
+
m(() => {
|
|
329
327
|
window.addEventListener("message", o);
|
|
330
|
-
}),
|
|
328
|
+
}), l(() => {
|
|
331
329
|
window.removeEventListener("message", o);
|
|
332
330
|
});
|
|
333
|
-
const d =
|
|
331
|
+
const d = p(() => {
|
|
334
332
|
const t = e.host || "https://app.documenso.com", n = btoa(
|
|
335
333
|
encodeURIComponent(
|
|
336
334
|
JSON.stringify({
|
|
@@ -339,6 +337,7 @@ const y = ["src"], R = /* @__PURE__ */ l({
|
|
|
339
337
|
css: e.css,
|
|
340
338
|
cssVars: e.cssVars,
|
|
341
339
|
darkModeDisabled: e.darkModeDisabled,
|
|
340
|
+
onlyEditFields: e.onlyEditFields,
|
|
342
341
|
...e.additionalProps
|
|
343
342
|
})
|
|
344
343
|
)
|
|
@@ -349,25 +348,24 @@ const y = ["src"], R = /* @__PURE__ */ l({
|
|
|
349
348
|
return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
|
|
350
349
|
});
|
|
351
350
|
function o(t) {
|
|
352
|
-
|
|
353
|
-
if (((n = s.value) == null ? void 0 : n.contentWindow) === t.source)
|
|
351
|
+
if (s.value?.contentWindow === t.source)
|
|
354
352
|
switch (t.data.type) {
|
|
355
353
|
case "template-updated":
|
|
356
|
-
|
|
354
|
+
e.onTemplateUpdated?.({
|
|
357
355
|
templateId: t.data.templateId,
|
|
358
356
|
externalId: t.data.externalId
|
|
359
357
|
});
|
|
360
358
|
break;
|
|
361
359
|
}
|
|
362
360
|
}
|
|
363
|
-
return (t, n) => (
|
|
361
|
+
return (t, n) => (_(), u("iframe", {
|
|
364
362
|
ref_key: "__iframe",
|
|
365
363
|
ref: s,
|
|
366
|
-
class:
|
|
364
|
+
class: f(t.className),
|
|
367
365
|
src: d.value
|
|
368
|
-
}, null, 10,
|
|
366
|
+
}, null, 10, w));
|
|
369
367
|
}
|
|
370
|
-
}),
|
|
368
|
+
}), I = ["src"], C = /* @__PURE__ */ r({
|
|
371
369
|
__name: "multisign-document",
|
|
372
370
|
props: {
|
|
373
371
|
className: {},
|
|
@@ -387,13 +385,13 @@ const y = ["src"], R = /* @__PURE__ */ l({
|
|
|
387
385
|
onAllDocumentsCompleted: { type: Function }
|
|
388
386
|
},
|
|
389
387
|
setup(c) {
|
|
390
|
-
const e = c, s =
|
|
391
|
-
|
|
388
|
+
const e = c, s = i();
|
|
389
|
+
m(() => {
|
|
392
390
|
window.addEventListener("message", o);
|
|
393
|
-
}),
|
|
391
|
+
}), l(() => {
|
|
394
392
|
window.removeEventListener("message", o);
|
|
395
393
|
});
|
|
396
|
-
const d =
|
|
394
|
+
const d = p(() => {
|
|
397
395
|
const t = e.host || "https://app.documenso.com", n = btoa(
|
|
398
396
|
encodeURIComponent(
|
|
399
397
|
JSON.stringify({
|
|
@@ -407,45 +405,48 @@ const y = ["src"], R = /* @__PURE__ */ l({
|
|
|
407
405
|
})
|
|
408
406
|
)
|
|
409
407
|
), a = new URL("/embed/v1/multisign", t);
|
|
410
|
-
for (const
|
|
411
|
-
a.searchParams.append("token",
|
|
408
|
+
for (const k of e.tokens)
|
|
409
|
+
a.searchParams.append("token", k);
|
|
412
410
|
return `${a}#${n}`;
|
|
413
411
|
});
|
|
414
412
|
function o(t) {
|
|
415
|
-
|
|
416
|
-
if (((n = s.value) == null ? void 0 : n.contentWindow) === t.source)
|
|
413
|
+
if (s.value?.contentWindow === t.source)
|
|
417
414
|
switch (t.data.action) {
|
|
418
415
|
case "document-ready":
|
|
419
|
-
|
|
416
|
+
e.onDocumentReady?.();
|
|
420
417
|
break;
|
|
421
418
|
case "document-completed":
|
|
422
|
-
|
|
419
|
+
e.onDocumentCompleted?.(t.data.data);
|
|
423
420
|
break;
|
|
424
421
|
case "document-error":
|
|
425
|
-
|
|
422
|
+
e.onDocumentError?.(t.data.data);
|
|
426
423
|
break;
|
|
427
424
|
case "document-rejected":
|
|
428
|
-
|
|
425
|
+
e.onDocumentRejected?.(t.data.data);
|
|
429
426
|
break;
|
|
430
427
|
case "all-documents-completed":
|
|
431
|
-
|
|
428
|
+
e.onAllDocumentsCompleted?.(t.data.data);
|
|
432
429
|
break;
|
|
433
430
|
}
|
|
434
431
|
}
|
|
435
|
-
return (t, n) => (
|
|
432
|
+
return (t, n) => (_(), u("iframe", {
|
|
436
433
|
ref_key: "__iframe",
|
|
437
434
|
ref: s,
|
|
438
|
-
class:
|
|
435
|
+
class: f(t.className),
|
|
439
436
|
src: d.value
|
|
440
|
-
}, null, 10,
|
|
437
|
+
}, null, 10, I));
|
|
441
438
|
}
|
|
442
439
|
});
|
|
443
440
|
export {
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
441
|
+
N as EmbedCreateDocumentV1,
|
|
442
|
+
R as EmbedCreateTemplateV1,
|
|
443
|
+
U as EmbedDirectTemplate,
|
|
444
|
+
M as EmbedSignDocument,
|
|
445
|
+
F as EmbedUpdateDocumentV1,
|
|
446
|
+
x as EmbedUpdateTemplateV1,
|
|
447
|
+
N as unstable_EmbedCreateDocument,
|
|
448
|
+
R as unstable_EmbedCreateTemplate,
|
|
449
|
+
C as unstable_EmbedMultiSignDocument,
|
|
450
|
+
F as unstable_EmbedUpdateDocument,
|
|
451
|
+
x as unstable_EmbedUpdateTemplate
|
|
451
452
|
};
|
|
@@ -16,6 +16,7 @@ export type EmbedUpdateDocumentProps = {
|
|
|
16
16
|
allowConfigureRedirectUrl?: boolean;
|
|
17
17
|
allowConfigureCommunication?: boolean;
|
|
18
18
|
};
|
|
19
|
+
onlyEditFields?: boolean | undefined;
|
|
19
20
|
additionalProps?: Record<string, string | number | boolean> | undefined;
|
|
20
21
|
onDocumentUpdated?: (data: {
|
|
21
22
|
externalId: string;
|
|
@@ -16,6 +16,7 @@ export type EmbedUpdateTemplateProps = {
|
|
|
16
16
|
allowConfigureRedirectUrl?: boolean;
|
|
17
17
|
allowConfigureCommunication?: boolean;
|
|
18
18
|
};
|
|
19
|
+
onlyEditFields?: boolean | undefined;
|
|
19
20
|
additionalProps?: Record<string, string | number | boolean> | undefined;
|
|
20
21
|
onTemplateUpdated?: (data: {
|
|
21
22
|
externalId: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@documenso/embed-vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.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
|
}
|