idmission-web-sdk 2.2.140 → 2.2.141
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/sdk2.cjs.development.js +1 -1
- package/dist/sdk2.cjs.development.js.map +1 -1
- package/dist/sdk2.cjs.production.js +1 -1
- package/dist/sdk2.cjs.production.js.map +1 -1
- package/dist/sdk2.esm.js +1 -1
- package/dist/sdk2.esm.js.map +1 -1
- package/dist/sdk2.umd.development.js +244 -259
- package/dist/sdk2.umd.development.js.map +1 -1
- package/dist/sdk2.umd.production.js +1 -1
- package/dist/sdk2.umd.production.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +4 -4
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react-dom/client'), require('platform'), require('styled-components'), require('tus-js-client'), require('react-dom'), require('prop-types')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', 'react', 'react-dom/client', 'platform', 'styled-components', 'tus-js-client', 'react-dom', 'prop-types'], factory) :
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Sdk2 = {}, global.React, global.ReactDOM, global.platform, global.styled, global.tusJsClient, global.ReactDOM, global.PropTypes));
|
|
5
|
-
})(this, (function (exports, React, ReactDOM, platform, styled, tusJsClient, reactDom,
|
|
5
|
+
})(this, (function (exports, React, ReactDOM, platform, styled, tusJsClient, reactDom, PropTypes) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopNamespaceDefault(e) {
|
|
8
8
|
var n = Object.create(null);
|
|
@@ -211,7 +211,7 @@
|
|
|
211
211
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
212
212
|
};
|
|
213
213
|
|
|
214
|
-
var webSdkVersion = '2.2.
|
|
214
|
+
var webSdkVersion = '2.2.141';
|
|
215
215
|
|
|
216
216
|
function getPlatform() {
|
|
217
217
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -529,31 +529,6 @@
|
|
|
529
529
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
530
530
|
}
|
|
531
531
|
|
|
532
|
-
function getAugmentedNamespace(n) {
|
|
533
|
-
if (n.__esModule) return n;
|
|
534
|
-
var f = n.default;
|
|
535
|
-
if (typeof f == "function") {
|
|
536
|
-
var a = function a () {
|
|
537
|
-
if (this instanceof a) {
|
|
538
|
-
return Reflect.construct(f, arguments, this.constructor);
|
|
539
|
-
}
|
|
540
|
-
return f.apply(this, arguments);
|
|
541
|
-
};
|
|
542
|
-
a.prototype = f.prototype;
|
|
543
|
-
} else a = {};
|
|
544
|
-
Object.defineProperty(a, '__esModule', {value: true});
|
|
545
|
-
Object.keys(n).forEach(function (k) {
|
|
546
|
-
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
547
|
-
Object.defineProperty(a, k, d.get ? d : {
|
|
548
|
-
enumerable: true,
|
|
549
|
-
get: function () {
|
|
550
|
-
return n[k];
|
|
551
|
-
}
|
|
552
|
-
});
|
|
553
|
-
});
|
|
554
|
-
return a;
|
|
555
|
-
}
|
|
556
|
-
|
|
557
532
|
function warn$1() {
|
|
558
533
|
if (console && console.warn) {
|
|
559
534
|
var _console;
|
|
@@ -10435,7 +10410,7 @@
|
|
|
10435
10410
|
});
|
|
10436
10411
|
}
|
|
10437
10412
|
|
|
10438
|
-
var _excluded = ["enabled", "anonymousActionType", "store"],
|
|
10413
|
+
var _excluded$1 = ["enabled", "anonymousActionType", "store"],
|
|
10439
10414
|
_excluded2 = ["connection"];
|
|
10440
10415
|
var trackedConnections = /* @__PURE__ */new Map();
|
|
10441
10416
|
var getTrackedConnectionState = function getTrackedConnectionState(name) {
|
|
@@ -10480,7 +10455,7 @@
|
|
|
10480
10455
|
enabled = _devtoolsOptions.enabled,
|
|
10481
10456
|
anonymousActionType = _devtoolsOptions.anonymousActionType,
|
|
10482
10457
|
store = _devtoolsOptions.store,
|
|
10483
|
-
options = _objectWithoutPropertiesLoose(_devtoolsOptions, _excluded);
|
|
10458
|
+
options = _objectWithoutPropertiesLoose(_devtoolsOptions, _excluded$1);
|
|
10484
10459
|
var extensionConnector;
|
|
10485
10460
|
try {
|
|
10486
10461
|
extensionConnector = (enabled != null ? enabled : (undefined ? undefined.MODE : void 0) !== "production") && window.__REDUX_DEVTOOLS_EXTENSION__;
|
|
@@ -21824,7 +21799,49 @@
|
|
|
21824
21799
|
});
|
|
21825
21800
|
};
|
|
21826
21801
|
|
|
21827
|
-
|
|
21802
|
+
function _objectWithoutProperties(e, t) {
|
|
21803
|
+
if (null == e) return {};
|
|
21804
|
+
var o,
|
|
21805
|
+
r,
|
|
21806
|
+
i = _objectWithoutPropertiesLoose(e, t);
|
|
21807
|
+
if (Object.getOwnPropertySymbols) {
|
|
21808
|
+
var s = Object.getOwnPropertySymbols(e);
|
|
21809
|
+
for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
21810
|
+
}
|
|
21811
|
+
return i;
|
|
21812
|
+
}
|
|
21813
|
+
|
|
21814
|
+
function _inherits(t, e) {
|
|
21815
|
+
if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function");
|
|
21816
|
+
t.prototype = Object.create(e && e.prototype, {
|
|
21817
|
+
constructor: {
|
|
21818
|
+
value: t,
|
|
21819
|
+
writable: !0,
|
|
21820
|
+
configurable: !0
|
|
21821
|
+
}
|
|
21822
|
+
}), Object.defineProperty(t, "prototype", {
|
|
21823
|
+
writable: !1
|
|
21824
|
+
}), e && _setPrototypeOf(t, e);
|
|
21825
|
+
}
|
|
21826
|
+
|
|
21827
|
+
function _possibleConstructorReturn(t, e) {
|
|
21828
|
+
if (e && ("object" == _typeof$1(e) || "function" == typeof e)) return e;
|
|
21829
|
+
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
21830
|
+
return _assertThisInitialized(t);
|
|
21831
|
+
}
|
|
21832
|
+
|
|
21833
|
+
function _createSuper(t) {
|
|
21834
|
+
var r = _isNativeReflectConstruct();
|
|
21835
|
+
return function () {
|
|
21836
|
+
var e,
|
|
21837
|
+
o = _getPrototypeOf(t);
|
|
21838
|
+
if (r) {
|
|
21839
|
+
var s = _getPrototypeOf(this).constructor;
|
|
21840
|
+
e = Reflect.construct(o, arguments, s);
|
|
21841
|
+
} else e = o.apply(this, arguments);
|
|
21842
|
+
return _possibleConstructorReturn(this, e);
|
|
21843
|
+
};
|
|
21844
|
+
}
|
|
21828
21845
|
|
|
21829
21846
|
/*!
|
|
21830
21847
|
* Signature Pad v2.3.2
|
|
@@ -22342,255 +22359,223 @@
|
|
|
22342
22359
|
return this._data;
|
|
22343
22360
|
};
|
|
22344
22361
|
|
|
22345
|
-
var signature_pad = /*#__PURE__*/Object.freeze({
|
|
22346
|
-
__proto__: null,
|
|
22347
|
-
default: SignaturePad$1
|
|
22348
|
-
});
|
|
22349
|
-
|
|
22350
|
-
var require$$2 = /*@__PURE__*/getAugmentedNamespace(signature_pad);
|
|
22351
|
-
|
|
22352
22362
|
var build = {exports: {}};
|
|
22353
22363
|
|
|
22354
|
-
var hasRequiredBuild;
|
|
22355
|
-
function requireBuild() {
|
|
22356
|
-
if (hasRequiredBuild) return build.exports;
|
|
22357
|
-
hasRequiredBuild = 1;
|
|
22358
|
-
(function (module, exports) {
|
|
22359
|
-
!function (e, t) {
|
|
22360
|
-
module.exports = t() ;
|
|
22361
|
-
}(commonjsGlobal, function () {
|
|
22362
|
-
return function (e) {
|
|
22363
|
-
function t(n) {
|
|
22364
|
-
if (r[n]) return r[n].exports;
|
|
22365
|
-
var o = r[n] = {
|
|
22366
|
-
exports: {},
|
|
22367
|
-
id: n,
|
|
22368
|
-
loaded: !1
|
|
22369
|
-
};
|
|
22370
|
-
return e[n].call(o.exports, o, o.exports, t), o.loaded = !0, o.exports;
|
|
22371
|
-
}
|
|
22372
|
-
var r = {};
|
|
22373
|
-
return t.m = e, t.c = r, t.p = "", t(0);
|
|
22374
|
-
}([function (e, t) {
|
|
22375
|
-
|
|
22376
|
-
function r(e) {
|
|
22377
|
-
var t = e.getContext("2d"),
|
|
22378
|
-
r = e.width,
|
|
22379
|
-
n = e.height,
|
|
22380
|
-
o = t.getImageData(0, 0, r, n).data,
|
|
22381
|
-
f = a(!0, r, n, o),
|
|
22382
|
-
i = a(!1, r, n, o),
|
|
22383
|
-
c = u(!0, r, n, o),
|
|
22384
|
-
d = u(!1, r, n, o),
|
|
22385
|
-
p = d - c + 1,
|
|
22386
|
-
l = i - f + 1,
|
|
22387
|
-
s = t.getImageData(c, f, p, l);
|
|
22388
|
-
return e.width = p, e.height = l, t.clearRect(0, 0, p, l), t.putImageData(s, 0, 0), e;
|
|
22389
|
-
}
|
|
22390
|
-
function n(e, t, r, n) {
|
|
22391
|
-
return {
|
|
22392
|
-
red: n[4 * (r * t + e)],
|
|
22393
|
-
green: n[4 * (r * t + e) + 1],
|
|
22394
|
-
blue: n[4 * (r * t + e) + 2],
|
|
22395
|
-
alpha: n[4 * (r * t + e) + 3]
|
|
22396
|
-
};
|
|
22397
|
-
}
|
|
22398
|
-
function o(e, t, r, o) {
|
|
22399
|
-
return n(e, t, r, o).alpha;
|
|
22400
|
-
}
|
|
22401
|
-
function a(e, t, r, n) {
|
|
22402
|
-
for (var a = e ? 1 : -1, u = e ? 0 : r - 1, f = u; e ? f < r : f > -1; f += a) for (var i = 0; i < t; i++) if (o(i, f, t, n)) return f;
|
|
22403
|
-
return null;
|
|
22404
|
-
}
|
|
22405
|
-
function u(e, t, r, n) {
|
|
22406
|
-
for (var a = e ? 1 : -1, u = e ? 0 : t - 1, f = u; e ? f < t : f > -1; f += a) for (var i = 0; i < r; i++) if (o(f, i, t, n)) return f;
|
|
22407
|
-
return null;
|
|
22408
|
-
}
|
|
22409
|
-
Object.defineProperty(t, "__esModule", {
|
|
22410
|
-
value: !0
|
|
22411
|
-
}), t["default"] = r;
|
|
22412
|
-
}]);
|
|
22413
|
-
});
|
|
22414
|
-
})(build);
|
|
22415
|
-
return build.exports;
|
|
22416
|
-
}
|
|
22417
|
-
|
|
22418
22364
|
(function (module, exports) {
|
|
22419
22365
|
!function (e, t) {
|
|
22420
|
-
module.exports = t(
|
|
22421
|
-
}(commonjsGlobal, function (
|
|
22366
|
+
module.exports = t() ;
|
|
22367
|
+
}(commonjsGlobal, function () {
|
|
22422
22368
|
return function (e) {
|
|
22423
|
-
function t(
|
|
22424
|
-
if (n
|
|
22425
|
-
var
|
|
22369
|
+
function t(n) {
|
|
22370
|
+
if (r[n]) return r[n].exports;
|
|
22371
|
+
var o = r[n] = {
|
|
22426
22372
|
exports: {},
|
|
22427
|
-
id:
|
|
22373
|
+
id: n,
|
|
22428
22374
|
loaded: !1
|
|
22429
22375
|
};
|
|
22430
|
-
return e[
|
|
22376
|
+
return e[n].call(o.exports, o, o.exports, t), o.loaded = !0, o.exports;
|
|
22431
22377
|
}
|
|
22432
|
-
var
|
|
22433
|
-
return t.m = e, t.c =
|
|
22434
|
-
}([function (e, t
|
|
22378
|
+
var r = {};
|
|
22379
|
+
return t.m = e, t.c = r, t.p = "", t(0);
|
|
22380
|
+
}([function (e, t) {
|
|
22435
22381
|
|
|
22436
22382
|
function r(e) {
|
|
22437
|
-
|
|
22438
|
-
|
|
22439
|
-
|
|
22383
|
+
var t = e.getContext("2d"),
|
|
22384
|
+
r = e.width,
|
|
22385
|
+
n = e.height,
|
|
22386
|
+
o = t.getImageData(0, 0, r, n).data,
|
|
22387
|
+
f = a(!0, r, n, o),
|
|
22388
|
+
i = a(!1, r, n, o),
|
|
22389
|
+
c = u(!0, r, n, o),
|
|
22390
|
+
d = u(!1, r, n, o),
|
|
22391
|
+
p = d - c + 1,
|
|
22392
|
+
l = i - f + 1,
|
|
22393
|
+
s = t.getImageData(c, f, p, l);
|
|
22394
|
+
return e.width = p, e.height = l, t.clearRect(0, 0, p, l), t.putImageData(s, 0, 0), e;
|
|
22440
22395
|
}
|
|
22441
|
-
function
|
|
22442
|
-
|
|
22443
|
-
|
|
22444
|
-
|
|
22396
|
+
function n(e, t, r, n) {
|
|
22397
|
+
return {
|
|
22398
|
+
red: n[4 * (r * t + e)],
|
|
22399
|
+
green: n[4 * (r * t + e) + 1],
|
|
22400
|
+
blue: n[4 * (r * t + e) + 2],
|
|
22401
|
+
alpha: n[4 * (r * t + e) + 3]
|
|
22402
|
+
};
|
|
22445
22403
|
}
|
|
22446
|
-
function o(e, t) {
|
|
22447
|
-
|
|
22404
|
+
function o(e, t, r, o) {
|
|
22405
|
+
return n(e, t, r, o).alpha;
|
|
22448
22406
|
}
|
|
22449
|
-
function
|
|
22450
|
-
|
|
22451
|
-
return
|
|
22407
|
+
function a(e, t, r, n) {
|
|
22408
|
+
for (var a = e ? 1 : -1, u = e ? 0 : r - 1, f = u; e ? f < r : f > -1; f += a) for (var i = 0; i < t; i++) if (o(i, f, t, n)) return f;
|
|
22409
|
+
return null;
|
|
22452
22410
|
}
|
|
22453
|
-
function u(e, t) {
|
|
22454
|
-
|
|
22455
|
-
|
|
22456
|
-
constructor: {
|
|
22457
|
-
value: e,
|
|
22458
|
-
enumerable: !1,
|
|
22459
|
-
writable: !0,
|
|
22460
|
-
configurable: !0
|
|
22461
|
-
}
|
|
22462
|
-
}), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t);
|
|
22411
|
+
function u(e, t, r, n) {
|
|
22412
|
+
for (var a = e ? 1 : -1, u = e ? 0 : t - 1, f = u; e ? f < t : f > -1; f += a) for (var i = 0; i < r; i++) if (o(f, i, t, n)) return f;
|
|
22413
|
+
return null;
|
|
22463
22414
|
}
|
|
22464
22415
|
Object.defineProperty(t, "__esModule", {
|
|
22465
22416
|
value: !0
|
|
22466
|
-
});
|
|
22467
|
-
var s = Object.assign || function (e) {
|
|
22468
|
-
for (var t = 1; t < arguments.length; t++) {
|
|
22469
|
-
var n = arguments[t];
|
|
22470
|
-
for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]);
|
|
22471
|
-
}
|
|
22472
|
-
return e;
|
|
22473
|
-
},
|
|
22474
|
-
c = function () {
|
|
22475
|
-
function e(e, t) {
|
|
22476
|
-
for (var n = 0; n < t.length; n++) {
|
|
22477
|
-
var r = t[n];
|
|
22478
|
-
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, r.key, r);
|
|
22479
|
-
}
|
|
22480
|
-
}
|
|
22481
|
-
return function (t, n, r) {
|
|
22482
|
-
return n && e(t.prototype, n), r && e(t, r), t;
|
|
22483
|
-
};
|
|
22484
|
-
}(),
|
|
22485
|
-
f = n(1),
|
|
22486
|
-
p = r(f),
|
|
22487
|
-
l = n(2),
|
|
22488
|
-
d = r(l),
|
|
22489
|
-
v = n(3),
|
|
22490
|
-
h = r(v),
|
|
22491
|
-
_ = n(4),
|
|
22492
|
-
g = r(_),
|
|
22493
|
-
m = function (e) {
|
|
22494
|
-
function t() {
|
|
22495
|
-
var e, n, r, u;
|
|
22496
|
-
o(this, t);
|
|
22497
|
-
for (var s = arguments.length, c = Array(s), f = 0; f < s; f++) c[f] = arguments[f];
|
|
22498
|
-
return n = r = i(this, (e = t.__proto__ || Object.getPrototypeOf(t)).call.apply(e, [this].concat(c))), r._sigPad = null, r._excludeOurProps = function () {
|
|
22499
|
-
var e = r.props,
|
|
22500
|
-
t = (e.canvasProps, e.clearOnResize, a(e, ["canvasProps", "clearOnResize"]));
|
|
22501
|
-
return t;
|
|
22502
|
-
}, r.getCanvas = function () {
|
|
22503
|
-
return r._canvas;
|
|
22504
|
-
}, r.getTrimmedCanvas = function () {
|
|
22505
|
-
var e = document.createElement("canvas");
|
|
22506
|
-
return e.width = r._canvas.width, e.height = r._canvas.height, e.getContext("2d").drawImage(r._canvas, 0, 0), (0, g["default"])(e);
|
|
22507
|
-
}, r.getSignaturePad = function () {
|
|
22508
|
-
return r._sigPad;
|
|
22509
|
-
}, r._checkClearOnResize = function () {
|
|
22510
|
-
r.props.clearOnResize && r._resizeCanvas();
|
|
22511
|
-
}, r._resizeCanvas = function () {
|
|
22512
|
-
var e = r.props.canvasProps || {},
|
|
22513
|
-
t = e.width,
|
|
22514
|
-
n = e.height;
|
|
22515
|
-
if (!t || !n) {
|
|
22516
|
-
var a = r._canvas,
|
|
22517
|
-
o = Math.max(window.devicePixelRatio || 1, 1);
|
|
22518
|
-
t || (a.width = a.offsetWidth * o), n || (a.height = a.offsetHeight * o), a.getContext("2d").scale(o, o), r.clear();
|
|
22519
|
-
}
|
|
22520
|
-
}, r.on = function () {
|
|
22521
|
-
return window.addEventListener("resize", r._checkClearOnResize), r._sigPad.on();
|
|
22522
|
-
}, r.off = function () {
|
|
22523
|
-
return window.removeEventListener("resize", r._checkClearOnResize), r._sigPad.off();
|
|
22524
|
-
}, r.clear = function () {
|
|
22525
|
-
return r._sigPad.clear();
|
|
22526
|
-
}, r.isEmpty = function () {
|
|
22527
|
-
return r._sigPad.isEmpty();
|
|
22528
|
-
}, r.fromDataURL = function (e, t) {
|
|
22529
|
-
return r._sigPad.fromDataURL(e, t);
|
|
22530
|
-
}, r.toDataURL = function (e, t) {
|
|
22531
|
-
return r._sigPad.toDataURL(e, t);
|
|
22532
|
-
}, r.fromData = function (e) {
|
|
22533
|
-
return r._sigPad.fromData(e);
|
|
22534
|
-
}, r.toData = function () {
|
|
22535
|
-
return r._sigPad.toData();
|
|
22536
|
-
}, u = n, i(r, u);
|
|
22537
|
-
}
|
|
22538
|
-
return u(t, e), c(t, [{
|
|
22539
|
-
key: "componentDidMount",
|
|
22540
|
-
value: function value() {
|
|
22541
|
-
this._sigPad = new h["default"](this._canvas, this._excludeOurProps()), this._resizeCanvas(), this.on();
|
|
22542
|
-
}
|
|
22543
|
-
}, {
|
|
22544
|
-
key: "componentWillUnmount",
|
|
22545
|
-
value: function value() {
|
|
22546
|
-
this.off();
|
|
22547
|
-
}
|
|
22548
|
-
}, {
|
|
22549
|
-
key: "componentDidUpdate",
|
|
22550
|
-
value: function value() {
|
|
22551
|
-
Object.assign(this._sigPad, this._excludeOurProps());
|
|
22552
|
-
}
|
|
22553
|
-
}, {
|
|
22554
|
-
key: "render",
|
|
22555
|
-
value: function value() {
|
|
22556
|
-
var e = this,
|
|
22557
|
-
t = this.props.canvasProps;
|
|
22558
|
-
return d["default"].createElement("canvas", s({
|
|
22559
|
-
ref: function ref(t) {
|
|
22560
|
-
e._canvas = t;
|
|
22561
|
-
}
|
|
22562
|
-
}, t));
|
|
22563
|
-
}
|
|
22564
|
-
}]), t;
|
|
22565
|
-
}(l.Component);
|
|
22566
|
-
m.propTypes = {
|
|
22567
|
-
velocityFilterWeight: p["default"].number,
|
|
22568
|
-
minWidth: p["default"].number,
|
|
22569
|
-
maxWidth: p["default"].number,
|
|
22570
|
-
minDistance: p["default"].number,
|
|
22571
|
-
dotSize: p["default"].oneOfType([p["default"].number, p["default"].func]),
|
|
22572
|
-
penColor: p["default"].string,
|
|
22573
|
-
throttle: p["default"].number,
|
|
22574
|
-
onEnd: p["default"].func,
|
|
22575
|
-
onBegin: p["default"].func,
|
|
22576
|
-
canvasProps: p["default"].object,
|
|
22577
|
-
clearOnResize: p["default"].bool
|
|
22578
|
-
}, m.defaultProps = {
|
|
22579
|
-
clearOnResize: !0
|
|
22580
|
-
}, t["default"] = m;
|
|
22581
|
-
}, function (t, n) {
|
|
22582
|
-
t.exports = e;
|
|
22583
|
-
}, function (e, n) {
|
|
22584
|
-
e.exports = t;
|
|
22585
|
-
}, function (e, t) {
|
|
22586
|
-
e.exports = n;
|
|
22587
|
-
}, function (e, t) {
|
|
22588
|
-
e.exports = r;
|
|
22417
|
+
}), t["default"] = r;
|
|
22589
22418
|
}]);
|
|
22590
22419
|
});
|
|
22591
|
-
})(build
|
|
22592
|
-
var buildExports = build
|
|
22593
|
-
var
|
|
22420
|
+
})(build);
|
|
22421
|
+
var buildExports = build.exports;
|
|
22422
|
+
var trimCanvas = /*@__PURE__*/getDefaultExportFromCjs(buildExports);
|
|
22423
|
+
|
|
22424
|
+
var _excluded = ["canvasProps", "clearOnResize"];
|
|
22425
|
+
var SignatureCanvas = /*#__PURE__*/function (_Component) {
|
|
22426
|
+
_inherits(SignatureCanvas, _Component);
|
|
22427
|
+
var _super = _createSuper(SignatureCanvas);
|
|
22428
|
+
function SignatureCanvas() {
|
|
22429
|
+
var _this;
|
|
22430
|
+
_classCallCheck(this, SignatureCanvas);
|
|
22431
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
22432
|
+
args[_key] = arguments[_key];
|
|
22433
|
+
}
|
|
22434
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
22435
|
+
_this.staticThis = _this.constructor;
|
|
22436
|
+
_this._sigPad = null;
|
|
22437
|
+
_this._canvas = null;
|
|
22438
|
+
_this.setRef = function (ref) {
|
|
22439
|
+
_this._canvas = ref;
|
|
22440
|
+
// if component is unmounted, set internal references to null
|
|
22441
|
+
if (_this._canvas === null) {
|
|
22442
|
+
_this._sigPad = null;
|
|
22443
|
+
}
|
|
22444
|
+
};
|
|
22445
|
+
_this._excludeOurProps = function () {
|
|
22446
|
+
var _this$props = _this.props;
|
|
22447
|
+
_this$props.canvasProps;
|
|
22448
|
+
_this$props.clearOnResize;
|
|
22449
|
+
var sigPadProps = _objectWithoutProperties(_this$props, _excluded);
|
|
22450
|
+
return sigPadProps;
|
|
22451
|
+
};
|
|
22452
|
+
_this.componentDidMount = function () {
|
|
22453
|
+
var canvas = _this.getCanvas();
|
|
22454
|
+
_this._sigPad = new SignaturePad$1(canvas, _this._excludeOurProps());
|
|
22455
|
+
_this._resizeCanvas();
|
|
22456
|
+
_this.on();
|
|
22457
|
+
};
|
|
22458
|
+
_this.componentWillUnmount = function () {
|
|
22459
|
+
_this.off();
|
|
22460
|
+
};
|
|
22461
|
+
_this.componentDidUpdate = function () {
|
|
22462
|
+
Object.assign(_this._sigPad, _this._excludeOurProps());
|
|
22463
|
+
};
|
|
22464
|
+
_this.getCanvas = function () {
|
|
22465
|
+
if (_this._canvas === null) {
|
|
22466
|
+
throw _this.staticThis.refNullError;
|
|
22467
|
+
}
|
|
22468
|
+
return _this._canvas;
|
|
22469
|
+
};
|
|
22470
|
+
_this.getTrimmedCanvas = function () {
|
|
22471
|
+
// copy the canvas
|
|
22472
|
+
var canvas = _this.getCanvas();
|
|
22473
|
+
var copy = document.createElement('canvas');
|
|
22474
|
+
copy.width = canvas.width;
|
|
22475
|
+
copy.height = canvas.height;
|
|
22476
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
22477
|
+
copy.getContext('2d').drawImage(canvas, 0, 0);
|
|
22478
|
+
// then trim it
|
|
22479
|
+
return trimCanvas(copy);
|
|
22480
|
+
};
|
|
22481
|
+
_this.getSignaturePad = function () {
|
|
22482
|
+
if (_this._sigPad === null) {
|
|
22483
|
+
throw _this.staticThis.refNullError;
|
|
22484
|
+
}
|
|
22485
|
+
return _this._sigPad;
|
|
22486
|
+
};
|
|
22487
|
+
_this._checkClearOnResize = function () {
|
|
22488
|
+
if (!_this.props.clearOnResize) {
|
|
22489
|
+
// eslint-disable-line @typescript-eslint/strict-boolean-expressions -- this is backward compatible with the previous behavior, where null was treated as falsey
|
|
22490
|
+
return;
|
|
22491
|
+
}
|
|
22492
|
+
_this._resizeCanvas();
|
|
22493
|
+
};
|
|
22494
|
+
_this._resizeCanvas = function () {
|
|
22495
|
+
var _this$props$canvasPro, _window$devicePixelRa;
|
|
22496
|
+
var canvasProps = (_this$props$canvasPro = _this.props.canvasProps) !== null && _this$props$canvasPro !== void 0 ? _this$props$canvasPro : {};
|
|
22497
|
+
var width = canvasProps.width,
|
|
22498
|
+
height = canvasProps.height;
|
|
22499
|
+
// don't resize if the canvas has fixed width and height
|
|
22500
|
+
if (typeof width !== 'undefined' && typeof height !== 'undefined') {
|
|
22501
|
+
return;
|
|
22502
|
+
}
|
|
22503
|
+
var canvas = _this.getCanvas();
|
|
22504
|
+
/* When zoomed out to less than 100%, for some very strange reason,
|
|
22505
|
+
some browsers report devicePixelRatio as less than 1
|
|
22506
|
+
and only part of the canvas is cleared then. */
|
|
22507
|
+
var ratio = Math.max((_window$devicePixelRa = window.devicePixelRatio) !== null && _window$devicePixelRa !== void 0 ? _window$devicePixelRa : 1, 1);
|
|
22508
|
+
if (typeof width === 'undefined') {
|
|
22509
|
+
canvas.width = canvas.offsetWidth * ratio;
|
|
22510
|
+
}
|
|
22511
|
+
if (typeof height === 'undefined') {
|
|
22512
|
+
canvas.height = canvas.offsetHeight * ratio;
|
|
22513
|
+
}
|
|
22514
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
22515
|
+
canvas.getContext('2d').scale(ratio, ratio);
|
|
22516
|
+
_this.clear();
|
|
22517
|
+
};
|
|
22518
|
+
_this.render = function () {
|
|
22519
|
+
var canvasProps = _this.props.canvasProps;
|
|
22520
|
+
return /*#__PURE__*/React.createElement("canvas", _extends({
|
|
22521
|
+
ref: _this.setRef
|
|
22522
|
+
}, canvasProps));
|
|
22523
|
+
};
|
|
22524
|
+
_this.on = function () {
|
|
22525
|
+
window.addEventListener('resize', _this._checkClearOnResize);
|
|
22526
|
+
return _this.getSignaturePad().on();
|
|
22527
|
+
};
|
|
22528
|
+
_this.off = function () {
|
|
22529
|
+
window.removeEventListener('resize', _this._checkClearOnResize);
|
|
22530
|
+
return _this.getSignaturePad().off();
|
|
22531
|
+
};
|
|
22532
|
+
_this.clear = function () {
|
|
22533
|
+
return _this.getSignaturePad().clear();
|
|
22534
|
+
};
|
|
22535
|
+
_this.isEmpty = function () {
|
|
22536
|
+
return _this.getSignaturePad().isEmpty();
|
|
22537
|
+
};
|
|
22538
|
+
_this.fromDataURL = function (dataURL, options) {
|
|
22539
|
+
return _this.getSignaturePad().fromDataURL(dataURL, options);
|
|
22540
|
+
};
|
|
22541
|
+
_this.toDataURL = function (type, encoderOptions) {
|
|
22542
|
+
return _this.getSignaturePad().toDataURL(type, encoderOptions);
|
|
22543
|
+
};
|
|
22544
|
+
_this.fromData = function (pointGroups) {
|
|
22545
|
+
return _this.getSignaturePad().fromData(pointGroups);
|
|
22546
|
+
};
|
|
22547
|
+
_this.toData = function () {
|
|
22548
|
+
return _this.getSignaturePad().toData();
|
|
22549
|
+
};
|
|
22550
|
+
return _this;
|
|
22551
|
+
} // shortcut reference (https://stackoverflow.com/a/29244254/3431180)
|
|
22552
|
+
// propagate prop updates to SignaturePad
|
|
22553
|
+
// return the canvas ref for operations like toDataURL
|
|
22554
|
+
// return a trimmed copy of the canvas
|
|
22555
|
+
// return the internal SignaturePad reference
|
|
22556
|
+
// all wrapper functions below render
|
|
22557
|
+
//
|
|
22558
|
+
return _createClass(SignatureCanvas);
|
|
22559
|
+
}(React.Component);
|
|
22560
|
+
SignatureCanvas.propTypes = {
|
|
22561
|
+
// signature_pad's props
|
|
22562
|
+
velocityFilterWeight: PropTypes.number,
|
|
22563
|
+
minWidth: PropTypes.number,
|
|
22564
|
+
maxWidth: PropTypes.number,
|
|
22565
|
+
minDistance: PropTypes.number,
|
|
22566
|
+
dotSize: PropTypes.oneOfType([PropTypes.number, PropTypes.func]),
|
|
22567
|
+
penColor: PropTypes.string,
|
|
22568
|
+
throttle: PropTypes.number,
|
|
22569
|
+
onEnd: PropTypes.func,
|
|
22570
|
+
onBegin: PropTypes.func,
|
|
22571
|
+
// props specific to the React wrapper
|
|
22572
|
+
canvasProps: PropTypes.object,
|
|
22573
|
+
clearOnResize: PropTypes.bool
|
|
22574
|
+
};
|
|
22575
|
+
SignatureCanvas.defaultProps = {
|
|
22576
|
+
clearOnResize: true
|
|
22577
|
+
};
|
|
22578
|
+
SignatureCanvas.refNullError = new Error('react-signature-canvas is currently ' + 'mounting or unmounting: React refs are null during this phase.');
|
|
22594
22579
|
|
|
22595
22580
|
function signatureDataToIdmissionFormat(signatureCanvas, imageUrl) {
|
|
22596
22581
|
imageUrl || (imageUrl = signatureCanvas.toDataURL());
|