@documenso/embed-solid 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 +130 -85
- package/dist/multisign-document.d.ts +37 -0
- package/package.json +2 -2
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 d=require("solid-js");function m(e,o,i){let c;const t=()=>{const a=document.createElement("template");return a.innerHTML=e,a.content.firstChild},n=()=>(c||(c=t())).cloneNode(!0);return n.cloneNode=n,n}function u(e,o,i){b(e)||(i==null?e.removeAttribute(o):e.setAttribute(o,i))}function l(e,o){b(e)||(o==null?e.removeAttribute("class"):e.className=o)}function f(e,o,i){return d.untrack(()=>e(o,i))}function b(e){return!!d.sharedConfig.context&&!d.sharedConfig.done&&(!e||e.isConnected)}var k=m("<iframe>");function g(e){const o=d.createMemo(()=>{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 i(t){if(c?.contentWindow===t.source)switch(t.data.action){case"document-ready":e.onDocumentReady?.();break;case"document-completed":e.onDocumentCompleted?.(t.data.data);break;case"document-error":e.onDocumentError?.(t.data.data);break;case"field-signed":e.onFieldSigned?.();break;case"field-unsigned":e.onFieldUnsigned?.();break}}let c;return d.onMount(()=>{window.addEventListener("message",i)}),(()=>{var t=k(),n=c;return typeof n=="function"?f(n,t):c=t,d.createRenderEffect(a=>{var r=e.className,s=o();return r!==a.e&&l(t,a.e=r),s!==a.t&&u(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}var h=m("<iframe>");function v(e){const o=d.createMemo(()=>{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 i(t){if(c?.contentWindow===t.source)switch(t.data.action){case"document-ready":e.onDocumentReady?.();break;case"document-completed":e.onDocumentCompleted?.(t.data.data);break;case"document-error":e.onDocumentError?.(t.data.data);break;case"document-rejected":e.onDocumentRejected?.(t.data.data);break}}let c;return d.onMount(()=>{window.addEventListener("message",i)}),(()=>{var t=h(),n=c;return typeof n=="function"?f(n,t):c=t,d.createRenderEffect(a=>{var r=e.className,s=o();return r!==a.e&&l(t,a.e=r),s!==a.t&&u(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}var D=m("<iframe>");function w(e){const o=d.createMemo(()=>{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 i(t){if(c?.contentWindow===t.source)switch(t.data.type){case"document-created":e.onDocumentCreated?.({documentId:t.data.documentId,externalId:t.data.externalId});break}}let c;return d.onMount(()=>{window.addEventListener("message",i)}),(()=>{var t=D(),n=c;return typeof n=="function"?f(n,t):c=t,d.createRenderEffect(a=>{var r=e.className,s=o();return r!==a.e&&l(t,a.e=r),s!==a.t&&u(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}var M=m("<iframe>");function I(e){const o=d.createMemo(()=>{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 i(t){if(c?.contentWindow===t.source)switch(t.data.type){case"template-created":e.onTemplateCreated?.({templateId:t.data.templateId,externalId:t.data.externalId});break}}let c;return d.onMount(()=>{window.addEventListener("message",i)}),(()=>{var t=M(),n=c;return typeof n=="function"?f(n,t):c=t,d.createRenderEffect(a=>{var r=e.className,s=o();return r!==a.e&&l(t,a.e=r),s!==a.t&&u(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}var E=m("<iframe>");function R(e){const o=d.createMemo(()=>{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 i(t){if(c?.contentWindow===t.source)switch(t.data.type){case"document-updated":e.onDocumentUpdated?.({documentId:t.data.documentId,externalId:t.data.externalId});break}}let c;return d.onMount(()=>{window.addEventListener("message",i)}),(()=>{var t=E(),n=c;return typeof n=="function"?f(n,t):c=t,d.createRenderEffect(a=>{var r=e.className,s=o();return r!==a.e&&l(t,a.e=r),s!==a.t&&u(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}var U=m("<iframe>");function y(e){const o=d.createMemo(()=>{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 i(t){if(c?.contentWindow===t.source)switch(t.data.type){case"template-updated":e.onTemplateUpdated?.({templateId:t.data.templateId,externalId:t.data.externalId});break}}let c;return d.onMount(()=>{window.addEventListener("message",i)}),(()=>{var t=U(),n=c;return typeof n=="function"?f(n,t):c=t,d.createRenderEffect(a=>{var r=e.className,s=o();return r!==a.e&&l(t,a.e=r),s!==a.t&&u(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}var _=m("<iframe>");function N(e){const o=d.createMemo(()=>{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 r of e.tokens)a.searchParams.append("token",r);return`${a}#${n}`});function i(t){if(c?.contentWindow===t.source)switch(t.data.action){case"document-ready":e.onDocumentReady?.();break;case"document-completed":e.onDocumentCompleted?.(t.data.data);break;case"document-error":e.onDocumentError?.(t.data.data);break;case"document-rejected":e.onDocumentRejected?.(t.data.data);break;case"all-documents-completed":e.onAllDocumentsCompleted?.(t.data.data);break}}let c;return d.onMount(()=>{window.addEventListener("message",i)}),(()=>{var t=_(),n=c;return typeof n=="function"?f(n,t):c=t,d.createRenderEffect(a=>{var r=e.className,s=o();return r!==a.e&&l(t,a.e=r),s!==a.t&&u(t,"src",a.t=s),a},{e:void 0,t:void 0}),t})()}exports.EmbedDirectTemplate=g;exports.EmbedSignDocument=v;exports.unstable_EmbedCreateDocument=w;exports.unstable_EmbedCreateTemplate=I;exports.unstable_EmbedMultiSignDocument=N;exports.unstable_EmbedUpdateDocument=R;exports.unstable_EmbedUpdateTemplate=y;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
function u(e,
|
|
1
|
+
import { untrack as v, sharedConfig as h, createMemo as i, onMount as m, createRenderEffect as l } from "solid-js";
|
|
2
|
+
function u(e, c, r) {
|
|
3
3
|
let d;
|
|
4
4
|
const t = () => {
|
|
5
5
|
const a = document.createElement("template");
|
|
@@ -7,21 +7,21 @@ function u(e, i, o) {
|
|
|
7
7
|
}, n = () => (d || (d = t())).cloneNode(!0);
|
|
8
8
|
return n.cloneNode = n, n;
|
|
9
9
|
}
|
|
10
|
-
function f(e,
|
|
11
|
-
|
|
10
|
+
function f(e, c, r) {
|
|
11
|
+
g(e) || (r == null ? e.removeAttribute(c) : e.setAttribute(c, r));
|
|
12
12
|
}
|
|
13
|
-
function b(e,
|
|
14
|
-
|
|
13
|
+
function b(e, c) {
|
|
14
|
+
g(e) || (c == null ? e.removeAttribute("class") : e.className = c);
|
|
15
15
|
}
|
|
16
|
-
function k(e,
|
|
17
|
-
return
|
|
16
|
+
function k(e, c, r) {
|
|
17
|
+
return v(() => e(c, r));
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
return !!
|
|
19
|
+
function g(e) {
|
|
20
|
+
return !!h.context && !h.done && (!e || e.isConnected);
|
|
21
21
|
}
|
|
22
|
-
var
|
|
22
|
+
var D = /* @__PURE__ */ u("<iframe>");
|
|
23
23
|
function N(e) {
|
|
24
|
-
const
|
|
24
|
+
const c = i(() => {
|
|
25
25
|
const t = e.host || "https://app.documenso.com", n = btoa(encodeURIComponent(JSON.stringify({
|
|
26
26
|
name: e.name,
|
|
27
27
|
lockName: e.lockName,
|
|
@@ -34,44 +34,43 @@ function N(e) {
|
|
|
34
34
|
}))), a = new URL(`/embed/direct/${e.token}`, t);
|
|
35
35
|
return e.externalId && a.searchParams.set("externalId", e.externalId), `${a}#${n}`;
|
|
36
36
|
});
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
if ((d == null ? void 0 : d.contentWindow) === t.source)
|
|
37
|
+
function r(t) {
|
|
38
|
+
if (d?.contentWindow === t.source)
|
|
40
39
|
switch (t.data.action) {
|
|
41
40
|
case "document-ready":
|
|
42
|
-
|
|
41
|
+
e.onDocumentReady?.();
|
|
43
42
|
break;
|
|
44
43
|
case "document-completed":
|
|
45
|
-
|
|
44
|
+
e.onDocumentCompleted?.(t.data.data);
|
|
46
45
|
break;
|
|
47
46
|
case "document-error":
|
|
48
|
-
|
|
47
|
+
e.onDocumentError?.(t.data.data);
|
|
49
48
|
break;
|
|
50
49
|
case "field-signed":
|
|
51
|
-
|
|
50
|
+
e.onFieldSigned?.();
|
|
52
51
|
break;
|
|
53
52
|
case "field-unsigned":
|
|
54
|
-
|
|
53
|
+
e.onFieldUnsigned?.();
|
|
55
54
|
break;
|
|
56
55
|
}
|
|
57
56
|
}
|
|
58
57
|
let d;
|
|
59
58
|
return m(() => {
|
|
60
|
-
window.addEventListener("message",
|
|
59
|
+
window.addEventListener("message", r);
|
|
61
60
|
}), (() => {
|
|
62
|
-
var t =
|
|
61
|
+
var t = D(), n = d;
|
|
63
62
|
return typeof n == "function" ? k(n, t) : d = t, l((a) => {
|
|
64
|
-
var
|
|
65
|
-
return
|
|
63
|
+
var o = e.className, s = c();
|
|
64
|
+
return o !== a.e && b(t, a.e = o), s !== a.t && f(t, "src", a.t = s), a;
|
|
66
65
|
}, {
|
|
67
66
|
e: void 0,
|
|
68
67
|
t: void 0
|
|
69
68
|
}), t;
|
|
70
69
|
})();
|
|
71
70
|
}
|
|
72
|
-
var
|
|
73
|
-
function
|
|
74
|
-
const
|
|
71
|
+
var w = /* @__PURE__ */ u("<iframe>");
|
|
72
|
+
function R(e) {
|
|
73
|
+
const c = i(() => {
|
|
75
74
|
const t = e.host || "https://app.documenso.com", n = btoa(encodeURIComponent(JSON.stringify({
|
|
76
75
|
name: e.name,
|
|
77
76
|
lockName: e.lockName,
|
|
@@ -83,41 +82,40 @@ function $(e) {
|
|
|
83
82
|
})));
|
|
84
83
|
return `${new URL(`/embed/sign/${e.token}`, t)}#${n}`;
|
|
85
84
|
});
|
|
86
|
-
function
|
|
87
|
-
|
|
88
|
-
if ((d == null ? void 0 : d.contentWindow) === t.source)
|
|
85
|
+
function r(t) {
|
|
86
|
+
if (d?.contentWindow === t.source)
|
|
89
87
|
switch (t.data.action) {
|
|
90
88
|
case "document-ready":
|
|
91
|
-
|
|
89
|
+
e.onDocumentReady?.();
|
|
92
90
|
break;
|
|
93
91
|
case "document-completed":
|
|
94
|
-
|
|
92
|
+
e.onDocumentCompleted?.(t.data.data);
|
|
95
93
|
break;
|
|
96
94
|
case "document-error":
|
|
97
|
-
|
|
95
|
+
e.onDocumentError?.(t.data.data);
|
|
98
96
|
break;
|
|
99
97
|
case "document-rejected":
|
|
100
|
-
|
|
98
|
+
e.onDocumentRejected?.(t.data.data);
|
|
101
99
|
break;
|
|
102
100
|
}
|
|
103
101
|
}
|
|
104
102
|
let d;
|
|
105
103
|
return m(() => {
|
|
106
|
-
window.addEventListener("message",
|
|
104
|
+
window.addEventListener("message", r);
|
|
107
105
|
}), (() => {
|
|
108
|
-
var t =
|
|
106
|
+
var t = w(), n = d;
|
|
109
107
|
return typeof n == "function" ? k(n, t) : d = t, l((a) => {
|
|
110
|
-
var
|
|
111
|
-
return
|
|
108
|
+
var o = e.className, s = c();
|
|
109
|
+
return o !== a.e && b(t, a.e = o), s !== a.t && f(t, "src", a.t = s), a;
|
|
112
110
|
}, {
|
|
113
111
|
e: void 0,
|
|
114
112
|
t: void 0
|
|
115
113
|
}), t;
|
|
116
114
|
})();
|
|
117
115
|
}
|
|
118
|
-
var
|
|
119
|
-
function
|
|
120
|
-
const
|
|
116
|
+
var I = /* @__PURE__ */ u("<iframe>");
|
|
117
|
+
function $(e) {
|
|
118
|
+
const c = i(() => {
|
|
121
119
|
const t = e.host || "https://app.documenso.com", n = btoa(encodeURIComponent(JSON.stringify({
|
|
122
120
|
externalId: e.externalId,
|
|
123
121
|
features: e.features,
|
|
@@ -128,12 +126,11 @@ function C(e) {
|
|
|
128
126
|
}))), a = new URL("/embed/v1/authoring/document/create", t);
|
|
129
127
|
return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
|
|
130
128
|
});
|
|
131
|
-
function
|
|
132
|
-
|
|
133
|
-
if ((d == null ? void 0 : d.contentWindow) === t.source)
|
|
129
|
+
function r(t) {
|
|
130
|
+
if (d?.contentWindow === t.source)
|
|
134
131
|
switch (t.data.type) {
|
|
135
132
|
case "document-created":
|
|
136
|
-
|
|
133
|
+
e.onDocumentCreated?.({
|
|
137
134
|
documentId: t.data.documentId,
|
|
138
135
|
externalId: t.data.externalId
|
|
139
136
|
});
|
|
@@ -142,21 +139,21 @@ function C(e) {
|
|
|
142
139
|
}
|
|
143
140
|
let d;
|
|
144
141
|
return m(() => {
|
|
145
|
-
window.addEventListener("message",
|
|
142
|
+
window.addEventListener("message", r);
|
|
146
143
|
}), (() => {
|
|
147
|
-
var t =
|
|
144
|
+
var t = I(), n = d;
|
|
148
145
|
return typeof n == "function" ? k(n, t) : d = t, l((a) => {
|
|
149
|
-
var
|
|
150
|
-
return
|
|
146
|
+
var o = e.className, s = c();
|
|
147
|
+
return o !== a.e && b(t, a.e = o), s !== a.t && f(t, "src", a.t = s), a;
|
|
151
148
|
}, {
|
|
152
149
|
e: void 0,
|
|
153
150
|
t: void 0
|
|
154
151
|
}), t;
|
|
155
152
|
})();
|
|
156
153
|
}
|
|
157
|
-
var
|
|
158
|
-
function
|
|
159
|
-
const
|
|
154
|
+
var U = /* @__PURE__ */ u("<iframe>");
|
|
155
|
+
function x(e) {
|
|
156
|
+
const c = i(() => {
|
|
160
157
|
const t = e.host || "https://app.documenso.com", n = btoa(encodeURIComponent(JSON.stringify({
|
|
161
158
|
externalId: e.externalId,
|
|
162
159
|
features: e.features,
|
|
@@ -167,12 +164,11 @@ function R(e) {
|
|
|
167
164
|
}))), a = new URL("/embed/v1/authoring/template/create", t);
|
|
168
165
|
return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
|
|
169
166
|
});
|
|
170
|
-
function
|
|
171
|
-
|
|
172
|
-
if ((d == null ? void 0 : d.contentWindow) === t.source)
|
|
167
|
+
function r(t) {
|
|
168
|
+
if (d?.contentWindow === t.source)
|
|
173
169
|
switch (t.data.type) {
|
|
174
170
|
case "template-created":
|
|
175
|
-
|
|
171
|
+
e.onTemplateCreated?.({
|
|
176
172
|
templateId: t.data.templateId,
|
|
177
173
|
externalId: t.data.externalId
|
|
178
174
|
});
|
|
@@ -181,21 +177,21 @@ function R(e) {
|
|
|
181
177
|
}
|
|
182
178
|
let d;
|
|
183
179
|
return m(() => {
|
|
184
|
-
window.addEventListener("message",
|
|
180
|
+
window.addEventListener("message", r);
|
|
185
181
|
}), (() => {
|
|
186
|
-
var t =
|
|
182
|
+
var t = U(), n = d;
|
|
187
183
|
return typeof n == "function" ? k(n, t) : d = t, l((a) => {
|
|
188
|
-
var
|
|
189
|
-
return
|
|
184
|
+
var o = e.className, s = c();
|
|
185
|
+
return o !== a.e && b(t, a.e = o), s !== a.t && f(t, "src", a.t = s), a;
|
|
190
186
|
}, {
|
|
191
187
|
e: void 0,
|
|
192
188
|
t: void 0
|
|
193
189
|
}), t;
|
|
194
190
|
})();
|
|
195
191
|
}
|
|
196
|
-
var
|
|
197
|
-
function
|
|
198
|
-
const
|
|
192
|
+
var E = /* @__PURE__ */ u("<iframe>");
|
|
193
|
+
function C(e) {
|
|
194
|
+
const c = i(() => {
|
|
199
195
|
const t = e.host || "https://app.documenso.com", n = btoa(encodeURIComponent(JSON.stringify({
|
|
200
196
|
token: e.presignToken,
|
|
201
197
|
externalId: e.externalId,
|
|
@@ -207,12 +203,11 @@ function L(e) {
|
|
|
207
203
|
}))), a = new URL(`/embed/v1/authoring/document/edit/${e.documentId}`, t);
|
|
208
204
|
return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
|
|
209
205
|
});
|
|
210
|
-
function
|
|
211
|
-
|
|
212
|
-
if ((d == null ? void 0 : d.contentWindow) === t.source)
|
|
206
|
+
function r(t) {
|
|
207
|
+
if (d?.contentWindow === t.source)
|
|
213
208
|
switch (t.data.type) {
|
|
214
209
|
case "document-updated":
|
|
215
|
-
|
|
210
|
+
e.onDocumentUpdated?.({
|
|
216
211
|
documentId: t.data.documentId,
|
|
217
212
|
externalId: t.data.externalId
|
|
218
213
|
});
|
|
@@ -221,21 +216,21 @@ function L(e) {
|
|
|
221
216
|
}
|
|
222
217
|
let d;
|
|
223
218
|
return m(() => {
|
|
224
|
-
window.addEventListener("message",
|
|
219
|
+
window.addEventListener("message", r);
|
|
225
220
|
}), (() => {
|
|
226
|
-
var t =
|
|
221
|
+
var t = E(), n = d;
|
|
227
222
|
return typeof n == "function" ? k(n, t) : d = t, l((a) => {
|
|
228
|
-
var
|
|
229
|
-
return
|
|
223
|
+
var o = e.className, s = c();
|
|
224
|
+
return o !== a.e && b(t, a.e = o), s !== a.t && f(t, "src", a.t = s), a;
|
|
230
225
|
}, {
|
|
231
226
|
e: void 0,
|
|
232
227
|
t: void 0
|
|
233
228
|
}), t;
|
|
234
229
|
})();
|
|
235
230
|
}
|
|
236
|
-
var
|
|
231
|
+
var M = /* @__PURE__ */ u("<iframe>");
|
|
237
232
|
function S(e) {
|
|
238
|
-
const
|
|
233
|
+
const c = i(() => {
|
|
239
234
|
const t = e.host || "https://app.documenso.com", n = btoa(encodeURIComponent(JSON.stringify({
|
|
240
235
|
externalId: e.externalId,
|
|
241
236
|
features: e.features,
|
|
@@ -246,12 +241,11 @@ function S(e) {
|
|
|
246
241
|
}))), a = new URL(`/embed/v1/authoring/template/edit/${e.templateId}`, t);
|
|
247
242
|
return a.searchParams.set("token", e.presignToken), a.hash = n, a.toString();
|
|
248
243
|
});
|
|
249
|
-
function
|
|
250
|
-
|
|
251
|
-
if ((d == null ? void 0 : d.contentWindow) === t.source)
|
|
244
|
+
function r(t) {
|
|
245
|
+
if (d?.contentWindow === t.source)
|
|
252
246
|
switch (t.data.type) {
|
|
253
247
|
case "template-updated":
|
|
254
|
-
|
|
248
|
+
e.onTemplateUpdated?.({
|
|
255
249
|
templateId: t.data.templateId,
|
|
256
250
|
externalId: t.data.externalId
|
|
257
251
|
});
|
|
@@ -260,12 +254,62 @@ function S(e) {
|
|
|
260
254
|
}
|
|
261
255
|
let d;
|
|
262
256
|
return m(() => {
|
|
263
|
-
window.addEventListener("message",
|
|
257
|
+
window.addEventListener("message", r);
|
|
258
|
+
}), (() => {
|
|
259
|
+
var t = M(), n = d;
|
|
260
|
+
return typeof n == "function" ? k(n, t) : d = t, l((a) => {
|
|
261
|
+
var o = e.className, s = c();
|
|
262
|
+
return o !== a.e && b(t, a.e = o), s !== a.t && f(t, "src", a.t = s), a;
|
|
263
|
+
}, {
|
|
264
|
+
e: void 0,
|
|
265
|
+
t: void 0
|
|
266
|
+
}), t;
|
|
267
|
+
})();
|
|
268
|
+
}
|
|
269
|
+
var _ = /* @__PURE__ */ u("<iframe>");
|
|
270
|
+
function L(e) {
|
|
271
|
+
const c = i(() => {
|
|
272
|
+
const t = e.host || "https://app.documenso.com", n = btoa(encodeURIComponent(JSON.stringify({
|
|
273
|
+
name: e.name,
|
|
274
|
+
lockName: e.lockName,
|
|
275
|
+
css: e.css,
|
|
276
|
+
cssVars: e.cssVars,
|
|
277
|
+
darkModeDisabled: e.darkModeDisabled,
|
|
278
|
+
allowDocumentRejection: e.allowDocumentRejection,
|
|
279
|
+
...e.additionalProps
|
|
280
|
+
}))), a = new URL("/embed/v1/multisign", t);
|
|
281
|
+
for (const o of e.tokens)
|
|
282
|
+
a.searchParams.append("token", o);
|
|
283
|
+
return `${a}#${n}`;
|
|
284
|
+
});
|
|
285
|
+
function r(t) {
|
|
286
|
+
if (d?.contentWindow === t.source)
|
|
287
|
+
switch (t.data.action) {
|
|
288
|
+
case "document-ready":
|
|
289
|
+
e.onDocumentReady?.();
|
|
290
|
+
break;
|
|
291
|
+
case "document-completed":
|
|
292
|
+
e.onDocumentCompleted?.(t.data.data);
|
|
293
|
+
break;
|
|
294
|
+
case "document-error":
|
|
295
|
+
e.onDocumentError?.(t.data.data);
|
|
296
|
+
break;
|
|
297
|
+
case "document-rejected":
|
|
298
|
+
e.onDocumentRejected?.(t.data.data);
|
|
299
|
+
break;
|
|
300
|
+
case "all-documents-completed":
|
|
301
|
+
e.onAllDocumentsCompleted?.(t.data.data);
|
|
302
|
+
break;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
let d;
|
|
306
|
+
return m(() => {
|
|
307
|
+
window.addEventListener("message", r);
|
|
264
308
|
}), (() => {
|
|
265
|
-
var t =
|
|
309
|
+
var t = _(), n = d;
|
|
266
310
|
return typeof n == "function" ? k(n, t) : d = t, l((a) => {
|
|
267
|
-
var
|
|
268
|
-
return
|
|
311
|
+
var o = e.className, s = c();
|
|
312
|
+
return o !== a.e && b(t, a.e = o), s !== a.t && f(t, "src", a.t = s), a;
|
|
269
313
|
}, {
|
|
270
314
|
e: void 0,
|
|
271
315
|
t: void 0
|
|
@@ -274,9 +318,10 @@ function S(e) {
|
|
|
274
318
|
}
|
|
275
319
|
export {
|
|
276
320
|
N as EmbedDirectTemplate,
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
L as
|
|
321
|
+
R as EmbedSignDocument,
|
|
322
|
+
$ as unstable_EmbedCreateDocument,
|
|
323
|
+
x as unstable_EmbedCreateTemplate,
|
|
324
|
+
L as unstable_EmbedMultiSignDocument,
|
|
325
|
+
C as unstable_EmbedUpdateDocument,
|
|
281
326
|
S as unstable_EmbedUpdateTemplate
|
|
282
327
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
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 function EmbedMultiSignDocument(props: EmbedMultiSignDocumentProps): import("solid-js").JSX.Element;
|
|
37
|
+
export default EmbedMultiSignDocument;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@documenso/embed-solid",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@documenso/embed": "*",
|
|
39
39
|
"vite-plugin-solid": "^2.10.2",
|
|
40
|
-
"vite": "^
|
|
40
|
+
"vite": "^7.0.0",
|
|
41
41
|
"vite-plugin-dts": "^4.1.0"
|
|
42
42
|
}
|
|
43
43
|
}
|