@superdoc-dev/esign 1.0.0-next.2 → 1.0.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/README.md +104 -169
- package/dist/defaults/ConsentCheckbox.d.ts +4 -0
- package/dist/defaults/ConsentCheckbox.d.ts.map +1 -0
- package/dist/defaults/DownloadButton.d.ts +4 -0
- package/dist/defaults/DownloadButton.d.ts.map +1 -0
- package/dist/defaults/SignatureInput.d.ts +4 -0
- package/dist/defaults/SignatureInput.d.ts.map +1 -0
- package/dist/defaults/SubmitButton.d.ts +4 -0
- package/dist/defaults/SubmitButton.d.ts.map +1 -0
- package/dist/defaults/index.d.ts +5 -0
- package/dist/defaults/index.d.ts.map +1 -0
- package/dist/index.d.ts +5 -60
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.mjs +494 -363
- package/dist/types.d.ts +107 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +5 -3
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
var
|
|
1
|
+
import le, { forwardRef as ue, useState as N, useRef as Z, useCallback as P, useEffect as re, useImperativeHandle as de } from "react";
|
|
2
|
+
var Q = { exports: {} }, L = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
5
5
|
* react-jsx-runtime.production.js
|
|
@@ -9,29 +9,29 @@ var X = { exports: {} }, Y = {};
|
|
|
9
9
|
* This source code is licensed under the MIT license found in the
|
|
10
10
|
* LICENSE file in the root directory of this source tree.
|
|
11
11
|
*/
|
|
12
|
-
var
|
|
13
|
-
function
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
var
|
|
17
|
-
function p(
|
|
18
|
-
var
|
|
19
|
-
if (
|
|
20
|
-
|
|
21
|
-
for (var
|
|
22
|
-
|
|
23
|
-
} else
|
|
24
|
-
return
|
|
25
|
-
$$typeof:
|
|
26
|
-
type:
|
|
27
|
-
key:
|
|
28
|
-
ref:
|
|
29
|
-
props:
|
|
12
|
+
var ne;
|
|
13
|
+
function fe() {
|
|
14
|
+
if (ne) return L;
|
|
15
|
+
ne = 1;
|
|
16
|
+
var f = Symbol.for("react.transitional.element"), g = Symbol.for("react.fragment");
|
|
17
|
+
function p(s, o, l) {
|
|
18
|
+
var v = null;
|
|
19
|
+
if (l !== void 0 && (v = "" + l), o.key !== void 0 && (v = "" + o.key), "key" in o) {
|
|
20
|
+
l = {};
|
|
21
|
+
for (var _ in o)
|
|
22
|
+
_ !== "key" && (l[_] = o[_]);
|
|
23
|
+
} else l = o;
|
|
24
|
+
return o = l.ref, {
|
|
25
|
+
$$typeof: f,
|
|
26
|
+
type: s,
|
|
27
|
+
key: v,
|
|
28
|
+
ref: o !== void 0 ? o : null,
|
|
29
|
+
props: l
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
return
|
|
32
|
+
return L.Fragment = g, L.jsx = p, L.jsxs = p, L;
|
|
33
33
|
}
|
|
34
|
-
var
|
|
34
|
+
var U = {};
|
|
35
35
|
/**
|
|
36
36
|
* @license React
|
|
37
37
|
* react-jsx-runtime.development.js
|
|
@@ -41,24 +41,24 @@ var M = {};
|
|
|
41
41
|
* This source code is licensed under the MIT license found in the
|
|
42
42
|
* LICENSE file in the root directory of this source tree.
|
|
43
43
|
*/
|
|
44
|
-
var
|
|
45
|
-
function
|
|
46
|
-
return
|
|
47
|
-
function
|
|
44
|
+
var oe;
|
|
45
|
+
function me() {
|
|
46
|
+
return oe || (oe = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
47
|
+
function f(e) {
|
|
48
48
|
if (e == null) return null;
|
|
49
49
|
if (typeof e == "function")
|
|
50
|
-
return e.$$typeof ===
|
|
50
|
+
return e.$$typeof === ee ? null : e.displayName || e.name || null;
|
|
51
51
|
if (typeof e == "string") return e;
|
|
52
52
|
switch (e) {
|
|
53
|
-
case
|
|
53
|
+
case y:
|
|
54
54
|
return "Fragment";
|
|
55
55
|
case h:
|
|
56
56
|
return "Profiler";
|
|
57
|
-
case
|
|
57
|
+
case V:
|
|
58
58
|
return "StrictMode";
|
|
59
|
-
case
|
|
59
|
+
case S:
|
|
60
60
|
return "Suspense";
|
|
61
|
-
case
|
|
61
|
+
case J:
|
|
62
62
|
return "SuspenseList";
|
|
63
63
|
case H:
|
|
64
64
|
return "Activity";
|
|
@@ -67,100 +67,100 @@ function ce() {
|
|
|
67
67
|
switch (typeof e.tag == "number" && console.error(
|
|
68
68
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
69
69
|
), e.$$typeof) {
|
|
70
|
-
case
|
|
70
|
+
case K:
|
|
71
71
|
return "Portal";
|
|
72
|
-
case
|
|
72
|
+
case w:
|
|
73
73
|
return e.displayName || "Context";
|
|
74
|
-
case
|
|
74
|
+
case z:
|
|
75
75
|
return (e._context.displayName || "Context") + ".Consumer";
|
|
76
|
-
case
|
|
77
|
-
var
|
|
78
|
-
return e = e.displayName, e || (e =
|
|
79
|
-
case
|
|
80
|
-
return
|
|
81
|
-
case
|
|
82
|
-
|
|
76
|
+
case B:
|
|
77
|
+
var n = e.render;
|
|
78
|
+
return e = e.displayName, e || (e = n.displayName || n.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
79
|
+
case M:
|
|
80
|
+
return n = e.displayName || null, n !== null ? n : f(e.type) || "Memo";
|
|
81
|
+
case A:
|
|
82
|
+
n = e._payload, e = e._init;
|
|
83
83
|
try {
|
|
84
|
-
return
|
|
84
|
+
return f(e(n));
|
|
85
85
|
} catch {
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
return null;
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function g(e) {
|
|
91
91
|
return "" + e;
|
|
92
92
|
}
|
|
93
93
|
function p(e) {
|
|
94
94
|
try {
|
|
95
|
-
|
|
96
|
-
var
|
|
95
|
+
g(e);
|
|
96
|
+
var n = !1;
|
|
97
97
|
} catch {
|
|
98
|
-
|
|
98
|
+
n = !0;
|
|
99
99
|
}
|
|
100
|
-
if (
|
|
101
|
-
|
|
102
|
-
var
|
|
103
|
-
return
|
|
104
|
-
|
|
100
|
+
if (n) {
|
|
101
|
+
n = console;
|
|
102
|
+
var c = n.error, u = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
103
|
+
return c.call(
|
|
104
|
+
n,
|
|
105
105
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
106
|
-
|
|
107
|
-
),
|
|
106
|
+
u
|
|
107
|
+
), g(e);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
if (e ===
|
|
112
|
-
if (typeof e == "object" && e !== null && e.$$typeof ===
|
|
110
|
+
function s(e) {
|
|
111
|
+
if (e === y) return "<>";
|
|
112
|
+
if (typeof e == "object" && e !== null && e.$$typeof === A)
|
|
113
113
|
return "<...>";
|
|
114
114
|
try {
|
|
115
|
-
var
|
|
116
|
-
return
|
|
115
|
+
var n = f(e);
|
|
116
|
+
return n ? "<" + n + ">" : "<...>";
|
|
117
117
|
} catch {
|
|
118
118
|
return "<...>";
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
var e =
|
|
121
|
+
function o() {
|
|
122
|
+
var e = T.A;
|
|
123
123
|
return e === null ? null : e.getOwner();
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function l() {
|
|
126
126
|
return Error("react-stack-top-frame");
|
|
127
127
|
}
|
|
128
|
-
function
|
|
129
|
-
if (
|
|
130
|
-
var
|
|
131
|
-
if (
|
|
128
|
+
function v(e) {
|
|
129
|
+
if (E.call(e, "key")) {
|
|
130
|
+
var n = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
131
|
+
if (n && n.isReactWarning) return !1;
|
|
132
132
|
}
|
|
133
133
|
return e.key !== void 0;
|
|
134
134
|
}
|
|
135
|
-
function
|
|
136
|
-
function
|
|
137
|
-
|
|
135
|
+
function _(e, n) {
|
|
136
|
+
function c() {
|
|
137
|
+
k || (k = !0, console.error(
|
|
138
138
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
139
|
-
|
|
139
|
+
n
|
|
140
140
|
));
|
|
141
141
|
}
|
|
142
|
-
|
|
143
|
-
get:
|
|
142
|
+
c.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
143
|
+
get: c,
|
|
144
144
|
configurable: !0
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
var e =
|
|
149
|
-
return
|
|
147
|
+
function D() {
|
|
148
|
+
var e = f(this.type);
|
|
149
|
+
return G[e] || (G[e] = !0, console.error(
|
|
150
150
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
151
151
|
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
152
152
|
}
|
|
153
|
-
function q(e,
|
|
154
|
-
var
|
|
153
|
+
function q(e, n, c, u, O, $) {
|
|
154
|
+
var t = c.ref;
|
|
155
155
|
return e = {
|
|
156
|
-
$$typeof:
|
|
156
|
+
$$typeof: W,
|
|
157
157
|
type: e,
|
|
158
|
-
key:
|
|
159
|
-
props:
|
|
160
|
-
_owner:
|
|
161
|
-
}, (
|
|
158
|
+
key: n,
|
|
159
|
+
props: c,
|
|
160
|
+
_owner: u
|
|
161
|
+
}, (t !== void 0 ? t : null) !== null ? Object.defineProperty(e, "ref", {
|
|
162
162
|
enumerable: !1,
|
|
163
|
-
get:
|
|
163
|
+
get: D
|
|
164
164
|
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
165
165
|
configurable: !1,
|
|
166
166
|
enumerable: !1,
|
|
@@ -175,349 +175,480 @@ function ce() {
|
|
|
175
175
|
configurable: !1,
|
|
176
176
|
enumerable: !1,
|
|
177
177
|
writable: !0,
|
|
178
|
-
value:
|
|
178
|
+
value: O
|
|
179
179
|
}), Object.defineProperty(e, "_debugTask", {
|
|
180
180
|
configurable: !1,
|
|
181
181
|
enumerable: !1,
|
|
182
182
|
writable: !0,
|
|
183
|
-
value:
|
|
183
|
+
value: $
|
|
184
184
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
185
185
|
}
|
|
186
|
-
function
|
|
187
|
-
var
|
|
188
|
-
if (
|
|
189
|
-
if (
|
|
190
|
-
if (
|
|
191
|
-
for (
|
|
192
|
-
|
|
193
|
-
Object.freeze && Object.freeze(
|
|
186
|
+
function F(e, n, c, u, O, $) {
|
|
187
|
+
var t = n.children;
|
|
188
|
+
if (t !== void 0)
|
|
189
|
+
if (u)
|
|
190
|
+
if (te(t)) {
|
|
191
|
+
for (u = 0; u < t.length; u++)
|
|
192
|
+
I(t[u]);
|
|
193
|
+
Object.freeze && Object.freeze(t);
|
|
194
194
|
} else
|
|
195
195
|
console.error(
|
|
196
196
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
197
197
|
);
|
|
198
|
-
else
|
|
199
|
-
if (
|
|
200
|
-
|
|
201
|
-
var
|
|
202
|
-
return
|
|
198
|
+
else I(t);
|
|
199
|
+
if (E.call(n, "key")) {
|
|
200
|
+
t = f(e);
|
|
201
|
+
var r = Object.keys(n).filter(function(d) {
|
|
202
|
+
return d !== "key";
|
|
203
203
|
});
|
|
204
|
-
|
|
204
|
+
u = 0 < r.length ? "{key: someKey, " + r.join(": ..., ") + ": ...}" : "{key: someKey}", X[t + u] || (r = 0 < r.length ? "{" + r.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
205
205
|
`A props object containing a "key" prop is being spread into JSX:
|
|
206
206
|
let props = %s;
|
|
207
207
|
<%s {...props} />
|
|
208
208
|
React keys must be passed directly to JSX without using spread:
|
|
209
209
|
let props = %s;
|
|
210
210
|
<%s key={someKey} {...props} />`,
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
),
|
|
211
|
+
u,
|
|
212
|
+
t,
|
|
213
|
+
r,
|
|
214
|
+
t
|
|
215
|
+
), X[t + u] = !0);
|
|
216
216
|
}
|
|
217
|
-
if (
|
|
218
|
-
|
|
219
|
-
for (var
|
|
220
|
-
|
|
221
|
-
} else
|
|
222
|
-
return
|
|
223
|
-
|
|
217
|
+
if (t = null, c !== void 0 && (p(c), t = "" + c), v(n) && (p(n.key), t = "" + n.key), "key" in n) {
|
|
218
|
+
c = {};
|
|
219
|
+
for (var a in n)
|
|
220
|
+
a !== "key" && (c[a] = n[a]);
|
|
221
|
+
} else c = n;
|
|
222
|
+
return t && _(
|
|
223
|
+
c,
|
|
224
224
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
225
225
|
), q(
|
|
226
226
|
e,
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
227
|
+
t,
|
|
228
|
+
c,
|
|
229
|
+
o(),
|
|
230
|
+
O,
|
|
231
|
+
$
|
|
232
232
|
);
|
|
233
233
|
}
|
|
234
|
-
function
|
|
235
|
-
|
|
234
|
+
function I(e) {
|
|
235
|
+
b(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === A && (e._payload.status === "fulfilled" ? b(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
236
236
|
}
|
|
237
|
-
function
|
|
238
|
-
return typeof e == "object" && e !== null && e.$$typeof ===
|
|
237
|
+
function b(e) {
|
|
238
|
+
return typeof e == "object" && e !== null && e.$$typeof === W;
|
|
239
239
|
}
|
|
240
|
-
var
|
|
240
|
+
var C = le, W = Symbol.for("react.transitional.element"), K = Symbol.for("react.portal"), y = Symbol.for("react.fragment"), V = Symbol.for("react.strict_mode"), h = Symbol.for("react.profiler"), z = Symbol.for("react.consumer"), w = Symbol.for("react.context"), B = Symbol.for("react.forward_ref"), S = Symbol.for("react.suspense"), J = Symbol.for("react.suspense_list"), M = Symbol.for("react.memo"), A = Symbol.for("react.lazy"), H = Symbol.for("react.activity"), ee = Symbol.for("react.client.reference"), T = C.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, E = Object.prototype.hasOwnProperty, te = Array.isArray, x = console.createTask ? console.createTask : function() {
|
|
241
241
|
return null;
|
|
242
242
|
};
|
|
243
|
-
|
|
243
|
+
C = {
|
|
244
244
|
react_stack_bottom_frame: function(e) {
|
|
245
245
|
return e();
|
|
246
246
|
}
|
|
247
247
|
};
|
|
248
|
-
var
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
)(),
|
|
252
|
-
|
|
253
|
-
var
|
|
254
|
-
return
|
|
248
|
+
var k, G = {}, Y = C.react_stack_bottom_frame.bind(
|
|
249
|
+
C,
|
|
250
|
+
l
|
|
251
|
+
)(), j = x(s(l)), X = {};
|
|
252
|
+
U.Fragment = y, U.jsx = function(e, n, c) {
|
|
253
|
+
var u = 1e4 > T.recentlyCreatedOwnerStacks++;
|
|
254
|
+
return F(
|
|
255
255
|
e,
|
|
256
|
-
|
|
257
|
-
|
|
256
|
+
n,
|
|
257
|
+
c,
|
|
258
258
|
!1,
|
|
259
|
-
|
|
260
|
-
|
|
259
|
+
u ? Error("react-stack-top-frame") : Y,
|
|
260
|
+
u ? x(s(e)) : j
|
|
261
261
|
);
|
|
262
|
-
},
|
|
263
|
-
var
|
|
264
|
-
return
|
|
262
|
+
}, U.jsxs = function(e, n, c) {
|
|
263
|
+
var u = 1e4 > T.recentlyCreatedOwnerStacks++;
|
|
264
|
+
return F(
|
|
265
265
|
e,
|
|
266
|
-
|
|
267
|
-
|
|
266
|
+
n,
|
|
267
|
+
c,
|
|
268
268
|
!0,
|
|
269
|
-
|
|
270
|
-
|
|
269
|
+
u ? Error("react-stack-top-frame") : Y,
|
|
270
|
+
u ? x(s(e)) : j
|
|
271
271
|
);
|
|
272
272
|
};
|
|
273
|
-
})()),
|
|
273
|
+
})()), U;
|
|
274
274
|
}
|
|
275
|
-
var
|
|
276
|
-
function
|
|
277
|
-
return
|
|
275
|
+
var ae;
|
|
276
|
+
function pe() {
|
|
277
|
+
return ae || (ae = 1, process.env.NODE_ENV === "production" ? Q.exports = fe() : Q.exports = me()), Q.exports;
|
|
278
278
|
}
|
|
279
|
-
var
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
279
|
+
var m = pe();
|
|
280
|
+
const ge = ({
|
|
281
|
+
value: f,
|
|
282
|
+
onChange: g,
|
|
283
|
+
isDisabled: p,
|
|
284
|
+
label: s
|
|
285
|
+
}) => /* @__PURE__ */ m.jsxs("div", { className: "superdoc-esign-signature-input", style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
|
|
286
|
+
s && /* @__PURE__ */ m.jsx("label", { children: s }),
|
|
287
|
+
/* @__PURE__ */ m.jsx(
|
|
288
|
+
"input",
|
|
289
|
+
{
|
|
290
|
+
type: "text",
|
|
291
|
+
value: String(f || ""),
|
|
292
|
+
onChange: (o) => g(o.target.value),
|
|
293
|
+
disabled: p,
|
|
294
|
+
placeholder: "Type your full name",
|
|
295
|
+
style: {
|
|
296
|
+
fontFamily: "cursive",
|
|
297
|
+
fontSize: "18px"
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
)
|
|
301
|
+
] }), ve = ({
|
|
302
|
+
value: f,
|
|
303
|
+
onChange: g,
|
|
304
|
+
isDisabled: p,
|
|
305
|
+
label: s
|
|
306
|
+
}) => /* @__PURE__ */ m.jsxs(
|
|
307
|
+
"label",
|
|
308
|
+
{
|
|
309
|
+
className: "superdoc-esign-consent-checkbox",
|
|
310
|
+
style: { display: "flex", gap: "8px" },
|
|
311
|
+
children: [
|
|
312
|
+
/* @__PURE__ */ m.jsx(
|
|
313
|
+
"input",
|
|
314
|
+
{
|
|
315
|
+
type: "checkbox",
|
|
316
|
+
checked: !!f,
|
|
317
|
+
onChange: (o) => g(o.target.checked),
|
|
318
|
+
disabled: p
|
|
319
|
+
}
|
|
320
|
+
),
|
|
321
|
+
/* @__PURE__ */ m.jsx("span", { children: s })
|
|
322
|
+
]
|
|
323
|
+
}
|
|
324
|
+
), be = (f) => ({
|
|
325
|
+
onClick: p,
|
|
326
|
+
fileName: s,
|
|
327
|
+
isDisabled: o
|
|
328
|
+
}) => {
|
|
329
|
+
const l = f?.label || "Download";
|
|
330
|
+
return /* @__PURE__ */ m.jsxs(
|
|
331
|
+
"button",
|
|
332
|
+
{
|
|
333
|
+
onClick: p,
|
|
334
|
+
disabled: o,
|
|
335
|
+
className: "superdoc-esign-btn",
|
|
336
|
+
style: {
|
|
337
|
+
padding: "10px 20px",
|
|
338
|
+
borderRadius: "6px",
|
|
339
|
+
border: "none",
|
|
340
|
+
background: "#fff",
|
|
341
|
+
color: "#333",
|
|
342
|
+
cursor: o ? "not-allowed" : "pointer",
|
|
343
|
+
opacity: o ? 0.5 : 1,
|
|
344
|
+
fontSize: "16px",
|
|
345
|
+
fontWeight: "bold"
|
|
346
|
+
},
|
|
347
|
+
children: [
|
|
348
|
+
l,
|
|
349
|
+
" ",
|
|
350
|
+
s && `(${s})`
|
|
351
|
+
]
|
|
352
|
+
}
|
|
353
|
+
);
|
|
354
|
+
}, he = (f) => ({
|
|
355
|
+
onClick: p,
|
|
356
|
+
isValid: s,
|
|
357
|
+
isDisabled: o,
|
|
358
|
+
isSubmitting: l
|
|
359
|
+
}) => {
|
|
360
|
+
const v = () => f?.label || "Submit";
|
|
361
|
+
return /* @__PURE__ */ m.jsx(
|
|
362
|
+
"button",
|
|
363
|
+
{
|
|
364
|
+
onClick: p,
|
|
365
|
+
disabled: !s || o || l,
|
|
366
|
+
className: "superdoc-esign-btn",
|
|
367
|
+
style: {
|
|
368
|
+
padding: "12px 24px",
|
|
369
|
+
borderRadius: "6px",
|
|
370
|
+
border: "none",
|
|
371
|
+
background: "#007bff",
|
|
372
|
+
color: "#fff",
|
|
373
|
+
cursor: !s || o ? "not-allowed" : "pointer",
|
|
374
|
+
opacity: !s || o ? 0.5 : 1,
|
|
375
|
+
fontSize: "16px",
|
|
376
|
+
fontWeight: "bold"
|
|
377
|
+
},
|
|
378
|
+
children: v()
|
|
379
|
+
}
|
|
380
|
+
);
|
|
381
|
+
}, Ee = ue(
|
|
382
|
+
(f, g) => {
|
|
383
|
+
const {
|
|
384
|
+
eventId: p,
|
|
385
|
+
document: s,
|
|
386
|
+
fields: o = {},
|
|
387
|
+
download: l,
|
|
388
|
+
submit: v,
|
|
389
|
+
onSubmit: _,
|
|
390
|
+
onDownload: D,
|
|
391
|
+
onStateChange: q,
|
|
392
|
+
onFieldChange: F,
|
|
393
|
+
onFieldsDiscovered: I,
|
|
394
|
+
isDisabled: b = !1,
|
|
395
|
+
className: C,
|
|
396
|
+
style: W,
|
|
397
|
+
documentHeight: K = "600px"
|
|
398
|
+
} = f, [y, V] = N(
|
|
399
|
+
!s.validation?.scroll?.required
|
|
400
|
+
), [h, z] = N(/* @__PURE__ */ new Map()), [w, B] = N(!1), [S, J] = N(!1), [M, A] = N([]), [H, ee] = N(!1), T = Z(null), E = Z(null), te = Z(Date.now()), x = Z(o);
|
|
401
|
+
x.current = o;
|
|
402
|
+
const k = P((t) => {
|
|
403
|
+
if (!E.current?.activeEditor) return;
|
|
404
|
+
const r = E.current.activeEditor, a = x.current.signer?.find((i) => i.id === t.id);
|
|
405
|
+
let d;
|
|
406
|
+
a?.type === "signature" && t.value ? d = {
|
|
407
|
+
json: {
|
|
408
|
+
type: "image",
|
|
409
|
+
attrs: { src: typeof t.value == "string" && t.value.startsWith("data:image/") ? t.value : G(String(t.value)), alt: "Signature" }
|
|
410
|
+
}
|
|
411
|
+
} : d = { text: String(t.value ?? "") }, t.id && r.commands.updateStructuredContentById(
|
|
412
|
+
t.id,
|
|
413
|
+
d
|
|
299
414
|
);
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
415
|
+
}, []);
|
|
416
|
+
function G(t) {
|
|
417
|
+
const r = globalThis.document.createElement("canvas"), a = r.getContext("2d"), d = 30;
|
|
418
|
+
a.font = `italic ${d}px cursive`;
|
|
419
|
+
const R = a.measureText(t).width, se = d * 1.3, ie = 4, ce = 6;
|
|
420
|
+
return r.width = Math.ceil(R + ie * 2) + 20, r.height = Math.ceil(se + ce * 2), a.font = `italic ${d}px cursive`, a.fillStyle = "black", a.textAlign = "center", a.textBaseline = "middle", a.fillText(
|
|
421
|
+
t,
|
|
422
|
+
r.width / 2,
|
|
423
|
+
r.height / 2
|
|
424
|
+
), r.toDataURL("image/png");
|
|
425
|
+
}
|
|
426
|
+
const Y = P(
|
|
427
|
+
(t) => {
|
|
428
|
+
if (!t) return;
|
|
429
|
+
const r = t.helpers.structuredContentCommands.getStructuredContentTags(
|
|
430
|
+
t.state
|
|
431
|
+
), a = /* @__PURE__ */ new Map();
|
|
432
|
+
x.current.document?.forEach((i) => {
|
|
433
|
+
i.id && a.set(i.id, i.value);
|
|
434
|
+
}), x.current.signer?.forEach((i) => {
|
|
435
|
+
i.value !== void 0 && a.set(i.id, i.value);
|
|
436
|
+
});
|
|
437
|
+
const d = r.map(({ node: i }) => ({
|
|
438
|
+
id: i.attrs.id,
|
|
439
|
+
label: i.attrs.label,
|
|
440
|
+
value: a.get(i.attrs.id) ?? i.textContent ?? ""
|
|
441
|
+
})).filter((i) => i.id);
|
|
442
|
+
d.length > 0 && (I?.(d), [
|
|
443
|
+
...x.current.document || [],
|
|
444
|
+
...x.current.signer || []
|
|
445
|
+
].filter((R) => R.value !== void 0).forEach(
|
|
446
|
+
(R) => k({
|
|
447
|
+
id: R.id,
|
|
448
|
+
value: R.value
|
|
449
|
+
})
|
|
450
|
+
));
|
|
451
|
+
},
|
|
452
|
+
[I, k]
|
|
453
|
+
), j = (t) => {
|
|
454
|
+
const r = {
|
|
455
|
+
...t,
|
|
456
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
305
457
|
};
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
458
|
+
A((a) => [...a, r]);
|
|
459
|
+
};
|
|
460
|
+
re(() => T.current ? ((async () => {
|
|
461
|
+
const { SuperDoc: r } = await import("superdoc"), a = new r({
|
|
462
|
+
selector: T.current,
|
|
463
|
+
document: s.source,
|
|
311
464
|
documentMode: "viewing",
|
|
312
465
|
onReady: () => {
|
|
313
|
-
|
|
314
|
-
},
|
|
315
|
-
onException: ({ error: n }) => {
|
|
316
|
-
console.error("SuperDoc error:", n);
|
|
466
|
+
a.activeEditor && Y(a.activeEditor), j({ type: "ready" }), ee(!0);
|
|
317
467
|
}
|
|
318
468
|
});
|
|
319
|
-
|
|
469
|
+
E.current = a;
|
|
320
470
|
})(), () => {
|
|
321
|
-
|
|
322
|
-
}) : void 0, [
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
471
|
+
E.current && (E.current.destroy(), E.current = null);
|
|
472
|
+
}) : void 0, [s.source, s.mode, Y]), re(() => {
|
|
473
|
+
if (!s.validation?.scroll?.required || !H) return;
|
|
474
|
+
const t = T.current;
|
|
475
|
+
if (!t) return;
|
|
476
|
+
const r = () => {
|
|
477
|
+
const { scrollTop: a, scrollHeight: d, clientHeight: i } = t, R = a / (d - i);
|
|
478
|
+
(R >= 0.95 || d <= i) && (V(!0), j({
|
|
479
|
+
type: "scroll",
|
|
480
|
+
data: { percent: Math.round(R * 100) }
|
|
481
|
+
}));
|
|
482
|
+
};
|
|
483
|
+
return t.addEventListener("scroll", r), r(), () => t.removeEventListener("scroll", r);
|
|
484
|
+
}, [s.validation?.scroll?.required, H]);
|
|
485
|
+
const X = P(
|
|
486
|
+
(t, r) => {
|
|
487
|
+
z((a) => {
|
|
488
|
+
const d = a.get(t), i = new Map(a);
|
|
489
|
+
return i.set(t, r), k({
|
|
490
|
+
id: t,
|
|
491
|
+
value: r
|
|
492
|
+
}), j({
|
|
493
|
+
type: "field_change",
|
|
494
|
+
data: { fieldId: t, value: r, previousValue: d }
|
|
495
|
+
}), F?.({
|
|
496
|
+
id: t,
|
|
497
|
+
value: r,
|
|
498
|
+
previousValue: d
|
|
499
|
+
}), i;
|
|
344
500
|
});
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
501
|
+
},
|
|
502
|
+
[F, k]
|
|
503
|
+
), e = P(() => s.validation?.scroll?.required && !y ? !1 : (o.signer || []).every((t) => {
|
|
504
|
+
if (!t.validation?.required) return !0;
|
|
505
|
+
const r = h.get(t.id);
|
|
506
|
+
return r && (typeof r != "string" || r.trim());
|
|
507
|
+
}), [y, o.signer, h, s.validation?.scroll?.required]);
|
|
508
|
+
re(() => {
|
|
509
|
+
const t = e();
|
|
510
|
+
B(t), q?.({
|
|
511
|
+
scrolled: y,
|
|
512
|
+
fields: h,
|
|
513
|
+
isValid: t,
|
|
514
|
+
isSubmitting: S
|
|
353
515
|
});
|
|
354
|
-
};
|
|
355
|
-
|
|
356
|
-
if (
|
|
357
|
-
const
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
(r / (n - o) >= 0.95 || n <= o) && U(!0);
|
|
362
|
-
};
|
|
363
|
-
return e.addEventListener("scroll", t), t(), () => e.removeEventListener("scroll", t);
|
|
364
|
-
}, [s.scroll, y]), k(() => {
|
|
365
|
-
if (!s.signature) return;
|
|
366
|
-
const e = () => {
|
|
367
|
-
const n = globalThis.document.querySelector(
|
|
368
|
-
i
|
|
369
|
-
);
|
|
370
|
-
if (!n) return;
|
|
371
|
-
const o = Z(n);
|
|
372
|
-
z(o);
|
|
373
|
-
}, t = new MutationObserver(e);
|
|
374
|
-
t.observe(globalThis.document.body, {
|
|
375
|
-
childList: !0,
|
|
376
|
-
subtree: !0,
|
|
377
|
-
attributes: !0,
|
|
378
|
-
attributeFilter: ["value", "data-signed"]
|
|
516
|
+
}, [y, h, S, e, q]);
|
|
517
|
+
const n = P(async () => {
|
|
518
|
+
if (b) return;
|
|
519
|
+
const t = await E.current?.export({
|
|
520
|
+
exportType: ["pdf"],
|
|
521
|
+
isFinalDoc: !0,
|
|
522
|
+
triggerDownload: !1
|
|
379
523
|
});
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
};
|
|
386
|
-
}, [s.signature, i]), k(() => {
|
|
387
|
-
if (!s.consents || s.consents.length === 0) return;
|
|
388
|
-
const e = () => {
|
|
389
|
-
const r = globalThis.document.querySelectorAll(
|
|
390
|
-
c
|
|
391
|
-
), n = /* @__PURE__ */ new Set();
|
|
392
|
-
r.forEach((o) => {
|
|
393
|
-
const l = o.name || o.dataset.esignConsent || o.id;
|
|
394
|
-
l && o.checked && n.add(l);
|
|
395
|
-
}), J(n);
|
|
396
|
-
}, t = (r) => {
|
|
397
|
-
r.target.matches(c) && e();
|
|
398
|
-
};
|
|
399
|
-
return globalThis.document.addEventListener("change", t, !0), e(), () => {
|
|
400
|
-
globalThis.document.removeEventListener("change", t, !0);
|
|
401
|
-
};
|
|
402
|
-
}, [s.consents, c]);
|
|
403
|
-
const Z = (e) => {
|
|
404
|
-
if (!e) return !1;
|
|
405
|
-
if (e.tagName === "CANVAS") {
|
|
406
|
-
const t = e, r = t.getContext("2d");
|
|
407
|
-
return r ? r.getImageData(0, 0, t.width, t.height).data.some(
|
|
408
|
-
(o) => o !== 0 && o !== 255
|
|
409
|
-
) : !1;
|
|
524
|
+
if (t && D)
|
|
525
|
+
D(t, l?.fileName || "document.pdf");
|
|
526
|
+
else if (t) {
|
|
527
|
+
const r = URL.createObjectURL(t), a = globalThis.document.createElement("a");
|
|
528
|
+
a.href = r, a.download = l?.fileName || "document.pdf", a.click(), URL.revokeObjectURL(r);
|
|
410
529
|
}
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
if (e?.dataset.signatureImage)
|
|
417
|
-
return e.dataset.signatureImage;
|
|
418
|
-
if (e?.tagName === "CANVAS")
|
|
419
|
-
return e.toDataURL("image/png");
|
|
420
|
-
};
|
|
421
|
-
k(() => {
|
|
422
|
-
const e = T();
|
|
423
|
-
b?.(e);
|
|
424
|
-
}, [v, g, h, s, T, b]);
|
|
425
|
-
const N = A(async () => {
|
|
426
|
-
if (!T().isValid) return !1;
|
|
427
|
-
const t = Array.from(f.values()).map(
|
|
428
|
-
(n) => ({
|
|
429
|
-
id: n.id,
|
|
430
|
-
alias: n.label,
|
|
431
|
-
value: n.value
|
|
432
|
-
})
|
|
433
|
-
), r = {
|
|
530
|
+
}, [b, l, D]), c = P(async () => {
|
|
531
|
+
if (!w || b || S) return;
|
|
532
|
+
J(!0), j({ type: "submit" });
|
|
533
|
+
const t = {
|
|
534
|
+
eventId: p,
|
|
434
535
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
435
|
-
duration: Math.
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
536
|
+
duration: Math.floor((Date.now() - te.current) / 1e3),
|
|
537
|
+
auditTrail: M,
|
|
538
|
+
documentFields: o.document || [],
|
|
539
|
+
signerFields: (o.signer || []).map((r) => ({
|
|
540
|
+
id: r.id,
|
|
541
|
+
value: h.get(r.id) ?? null
|
|
542
|
+
})),
|
|
543
|
+
isFullyCompleted: w
|
|
441
544
|
};
|
|
442
|
-
return await V?.(r), r;
|
|
443
|
-
}, [f, v, g, h, T, V]), j = A(() => {
|
|
444
|
-
U(!1), z(!1), J(/* @__PURE__ */ new Set()), H.current = Date.now(), R.current && (R.current.scrollTop = 0);
|
|
445
|
-
const e = globalThis.document.querySelector(
|
|
446
|
-
i
|
|
447
|
-
);
|
|
448
|
-
e && (e.tagName === "CANVAS" ? e.getContext("2d")?.clearRect(
|
|
449
|
-
0,
|
|
450
|
-
0,
|
|
451
|
-
e.clientWidth,
|
|
452
|
-
e.clientHeight
|
|
453
|
-
) : "value" in e && (e.value = ""), e.dataset.signed = "false"), globalThis.document.querySelectorAll(
|
|
454
|
-
c
|
|
455
|
-
).forEach((r) => {
|
|
456
|
-
r.checked = !1;
|
|
457
|
-
});
|
|
458
|
-
}, [i, c]), D = A(
|
|
459
|
-
(e) => {
|
|
460
|
-
e.forEach((t) => {
|
|
461
|
-
O(t);
|
|
462
|
-
const r = f.get(t.id || "");
|
|
463
|
-
r && (r.value = t.value, G(new Map(f)));
|
|
464
|
-
});
|
|
465
|
-
},
|
|
466
|
-
[f]
|
|
467
|
-
), I = A(() => Array.from(f.values()), [f]), S = A(async () => {
|
|
468
|
-
if (!d.current) return !1;
|
|
469
545
|
try {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
triggerDownload: !1
|
|
474
|
-
});
|
|
475
|
-
if (!e) return !1;
|
|
476
|
-
const t = {
|
|
477
|
-
blob: e,
|
|
478
|
-
fields: Array.from(f.values())
|
|
479
|
-
};
|
|
480
|
-
return await x?.(t), t;
|
|
481
|
-
} catch (e) {
|
|
482
|
-
return console.error("Download request failed:", e), !1;
|
|
546
|
+
await _(t);
|
|
547
|
+
} finally {
|
|
548
|
+
J(!1);
|
|
483
549
|
}
|
|
484
|
-
}, [
|
|
485
|
-
return k(() => {
|
|
486
|
-
if (!y) return;
|
|
487
|
-
const e = (r) => {
|
|
488
|
-
r.preventDefault(), S();
|
|
489
|
-
}, t = globalThis.document.querySelectorAll(u);
|
|
490
|
-
return t.forEach((r) => {
|
|
491
|
-
r.addEventListener("click", e);
|
|
492
|
-
}), () => {
|
|
493
|
-
t.forEach((r) => {
|
|
494
|
-
r.removeEventListener("click", e);
|
|
495
|
-
});
|
|
496
|
-
};
|
|
497
|
-
}, [u, y, S]), oe(
|
|
550
|
+
}, [
|
|
498
551
|
w,
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
552
|
+
b,
|
|
553
|
+
S,
|
|
554
|
+
p,
|
|
555
|
+
M,
|
|
556
|
+
o,
|
|
557
|
+
h,
|
|
558
|
+
_
|
|
559
|
+
]), u = (t) => {
|
|
560
|
+
const r = t.component || O(t.type);
|
|
561
|
+
return /* @__PURE__ */ m.jsx(
|
|
562
|
+
r,
|
|
563
|
+
{
|
|
564
|
+
value: h.get(t.id) ?? null,
|
|
565
|
+
onChange: (a) => X(t.id, a),
|
|
566
|
+
isDisabled: b,
|
|
567
|
+
label: t.label
|
|
568
|
+
},
|
|
569
|
+
t.id
|
|
570
|
+
);
|
|
571
|
+
}, O = (t) => {
|
|
572
|
+
switch (t) {
|
|
573
|
+
case "signature":
|
|
574
|
+
case "text":
|
|
575
|
+
return ge;
|
|
576
|
+
case "consent":
|
|
577
|
+
case "checkbox":
|
|
578
|
+
return ve;
|
|
579
|
+
}
|
|
580
|
+
}, $ = () => {
|
|
581
|
+
const t = l?.component || be(l), r = v?.component || he(v);
|
|
582
|
+
return /* @__PURE__ */ m.jsxs(
|
|
583
|
+
"div",
|
|
584
|
+
{
|
|
585
|
+
className: "superdoc-esign-actions",
|
|
586
|
+
style: { display: "flex", gap: "10px" },
|
|
587
|
+
children: [
|
|
588
|
+
s.mode !== "download" && /* @__PURE__ */ m.jsx(
|
|
589
|
+
r,
|
|
590
|
+
{
|
|
591
|
+
onClick: c,
|
|
592
|
+
isValid: w,
|
|
593
|
+
isDisabled: b,
|
|
594
|
+
isSubmitting: S
|
|
595
|
+
}
|
|
596
|
+
),
|
|
597
|
+
/* @__PURE__ */ m.jsx(
|
|
598
|
+
t,
|
|
599
|
+
{
|
|
600
|
+
onClick: n,
|
|
601
|
+
fileName: l?.fileName,
|
|
602
|
+
isDisabled: b
|
|
603
|
+
}
|
|
604
|
+
)
|
|
605
|
+
]
|
|
606
|
+
}
|
|
607
|
+
);
|
|
608
|
+
};
|
|
609
|
+
return de(g, () => ({
|
|
610
|
+
getState: () => ({
|
|
611
|
+
scrolled: y,
|
|
612
|
+
fields: h,
|
|
613
|
+
isValid: w,
|
|
614
|
+
isSubmitting: S
|
|
507
615
|
}),
|
|
508
|
-
|
|
509
|
-
|
|
616
|
+
getAuditTrail: () => M,
|
|
617
|
+
reset: () => {
|
|
618
|
+
V(!s.validation?.scroll?.required), z(/* @__PURE__ */ new Map()), B(!1), A([]);
|
|
619
|
+
}
|
|
620
|
+
})), /* @__PURE__ */ m.jsxs(
|
|
510
621
|
"div",
|
|
511
622
|
{
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
623
|
+
className: `superdoc-esign-container ${C || ""}`,
|
|
624
|
+
style: W,
|
|
625
|
+
children: [
|
|
626
|
+
/* @__PURE__ */ m.jsx("div", { className: "superdoc-esign-document", children: /* @__PURE__ */ m.jsx(
|
|
627
|
+
"div",
|
|
628
|
+
{
|
|
629
|
+
ref: T,
|
|
630
|
+
style: { height: K, overflow: "auto" }
|
|
631
|
+
}
|
|
632
|
+
) }),
|
|
633
|
+
/* @__PURE__ */ m.jsxs("div", { className: "superdoc-esign-controls", style: { marginTop: "20px" }, children: [
|
|
634
|
+
o.signer && o.signer.length > 0 && /* @__PURE__ */ m.jsx(
|
|
635
|
+
"div",
|
|
636
|
+
{
|
|
637
|
+
className: "superdoc-esign-fields",
|
|
638
|
+
style: { marginBottom: "20px" },
|
|
639
|
+
children: o.signer.map(u)
|
|
640
|
+
}
|
|
641
|
+
),
|
|
642
|
+
$()
|
|
643
|
+
] })
|
|
644
|
+
]
|
|
516
645
|
}
|
|
517
646
|
);
|
|
518
647
|
}
|
|
519
648
|
);
|
|
520
|
-
|
|
649
|
+
Ee.displayName = "SuperDocESign";
|
|
521
650
|
export {
|
|
522
|
-
|
|
651
|
+
ve as ConsentCheckbox,
|
|
652
|
+
ge as SignatureInput,
|
|
653
|
+
Ee as default
|
|
523
654
|
};
|