From e708dad596d093501a12be260f5fbc6157a3ade3 Mon Sep 17 00:00:00 2001 From: prafull-opensignlabs <93375423+prafull-opensignlabs@users.noreply.github.com> Date: Mon, 13 Nov 2023 16:17:40 +0530 Subject: [PATCH 1/8] add shipping country code param in subscriptions url (#181) --- apps/OpenSign/src/routes/PlanSubscriptions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/OpenSign/src/routes/PlanSubscriptions.js b/apps/OpenSign/src/routes/PlanSubscriptions.js index 740277932..88d9d3ed2 100644 --- a/apps/OpenSign/src/routes/PlanSubscriptions.js +++ b/apps/OpenSign/src/routes/PlanSubscriptions.js @@ -28,7 +28,7 @@ const PlanSubscriptions = () => { : ""; const phone = userDetails && userDetails.phone ? "&mobile=" + userDetails.phone : ""; - const details = "?" + name + email + company + phone; + const details = "?shipping_country_code=US&" + name + email + company + phone; useEffect(() => { if (localStorage.getItem("accesstoken")) { setIsLoader(false); From edecf3ea239de11d9951711de1ce0a198b15007f Mon Sep 17 00:00:00 2001 From: nxglabs Date: Mon, 13 Nov 2023 18:21:49 +0530 Subject: [PATCH 2/8] chore: configure husky & prettier --- .husky/pre-commit | 7 +- .lintstagedrc.json | 3 + package-lock.json | 704 +++++++++++++++++++++++++++++++++++++++++++++ package.json | 30 ++ 4 files changed, 740 insertions(+), 4 deletions(-) create mode 100644 .lintstagedrc.json create mode 100644 package-lock.json create mode 100644 package.json diff --git a/.husky/pre-commit b/.husky/pre-commit index 1999e3518..21170d497 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,5 +1,4 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" -npx eslint '**/*.{js,jsx}' -npx pretty-quick --staged '**/*.{js,jsx}' \ No newline at end of file +npm run lint-staged-changes diff --git a/.lintstagedrc.json b/.lintstagedrc.json new file mode 100644 index 000000000..5478c3ce3 --- /dev/null +++ b/.lintstagedrc.json @@ -0,0 +1,3 @@ +{ + "*.js": "prettier --write" +} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 000000000..bc1cd89fe --- /dev/null +++ b/package-lock.json @@ -0,0 +1,704 @@ +{ + "name": "opensign", + "version": "1.0.6", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "opensign", + "version": "1.0.6", + "license": "AGPL-3.0", + "devDependencies": { + "husky": "^8.0.0", + "lint-staged": "^15.1.0", + "prettier": "3.1.0" + } + }, + "node_modules/ansi-escapes": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-5.0.0.tgz", + "integrity": "sha512-5GFMVX8HqE/TB+FuBJGuO5XG0WrsA6ptUqoODaT/n9mmUaZFkqnBueB4leqGBCmrUHnCnC4PCZTCd0E7QQ83bA==", + "dev": true, + "dependencies": { + "type-fest": "^1.0.2" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chalk": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", + "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/cli-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-4.0.0.tgz", + "integrity": "sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==", + "dev": true, + "dependencies": { + "restore-cursor": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-truncate": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-3.1.0.tgz", + "integrity": "sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA==", + "dev": true, + "dependencies": { + "slice-ansi": "^5.0.0", + "string-width": "^5.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "dev": true + }, + "node_modules/commander": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz", + "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==", + "dev": true, + "engines": { + "node": ">=16" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, + "node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "node_modules/eventemitter3": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz", + "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==", + "dev": true + }, + "node_modules/execa": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", + "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^8.0.1", + "human-signals": "^5.0.0", + "is-stream": "^3.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^5.1.0", + "onetime": "^6.0.0", + "signal-exit": "^4.1.0", + "strip-final-newline": "^3.0.0" + }, + "engines": { + "node": ">=16.17" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/get-stream": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", + "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", + "dev": true, + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/human-signals": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", + "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", + "dev": true, + "engines": { + "node": ">=16.17.0" + } + }, + "node_modules/husky": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.3.tgz", + "integrity": "sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==", + "dev": true, + "bin": { + "husky": "lib/bin.js" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz", + "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", + "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "node_modules/lilconfig": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", + "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/lint-staged": { + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-15.1.0.tgz", + "integrity": "sha512-ZPKXWHVlL7uwVpy8OZ7YQjYDAuO5X4kMh0XgZvPNxLcCCngd0PO5jKQyy3+s4TL2EnHoIXIzP1422f/l3nZKMw==", + "dev": true, + "dependencies": { + "chalk": "5.3.0", + "commander": "11.1.0", + "debug": "4.3.4", + "execa": "8.0.1", + "lilconfig": "2.1.0", + "listr2": "7.0.2", + "micromatch": "4.0.5", + "pidtree": "0.6.0", + "string-argv": "0.3.2", + "yaml": "2.3.4" + }, + "bin": { + "lint-staged": "bin/lint-staged.js" + }, + "engines": { + "node": ">=18.12.0" + }, + "funding": { + "url": "https://opencollective.com/lint-staged" + } + }, + "node_modules/listr2": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/listr2/-/listr2-7.0.2.tgz", + "integrity": "sha512-rJysbR9GKIalhTbVL2tYbF2hVyDnrf7pFUZBwjPaMIdadYHmeT+EVi/Bu3qd7ETQPahTotg2WRCatXwRBW554g==", + "dev": true, + "dependencies": { + "cli-truncate": "^3.1.0", + "colorette": "^2.0.20", + "eventemitter3": "^5.0.1", + "log-update": "^5.0.1", + "rfdc": "^1.3.0", + "wrap-ansi": "^8.1.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/log-update": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-5.0.1.tgz", + "integrity": "sha512-5UtUDQ/6edw4ofyljDNcOVJQ4c7OjDro4h3y8e1GQL5iYElYclVHJ3zeWchylvMaKnDbDilC8irOVyexnA/Slw==", + "dev": true, + "dependencies": { + "ansi-escapes": "^5.0.0", + "cli-cursor": "^4.0.0", + "slice-ansi": "^5.0.0", + "strip-ansi": "^7.0.1", + "wrap-ansi": "^8.0.1" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mimic-fn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", + "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/npm-run-path": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.1.0.tgz", + "integrity": "sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==", + "dev": true, + "dependencies": { + "path-key": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm-run-path/node_modules/path-key": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", + "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/onetime": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", + "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", + "dev": true, + "dependencies": { + "mimic-fn": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pidtree": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.6.0.tgz", + "integrity": "sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==", + "dev": true, + "bin": { + "pidtree": "bin/pidtree.js" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/prettier": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.0.tgz", + "integrity": "sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw==", + "dev": true, + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/restore-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz", + "integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==", + "dev": true, + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/restore-cursor/node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/restore-cursor/node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/restore-cursor/node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/rfdc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", + "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==", + "dev": true + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/slice-ansi": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", + "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.0.0", + "is-fullwidth-code-point": "^4.0.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" + } + }, + "node_modules/string-argv": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz", + "integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==", + "dev": true, + "engines": { + "node": ">=0.6.19" + } + }, + "node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/strip-final-newline": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", + "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/type-fest": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", + "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/yaml": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.4.tgz", + "integrity": "sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==", + "dev": true, + "engines": { + "node": ">= 14" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 000000000..febdc4fb2 --- /dev/null +++ b/package.json @@ -0,0 +1,30 @@ +{ + "name": "opensign", + "version": "1.0.6", + "description": "Free and open source alternative to DocuSign", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "prepare": "husky install", + "lint-staged-changes": "lint-staged" + }, + "repository": { + "type": "git", + "url": "github.com/opensignlabs/opensign" + }, + "keywords": [ + "digital", + "signature", + "e-signature", + "docusign", + "electronic", + "signature" + ], + "author": "OpenSignLabs", + "license": "AGPL-3.0", + "devDependencies": { + "husky": "^8.0.0", + "lint-staged": "^15.1.0", + "prettier": "3.1.0" + } +} From 6c565a144a9ce756d3bd7f3cd96fb48869e21dc2 Mon Sep 17 00:00:00 2001 From: Raktima <110812506+raktima-opensignlabs@users.noreply.github.com> Date: Tue, 14 Nov 2023 15:29:00 +0530 Subject: [PATCH 3/8] fix need your sign report document signature issue (#183) --- .../src/Component/PdfRequestFiles.js | 1 - .../src/Component/component/header.js | 173 ++++++++++++------ .../src/Component/component/renderPdf.js | 22 ++- .../src/Component/recipientSignPdf.js | 1 + .../SignDocuments/src/css/signature.css | 32 ++-- 5 files changed, 152 insertions(+), 77 deletions(-) diff --git a/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js b/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js index 6d2d33061..d741162d5 100644 --- a/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js +++ b/microfrontends/SignDocuments/src/Component/PdfRequestFiles.js @@ -192,7 +192,6 @@ function PdfRequestFiles() { //check document is signed or not if (checkDocIdExist && checkDocIdExist.length > 0) { - setAlreadySign(true); setIsDocId(true); const signerRes = res[0].Signers; //comparison auditTrail user details with signers user details diff --git a/microfrontends/SignDocuments/src/Component/component/header.js b/microfrontends/SignDocuments/src/Component/component/header.js index c68ad4ada..4d971cfb4 100644 --- a/microfrontends/SignDocuments/src/Component/component/header.js +++ b/microfrontends/SignDocuments/src/Component/component/header.js @@ -27,13 +27,13 @@ function Header({ signersdata, isMailSend, alertSendEmail, - isSigned, isCompleted, isShowHeader, decline, currentSigner, dataTut4, - alreadySign + alreadySign, + isSignYourself }) { const isMobile = window.innerWidth < 767; const navigate = useNavigate(); @@ -61,12 +61,19 @@ function Header({ const pdf = await getBase64FromUrl(pdfUrl); const isAndroidDevice = navigator.userAgent.match(/Android/i); - const isAppleDevice = (/iPad|iPhone|iPod/.test(navigator.platform) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)) && !window.MSStream + const isAppleDevice = + (/iPad|iPhone|iPod/.test(navigator.platform) || + (navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1)) && + !window.MSStream; if (isAndroidDevice || isAppleDevice) { - const byteArray = Uint8Array.from(atob(pdf).split('').map(char => char.charCodeAt(0))); - const blob = new Blob([byteArray], { type: 'application/pdf' }); + const byteArray = Uint8Array.from( + atob(pdf) + .split("") + .map((char) => char.charCodeAt(0)) + ); + const blob = new Blob([byteArray], { type: "application/pdf" }); const blobUrl = URL.createObjectURL(blob); - window.open(blobUrl, '_blank'); + window.open(blobUrl, "_blank"); } else { printModule({ printable: pdf, type: "pdf", base64: true }); } @@ -75,19 +82,76 @@ function Header({ //handle download signed pdf const handleDownloadPdf = () => { const pdfName = pdfDetails[0] && pdfDetails[0].Name; - - saveAs(pdfUrl, `${sanitizeFileName(pdfName)}_signed_by_OpenSign™.pdf`); + saveAs(pdfUrl, `${sanitizeFileName(pdfName)}_signed_by_OpenSign™.pdf`); }; - + const sanitizeFileName = (pdfName) => { // Replace spaces with underscore return pdfName.replace(/ /g, '_'); } - - + //certificate generate and download component in mobile view + const CertificateDropDown = () => { + //after generate download certifcate pdf + const handleDownload = (pdfBlob, fileName) => { + if (pdfBlob) { + const url = window.URL.createObjectURL(pdfBlob); + // Create a temporary anchor element + const link = document.createElement("a"); + link.href = url; + link.download = fileName; + // Append the anchor to the body + document.body.appendChild(link); + // Programmatically click the anchor to trigger the download + link.click(); + // Remove the anchor from the body + document.body.removeChild(link); + // Release the object URL to free up resources + window.URL.revokeObjectURL(url); + } + }; + return ( + e.preventDefault()} + style={{ textDecoration: "none", zIndex: "35" }} + document={} + > + {({ blob, url, loading, error }) => ( + <> + {loading ? ( + "Loading document..." + ) : ( +
+ handleDownload( + blob, + `completion certificate-${ + pdfDetails[0] && pdfDetails[0].Name + }.pdf` + ) + } + > + + Certificate +
+ )} + + )} +
+ ); + }; return (
{isMobile && isShowHeader ? ( @@ -95,7 +159,9 @@ function Header({ id="navbar" className={isGuestSigner ? "stickySignerHead" : "stickyHead"} style={{ - width: isGuestSigner ? window.innerWidth : window.innerWidth - 30 + "px" + width: isGuestSigner + ? window.innerWidth + : window.innerWidth - 30 + "px" }} >
@@ -140,16 +206,16 @@ function Header({ style={{ color: "gray", cursor: "pointer" }} >
- {pdfUrl ? ( + {pdfUrl && alreadySign ? (
handleDownloadPdf()} style={{ color: themeColor(), border: "none", fontWeight: "650", - fontSize: "16px" + fontSize: "16px", + padding:"0px 3px 0px 5px" }} > @@ -179,51 +245,46 @@ function Header({ Download
- - } - fileName={`completion certificate-${ - pdfDetails[0] && pdfDetails[0].Name - }.pdf`} + {recipient && pdfDetails[0] && pdfDetails.length > 0 ? ( + + + + ) : isPdfRequestFiles && + alreadySign && + isCompleted.isCertificate ? ( + + + + ) :isSignYourself && ( + + + + )} + +
- {({ blob, url, loading, error }) => ( - <> - {console.log("error", error)} - {loading ? ( - "Loading document..." - ) : ( - - )} - - )} - + {" "} + + Print +
) : (
- {/* current signer is checking user send request and check status of pdf sign than if current + {/* current signer is checking user send request and check status of pdf sign than if current user exist than show finish button else no */} {currentSigner && ( @@ -267,6 +328,8 @@ function Header({ onClick={() => { if (!pdfUrl) { embedImages(); + } else if (isPdfRequestFiles) { + embedImages(); } }} style={{ @@ -689,4 +752,4 @@ function Header({ ); } -export default Header; +export default Header; \ No newline at end of file diff --git a/microfrontends/SignDocuments/src/Component/component/renderPdf.js b/microfrontends/SignDocuments/src/Component/component/renderPdf.js index abebeb5db..07cade06e 100644 --- a/microfrontends/SignDocuments/src/Component/component/renderPdf.js +++ b/microfrontends/SignDocuments/src/Component/component/renderPdf.js @@ -42,7 +42,8 @@ function RenderPdf({ const isMobile = window.innerWidth < 767; const newWidth = window.innerWidth; const scale = isMobile ? pdfOriginalWidth / newWidth : 1; - + //check isGuestSigner is present in local if yes than handle login flow header in mobile view + const isGuestSigner = localStorage.getItem("isGuestSigner"); // handle signature block width and height according to screen const posWidth = (pos) => { let width; @@ -74,8 +75,7 @@ function RenderPdf({ return width; } }; - //check isGuestSigner is present in local if yes than handle login flow header in mobile view - const isGuestSigner = localStorage.getItem("isGuestSigner"); + //function for render placeholder block over pdf document const checkSignedSignes = (data) => { @@ -777,7 +777,13 @@ function RenderPdf({ }} onLoadSuccess={pageDetails} ref={pdfRef} - file={pdfUrl ? pdfUrl : pdfDetails[0] && pdfDetails[0].URL} + file={ + pdfUrl + ? pdfUrl + : pdfDetails[0] && pdfDetails[0].SignedUrl + ? pdfDetails[0].SignedUrl + : pdfDetails[0].URL + } > {Array.from(new Array(numPages), (el, index) => ( {Array.from(new Array(numPages), (el, index) => ( Date: Tue, 14 Nov 2023 20:09:51 +0530 Subject: [PATCH 4/8] fix: #172 - Location of requested signature placeholders shift to slight right on mobile view in "Request Signatures" flow (#185) --- .../src/Component/component/renderPdf.js | 1179 +++++++++-------- 1 file changed, 595 insertions(+), 584 deletions(-) diff --git a/microfrontends/SignDocuments/src/Component/component/renderPdf.js b/microfrontends/SignDocuments/src/Component/component/renderPdf.js index 07cade06e..815ce2cd5 100644 --- a/microfrontends/SignDocuments/src/Component/component/renderPdf.js +++ b/microfrontends/SignDocuments/src/Component/component/renderPdf.js @@ -42,8 +42,8 @@ function RenderPdf({ const isMobile = window.innerWidth < 767; const newWidth = window.innerWidth; const scale = isMobile ? pdfOriginalWidth / newWidth : 1; - //check isGuestSigner is present in local if yes than handle login flow header in mobile view - const isGuestSigner = localStorage.getItem("isGuestSigner"); + //check isGuestSigner is present in local if yes than handle login flow header in mobile view + const isGuestSigner = localStorage.getItem("isGuestSigner"); // handle signature block width and height according to screen const posWidth = (pos) => { let width; @@ -75,7 +75,6 @@ function RenderPdf({ return width; } }; - //function for render placeholder block over pdf document const checkSignedSignes = (data) => { @@ -90,7 +89,7 @@ function RenderPdf({ if (isMobile) { //if pos.isMobile false -- placeholder saved from desktop view then handle position in mobile view divided by scale if (!pos.isMobile) { - return pos.xPosition / scale - 20; + return pos.xPosition / scale + 32; } //pos.isMobile true -- placeholder save from mobile view(small device) handle position in mobile view(small screen) view divided by scale else { @@ -434,279 +433,144 @@ function RenderPdf({ ); }) : pdfRequest - ? signerPos.map((data, key) => { - return ( - - {checkSignedSignes(data)} - - ); - }) - : placeholder - ? signerPos.map((data, ind) => { - return ( - - {data.placeHolder.map((placeData, index) => { - return ( - - {placeData.pageNumber === pageNumber && - placeData.pos.map((pos) => { - return ( - - handleTabDrag(pos.key, data.signerObjId) - } - size={{ - width: pos.Width ? pos.Width : 150, - height: pos.Height ? pos.Height : 60 - }} - lockAspectRatio={ - pos.Width ? pos.Width / pos.Height : 2.5 - } - resizeHandleStyles={{ - bottom: { display: "none" }, - right: { display: "none" }, - bottomRight: { display: "block" } - }} - onDragStop={(event, dragElement) => - handleStop( - event, - dragElement, - data.signerObjId, - pos.key - ) - } - default={{ - x: pos.xPosition, - y: pos.yPosition - }} - onResize={( - e, - direction, - ref, - delta, - position - ) => { - handleImageResize( - ref, - pos.key, - data.signerObjId, - position - ); - }} - > -
{ - e.stopPropagation(); - handleDeleteSign( - pos.key, - data.signerObjId - ); - }} - style={{ - position: "absolute", - right: 0, - display: "inline-block", - background: themeColor(), - cursor: "pointer", - padding: "0px 10px", - zIndex: 10 - }} - > - x -
-
{ + return ( + + {checkSignedSignes(data)} + + ); + }) + : placeholder + ? signerPos.map((data, ind) => { + return ( + + {data.placeHolder.map((placeData, index) => { + return ( + + {placeData.pageNumber === pageNumber && + placeData.pos.map((pos) => { + return ( + + handleTabDrag( + pos.key, + data.signerObjId + ) + } + size={{ + width: pos.Width ? pos.Width : 150, + height: pos.Height ? pos.Height : 60 + }} + lockAspectRatio={ + pos.Width + ? pos.Width / pos.Height + : 2.5 + } + resizeHandleStyles={{ + bottom: { display: "none" }, + right: { display: "none" }, + bottomRight: { display: "block" } + }} + onDragStop={(event, dragElement) => + handleStop( + event, + dragElement, + data.signerObjId, + pos.key + ) + } + default={{ + x: pos.xPosition, + y: pos.yPosition + }} + onResize={( + e, + direction, + ref, + delta, + position + ) => { + handleImageResize( + ref, + pos.key, + data.signerObjId, + position + ); + }} + > +
{ + e.stopPropagation(); + handleDeleteSign( + pos.key, + data.signerObjId + ); + }} + style={{ + position: "absolute", + right: 0, + display: "inline-block", + background: themeColor(), + cursor: "pointer", + padding: "0px 10px", + zIndex: 10 + }} + > + x +
+
- {pos.isStamp ? "stamp" : "signature"} -
-
- ); - })} -
- ); - })} -
- ); - }) - : xyPostion.map((data, ind) => { - return ( - - {data.pageNumber === pageNumber && - data.pos.map((pos) => { - return pos && pos.SignUrl ? ( - handleTabDrag(pos.key)} - onDragStop={handleStop} - onResize={( - e, - direction, - ref, - delta, - position - ) => { - handleImageResize( - ref, - pos.key, - direction, - position - ); - }} - > - {" "} -
{ - if (!isDragging) { - setTimeout(() => { - e.stopPropagation(); - setIsSignPad(true); - setSignKey(pos.key); - setIsStamp(pos.isStamp); - }, 500); + marginTop: "0px" + }} + > + {pos.isStamp ? "stamp" : "signature"} +
+
+ ); + })} +
+ ); + })} + + ); + }) + : xyPostion.map((data, ind) => { + return ( + + {data.pageNumber === pageNumber && + data.pos.map((pos) => { + return pos && pos.SignUrl ? ( + -
{ - e.stopPropagation(); - handleDeleteSign(pos.key); - setIsStamp(false); - }} - style={{ - position: "absolute", - right: 0, - display: "inline-block", - background: themeColor(), - cursor: "pointer", - padding: "0px 10px" - }} - > - x -
-
- signimg { - setSignKey(pos.key); - setIsSignPad(true); - setIsStamp(pos.isStamp); - }} - src={pos.SignUrl} - style={{ - width: "100%", - height: "100%", - objectFit: "contain" - }} - /> -
-
-
- ) : ( - <> - { - handleTabDrag(pos.key, e); - }} - onDragStop={handleStop} - size={{ - width: pos.Width ? pos.Width : 150, - height: pos.Height ? pos.Height : 60 - }} - default={{ - x: pos.xPosition, - y: pos.yPosition - }} - > -
{ - if (!isDragging) { - setTimeout(() => { - setIsSignPad(true); - - setSignKey(pos.key); - setIsStamp(pos.isStamp); - }, 500); - } - }} - className="dragElm" + key={pos.key} style={{ padding: "0px", cursor: "all-scroll", - zIndex: 20, + zIndex: 1, position: "absolute", borderStyle: "dashed", width: "150px", @@ -716,50 +580,190 @@ function RenderPdf({ textAlign: "center", justifyContent: "center", borderWidth: "0.2px", - overflow: "hidden" + overflow: "hidden", + userSelect: "none" + }} + size={{ + width: pos.Width ? pos.Width : 151, + height: pos.Height ? pos.Height : 61 + }} + default={{ + x: pos.xPosition, + y: pos.yPosition + }} + onDrag={() => handleTabDrag(pos.key)} + onDragStop={handleStop} + onResize={( + e, + direction, + ref, + delta, + position + ) => { + handleImageResize( + ref, + pos.key, + direction, + position + ); }} > + {" "}
{ - e.stopPropagation(); - e.preventDefault(); - - handleDeleteSign(pos.key); - setIsStamp(false); - }} - onClick={(e) => { - e.stopPropagation(); // Prevent further event propagation + if (!isDragging) { + setTimeout(() => { + e.stopPropagation(); + setIsSignPad(true); + setSignKey(pos.key); + setIsStamp(pos.isStamp); + }, 500); + } }} + > +
{ + e.stopPropagation(); + handleDeleteSign(pos.key); + setIsStamp(false); + }} + style={{ + position: "absolute", + right: 0, + display: "inline-block", + background: themeColor(), + cursor: "pointer", + padding: "0px 10px" + }} + > + x +
+
+ signimg { + setSignKey(pos.key); + setIsSignPad(true); + setIsStamp(pos.isStamp); + }} + src={pos.SignUrl} + style={{ + width: "100%", + height: "100%", + objectFit: "contain" + }} + /> +
+
+ + ) : ( + <> + - x -
-
{ + handleTabDrag(pos.key, e); + }} + onDragStop={handleStop} + size={{ + width: pos.Width ? pos.Width : 150, + height: pos.Height ? pos.Height : 60 + }} + default={{ + x: pos.xPosition, + y: pos.yPosition }} > - {pos.isStamp ? "stamp" : "signature"} -
-
- - - ); - })} - - ); - }))} +
{ + if (!isDragging) { + setTimeout(() => { + setIsSignPad(true); + + setSignKey(pos.key); + setIsStamp(pos.isStamp); + }, 500); + } + }} + className="dragElm" + style={{ + padding: "0px", + cursor: "all-scroll", + zIndex: 20, + position: "absolute", + borderStyle: "dashed", + width: "150px", + height: "60px", + borderColor: themeColor(), + background: "#daebe0", + textAlign: "center", + justifyContent: "center", + borderWidth: "0.2px", + overflow: "hidden" + }} + > +
{ + e.stopPropagation(); + e.preventDefault(); + + handleDeleteSign(pos.key); + setIsStamp(false); + }} + onClick={(e) => { + e.stopPropagation(); // Prevent further event propagation + }} + style={{ + position: "absolute", + right: 0, + display: "inline-block", + background: themeColor(), + cursor: "pointer", + padding: "0px 10px" + }} + > + x +
+
+ {pos.isStamp ? "stamp" : "signature"} +
+
+ + + ); + })} + + ); + }))} {/* this component for render pdf document is in middle of the component */}
{Array.from(new Array(numPages), (el, index) => ( @@ -980,89 +984,289 @@ function RenderPdf({ ); }) : pdfRequest - ? signerPos.map((data, key) => { - return ( - - {checkSignedSignes(data)} - - ); - }) - : placeholder - ? signerPos.map((data, ind) => { - return ( - - {data.placeHolder.map((placeData, index) => { - return ( - - {placeData.pageNumber === pageNumber && - placeData.pos.map((pos) => { - return ( - { + return ( + + {checkSignedSignes(data)} + + ); + }) + : placeholder + ? signerPos.map((data, ind) => { + return ( + + {data.placeHolder.map((placeData, index) => { + return ( + + {placeData.pageNumber === pageNumber && + placeData.pos.map((pos) => { + return ( + + handleTabDrag( + pos.key, + data.signerObjId + ) + } + size={{ + width: pos.Width ? pos.Width : 150, + height: pos.Height ? pos.Height : 60 + }} + lockAspectRatio={ + pos.Width + ? pos.Width / pos.Height + : 2.5 + } + resizeHandleStyles={{ + bottom: { display: "none" }, + right: { display: "none" }, + bottomRight: { display: "block" } + }} + onDragStop={(event, dragElement) => + handleStop( + event, + dragElement, + data.signerObjId, + pos.key + ) + } + default={{ + x: pos.xPosition, + y: pos.yPosition + }} + onResize={( + e, + direction, + ref, + delta, + position + ) => { + handleImageResize( + ref, + pos.key, + data.signerObjId, + position + ); + }} + > +
{ + e.stopPropagation(); + handleDeleteSign( + pos.key, + data.signerObjId + ); + }} + style={{ + position: "absolute", + right: 0, + display: "inline-block", + background: themeColor(), + cursor: "pointer", + padding: "0px 10px", + zIndex: 10 + }} + > + x +
+
+ {pos.isStamp + ? "stamp" + : "signature"} +
+
+ ); + })} +
+ ); + })} +
+ ); + }) + : xyPostion.map((data, ind) => { + return ( + + {data.pageNumber === pageNumber && + data.pos.map((pos) => { + return pos && pos.SignUrl ? ( + handleTabDrag(pos.key)} + size={{ + width: pos.Width ? pos.Width : 150, + height: pos.Height ? pos.Height : 60 + }} + onDragStop={handleStop} + default={{ + x: pos.xPosition, + y: pos.yPosition + }} + onResize={( + e, + direction, + ref, + delta, + position + ) => { + handleImageResize( + ref, + pos.key, + direction, + position + ); + }} + onClick={() => { + if (!isDragging) { + setIsSignPad(true); + setSignKey(pos.key); + setIsStamp(pos.isStamp); + } + }} + > +
{ + e.stopPropagation(); + handleDeleteSign(pos.key); + setIsStamp(false); + }} + style={{ + position: "absolute", + right: 0, + display: "inline-block", + background: themeColor(), + cursor: "pointer", + padding: "0px 10px" + }} + > + x +
+
+ signimg { + setSignKey(pos.key); + setIsSignPad(true); + setIsStamp(pos.isStamp); + }} + src={pos.SignUrl} + style={{ + width: "100%", + height: "100%", + objectFit: "contain" + }} + /> +
+
+ ) : ( + handleTabDrag(pos.key, e)} + size={{ + width: pos.Width ? pos.Width : 150, + height: pos.Height ? pos.Height : 60 + }} + onDragStop={handleStop} + default={{ + x: pos.xPosition, + y: pos.yPosition + }} + > +
{ + if (!isDragging) { + e.stopPropagation(); + setIsSignPad(true); + setSignKey(pos.key); + setIsStamp(pos.isStamp); + } + }} style={{ - padding: "0px", cursor: "all-scroll", - zIndex: 1, + zIndex: 10, position: "absolute", borderStyle: "dashed", - width: "200px", - height: "30px", + width: "150px", + height: "60px", borderColor: themeColor(), - background: data.blockColor, + background: "#daebe0", textAlign: "center", justifyContent: "center", + alignItems: "center", borderWidth: "0.2px" }} - onDrag={() => - handleTabDrag(pos.key, data.signerObjId) - } - size={{ - width: pos.Width ? pos.Width : 150, - height: pos.Height ? pos.Height : 60 - }} - lockAspectRatio={ - pos.Width ? pos.Width / pos.Height : 2.5 - } - resizeHandleStyles={{ - bottom: { display: "none" }, - right: { display: "none" }, - bottomRight: { display: "block" } - }} - onDragStop={(event, dragElement) => - handleStop( - event, - dragElement, - data.signerObjId, - pos.key - ) - } - default={{ - x: pos.xPosition, - y: pos.yPosition - }} - onResize={( - e, - direction, - ref, - delta, - position - ) => { - handleImageResize( - ref, - pos.key, - data.signerObjId, - position - ); - }} >
{ e.stopPropagation(); - handleDeleteSign( - pos.key, - data.signerObjId - ); + handleDeleteSign(pos.key); + setIsStamp(false); }} style={{ position: "absolute", @@ -1070,8 +1274,7 @@ function RenderPdf({ display: "inline-block", background: themeColor(), cursor: "pointer", - padding: "0px 10px", - zIndex: 10 + padding: "0px 10px" }} > x @@ -1079,212 +1282,20 @@ function RenderPdf({
{pos.isStamp ? "stamp" : "signature"}
- - ); - })} - - ); - })} - - ); - }) - : xyPostion.map((data, ind) => { - return ( - - {data.pageNumber === pageNumber && - data.pos.map((pos) => { - return pos && pos.SignUrl ? ( - handleTabDrag(pos.key)} - size={{ - width: pos.Width ? pos.Width : 150, - height: pos.Height ? pos.Height : 60 - }} - onDragStop={handleStop} - default={{ - x: pos.xPosition, - y: pos.yPosition - }} - onResize={( - e, - direction, - ref, - delta, - position - ) => { - handleImageResize( - ref, - pos.key, - direction, - position - ); - }} - onClick={() => { - if (!isDragging) { - setIsSignPad(true); - setSignKey(pos.key); - setIsStamp(pos.isStamp); - } - }} - > -
{ - e.stopPropagation(); - handleDeleteSign(pos.key); - setIsStamp(false); - }} - style={{ - position: "absolute", - right: 0, - display: "inline-block", - background: themeColor(), - cursor: "pointer", - padding: "0px 10px" - }} - > - x -
-
- signimg { - setSignKey(pos.key); - setIsSignPad(true); - setIsStamp(pos.isStamp); - }} - src={pos.SignUrl} - style={{ - width: "100%", - height: "100%", - objectFit: "contain" - }} - /> -
-
- ) : ( - handleTabDrag(pos.key, e)} - size={{ - width: pos.Width ? pos.Width : 150, - height: pos.Height ? pos.Height : 60 - }} - onDragStop={handleStop} - default={{ - x: pos.xPosition, - y: pos.yPosition - }} - > -
{ - if (!isDragging) { - e.stopPropagation(); - setIsSignPad(true); - setSignKey(pos.key); - setIsStamp(pos.isStamp); - } - }} - style={{ - cursor: "all-scroll", - zIndex: 10, - position: "absolute", - borderStyle: "dashed", - width: "150px", - height: "60px", - borderColor: themeColor(), - background: "#daebe0", - textAlign: "center", - justifyContent: "center", - alignItems: "center", - borderWidth: "0.2px" - }} - > -
{ - e.stopPropagation(); - handleDeleteSign(pos.key); - setIsStamp(false); - }} - style={{ - position: "absolute", - right: 0, - display: "inline-block", - background: themeColor(), - cursor: "pointer", - padding: "0px 10px" - }} - > - x -
-
- {pos.isStamp ? "stamp" : "signature"} -
-
-
- ); - })} -
- ); - }))} +
+ + ); + })} + + ); + }))} {/* this component for render pdf document is in middle of the component */} {Array.from(new Array(numPages), (el, index) => ( @@ -1326,4 +1337,4 @@ function RenderPdf({ ); } -export default RenderPdf; \ No newline at end of file +export default RenderPdf; From 0d8767ee98547bbccbda08d5a5ba0d48ea8fdd48 Mon Sep 17 00:00:00 2001 From: Amol Date: Tue, 14 Nov 2023 20:30:40 +0530 Subject: [PATCH 5/8] Revert "fix: #172 - Location of requested signature placeholders shift to slight right on mobile view in "Request Signatures" flow (#185)" (#186) This reverts commit f463dc7af7fa1696fa117021b205162c3b7474be. --- .../src/Component/component/renderPdf.js | 1181 ++++++++--------- 1 file changed, 585 insertions(+), 596 deletions(-) diff --git a/microfrontends/SignDocuments/src/Component/component/renderPdf.js b/microfrontends/SignDocuments/src/Component/component/renderPdf.js index 815ce2cd5..07cade06e 100644 --- a/microfrontends/SignDocuments/src/Component/component/renderPdf.js +++ b/microfrontends/SignDocuments/src/Component/component/renderPdf.js @@ -42,8 +42,8 @@ function RenderPdf({ const isMobile = window.innerWidth < 767; const newWidth = window.innerWidth; const scale = isMobile ? pdfOriginalWidth / newWidth : 1; - //check isGuestSigner is present in local if yes than handle login flow header in mobile view - const isGuestSigner = localStorage.getItem("isGuestSigner"); + //check isGuestSigner is present in local if yes than handle login flow header in mobile view + const isGuestSigner = localStorage.getItem("isGuestSigner"); // handle signature block width and height according to screen const posWidth = (pos) => { let width; @@ -75,6 +75,7 @@ function RenderPdf({ return width; } }; + //function for render placeholder block over pdf document const checkSignedSignes = (data) => { @@ -89,7 +90,7 @@ function RenderPdf({ if (isMobile) { //if pos.isMobile false -- placeholder saved from desktop view then handle position in mobile view divided by scale if (!pos.isMobile) { - return pos.xPosition / scale + 32; + return pos.xPosition / scale - 20; } //pos.isMobile true -- placeholder save from mobile view(small device) handle position in mobile view(small screen) view divided by scale else { @@ -433,144 +434,279 @@ function RenderPdf({ ); }) : pdfRequest - ? signerPos.map((data, key) => { - return ( - - {checkSignedSignes(data)} - - ); - }) - : placeholder - ? signerPos.map((data, ind) => { - return ( - - {data.placeHolder.map((placeData, index) => { - return ( - - {placeData.pageNumber === pageNumber && - placeData.pos.map((pos) => { - return ( - - handleTabDrag( - pos.key, - data.signerObjId - ) - } - size={{ - width: pos.Width ? pos.Width : 150, - height: pos.Height ? pos.Height : 60 - }} - lockAspectRatio={ - pos.Width - ? pos.Width / pos.Height - : 2.5 - } - resizeHandleStyles={{ - bottom: { display: "none" }, - right: { display: "none" }, - bottomRight: { display: "block" } - }} - onDragStop={(event, dragElement) => - handleStop( - event, - dragElement, - data.signerObjId, - pos.key - ) - } - default={{ - x: pos.xPosition, - y: pos.yPosition - }} - onResize={( - e, - direction, - ref, - delta, - position - ) => { - handleImageResize( - ref, - pos.key, - data.signerObjId, - position - ); - }} - > -
{ - e.stopPropagation(); - handleDeleteSign( - pos.key, - data.signerObjId - ); - }} - style={{ - position: "absolute", - right: 0, - display: "inline-block", - background: themeColor(), - cursor: "pointer", - padding: "0px 10px", - zIndex: 10 - }} - > - x -
-
{ + return ( + + {checkSignedSignes(data)} + + ); + }) + : placeholder + ? signerPos.map((data, ind) => { + return ( + + {data.placeHolder.map((placeData, index) => { + return ( + + {placeData.pageNumber === pageNumber && + placeData.pos.map((pos) => { + return ( + + handleTabDrag(pos.key, data.signerObjId) + } + size={{ + width: pos.Width ? pos.Width : 150, + height: pos.Height ? pos.Height : 60 + }} + lockAspectRatio={ + pos.Width ? pos.Width / pos.Height : 2.5 + } + resizeHandleStyles={{ + bottom: { display: "none" }, + right: { display: "none" }, + bottomRight: { display: "block" } + }} + onDragStop={(event, dragElement) => + handleStop( + event, + dragElement, + data.signerObjId, + pos.key + ) + } + default={{ + x: pos.xPosition, + y: pos.yPosition + }} + onResize={( + e, + direction, + ref, + delta, + position + ) => { + handleImageResize( + ref, + pos.key, + data.signerObjId, + position + ); + }} + > +
{ + e.stopPropagation(); + handleDeleteSign( + pos.key, + data.signerObjId + ); + }} + style={{ + position: "absolute", + right: 0, + display: "inline-block", + background: themeColor(), + cursor: "pointer", + padding: "0px 10px", + zIndex: 10 + }} + > + x +
+
- {pos.isStamp ? "stamp" : "signature"} -
-
- ); - })} -
- ); - })} -
- ); - }) - : xyPostion.map((data, ind) => { - return ( - - {data.pageNumber === pageNumber && - data.pos.map((pos) => { - return pos && pos.SignUrl ? ( - + {pos.isStamp ? "stamp" : "signature"} +
+
+ ); + })} +
+ ); + })} +
+ ); + }) + : xyPostion.map((data, ind) => { + return ( + + {data.pageNumber === pageNumber && + data.pos.map((pos) => { + return pos && pos.SignUrl ? ( + handleTabDrag(pos.key)} + onDragStop={handleStop} + onResize={( + e, + direction, + ref, + delta, + position + ) => { + handleImageResize( + ref, + pos.key, + direction, + position + ); + }} + > + {" "} +
{ + if (!isDragging) { + setTimeout(() => { + e.stopPropagation(); + setIsSignPad(true); + setSignKey(pos.key); + setIsStamp(pos.isStamp); + }, 500); } - bounds="parent" + }} + > +
{ + e.stopPropagation(); + handleDeleteSign(pos.key); + setIsStamp(false); + }} + style={{ + position: "absolute", + right: 0, + display: "inline-block", + background: themeColor(), + cursor: "pointer", + padding: "0px 10px" + }} + > + x +
+
+ signimg { + setSignKey(pos.key); + setIsSignPad(true); + setIsStamp(pos.isStamp); + }} + src={pos.SignUrl} + style={{ + width: "100%", + height: "100%", + objectFit: "contain" + }} + /> +
+
+
+ ) : ( + <> + { + handleTabDrag(pos.key, e); + }} + onDragStop={handleStop} + size={{ + width: pos.Width ? pos.Width : 150, + height: pos.Height ? pos.Height : 60 + }} + default={{ + x: pos.xPosition, + y: pos.yPosition + }} + > +
{ + if (!isDragging) { + setTimeout(() => { + setIsSignPad(true); + + setSignKey(pos.key); + setIsStamp(pos.isStamp); + }, 500); + } + }} + className="dragElm" style={{ padding: "0px", cursor: "all-scroll", - zIndex: 1, + zIndex: 20, position: "absolute", borderStyle: "dashed", width: "150px", @@ -580,190 +716,50 @@ function RenderPdf({ textAlign: "center", justifyContent: "center", borderWidth: "0.2px", - overflow: "hidden", - userSelect: "none" - }} - size={{ - width: pos.Width ? pos.Width : 151, - height: pos.Height ? pos.Height : 61 - }} - default={{ - x: pos.xPosition, - y: pos.yPosition - }} - onDrag={() => handleTabDrag(pos.key)} - onDragStop={handleStop} - onResize={( - e, - direction, - ref, - delta, - position - ) => { - handleImageResize( - ref, - pos.key, - direction, - position - ); + overflow: "hidden" }} > - {" "}
{ - if (!isDragging) { - setTimeout(() => { - e.stopPropagation(); - setIsSignPad(true); - setSignKey(pos.key); - setIsStamp(pos.isStamp); - }, 500); - } + e.stopPropagation(); + e.preventDefault(); + + handleDeleteSign(pos.key); + setIsStamp(false); + }} + onClick={(e) => { + e.stopPropagation(); // Prevent further event propagation }} - > -
{ - e.stopPropagation(); - handleDeleteSign(pos.key); - setIsStamp(false); - }} - style={{ - position: "absolute", - right: 0, - display: "inline-block", - background: themeColor(), - cursor: "pointer", - padding: "0px 10px" - }} - > - x -
-
- signimg { - setSignKey(pos.key); - setIsSignPad(true); - setIsStamp(pos.isStamp); - }} - src={pos.SignUrl} - style={{ - width: "100%", - height: "100%", - objectFit: "contain" - }} - /> -
-
- - ) : ( - <> - { - handleTabDrag(pos.key, e); - }} - onDragStop={handleStop} - size={{ - width: pos.Width ? pos.Width : 150, - height: pos.Height ? pos.Height : 60 - }} - default={{ - x: pos.xPosition, - y: pos.yPosition + right: 0, + display: "inline-block", + background: themeColor(), + cursor: "pointer", + padding: "0px 10px" }} > -
{ - if (!isDragging) { - setTimeout(() => { - setIsSignPad(true); - - setSignKey(pos.key); - setIsStamp(pos.isStamp); - }, 500); - } - }} - className="dragElm" - style={{ - padding: "0px", - cursor: "all-scroll", - zIndex: 20, - position: "absolute", - borderStyle: "dashed", - width: "150px", - height: "60px", - borderColor: themeColor(), - background: "#daebe0", - textAlign: "center", - justifyContent: "center", - borderWidth: "0.2px", - overflow: "hidden" - }} - > -
{ - e.stopPropagation(); - e.preventDefault(); - - handleDeleteSign(pos.key); - setIsStamp(false); - }} - onClick={(e) => { - e.stopPropagation(); // Prevent further event propagation - }} - style={{ - position: "absolute", - right: 0, - display: "inline-block", - background: themeColor(), - cursor: "pointer", - padding: "0px 10px" - }} - > - x -
-
- {pos.isStamp ? "stamp" : "signature"} -
-
-
- - ); - })} - - ); - }))} + x +
+
+ {pos.isStamp ? "stamp" : "signature"} +
+
+
+ + ); + })} +
+ ); + }))} {/* this component for render pdf document is in middle of the component */}
{Array.from(new Array(numPages), (el, index) => ( @@ -984,289 +980,89 @@ function RenderPdf({ ); }) : pdfRequest - ? signerPos.map((data, key) => { - return ( - - {checkSignedSignes(data)} - - ); - }) - : placeholder - ? signerPos.map((data, ind) => { - return ( - - {data.placeHolder.map((placeData, index) => { - return ( - - {placeData.pageNumber === pageNumber && - placeData.pos.map((pos) => { - return ( - - handleTabDrag( - pos.key, - data.signerObjId - ) - } - size={{ - width: pos.Width ? pos.Width : 150, - height: pos.Height ? pos.Height : 60 - }} - lockAspectRatio={ - pos.Width - ? pos.Width / pos.Height - : 2.5 - } - resizeHandleStyles={{ - bottom: { display: "none" }, - right: { display: "none" }, - bottomRight: { display: "block" } - }} - onDragStop={(event, dragElement) => - handleStop( - event, - dragElement, - data.signerObjId, - pos.key - ) - } - default={{ - x: pos.xPosition, - y: pos.yPosition - }} - onResize={( - e, - direction, - ref, - delta, - position - ) => { - handleImageResize( - ref, - pos.key, - data.signerObjId, - position - ); - }} - > -
{ - e.stopPropagation(); - handleDeleteSign( - pos.key, - data.signerObjId - ); - }} - style={{ - position: "absolute", - right: 0, - display: "inline-block", - background: themeColor(), - cursor: "pointer", - padding: "0px 10px", - zIndex: 10 - }} - > - x -
-
- {pos.isStamp - ? "stamp" - : "signature"} -
-
- ); - })} -
- ); - })} -
- ); - }) - : xyPostion.map((data, ind) => { - return ( - - {data.pageNumber === pageNumber && - data.pos.map((pos) => { - return pos && pos.SignUrl ? ( - handleTabDrag(pos.key)} - size={{ - width: pos.Width ? pos.Width : 150, - height: pos.Height ? pos.Height : 60 - }} - onDragStop={handleStop} - default={{ - x: pos.xPosition, - y: pos.yPosition - }} - onResize={( - e, - direction, - ref, - delta, - position - ) => { - handleImageResize( - ref, - pos.key, - direction, - position - ); - }} - onClick={() => { - if (!isDragging) { - setIsSignPad(true); - setSignKey(pos.key); - setIsStamp(pos.isStamp); - } - }} - > -
{ - e.stopPropagation(); - handleDeleteSign(pos.key); - setIsStamp(false); - }} - style={{ - position: "absolute", - right: 0, - display: "inline-block", - background: themeColor(), - cursor: "pointer", - padding: "0px 10px" - }} - > - x -
-
- signimg { - setSignKey(pos.key); - setIsSignPad(true); - setIsStamp(pos.isStamp); - }} - src={pos.SignUrl} - style={{ - width: "100%", - height: "100%", - objectFit: "contain" - }} - /> -
-
- ) : ( - handleTabDrag(pos.key, e)} - size={{ - width: pos.Width ? pos.Width : 150, - height: pos.Height ? pos.Height : 60 - }} - onDragStop={handleStop} - default={{ - x: pos.xPosition, - y: pos.yPosition - }} - > -
{ - if (!isDragging) { - e.stopPropagation(); - setIsSignPad(true); - setSignKey(pos.key); - setIsStamp(pos.isStamp); - } - }} + ? signerPos.map((data, key) => { + return ( + + {checkSignedSignes(data)} + + ); + }) + : placeholder + ? signerPos.map((data, ind) => { + return ( + + {data.placeHolder.map((placeData, index) => { + return ( + + {placeData.pageNumber === pageNumber && + placeData.pos.map((pos) => { + return ( + + handleTabDrag(pos.key, data.signerObjId) + } + size={{ + width: pos.Width ? pos.Width : 150, + height: pos.Height ? pos.Height : 60 + }} + lockAspectRatio={ + pos.Width ? pos.Width / pos.Height : 2.5 + } + resizeHandleStyles={{ + bottom: { display: "none" }, + right: { display: "none" }, + bottomRight: { display: "block" } + }} + onDragStop={(event, dragElement) => + handleStop( + event, + dragElement, + data.signerObjId, + pos.key + ) + } + default={{ + x: pos.xPosition, + y: pos.yPosition + }} + onResize={( + e, + direction, + ref, + delta, + position + ) => { + handleImageResize( + ref, + pos.key, + data.signerObjId, + position + ); + }} >
{ e.stopPropagation(); - handleDeleteSign(pos.key); - setIsStamp(false); + handleDeleteSign( + pos.key, + data.signerObjId + ); }} style={{ position: "absolute", @@ -1274,7 +1070,8 @@ function RenderPdf({ display: "inline-block", background: themeColor(), cursor: "pointer", - padding: "0px 10px" + padding: "0px 10px", + zIndex: 10 }} > x @@ -1282,20 +1079,212 @@ function RenderPdf({
{pos.isStamp ? "stamp" : "signature"}
-
-
- ); - })} -
- ); - }))} + + ); + })} +
+ ); + })} + + ); + }) + : xyPostion.map((data, ind) => { + return ( + + {data.pageNumber === pageNumber && + data.pos.map((pos) => { + return pos && pos.SignUrl ? ( + handleTabDrag(pos.key)} + size={{ + width: pos.Width ? pos.Width : 150, + height: pos.Height ? pos.Height : 60 + }} + onDragStop={handleStop} + default={{ + x: pos.xPosition, + y: pos.yPosition + }} + onResize={( + e, + direction, + ref, + delta, + position + ) => { + handleImageResize( + ref, + pos.key, + direction, + position + ); + }} + onClick={() => { + if (!isDragging) { + setIsSignPad(true); + setSignKey(pos.key); + setIsStamp(pos.isStamp); + } + }} + > +
{ + e.stopPropagation(); + handleDeleteSign(pos.key); + setIsStamp(false); + }} + style={{ + position: "absolute", + right: 0, + display: "inline-block", + background: themeColor(), + cursor: "pointer", + padding: "0px 10px" + }} + > + x +
+
+ signimg { + setSignKey(pos.key); + setIsSignPad(true); + setIsStamp(pos.isStamp); + }} + src={pos.SignUrl} + style={{ + width: "100%", + height: "100%", + objectFit: "contain" + }} + /> +
+
+ ) : ( + handleTabDrag(pos.key, e)} + size={{ + width: pos.Width ? pos.Width : 150, + height: pos.Height ? pos.Height : 60 + }} + onDragStop={handleStop} + default={{ + x: pos.xPosition, + y: pos.yPosition + }} + > +
{ + if (!isDragging) { + e.stopPropagation(); + setIsSignPad(true); + setSignKey(pos.key); + setIsStamp(pos.isStamp); + } + }} + style={{ + cursor: "all-scroll", + zIndex: 10, + position: "absolute", + borderStyle: "dashed", + width: "150px", + height: "60px", + borderColor: themeColor(), + background: "#daebe0", + textAlign: "center", + justifyContent: "center", + alignItems: "center", + borderWidth: "0.2px" + }} + > +
{ + e.stopPropagation(); + handleDeleteSign(pos.key); + setIsStamp(false); + }} + style={{ + position: "absolute", + right: 0, + display: "inline-block", + background: themeColor(), + cursor: "pointer", + padding: "0px 10px" + }} + > + x +
+
+ {pos.isStamp ? "stamp" : "signature"} +
+
+
+ ); + })} +
+ ); + }))} {/* this component for render pdf document is in middle of the component */} {Array.from(new Array(numPages), (el, index) => ( @@ -1337,4 +1326,4 @@ function RenderPdf({ ); } -export default RenderPdf; +export default RenderPdf; \ No newline at end of file From a14454227c26f512cb24712bf5d3585d2d1af759 Mon Sep 17 00:00:00 2001 From: Raktima <110812506+raktima-opensignlabs@users.noreply.github.com> Date: Tue, 14 Nov 2023 20:31:19 +0530 Subject: [PATCH 6/8] fix Completion certificate issues (#184) --- .../src/Component/Certificate/Certificate.js | 82 +++---- .../src/Component/SignYourselfPdf.js | 14 +- .../src/Component/component/header.js | 203 ++++++++---------- .../src/assests/open-sign-logo.png | Bin 0 -> 88554 bytes 4 files changed, 125 insertions(+), 174 deletions(-) create mode 100644 microfrontends/SignDocuments/src/assests/open-sign-logo.png diff --git a/microfrontends/SignDocuments/src/Component/Certificate/Certificate.js b/microfrontends/SignDocuments/src/Component/Certificate/Certificate.js index 5df07d5f5..37eee4fc3 100644 --- a/microfrontends/SignDocuments/src/Component/Certificate/Certificate.js +++ b/microfrontends/SignDocuments/src/Component/Certificate/Certificate.js @@ -1,7 +1,15 @@ import React, { useEffect, useState } from "react"; import "./certificate.css"; +import opensignLogo from "../../assests/open-sign-logo.png"; -import { Page, Text, View, Document, StyleSheet } from "@react-pdf/renderer"; +import { + Page, + Text, + View, + Document, + StyleSheet, + Image +} from "@react-pdf/renderer"; function Certificate({ pdfData }) { const [isMultiSigners, setIsMultiSigners] = useState(); @@ -49,70 +57,34 @@ function Certificate({ pdfData }) { fontSize: "11px", marginBottom: "10px", color: "gray" + }, + image: { + width: "71px", + height: "17px" } }); const generatedDate = () => { const newDate = new Date(); - const localExpireDate = newDate.toLocaleDateString("en-US", { - day: "numeric", - month: "long", - year: "numeric" - }); - - var currentOffset = newDate.getTimezoneOffset(); - - var ISTOffset = 330; // IST offset UTC +5:30 - - var ISTTime = new Date( - newDate.getTime() + (ISTOffset + currentOffset) * 60000 - ); - - // ISTTime now represents the time in IST coordinates - - var hoursIST = ISTTime.getHours(); - var minutesIST = ISTTime.getMinutes(); + const utcTime = newDate.toUTCString(); return ( - Generated On {localExpireDate} {hoursIST}:{minutesIST} IST + Generated On {utcTime} ); }; const changeCompletedDate = () => { const completedOn = pdfData[0].updatedAt; const newDate = new Date(completedOn); - const localExpireDate = newDate.toLocaleDateString("en-US", { - day: "numeric", - month: "long", - year: "numeric" - }); + const utcTime = newDate.toUTCString(); - var currentOffset = newDate.getTimezoneOffset(); - - var ISTOffset = 330; // IST offset UTC +5:30 - - var ISTTime = new Date( - newDate.getTime() + (ISTOffset + currentOffset) * 60000 - ); - - // ISTTime now represents the time in IST coordinates - - var hoursIST = ISTTime.getHours(); - var minutesIST = ISTTime.getMinutes(); - - return ( - - {localExpireDate} {hoursIST}:{minutesIST} IST - - ); + return {utcTime}; }; const signerName = (data) => { @@ -143,7 +115,19 @@ function Certificate({ pdfData }) { {/** Page defines a single page of content. */} - {generatedDate()} + + + {generatedDate()} + + Organization :   - __ + + {pdfData[0].ExtUserPtr.Company} + Completed on :  {changeCompletedDate()} diff --git a/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js b/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js index d4cb37df9..6591667bc 100644 --- a/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js +++ b/microfrontends/SignDocuments/src/Component/SignYourselfPdf.js @@ -627,8 +627,8 @@ function SignYourSelf() { const bottomY = xyPosData.isDrag ? xyPosData.yBottom * scale - height : xyPosData.firstYPos - ? xyPosData.yBottom * scale - height + xyPosData.firstYPos - : xyPosData.yBottom * scale - height; + ? xyPosData.yBottom * scale - height + xyPosData.firstYPos + : xyPosData.yBottom * scale - height; singleSign = { pdfFile: pdfBase64Url, @@ -664,15 +664,7 @@ function SignYourSelf() { // console.log("json ", json); setPdfUrl(json.result.data); if (json.result.data) { - const docStatus = { - isCompleted: true - }; - - setDocumentStatus(docStatus); - const loadObj = { - isLoad: false - }; - setIsLoading(loadObj); + getDocumentDetails(); } }) .catch((err) => { diff --git a/microfrontends/SignDocuments/src/Component/component/header.js b/microfrontends/SignDocuments/src/Component/component/header.js index 4d971cfb4..d7f4724ed 100644 --- a/microfrontends/SignDocuments/src/Component/component/header.js +++ b/microfrontends/SignDocuments/src/Component/component/header.js @@ -82,13 +82,13 @@ function Header({ //handle download signed pdf const handleDownloadPdf = () => { const pdfName = pdfDetails[0] && pdfDetails[0].Name; - saveAs(pdfUrl, `${sanitizeFileName(pdfName)}_signed_by_OpenSign™.pdf`); + saveAs(pdfUrl, `${sanitizeFileName(pdfName)}_signed_by_OpenSign™.pdf`); }; - + const sanitizeFileName = (pdfName) => { // Replace spaces with underscore - return pdfName.replace(/ /g, '_'); - } + return pdfName.replace(/ /g, "_"); + }; //certificate generate and download component in mobile view const CertificateDropDown = () => { //after generate download certifcate pdf @@ -109,6 +109,7 @@ function Header({ window.URL.revokeObjectURL(url); } }; + return ( e.preventDefault()} @@ -118,7 +119,21 @@ function Header({ {({ blob, url, loading, error }) => ( <> {loading ? ( - "Loading document..." +
+ + Certificate +
) : (
); }; + const CertificateComponent = () => { + return ( + } + fileName={`completion certificate-${ + pdfDetails[0] && pdfDetails[0].Name + }.pdf`} + > + {({ blob, url, loading, error }) => + loading ? ( + + ) : ( + + ) + } + + ); + }; return (
@@ -255,10 +327,12 @@ function Header({ - ) :isSignYourself && ( - - - + ) : ( + isSignYourself && ( + + + + ) )} {pdfDetails[0] && pdfDetails.length > 0 && ( - } - fileName={`completion certificate-${ - pdfDetails[0] && pdfDetails[0].Name - }.pdf`} - > - {({ blob, url, loading, error }) => - loading ? ( - "Loading document..." - ) : ( - - ) - } - + )} - ) - } - - )} + {isCompleted.isCertificate && } - ) - } - +

