@documenso/embed-vue 0.2.0-rc.0 → 0.2.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 +46 -42
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),k=["src"],f=o.defineComponent({__name:"direct-template",props:{className:{},host:{},token:{},externalId:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},email:{},lockEmail:{type:Boolean},name:{},lockName:{type:Boolean},onDocumentReady:{type:Function},onDocumentCompleted:{type:Function},onDocumentError:{type:Function},onFieldSigned:{type:Function},onFieldUnsigned:{type:Function}},setup(m){const e=m,c=o.ref();o.onMounted(()=>{window.addEventListener("message",s)}),o.onUnmounted(()=>{window.removeEventListener("message",s)});const i=o.computed(()=>{const n=e.host||"https://app.documenso.com",t=btoa(JSON.stringify({name:e.name,lockName:e.lockName,email:e.email,lockEmail:e.lockEmail,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled})),a=new URL(`/embed/direct/${e.token}`,n);return e.externalId&&a.searchParams.set("externalId",e.externalId),`${a}#${t}`});function s(n){var t,a,d,r,l,u;if(((t=c.value)==null?void 0:t.contentWindow)===n.source)switch(n.data.action){case"document-ready":(a=e.onDocumentReady)==null||a.call(e);break;case"document-completed":(d=e.onDocumentCompleted)==null||d.call(e,n.data.data);break;case"document-error":(r=e.onDocumentError)==null||r.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,t)=>(o.openBlock(),o.createElementBlock("iframe",{ref_key:"__iframe",ref:c,class:o.normalizeClass(n.className),src:i.value},null,10,k))}}),y=["src"],_=o.defineComponent({__name:"sign-document",props:{className:{},host:{},token:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},name:{},lockName:{type:Boolean},onDocumentReady:{type:Function},onDocumentCompleted:{type:Function},onDocumentError:{type:Function}},setup(m){const e=m,c=o.ref();o.onMounted(()=>{window.addEventListener("message",s)}),o.onUnmounted(()=>{window.removeEventListener("message",s)});const i=o.computed(()=>{const n=e.host||"https://app.documenso.com",t=btoa(JSON.stringify({name:e.name,lockName:e.lockName,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled}));return`${new URL(`/embed/sign/${e.token}`,n)}#${t}`});function s(n){var t,a,d,r;if(((t=c.value)==null?void 0:t.contentWindow)===n.source)switch(n.data.action){case"document-ready":(a=e.onDocumentReady)==null||a.call(e);break;case"document-completed":(d=e.onDocumentCompleted)==null||d.call(e,n.data.data);break;case"document-error":(r=e.onDocumentError)==null||r.call(e,n.data.data);break}}return(n,t)=>(o.openBlock(),o.createElementBlock("iframe",{ref_key:"__iframe",ref:c,class:o.normalizeClass(n.className),src:i.value},null,10,y))}});exports.EmbedDirectTemplate=f;exports.EmbedSignDocument=_;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),k=["src"],f=o.defineComponent({__name:"direct-template",props:{className:{},host:{},token:{},externalId:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},email:{},lockEmail:{type:Boolean},name:{},lockName:{type:Boolean},onDocumentReady:{type:Function},onDocumentCompleted:{type:Function},onDocumentError:{type:Function},onFieldSigned:{type:Function},onFieldUnsigned:{type:Function}},setup(m){const e=m,c=o.ref();o.onMounted(()=>{window.addEventListener("message",s)}),o.onUnmounted(()=>{window.removeEventListener("message",s)});const i=o.computed(()=>{const n=e.host||"https://app.documenso.com",t=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}))),a=new URL(`/embed/direct/${e.token}`,n);return e.externalId&&a.searchParams.set("externalId",e.externalId),`${a}#${t}`});function s(n){var t,a,d,r,l,u;if(((t=c.value)==null?void 0:t.contentWindow)===n.source)switch(n.data.action){case"document-ready":(a=e.onDocumentReady)==null||a.call(e);break;case"document-completed":(d=e.onDocumentCompleted)==null||d.call(e,n.data.data);break;case"document-error":(r=e.onDocumentError)==null||r.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,t)=>(o.openBlock(),o.createElementBlock("iframe",{ref_key:"__iframe",ref:c,class:o.normalizeClass(n.className),src:i.value},null,10,k))}}),y=["src"],_=o.defineComponent({__name:"sign-document",props:{className:{},host:{},token:{},css:{},cssVars:{},darkModeDisabled:{type:Boolean},name:{},lockName:{type:Boolean},onDocumentReady:{type:Function},onDocumentCompleted:{type:Function},onDocumentError:{type:Function}},setup(m){const e=m,c=o.ref();o.onMounted(()=>{window.addEventListener("message",s)}),o.onUnmounted(()=>{window.removeEventListener("message",s)});const i=o.computed(()=>{const n=e.host||"https://app.documenso.com",t=btoa(encodeURIComponent(JSON.stringify({name:e.name,lockName:e.lockName,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled})));return`${new URL(`/embed/sign/${e.token}`,n)}#${t}`});function s(n){var t,a,d,r;if(((t=c.value)==null?void 0:t.contentWindow)===n.source)switch(n.data.action){case"document-ready":(a=e.onDocumentReady)==null||a.call(e);break;case"document-completed":(d=e.onDocumentCompleted)==null||d.call(e,n.data.data);break;case"document-error":(r=e.onDocumentError)==null||r.call(e,n.data.data);break}}return(n,t)=>(o.openBlock(),o.createElementBlock("iframe",{ref_key:"__iframe",ref:c,class:o.normalizeClass(n.className),src:i.value},null,10,y))}});exports.EmbedDirectTemplate=f;exports.EmbedSignDocument=_;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as u, ref as k, onMounted as f, onUnmounted as _, computed as y, openBlock as b, createElementBlock as D, normalizeClass as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as u, ref as k, onMounted as f, onUnmounted as _, computed as y, openBlock as b, createElementBlock as D, normalizeClass as p } from "vue";
|
|
2
|
+
const g = ["src"], E = /* @__PURE__ */ u({
|
|
3
3
|
__name: "direct-template",
|
|
4
4
|
props: {
|
|
5
5
|
className: {},
|
|
@@ -22,33 +22,35 @@ const p = ["src"], E = /* @__PURE__ */ u({
|
|
|
22
22
|
setup(r) {
|
|
23
23
|
const e = r, t = k();
|
|
24
24
|
f(() => {
|
|
25
|
-
window.addEventListener("message",
|
|
25
|
+
window.addEventListener("message", c);
|
|
26
26
|
}), _(() => {
|
|
27
|
-
window.removeEventListener("message",
|
|
27
|
+
window.removeEventListener("message", c);
|
|
28
28
|
});
|
|
29
29
|
const m = y(() => {
|
|
30
|
-
const n = e.host || "https://app.documenso.com",
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
const n = e.host || "https://app.documenso.com", o = btoa(
|
|
31
|
+
encodeURIComponent(
|
|
32
|
+
JSON.stringify({
|
|
33
|
+
name: e.name,
|
|
34
|
+
lockName: e.lockName,
|
|
35
|
+
email: e.email,
|
|
36
|
+
lockEmail: e.lockEmail,
|
|
37
|
+
css: e.css,
|
|
38
|
+
cssVars: e.cssVars,
|
|
39
|
+
darkModeDisabled: e.darkModeDisabled
|
|
40
|
+
})
|
|
41
|
+
)
|
|
42
|
+
), a = new URL(`/embed/direct/${e.token}`, n);
|
|
43
|
+
return e.externalId && a.searchParams.set("externalId", e.externalId), `${a}#${o}`;
|
|
42
44
|
});
|
|
43
|
-
function
|
|
44
|
-
var
|
|
45
|
-
if (((
|
|
45
|
+
function c(n) {
|
|
46
|
+
var o, a, s, d, i, l;
|
|
47
|
+
if (((o = t.value) == null ? void 0 : o.contentWindow) === n.source)
|
|
46
48
|
switch (n.data.action) {
|
|
47
49
|
case "document-ready":
|
|
48
|
-
(
|
|
50
|
+
(a = e.onDocumentReady) == null || a.call(e);
|
|
49
51
|
break;
|
|
50
52
|
case "document-completed":
|
|
51
|
-
(
|
|
53
|
+
(s = e.onDocumentCompleted) == null || s.call(e, n.data.data);
|
|
52
54
|
break;
|
|
53
55
|
case "document-error":
|
|
54
56
|
(d = e.onDocumentError) == null || d.call(e, n.data.data);
|
|
@@ -61,12 +63,12 @@ const p = ["src"], E = /* @__PURE__ */ u({
|
|
|
61
63
|
break;
|
|
62
64
|
}
|
|
63
65
|
}
|
|
64
|
-
return (n,
|
|
66
|
+
return (n, o) => (b(), D("iframe", {
|
|
65
67
|
ref_key: "__iframe",
|
|
66
68
|
ref: t,
|
|
67
|
-
class:
|
|
69
|
+
class: p(n.className),
|
|
68
70
|
src: m.value
|
|
69
|
-
}, null, 10,
|
|
71
|
+
}, null, 10, g));
|
|
70
72
|
}
|
|
71
73
|
}), h = ["src"], F = /* @__PURE__ */ u({
|
|
72
74
|
__name: "sign-document",
|
|
@@ -86,41 +88,43 @@ const p = ["src"], E = /* @__PURE__ */ u({
|
|
|
86
88
|
setup(r) {
|
|
87
89
|
const e = r, t = k();
|
|
88
90
|
f(() => {
|
|
89
|
-
window.addEventListener("message",
|
|
91
|
+
window.addEventListener("message", c);
|
|
90
92
|
}), _(() => {
|
|
91
|
-
window.removeEventListener("message",
|
|
93
|
+
window.removeEventListener("message", c);
|
|
92
94
|
});
|
|
93
95
|
const m = y(() => {
|
|
94
|
-
const n = e.host || "https://app.documenso.com",
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
const n = e.host || "https://app.documenso.com", o = btoa(
|
|
97
|
+
encodeURIComponent(
|
|
98
|
+
JSON.stringify({
|
|
99
|
+
name: e.name,
|
|
100
|
+
lockName: e.lockName,
|
|
101
|
+
css: e.css,
|
|
102
|
+
cssVars: e.cssVars,
|
|
103
|
+
darkModeDisabled: e.darkModeDisabled
|
|
104
|
+
})
|
|
105
|
+
)
|
|
102
106
|
);
|
|
103
|
-
return `${new URL(`/embed/sign/${e.token}`, n)}#${
|
|
107
|
+
return `${new URL(`/embed/sign/${e.token}`, n)}#${o}`;
|
|
104
108
|
});
|
|
105
|
-
function
|
|
106
|
-
var
|
|
107
|
-
if (((
|
|
109
|
+
function c(n) {
|
|
110
|
+
var o, a, s, d;
|
|
111
|
+
if (((o = t.value) == null ? void 0 : o.contentWindow) === n.source)
|
|
108
112
|
switch (n.data.action) {
|
|
109
113
|
case "document-ready":
|
|
110
|
-
(
|
|
114
|
+
(a = e.onDocumentReady) == null || a.call(e);
|
|
111
115
|
break;
|
|
112
116
|
case "document-completed":
|
|
113
|
-
(
|
|
117
|
+
(s = e.onDocumentCompleted) == null || s.call(e, n.data.data);
|
|
114
118
|
break;
|
|
115
119
|
case "document-error":
|
|
116
120
|
(d = e.onDocumentError) == null || d.call(e, n.data.data);
|
|
117
121
|
break;
|
|
118
122
|
}
|
|
119
123
|
}
|
|
120
|
-
return (n,
|
|
124
|
+
return (n, o) => (b(), D("iframe", {
|
|
121
125
|
ref_key: "__iframe",
|
|
122
126
|
ref: t,
|
|
123
|
-
class:
|
|
127
|
+
class: p(n.className),
|
|
124
128
|
src: m.value
|
|
125
129
|
}, null, 10, h));
|
|
126
130
|
}
|