@documenso/embed-solid 0.2.0 → 0.2.1-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/create-document.d.ts +25 -0
- package/dist/create-template.d.ts +25 -0
- package/dist/direct-template.d.ts +1 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +126 -38
- package/dist/sign-document.d.ts +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CssVars } from './css-vars';
|
|
2
|
+
export type EmbedCreateDocumentProps = {
|
|
3
|
+
className?: string;
|
|
4
|
+
host?: string;
|
|
5
|
+
presignToken: string;
|
|
6
|
+
externalId?: string;
|
|
7
|
+
css?: string | undefined;
|
|
8
|
+
cssVars?: (CssVars & Record<string, string>) | undefined;
|
|
9
|
+
darkModeDisabled?: boolean | undefined;
|
|
10
|
+
features?: {
|
|
11
|
+
allowConfigureSignatureTypes?: boolean;
|
|
12
|
+
allowConfigureLanguage?: boolean;
|
|
13
|
+
allowConfigureDateFormat?: boolean;
|
|
14
|
+
allowConfigureTimezone?: boolean;
|
|
15
|
+
allowConfigureRedirectUrl?: boolean;
|
|
16
|
+
allowConfigureCommunication?: boolean;
|
|
17
|
+
};
|
|
18
|
+
additionalProps?: Record<string, string | number | boolean> | undefined;
|
|
19
|
+
onDocumentCreated?: (data: {
|
|
20
|
+
externalId: string;
|
|
21
|
+
documentId: number;
|
|
22
|
+
}) => void;
|
|
23
|
+
};
|
|
24
|
+
declare function EmbedCreateDocument(props: EmbedCreateDocumentProps): import("solid-js").JSX.Element;
|
|
25
|
+
export default EmbedCreateDocument;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CssVars } from './css-vars';
|
|
2
|
+
export type EmbedCreateTemplateProps = {
|
|
3
|
+
className?: string;
|
|
4
|
+
host?: string;
|
|
5
|
+
presignToken: string;
|
|
6
|
+
externalId?: string;
|
|
7
|
+
css?: string | undefined;
|
|
8
|
+
cssVars?: (CssVars & Record<string, string>) | undefined;
|
|
9
|
+
darkModeDisabled?: boolean | undefined;
|
|
10
|
+
features?: {
|
|
11
|
+
allowConfigureSignatureTypes?: boolean;
|
|
12
|
+
allowConfigureLanguage?: boolean;
|
|
13
|
+
allowConfigureDateFormat?: boolean;
|
|
14
|
+
allowConfigureTimezone?: boolean;
|
|
15
|
+
allowConfigureRedirectUrl?: boolean;
|
|
16
|
+
allowConfigureCommunication?: boolean;
|
|
17
|
+
};
|
|
18
|
+
additionalProps?: Record<string, string | number | boolean> | undefined;
|
|
19
|
+
onTemplateCreated?: (data: {
|
|
20
|
+
externalId: string;
|
|
21
|
+
templateId: number;
|
|
22
|
+
}) => void;
|
|
23
|
+
};
|
|
24
|
+
declare function EmbedCreateTemplate(props: EmbedCreateTemplateProps): import("solid-js").JSX.Element;
|
|
25
|
+
export default EmbedCreateTemplate;
|
|
@@ -11,6 +11,7 @@ export type EmbedDirectTemplateProps = {
|
|
|
11
11
|
lockEmail?: boolean | undefined;
|
|
12
12
|
name?: string | undefined;
|
|
13
13
|
lockName?: boolean | undefined;
|
|
14
|
+
additionalProps?: Record<string, string | number | boolean> | undefined;
|
|
14
15
|
onDocumentReady?: () => void;
|
|
15
16
|
onDocumentCompleted?: (data: {
|
|
16
17
|
token: string;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export { default as EmbedDirectTemplate } from './direct-template';
|
|
2
2
|
export { default as EmbedSignDocument } from './sign-document';
|
|
3
|
+
export { default as unstable_EmbedCreateDocument } from './create-document';
|
|
4
|
+
export { default as unstable_EmbedCreateTemplate } from './create-template';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export { default as EmbedDirectTemplate } from './direct-template';
|
|
2
2
|
export { default as EmbedSignDocument } from './sign-document';
|
|
3
|
+
export { default as unstable_EmbedCreateDocument } from './create-document';
|
|
4
|
+
export { default as unstable_EmbedCreateTemplate } from './create-template';
|
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 r=require("solid-js");function s(e,i,l){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 m(e,i,l){k(e)||(l==null?e.removeAttribute(i):e.setAttribute(i,l))}function u(e,i){k(e)||(i==null?e.removeAttribute("class"):e.className=i)}function f(e,i,l){return r.untrack(()=>e(i,l))}function k(e){return!!r.sharedConfig.context&&!r.sharedConfig.done&&(!e||e.isConnected)}var g=s("<iframe>");function v(e){const i=r.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,...e.additionalProps}))),n=new URL(`/embed/direct/${e.token}`,t);return e.externalId&&n.searchParams.set("externalId",e.externalId),`${n}#${a}`});function l(t){var a,n,d,o,b;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":(d=e.onDocumentError)==null||d.call(e,t.data.data);break;case"field-signed":(o=e.onFieldSigned)==null||o.call(e);break;case"field-unsigned":(b=e.onFieldUnsigned)==null||b.call(e);break}}let c;return r.onMount(()=>{window.addEventListener("message",l)}),(()=>{var t=g(),a=c;return typeof a=="function"?f(a,t):c=t,r.createRenderEffect(n=>{var d=e.className,o=i();return d!==n.e&&u(t,n.e=d),o!==n.t&&m(t,"src",n.t=o),n},{e:void 0,t:void 0}),t})()}var D=s("<iframe>");function h(e){const i=r.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,allowDocumentRejection:e.allowDocumentRejection,...e.additionalProps})));return`${new URL(`/embed/sign/${e.token}`,t)}#${a}`});function l(t){var a,n,d,o;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":(d=e.onDocumentError)==null||d.call(e,t.data.data);break;case"document-rejected":(o=e.onDocumentRejected)==null||o.call(e,t.data.data);break}}let c;return r.onMount(()=>{window.addEventListener("message",l)}),(()=>{var t=D(),a=c;return typeof a=="function"?f(a,t):c=t,r.createRenderEffect(n=>{var d=e.className,o=i();return d!==n.e&&u(t,n.e=d),o!==n.t&&m(t,"src",n.t=o),n},{e:void 0,t:void 0}),t})()}var w=s("<iframe>");function E(e){const i=r.createMemo(()=>{const t=e.host||"https://app.documenso.com",a=btoa(encodeURIComponent(JSON.stringify({token:e.presignToken,externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps})));return`${new URL("/embed/v1/authoring/document/create",t)}#${a}`});function l(t){var a;if((c==null?void 0:c.contentWindow)===t.source)switch(t.data.type){case"document-completed":(a=e.onDocumentCreated)==null||a.call(e,{documentId:t.data.documentId,externalId:t.data.externalId});break}}let c;return r.onMount(()=>{window.addEventListener("message",l)}),(()=>{var t=w(),a=c;return typeof a=="function"?f(a,t):c=t,r.createRenderEffect(n=>{var d=e.className,o=i();return d!==n.e&&u(t,n.e=d),o!==n.t&&m(t,"src",n.t=o),n},{e:void 0,t:void 0}),t})()}var M=s("<iframe>");function I(e){const i=r.createMemo(()=>{const t=e.host||"https://app.documenso.com",a=btoa(encodeURIComponent(JSON.stringify({token:e.presignToken,externalId:e.externalId,features:e.features,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled,...e.additionalProps})));return`${new URL("/embed/v1/authoring/template/create",t)}#${a}`});function l(t){var a;if((c==null?void 0:c.contentWindow)===t.source)switch(t.data.type){case"template-completed":(a=e.onTemplateCreated)==null||a.call(e,{templateId:t.data.templateId,externalId:t.data.externalId});break}}let c;return r.onMount(()=>{window.addEventListener("message",l)}),(()=>{var t=M(),a=c;return typeof a=="function"?f(a,t):c=t,r.createRenderEffect(n=>{var d=e.className,o=i();return d!==n.e&&u(t,n.e=d),o!==n.t&&m(t,"src",n.t=o),n},{e:void 0,t:void 0}),t})()}exports.EmbedDirectTemplate=v;exports.EmbedSignDocument=h;exports.unstable_EmbedCreateDocument=E;exports.unstable_EmbedCreateTemplate=I;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { sharedConfig as
|
|
2
|
-
function
|
|
1
|
+
import { sharedConfig as g, untrack as D, createMemo as s, onMount as l, createRenderEffect as m } from "solid-js";
|
|
2
|
+
function u(e, o, r) {
|
|
3
3
|
let c;
|
|
4
4
|
const t = () => {
|
|
5
5
|
const n = document.createElement("template");
|
|
@@ -7,21 +7,21 @@ function b(e, d, m) {
|
|
|
7
7
|
}, a = () => (c || (c = t())).cloneNode(!0);
|
|
8
8
|
return a.cloneNode = a, a;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
|
|
10
|
+
function f(e, o, r) {
|
|
11
|
+
w(e) || (r == null ? e.removeAttribute(o) : e.setAttribute(o, r));
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
13
|
+
function b(e, o) {
|
|
14
|
+
w(e) || (o == null ? e.removeAttribute("class") : e.className = o);
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
return
|
|
16
|
+
function k(e, o, r) {
|
|
17
|
+
return D(() => e(o, r));
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
return !!
|
|
19
|
+
function w(e) {
|
|
20
|
+
return !!g.context && !g.done && (!e || e.isConnected);
|
|
21
21
|
}
|
|
22
|
-
var h = /* @__PURE__ */
|
|
23
|
-
function
|
|
24
|
-
const
|
|
22
|
+
var h = /* @__PURE__ */ u("<iframe>");
|
|
23
|
+
function N(e) {
|
|
24
|
+
const o = s(() => {
|
|
25
25
|
const t = e.host || "https://app.documenso.com", a = btoa(encodeURIComponent(JSON.stringify({
|
|
26
26
|
name: e.name,
|
|
27
27
|
lockName: e.lockName,
|
|
@@ -29,12 +29,13 @@ function y(e) {
|
|
|
29
29
|
lockEmail: e.lockEmail,
|
|
30
30
|
css: e.css,
|
|
31
31
|
cssVars: e.cssVars,
|
|
32
|
-
darkModeDisabled: e.darkModeDisabled
|
|
32
|
+
darkModeDisabled: e.darkModeDisabled,
|
|
33
|
+
...e.additionalProps
|
|
33
34
|
}))), n = new URL(`/embed/direct/${e.token}`, t);
|
|
34
35
|
return e.externalId && n.searchParams.set("externalId", e.externalId), `${n}#${a}`;
|
|
35
36
|
});
|
|
36
|
-
function
|
|
37
|
-
var a, n,
|
|
37
|
+
function r(t) {
|
|
38
|
+
var a, n, d, i, v;
|
|
38
39
|
if ((c == null ? void 0 : c.contentWindow) === t.source)
|
|
39
40
|
switch (t.data.action) {
|
|
40
41
|
case "document-ready":
|
|
@@ -44,44 +45,46 @@ function y(e) {
|
|
|
44
45
|
(n = e.onDocumentCompleted) == null || n.call(e, t.data.data);
|
|
45
46
|
break;
|
|
46
47
|
case "document-error":
|
|
47
|
-
(
|
|
48
|
+
(d = e.onDocumentError) == null || d.call(e, t.data.data);
|
|
48
49
|
break;
|
|
49
50
|
case "field-signed":
|
|
50
|
-
(
|
|
51
|
+
(i = e.onFieldSigned) == null || i.call(e);
|
|
51
52
|
break;
|
|
52
53
|
case "field-unsigned":
|
|
53
|
-
(
|
|
54
|
+
(v = e.onFieldUnsigned) == null || v.call(e);
|
|
54
55
|
break;
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
let c;
|
|
58
|
-
return
|
|
59
|
-
window.addEventListener("message",
|
|
59
|
+
return l(() => {
|
|
60
|
+
window.addEventListener("message", r);
|
|
60
61
|
}), (() => {
|
|
61
62
|
var t = h(), a = c;
|
|
62
|
-
return typeof a == "function" ?
|
|
63
|
-
var
|
|
64
|
-
return
|
|
63
|
+
return typeof a == "function" ? k(a, t) : c = t, m((n) => {
|
|
64
|
+
var d = e.className, i = o();
|
|
65
|
+
return d !== n.e && b(t, n.e = d), i !== n.t && f(t, "src", n.t = i), n;
|
|
65
66
|
}, {
|
|
66
67
|
e: void 0,
|
|
67
68
|
t: void 0
|
|
68
69
|
}), t;
|
|
69
70
|
})();
|
|
70
71
|
}
|
|
71
|
-
var
|
|
72
|
-
function
|
|
73
|
-
const
|
|
72
|
+
var I = /* @__PURE__ */ u("<iframe>");
|
|
73
|
+
function U(e) {
|
|
74
|
+
const o = s(() => {
|
|
74
75
|
const t = e.host || "https://app.documenso.com", a = btoa(encodeURIComponent(JSON.stringify({
|
|
75
76
|
name: e.name,
|
|
76
77
|
lockName: e.lockName,
|
|
77
78
|
css: e.css,
|
|
78
79
|
cssVars: e.cssVars,
|
|
79
|
-
darkModeDisabled: e.darkModeDisabled
|
|
80
|
+
darkModeDisabled: e.darkModeDisabled,
|
|
81
|
+
allowDocumentRejection: e.allowDocumentRejection,
|
|
82
|
+
...e.additionalProps
|
|
80
83
|
})));
|
|
81
84
|
return `${new URL(`/embed/sign/${e.token}`, t)}#${a}`;
|
|
82
85
|
});
|
|
83
|
-
function
|
|
84
|
-
var a, n, i;
|
|
86
|
+
function r(t) {
|
|
87
|
+
var a, n, d, i;
|
|
85
88
|
if ((c == null ? void 0 : c.contentWindow) === t.source)
|
|
86
89
|
switch (t.data.action) {
|
|
87
90
|
case "document-ready":
|
|
@@ -91,18 +94,101 @@ function M(e) {
|
|
|
91
94
|
(n = e.onDocumentCompleted) == null || n.call(e, t.data.data);
|
|
92
95
|
break;
|
|
93
96
|
case "document-error":
|
|
94
|
-
(
|
|
97
|
+
(d = e.onDocumentError) == null || d.call(e, t.data.data);
|
|
98
|
+
break;
|
|
99
|
+
case "document-rejected":
|
|
100
|
+
(i = e.onDocumentRejected) == null || i.call(e, t.data.data);
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
let c;
|
|
105
|
+
return l(() => {
|
|
106
|
+
window.addEventListener("message", r);
|
|
107
|
+
}), (() => {
|
|
108
|
+
var t = I(), a = c;
|
|
109
|
+
return typeof a == "function" ? k(a, t) : c = t, m((n) => {
|
|
110
|
+
var d = e.className, i = o();
|
|
111
|
+
return d !== n.e && b(t, n.e = d), i !== n.t && f(t, "src", n.t = i), n;
|
|
112
|
+
}, {
|
|
113
|
+
e: void 0,
|
|
114
|
+
t: void 0
|
|
115
|
+
}), t;
|
|
116
|
+
})();
|
|
117
|
+
}
|
|
118
|
+
var E = /* @__PURE__ */ u("<iframe>");
|
|
119
|
+
function y(e) {
|
|
120
|
+
const o = s(() => {
|
|
121
|
+
const t = e.host || "https://app.documenso.com", a = btoa(encodeURIComponent(JSON.stringify({
|
|
122
|
+
token: e.presignToken,
|
|
123
|
+
externalId: e.externalId,
|
|
124
|
+
features: e.features,
|
|
125
|
+
css: e.css,
|
|
126
|
+
cssVars: e.cssVars,
|
|
127
|
+
darkModeDisabled: e.darkModeDisabled,
|
|
128
|
+
...e.additionalProps
|
|
129
|
+
})));
|
|
130
|
+
return `${new URL("/embed/v1/authoring/document/create", t)}#${a}`;
|
|
131
|
+
});
|
|
132
|
+
function r(t) {
|
|
133
|
+
var a;
|
|
134
|
+
if ((c == null ? void 0 : c.contentWindow) === t.source)
|
|
135
|
+
switch (t.data.type) {
|
|
136
|
+
case "document-completed":
|
|
137
|
+
(a = e.onDocumentCreated) == null || a.call(e, {
|
|
138
|
+
documentId: t.data.documentId,
|
|
139
|
+
externalId: t.data.externalId
|
|
140
|
+
});
|
|
95
141
|
break;
|
|
96
142
|
}
|
|
97
143
|
}
|
|
98
144
|
let c;
|
|
99
|
-
return
|
|
100
|
-
window.addEventListener("message",
|
|
145
|
+
return l(() => {
|
|
146
|
+
window.addEventListener("message", r);
|
|
101
147
|
}), (() => {
|
|
102
148
|
var t = E(), a = c;
|
|
103
|
-
return typeof a == "function" ?
|
|
104
|
-
var
|
|
105
|
-
return
|
|
149
|
+
return typeof a == "function" ? k(a, t) : c = t, m((n) => {
|
|
150
|
+
var d = e.className, i = o();
|
|
151
|
+
return d !== n.e && b(t, n.e = d), i !== n.t && f(t, "src", n.t = i), n;
|
|
152
|
+
}, {
|
|
153
|
+
e: void 0,
|
|
154
|
+
t: void 0
|
|
155
|
+
}), t;
|
|
156
|
+
})();
|
|
157
|
+
}
|
|
158
|
+
var $ = /* @__PURE__ */ u("<iframe>");
|
|
159
|
+
function M(e) {
|
|
160
|
+
const o = s(() => {
|
|
161
|
+
const t = e.host || "https://app.documenso.com", a = btoa(encodeURIComponent(JSON.stringify({
|
|
162
|
+
token: e.presignToken,
|
|
163
|
+
externalId: e.externalId,
|
|
164
|
+
features: e.features,
|
|
165
|
+
css: e.css,
|
|
166
|
+
cssVars: e.cssVars,
|
|
167
|
+
darkModeDisabled: e.darkModeDisabled,
|
|
168
|
+
...e.additionalProps
|
|
169
|
+
})));
|
|
170
|
+
return `${new URL("/embed/v1/authoring/template/create", t)}#${a}`;
|
|
171
|
+
});
|
|
172
|
+
function r(t) {
|
|
173
|
+
var a;
|
|
174
|
+
if ((c == null ? void 0 : c.contentWindow) === t.source)
|
|
175
|
+
switch (t.data.type) {
|
|
176
|
+
case "template-completed":
|
|
177
|
+
(a = e.onTemplateCreated) == null || a.call(e, {
|
|
178
|
+
templateId: t.data.templateId,
|
|
179
|
+
externalId: t.data.externalId
|
|
180
|
+
});
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
let c;
|
|
185
|
+
return l(() => {
|
|
186
|
+
window.addEventListener("message", r);
|
|
187
|
+
}), (() => {
|
|
188
|
+
var t = $(), a = c;
|
|
189
|
+
return typeof a == "function" ? k(a, t) : c = t, m((n) => {
|
|
190
|
+
var d = e.className, i = o();
|
|
191
|
+
return d !== n.e && b(t, n.e = d), i !== n.t && f(t, "src", n.t = i), n;
|
|
106
192
|
}, {
|
|
107
193
|
e: void 0,
|
|
108
194
|
t: void 0
|
|
@@ -110,6 +196,8 @@ function M(e) {
|
|
|
110
196
|
})();
|
|
111
197
|
}
|
|
112
198
|
export {
|
|
113
|
-
|
|
114
|
-
|
|
199
|
+
N as EmbedDirectTemplate,
|
|
200
|
+
U as EmbedSignDocument,
|
|
201
|
+
y as unstable_EmbedCreateDocument,
|
|
202
|
+
M as unstable_EmbedCreateTemplate
|
|
115
203
|
};
|
package/dist/sign-document.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export type EmbedSignDocumentProps = {
|
|
|
8
8
|
darkModeDisabled?: boolean | undefined;
|
|
9
9
|
name?: string | undefined;
|
|
10
10
|
lockName?: boolean | undefined;
|
|
11
|
+
allowDocumentRejection?: boolean | undefined;
|
|
12
|
+
additionalProps?: Record<string, string | number | boolean> | undefined;
|
|
11
13
|
onDocumentReady?: () => void;
|
|
12
14
|
onDocumentCompleted?: (data: {
|
|
13
15
|
token: string;
|
|
@@ -15,6 +17,12 @@ export type EmbedSignDocumentProps = {
|
|
|
15
17
|
recipientId: number;
|
|
16
18
|
}) => void;
|
|
17
19
|
onDocumentError?: (error: string) => void;
|
|
20
|
+
onDocumentRejected?: (data: {
|
|
21
|
+
token: string;
|
|
22
|
+
documentId: number;
|
|
23
|
+
recipientId: number;
|
|
24
|
+
reason: string;
|
|
25
|
+
}) => void;
|
|
18
26
|
};
|
|
19
27
|
declare function EmbedSignDocument(props: EmbedSignDocumentProps): import("solid-js").JSX.Element;
|
|
20
28
|
export default EmbedSignDocument;
|