@documenso/embed-vue 0.2.2 → 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.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +184 -118
- package/dist/multisign-document.vue.d.ts +46 -0
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -4,3 +4,4 @@ export { default as unstable_EmbedCreateDocument } from './create-document.vue';
|
|
|
4
4
|
export { default as unstable_EmbedCreateTemplate } from './create-template.vue';
|
|
5
5
|
export { default as unstable_EmbedUpdateDocument } from './update-document.vue';
|
|
6
6
|
export { default as unstable_EmbedUpdateTemplate } from './update-template.vue';
|
|
7
|
+
export { default as unstable_EmbedMultiSignDocument } from './multisign-document.vue';
|
package/dist/index.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ export { default as unstable_EmbedCreateDocument } from './create-document.vue';
|
|
|
4
4
|
export { default as unstable_EmbedCreateTemplate } from './create-template.vue';
|
|
5
5
|
export { default as unstable_EmbedUpdateDocument } from './update-document.vue';
|
|
6
6
|
export { default as unstable_EmbedUpdateTemplate } from './update-template.vue';
|
|
7
|
+
export { default as unstable_EmbedMultiSignDocument } from './multisign-document.vue';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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,14 +21,14 @@ const w = ["src"], M = /* @__PURE__ */ r({
|
|
|
21
21
|
onFieldUnsigned: { type: Function }
|
|
22
22
|
},
|
|
23
23
|
setup(c) {
|
|
24
|
-
const e = c,
|
|
24
|
+
const e = c, s = i();
|
|
25
25
|
m(() => {
|
|
26
26
|
window.addEventListener("message", o);
|
|
27
27
|
}), l(() => {
|
|
28
28
|
window.removeEventListener("message", o);
|
|
29
29
|
});
|
|
30
|
-
const
|
|
31
|
-
const
|
|
30
|
+
const r = p(() => {
|
|
31
|
+
const t = e.host || "https://app.documenso.com", n = btoa(
|
|
32
32
|
encodeURIComponent(
|
|
33
33
|
JSON.stringify({
|
|
34
34
|
name: e.name,
|
|
@@ -41,38 +41,37 @@ const w = ["src"], M = /* @__PURE__ */ r({
|
|
|
41
41
|
...e.additionalProps
|
|
42
42
|
})
|
|
43
43
|
)
|
|
44
|
-
),
|
|
45
|
-
return e.externalId &&
|
|
44
|
+
), a = new URL(`/embed/direct/${e.token}`, t);
|
|
45
|
+
return e.externalId && a.searchParams.set("externalId", e.externalId), `${a}#${n}`;
|
|
46
46
|
});
|
|
47
|
-
function o(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
switch (a.data.action) {
|
|
47
|
+
function o(t) {
|
|
48
|
+
if (s.value?.contentWindow === t.source)
|
|
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 (
|
|
67
|
+
return (t, n) => (_(), u("iframe", {
|
|
69
68
|
ref_key: "__iframe",
|
|
70
|
-
ref:
|
|
71
|
-
class: f(
|
|
72
|
-
src:
|
|
73
|
-
}, null, 10,
|
|
69
|
+
ref: s,
|
|
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,14 +90,14 @@ const w = ["src"], M = /* @__PURE__ */ r({
|
|
|
91
90
|
onDocumentRejected: { type: Function }
|
|
92
91
|
},
|
|
93
92
|
setup(c) {
|
|
94
|
-
const e = c,
|
|
93
|
+
const e = c, s = i();
|
|
95
94
|
m(() => {
|
|
96
95
|
window.addEventListener("message", o);
|
|
97
96
|
}), l(() => {
|
|
98
97
|
window.removeEventListener("message", o);
|
|
99
98
|
});
|
|
100
|
-
const
|
|
101
|
-
const
|
|
99
|
+
const r = p(() => {
|
|
100
|
+
const t = e.host || "https://app.documenso.com", n = btoa(
|
|
102
101
|
encodeURIComponent(
|
|
103
102
|
JSON.stringify({
|
|
104
103
|
name: e.name,
|
|
@@ -111,34 +110,33 @@ const w = ["src"], M = /* @__PURE__ */ r({
|
|
|
111
110
|
})
|
|
112
111
|
)
|
|
113
112
|
);
|
|
114
|
-
return `${new URL(`/embed/sign/${e.token}`,
|
|
113
|
+
return `${new URL(`/embed/sign/${e.token}`, t)}#${n}`;
|
|
115
114
|
});
|
|
116
|
-
function o(
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
switch (a.data.action) {
|
|
115
|
+
function o(t) {
|
|
116
|
+
if (s.value?.contentWindow === t.source)
|
|
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 (
|
|
132
|
+
return (t, n) => (_(), u("iframe", {
|
|
135
133
|
ref_key: "__iframe",
|
|
136
|
-
ref:
|
|
137
|
-
class: f(
|
|
138
|
-
src:
|
|
139
|
-
}, null, 10,
|
|
134
|
+
ref: s,
|
|
135
|
+
class: f(t.className),
|
|
136
|
+
src: r.value
|
|
137
|
+
}, null, 10, b));
|
|
140
138
|
}
|
|
141
|
-
}), D = ["src"],
|
|
139
|
+
}), D = ["src"], N = /* @__PURE__ */ d({
|
|
142
140
|
__name: "create-document",
|
|
143
141
|
props: {
|
|
144
142
|
className: {},
|
|
@@ -153,14 +151,14 @@ const w = ["src"], M = /* @__PURE__ */ r({
|
|
|
153
151
|
onDocumentCreated: { type: Function }
|
|
154
152
|
},
|
|
155
153
|
setup(c) {
|
|
156
|
-
const e = c,
|
|
154
|
+
const e = c, s = i();
|
|
157
155
|
m(() => {
|
|
158
156
|
window.addEventListener("message", o);
|
|
159
157
|
}), l(() => {
|
|
160
158
|
window.removeEventListener("message", o);
|
|
161
159
|
});
|
|
162
|
-
const
|
|
163
|
-
const
|
|
160
|
+
const r = p(() => {
|
|
161
|
+
const t = e.host || "https://app.documenso.com", n = btoa(
|
|
164
162
|
encodeURIComponent(
|
|
165
163
|
JSON.stringify({
|
|
166
164
|
externalId: e.externalId,
|
|
@@ -171,29 +169,28 @@ const w = ["src"], M = /* @__PURE__ */ r({
|
|
|
171
169
|
...e.additionalProps
|
|
172
170
|
})
|
|
173
171
|
)
|
|
174
|
-
),
|
|
175
|
-
return
|
|
172
|
+
), a = new URL("/embed/v1/authoring/document/create", t);
|
|
173
|
+
return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
|
|
176
174
|
});
|
|
177
|
-
function o(
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
switch (a.data.type) {
|
|
175
|
+
function o(t) {
|
|
176
|
+
if (s.value?.contentWindow === t.source)
|
|
177
|
+
switch (t.data.type) {
|
|
181
178
|
case "document-created":
|
|
182
|
-
|
|
183
|
-
documentId:
|
|
184
|
-
externalId:
|
|
179
|
+
e.onDocumentCreated?.({
|
|
180
|
+
documentId: t.data.documentId,
|
|
181
|
+
externalId: t.data.externalId
|
|
185
182
|
});
|
|
186
183
|
break;
|
|
187
184
|
}
|
|
188
185
|
}
|
|
189
|
-
return (
|
|
186
|
+
return (t, n) => (_(), u("iframe", {
|
|
190
187
|
ref_key: "__iframe",
|
|
191
|
-
ref:
|
|
192
|
-
class: f(
|
|
193
|
-
src:
|
|
188
|
+
ref: s,
|
|
189
|
+
class: f(t.className),
|
|
190
|
+
src: r.value
|
|
194
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,14 +205,14 @@ const w = ["src"], M = /* @__PURE__ */ r({
|
|
|
208
205
|
onTemplateCreated: { type: Function }
|
|
209
206
|
},
|
|
210
207
|
setup(c) {
|
|
211
|
-
const e = c,
|
|
208
|
+
const e = c, s = i();
|
|
212
209
|
m(() => {
|
|
213
210
|
window.addEventListener("message", o);
|
|
214
211
|
}), l(() => {
|
|
215
212
|
window.removeEventListener("message", o);
|
|
216
213
|
});
|
|
217
|
-
const
|
|
218
|
-
const
|
|
214
|
+
const r = p(() => {
|
|
215
|
+
const t = e.host || "https://app.documenso.com", n = btoa(
|
|
219
216
|
encodeURIComponent(
|
|
220
217
|
JSON.stringify({
|
|
221
218
|
externalId: e.externalId,
|
|
@@ -226,29 +223,28 @@ const w = ["src"], M = /* @__PURE__ */ r({
|
|
|
226
223
|
...e.additionalProps
|
|
227
224
|
})
|
|
228
225
|
)
|
|
229
|
-
),
|
|
230
|
-
return
|
|
226
|
+
), a = new URL("/embed/v1/authoring/template/create", t);
|
|
227
|
+
return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
|
|
231
228
|
});
|
|
232
|
-
function o(
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
switch (a.data.type) {
|
|
229
|
+
function o(t) {
|
|
230
|
+
if (s.value?.contentWindow === t.source)
|
|
231
|
+
switch (t.data.type) {
|
|
236
232
|
case "template-created":
|
|
237
|
-
|
|
238
|
-
templateId:
|
|
239
|
-
externalId:
|
|
233
|
+
e.onTemplateCreated?.({
|
|
234
|
+
templateId: t.data.templateId,
|
|
235
|
+
externalId: t.data.externalId
|
|
240
236
|
});
|
|
241
237
|
break;
|
|
242
238
|
}
|
|
243
239
|
}
|
|
244
|
-
return (
|
|
240
|
+
return (t, n) => (_(), u("iframe", {
|
|
245
241
|
ref_key: "__iframe",
|
|
246
|
-
ref:
|
|
247
|
-
class: f(
|
|
248
|
-
src:
|
|
249
|
-
}, null, 10,
|
|
242
|
+
ref: s,
|
|
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,14 +260,14 @@ const w = ["src"], M = /* @__PURE__ */ r({
|
|
|
264
260
|
onDocumentUpdated: { type: Function }
|
|
265
261
|
},
|
|
266
262
|
setup(c) {
|
|
267
|
-
const e = c,
|
|
263
|
+
const e = c, s = i();
|
|
268
264
|
m(() => {
|
|
269
265
|
window.addEventListener("message", o);
|
|
270
266
|
}), l(() => {
|
|
271
267
|
window.removeEventListener("message", o);
|
|
272
268
|
});
|
|
273
|
-
const
|
|
274
|
-
const
|
|
269
|
+
const r = p(() => {
|
|
270
|
+
const t = e.host || "https://app.documenso.com", n = btoa(
|
|
275
271
|
encodeURIComponent(
|
|
276
272
|
JSON.stringify({
|
|
277
273
|
token: e.presignToken,
|
|
@@ -283,32 +279,31 @@ const w = ["src"], M = /* @__PURE__ */ r({
|
|
|
283
279
|
...e.additionalProps
|
|
284
280
|
})
|
|
285
281
|
)
|
|
286
|
-
),
|
|
282
|
+
), a = new URL(
|
|
287
283
|
`/embed/v1/authoring/document/edit/${e.documentId}`,
|
|
288
|
-
|
|
284
|
+
t
|
|
289
285
|
);
|
|
290
|
-
return
|
|
286
|
+
return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
|
|
291
287
|
});
|
|
292
|
-
function o(
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
switch (a.data.type) {
|
|
288
|
+
function o(t) {
|
|
289
|
+
if (s.value?.contentWindow === t.source)
|
|
290
|
+
switch (t.data.type) {
|
|
296
291
|
case "document-updated":
|
|
297
|
-
|
|
298
|
-
documentId:
|
|
299
|
-
externalId:
|
|
292
|
+
e.onDocumentUpdated?.({
|
|
293
|
+
documentId: t.data.documentId,
|
|
294
|
+
externalId: t.data.externalId
|
|
300
295
|
});
|
|
301
296
|
break;
|
|
302
297
|
}
|
|
303
298
|
}
|
|
304
|
-
return (
|
|
299
|
+
return (t, n) => (_(), u("iframe", {
|
|
305
300
|
ref_key: "__iframe",
|
|
306
|
-
ref:
|
|
307
|
-
class: f(
|
|
308
|
-
src:
|
|
309
|
-
}, null, 10,
|
|
301
|
+
ref: s,
|
|
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,14 +319,14 @@ const w = ["src"], M = /* @__PURE__ */ r({
|
|
|
324
319
|
onTemplateUpdated: { type: Function }
|
|
325
320
|
},
|
|
326
321
|
setup(c) {
|
|
327
|
-
const e = c,
|
|
322
|
+
const e = c, s = i();
|
|
328
323
|
m(() => {
|
|
329
324
|
window.addEventListener("message", o);
|
|
330
325
|
}), l(() => {
|
|
331
326
|
window.removeEventListener("message", o);
|
|
332
327
|
});
|
|
333
|
-
const
|
|
334
|
-
const
|
|
328
|
+
const r = p(() => {
|
|
329
|
+
const t = e.host || "https://app.documenso.com", n = btoa(
|
|
335
330
|
encodeURIComponent(
|
|
336
331
|
JSON.stringify({
|
|
337
332
|
externalId: e.externalId,
|
|
@@ -342,37 +337,108 @@ const w = ["src"], M = /* @__PURE__ */ r({
|
|
|
342
337
|
...e.additionalProps
|
|
343
338
|
})
|
|
344
339
|
)
|
|
345
|
-
),
|
|
340
|
+
), a = new URL(
|
|
346
341
|
`/embed/v1/authoring/template/edit/${e.templateId}`,
|
|
347
|
-
|
|
342
|
+
t
|
|
348
343
|
);
|
|
349
|
-
return
|
|
344
|
+
return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
|
|
350
345
|
});
|
|
351
|
-
function o(
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
switch (a.data.type) {
|
|
346
|
+
function o(t) {
|
|
347
|
+
if (s.value?.contentWindow === t.source)
|
|
348
|
+
switch (t.data.type) {
|
|
355
349
|
case "template-updated":
|
|
356
|
-
|
|
357
|
-
templateId:
|
|
358
|
-
externalId:
|
|
350
|
+
e.onTemplateUpdated?.({
|
|
351
|
+
templateId: t.data.templateId,
|
|
352
|
+
externalId: t.data.externalId
|
|
359
353
|
});
|
|
360
354
|
break;
|
|
361
355
|
}
|
|
362
356
|
}
|
|
363
|
-
return (
|
|
357
|
+
return (t, n) => (_(), u("iframe", {
|
|
364
358
|
ref_key: "__iframe",
|
|
365
|
-
ref:
|
|
366
|
-
class: f(
|
|
367
|
-
src:
|
|
368
|
-
}, null, 10,
|
|
359
|
+
ref: s,
|
|
360
|
+
class: f(t.className),
|
|
361
|
+
src: r.value
|
|
362
|
+
}, null, 10, w));
|
|
363
|
+
}
|
|
364
|
+
}), I = ["src"], F = /* @__PURE__ */ d({
|
|
365
|
+
__name: "multisign-document",
|
|
366
|
+
props: {
|
|
367
|
+
className: {},
|
|
368
|
+
host: {},
|
|
369
|
+
tokens: {},
|
|
370
|
+
css: {},
|
|
371
|
+
cssVars: {},
|
|
372
|
+
darkModeDisabled: { type: Boolean },
|
|
373
|
+
name: {},
|
|
374
|
+
lockName: { type: Boolean },
|
|
375
|
+
allowDocumentRejection: { type: Boolean },
|
|
376
|
+
additionalProps: {},
|
|
377
|
+
onDocumentReady: { type: Function },
|
|
378
|
+
onDocumentCompleted: { type: Function },
|
|
379
|
+
onDocumentError: { type: Function },
|
|
380
|
+
onDocumentRejected: { type: Function },
|
|
381
|
+
onAllDocumentsCompleted: { type: Function }
|
|
382
|
+
},
|
|
383
|
+
setup(c) {
|
|
384
|
+
const e = c, s = i();
|
|
385
|
+
m(() => {
|
|
386
|
+
window.addEventListener("message", o);
|
|
387
|
+
}), l(() => {
|
|
388
|
+
window.removeEventListener("message", o);
|
|
389
|
+
});
|
|
390
|
+
const r = p(() => {
|
|
391
|
+
const t = e.host || "https://app.documenso.com", n = btoa(
|
|
392
|
+
encodeURIComponent(
|
|
393
|
+
JSON.stringify({
|
|
394
|
+
name: e.name,
|
|
395
|
+
lockName: e.lockName,
|
|
396
|
+
css: e.css,
|
|
397
|
+
cssVars: e.cssVars,
|
|
398
|
+
darkModeDisabled: e.darkModeDisabled,
|
|
399
|
+
allowDocumentRejection: e.allowDocumentRejection,
|
|
400
|
+
...e.additionalProps
|
|
401
|
+
})
|
|
402
|
+
)
|
|
403
|
+
), a = new URL("/embed/v1/multisign", t);
|
|
404
|
+
for (const k of e.tokens)
|
|
405
|
+
a.searchParams.append("token", k);
|
|
406
|
+
return `${a}#${n}`;
|
|
407
|
+
});
|
|
408
|
+
function o(t) {
|
|
409
|
+
if (s.value?.contentWindow === t.source)
|
|
410
|
+
switch (t.data.action) {
|
|
411
|
+
case "document-ready":
|
|
412
|
+
e.onDocumentReady?.();
|
|
413
|
+
break;
|
|
414
|
+
case "document-completed":
|
|
415
|
+
e.onDocumentCompleted?.(t.data.data);
|
|
416
|
+
break;
|
|
417
|
+
case "document-error":
|
|
418
|
+
e.onDocumentError?.(t.data.data);
|
|
419
|
+
break;
|
|
420
|
+
case "document-rejected":
|
|
421
|
+
e.onDocumentRejected?.(t.data.data);
|
|
422
|
+
break;
|
|
423
|
+
case "all-documents-completed":
|
|
424
|
+
e.onAllDocumentsCompleted?.(t.data.data);
|
|
425
|
+
break;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
return (t, n) => (_(), u("iframe", {
|
|
429
|
+
ref_key: "__iframe",
|
|
430
|
+
ref: s,
|
|
431
|
+
class: f(t.className),
|
|
432
|
+
src: r.value
|
|
433
|
+
}, null, 10, I));
|
|
369
434
|
}
|
|
370
435
|
});
|
|
371
436
|
export {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
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
|
|
378
444
|
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { CssVars } from './css-vars';
|
|
2
|
+
export type EmbedMultiSignDocumentProps = {
|
|
3
|
+
className?: string;
|
|
4
|
+
host?: string;
|
|
5
|
+
tokens: string[];
|
|
6
|
+
css?: string | undefined;
|
|
7
|
+
cssVars?: (CssVars & Record<string, string>) | undefined;
|
|
8
|
+
darkModeDisabled?: boolean | undefined;
|
|
9
|
+
name?: string | undefined;
|
|
10
|
+
lockName?: boolean | undefined;
|
|
11
|
+
allowDocumentRejection?: boolean | undefined;
|
|
12
|
+
additionalProps?: Record<string, string | number | boolean> | undefined;
|
|
13
|
+
onDocumentReady?: () => void;
|
|
14
|
+
onDocumentCompleted?: (data: {
|
|
15
|
+
token: string;
|
|
16
|
+
documentId: number;
|
|
17
|
+
recipientId: number;
|
|
18
|
+
}) => void;
|
|
19
|
+
onDocumentError?: (error: string) => void;
|
|
20
|
+
onDocumentRejected?: (data: {
|
|
21
|
+
token: string;
|
|
22
|
+
documentId: number;
|
|
23
|
+
recipientId: number;
|
|
24
|
+
reason: string;
|
|
25
|
+
}) => void;
|
|
26
|
+
onAllDocumentsCompleted?: (data: {
|
|
27
|
+
documents: Array<{
|
|
28
|
+
token: string;
|
|
29
|
+
documentId: number;
|
|
30
|
+
recipientId: number;
|
|
31
|
+
action: "document-completed" | "document-rejected";
|
|
32
|
+
reason?: string;
|
|
33
|
+
}>;
|
|
34
|
+
}) => void;
|
|
35
|
+
};
|
|
36
|
+
declare const _default: import('vue').DefineComponent<__VLS_TypePropsToOption<EmbedMultiSignDocumentProps>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<__VLS_TypePropsToOption<EmbedMultiSignDocumentProps>>>, {}, {}>;
|
|
37
|
+
export default _default;
|
|
38
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
39
|
+
type __VLS_TypePropsToOption<T> = {
|
|
40
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
41
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
42
|
+
} : {
|
|
43
|
+
type: import('vue').PropType<T[K]>;
|
|
44
|
+
required: true;
|
|
45
|
+
};
|
|
46
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@documenso/embed-vue",
|
|
3
|
-
"version": "0.
|
|
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
|
}
|