Merge branch 'staging' of https://github.com/OpenSignLabs/OpenSign into feat_widget

This commit is contained in:
RaktimaNXG
2024-03-02 14:46:42 +05:30
110 changed files with 10405 additions and 10994 deletions
+251 -163
View File
@@ -9,16 +9,16 @@
"version": "0.1.0",
"dependencies": {
"@radix-ui/themes": "^1.1.2",
"@react-pdf/renderer": "^3.1.9",
"@react-pdf/renderer": "^3.3.8",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"axios": "^1.5.1",
"axios": "^1.6.0",
"file-saver": "^2.0.5",
"gh-pages": "^6.0.0",
"mf-cra": "^0.0.5",
"moment": "^2.30.1",
"parse": "^4.2.0",
"parse": "^4.3.1",
"pdf-lib": "^1.17.1",
"print-js": "^1.6.0",
"radix-ui": "^1.0.1",
@@ -32,7 +32,8 @@
"react-dom": "^18.2.0",
"react-draggable": "^4.4.6",
"react-helmet": "^6.1.0",
"react-pdf": "^7.4.0",
"react-konva": "^18.2.10",
"react-pdf": "^7.7.0",
"react-rnd": "^10.4.1",
"react-router-dom": "^6.16.0",
"react-scripts": "5.0.1",
@@ -81,11 +82,11 @@
}
},
"node_modules/@babel/code-frame": {
"version": "7.22.13",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz",
"integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==",
"version": "7.23.5",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz",
"integrity": "sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==",
"dependencies": {
"@babel/highlight": "^7.22.13",
"@babel/highlight": "^7.23.4",
"chalk": "^2.4.2"
},
"engines": {
@@ -171,11 +172,11 @@
}
},
"node_modules/@babel/generator": {
"version": "7.23.0",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.0.tgz",
"integrity": "sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==",
"version": "7.23.6",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.6.tgz",
"integrity": "sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw==",
"dependencies": {
"@babel/types": "^7.23.0",
"@babel/types": "^7.23.6",
"@jridgewell/gen-mapping": "^0.3.2",
"@jridgewell/trace-mapping": "^0.3.17",
"jsesc": "^2.5.1"
@@ -454,9 +455,9 @@
}
},
"node_modules/@babel/helper-string-parser": {
"version": "7.22.5",
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz",
"integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==",
"version": "7.23.4",
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz",
"integrity": "sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==",
"engines": {
"node": ">=6.9.0"
}
@@ -504,9 +505,9 @@
}
},
"node_modules/@babel/highlight": {
"version": "7.22.20",
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz",
"integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==",
"version": "7.23.4",
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz",
"integrity": "sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==",
"dependencies": {
"@babel/helper-validator-identifier": "^7.22.20",
"chalk": "^2.4.2",
@@ -517,9 +518,9 @@
}
},
"node_modules/@babel/parser": {
"version": "7.23.0",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz",
"integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==",
"version": "7.23.9",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.9.tgz",
"integrity": "sha512-9tcKgqKbs3xGJ+NtKF2ndOBBLVwPjl1SHxPQkd36r3Dlirw3xWUeGaTbqr7uGZcTaxkVNwc+03SVP7aCdWrTlA==",
"bin": {
"parser": "bin/babel-parser.js"
},
@@ -1977,22 +1978,17 @@
}
},
"node_modules/@babel/runtime-corejs3": {
"version": "7.21.0",
"resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.21.0.tgz",
"integrity": "sha512-TDD4UJzos3JJtM+tHX+w2Uc+KWj7GV+VKKFdMVd2Rx8sdA19hcc3P3AHFYd5LVOw+pYuSd5lICC3gm52B6Rwxw==",
"version": "7.23.2",
"resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.23.2.tgz",
"integrity": "sha512-54cIh74Z1rp4oIjsHjqN+WM4fMyCBYe+LpZ9jWm51CZ1fbH3SkAzQD/3XLoNkjbJ7YEmjobLXyvQrFypRHOrXw==",
"dependencies": {
"core-js-pure": "^3.25.1",
"regenerator-runtime": "^0.13.11"
"core-js-pure": "^3.30.2",
"regenerator-runtime": "^0.14.0"
},
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@babel/runtime-corejs3/node_modules/regenerator-runtime": {
"version": "0.13.11",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz",
"integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg=="
},
"node_modules/@babel/template": {
"version": "7.22.15",
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz",
@@ -2007,19 +2003,19 @@
}
},
"node_modules/@babel/traverse": {
"version": "7.23.0",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.0.tgz",
"integrity": "sha512-t/QaEvyIoIkwzpiZ7aoSKK8kObQYeF7T2v+dazAYCb8SXtp58zEVkWW7zAnju8FNKNdr4ScAOEDmMItbyOmEYw==",
"version": "7.23.9",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.9.tgz",
"integrity": "sha512-I/4UJ9vs90OkBtY6iiiTORVMyIhJ4kAVmsKo9KFc8UOxMeUfi2hvtIBsET5u9GizXE6/GFSuKCTNfgCswuEjRg==",
"dependencies": {
"@babel/code-frame": "^7.22.13",
"@babel/generator": "^7.23.0",
"@babel/code-frame": "^7.23.5",
"@babel/generator": "^7.23.6",
"@babel/helper-environment-visitor": "^7.22.20",
"@babel/helper-function-name": "^7.23.0",
"@babel/helper-hoist-variables": "^7.22.5",
"@babel/helper-split-export-declaration": "^7.22.6",
"@babel/parser": "^7.23.0",
"@babel/types": "^7.23.0",
"debug": "^4.1.0",
"@babel/parser": "^7.23.9",
"@babel/types": "^7.23.9",
"debug": "^4.3.1",
"globals": "^11.1.0"
},
"engines": {
@@ -2027,11 +2023,11 @@
}
},
"node_modules/@babel/types": {
"version": "7.23.0",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz",
"integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==",
"version": "7.23.9",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.9.tgz",
"integrity": "sha512-dQjSq/7HaSjRM43FFGnv5keM2HsxpmyV1PfaSVm0nzzjwwTmjOe6J4bC8e3+pTEIgHaHj+1ZlLThRJ2auc/w1Q==",
"dependencies": {
"@babel/helper-string-parser": "^7.22.5",
"@babel/helper-string-parser": "^7.23.4",
"@babel/helper-validator-identifier": "^7.22.20",
"to-fast-properties": "^2.0.0"
},
@@ -5111,114 +5107,116 @@
"integrity": "sha512-/RVXdLvJxLg4QKvMoM5WlwNR9ViO9z8B/qPcc+C0Sa/teJY7QG7kJ441DwzOjMYEY7GmU4dj5EcGHIkKZiQZCA=="
},
"node_modules/@react-pdf/fns": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@react-pdf/fns/-/fns-2.0.1.tgz",
"integrity": "sha512-/vgecczzFYBQFkgUupH+sxXhLWQtBwdwCgweyh25XOlR4NZuaMD/UVUDl4loFHhRQqDMQq37lkTcchh7zzW6ug==",
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/@react-pdf/fns/-/fns-2.2.1.tgz",
"integrity": "sha512-s78aDg0vDYaijU5lLOCsUD+qinQbfOvcNeaoX9AiE7+kZzzCo6B/nX+l48cmt9OosJmvZvE9DWR9cLhrhOi2pA==",
"dependencies": {
"@babel/runtime": "^7.20.13"
}
},
"node_modules/@react-pdf/font": {
"version": "2.3.6",
"resolved": "https://registry.npmjs.org/@react-pdf/font/-/font-2.3.6.tgz",
"integrity": "sha512-JYV+KmVyG2tPdpCK0/iFiBy1V7VHz2fETttKCgTRsLAo+w8RpM0pUGSAYROSuRl7yqbhiKGw/A24PYWhBReiOQ==",
"version": "2.4.4",
"resolved": "https://registry.npmjs.org/@react-pdf/font/-/font-2.4.4.tgz",
"integrity": "sha512-yjK5eSY+LcbxS0m+sOYln8GdgIbUgti4xjwf14kx8OSsOMJQJyHFALHMh2cLcKJR9yZeqVDo1FwCsY6gw1yCkg==",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@react-pdf/types": "^2.3.3",
"@react-pdf/types": "^2.4.1",
"cross-fetch": "^3.1.5",
"fontkit": "^2.0.2",
"is-url": "^1.2.4"
}
},
"node_modules/@react-pdf/image": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/@react-pdf/image/-/image-2.2.1.tgz",
"integrity": "sha512-f0+cEP6pSBmk8eS/wP2tMsJcv2c7xjzca6cr1kwcapr1nzkPrh6fMdEeFl6kR2/HlJK/JoHo+xxlzRiQ8V2lrw==",
"version": "2.3.4",
"resolved": "https://registry.npmjs.org/@react-pdf/image/-/image-2.3.4.tgz",
"integrity": "sha512-IE34l7gfTdaxXe3XR9240xMZsFdxF1myIwmEWK28XoeTaucUPAUyOiNcFSGRT59vNuZVBuakYz3BlGGrkvAPVQ==",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@react-pdf/png-js": "^2.2.0",
"cross-fetch": "^3.1.5"
"@react-pdf/png-js": "^2.3.1",
"cross-fetch": "^3.1.5",
"jay-peg": "^1.0.0"
}
},
"node_modules/@react-pdf/layout": {
"version": "3.6.2",
"resolved": "https://registry.npmjs.org/@react-pdf/layout/-/layout-3.6.2.tgz",
"integrity": "sha512-YD3/tDC6p5XPCXI04zH79bgX8LytjxEYfeCtsIzEFk0A2VvIHoRnRRDZ2OhZmO5g112ykyjY8vn9//ubTt+Ktg==",
"version": "3.11.2",
"resolved": "https://registry.npmjs.org/@react-pdf/layout/-/layout-3.11.2.tgz",
"integrity": "sha512-5EiHJ+Eb0odqnkWll9pWbTp+dwH1QRm7mOXDMiklqIWK98eI7e3cEae5Dgr0TtdnB7KgPW9Tvul2CwRJTwq54A==",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@react-pdf/fns": "2.0.1",
"@react-pdf/image": "^2.2.1",
"@react-pdf/pdfkit": "^3.0.2",
"@react-pdf/primitives": "^3.0.0",
"@react-pdf/stylesheet": "^4.1.7",
"@react-pdf/textkit": "^4.2.0",
"@react-pdf/types": "^2.3.3",
"@react-pdf/yoga": "^4.1.2",
"@react-pdf/fns": "2.2.1",
"@react-pdf/image": "^2.3.4",
"@react-pdf/pdfkit": "^3.1.6",
"@react-pdf/primitives": "^3.1.1",
"@react-pdf/stylesheet": "^4.2.4",
"@react-pdf/textkit": "^4.4.1",
"@react-pdf/types": "^2.4.1",
"cross-fetch": "^3.1.5",
"emoji-regex": "^10.2.1",
"queue": "^6.0.1"
"emoji-regex": "^10.3.0",
"queue": "^6.0.1",
"yoga-layout": "^2.0.1"
}
},
"node_modules/@react-pdf/layout/node_modules/emoji-regex": {
"version": "10.2.1",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.2.1.tgz",
"integrity": "sha512-97g6QgOk8zlDRdgq1WxwgTMgEWGVAQvB5Fdpgc1MkNy56la5SKP9GsMXKDOdqwn90/41a8yPwIGk1Y6WVbeMQA=="
"version": "10.3.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.3.0.tgz",
"integrity": "sha512-QpLs9D9v9kArv4lfDEgg1X/gN5XLnf/A6l9cs8SPZLRZR3ZkY9+kwIQTxm+fsSej5UMYGE8fdoaZVIBlqG0XTw=="
},
"node_modules/@react-pdf/pdfkit": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@react-pdf/pdfkit/-/pdfkit-3.0.2.tgz",
"integrity": "sha512-+m5rwNCwyEH6lmnZWpsQJvdqb6YaCCR0nMWrc/KKDwznuPMrGmGWyNxqCja+bQPORcHZyl6Cd/iFL0glyB3QGw==",
"version": "3.1.6",
"resolved": "https://registry.npmjs.org/@react-pdf/pdfkit/-/pdfkit-3.1.6.tgz",
"integrity": "sha512-U96VVhphniDBsLbmeJHgEml15nng8cr90mmEfPATh98gsqg6wev0avBr4k9XPjLdaN1f2xTXD4VdlaMYJZ+n7Q==",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@react-pdf/png-js": "^2.2.0",
"@react-pdf/png-js": "^2.3.1",
"browserify-zlib": "^0.2.0",
"crypto-js": "^4.0.0",
"crypto-js": "^4.2.0",
"fontkit": "^2.0.2",
"jay-peg": "^1.0.0",
"vite-compatible-readable-stream": "^3.6.1"
}
},
"node_modules/@react-pdf/png-js": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/@react-pdf/png-js/-/png-js-2.2.0.tgz",
"integrity": "sha512-csZU5lfNW73tq7s7zB/1rWXGro+Z9cQhxtsXwxS418TSszHUiM6PwddouiKJxdGhbVLjRIcuuFVa0aR5cDOC6w==",
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/@react-pdf/png-js/-/png-js-2.3.1.tgz",
"integrity": "sha512-pEZ18I4t1vAUS4lmhvXPmXYP4PHeblpWP/pAlMMRkEyP7tdAeHUN7taQl9sf9OPq7YITMY3lWpYpJU6t4CZgZg==",
"dependencies": {
"browserify-zlib": "^0.2.0"
}
},
"node_modules/@react-pdf/primitives": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/@react-pdf/primitives/-/primitives-3.0.1.tgz",
"integrity": "sha512-0HGcknrLNwyhxe+SZCBL29JY4M85mXKdvTZE9uhjNbADGgTc8wVnkc5+e4S/lDvugbVISXyuIhZnYwtK9eDnyQ=="
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/@react-pdf/primitives/-/primitives-3.1.1.tgz",
"integrity": "sha512-miwjxLwTnO3IjoqkTVeTI+9CdyDggwekmSLhVCw+a/7FoQc+gF3J2dSKwsHvAcVFM0gvU8mzCeTofgw0zPDq0w=="
},
"node_modules/@react-pdf/render": {
"version": "3.2.6",
"resolved": "https://registry.npmjs.org/@react-pdf/render/-/render-3.2.6.tgz",
"integrity": "sha512-nsd1sleWMzBdrYGv5BwChPgVwoTZilfdiadE5wQiblFqG1C7EYINadalnEl1tjldKAzofSPBLKJbnSGR5r2lIQ==",
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/@react-pdf/render/-/render-3.4.3.tgz",
"integrity": "sha512-9LL059vfwrK1gA0uIA4utpQ/pUH9EW/yia4bb7pCoARs8IlupY5UP265jgax15ua0p+MdUwShZzQ9rilu7kGsw==",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@react-pdf/fns": "2.0.1",
"@react-pdf/primitives": "^3.0.0",
"@react-pdf/textkit": "^4.2.0",
"@react-pdf/types": "^2.3.3",
"@react-pdf/fns": "2.2.1",
"@react-pdf/primitives": "^3.1.1",
"@react-pdf/textkit": "^4.4.1",
"@react-pdf/types": "^2.4.1",
"abs-svg-path": "^0.1.1",
"color-string": "^1.5.3",
"color-string": "^1.9.1",
"normalize-svg-path": "^1.1.0",
"parse-svg-path": "^0.1.2",
"svg-arc-to-cubic-bezier": "^3.2.0"
}
},
"node_modules/@react-pdf/renderer": {
"version": "3.1.12",
"resolved": "https://registry.npmjs.org/@react-pdf/renderer/-/renderer-3.1.12.tgz",
"integrity": "sha512-y4H2ELH0okJP7+ig+uNjFAfuAanWiF3mxsKsE7ZBuhF4tabbMt9fX+pQ7qn4xrzEWX0vlso6s6ebkkeGdSGWzA==",
"version": "3.3.8",
"resolved": "https://registry.npmjs.org/@react-pdf/renderer/-/renderer-3.3.8.tgz",
"integrity": "sha512-wJESEZCNNbog4MxDjRgKtgdmyGm+lDce9cMX2THRs1Jltckq3M8N0yt/fkvGyB8nwiDPtEBOsz9JKlw5vLidbw==",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@react-pdf/font": "^2.3.6",
"@react-pdf/layout": "^3.6.2",
"@react-pdf/pdfkit": "^3.0.2",
"@react-pdf/primitives": "^3.0.0",
"@react-pdf/render": "^3.2.6",
"@react-pdf/types": "^2.3.3",
"@react-pdf/font": "^2.4.4",
"@react-pdf/layout": "^3.11.2",
"@react-pdf/pdfkit": "^3.1.6",
"@react-pdf/primitives": "^3.1.1",
"@react-pdf/render": "^3.4.3",
"@react-pdf/types": "^2.4.1",
"events": "^3.3.0",
"object-assign": "^4.1.1",
"prop-types": "^15.6.2",
@@ -5226,7 +5224,7 @@
"scheduler": "^0.17.0"
},
"peerDependencies": {
"react": "^16.8.6 || ^17.0.0 || ^18.0.0"
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
}
},
"node_modules/@react-pdf/renderer/node_modules/scheduler": {
@@ -5239,42 +5237,35 @@
}
},
"node_modules/@react-pdf/stylesheet": {
"version": "4.1.7",
"resolved": "https://registry.npmjs.org/@react-pdf/stylesheet/-/stylesheet-4.1.7.tgz",
"integrity": "sha512-3n0Vg0XFszPyo0MpH75DkLRvsS4JOE0HzBH6XqFHDiquZDrC4mNgmMhZEbsOED+8xDGoCeVh8fLU3L6Tu0HWqg==",
"version": "4.2.4",
"resolved": "https://registry.npmjs.org/@react-pdf/stylesheet/-/stylesheet-4.2.4.tgz",
"integrity": "sha512-CgRfDzeMtnV0GL7zSn381NubmgwqKhFKcK1YrWX3azl/KWVh52jjFd3HWi6dvcETNT862mjWz5MnExe4WOBJXA==",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@react-pdf/fns": "2.0.1",
"@react-pdf/types": "^2.3.3",
"color-string": "^1.5.3",
"@react-pdf/fns": "2.2.1",
"@react-pdf/types": "^2.4.1",
"color-string": "^1.9.1",
"hsl-to-hex": "^1.0.0",
"media-engine": "^1.0.3",
"postcss-value-parser": "^4.1.0"
}
},
"node_modules/@react-pdf/textkit": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/@react-pdf/textkit/-/textkit-4.2.0.tgz",
"integrity": "sha512-R90pEOW6NdhUx4p99iROvKmwB06IRYdXMhh0QcmUeoPOLe64ZdMfs3LZliNUWgI5fCmq71J+nv868i/EakFPDg==",
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/@react-pdf/textkit/-/textkit-4.4.1.tgz",
"integrity": "sha512-Jl9wdTqIvJ5pX+vAGz0EOhP7ut5Two9H6CzTKo/YYPeD79cM2yTXF3JzTERBC28y7LR0Waq9D2LHQjI+b/EYUQ==",
"dependencies": {
"@babel/runtime": "^7.20.13",
"@react-pdf/fns": "2.0.1",
"@react-pdf/fns": "2.2.1",
"bidi-js": "^1.0.2",
"hyphen": "^1.6.4",
"unicode-properties": "^1.4.1"
}
},
"node_modules/@react-pdf/types": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/@react-pdf/types/-/types-2.3.3.tgz",
"integrity": "sha512-I3BVu5vF0xxX6rvqZHt4gCjFAt6X+mak5bwYQyf6bm21IIMDXXBtgXqWEl1wosWizArox7fcN/XbEnysrf/8Dw=="
},
"node_modules/@react-pdf/yoga": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/@react-pdf/yoga/-/yoga-4.1.2.tgz",
"integrity": "sha512-OlMZkFrJDj4GyKZ70thiObwwPVZ52B7mlPyfzwa+sgwsioqHXg9nMWOO+7SQFNUbbOGagMUu0bCuTv+iXYZuaQ==",
"dependencies": {
"@babel/runtime": "^7.20.13"
}
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/@react-pdf/types/-/types-2.4.1.tgz",
"integrity": "sha512-w8pk7svhjVj5f7d7kjEGXSk26ffCqRSQcgWR4DwcFltNpSM18ZJmzmM6WrNeeP437y48LlykLnmGDA3oATakgw=="
},
"node_modules/@remix-run/router": {
"version": "1.9.0",
@@ -6459,6 +6450,14 @@
"@types/react": "*"
}
},
"node_modules/@types/react-reconciler": {
"version": "0.28.8",
"resolved": "https://registry.npmjs.org/@types/react-reconciler/-/react-reconciler-0.28.8.tgz",
"integrity": "sha512-SN9c4kxXZonFhbX4hJrZy37yw9e7EIxcpHCxQv5JUS18wDE5ovkQKlqQEkufdJCCMfuI9BnjUJvhYeJ9x5Ra7g==",
"dependencies": {
"@types/react": "*"
}
},
"node_modules/@types/react-transition-group": {
"version": "4.4.7",
"resolved": "https://registry.npmjs.org/@types/react-transition-group/-/react-transition-group-4.4.7.tgz",
@@ -7458,9 +7457,9 @@
}
},
"node_modules/axios": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.5.1.tgz",
"integrity": "sha512-Q28iYCWzNHjAm+yEAot5QaAMxhMghWLFVf7rRdwhUI+c2jix2DUXjAHXVi+s1ibs3mjPO/cCgbA++3BjD0vP/A==",
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.0.tgz",
"integrity": "sha512-EZ1DYihju9pwVB+jg67ogm+Tmqc6JmhamRN6I4Zt8DfZu5lbcQGw3ozH9lFejSJgs/ibaef3A9PMXPLeefFGJg==",
"dependencies": {
"follow-redirects": "^1.15.0",
"form-data": "^4.0.0",
@@ -7828,6 +7827,14 @@
"node": ">= 8.0.0"
}
},
"node_modules/bidi-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/bidi-js/-/bidi-js-1.0.3.tgz",
"integrity": "sha512-RKshQI1R3YQ+n9YJz2QQ147P66ELpa1FQEg20Dk8oW9t2KgLbpDLLp9aGZ7y8WHSshDknG0bknqGw5/tyCs5tw==",
"dependencies": {
"require-from-string": "^2.0.2"
}
},
"node_modules/big.js": {
"version": "5.2.2",
"resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz",
@@ -8578,9 +8585,9 @@
}
},
"node_modules/crypto-js": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz",
"integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw=="
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz",
"integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q=="
},
"node_modules/crypto-random-string": {
"version": "2.0.0",
@@ -10817,9 +10824,9 @@
"integrity": "sha512-bHWEmjLsTjGP9gVs7P3Hyl+oY5NlMW8aTSPdTJ+X2GKt6glDctt9fUCLbRV+d/l8NDC40+FxMjp9WlTQXaQALw=="
},
"node_modules/follow-redirects": {
"version": "1.15.3",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz",
"integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==",
"version": "1.15.5",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz",
"integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==",
"funding": [
{
"type": "individual",
@@ -11824,9 +11831,9 @@
}
},
"node_modules/hyphen": {
"version": "1.6.6",
"resolved": "https://registry.npmjs.org/hyphen/-/hyphen-1.6.6.tgz",
"integrity": "sha512-XtqmnT+b9n5MX+MsqluFAVTIenbtC25iskW0Z+jLd+awfhA+ZbWKWQMIvLJccGoa2bM1R6juWJ27cZxIFOmkWw=="
"version": "1.10.4",
"resolved": "https://registry.npmjs.org/hyphen/-/hyphen-1.10.4.tgz",
"integrity": "sha512-SejXzIpv9gOVdDWXd4suM1fdF1k2dxZGvuTdkOVLoazYfK7O4DykIQbdrvuyG+EaTNlXAGhMndtKrhykgbt0gg=="
},
"node_modules/iconv-lite": {
"version": "0.6.3",
@@ -11856,12 +11863,9 @@
"integrity": "sha512-gchesWBzyvGHRO9W8tzUWFDycow5gwjvFKfyV9FF32Y7F50yZMp7mP+T2mJIWFx49zicqyC4uefHM17o6xKIVQ=="
},
"node_modules/idb-keyval": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/idb-keyval/-/idb-keyval-6.2.0.tgz",
"integrity": "sha512-uw+MIyQn2jl3+hroD7hF8J7PUviBU7BPKWw4f/ISf32D4LoGu98yHjrzWWJDASu9QNrX10tCJqk9YY0ClWm8Ng==",
"dependencies": {
"safari-14-idb-fix": "^3.0.0"
}
"version": "6.2.1",
"resolved": "https://registry.npmjs.org/idb-keyval/-/idb-keyval-6.2.1.tgz",
"integrity": "sha512-8Sb3veuYCyrZL+VBt9LJfZjLUPWVvqn8tG28VqYNFCo43KHcKuq+b4EiXGeuaLAQWL2YmyDgMp2aSpH9JHsEQg=="
},
"node_modules/identity-obj-proxy": {
"version": "3.0.0",
@@ -12555,6 +12559,17 @@
"set-function-name": "^2.0.1"
}
},
"node_modules/its-fine": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/its-fine/-/its-fine-1.1.1.tgz",
"integrity": "sha512-v1Ia1xl20KbuSGlwoaGsW0oxsw8Be+TrXweidxD9oT/1lAh6O3K3/GIM95Tt6WCiv6W+h2M7RB1TwdoAjQyyKw==",
"dependencies": {
"@types/react-reconciler": "^0.28.0"
},
"peerDependencies": {
"react": ">=18.0"
}
},
"node_modules/jake": {
"version": "10.8.7",
"resolved": "https://registry.npmjs.org/jake/-/jake-10.8.7.tgz",
@@ -12636,6 +12651,14 @@
"node": ">=8"
}
},
"node_modules/jay-peg": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/jay-peg/-/jay-peg-1.0.1.tgz",
"integrity": "sha512-zBfjkGbuuNXk8JW+rEePpPEbRRjupS8q+5yPak7kjy3e2GvvNwsLle9okEFvfGyZA6HvtSSiYrVd1/jgnYebaQ==",
"dependencies": {
"restructure": "^3.0.0"
}
},
"node_modules/jest": {
"version": "27.5.1",
"resolved": "https://registry.npmjs.org/jest/-/jest-27.5.1.tgz",
@@ -14717,6 +14740,26 @@
"node": ">= 8"
}
},
"node_modules/konva": {
"version": "9.3.2",
"resolved": "https://registry.npmjs.org/konva/-/konva-9.3.2.tgz",
"integrity": "sha512-I4CFGVbWKpzgYi1I0pmoHz8iYfmGc/A61yfltzcuBHMFuBwDsR2VnQo4+eFQ1dGyEAmHcdvTumJ871KqkhuGng==",
"funding": [
{
"type": "patreon",
"url": "https://www.patreon.com/lavrton"
},
{
"type": "opencollective",
"url": "https://opencollective.com/konva"
},
{
"type": "github",
"url": "https://github.com/sponsors/lavrton"
}
],
"peer": true
},
"node_modules/language-subtag-registry": {
"version": "0.3.22",
"resolved": "https://registry.npmjs.org/language-subtag-registry/-/language-subtag-registry-0.3.22.tgz",
@@ -15775,14 +15818,14 @@
}
},
"node_modules/parse": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/parse/-/parse-4.2.0.tgz",
"integrity": "sha512-K8bWs0wM2qRhkSr6N16j8OvsF6Uallrynqng9e+tzR3RdKuB09vaJh48qrf9MbiJ1Ya4JZI7AfEHYF+ywEKs7Q==",
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/parse/-/parse-4.3.1.tgz",
"integrity": "sha512-ypLPhMPFsJY+C2MXg6HdrVu6ielsL+kUjcSqh7J01lPC5oBuLh70F9YMQSw51QBocEeMSVgB7eUorFOH+MkVpA==",
"dependencies": {
"@babel/runtime-corejs3": "7.21.0",
"idb-keyval": "6.2.0",
"@babel/runtime-corejs3": "7.23.2",
"idb-keyval": "6.2.1",
"react-native-crypto-js": "1.0.0",
"uuid": "9.0.0",
"uuid": "9.0.1",
"ws": "8.13.0",
"xmlhttprequest": "1.8.0"
},
@@ -15790,7 +15833,7 @@
"node": ">=14.21.0 <17 || >=18 <20"
},
"optionalDependencies": {
"crypto-js": "4.1.1"
"crypto-js": "4.2.0"
}
},
"node_modules/parse-json": {
@@ -15816,9 +15859,13 @@
"integrity": "sha512-JyPSBnkTJ0AI8GGJLfMXvKq42cj5c006fnLz6fXy6zfoVjJizi8BNTpu8on8ziI1cKy9d9DGNuY17Ce7wuejpQ=="
},
"node_modules/parse/node_modules/uuid": {
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz",
"integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==",
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz",
"integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==",
"funding": [
"https://github.com/sponsors/broofa",
"https://github.com/sponsors/ctavan"
],
"bin": {
"uuid": "dist/bin/uuid"
}
@@ -17960,6 +18007,36 @@
"resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w=="
},
"node_modules/react-konva": {
"version": "18.2.10",
"resolved": "https://registry.npmjs.org/react-konva/-/react-konva-18.2.10.tgz",
"integrity": "sha512-ohcX1BJINL43m4ynjZ24MxFI1syjBdrXhqVxYVDw2rKgr3yuS0x/6m1Y2Z4sl4T/gKhfreBx8KHisd0XC6OT1g==",
"funding": [
{
"type": "patreon",
"url": "https://www.patreon.com/lavrton"
},
{
"type": "opencollective",
"url": "https://opencollective.com/konva"
},
{
"type": "github",
"url": "https://github.com/sponsors/lavrton"
}
],
"dependencies": {
"@types/react-reconciler": "^0.28.2",
"its-fine": "^1.1.1",
"react-reconciler": "~0.29.0",
"scheduler": "^0.23.0"
},
"peerDependencies": {
"konva": "^8.0.1 || ^7.2.5 || ^9.0.0",
"react": ">=18.0.0",
"react-dom": ">=18.0.0"
}
},
"node_modules/react-lifecycles-compat": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz",
@@ -17984,18 +18061,19 @@
}
},
"node_modules/react-pdf": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/react-pdf/-/react-pdf-7.4.0.tgz",
"integrity": "sha512-L2GIUc9eBLdb51DRqUe3zlkTmvOq7KQN5cKmgcrWdnWNwhYgrOGgpJQ3f56kG26G+B5GoasAHI6RjQrLfTjTnw==",
"version": "7.7.0",
"resolved": "https://registry.npmjs.org/react-pdf/-/react-pdf-7.7.0.tgz",
"integrity": "sha512-704ObLnRDm5lixL4e6NXNLaincBHGNLo+NGdbO3rEXE963NlNzwLxFpmKcbdXHAMQL4rYJQWb1L0w5IL6y8Osw==",
"dependencies": {
"clsx": "^2.0.0",
"dequal": "^2.0.3",
"make-cancellable-promise": "^1.3.1",
"make-event-props": "^1.6.0",
"merge-refs": "^1.2.1",
"pdfjs-dist": "3.11.174",
"prop-types": "^15.6.2",
"tiny-invariant": "^1.0.0",
"tiny-warning": "^1.0.0"
"warning": "^4.0.0"
},
"funding": {
"url": "https://github.com/wojtekmaj/react-pdf?sponsor=1"
@@ -18019,6 +18097,21 @@
"node": ">=6"
}
},
"node_modules/react-reconciler": {
"version": "0.29.0",
"resolved": "https://registry.npmjs.org/react-reconciler/-/react-reconciler-0.29.0.tgz",
"integrity": "sha512-wa0fGj7Zht1EYMRhKWwoo1H9GApxYLBuhoAuXN0TlltESAjDssB+Apf0T/DngVqaMyPypDmabL37vw/2aRM98Q==",
"dependencies": {
"loose-envify": "^1.1.0",
"scheduler": "^0.23.0"
},
"engines": {
"node": ">=0.10.0"
},
"peerDependencies": {
"react": "^18.2.0"
}
},
"node_modules/react-refresh": {
"version": "0.11.0",
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz",
@@ -18799,11 +18892,6 @@
"queue-microtask": "^1.2.2"
}
},
"node_modules/safari-14-idb-fix": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/safari-14-idb-fix/-/safari-14-idb-fix-3.0.0.tgz",
"integrity": "sha512-eBNFLob4PMq8JA1dGyFn6G97q3/WzNtFK4RnzT1fnLq+9RyrGknzYiM/9B12MnKAxuj1IXr7UKYtTNtjyKMBog=="
},
"node_modules/safe-array-concat": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.1.tgz",
@@ -20209,11 +20297,6 @@
"resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.1.tgz",
"integrity": "sha512-AD5ih2NlSssTCwsMznbvwMZpJ1cbhkGd2uueNxzv2jDlEeZdU04JQfRnggJQ8DrcVBGjAsCKwFBbDlVNtEMlzw=="
},
"node_modules/tiny-warning": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz",
"integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA=="
},
"node_modules/tmpl": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz",
@@ -21789,6 +21872,11 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/yoga-layout": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/yoga-layout/-/yoga-layout-2.0.1.tgz",
"integrity": "sha512-tT/oChyDXelLo2A+UVnlW9GU7CsvFMaEnd9kVFsaiCQonFAXd3xrHhkLYu+suwwosrAEQ746xBU+HvYtm1Zs2Q=="
},
"node_modules/zoom-level": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/zoom-level/-/zoom-level-2.5.0.tgz",
+6 -4
View File
@@ -5,16 +5,16 @@
"homepage": "./mfbuild",
"dependencies": {
"@radix-ui/themes": "^1.1.2",
"@react-pdf/renderer": "^3.1.9",
"@react-pdf/renderer": "^3.3.8",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"axios": "^1.5.1",
"axios": "^1.6.0",
"file-saver": "^2.0.5",
"gh-pages": "^6.0.0",
"mf-cra": "^0.0.5",
"moment": "^2.30.1",
"parse": "^4.2.0",
"parse": "^4.3.1",
"pdf-lib": "^1.17.1",
"print-js": "^1.6.0",
"radix-ui": "^1.0.1",
@@ -28,7 +28,8 @@
"react-dom": "^18.2.0",
"react-draggable": "^4.4.6",
"react-helmet": "^6.1.0",
"react-pdf": "^7.4.0",
"react-konva": "^18.2.10",
"react-pdf": "^7.7.0",
"react-rnd": "^10.4.1",
"react-router-dom": "^6.16.0",
"react-scripts": "5.0.1",
@@ -42,6 +43,7 @@
"scripts": {
"start": "mf-cra start",
"build": "CI=false && PUBLIC_URL=./mfbuild BUILD_PATH='./mfbuild' mf-cra build && mv mfbuild ../../apps/OpenSign/public",
"docker-build": "CI=false && PUBLIC_URL=./mfbuild BUILD_PATH='./mfbuild' mf-cra build && mv mfbuild ../public",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
@@ -0,0 +1,429 @@
import React, { useEffect, useState } from "react";
import RenderAllPdfPage from "./component/renderAllPdfPage";
import "../css/./signature.css";
import "../css/AddUser.css";
import Title from "./component/Title";
import ModalUi from "../premitives/ModalUi";
import RenderDebugPdf from "./component/RenderDebugPdf";
import { pdfjs } from "react-pdf";
import Alert from "../premitives/Alert";
import HandleError from "./component/HandleError";
import { useWindowSize } from "../hook/useWindowSize";
function processDimensions(x, y, width, height) {
if (width < 0) {
x -= Math.abs(width);
width = Math.abs(width);
}
if (height < 0) {
y -= Math.abs(height);
height = Math.abs(height);
}
return {
x: Math.floor(x),
y: Math.floor(y),
width: Math.floor(width),
height: Math.floor(height)
};
}
const DebugUi = () => {
const { width } = useWindowSize();
const [pdf, setPdf] = useState("");
const [isModal, setIsModal] = useState(true);
const [allPages, setAllPages] = useState(null);
const [pageNumber, setPageNumber] = useState(1);
const [pdfLoadFail, setPdfLoadFail] = useState({
status: false,
type: "load"
});
const [pdfDetails, setPdfDetails] = useState({
name: "",
pdftype: "",
totalPages: "",
currentPage: 1,
x: 0,
y: 0,
base64: ""
});
const [hoverCoordinates, setHoverCoordinates] = useState({ x: 0, y: 0 });
const [pdfDimension, setPdfDimension] = useState({ width: 0, height: 0 });
const [annotations, setAnnotations] = useState([]);
const [newAnnotation, setNewAnnotation] = useState([]);
const [copied, setCopied] = useState(false);
useEffect(() => {
if (pdf && pdf.name) {
const fetchPdfMetadata = async () => {
try {
const pdfDataURL = URL.createObjectURL(pdf); // Convert File to data URL
console.log("pdfDataURL ", pdfDataURL);
const pdfInfo = await pdfjs.getDocument({ url: pdfDataURL }).promise;
const pdfType = await inferPdfType(pdfInfo);
setPdfDetails((prevDetails) => ({
...prevDetails,
pdftype: pdfType
}));
} catch (error) {
console.error("Error fetching PDF metadata:", error);
}
};
fetchPdfMetadata();
}
}, [pdf]);
const inferPdfType = async (pdf) => {
try {
const firstPage = await pdf.getPage(1);
const scale = 1;
const { width, height } = firstPage.getViewport({ scale });
setPdfDimension({ width: width, height: height });
// Assuming a standard DPI of 72, you can adjust this value if needed
const dpi = 72;
const widthInInches = width / dpi;
const heightInInches = height / dpi;
const isA1 = widthInInches > 23.39 && heightInInches > 16.54;
const isA2 = widthInInches > 16.54 && heightInInches > 11.69;
const isA3 = widthInInches > 11.69 && heightInInches > 8.27;
const isA4 = widthInInches > 8.27 && heightInInches > 5.83;
const isLegal = widthInInches > 8.5 && heightInInches > 14;
const isLetter = widthInInches > 8.5 && heightInInches > 11;
const isLedger = widthInInches > 11 && heightInInches > 17;
if (isA1) return "A1";
if (isA2) return "A2";
if (isA3) return "A3";
if (isA4) return "A4";
if (isLegal) return "Legal";
if (isLetter) return "Letter";
if (isLedger) return "Ledger";
return "Unknown";
} catch (error) {
console.error("Error getting page dimensions:", error);
return "Unknown";
}
};
const handleSubmit = (e) => {
e.preventDefault();
setIsModal(false);
setPdfDetails((prevData) => ({ ...prevData, name: pdf?.name }));
};
//function for get pdf page details
const pageDetails = async ({ numPages }) => {
const load = {
status: true
};
setPdfDetails((prevDetails) => ({ ...prevDetails, totalPages: numPages }));
setPdfLoadFail(load);
};
const handleMouseMoveDiv = (event) => {
setHoverCoordinates({
x: event.nativeEvent.offsetX,
y: event.nativeEvent.offsetY
});
};
const handleMouseDown = (event) => {
if (newAnnotation.length === 0) {
const { x, y } = event.target.getStage().getPointerPosition();
setNewAnnotation([
{ x, y, width: 0, height: 0, key: "0", page: pageNumber }
]);
}
};
const handleMouseUp = (event) => {
if (newAnnotation.length === 1) {
const sx = newAnnotation[0].x;
const sy = newAnnotation[0].y;
const { x, y } = event.target.getStage().getPointerPosition();
const result = processDimensions(sx, sy, x - sx, y - sy);
const annotationToAdd = {
...result,
key: annotations.length + 1,
page: pageNumber
};
annotations.push(annotationToAdd);
setNewAnnotation([]);
setAnnotations(annotations);
setPdfDetails((prevDetails) => ({
...prevDetails,
x: result.x,
y: result.y
}));
}
};
const handleMouseMove = (event) => {
if (newAnnotation.length === 1) {
const sx = newAnnotation[0].x;
const sy = newAnnotation[0].y;
const { x, y } = event.target.getStage().getPointerPosition();
setNewAnnotation([
{
x: sx,
y: sy,
width: x - sx,
height: y - sy,
page: pageNumber,
key: "0"
}
]);
}
};
const annotationsToDraw = [...annotations, ...newAnnotation];
const handlePageLoadSuccess = (page) => {
setPdfDetails((prevDetails) => ({
...prevDetails,
currentPage: page.pageNumber
}));
};
const copytoclipboard = (text) => {
navigator.clipboard.writeText(text);
setCopied(true);
setTimeout(() => {
setCopied(false);
}, 1500); // Reset copied state after 1.5 seconds
};
const handleFileChange = (files) => {
const file = files[0];
setPdf(file);
if (file && file.type === "application/pdf") {
const reader = new FileReader();
reader.onloadend = () => {
const base64String = reader.result.split(",")[1];
setPdfDetails((prevdata) => ({ ...prevdata, base64: base64String }));
};
reader.readAsDataURL(file);
}
};
const handleDelete = (key) => {
const updateAnnotations = annotations.filter((x) => x.key !== key);
setAnnotations(updateAnnotations);
};
return (
<div>
{copied && <Alert type="success">Copied</Alert>}
<Title title={"Debug Pdf"} />
{width < 800 ? (
<HandleError handleError={"Debug PDF only availble for PC"} />
) : (
<>
{!isModal && (
<div className="signatureContainer">
{/* this component used to render all pdf pages in left side */}
<RenderAllPdfPage
signPdfUrl={pdf}
allPages={allPages}
setAllPages={setAllPages}
setPageNumber={setPageNumber}
pageNumber={pageNumber}
/>
{/* pdf render view */}
<div>
<div data-tut="reactourThird">
<RenderDebugPdf
pdfUrl={pdf}
pageDetails={pageDetails}
pageNumber={pageNumber}
setPdfLoadFail={setPdfLoadFail}
pdfLoadFail={pdfLoadFail}
handlePageLoadSuccess={handlePageLoadSuccess}
handleMouseMove={handleMouseMove}
handleMouseUp={handleMouseUp}
handleMouseDown={handleMouseDown}
hoverCoordinates={hoverCoordinates}
annotations={annotationsToDraw}
pdfDimension={pdfDimension}
handleMouseMoveDiv={handleMouseMoveDiv}
/>
</div>
</div>
<div style={{ backgroundColor: "white", width: 220 }}>
<div
style={{
fontSize: 18,
fontWeight: 500,
padding: "10px 12px",
borderBottom: "1px solid grey"
}}
>
PDF details
</div>
<div style={{ fontSize: 14, padding: "5px 12px" }}>
Name: {pdfDetails?.name}
</div>
<div style={{ fontSize: 14, padding: "5px 12px" }}>
Pdf type: {pdfDetails?.pdftype}
</div>
<div style={{ fontSize: 14, padding: "5px 12px" }}>
Total Pages: {pdfDetails?.totalPages}
</div>
<div style={{ fontSize: 14, padding: "5px 12px" }}>
Current Page: {pdfDetails?.currentPage}
</div>
<div style={{ fontSize: 14, padding: "5px 12px" }}>
Base64 : {pdfDetails?.base64.slice(0, 10)}...
<span
style={{
borderRadius: 4,
padding: "3px 5px",
border: "1px solid gray",
fontSize: 12,
margin: 2,
cursor: "pointer"
}}
onClick={() => copytoclipboard(pdfDetails?.base64)}
>
<i className="fa-solid fa-copy"></i>
</span>
</div>
<div
style={{
fontSize: 18,
fontWeight: 500,
padding: "10px 12px",
borderBottom: "1px solid grey"
}}
>
Last click
</div>
<div style={{ fontSize: 14, padding: "5px 12px" }}>
x co-ordinate: {pdfDetails?.x}
</div>
<div style={{ fontSize: 14, padding: "5px 12px" }}>
y co-ordinate: {pdfDetails?.y}
</div>
<div
style={{
fontSize: 18,
fontWeight: 500,
padding: "10px 12px",
borderBottom: "1px solid grey",
borderTop: "1px solid grey"
}}
>
Annotation
</div>
<ul
style={{
listStyle: "none",
padding: 10,
height: 500,
overflowY: "auto",
scrollbarWidth: 5
}}
>
{annotations.map((coord, index) => (
<li key={index}>
<span style={{ fontSize: 13, fontWeight: 500 }}>{`Box ${
index + 1
}:`}</span>
<code
style={{
fontSize: 12,
color: "black",
cursor: "pointer"
}}
>
{` ["page":${coord?.page}, "x": ${coord.x}, "y": ${coord.y}, "w": ${coord.width}, "h": ${coord.height}]`}
</code>
<div>
<span
style={{
borderRadius: 4,
padding: "3px 5px",
border: "1px solid gray",
fontSize: 12,
margin: 2,
cursor: "pointer"
}}
onClick={() =>
copytoclipboard(
`"page":${coord?.page}, "x": ${coord.x}, "y": ${coord.y}, "w": ${coord.width}, "h": ${coord.height}`
)
}
>
<i className="fa-solid fa-copy"></i>
</span>
<span
style={{
borderRadius: 4,
padding: "3px 5px",
border: "1px solid gray",
fontSize: 12,
margin: 2,
cursor: "pointer"
}}
onClick={() => handleDelete(coord.key)}
>
<i className="fa-solid fa-trash-can"></i>
</span>
</div>
</li>
))}
</ul>
</div>
</div>
)}
<ModalUi title={"Select PDF"} isOpen={isModal}>
<form onSubmit={handleSubmit} style={{ margin: "10px" }}>
<input
type="file"
onChange={(e) => handleFileChange(e.target.files)}
style={{
width: "100%",
border: "1px solid grey",
borderRadius: "4px",
padding: "5px",
fontSize: 12
}}
accept=".pdf"
required
/>
<div
style={{ borderTop: "1px solid grey", margin: "10px 0" }}
></div>
<button
style={{
background: "#32a3ac",
borderRadius: "2px",
boxShadow:
"0 2px 4px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.18)",
border: "none",
textTransform: "uppercase",
fontSize: "13px",
fontWeight: "600",
padding: "0.375rem 0.75rem",
textAlign: "center",
color: "#ffffff",
outline: "none"
}}
type="submit"
>
Submit
</button>
</form>
</ModalUi>
</>
)}
</div>
);
};
export default DebugUi;
@@ -89,6 +89,7 @@ function PdfRequestFiles() {
const [validateAlert, setValidateAlert] = useState(false);
const [widgetsTour, setWidgetsTour] = useState(false);
const [minRequiredCount, setminRequiredCount] = useState();
const [sendInOrder, setSendInOrder] = useState(false);
const divRef = useRef(null);
const isMobile = window.innerWidth < 767;
const rowLevel =
@@ -191,6 +192,52 @@ function PdfRequestFiles() {
checkAlreadySign.length > 0
) {
setAlreadySign(true);
} else {
const obj = documentData?.[0];
setSendInOrder(obj?.SendinOrder || false);
if (
obj &&
obj.Signers &&
obj.Signers.length > 0 &&
obj.Placeholders &&
obj.Placeholders.length > 0
) {
const params = {
event: "viewed",
body: {
objectId: documentData?.[0].objectId,
file: documentData?.[0]?.SignedUrl || documentData?.[0]?.URL,
name: documentData?.[0].Name,
note: documentData?.[0].Note || "",
description: documentData?.[0].Description || "",
signers: documentData?.[0].Signers?.map((x) => ({
name: x?.Name,
email: x?.Email,
phone: x?.Phone
})),
viewedBy: jsonSender.email,
viewedAt: new Date(),
createdAt: documentData?.[0].createdAt
}
};
try {
await axios.post(
`${localStorage.getItem("baseUrl")}functions/callwebhook`,
params,
{
headers: {
"Content-Type": "application/json",
"X-Parse-Application-Id":
localStorage.getItem("parseAppId"),
sessiontoken: localStorage.getItem("accesstoken")
}
}
);
} catch (err) {
console.log("Err ", err);
}
}
}
let signers = [];
@@ -295,8 +342,36 @@ function PdfRequestFiles() {
});
};
const checkSendInOrder = () => {
if (sendInOrder) {
const index = pdfDetails?.[0].Signers.findIndex(
(x) => x.Email === jsonSender.email
);
const newIndex = index - 1;
if (newIndex !== -1) {
const user = pdfDetails?.[0].Signers[newIndex];
const isPrevUserSigned =
pdfDetails?.[0].AuditTrail &&
pdfDetails?.[0].AuditTrail.some(
(x) =>
x.UserPtr.objectId === user.objectId && x.Activity === "Signed"
);
if (isPrevUserSigned) {
return true;
} else {
return false;
}
} else {
return true;
}
} else {
return true;
}
};
//function for embed signature or image url in pdf
async function embedImages() {
const validateSigning = checkSendInOrder();
if (validateSigning) {
const checkUser = signerPos.filter(
(data) => data.signerObjId === signerObjectId
);
@@ -365,7 +440,8 @@ function PdfRequestFiles() {
} else if (!checkboxExist && unSignUrlData && unSignUrlData.length > 0) {
setUnSignedWidgetId(unSignUrlData[0].key);
setWidgetsTour(true);
} else {
}
else {
setIsUiLoading(true);
const pngUrl = checkUser[0].placeHolder;
// Load a PDFDocument from the existing PDF bytes
@@ -375,16 +451,102 @@ function PdfRequestFiles() {
const pdfDoc = await PDFDocument.load(existingPdfBytes, {
ignoreEncryption: true
});
// let pdfBase64;
//checking if signature is only one then send image url in jpeg formate to server
// if (pngUrl.length === 1 && pngUrl[0].pos.length === 1) {
// if (isDocId) {
// try {
// pdfBase64 = await getBase64FromUrl(pdfUrl);
// } catch (err) {
// console.log(err);
// }
// } else {
// //embed document's object id to all pages in pdf document
// try {
// await embedDocId(pdfDoc, documentId, allPages);
// } catch (err) {
// console.log(err);
// }
// try {
// pdfBase64 = await pdfDoc.saveAsBase64({
// useObjectStreams: false
// });
// } catch (err) {
// console.log(err);
// }
// }
// for (let pngData of pngUrl) {
// const imgUrlList = pngData.pos;
// const pageNo = pngData.pageNumber;
// imgUrlList.map(async (data) => {
// //cheking signUrl is defau;t signature url of custom url
// let ImgUrl = data.SignUrl;
// const checkUrl = urlValidator(ImgUrl);
// //if default signature url then convert it in base 64
// if (checkUrl) {
// ImgUrl = await getBase64FromIMG(ImgUrl + "?get");
// }
// //function for called convert png signatre to jpeg in base 64
// convertPNGtoJPEG(ImgUrl)
// .then((jpegBase64Data) => {
// const removeBase64Fromjpeg = "data:image/jpeg;base64,";
// const newImgUrl = jpegBase64Data.replace(
// removeBase64Fromjpeg,
// ""
// );
// //function for call to embed signature in pdf and get digital signature pdf
// signPdfFun(
// newImgUrl,
// documentId,
// signerObjectId,
// pdfOriginalWidth,
// pngUrl,
// containerWH,
// setIsAlert,
// data,
// pdfBase64,
// pageNo
// )
// .then((res) => {
// if (res && res.status === "success") {
// setPdfUrl(res.data);
// setIsSigned(true);
// setSignedSigners([]);
// setUnSignedSigners([]);
// getDocumentDetails();
// } else {
// setIsAlert({
// isShow: true,
// alertMessage: "something went wrong"
// });
// }
// })
// .catch((err) => {
// setIsAlert({
// isShow: true,
// alertMessage: "something went wrong"
// });
// });
// })
// .catch((error) => {
// console.error("Error:", error);
// });
// });
// }
// }
// //else if signature is more than one then embed all sign with the use of pdf-lib
// else if (pngUrl.length > 0 && pngUrl[0].pos.length > 0) {
const flag = false;
const extUserPtr = pdfDetails[0].ExtUserPtr;
const HeaderDocId = extUserPtr?.HeaderDocId;
//embed document's object id to all pages in pdf document
if (!HeaderDocId) {
if (!isDocId) {
await embedDocId(pdfDoc, documentId, allPages);
}
if (!isDocId) {
await embedDocId(pdfDoc, documentId, allPages);
}
}
//embed multi signature in pdf
const pdfBytes = await multiSignEmbed(
pngUrl,
@@ -393,7 +555,6 @@ function PdfRequestFiles() {
flag,
containerWH
);
//function for call to embed signature in pdf and get digital signature pdf
try {
const res = await signPdfFun(
@@ -411,6 +572,88 @@ function PdfRequestFiles() {
setSignedSigners([]);
setUnSignedSigners([]);
getDocumentDetails();
if (sendInOrder) {
const index = pdfDetails?.[0].Signers.findIndex(
(x) => x.Email === jsonSender.email
);
const newIndex = index + 1;
const user = pdfDetails?.[0].Signers[newIndex];
if (user) {
let sendMail;
// console.log("pdfDetails", pdfDetails);
const expireDate = pdfDetails?.[0].ExpiryDate.iso;
const newDate = new Date(expireDate);
const localExpireDate = newDate.toLocaleDateString("en-US", {
day: "numeric",
month: "long",
year: "numeric"
});
let sender = pdfDetails?.[0].ExtUserPtr.Email;
try {
const imgPng =
"https://qikinnovation.ams3.digitaloceanspaces.com/logo.png";
let url = `${localStorage.getItem(
"baseUrl"
)}functions/sendmailv3/`;
const headers = {
"Content-Type": "application/json",
"X-Parse-Application-Id":
localStorage.getItem("parseAppId"),
sessionToken: localStorage.getItem("accesstoken")
};
const serverUrl = localStorage.getItem("baseUrl");
const newServer = serverUrl.replaceAll("/", "%2F");
const objectId = user.objectId;
const serverParams = `${newServer}&${localStorage.getItem(
"parseAppId"
)}&${localStorage.getItem("_appName")}`;
const hostUrl =
window.location.origin + "/loadmf/signmicroapp";
let signPdf = `${hostUrl}/login/${pdfDetails?.[0].objectId}/${user.Email}/${objectId}/${serverParams}`;
const openSignUrl =
"https://www.opensignlabs.com/contact-us";
const orgName = pdfDetails[0]?.ExtUserPtr.Company
? pdfDetails[0].ExtUserPtr.Company
: "";
const themeBGcolor = themeColor();
let params = {
recipient: user.Email,
subject: `${pdfDetails?.[0].ExtUserPtr.Name} has requested you to sign ${pdfDetails?.[0].Name}`,
from: sender,
html:
"<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /> </head> <body> <div style='background-color: #f5f5f5; padding: 20px'=> <div style=' box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 12px;background: white;padding-bottom: 20px;'> <div style='padding:10px 10px 0 10px'><img src=" +
imgPng +
" height='50' style='padding: 20px,width:170px,height:40px' /></div> <div style=' padding: 2px;font-family: system-ui;background-color:" +
themeBGcolor +
";'><p style='font-size: 20px;font-weight: 400;color: white;padding-left: 20px;' > Digital Signature Request</p></div><div><p style='padding: 20px;font-family: system-ui;font-size: 14px; margin-bottom: 10px;'> " +
pdfDetails?.[0].ExtUserPtr.Name +
" has requested you to review and sign <strong> " +
pdfDetails?.[0].Name +
"</strong>.</p><div style='padding: 5px 0px 5px 25px;display: flex;flex-direction: row;justify-content: space-around;'><table> <tr> <td style='font-weight:bold;font-family:sans-serif;font-size:15px'>Sender</td> <td> </td> <td style='color:#626363;font-weight:bold'>" +
sender +
"</td></tr><tr><td style='font-weight:bold;font-family:sans-serif;font-size:15px'>Organization</td> <td> </td><td style='color:#626363;font-weight:bold'> " +
orgName +
"</td></tr> <tr> <td style='font-weight:bold;font-family:sans-serif;font-size:15px'>Expires on</td><td> </td> <td style='color:#626363;font-weight:bold'>" +
localExpireDate +
"</td></tr><tr> <td></td> <td> </td></tr></table> </div> <div style='margin-left:70px'><a href=" +
signPdf +
"> <button style='padding: 12px 12px 12px 12px;background-color: #d46b0f;color: white; border: 0px;box-shadow: rgba(0, 0, 0, 0.05) 0px 6px 24px 0px,rgba(0, 0, 0, 0.08) 0px 0px 0px 1px;font-weight:bold;margin-top:30px'>Sign here</button></a> </div> <div style='display: flex; justify-content: center;margin-top: 10px;'> </div></div></div><div><p> This is an automated email from OpenSign™. For any queries regarding this email, please contact the sender " +
sender +
" directly.If you think this email is inappropriate or spam, you may file a complaint with OpenSign™ <a href= " +
openSignUrl +
" target=_blank>here</a>.</p> </div></div></body> </html>"
};
sendMail = await axios.post(url, params, {
headers: headers
});
} catch (error) {
console.log("error", error);
}
}
}
} else {
setIsAlert({
isShow: true,
@@ -424,7 +667,6 @@ function PdfRequestFiles() {
});
}
}
setIsSignPad(false);
} else {
setIsAlert({
@@ -432,8 +674,14 @@ function PdfRequestFiles() {
alertMessage: "something went wrong"
});
}
} else {
setIsAlert({
isShow: true,
alertMessage:
"Please wait for your turn to sign this document, as it has been set up by the creator to be signed in a specific order; you'll be notified when it's your turn."
});
}
}
//function for update TourStatus
const closeTour = async () => {
setWidgetsTour(false);
@@ -607,7 +855,7 @@ function PdfRequestFiles() {
}
}
)
.then((result) => {
.then(async (result) => {
const res = result.data;
if (res) {
const currentDecline = {
@@ -616,6 +864,40 @@ function PdfRequestFiles() {
};
setIsDecline(currentDecline);
setIsUiLoading(false);
const params = {
event: "declined",
body: {
objectId: pdfDetails?.[0].objectId,
file: pdfDetails?.[0]?.SignedUrl || pdfDetails?.[0]?.URL,
name: pdfDetails?.[0].Name,
note: pdfDetails?.[0].Note || "",
description: pdfDetails?.[0].Description || "",
signers: pdfDetails?.[0].Signers?.map((x) => ({
name: x?.Name,
email: x?.Email,
phone: x?.Phone
})),
declinedBy: jsonSender.email,
declinedAt: new Date(),
createdAt: pdfDetails?.[0].createdAt
}
};
try {
await axios.post(
`${localStorage.getItem("baseUrl")}functions/callwebhook`,
params,
{
headers: {
"Content-Type": "application/json",
"X-Parse-Application-Id": localStorage.getItem("parseAppId"),
sessiontoken: localStorage.getItem("accesstoken")
}
}
);
} catch (err) {
console.log("Err ", err);
}
}
})
.catch((err) => {
@@ -667,7 +667,8 @@ const TemplatePlaceholder = () => {
Signers: signers,
Name: pdfDetails[0]?.Name || "",
Note: pdfDetails[0]?.Note || "",
Description: pdfDetails[0]?.Description || ""
Description: pdfDetails[0]?.Description || "",
SendinOrder: pdfDetails[0]?.SendinOrder || false
};
await axios
@@ -725,7 +726,7 @@ const TemplatePlaceholder = () => {
selector: '[data-tut="reactourFirst"]',
content: () => (
<TourContentWithBtn
message={`Select a recipient from this list to add a place-holder where he is supposed to sign.The placeholder will appear in the same colour as the recipient name once you drop it on the document.`}
message={`Select a role from this list to add a place-holder where he is supposed to sign.The placeholder will appear in the same colour as the recipient name once you drop it on the document.`}
isChecked={handleDontShow}
/>
),
@@ -748,7 +749,7 @@ const TemplatePlaceholder = () => {
selector: '[data-tut="reactourThird"]',
content: () => (
<TourContentWithBtn
message={`Drag the placeholder for a recipient anywhere on the document.Remember, it will appear in the same colour as the name of the recipient for easy reference.`}
message={`Drag the placeholder for a role anywhere on the document.Remember, it will appear in the same colour as the name of the recipient for easy reference.`}
isChecked={handleDontShow}
/>
),
@@ -1213,11 +1214,11 @@ const TemplatePlaceholder = () => {
<ModalUi
headerColor={"#dc3545"}
isOpen={!IsReceipent}
title={"Receipent required"}
title={"Roles"}
handleClose={() => setIsReceipent(true)}
>
<div style={{ height: "100%", padding: 20 }}>
<p>Please add receipent.</p>
<p>Please add a role</p>
</div>
</ModalUi>
{/* this modal is used show send mail message and after send mail success message */}
@@ -7,7 +7,8 @@ const EditTemplate = ({ template, onSuccess }) => {
const [formData, setFormData] = useState({
Name: template?.Name || "",
Note: template?.Note || "",
Description: template?.Description || ""
Description: template?.Description || "",
SendinOrder: template?.SendinOrder ? `${template?.SendinOrder}` : "false"
});
const handleStrInput = (e) => {
@@ -22,7 +23,8 @@ const EditTemplate = ({ template, onSuccess }) => {
const handleSubmit = async (e) => {
e.preventDefault();
e.stopPropagation();
const data = { ...formData };
const isChecked = formData.SendinOrder === "true" ? true : false;
const data = { ...formData, SendinOrder: isChecked };
onSuccess(data);
};
@@ -86,6 +88,45 @@ const EditTemplate = ({ template, onSuccess }) => {
className="addUserInput"
/>
</div>
<div className="form-section">
<label style={{ fontSize: 13 }}>Send In Order</label>
<div
style={{
display: "flex",
alignItems: "center",
gap: 8,
marginLeft: 8,
marginBottom: 5
}}
>
<input
type="radio"
value={"true"}
name="SendinOrder"
checked={formData.SendinOrder === "true"}
onChange={handleStrInput}
/>
<div style={{ fontSize: 12 }}>Yes</div>
</div>
<div
style={{
display: "flex",
alignItems: "center",
gap: 8,
marginLeft: 8,
marginBottom: 5
}}
>
<input
type="radio"
value={"false"}
name="SendinOrder"
checked={formData.SendinOrder === "false"}
onChange={handleStrInput}
/>
<div style={{ fontSize: 12 }}>No</div>
</div>
</div>
{/* <SelectFolder onSuccess={handleFolder} folderCls={"contracts_Template"} /> */}
<div className="buttoncontainer">
<button type="submit" className="submitbutton">
@@ -0,0 +1,85 @@
import React from "react";
import { Document, Page, pdfjs } from "react-pdf";
import { Stage, Layer, Rect } from "react-konva";
const RenderDebugPdf = (props) => {
pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`;
return (
<div>
<div
style={{
position: "sticky",
top: 0,
padding: 10,
zIndex: 1,
backgroundColor: "white",
border: "1px solid grey",
margin: "5px 0"
}}
>
{`Co-ordinates: X - ${props.hoverCoordinates.x}, Y - ${props.hoverCoordinates.y}`}
</div>
<div
style={{
flex: 1,
position: "relative",
border: "1px solid grey",
overflow: "auto"
}}
onMouseMove={props.handleMouseMoveDiv}
>
<Document
onLoadError={(e) => {
const load = {
status: false,
type: "failed"
};
props.setPdfLoadFail(load);
}}
loading={"Loading Document.."}
onLoadSuccess={props.pageDetails}
ref={props.pdfRef}
file={props.pdfUrl}
>
<Page
onLoadSuccess={props.handlePageLoadSuccess}
pageNumber={props.pageNumber}
renderAnnotationLayer={false}
renderTextLayer={false}
onGetAnnotationsError={(error) => {
console.log("annotation error", error);
}}
/>
</Document>
<Stage
onMouseMove={props.handleMouseMove}
onMouseDown={props.handleMouseDown}
onMouseUp={props.handleMouseUp}
width={props.pdfDimension.width}
height={props.pdfDimension.height}
style={{ position: "absolute", top: 0, left: 0 }}
>
<Layer>
{props.annotations
.filter((value) => value.page === props.pageNumber)
.map((value) => {
return (
<Rect
x={value.x}
y={value.y}
width={value.width}
height={value.height}
fill="transparent"
stroke="black"
/>
);
})}
</Layer>
</Stage>
</div>
</div>
);
};
export default RenderDebugPdf;
@@ -379,7 +379,7 @@ function FieldsComponent({
)}
{isSignersModal && (
<ModalUi
title={"Recipients"}
title={"Roles"}
isOpen={isSignersModal}
handleClose={handleModal}
>
@@ -407,7 +407,7 @@ function FieldsComponent({
textAlign: "center"
}}
>
Please add Recipient
Please add a role
</div>
)}
</ModalUi>
@@ -99,6 +99,7 @@ function PlaceHolderSign() {
const [isCheckbox, setIsCheckbox] = useState(false);
const [isNameModal, setIsNameModal] = useState(false);
const [widgetName, setWidgetName] = useState(false);
const [mailStatus, setMailStatus] = useState("");
const color = [
"#93a3db",
"#e6c3db",
@@ -759,8 +760,11 @@ function PlaceHolderSign() {
year: "numeric"
});
let sender = pdfDetails?.[0].ExtUserPtr.Email;
const signerMail = signersdata;
let signerMail = signersdata.slice();
if (pdfDetails?.[0]?.SendinOrder && pdfDetails?.[0]?.SendinOrder === true) {
signerMail.splice(1);
}
for (let i = 0; i < signerMail.length; i++) {
try {
const imgPng =
@@ -789,7 +793,6 @@ function PlaceHolderSign() {
recipient: signerMail[i].Email,
subject: `${pdfDetails?.[0].ExtUserPtr.Name} has requested you to sign ${pdfDetails?.[0].Name}`,
from: sender,
html:
"<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /> </head> <body> <div style='background-color: #f5f5f5; padding: 20px'=> <div style=' box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 12px;background: white;padding-bottom: 20px;'> <div style='padding:10px 10px 0 10px'><img src=" +
imgPng +
@@ -820,6 +823,72 @@ function PlaceHolderSign() {
}
if (sendMail.data.result.status === "success") {
setMailStatus("success");
const signers = signersdata?.map((x) => {
return {
__type: "Pointer",
className: "contracts_Contactbook",
objectId: x.objectId
};
});
const addExtraDays = pdfDetails[0]?.TimeToCompleteDays
? pdfDetails[0].TimeToCompleteDays
: 15;
const currentUser = signersdata.find((x) => x.Email === currentId);
setCurrentId(currentUser?.objectId);
let updateExpiryDate, data;
updateExpiryDate = new Date();
updateExpiryDate.setDate(updateExpiryDate.getDate() + addExtraDays);
try {
if (updateExpiryDate) {
data = {
Placeholders: signerPos,
SignedUrl: pdfDetails[0].URL,
Signers: signers,
ExpiryDate: {
iso: updateExpiryDate,
__type: "Date"
}
};
} else {
data = {
Placeholders: signerPos,
SignedUrl: pdfDetails[0].URL,
Signers: signers
};
}
await axios
.put(
`${localStorage.getItem("baseUrl")}classes/${localStorage.getItem(
"_appName"
)}_Document/${documentId}`,
data,
{
headers: {
"Content-Type": "application/json",
"X-Parse-Application-Id": localStorage.getItem("parseAppId"),
"X-Parse-Session-Token": localStorage.getItem("accesstoken")
}
}
)
.then((result) => {
setIsSend(true);
setIsMailSend(true);
const loadObj = {
isLoad: false
};
setIsLoading(loadObj);
})
.catch((err) => {
console.log("axois err ", err);
});
} catch (e) {
console.log("error", e);
}
} else {
setMailStatus("failed");
const signers = signersdata?.map((x) => {
return {
__type: "Pointer",
@@ -1370,7 +1439,11 @@ function PlaceHolderSign() {
}}
>
<div style={{ height: "100%", padding: 20 }}>
<p>You have successfully sent mails to all recipients!</p>
{mailStatus === "success" ? (
<p>You have successfully sent mails to all recipients!</p>
) : (
<p>Please setup mail adapter to send mail!</p>
)}
{currentId && (
<p>Do you want to sign documents right now ?</p>
)}
@@ -10,6 +10,7 @@ import LegaDrive from "./Component/LegaDrive/LegaDrive";
import PageNotFound from "./Component/PageNotFound";
import TemplatePlaceHolder from "./Component/TemplatePlaceholder";
import Parse from "parse";
import DebugUi from "./Component/DebugUi";
Parse.serverURL = localStorage.getItem("baseUrl");
Parse.initialize(localStorage.getItem("parseAppId"));
// `AppRoutes` is used to define route path of app and
@@ -50,6 +51,7 @@ function AppRoutes() {
<Route path="/legadrive" element={<LegaDrive />} />
{/* Page Not Found */}
<Route path="/template/:templateId" element={<TemplatePlaceHolder />} />
<Route path="/debugpdf" element={<DebugUi />} />
<Route path="*" element={<PageNotFound />} />
</Routes>
</div>
@@ -0,0 +1,25 @@
import { useEffect, useState } from "react";
export function useWindowSize() {
const [size, setSize] = useState({
width: 0,
height: 0
});
const onResize = () => {
setSize({
width: window.innerWidth,
height: window.innerHeight
});
};
useEffect(() => {
onResize();
window.addEventListener("resize", onResize);
return () => {
window.removeEventListener("resize", onResize);
};
}, []);
return size;
}
@@ -5,20 +5,47 @@ const Alert = ({ children, type }) => {
function theme(color) {
switch (color) {
case "success":
return "border-[#c3e6cb] bg-[#d4edda] text-[#155724]";
return {
border: `1px solid #c3e6cb`, // Border color
backgroundColor: "#d4edda", // Background color
color: "#155724" // Text color
};
case "info":
return "border-[#adcdeb] bg-[#c1daf0] text-[#153756]";
return {
border: `1px solid #adcdeb`, // Border color
backgroundColor: "#c1daf0", // Background color
color: "#153756" // Text color
};
case "danger":
return "border-[#f0a8a8] bg-[#f4bebe] text-[#c42121]";
return {
border: `1px solid #f0a8a8`, // Border color
backgroundColor: "#f4bebe", // Background color
color: "#c42121" // Text color
};
default:
return "border-[#d6d6d6] bg-[#d9d9d9] text-[#575757]";
return {
border: `1px solid #d6d6d6`, // Border color
backgroundColor: "#d9d9d9", // Background color
color: "#575757" // Text color
};
}
}
return (
<>
{children && (
<div
className={`z-40 fixed top-20 left-1/2 transform -translate-x-1/2 border-[1px] text-sm ${textcolor} rounded py-[.75rem] px-[1.25rem] `}
style={{
...textcolor,
position: "fixed",
top: "20px",
left: "50%",
transform: "translateX(-50%)",
fontSize: "0.875rem", // Corresponds to text-sm in Tailwind CSS
borderRadius: "5px", // Rounded corners
padding: "10px 15px", // Padding
zIndex: 40
}}
>
{children}
</div>
File diff suppressed because it is too large Load Diff
@@ -1391,7 +1391,8 @@ export const createDocument = async (template, placeholders, signerData) => {
className: "_User",
objectId: Doc.CreatedBy.objectId
},
Signers: signers
Signers: signers,
SendinOrder: Doc?.SendinOrder || false
};
try {