@documenso/embed-solid 0.0.1 → 0.0.2-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 +61 -241
- package/package.json +2 -2
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 o=require("solid-js");function l(e,i,m){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 s(e,i,m){g(e)||(m==null?e.removeAttribute(i):e.setAttribute(i,m))}function f(e,i){g(e)||(i==null?e.removeAttribute("class"):e.className=i)}function b(e,i,m){return o.untrack(()=>e(i,m))}function g(e){return!!o.sharedConfig.context&&!o.sharedConfig.done&&(!e||e.isConnected)}var k=l("<iframe>");function E(e){const i=o.createMemo(()=>{const t=e.host||"https://app.documenso.com",a=btoa(JSON.stringify({name:e.name,lockName:e.lockName,email:e.email,lockEmail:e.lockEmail,css:e.css})),n=new URL(`/embed/direct/${e.token}`,t);return e.externalId&&n.searchParams.set("externalId",e.externalId),`${n}#${a}`});function m(t){var a,n,d,u,r;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":(u=e.onFieldSigned)==null||u.call(e);break;case"field-unsigned":(r=e.onFieldUnsigned)==null||r.call(e);break}}let c;return o.onMount(()=>{window.addEventListener("message",m)}),(()=>{var t=k(),a=c;return typeof a=="function"?b(a,t):c=t,o.createRenderEffect(n=>{var d=e.className,u=i();return d!==n.e&&f(t,n.e=d),u!==n.t&&s(t,"src",n.t=u),n},{e:void 0,t:void 0}),t})()}var v=l("<iframe>");function h(e){const i=o.createMemo(()=>{const t=e.host||"https://app.documenso.com",a=btoa(JSON.stringify({name:e.name,lockName:e.lockName,css:e.css}));return`${new URL(`/embed/sign/${e.token}`,t)}#${a}`});function m(t){var a,n,d;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}}let c;return o.onMount(()=>{window.addEventListener("message",m)}),(()=>{var t=v(),a=c;return typeof a=="function"?b(a,t):c=t,o.createRenderEffect(n=>{var d=e.className,u=i();return d!==n.e&&f(t,n.e=d),u!==n.t&&s(t,"src",n.t=u),n},{e:void 0,t:void 0}),t})()}exports.EmbedDirectTemplate=E;exports.EmbedSignDocument=h;
|
package/dist/index.mjs
CHANGED
|
@@ -1,291 +1,111 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
owner: null
|
|
10
|
-
};
|
|
11
|
-
var i = null;
|
|
12
|
-
let k = null, J = null, u = null, a = null, f = null, g = 0;
|
|
13
|
-
function D(e, t, s) {
|
|
14
|
-
const n = N(e, t, !1, m);
|
|
15
|
-
d(n);
|
|
16
|
-
}
|
|
17
|
-
function P(e, t, s) {
|
|
18
|
-
x = z;
|
|
19
|
-
const n = N(e, t, !1, m);
|
|
20
|
-
n.user = !0, f ? f.push(n) : d(n);
|
|
21
|
-
}
|
|
22
|
-
function C(e, t, s) {
|
|
23
|
-
s = s ? Object.assign({}, U, s) : U;
|
|
24
|
-
const n = N(e, t, !0, 0);
|
|
25
|
-
return n.observers = null, n.observerSlots = null, n.comparator = s.equals || void 0, d(n), V.bind(n);
|
|
26
|
-
}
|
|
27
|
-
function S(e) {
|
|
28
|
-
if (u === null) return e();
|
|
29
|
-
const t = u;
|
|
30
|
-
u = null;
|
|
31
|
-
try {
|
|
32
|
-
return e();
|
|
33
|
-
} finally {
|
|
34
|
-
u = t;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function $(e) {
|
|
38
|
-
P(() => S(e));
|
|
39
|
-
}
|
|
40
|
-
function V() {
|
|
41
|
-
if (this.sources && this.state)
|
|
42
|
-
if (this.state === m) d(this);
|
|
43
|
-
else {
|
|
44
|
-
const e = a;
|
|
45
|
-
a = null, E(() => w(this)), a = e;
|
|
46
|
-
}
|
|
47
|
-
if (u) {
|
|
48
|
-
const e = this.observers ? this.observers.length : 0;
|
|
49
|
-
u.sources ? (u.sources.push(this), u.sourceSlots.push(e)) : (u.sources = [this], u.sourceSlots = [e]), this.observers ? (this.observers.push(u), this.observerSlots.push(u.sources.length - 1)) : (this.observers = [u], this.observerSlots = [u.sources.length - 1]);
|
|
50
|
-
}
|
|
51
|
-
return this.value;
|
|
52
|
-
}
|
|
53
|
-
function j(e, t, s) {
|
|
54
|
-
let n = e.value;
|
|
55
|
-
return (!e.comparator || !e.comparator(n, t)) && (e.value = t, e.observers && e.observers.length && E(() => {
|
|
56
|
-
for (let r = 0; r < e.observers.length; r += 1) {
|
|
57
|
-
const l = e.observers[r], c = k && k.running;
|
|
58
|
-
c && k.disposed.has(l), (c ? !l.tState : !l.state) && (l.pure ? a.push(l) : f.push(l), l.observers && O(l)), c || (l.state = m);
|
|
59
|
-
}
|
|
60
|
-
if (a.length > 1e6)
|
|
61
|
-
throw a = [], new Error();
|
|
62
|
-
})), t;
|
|
63
|
-
}
|
|
64
|
-
function d(e) {
|
|
65
|
-
if (!e.fn) return;
|
|
66
|
-
A(e);
|
|
67
|
-
const t = g;
|
|
68
|
-
H(e, e.value, t);
|
|
69
|
-
}
|
|
70
|
-
function H(e, t, s) {
|
|
71
|
-
let n;
|
|
72
|
-
const r = i, l = u;
|
|
73
|
-
u = i = e;
|
|
74
|
-
try {
|
|
75
|
-
n = e.fn(t);
|
|
76
|
-
} catch (c) {
|
|
77
|
-
return e.pure && (e.state = m, e.owned && e.owned.forEach(A), e.owned = null), e.updatedAt = s + 1, R(c);
|
|
78
|
-
} finally {
|
|
79
|
-
u = l, i = r;
|
|
80
|
-
}
|
|
81
|
-
(!e.updatedAt || e.updatedAt <= s) && (e.updatedAt != null && "observers" in e ? j(e, n) : e.value = n, e.updatedAt = s);
|
|
82
|
-
}
|
|
83
|
-
function N(e, t, s, n = m, r) {
|
|
84
|
-
const l = {
|
|
85
|
-
fn: e,
|
|
86
|
-
state: n,
|
|
87
|
-
updatedAt: null,
|
|
88
|
-
owned: null,
|
|
89
|
-
sources: null,
|
|
90
|
-
sourceSlots: null,
|
|
91
|
-
cleanups: null,
|
|
92
|
-
value: t,
|
|
93
|
-
owner: i,
|
|
94
|
-
context: i ? i.context : null,
|
|
95
|
-
pure: s
|
|
96
|
-
};
|
|
97
|
-
return i === null || i !== G && (i.owned ? i.owned.push(l) : i.owned = [l]), l;
|
|
98
|
-
}
|
|
99
|
-
function v(e) {
|
|
100
|
-
if (e.state === 0) return;
|
|
101
|
-
if (e.state === b) return w(e);
|
|
102
|
-
if (e.suspense && S(e.suspense.inFallback)) return e.suspense.effects.push(e);
|
|
103
|
-
const t = [e];
|
|
104
|
-
for (; (e = e.owner) && (!e.updatedAt || e.updatedAt < g); )
|
|
105
|
-
e.state && t.push(e);
|
|
106
|
-
for (let s = t.length - 1; s >= 0; s--)
|
|
107
|
-
if (e = t[s], e.state === m)
|
|
108
|
-
d(e);
|
|
109
|
-
else if (e.state === b) {
|
|
110
|
-
const n = a;
|
|
111
|
-
a = null, E(() => w(e, t[0])), a = n;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
function E(e, t) {
|
|
115
|
-
if (a) return e();
|
|
116
|
-
let s = !1;
|
|
117
|
-
a = [], f ? s = !0 : f = [], g++;
|
|
118
|
-
try {
|
|
119
|
-
const n = e();
|
|
120
|
-
return Q(s), n;
|
|
121
|
-
} catch (n) {
|
|
122
|
-
s || (f = null), a = null, R(n);
|
|
123
|
-
}
|
|
1
|
+
import { sharedConfig as l, untrack as h, createMemo as r, onMount as s, createRenderEffect as f } from "solid-js";
|
|
2
|
+
function b(e, i, m) {
|
|
3
|
+
let c;
|
|
4
|
+
const t = () => {
|
|
5
|
+
const n = document.createElement("template");
|
|
6
|
+
return n.innerHTML = e, n.content.firstChild;
|
|
7
|
+
}, a = () => (c || (c = t())).cloneNode(!0);
|
|
8
|
+
return a.cloneNode = a, a;
|
|
124
9
|
}
|
|
125
|
-
function
|
|
126
|
-
|
|
127
|
-
const t = f;
|
|
128
|
-
f = null, t.length && E(() => x(t));
|
|
10
|
+
function k(e, i, m) {
|
|
11
|
+
N(e) || (m == null ? e.removeAttribute(i) : e.setAttribute(i, m));
|
|
129
12
|
}
|
|
130
|
-
function
|
|
131
|
-
|
|
13
|
+
function g(e, i) {
|
|
14
|
+
N(e) || (i == null ? e.removeAttribute("class") : e.className = i);
|
|
132
15
|
}
|
|
133
|
-
function
|
|
134
|
-
|
|
135
|
-
for (t = 0; t < e.length; t++) {
|
|
136
|
-
const n = e[t];
|
|
137
|
-
n.user ? e[s++] = n : v(n);
|
|
138
|
-
}
|
|
139
|
-
for (t = 0; t < s; t++) v(e[t]);
|
|
16
|
+
function v(e, i, m) {
|
|
17
|
+
return h(() => e(i, m));
|
|
140
18
|
}
|
|
141
|
-
function
|
|
142
|
-
|
|
143
|
-
for (let s = 0; s < e.sources.length; s += 1) {
|
|
144
|
-
const n = e.sources[s];
|
|
145
|
-
if (n.sources) {
|
|
146
|
-
const r = n.state;
|
|
147
|
-
r === m ? n !== t && (!n.updatedAt || n.updatedAt < g) && v(n) : r === b && w(n, t);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
function O(e) {
|
|
152
|
-
for (let t = 0; t < e.observers.length; t += 1) {
|
|
153
|
-
const s = e.observers[t];
|
|
154
|
-
s.state || (s.state = b, s.pure ? a.push(s) : f.push(s), s.observers && O(s));
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
function A(e) {
|
|
158
|
-
let t;
|
|
159
|
-
if (e.sources)
|
|
160
|
-
for (; e.sources.length; ) {
|
|
161
|
-
const s = e.sources.pop(), n = e.sourceSlots.pop(), r = s.observers;
|
|
162
|
-
if (r && r.length) {
|
|
163
|
-
const l = r.pop(), c = s.observerSlots.pop();
|
|
164
|
-
n < r.length && (l.sourceSlots[c] = n, r[n] = l, s.observerSlots[n] = c);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
if (e.owned) {
|
|
168
|
-
for (t = e.owned.length - 1; t >= 0; t--) A(e.owned[t]);
|
|
169
|
-
e.owned = null;
|
|
170
|
-
}
|
|
171
|
-
if (e.cleanups) {
|
|
172
|
-
for (t = e.cleanups.length - 1; t >= 0; t--) e.cleanups[t]();
|
|
173
|
-
e.cleanups = null;
|
|
174
|
-
}
|
|
175
|
-
e.state = 0;
|
|
19
|
+
function N(e) {
|
|
20
|
+
return !!l.context && !l.done && (!e || e.isConnected);
|
|
176
21
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
function R(e, t = i) {
|
|
183
|
-
throw B(e);
|
|
184
|
-
}
|
|
185
|
-
function T(e, t, s) {
|
|
186
|
-
let n;
|
|
187
|
-
const r = () => {
|
|
188
|
-
const c = document.createElement("template");
|
|
189
|
-
return c.innerHTML = e, c.content.firstChild;
|
|
190
|
-
}, l = () => (n || (n = r())).cloneNode(!0);
|
|
191
|
-
return l.cloneNode = l, l;
|
|
192
|
-
}
|
|
193
|
-
function M(e, t, s) {
|
|
194
|
-
s == null ? e.removeAttribute(t) : e.setAttribute(t, s);
|
|
195
|
-
}
|
|
196
|
-
function F(e, t) {
|
|
197
|
-
t == null ? e.removeAttribute("class") : e.className = t;
|
|
198
|
-
}
|
|
199
|
-
function I(e, t, s) {
|
|
200
|
-
return S(() => e(t, s));
|
|
201
|
-
}
|
|
202
|
-
var K = /* @__PURE__ */ T("<iframe>");
|
|
203
|
-
function Y(e) {
|
|
204
|
-
const t = C(() => {
|
|
205
|
-
const r = e.host || "https://app.documenso.com", l = btoa(JSON.stringify({
|
|
22
|
+
var E = /* @__PURE__ */ b("<iframe>");
|
|
23
|
+
function $(e) {
|
|
24
|
+
const i = r(() => {
|
|
25
|
+
const t = e.host || "https://app.documenso.com", a = btoa(JSON.stringify({
|
|
206
26
|
name: e.name,
|
|
207
27
|
lockName: e.lockName,
|
|
208
28
|
email: e.email,
|
|
209
29
|
lockEmail: e.lockEmail,
|
|
210
30
|
css: e.css
|
|
211
|
-
})),
|
|
212
|
-
return e.externalId &&
|
|
31
|
+
})), n = new URL(`/embed/direct/${e.token}`, t);
|
|
32
|
+
return e.externalId && n.searchParams.set("externalId", e.externalId), `${n}#${a}`;
|
|
213
33
|
});
|
|
214
|
-
function
|
|
215
|
-
var
|
|
216
|
-
if ((
|
|
217
|
-
switch (
|
|
34
|
+
function m(t) {
|
|
35
|
+
var a, n, d, u, o;
|
|
36
|
+
if ((c == null ? void 0 : c.contentWindow) === t.source)
|
|
37
|
+
switch (t.data.action) {
|
|
218
38
|
case "document-ready":
|
|
219
|
-
(
|
|
39
|
+
(a = e.onDocumentReady) == null || a.call(e);
|
|
220
40
|
break;
|
|
221
41
|
case "document-completed":
|
|
222
|
-
(
|
|
42
|
+
(n = e.onDocumentCompleted) == null || n.call(e, t.data.data);
|
|
223
43
|
break;
|
|
224
44
|
case "document-error":
|
|
225
|
-
(
|
|
45
|
+
(d = e.onDocumentError) == null || d.call(e, t.data.data);
|
|
226
46
|
break;
|
|
227
47
|
case "field-signed":
|
|
228
|
-
(
|
|
48
|
+
(u = e.onFieldSigned) == null || u.call(e);
|
|
229
49
|
break;
|
|
230
50
|
case "field-unsigned":
|
|
231
|
-
(
|
|
51
|
+
(o = e.onFieldUnsigned) == null || o.call(e);
|
|
232
52
|
break;
|
|
233
53
|
}
|
|
234
54
|
}
|
|
235
|
-
let
|
|
236
|
-
return
|
|
237
|
-
window.addEventListener("message",
|
|
55
|
+
let c;
|
|
56
|
+
return s(() => {
|
|
57
|
+
window.addEventListener("message", m);
|
|
238
58
|
}), (() => {
|
|
239
|
-
var
|
|
240
|
-
return typeof
|
|
241
|
-
var
|
|
242
|
-
return
|
|
59
|
+
var t = E(), a = c;
|
|
60
|
+
return typeof a == "function" ? v(a, t) : c = t, f((n) => {
|
|
61
|
+
var d = e.className, u = i();
|
|
62
|
+
return d !== n.e && g(t, n.e = d), u !== n.t && k(t, "src", n.t = u), n;
|
|
243
63
|
}, {
|
|
244
64
|
e: void 0,
|
|
245
65
|
t: void 0
|
|
246
|
-
}),
|
|
66
|
+
}), t;
|
|
247
67
|
})();
|
|
248
68
|
}
|
|
249
|
-
var
|
|
250
|
-
function
|
|
251
|
-
const
|
|
252
|
-
const
|
|
69
|
+
var w = /* @__PURE__ */ b("<iframe>");
|
|
70
|
+
function D(e) {
|
|
71
|
+
const i = r(() => {
|
|
72
|
+
const t = e.host || "https://app.documenso.com", a = btoa(JSON.stringify({
|
|
253
73
|
name: e.name,
|
|
254
74
|
lockName: e.lockName,
|
|
255
75
|
css: e.css
|
|
256
76
|
}));
|
|
257
|
-
return `${new URL(`/embed/sign/${e.token}`,
|
|
77
|
+
return `${new URL(`/embed/sign/${e.token}`, t)}#${a}`;
|
|
258
78
|
});
|
|
259
|
-
function
|
|
260
|
-
var
|
|
261
|
-
if ((
|
|
262
|
-
switch (
|
|
79
|
+
function m(t) {
|
|
80
|
+
var a, n, d;
|
|
81
|
+
if ((c == null ? void 0 : c.contentWindow) === t.source)
|
|
82
|
+
switch (t.data.action) {
|
|
263
83
|
case "document-ready":
|
|
264
|
-
(
|
|
84
|
+
(a = e.onDocumentReady) == null || a.call(e);
|
|
265
85
|
break;
|
|
266
86
|
case "document-completed":
|
|
267
|
-
(
|
|
87
|
+
(n = e.onDocumentCompleted) == null || n.call(e, t.data.data);
|
|
268
88
|
break;
|
|
269
89
|
case "document-error":
|
|
270
|
-
(
|
|
90
|
+
(d = e.onDocumentError) == null || d.call(e, t.data.data);
|
|
271
91
|
break;
|
|
272
92
|
}
|
|
273
93
|
}
|
|
274
|
-
let
|
|
275
|
-
return
|
|
276
|
-
window.addEventListener("message",
|
|
94
|
+
let c;
|
|
95
|
+
return s(() => {
|
|
96
|
+
window.addEventListener("message", m);
|
|
277
97
|
}), (() => {
|
|
278
|
-
var
|
|
279
|
-
return typeof
|
|
280
|
-
var
|
|
281
|
-
return
|
|
98
|
+
var t = w(), a = c;
|
|
99
|
+
return typeof a == "function" ? v(a, t) : c = t, f((n) => {
|
|
100
|
+
var d = e.className, u = i();
|
|
101
|
+
return d !== n.e && g(t, n.e = d), u !== n.t && k(t, "src", n.t = u), n;
|
|
282
102
|
}, {
|
|
283
103
|
e: void 0,
|
|
284
104
|
t: void 0
|
|
285
|
-
}),
|
|
105
|
+
}), t;
|
|
286
106
|
})();
|
|
287
107
|
}
|
|
288
108
|
export {
|
|
289
|
-
|
|
290
|
-
|
|
109
|
+
$ as EmbedDirectTemplate,
|
|
110
|
+
D as EmbedSignDocument
|
|
291
111
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@documenso/embed-solid",
|
|
3
|
-
"version": "0.0.1",
|
|
3
|
+
"version": "0.0.2-rc.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "vite build",
|
|
29
|
-
"clean": "rimraf node_modules",
|
|
29
|
+
"clean": "rimraf node_modules && rimraf src",
|
|
30
30
|
"check-exports": "attw --pack .",
|
|
31
31
|
"publint": "publint"
|
|
32
32
|
},
|