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