@documenso/embed-react 0.2.0-rc.0 → 0.2.0-rc.1
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 +23 -19
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),c=require("react");function f(e){const d=c.useRef(null);function u(){const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),c=require("react");function f(e){const d=c.useRef(null);function u(){const n=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}))),t=new URL(`/embed/direct/${e.token}`,n);return e.externalId&&t.searchParams.set("externalId",e.externalId),`${t}#${a}`}function i(n){var a,t,m,s,l,o;if(((a=d.current)==null?void 0:a.contentWindow)===n.source)switch(n.data.action){case"document-ready":(t=e.onDocumentReady)==null||t.call(e);break;case"document-completed":(m=e.onDocumentCompleted)==null||m.call(e,n.data.data);break;case"document-error":(s=e.onDocumentError)==null||s.call(e,n.data.data);break;case"field-signed":(l=e.onFieldSigned)==null||l.call(e);break;case"field-unsigned":(o=e.onFieldUnsigned)==null||o.call(e);break}}return c.useEffect(()=>{window.addEventListener("message",i)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",i)},[]),r.jsx("iframe",{ref:d,className:e.className,src:u()})}function b(e){const d=c.useRef(null);function u(){const n=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}`,n)}#${a}`}function i(n){var a,t,m,s;if(((a=d.current)==null?void 0:a.contentWindow)===n.source)switch(n.data.action){case"document-ready":(t=e.onDocumentReady)==null||t.call(e);break;case"document-completed":(m=e.onDocumentCompleted)==null||m.call(e,n.data.data);break;case"document-error":(s=e.onDocumentError)==null||s.call(e,n.data.data);break}}return c.useEffect(()=>{window.addEventListener("message",i)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",i)},[]),r.jsx("iframe",{ref:d,className:e.className,src:u()})}exports.EmbedDirectTemplate=f;exports.EmbedSignDocument=b;
|
package/dist/index.mjs
CHANGED
|
@@ -4,20 +4,22 @@ function g(e) {
|
|
|
4
4
|
const c = f(null);
|
|
5
5
|
function s() {
|
|
6
6
|
const a = e.host || "https://app.documenso.com", n = btoa(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
encodeURIComponent(
|
|
8
|
+
JSON.stringify({
|
|
9
|
+
name: e.name,
|
|
10
|
+
lockName: e.lockName,
|
|
11
|
+
email: e.email,
|
|
12
|
+
lockEmail: e.lockEmail,
|
|
13
|
+
css: e.css,
|
|
14
|
+
cssVars: e.cssVars,
|
|
15
|
+
darkModeDisabled: e.darkModeDisabled
|
|
16
|
+
})
|
|
17
|
+
)
|
|
16
18
|
), t = new URL(`/embed/direct/${e.token}`, a);
|
|
17
19
|
return e.externalId && t.searchParams.set("externalId", e.externalId), `${t}#${n}`;
|
|
18
20
|
}
|
|
19
21
|
function d(a) {
|
|
20
|
-
var n, t, m, i,
|
|
22
|
+
var n, t, m, i, o, u;
|
|
21
23
|
if (((n = c.current) == null ? void 0 : n.contentWindow) === a.source)
|
|
22
24
|
switch (a.data.action) {
|
|
23
25
|
case "document-ready":
|
|
@@ -30,10 +32,10 @@ function g(e) {
|
|
|
30
32
|
(i = e.onDocumentError) == null || i.call(e, a.data.data);
|
|
31
33
|
break;
|
|
32
34
|
case "field-signed":
|
|
33
|
-
(
|
|
35
|
+
(o = e.onFieldSigned) == null || o.call(e);
|
|
34
36
|
break;
|
|
35
37
|
case "field-unsigned":
|
|
36
|
-
(
|
|
38
|
+
(u = e.onFieldUnsigned) == null || u.call(e);
|
|
37
39
|
break;
|
|
38
40
|
}
|
|
39
41
|
}
|
|
@@ -47,13 +49,15 @@ function w(e) {
|
|
|
47
49
|
const c = f(null);
|
|
48
50
|
function s() {
|
|
49
51
|
const a = e.host || "https://app.documenso.com", n = btoa(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
encodeURIComponent(
|
|
53
|
+
JSON.stringify({
|
|
54
|
+
name: e.name,
|
|
55
|
+
lockName: e.lockName,
|
|
56
|
+
css: e.css,
|
|
57
|
+
cssVars: e.cssVars,
|
|
58
|
+
darkModeDisabled: e.darkModeDisabled
|
|
59
|
+
})
|
|
60
|
+
)
|
|
57
61
|
);
|
|
58
62
|
return `${new URL(`/embed/sign/${e.token}`, a)}#${n}`;
|
|
59
63
|
}
|