" @@ -46,14 +62,60 @@ async function sendmail(req) { const from = req.params.from || ''; const messageParams = { - from: from + ' <' + process.env.MAILGUN_SENDER + '>', + from: + from + ' <' + process.env.SMTP_ENABLE + ? process.env.SMTP_USER_EMAIL + : process.env.MAILGUN_SENDER + '>', to: req.params.recipient, subject: req.params.subject, text: req.params.text || 'mail', html: req.params.html || '', - attachment: file, + attachments: process.env.SMTP_ENABLE ? [file] : undefined, + attachment: process.env.SMTP_ENABLE ? undefined : file, }; + if (transporterSMTP) { + const res = await transporterSMTP.sendMail(messageParams); + + console.log('Res ', res); + if (!res.err) { + return { + status: 'success', + }; + } + } else { + const res = await mailgunClient.messages.create(mailgunDomain, messageParams); + console.log('Res ', res); + if (res.status === 200) { + return { + status: 'success', + }; + } + } + } + } else { + const from = req.params.from || ''; + const messageParams = { + from: + from + ' <' + process.env.SMTP_ENABLE + ? process.env.SMTP_USER_EMAIL + : process.env.MAILGUN_SENDER + '>', + to: req.params.recipient, + subject: req.params.subject, + text: req.params.text || 'mail', + html: req.params.html || '', + }; + + if (transporterSMTP) { + const res = await transporterSMTP.sendMail(messageParams); + + console.log('Res ', res); + if (!res.err) { + return { + status: 'success', + }; + } + } else { const res = await mailgunClient.messages.create(mailgunDomain, messageParams); console.log('Res ', res); if (res.status === 200) { @@ -62,23 +124,6 @@ async function sendmail(req) { }; } } - } else { - const from = req.params.from || ''; - const messageParams = { - from: from + ' <' + process.env.MAILGUN_SENDER + '>', - to: req.params.recipient, - subject: req.params.subject, - text: req.params.text || 'mail', - html: req.params.html || '', - }; - - const res = await mailgunClient.messages.create(mailgunDomain, messageParams); - console.log('Res ', res); - if (res.status === 200) { - return { - status: 'success', - }; - } } } catch (err) { console.log('err ', err); diff --git a/apps/OpenSignServer/index.js b/apps/OpenSignServer/index.js index 814d9cf58..13814d3cc 100644 --- a/apps/OpenSignServer/index.js +++ b/apps/OpenSignServer/index.js @@ -17,10 +17,11 @@ import S3Adapter from 'parse-server-s3-adapter'; import FSFilesAdapter from 'parse-server-fs-adapter'; import AWS from 'aws-sdk'; import { app as customRoute } from './cloud/customRoute/customApp.js'; +import { createTransport } from 'nodemailer'; const spacesEndpoint = new AWS.Endpoint(process.env.DO_ENDPOINT); // console.log("configuration ", configuration); -if (process.env.USE_LOCAL !== "TRUE") { +if (process.env.USE_LOCAL !== 'TRUE') { const s3Options = { bucket: process.env.DO_SPACE, // globalConfig.S3FilesAdapter.bucket, baseUrl: process.env.DO_BASEURL, @@ -36,18 +37,31 @@ if (process.env.USE_LOCAL !== "TRUE") { var fsAdapter = new S3Adapter(s3Options); } else { var fsAdapter = new FSFilesAdapter({ - "filesSubDirectory": "files" // optional, defaults to ./files + filesSubDirectory: 'files', // optional, defaults to ./files }); } +let transporterMail; let mailgunClient; let mailgunDomain; -if (process.env.MAILGUN_API_KEY) { + +if (process.env.SMTP_ENABLE) { + transporterMail = createTransport({ + host: process.env.SMTP_HOST, + port: process.env.SMTP_PORT || 465, + secure: process.env.SMTP_SECURE || true, + auth: { + user: process.env.SMTP_USER_EMAIL, + pass: process.env.SMTP_PASS, + }, + }); +} else if (process.env.MAILGUN_API_KEY) { const mailgun = new Mailgun(formData); mailgunClient = mailgun.client({ username: 'api', key: process.env.MAILGUN_API_KEY, }); + mailgunDomain = process.env.MAILGUN_DOMAIN; } @@ -64,36 +78,39 @@ export const config = { // Your apps name. This will appear in the subject and body of the emails that are sent. appName: 'Open Sign', allowClientClassCreation: false, - emailAdapter: process.env.MAILGUN_API_KEY - ? { - module: 'parse-server-api-mail-adapter', - options: { - // The email address from which emails are sent. - sender: process.env.MAILGUN_SENDER, - // The email templates. - templates: { - // The template used by Parse Server to send an email for password - // reset; this is a reserved template name. - passwordResetEmail: { - subjectPath: './files/password_reset_email_subject.txt', - textPath: './files/password_reset_email.txt', - htmlPath: './files/password_reset_email.html', + emailAdapter: + process.env.SMTP_ENABLE || process.env.MAILGUN_API_KEY + ? { + module: 'parse-server-api-mail-adapter', + options: { + // The email address from which emails are sent. + sender: process.env.SMTP_ENABLE ? process.env.SMTP_USER_EMAIL : process.env.MAILGUN_SENDER, + // The email templates. + templates: { + // The template used by Parse Server to send an email for password + // reset; this is a reserved template name. + passwordResetEmail: { + subjectPath: './files/password_reset_email_subject.txt', + textPath: './files/password_reset_email.txt', + htmlPath: './files/password_reset_email.html', + }, + // The template used by Parse Server to send an email for email + // address verification; this is a reserved template name. + verificationEmail: { + subjectPath: './files/verification_email_subject.txt', + textPath: './files/verification_email.txt', + htmlPath: './files/verification_email.html', + }, }, - // The template used by Parse Server to send an email for email - // address verification; this is a reserved template name. - verificationEmail: { - subjectPath: './files/verification_email_subject.txt', - textPath: './files/verification_email.txt', - htmlPath: './files/verification_email.html', + apiCallback: async ({ payload, locale }) => { + if (mailgunClient) { + const mailgunPayload = ApiPayloadConverter.mailgun(payload); + await mailgunClient.messages.create(mailgunDomain, mailgunPayload); + } else if (transporterMail) await transporterMail.sendMail(payload); }, }, - apiCallback: async ({ payload, locale }) => { - const mailgunPayload = ApiPayloadConverter.mailgun(payload); - await mailgunClient.messages.create(mailgunDomain, mailgunPayload); - }, - }, - } - : null, + } + : null, filesAdapter: fsAdapter, auth: { google: { diff --git a/apps/OpenSignServer/package-lock.json b/apps/OpenSignServer/package-lock.json index 6b692e824..f7626012e 100644 --- a/apps/OpenSignServer/package-lock.json +++ b/apps/OpenSignServer/package-lock.json @@ -18,16 +18,18 @@ "express-sse": "^0.5.3", "form-data": "^4.0.0", "jsonschema": "^1.4.1", - "mailgun.js": "^9.0.1", + "mailgun.js": "^9.3.0", "mongoose": "^7.2.1", "multer": "^1.4.5-lts.1", "multer-s3": "^2.10.0", "node-forge": "^1.3.1", "node-signpdf": "^1.5.1", + "nodemailer": "^6.9.7", "openai": "^4.8.0", "parse": "4.1.0", "parse-server": "6.3.1", "parse-server-api-mail-adapter": "^3.0.0", + "parse-server-fs-adapter": "1.0.1", "parse-server-s3-adapter": "^1.2.0", "pdf-lib": "^1.16.0", "pdfkit": "^0.13.0", @@ -6016,9 +6018,9 @@ } }, "node_modules/mailgun.js": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/mailgun.js/-/mailgun.js-9.0.1.tgz", - "integrity": "sha512-bVZ1zGh5UfQcChqIwIAil99hzoTeB3aHqAUbqmIBLMLcKfx+FF2qvhbc00WtwrFhe5dBQqQw6zPj0QBlqV4nXg==", + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/mailgun.js/-/mailgun.js-9.3.0.tgz", + "integrity": "sha512-iRqCglCdi+Q5anFpeRKHiytT/i34E14p/WtTE57VSeq5bATK+zQ8UnpFgPRaqGGTJqyGjqcO9m5YDRRB4/qirw==", "dependencies": { "axios": "^1.3.3", "base-64": "^1.0.0", @@ -6799,6 +6801,14 @@ "node-forge": "^1.2.1" } }, + "node_modules/nodemailer": { + "version": "6.9.7", + "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.7.tgz", + "integrity": "sha512-rUtR77ksqex/eZRLmQ21LKVH5nAAsVicAtAYudK7JgwenEDZ0UIQ1adUGqErz7sMkWYxWTTU1aeP2Jga6WQyJw==", + "engines": { + "node": ">=6.0.0" + } + }, "node_modules/nodemon": { "version": "2.0.22", "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.22.tgz", @@ -7403,6 +7413,12 @@ "node": ">=12" } }, + "node_modules/parse-server-fs-adapter": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parse-server-fs-adapter/-/parse-server-fs-adapter-1.0.1.tgz", + "integrity": "sha512-5IRKAT2QkzHrYrBESY4E8jsV1sl+XVBTKGyUvBPgBR2QzsTTqiyU/lFZD8PAJavA+TH1BLyLTUMZbhZhswNVbQ==", + "deprecated": "use @parse/fs-files-adapter" + }, "node_modules/parse-server-s3-adapter": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/parse-server-s3-adapter/-/parse-server-s3-adapter-1.2.0.tgz", diff --git a/apps/OpenSignServer/package.json b/apps/OpenSignServer/package.json index 50292ad43..5049e7188 100644 --- a/apps/OpenSignServer/package.json +++ b/apps/OpenSignServer/package.json @@ -27,18 +27,19 @@ "express-sse": "^0.5.3", "form-data": "^4.0.0", "jsonschema": "^1.4.1", - "mailgun.js": "^9.0.1", + "mailgun.js": "^9.3.0", "mongoose": "^7.2.1", "multer": "^1.4.5-lts.1", "multer-s3": "^2.10.0", "node-forge": "^1.3.1", "node-signpdf": "^1.5.1", + "nodemailer": "^6.9.7", "openai": "^4.8.0", "parse": "4.1.0", "parse-server": "6.3.1", "parse-server-api-mail-adapter": "^3.0.0", - "parse-server-s3-adapter": "^1.2.0", "parse-server-fs-adapter": "1.0.1", + "parse-server-s3-adapter": "^1.2.0", "pdf-lib": "^1.16.0", "pdfkit": "^0.13.0", "razorpay": "^2.8.6", From 0a365509079c5e470a0d00003684ed33c8bf0fc3 Mon Sep 17 00:00:00 2001 From: Amol Date: Wed, 15 Nov 2023 02:21:26 +0530 Subject: [PATCH 8/8] Update README.md --- README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fe1f2b8e6..7a4d986c7 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ -

OpenSign™

- -
+

+

-The free and open source alternative to DocuSign +[The free and open source alternative to DocuSign](https://www.opensignlabs.com) [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/opensignlabs/opensign.svg)](http://isitmaintained.com/project/opensignlabs/opensign "Average time to resolve an issue") [![All Contributors](https://img.shields.io/github/all-contributors/opensignlabs/opensign?color=ee8449&style=flat-square)](#contributors) @@ -23,7 +22,7 @@ The free and open source alternative to DocuSign LinkedIn -## An open-source document e-signing solution +## The open-source document e-signing solution ---