@documenso/embed-solid 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 +15 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("solid-js");function u(e,d,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("solid-js");function u(e,d,o){let c;const t=()=>{const n=document.createElement("template");return n.innerHTML=e,n.content.firstChild},a=()=>(c||(c=t())).cloneNode(!0);return a.cloneNode=a,a}function s(e,d,o){k(e)||(o==null?e.removeAttribute(d):e.setAttribute(d,o))}function f(e,d){k(e)||(d==null?e.removeAttribute("class"):e.className=d)}function b(e,d,o){return m.untrack(()=>e(d,o))}function k(e){return!!m.sharedConfig.context&&!m.sharedConfig.done&&(!e||e.isConnected)}var g=u("<iframe>");function D(e){const d=m.createMemo(()=>{const t=e.host||"https://app.documenso.com",a=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}))),n=new URL(`/embed/direct/${e.token}`,t);return e.externalId&&n.searchParams.set("externalId",e.externalId),`${n}#${a}`});function o(t){var a,n,i,r,l;if((c==null?void 0:c.contentWindow)===t.source)switch(t.data.action){case"document-ready":(a=e.onDocumentReady)==null||a.call(e);break;case"document-completed":(n=e.onDocumentCompleted)==null||n.call(e,t.data.data);break;case"document-error":(i=e.onDocumentError)==null||i.call(e,t.data.data);break;case"field-signed":(r=e.onFieldSigned)==null||r.call(e);break;case"field-unsigned":(l=e.onFieldUnsigned)==null||l.call(e);break}}let c;return m.onMount(()=>{window.addEventListener("message",o)}),(()=>{var t=g(),a=c;return typeof a=="function"?b(a,t):c=t,m.createRenderEffect(n=>{var i=e.className,r=d();return i!==n.e&&f(t,n.e=i),r!==n.t&&s(t,"src",n.t=r),n},{e:void 0,t:void 0}),t})()}var E=u("<iframe>");function v(e){const d=m.createMemo(()=>{const t=e.host||"https://app.documenso.com",a=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}`,t)}#${a}`});function o(t){var a,n,i;if((c==null?void 0:c.contentWindow)===t.source)switch(t.data.action){case"document-ready":(a=e.onDocumentReady)==null||a.call(e);break;case"document-completed":(n=e.onDocumentCompleted)==null||n.call(e,t.data.data);break;case"document-error":(i=e.onDocumentError)==null||i.call(e,t.data.data);break}}let c;return m.onMount(()=>{window.addEventListener("message",o)}),(()=>{var t=E(),a=c;return typeof a=="function"?b(a,t):c=t,m.createRenderEffect(n=>{var i=e.className,r=d();return i!==n.e&&f(t,n.e=i),r!==n.t&&s(t,"src",n.t=r),n},{e:void 0,t:void 0}),t})()}exports.EmbedDirectTemplate=D;exports.EmbedSignDocument=v;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { sharedConfig as
|
|
1
|
+
import { sharedConfig as r, untrack as N, createMemo as u, onMount as s, createRenderEffect as f } from "solid-js";
|
|
2
2
|
function b(e, d, m) {
|
|
3
3
|
let c;
|
|
4
4
|
const t = () => {
|
|
@@ -17,12 +17,12 @@ function v(e, d, m) {
|
|
|
17
17
|
return N(() => e(d, m));
|
|
18
18
|
}
|
|
19
19
|
function D(e) {
|
|
20
|
-
return !!
|
|
20
|
+
return !!r.context && !r.done && (!e || e.isConnected);
|
|
21
21
|
}
|
|
22
22
|
var h = /* @__PURE__ */ b("<iframe>");
|
|
23
23
|
function y(e) {
|
|
24
|
-
const d =
|
|
25
|
-
const t = e.host || "https://app.documenso.com", a = btoa(JSON.stringify({
|
|
24
|
+
const d = u(() => {
|
|
25
|
+
const t = e.host || "https://app.documenso.com", a = btoa(encodeURIComponent(JSON.stringify({
|
|
26
26
|
name: e.name,
|
|
27
27
|
lockName: e.lockName,
|
|
28
28
|
email: e.email,
|
|
@@ -30,11 +30,11 @@ function y(e) {
|
|
|
30
30
|
css: e.css,
|
|
31
31
|
cssVars: e.cssVars,
|
|
32
32
|
darkModeDisabled: e.darkModeDisabled
|
|
33
|
-
})), n = new URL(`/embed/direct/${e.token}`, t);
|
|
33
|
+
}))), n = new URL(`/embed/direct/${e.token}`, t);
|
|
34
34
|
return e.externalId && n.searchParams.set("externalId", e.externalId), `${n}#${a}`;
|
|
35
35
|
});
|
|
36
36
|
function m(t) {
|
|
37
|
-
var a, n, i,
|
|
37
|
+
var a, n, i, o, l;
|
|
38
38
|
if ((c == null ? void 0 : c.contentWindow) === t.source)
|
|
39
39
|
switch (t.data.action) {
|
|
40
40
|
case "document-ready":
|
|
@@ -47,10 +47,10 @@ function y(e) {
|
|
|
47
47
|
(i = e.onDocumentError) == null || i.call(e, t.data.data);
|
|
48
48
|
break;
|
|
49
49
|
case "field-signed":
|
|
50
|
-
(
|
|
50
|
+
(o = e.onFieldSigned) == null || o.call(e);
|
|
51
51
|
break;
|
|
52
52
|
case "field-unsigned":
|
|
53
|
-
(
|
|
53
|
+
(l = e.onFieldUnsigned) == null || l.call(e);
|
|
54
54
|
break;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -60,8 +60,8 @@ function y(e) {
|
|
|
60
60
|
}), (() => {
|
|
61
61
|
var t = h(), a = c;
|
|
62
62
|
return typeof a == "function" ? v(a, t) : c = t, f((n) => {
|
|
63
|
-
var i = e.className,
|
|
64
|
-
return i !== n.e && g(t, n.e = i),
|
|
63
|
+
var i = e.className, o = d();
|
|
64
|
+
return i !== n.e && g(t, n.e = i), o !== n.t && k(t, "src", n.t = o), n;
|
|
65
65
|
}, {
|
|
66
66
|
e: void 0,
|
|
67
67
|
t: void 0
|
|
@@ -70,14 +70,14 @@ function y(e) {
|
|
|
70
70
|
}
|
|
71
71
|
var E = /* @__PURE__ */ b("<iframe>");
|
|
72
72
|
function M(e) {
|
|
73
|
-
const d =
|
|
74
|
-
const t = e.host || "https://app.documenso.com", a = btoa(JSON.stringify({
|
|
73
|
+
const d = u(() => {
|
|
74
|
+
const t = e.host || "https://app.documenso.com", a = btoa(encodeURIComponent(JSON.stringify({
|
|
75
75
|
name: e.name,
|
|
76
76
|
lockName: e.lockName,
|
|
77
77
|
css: e.css,
|
|
78
78
|
cssVars: e.cssVars,
|
|
79
79
|
darkModeDisabled: e.darkModeDisabled
|
|
80
|
-
}));
|
|
80
|
+
})));
|
|
81
81
|
return `${new URL(`/embed/sign/${e.token}`, t)}#${a}`;
|
|
82
82
|
});
|
|
83
83
|
function m(t) {
|
|
@@ -101,8 +101,8 @@ function M(e) {
|
|
|
101
101
|
}), (() => {
|
|
102
102
|
var t = E(), a = c;
|
|
103
103
|
return typeof a == "function" ? v(a, t) : c = t, f((n) => {
|
|
104
|
-
var i = e.className,
|
|
105
|
-
return i !== n.e && g(t, n.e = i),
|
|
104
|
+
var i = e.className, o = d();
|
|
105
|
+
return i !== n.e && g(t, n.e = i), o !== n.t && k(t, "src", n.t = o), n;
|
|
106
106
|
}, {
|
|
107
107
|
e: void 0,
|
|
108
108
|
t: void 0
|