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