@documenso/embed-solid 0.2.1-rc.0 → 0.2.1-rc.2
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/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +119 -37
- 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;
|
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 l(e,o,s){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,o,s){k(e)||(s==null?e.removeAttribute(o):e.setAttribute(o,s))}function u(e,o){k(e)||(o==null?e.removeAttribute("class"):e.className=o)}function f(e,o,s){return r.untrack(()=>e(o,s))}function k(e){return!!r.sharedConfig.context&&!r.sharedConfig.done&&(!e||e.isConnected)}var g=l("<iframe>");function v(e){const o=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 s(t){var a,n,d,i,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":(i=e.onFieldSigned)==null||i.call(e);break;case"field-unsigned":(b=e.onFieldUnsigned)==null||b.call(e);break}}let c;return r.onMount(()=>{window.addEventListener("message",s)}),(()=>{var t=g(),a=c;return typeof a=="function"?f(a,t):c=t,r.createRenderEffect(n=>{var d=e.className,i=o();return d!==n.e&&u(t,n.e=d),i!==n.t&&m(t,"src",n.t=i),n},{e:void 0,t:void 0}),t})()}var D=l("<iframe>");function h(e){const o=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 s(t){var a,n,d,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":(d=e.onDocumentError)==null||d.call(e,t.data.data);break;case"document-rejected":(i=e.onDocumentRejected)==null||i.call(e,t.data.data);break}}let c;return r.onMount(()=>{window.addEventListener("message",s)}),(()=>{var t=D(),a=c;return typeof a=="function"?f(a,t):c=t,r.createRenderEffect(n=>{var d=e.className,i=o();return d!==n.e&&u(t,n.e=d),i!==n.t&&m(t,"src",n.t=i),n},{e:void 0,t:void 0}),t})()}var w=l("<iframe>");function E(e){const o=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 s(t){var a;if((c==null?void 0:c.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}}let c;return r.onMount(()=>{window.addEventListener("message",s)}),(()=>{var t=w(),a=c;return typeof a=="function"?f(a,t):c=t,r.createRenderEffect(n=>{var d=e.className,i=o();return d!==n.e&&u(t,n.e=d),i!==n.t&&m(t,"src",n.t=i),n},{e:void 0,t:void 0}),t})()}var M=l("<iframe>");function I(e){const o=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 s(t){var a;if((c==null?void 0:c.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}}let c;return r.onMount(()=>{window.addEventListener("message",s)}),(()=>{var t=M(),a=c;return typeof a=="function"?f(a,t):c=t,r.createRenderEffect(n=>{var d=e.className,i=o();return d!==n.e&&u(t,n.e=d),i!==n.t&&m(t,"src",n.t=i),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
|
-
w(e) || (
|
|
10
|
+
function f(e, o, r) {
|
|
11
|
+
w(e) || (r == null ? e.removeAttribute(o) : e.setAttribute(o, r));
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
w(e) || (
|
|
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
19
|
function w(e) {
|
|
20
|
-
return !!
|
|
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,
|
|
@@ -34,8 +34,8 @@ function R(e) {
|
|
|
34
34
|
}))), n = new URL(`/embed/direct/${e.token}`, t);
|
|
35
35
|
return e.externalId && n.searchParams.set("externalId", e.externalId), `${n}#${a}`;
|
|
36
36
|
});
|
|
37
|
-
function
|
|
38
|
-
var a, n,
|
|
37
|
+
function r(t) {
|
|
38
|
+
var a, n, d, i, v;
|
|
39
39
|
if ((c == null ? void 0 : c.contentWindow) === t.source)
|
|
40
40
|
switch (t.data.action) {
|
|
41
41
|
case "document-ready":
|
|
@@ -45,33 +45,33 @@ function R(e) {
|
|
|
45
45
|
(n = e.onDocumentCompleted) == null || n.call(e, t.data.data);
|
|
46
46
|
break;
|
|
47
47
|
case "document-error":
|
|
48
|
-
(
|
|
48
|
+
(d = e.onDocumentError) == null || d.call(e, t.data.data);
|
|
49
49
|
break;
|
|
50
50
|
case "field-signed":
|
|
51
|
-
(
|
|
51
|
+
(i = e.onFieldSigned) == null || i.call(e);
|
|
52
52
|
break;
|
|
53
53
|
case "field-unsigned":
|
|
54
|
-
(
|
|
54
|
+
(v = e.onFieldUnsigned) == null || v.call(e);
|
|
55
55
|
break;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
let c;
|
|
59
|
-
return
|
|
60
|
-
window.addEventListener("message",
|
|
59
|
+
return l(() => {
|
|
60
|
+
window.addEventListener("message", r);
|
|
61
61
|
}), (() => {
|
|
62
62
|
var t = h(), a = c;
|
|
63
|
-
return typeof a == "function" ?
|
|
64
|
-
var
|
|
65
|
-
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;
|
|
66
66
|
}, {
|
|
67
67
|
e: void 0,
|
|
68
68
|
t: void 0
|
|
69
69
|
}), t;
|
|
70
70
|
})();
|
|
71
71
|
}
|
|
72
|
-
var
|
|
73
|
-
function
|
|
74
|
-
const
|
|
72
|
+
var I = /* @__PURE__ */ u("<iframe>");
|
|
73
|
+
function U(e) {
|
|
74
|
+
const o = s(() => {
|
|
75
75
|
const t = e.host || "https://app.documenso.com", a = btoa(encodeURIComponent(JSON.stringify({
|
|
76
76
|
name: e.name,
|
|
77
77
|
lockName: e.lockName,
|
|
@@ -83,8 +83,8 @@ function y(e) {
|
|
|
83
83
|
})));
|
|
84
84
|
return `${new URL(`/embed/sign/${e.token}`, t)}#${a}`;
|
|
85
85
|
});
|
|
86
|
-
function
|
|
87
|
-
var a, n,
|
|
86
|
+
function r(t) {
|
|
87
|
+
var a, n, d, i;
|
|
88
88
|
if ((c == null ? void 0 : c.contentWindow) === t.source)
|
|
89
89
|
switch (t.data.action) {
|
|
90
90
|
case "document-ready":
|
|
@@ -94,21 +94,101 @@ function y(e) {
|
|
|
94
94
|
(n = e.onDocumentCompleted) == null || n.call(e, t.data.data);
|
|
95
95
|
break;
|
|
96
96
|
case "document-error":
|
|
97
|
-
(
|
|
97
|
+
(d = e.onDocumentError) == null || d.call(e, t.data.data);
|
|
98
98
|
break;
|
|
99
99
|
case "document-rejected":
|
|
100
|
-
(
|
|
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-created":
|
|
137
|
+
(a = e.onDocumentCreated) == null || a.call(e, {
|
|
138
|
+
documentId: t.data.documentId,
|
|
139
|
+
externalId: t.data.externalId
|
|
140
|
+
});
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
let c;
|
|
145
|
+
return l(() => {
|
|
146
|
+
window.addEventListener("message", r);
|
|
147
|
+
}), (() => {
|
|
148
|
+
var t = E(), a = c;
|
|
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-created":
|
|
177
|
+
(a = e.onTemplateCreated) == null || a.call(e, {
|
|
178
|
+
templateId: t.data.templateId,
|
|
179
|
+
externalId: t.data.externalId
|
|
180
|
+
});
|
|
101
181
|
break;
|
|
102
182
|
}
|
|
103
183
|
}
|
|
104
184
|
let c;
|
|
105
|
-
return
|
|
106
|
-
window.addEventListener("message",
|
|
185
|
+
return l(() => {
|
|
186
|
+
window.addEventListener("message", r);
|
|
107
187
|
}), (() => {
|
|
108
|
-
var t =
|
|
109
|
-
return typeof a == "function" ?
|
|
110
|
-
var
|
|
111
|
-
return
|
|
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;
|
|
112
192
|
}, {
|
|
113
193
|
e: void 0,
|
|
114
194
|
t: void 0
|
|
@@ -116,6 +196,8 @@ function y(e) {
|
|
|
116
196
|
})();
|
|
117
197
|
}
|
|
118
198
|
export {
|
|
119
|
-
|
|
120
|
-
|
|
199
|
+
N as EmbedDirectTemplate,
|
|
200
|
+
U as EmbedSignDocument,
|
|
201
|
+
y as unstable_EmbedCreateDocument,
|
|
202
|
+
M as unstable_EmbedCreateTemplate
|
|
121
203
|
};
|