@documenso/embed-react 0.2.2 → 0.2.3
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 +139 -91
- package/dist/multisign-document.d.ts +38 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -4,3 +4,4 @@ export { default as unstable_EmbedCreateDocument } from './create-document';
|
|
|
4
4
|
export { default as unstable_EmbedCreateTemplate } from './create-template';
|
|
5
5
|
export { default as unstable_EmbedUpdateDocument } from './update-document';
|
|
6
6
|
export { default as unstable_EmbedUpdateTemplate } from './update-template';
|
|
7
|
+
export { default as unstable_EmbedMultiSignDocument } from './multisign-document';
|
package/dist/index.d.ts
CHANGED
|
@@ -4,3 +4,4 @@ export { default as unstable_EmbedCreateDocument } from './create-document';
|
|
|
4
4
|
export { default as unstable_EmbedCreateTemplate } from './create-template';
|
|
5
5
|
export { default as unstable_EmbedUpdateDocument } from './update-document';
|
|
6
6
|
export { default as unstable_EmbedUpdateTemplate } from './update-template';
|
|
7
|
+
export { default as unstable_EmbedMultiSignDocument } from './multisign-document';
|
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 l=require("react/jsx-runtime"),c=require("react");function f(e){const d=c.useRef(null);function m(){const t=e.host||"https://app.documenso.com",n=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}))),a=new URL(`/embed/direct/${e.token}`,t);return e.externalId&&a.searchParams.set("externalId",e.externalId),`${a}#${n}`}function s(t){var n,a,i,o,u,r;if(((n=d.current)==null?void 0:n.contentWindow)===t.source)switch(t.data.action){case"document-ready":(a=e.onDocumentReady)==null||a.call(e);break;case"document-completed":(i=e.onDocumentCompleted)==null||i.call(e,t.data.data);break;case"document-error":(o=e.onDocumentError)==null||o.call(e,t.data.data);break;case"field-signed":(u=e.onFieldSigned)==null||u.call(e);break;case"field-unsigned":(r=e.onFieldUnsigned)==null||r.call(e);break}}return c.useEffect(()=>{window.addEventListener("message",s)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",s)},[]),l.jsx("iframe",{ref:d,className:e.className,src:m()})}function b(e){const d=c.useRef(null);function m(){const t=e.host||"https://app.documenso.com",n=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}`,t)}#${n}`}function s(t){var n,a,i,o,u;if(((n=d.current)==null?void 0:n.contentWindow)===t.source)switch(t.data.action){case"document-ready":(a=e.onDocumentReady)==null||a.call(e);break;case"document-completed":(i=e.onDocumentCompleted)==null||i.call(e,t.data.data);break;case"document-error":(o=e.onDocumentError)==null||o.call(e,t.data.data);break;case"document-rejected":(u=e.onDocumentRejected)==null||u.call(e,t.data.data);break}}return c.useEffect(()=>{window.addEventListener("message",s)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",s)},[]),l.jsx("iframe",{ref:d,className:e.className,src:m()})}function k(e){const d=c.useRef(null);function m(){const t=e.host||"https://app.documenso.com",n=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),a=new URL("/embed/v1/authoring/document/create",t);return a.searchParams.set("token",e.presignToken),a.hash=n,a.toString()}function s(t){var n,a;if(((n=d.current)==null?void 0:n.contentWindow)===t.source)switch(t.data.type){case"document-created":(a=e.onDocumentCreated)==null||a.call(e,{documentId:t.data.documentId,externalId:t.data.externalId});break}}return c.useEffect(()=>{window.addEventListener("message",s)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",s)},[]),l.jsx("iframe",{ref:d,className:e.className,src:m()})}function g(e){const d=c.useRef(null);function m(){const t=e.host||"https://app.documenso.com",n=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),a=new URL("/embed/v1/authoring/template/create",t);return a.searchParams.set("token",e.presignToken),a.hash=n,a.toString()}function s(t){var n,a;if(((n=d.current)==null?void 0:n.contentWindow)===t.source)switch(t.data.type){case"template-created":(a=e.onTemplateCreated)==null||a.call(e,{templateId:t.data.templateId,externalId:t.data.externalId});break}}return c.useEffect(()=>{window.addEventListener("message",s)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",s)},[]),l.jsx("iframe",{ref:d,className:e.className,src:m()})}function w(e){const d=c.useRef(null);function m(){const t=e.host||"https://app.documenso.com",n=btoa(encodeURIComponent(JSON.stringify({token:e.presignToken,externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),a=new URL(`/embed/v1/authoring/document/edit/${e.documentId}`,t);return a.searchParams.set("token",e.presignToken),a.hash=n,a.toString()}function s(t){var n,a;if(((n=d.current)==null?void 0:n.contentWindow)===t.source)switch(t.data.type){case"document-updated":(a=e.onDocumentUpdated)==null||a.call(e,{documentId:t.data.documentId,externalId:t.data.externalId});break}}return c.useEffect(()=>{window.addEventListener("message",s)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",s)},[]),l.jsx("iframe",{ref:d,className:e.className,src:m()})}function E(e){const d=c.useRef(null);function m(){const t=e.host||"https://app.documenso.com",n=btoa(encodeURIComponent(JSON.stringify({externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps}))),a=new URL(`/embed/v1/authoring/template/edit/${e.templateId}`,t);return a.searchParams.set("token",e.presignToken),a.hash=n,a.toString()}function s(t){var n,a;if(((n=d.current)==null?void 0:n.contentWindow)===t.source)switch(t.data.type){case"template-updated":(a=e.onTemplateUpdated)==null||a.call(e,{templateId:t.data.templateId,externalId:t.data.externalId});break}}return c.useEffect(()=>{window.addEventListener("message",s)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",s)},[]),l.jsx("iframe",{ref:d,className:e.className,src:m()})}function h(e){const d=c.useRef(null);function m(){const t=e.host||"https://app.documenso.com",n=btoa(encodeURIComponent(JSON.stringify({name:e.name,lockName:e.lockName,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,allowDocumentRejection:e.allowDocumentRejection,...e.additionalProps}))),a=new URL("/embed/v1/multisign",t);for(const i of e.tokens)a.searchParams.append("token",i);return`${a}#${n}`}function s(t){var n,a,i,o,u,r;if(((n=d.current)==null?void 0:n.contentWindow)===t.source)switch(t.data.action){case"document-ready":(a=e.onDocumentReady)==null||a.call(e);break;case"document-completed":(i=e.onDocumentCompleted)==null||i.call(e,t.data.data);break;case"document-error":(o=e.onDocumentError)==null||o.call(e,t.data.data);break;case"document-rejected":(u=e.onDocumentRejected)==null||u.call(e,t.data.data);break;case"all-documents-completed":(r=e.onAllDocumentsCompleted)==null||r.call(e,t.data.data);break}}return c.useEffect(()=>{window.addEventListener("message",s)},[]),c.useEffect(()=>()=>{window.removeEventListener("message",s)},[]),l.jsx("iframe",{ref:d,className:e.className,src:m()})}exports.EmbedDirectTemplate=f;exports.EmbedSignDocument=b;exports.unstable_EmbedCreateDocument=k;exports.unstable_EmbedCreateTemplate=g;exports.unstable_EmbedMultiSignDocument=h;exports.unstable_EmbedUpdateDocument=w;exports.unstable_EmbedUpdateTemplate=E;
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
function
|
|
4
|
-
const d =
|
|
5
|
-
function
|
|
6
|
-
const
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as r, useEffect as s } from "react";
|
|
3
|
+
function w(e) {
|
|
4
|
+
const d = r(null);
|
|
5
|
+
function m() {
|
|
6
|
+
const a = e.host || "https://app.documenso.com", n = btoa(
|
|
7
7
|
encodeURIComponent(
|
|
8
8
|
JSON.stringify({
|
|
9
9
|
name: e.name,
|
|
@@ -16,24 +16,24 @@ function g(e) {
|
|
|
16
16
|
...e.additionalProps
|
|
17
17
|
})
|
|
18
18
|
)
|
|
19
|
-
),
|
|
20
|
-
return e.externalId &&
|
|
19
|
+
), t = new URL(`/embed/direct/${e.token}`, a);
|
|
20
|
+
return e.externalId && t.searchParams.set("externalId", e.externalId), `${t}#${n}`;
|
|
21
21
|
}
|
|
22
|
-
function c(
|
|
23
|
-
var n,
|
|
24
|
-
if (((n = d.current) == null ? void 0 : n.contentWindow) ===
|
|
25
|
-
switch (
|
|
22
|
+
function c(a) {
|
|
23
|
+
var n, t, i, o, l, f;
|
|
24
|
+
if (((n = d.current) == null ? void 0 : n.contentWindow) === a.source)
|
|
25
|
+
switch (a.data.action) {
|
|
26
26
|
case "document-ready":
|
|
27
|
-
(
|
|
27
|
+
(t = e.onDocumentReady) == null || t.call(e);
|
|
28
28
|
break;
|
|
29
29
|
case "document-completed":
|
|
30
|
-
(
|
|
30
|
+
(i = e.onDocumentCompleted) == null || i.call(e, a.data.data);
|
|
31
31
|
break;
|
|
32
32
|
case "document-error":
|
|
33
|
-
(
|
|
33
|
+
(o = e.onDocumentError) == null || o.call(e, a.data.data);
|
|
34
34
|
break;
|
|
35
35
|
case "field-signed":
|
|
36
|
-
(
|
|
36
|
+
(l = e.onFieldSigned) == null || l.call(e);
|
|
37
37
|
break;
|
|
38
38
|
case "field-unsigned":
|
|
39
39
|
(f = e.onFieldUnsigned) == null || f.call(e);
|
|
@@ -44,12 +44,12 @@ function g(e) {
|
|
|
44
44
|
window.addEventListener("message", c);
|
|
45
45
|
}, []), s(() => () => {
|
|
46
46
|
window.removeEventListener("message", c);
|
|
47
|
-
}, []), /* @__PURE__ */
|
|
47
|
+
}, []), /* @__PURE__ */ u("iframe", { ref: d, className: e.className, src: m() });
|
|
48
48
|
}
|
|
49
|
-
function
|
|
50
|
-
const d =
|
|
51
|
-
function
|
|
52
|
-
const
|
|
49
|
+
function g(e) {
|
|
50
|
+
const d = r(null);
|
|
51
|
+
function m() {
|
|
52
|
+
const a = e.host || "https://app.documenso.com", n = btoa(
|
|
53
53
|
encodeURIComponent(
|
|
54
54
|
JSON.stringify({
|
|
55
55
|
name: e.name,
|
|
@@ -62,23 +62,23 @@ function k(e) {
|
|
|
62
62
|
})
|
|
63
63
|
)
|
|
64
64
|
);
|
|
65
|
-
return `${new URL(`/embed/sign/${e.token}`,
|
|
65
|
+
return `${new URL(`/embed/sign/${e.token}`, a)}#${n}`;
|
|
66
66
|
}
|
|
67
|
-
function c(
|
|
68
|
-
var n,
|
|
69
|
-
if (((n = d.current) == null ? void 0 : n.contentWindow) ===
|
|
70
|
-
switch (
|
|
67
|
+
function c(a) {
|
|
68
|
+
var n, t, i, o, l;
|
|
69
|
+
if (((n = d.current) == null ? void 0 : n.contentWindow) === a.source)
|
|
70
|
+
switch (a.data.action) {
|
|
71
71
|
case "document-ready":
|
|
72
|
-
(
|
|
72
|
+
(t = e.onDocumentReady) == null || t.call(e);
|
|
73
73
|
break;
|
|
74
74
|
case "document-completed":
|
|
75
|
-
(
|
|
75
|
+
(i = e.onDocumentCompleted) == null || i.call(e, a.data.data);
|
|
76
76
|
break;
|
|
77
77
|
case "document-error":
|
|
78
|
-
(
|
|
78
|
+
(o = e.onDocumentError) == null || o.call(e, a.data.data);
|
|
79
79
|
break;
|
|
80
80
|
case "document-rejected":
|
|
81
|
-
(
|
|
81
|
+
(l = e.onDocumentRejected) == null || l.call(e, a.data.data);
|
|
82
82
|
break;
|
|
83
83
|
}
|
|
84
84
|
}
|
|
@@ -86,12 +86,12 @@ function k(e) {
|
|
|
86
86
|
window.addEventListener("message", c);
|
|
87
87
|
}, []), s(() => () => {
|
|
88
88
|
window.removeEventListener("message", c);
|
|
89
|
-
}, []), /* @__PURE__ */
|
|
89
|
+
}, []), /* @__PURE__ */ u("iframe", { ref: d, className: e.className, src: m() });
|
|
90
90
|
}
|
|
91
91
|
function h(e) {
|
|
92
|
-
const d =
|
|
93
|
-
function
|
|
94
|
-
const
|
|
92
|
+
const d = r(null);
|
|
93
|
+
function m() {
|
|
94
|
+
const a = e.host || "https://app.documenso.com", n = btoa(
|
|
95
95
|
encodeURIComponent(
|
|
96
96
|
JSON.stringify({
|
|
97
97
|
externalId: e.externalId,
|
|
@@ -102,17 +102,17 @@ function h(e) {
|
|
|
102
102
|
...e.additionalProps
|
|
103
103
|
})
|
|
104
104
|
)
|
|
105
|
-
),
|
|
106
|
-
return
|
|
105
|
+
), t = new URL("/embed/v1/authoring/document/create", a);
|
|
106
|
+
return t.searchParams.set("token", e.presignToken), t.hash = n, t.toString();
|
|
107
107
|
}
|
|
108
|
-
function c(
|
|
109
|
-
var n,
|
|
110
|
-
if (((n = d.current) == null ? void 0 : n.contentWindow) ===
|
|
111
|
-
switch (
|
|
108
|
+
function c(a) {
|
|
109
|
+
var n, t;
|
|
110
|
+
if (((n = d.current) == null ? void 0 : n.contentWindow) === a.source)
|
|
111
|
+
switch (a.data.type) {
|
|
112
112
|
case "document-created":
|
|
113
|
-
(
|
|
114
|
-
documentId:
|
|
115
|
-
externalId:
|
|
113
|
+
(t = e.onDocumentCreated) == null || t.call(e, {
|
|
114
|
+
documentId: a.data.documentId,
|
|
115
|
+
externalId: a.data.externalId
|
|
116
116
|
});
|
|
117
117
|
break;
|
|
118
118
|
}
|
|
@@ -121,12 +121,12 @@ function h(e) {
|
|
|
121
121
|
window.addEventListener("message", c);
|
|
122
122
|
}, []), s(() => () => {
|
|
123
123
|
window.removeEventListener("message", c);
|
|
124
|
-
}, []), /* @__PURE__ */
|
|
124
|
+
}, []), /* @__PURE__ */ u("iframe", { ref: d, className: e.className, src: m() });
|
|
125
125
|
}
|
|
126
|
-
function
|
|
127
|
-
const d =
|
|
128
|
-
function
|
|
129
|
-
const
|
|
126
|
+
function D(e) {
|
|
127
|
+
const d = r(null);
|
|
128
|
+
function m() {
|
|
129
|
+
const a = e.host || "https://app.documenso.com", n = btoa(
|
|
130
130
|
encodeURIComponent(
|
|
131
131
|
JSON.stringify({
|
|
132
132
|
externalId: e.externalId,
|
|
@@ -137,17 +137,17 @@ function I(e) {
|
|
|
137
137
|
...e.additionalProps
|
|
138
138
|
})
|
|
139
139
|
)
|
|
140
|
-
),
|
|
141
|
-
return
|
|
140
|
+
), t = new URL("/embed/v1/authoring/template/create", a);
|
|
141
|
+
return t.searchParams.set("token", e.presignToken), t.hash = n, t.toString();
|
|
142
142
|
}
|
|
143
|
-
function c(
|
|
144
|
-
var n,
|
|
145
|
-
if (((n = d.current) == null ? void 0 : n.contentWindow) ===
|
|
146
|
-
switch (
|
|
143
|
+
function c(a) {
|
|
144
|
+
var n, t;
|
|
145
|
+
if (((n = d.current) == null ? void 0 : n.contentWindow) === a.source)
|
|
146
|
+
switch (a.data.type) {
|
|
147
147
|
case "template-created":
|
|
148
|
-
(
|
|
149
|
-
templateId:
|
|
150
|
-
externalId:
|
|
148
|
+
(t = e.onTemplateCreated) == null || t.call(e, {
|
|
149
|
+
templateId: a.data.templateId,
|
|
150
|
+
externalId: a.data.externalId
|
|
151
151
|
});
|
|
152
152
|
break;
|
|
153
153
|
}
|
|
@@ -156,12 +156,12 @@ function I(e) {
|
|
|
156
156
|
window.addEventListener("message", c);
|
|
157
157
|
}, []), s(() => () => {
|
|
158
158
|
window.removeEventListener("message", c);
|
|
159
|
-
}, []), /* @__PURE__ */
|
|
159
|
+
}, []), /* @__PURE__ */ u("iframe", { ref: d, className: e.className, src: m() });
|
|
160
160
|
}
|
|
161
|
-
function
|
|
162
|
-
const d =
|
|
163
|
-
function
|
|
164
|
-
const
|
|
161
|
+
function I(e) {
|
|
162
|
+
const d = r(null);
|
|
163
|
+
function m() {
|
|
164
|
+
const a = e.host || "https://app.documenso.com", n = btoa(
|
|
165
165
|
encodeURIComponent(
|
|
166
166
|
JSON.stringify({
|
|
167
167
|
token: e.presignToken,
|
|
@@ -173,20 +173,20 @@ function D(e) {
|
|
|
173
173
|
...e.additionalProps
|
|
174
174
|
})
|
|
175
175
|
)
|
|
176
|
-
),
|
|
176
|
+
), t = new URL(
|
|
177
177
|
`/embed/v1/authoring/document/edit/${e.documentId}`,
|
|
178
|
-
|
|
178
|
+
a
|
|
179
179
|
);
|
|
180
|
-
return
|
|
180
|
+
return t.searchParams.set("token", e.presignToken), t.hash = n, t.toString();
|
|
181
181
|
}
|
|
182
|
-
function c(
|
|
183
|
-
var n,
|
|
184
|
-
if (((n = d.current) == null ? void 0 : n.contentWindow) ===
|
|
185
|
-
switch (
|
|
182
|
+
function c(a) {
|
|
183
|
+
var n, t;
|
|
184
|
+
if (((n = d.current) == null ? void 0 : n.contentWindow) === a.source)
|
|
185
|
+
switch (a.data.type) {
|
|
186
186
|
case "document-updated":
|
|
187
|
-
(
|
|
188
|
-
documentId:
|
|
189
|
-
externalId:
|
|
187
|
+
(t = e.onDocumentUpdated) == null || t.call(e, {
|
|
188
|
+
documentId: a.data.documentId,
|
|
189
|
+
externalId: a.data.externalId
|
|
190
190
|
});
|
|
191
191
|
break;
|
|
192
192
|
}
|
|
@@ -195,12 +195,12 @@ function D(e) {
|
|
|
195
195
|
window.addEventListener("message", c);
|
|
196
196
|
}, []), s(() => () => {
|
|
197
197
|
window.removeEventListener("message", c);
|
|
198
|
-
}, []), /* @__PURE__ */
|
|
198
|
+
}, []), /* @__PURE__ */ u("iframe", { ref: d, className: e.className, src: m() });
|
|
199
199
|
}
|
|
200
200
|
function E(e) {
|
|
201
|
-
const d =
|
|
202
|
-
function
|
|
203
|
-
const
|
|
201
|
+
const d = r(null);
|
|
202
|
+
function m() {
|
|
203
|
+
const a = e.host || "https://app.documenso.com", n = btoa(
|
|
204
204
|
encodeURIComponent(
|
|
205
205
|
JSON.stringify({
|
|
206
206
|
externalId: e.externalId,
|
|
@@ -211,20 +211,20 @@ function E(e) {
|
|
|
211
211
|
...e.additionalProps
|
|
212
212
|
})
|
|
213
213
|
)
|
|
214
|
-
),
|
|
214
|
+
), t = new URL(
|
|
215
215
|
`/embed/v1/authoring/template/edit/${e.templateId}`,
|
|
216
|
-
|
|
216
|
+
a
|
|
217
217
|
);
|
|
218
|
-
return
|
|
218
|
+
return t.searchParams.set("token", e.presignToken), t.hash = n, t.toString();
|
|
219
219
|
}
|
|
220
|
-
function c(
|
|
221
|
-
var n,
|
|
222
|
-
if (((n = d.current) == null ? void 0 : n.contentWindow) ===
|
|
223
|
-
switch (
|
|
220
|
+
function c(a) {
|
|
221
|
+
var n, t;
|
|
222
|
+
if (((n = d.current) == null ? void 0 : n.contentWindow) === a.source)
|
|
223
|
+
switch (a.data.type) {
|
|
224
224
|
case "template-updated":
|
|
225
|
-
(
|
|
226
|
-
templateId:
|
|
227
|
-
externalId:
|
|
225
|
+
(t = e.onTemplateUpdated) == null || t.call(e, {
|
|
226
|
+
templateId: a.data.templateId,
|
|
227
|
+
externalId: a.data.externalId
|
|
228
228
|
});
|
|
229
229
|
break;
|
|
230
230
|
}
|
|
@@ -233,13 +233,61 @@ function E(e) {
|
|
|
233
233
|
window.addEventListener("message", c);
|
|
234
234
|
}, []), s(() => () => {
|
|
235
235
|
window.removeEventListener("message", c);
|
|
236
|
-
}, []), /* @__PURE__ */
|
|
236
|
+
}, []), /* @__PURE__ */ u("iframe", { ref: d, className: e.className, src: m() });
|
|
237
|
+
}
|
|
238
|
+
function U(e) {
|
|
239
|
+
const d = r(null);
|
|
240
|
+
function m() {
|
|
241
|
+
const a = e.host || "https://app.documenso.com", n = btoa(
|
|
242
|
+
encodeURIComponent(
|
|
243
|
+
JSON.stringify({
|
|
244
|
+
name: e.name,
|
|
245
|
+
lockName: e.lockName,
|
|
246
|
+
css: e.css,
|
|
247
|
+
cssVars: e.cssVars,
|
|
248
|
+
darkModeDisabled: e.darkModeDisabled,
|
|
249
|
+
allowDocumentRejection: e.allowDocumentRejection,
|
|
250
|
+
...e.additionalProps
|
|
251
|
+
})
|
|
252
|
+
)
|
|
253
|
+
), t = new URL("/embed/v1/multisign", a);
|
|
254
|
+
for (const i of e.tokens)
|
|
255
|
+
t.searchParams.append("token", i);
|
|
256
|
+
return `${t}#${n}`;
|
|
257
|
+
}
|
|
258
|
+
function c(a) {
|
|
259
|
+
var n, t, i, o, l, f;
|
|
260
|
+
if (((n = d.current) == null ? void 0 : n.contentWindow) === a.source)
|
|
261
|
+
switch (a.data.action) {
|
|
262
|
+
case "document-ready":
|
|
263
|
+
(t = e.onDocumentReady) == null || t.call(e);
|
|
264
|
+
break;
|
|
265
|
+
case "document-completed":
|
|
266
|
+
(i = e.onDocumentCompleted) == null || i.call(e, a.data.data);
|
|
267
|
+
break;
|
|
268
|
+
case "document-error":
|
|
269
|
+
(o = e.onDocumentError) == null || o.call(e, a.data.data);
|
|
270
|
+
break;
|
|
271
|
+
case "document-rejected":
|
|
272
|
+
(l = e.onDocumentRejected) == null || l.call(e, a.data.data);
|
|
273
|
+
break;
|
|
274
|
+
case "all-documents-completed":
|
|
275
|
+
(f = e.onAllDocumentsCompleted) == null || f.call(e, a.data.data);
|
|
276
|
+
break;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return s(() => {
|
|
280
|
+
window.addEventListener("message", c);
|
|
281
|
+
}, []), s(() => () => {
|
|
282
|
+
window.removeEventListener("message", c);
|
|
283
|
+
}, []), /* @__PURE__ */ u("iframe", { ref: d, className: e.className, src: m() });
|
|
237
284
|
}
|
|
238
285
|
export {
|
|
239
|
-
|
|
240
|
-
|
|
286
|
+
w as EmbedDirectTemplate,
|
|
287
|
+
g as EmbedSignDocument,
|
|
241
288
|
h as unstable_EmbedCreateDocument,
|
|
242
|
-
|
|
243
|
-
|
|
289
|
+
D as unstable_EmbedCreateTemplate,
|
|
290
|
+
U as unstable_EmbedMultiSignDocument,
|
|
291
|
+
I as unstable_EmbedUpdateDocument,
|
|
244
292
|
E as unstable_EmbedUpdateTemplate
|
|
245
293
|
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { CssVars } from './css-vars';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export type EmbedMultiSignDocumentProps = {
|
|
4
|
+
className?: string;
|
|
5
|
+
host?: string;
|
|
6
|
+
tokens: string[];
|
|
7
|
+
css?: string | undefined;
|
|
8
|
+
cssVars?: (CssVars & Record<string, string>) | undefined;
|
|
9
|
+
darkModeDisabled?: boolean | undefined;
|
|
10
|
+
name?: string | undefined;
|
|
11
|
+
lockName?: boolean | undefined;
|
|
12
|
+
allowDocumentRejection?: boolean | undefined;
|
|
13
|
+
additionalProps?: Record<string, string | number | boolean> | undefined;
|
|
14
|
+
onDocumentReady?: () => void;
|
|
15
|
+
onDocumentCompleted?: (data: {
|
|
16
|
+
token: string;
|
|
17
|
+
documentId: number;
|
|
18
|
+
recipientId: number;
|
|
19
|
+
}) => void;
|
|
20
|
+
onDocumentError?: (error: string) => void;
|
|
21
|
+
onDocumentRejected?: (data: {
|
|
22
|
+
token: string;
|
|
23
|
+
documentId: number;
|
|
24
|
+
recipientId: number;
|
|
25
|
+
reason: string;
|
|
26
|
+
}) => void;
|
|
27
|
+
onAllDocumentsCompleted?: (data: {
|
|
28
|
+
documents: Array<{
|
|
29
|
+
token: string;
|
|
30
|
+
documentId: number;
|
|
31
|
+
recipientId: number;
|
|
32
|
+
action: "document-completed" | "document-rejected";
|
|
33
|
+
reason?: string;
|
|
34
|
+
}>;
|
|
35
|
+
}) => void;
|
|
36
|
+
};
|
|
37
|
+
declare function EmbedMultiSignDocument(props: EmbedMultiSignDocumentProps): React.JSX.Element;
|
|
38
|
+
export default EmbedMultiSignDocument;
|