From 38808c26c2dff9df9ad1ef6d7e551be39d9b5f4b Mon Sep 17 00:00:00 2001 From: Rinat Arsaev <11846445+KrickRay@users.noreply.github.com> Date: Thu, 28 Jul 2022 13:32:23 +0300 Subject: [PATCH 1/9] Update damsel (#118) --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index eb88ead2..a726e02f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,7 +29,7 @@ "@s-libs/ng-core": "14.0.0", "@s-libs/rxjs-core": "14.0.0", "@vality/deanonimus-proto": "1.0.1-c9a6cae.0", - "@vality/domain-proto": "1.0.1-9362c08.0", + "@vality/domain-proto": "1.0.1-09e7a75.0", "@vality/dominant-cache-proto": "1.0.1-5b29d81.0", "@vality/file-storage-proto": "1.0.1-447212b.0", "@vality/fistful-proto": "1.0.1-ea0fe7a.0", @@ -5470,9 +5470,9 @@ "integrity": "sha512-GjD4N6ZXyuYaGXv4od+lcCGKfIJFi640I6wJ3+O1eA9VrUI4Ro+Ljpu+TLjckMQ6nS1DkXuu+06Dk7Hr5nK1og==" }, "node_modules/@vality/domain-proto": { - "version": "1.0.1-9362c08.0", - "resolved": "https://registry.npmjs.org/@vality/domain-proto/-/domain-proto-1.0.1-9362c08.0.tgz", - "integrity": "sha512-B7JksaSacuNVNS/xyXa8IciOwIkh99vvME34482q1voMu4irVGRwCxovvpWcQKxfmEXoBvV5FTn1mkNNDiIWcA==" + "version": "1.0.1-09e7a75.0", + "resolved": "https://registry.npmjs.org/@vality/domain-proto/-/domain-proto-1.0.1-09e7a75.0.tgz", + "integrity": "sha512-y7J2P98eehI7upxTPgg2vmxoBMV7QcgKstYiJBjJmt+Ra1XKhCeoGbRVOINmJqhHAbqGBpuqOAOLI1f7UZ9jLA==" }, "node_modules/@vality/dominant-cache-proto": { "version": "1.0.1-5b29d81.0", @@ -25739,9 +25739,9 @@ "integrity": "sha512-GjD4N6ZXyuYaGXv4od+lcCGKfIJFi640I6wJ3+O1eA9VrUI4Ro+Ljpu+TLjckMQ6nS1DkXuu+06Dk7Hr5nK1og==" }, "@vality/domain-proto": { - "version": "1.0.1-9362c08.0", - "resolved": "https://registry.npmjs.org/@vality/domain-proto/-/domain-proto-1.0.1-9362c08.0.tgz", - "integrity": "sha512-B7JksaSacuNVNS/xyXa8IciOwIkh99vvME34482q1voMu4irVGRwCxovvpWcQKxfmEXoBvV5FTn1mkNNDiIWcA==" + "version": "1.0.1-09e7a75.0", + "resolved": "https://registry.npmjs.org/@vality/domain-proto/-/domain-proto-1.0.1-09e7a75.0.tgz", + "integrity": "sha512-y7J2P98eehI7upxTPgg2vmxoBMV7QcgKstYiJBjJmt+Ra1XKhCeoGbRVOINmJqhHAbqGBpuqOAOLI1f7UZ9jLA==" }, "@vality/dominant-cache-proto": { "version": "1.0.1-5b29d81.0", diff --git a/package.json b/package.json index 3c341346..64524404 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "@s-libs/ng-core": "14.0.0", "@s-libs/rxjs-core": "14.0.0", "@vality/deanonimus-proto": "1.0.1-c9a6cae.0", - "@vality/domain-proto": "1.0.1-9362c08.0", + "@vality/domain-proto": "1.0.1-09e7a75.0", "@vality/dominant-cache-proto": "1.0.1-5b29d81.0", "@vality/file-storage-proto": "1.0.1-447212b.0", "@vality/fistful-proto": "1.0.1-ea0fe7a.0", From 3b7eb37f1c4194c3280acb580b2fb315d727d105 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 28 Jul 2022 15:25:15 +0300 Subject: [PATCH 2/9] Update dependency ts-node to v10 (#112) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package-lock.json | 180 ++++++++++++++++++++++++++++++++++++++++++---- package.json | 2 +- 2 files changed, 169 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index a726e02f..86ec52eb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -99,7 +99,7 @@ "prettier": "2.7.1", "prettier-plugin-organize-attributes": "0.0.5", "ts-mockito": "2.6.1", - "ts-node": "8.8.2", + "ts-node": "10.9.1", "typescript": "4.7.4" } }, @@ -3028,6 +3028,28 @@ "node": ">=0.1.90" } }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, "node_modules/@csstools/postcss-color-function": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@csstools/postcss-color-function/-/postcss-color-function-1.1.0.tgz", @@ -4469,6 +4491,30 @@ "node": ">= 6" } }, + "node_modules/@tsconfig/node10": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", + "dev": true + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", + "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", + "dev": true + }, "node_modules/@types/body-parser": { "version": "1.19.2", "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz", @@ -6544,6 +6590,15 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/adjust-sourcemap-loader": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/adjust-sourcemap-loader/-/adjust-sourcemap-loader-4.0.0.tgz", @@ -9394,6 +9449,12 @@ "sha.js": "^2.4.8" } }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, "node_modules/critters": { "version": "0.0.16", "resolved": "https://registry.npmjs.org/critters/-/critters-0.0.16.tgz", @@ -20293,28 +20354,46 @@ } }, "node_modules/ts-node": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.8.2.tgz", - "integrity": "sha512-duVj6BpSpUpD/oM4MfhO98ozgkp3Gt9qIp3jGxwU2DFvl/3IRaEAvbLa8G60uS7C77457e/m5TMowjedeRxI1Q==", + "version": "10.9.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", + "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", "dev": true, "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", "arg": "^4.1.0", + "create-require": "^1.1.0", "diff": "^4.0.1", "make-error": "^1.1.1", - "source-map-support": "^0.5.6", + "v8-compile-cache-lib": "^3.0.1", "yn": "3.1.1" }, "bin": { "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", "ts-node-script": "dist/bin-script.js", "ts-node-transpile-only": "dist/bin-transpile.js", "ts-script": "dist/bin-script-deprecated.js" }, - "engines": { - "node": ">=6.0.0" - }, "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } } }, "node_modules/tsconfig-paths": { @@ -20695,6 +20774,12 @@ "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==" }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true + }, "node_modules/validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", @@ -23965,6 +24050,27 @@ "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==", "dev": true }, + "@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "dependencies": { + "@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + } + } + }, "@csstools/postcss-color-function": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@csstools/postcss-color-function/-/postcss-color-function-1.1.0.tgz", @@ -25023,6 +25129,30 @@ "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", "dev": true }, + "@tsconfig/node10": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", + "dev": true + }, + "@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true + }, + "@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true + }, + "@tsconfig/node16": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", + "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", + "dev": true + }, "@types/body-parser": { "version": "1.19.2", "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz", @@ -26653,6 +26783,12 @@ "dev": true, "requires": {} }, + "acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true + }, "adjust-sourcemap-loader": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/adjust-sourcemap-loader/-/adjust-sourcemap-loader-4.0.0.tgz", @@ -28992,6 +29128,12 @@ "sha.js": "^2.4.8" } }, + "create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, "critters": { "version": "0.0.16", "resolved": "https://registry.npmjs.org/critters/-/critters-0.0.16.tgz", @@ -37182,15 +37324,23 @@ } }, "ts-node": { - "version": "8.8.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.8.2.tgz", - "integrity": "sha512-duVj6BpSpUpD/oM4MfhO98ozgkp3Gt9qIp3jGxwU2DFvl/3IRaEAvbLa8G60uS7C77457e/m5TMowjedeRxI1Q==", + "version": "10.9.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", + "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", "dev": true, "requires": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", "arg": "^4.1.0", + "create-require": "^1.1.0", "diff": "^4.0.1", "make-error": "^1.1.1", - "source-map-support": "^0.5.6", + "v8-compile-cache-lib": "^3.0.1", "yn": "3.1.1" } }, @@ -37479,6 +37629,12 @@ "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==" }, + "v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true + }, "validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", diff --git a/package.json b/package.json index 64524404..8337a257 100644 --- a/package.json +++ b/package.json @@ -107,7 +107,7 @@ "prettier": "2.7.1", "prettier-plugin-organize-attributes": "0.0.5", "ts-mockito": "2.6.1", - "ts-node": "8.8.2", + "ts-node": "10.9.1", "typescript": "4.7.4" } } From 8fa78ebef36644fad2a2e1c5cb7645d968bd8109 Mon Sep 17 00:00:00 2001 From: Rinat Arsaev <11846445+KrickRay@users.noreply.github.com> Date: Mon, 1 Aug 2022 19:21:48 +0300 Subject: [PATCH 3/9] Select shared library (#119) --- .eslintrc.js | 2 +- .github/workflows/pr.yaml | 21 +- Dockerfile | 2 +- README.md | 7 + angular.json | 36 +- package-lock.json | 937 ++++++++++++++++++ package.json | 19 +- projects/ng-core/.browserslistrc | 16 + projects/ng-core/.prettierignore | 1 + projects/ng-core/README.md | 25 + projects/ng-core/karma.conf.js | 41 + projects/ng-core/ng-package.json | 7 + projects/ng-core/package.json | 11 + .../components/actions/actions.component.html | 0 .../components/actions/actions.component.scss | 0 .../components/actions/actions.component.ts | 0 .../lib}/components/actions/actions.module.ts | 0 .../src/lib/components/actions/index.ts | 2 + .../base-dialog/base-dialog.component.html | 0 .../base-dialog/base-dialog.component.scss | 0 .../base-dialog/base-dialog.component.ts | 2 +- .../base-dialog/base-dialog.module.ts | 4 +- .../base-dialog-actions.component.html | 0 .../base-dialog-actions.component.ts | 0 .../src/lib/components/base-dialog/index.ts | 8 + .../services/base-dialog.service.ts | 25 +- .../src/lib/components/base-dialog/tokens.ts | 20 + .../types/base-dialog-response-status.ts | 0 .../base-dialog/types/base-dialog-response.ts | 2 +- .../utils/base-dialog-superclass.ts | 3 +- projects/ng-core/src/lib/components/index.ts | 2 + projects/ng-core/src/lib/index.ts | 1 + projects/ng-core/src/public-api.ts | 5 + projects/ng-core/src/test.ts | 29 + projects/ng-core/tsconfig.lib.json | 16 + projects/ng-core/tsconfig.lib.prod.json | 10 + projects/ng-core/tsconfig.spec.json | 10 + src/app/app.module.ts | 3 - src/app/sections/claim/claim.component.ts | 3 +- src/app/sections/claim/claim.module.ts | 3 +- .../add-modification-dialog.component.ts | 7 +- .../change-status-dialog.component.ts | 2 +- ...dification-unit-timeline-item.component.ts | 3 +- .../claim/services/upload-file.service.ts | 3 +- .../party-claims/party-claims.component.ts | 3 +- .../payout-details/payout-details.module.ts | 2 +- .../cancel-payout-dialog.component.ts | 6 +- .../create-payout-dialog.component.ts | 6 +- .../payouts/payouts/payouts.component.ts | 8 +- .../payouts/payouts/payouts.module.ts | 2 +- .../services/payout-actions.service.ts | 3 +- .../repair-by-scenario-dialog.component.ts | 5 +- .../sections/repairing/repairing.component.ts | 3 +- .../sections/repairing/repairing.module.ts | 3 +- ...hange-delegate-ruleset-dialog.component.ts | 3 +- .../change-delegate-ruleset-dialog.module.ts | 3 +- .../change-target-dialog.component.ts | 2 +- .../change-target-dialog.module.ts | 3 +- .../attach-new-ruleset-dialog.component.ts | 2 +- .../party-delegate-rulesets.component.ts | 2 +- .../party-delegate-rulesets.module.ts | 2 +- ...add-party-routing-rule-dialog.component.ts | 3 +- .../add-party-routing-rule-dialog.module.ts | 3 +- ...itialize-routing-rules-dialog.component.ts | 3 +- .../initialize-routing-rules-dialog.module.ts | 3 +- .../party-routing-ruleset.component.ts | 4 +- .../routing-rules-list.component.ts | 4 +- .../add-routing-rule-dialog.component.ts | 3 +- .../add-routing-rule-dialog.module.ts | 2 +- .../add-routing-rule-dialog.service.ts | 3 +- .../routing-ruleset.component.ts | 3 +- .../create-adjustment-dialog.component.ts | 5 +- .../withdrawals/withdrawals.component.ts | 3 +- .../withdrawals/withdrawals.module.ts | 2 +- src/app/tokens.ts | 18 - src/components/actions/index.ts | 1 - src/components/base-dialog/index.ts | 4 - .../confirm-action-dialog.component.ts | 3 +- .../confirm-action-dialog.module.ts | 3 +- tsconfig.json | 4 +- 80 files changed, 1282 insertions(+), 138 deletions(-) create mode 100644 projects/ng-core/.browserslistrc create mode 100644 projects/ng-core/.prettierignore create mode 100644 projects/ng-core/README.md create mode 100644 projects/ng-core/karma.conf.js create mode 100644 projects/ng-core/ng-package.json create mode 100644 projects/ng-core/package.json rename {src => projects/ng-core/src/lib}/components/actions/actions.component.html (100%) rename {src => projects/ng-core/src/lib}/components/actions/actions.component.scss (100%) rename {src => projects/ng-core/src/lib}/components/actions/actions.component.ts (100%) rename {src => projects/ng-core/src/lib}/components/actions/actions.module.ts (100%) create mode 100644 projects/ng-core/src/lib/components/actions/index.ts rename {src => projects/ng-core/src/lib}/components/base-dialog/base-dialog.component.html (100%) rename {src => projects/ng-core/src/lib}/components/base-dialog/base-dialog.component.scss (100%) rename {src => projects/ng-core/src/lib}/components/base-dialog/base-dialog.component.ts (96%) rename {src => projects/ng-core/src/lib}/components/base-dialog/base-dialog.module.ts (92%) rename {src => projects/ng-core/src/lib}/components/base-dialog/components/base-dialog-actions/base-dialog-actions.component.html (100%) rename {src => projects/ng-core/src/lib}/components/base-dialog/components/base-dialog-actions/base-dialog-actions.component.ts (100%) create mode 100644 projects/ng-core/src/lib/components/base-dialog/index.ts rename {src => projects/ng-core/src/lib}/components/base-dialog/services/base-dialog.service.ts (58%) create mode 100644 projects/ng-core/src/lib/components/base-dialog/tokens.ts rename {src => projects/ng-core/src/lib}/components/base-dialog/types/base-dialog-response-status.ts (100%) rename {src => projects/ng-core/src/lib}/components/base-dialog/types/base-dialog-response.ts (65%) rename {src => projects/ng-core/src/lib}/components/base-dialog/utils/base-dialog-superclass.ts (92%) create mode 100644 projects/ng-core/src/lib/components/index.ts create mode 100644 projects/ng-core/src/lib/index.ts create mode 100644 projects/ng-core/src/public-api.ts create mode 100644 projects/ng-core/src/test.ts create mode 100644 projects/ng-core/tsconfig.lib.json create mode 100644 projects/ng-core/tsconfig.lib.prod.json create mode 100644 projects/ng-core/tsconfig.spec.json delete mode 100644 src/components/actions/index.ts delete mode 100644 src/components/base-dialog/index.ts diff --git a/.eslintrc.js b/.eslintrc.js index cc053003..2e7a5136 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -43,7 +43,7 @@ module.exports = { { ...baseTsRules, // TODO: add fixed directories - files: ['**/src/app/core/**/*.ts'], + files: ['**/src/app/core/**/*.ts', '**/projects/**/*.ts'], }, { ...baseTsRules, diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 7da1b8cf..de37fd09 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -9,6 +9,8 @@ jobs: steps: - uses: actions/checkout@v3 - uses: ./.github/actions/init + - name: Building libraries + run: npm run build-libs - name: Cache all uses: actions/cache@v3 id: cache @@ -16,7 +18,7 @@ jobs: path: ./* key: ${{ github.sha }} eslint: - name: ESLint + name: ESLint App runs-on: ubuntu-latest needs: [init] steps: @@ -27,7 +29,20 @@ jobs: path: ./* key: ${{ github.sha }} - name: Check - run: npm run lint-cmd + run: npm run lint + eslint-libs: + name: ESLint Libs + runs-on: ubuntu-latest + needs: [init] + steps: + - name: Cache all + uses: actions/cache@v3 + id: cache + with: + path: ./* + key: ${{ github.sha }} + - name: Check + run: npm run lint-libs prettier: name: Prettier runs-on: ubuntu-latest @@ -53,4 +68,4 @@ jobs: path: ./* key: ${{ github.sha }} - name: Build - run: npm run build + run: npm run build-app diff --git a/Dockerfile b/Dockerfile index 88283828..75cea778 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,3 @@ FROM nginx:1.21 -COPY dist /usr/share/nginx/html +COPY dist/control-center /usr/share/nginx/html COPY nginx.conf /etc/nginx/vhosts.d/control-center.conf \ No newline at end of file diff --git a/README.md b/README.md index 1b122be1..bce3a93f 100644 --- a/README.md +++ b/README.md @@ -40,3 +40,10 @@ npm start ``` 2. Open [localhost:4200](http://localhost:4200/) + +If you want to develop a library, then it's better to start building library separately: + +```sh +npm run dev +npm run dev-libs +``` diff --git a/angular.json b/angular.json index 39274222..84d56c3b 100644 --- a/angular.json +++ b/angular.json @@ -37,9 +37,10 @@ "@vality/payout-manager-proto", "@vality/repairer-proto", "@vality/fistful-proto", - "@vality/file-storage-proto" + "@vality/file-storage-proto", + "@vality/thrift-ts" ], - "outputPath": "dist", + "outputPath": "dist/control-center", "index": "src/index.html", "main": "src/main.ts", "polyfills": "src/polyfills.ts", @@ -143,6 +144,37 @@ } } } + }, + "ng-core": { + "projectType": "library", + "root": "projects/ng-core", + "sourceRoot": "projects/ng-core/src", + "prefix": "v", + "architect": { + "build": { + "builder": "@angular-devkit/build-angular:ng-packagr", + "options": { + "project": "projects/ng-core/ng-package.json" + }, + "configurations": { + "production": { + "tsConfig": "projects/ng-core/tsconfig.lib.prod.json" + }, + "development": { + "tsConfig": "projects/ng-core/tsconfig.lib.json" + } + }, + "defaultConfiguration": "production" + }, + "test": { + "builder": "@angular-devkit/build-angular:karma", + "options": { + "main": "projects/ng-core/src/test.ts", + "tsConfig": "projects/ng-core/tsconfig.spec.json", + "karmaConfig": "projects/ng-core/karma.conf.js" + } + } + } } }, "cli": { diff --git a/package-lock.json b/package-lock.json index 86ec52eb..c16df8d5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -78,6 +78,7 @@ "@types/uuid": "3.4.3", "@typescript-eslint/eslint-plugin": "^5.29.0", "@typescript-eslint/parser": "^5.29.0", + "concurrently": "7.3.0", "dotenv": "16.0.0", "eslint": "8.20.0", "eslint-config-prettier": "8.5.0", @@ -95,6 +96,7 @@ "karma-coverage-istanbul-reporter": "3.0.3", "karma-jasmine": "5.1.0", "karma-jasmine-html-reporter": "2.0.0", + "ng-packagr": "14.1.0", "ngx-build-plus": "14.0.0", "prettier": "2.7.1", "prettier-plugin-organize-attributes": "0.0.5", @@ -4412,6 +4414,61 @@ "node": ">=10" } }, + "node_modules/@rollup/plugin-json": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-4.1.0.tgz", + "integrity": "sha512-yfLbTdNS6amI/2OpmbiBoW12vngr5NW2jCJVZSBEz+H5KfUJZ2M7sDjk0U6GOOdCWFVScShte29o9NezJ53TPw==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^3.0.8" + }, + "peerDependencies": { + "rollup": "^1.20.0 || ^2.0.0" + } + }, + "node_modules/@rollup/plugin-node-resolve": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-13.3.0.tgz", + "integrity": "sha512-Lus8rbUo1eEcnS4yTFKLZrVumLPY+YayBdWXgFSHYhTT2iJbMhoaaBL3xl5NCdeRytErGr8tZ0L71BMRmnlwSw==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^3.1.0", + "@types/resolve": "1.17.1", + "deepmerge": "^4.2.2", + "is-builtin-module": "^3.1.0", + "is-module": "^1.0.0", + "resolve": "^1.19.0" + }, + "engines": { + "node": ">= 10.0.0" + }, + "peerDependencies": { + "rollup": "^2.42.0" + } + }, + "node_modules/@rollup/pluginutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", + "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", + "dev": true, + "dependencies": { + "@types/estree": "0.0.39", + "estree-walker": "^1.0.1", + "picomatch": "^2.2.2" + }, + "engines": { + "node": ">= 8.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0" + } + }, + "node_modules/@rollup/pluginutils/node_modules/@types/estree": { + "version": "0.0.39", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", + "dev": true + }, "node_modules/@s-libs/js-core": { "version": "14.0.0", "resolved": "https://registry.npmjs.org/@s-libs/js-core/-/js-core-14.0.0.tgz", @@ -4705,6 +4762,15 @@ "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==", "dev": true }, + "node_modules/@types/resolve": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz", + "integrity": "sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/retry": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz", @@ -8362,6 +8428,18 @@ "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=" }, + "node_modules/builtin-modules": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz", + "integrity": "sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/builtin-status-codes": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-2.0.0.tgz", @@ -9072,6 +9150,53 @@ "typedarray": "^0.0.6" } }, + "node_modules/concurrently": { + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-7.3.0.tgz", + "integrity": "sha512-IiDwm+8DOcFEInca494A8V402tNTQlJaYq78RF2rijOrKEk/AOHTxhN4U1cp7GYKYX5Q6Ymh1dLTBlzIMN0ikA==", + "dev": true, + "dependencies": { + "chalk": "^4.1.0", + "date-fns": "^2.16.1", + "lodash": "^4.17.21", + "rxjs": "^7.0.0", + "shell-quote": "^1.7.3", + "spawn-command": "^0.0.2-1", + "supports-color": "^8.1.0", + "tree-kill": "^1.2.2", + "yargs": "^17.3.1" + }, + "bin": { + "concurrently": "dist/bin/concurrently.js" + }, + "engines": { + "node": "^12.20.0 || ^14.13.0 || >=16.0.0" + } + }, + "node_modules/concurrently/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/concurrently/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, "node_modules/connect": { "version": "3.7.0", "resolved": "https://registry.npmjs.org/connect/-/connect-3.7.0.tgz", @@ -9702,6 +9827,12 @@ "node": ">=4" } }, + "node_modules/cuint": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/cuint/-/cuint-0.2.2.tgz", + "integrity": "sha512-d4ZVpCW31eWwCMe1YT3ur7mUDnTXbgwyzaL320DrcRT45rfjYxkt5QWLrmOJ+/UEAI2+fQgKe/fCjR8l4TpRgw==", + "dev": true + }, "node_modules/custom-event": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/custom-event/-/custom-event-1.0.1.tgz", @@ -9713,6 +9844,19 @@ "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-1.0.1.tgz", "integrity": "sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=" }, + "node_modules/date-fns": { + "version": "2.29.1", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.29.1.tgz", + "integrity": "sha512-dlLD5rKaKxpFdnjrs+5azHDFOPEu4ANy/LTh04A1DTzMM7qoajmKCBc8pkKRFT41CNzw+4gQh79X5C+Jq27HAw==", + "dev": true, + "engines": { + "node": ">=0.11" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/date-fns" + } + }, "node_modules/date-format": { "version": "4.0.11", "resolved": "https://registry.npmjs.org/date-format/-/date-format-4.0.11.tgz", @@ -9752,6 +9896,15 @@ "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", "dev": true }, + "node_modules/deepmerge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", + "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/default-gateway": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/default-gateway/-/default-gateway-6.0.3.tgz", @@ -11617,6 +11770,12 @@ "node": ">=4.0" } }, + "node_modules/estree-walker": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", + "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", + "dev": true + }, "node_modules/esutils": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", @@ -13323,6 +13482,15 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, + "node_modules/injection-js": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/injection-js/-/injection-js-2.4.0.tgz", + "integrity": "sha512-6jiJt0tCAo9zjHbcwLiPL+IuNe9SQ6a9g0PEzafThW3fOQi0mrmiJGBJvDD6tmhPh8cQHIQtCOrJuBfQME4kPA==", + "dev": true, + "dependencies": { + "tslib": "^2.0.0" + } + }, "node_modules/inquirer": { "version": "8.2.4", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-8.2.4.tgz", @@ -13518,6 +13686,18 @@ "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" }, + "node_modules/is-builtin-module": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.1.0.tgz", + "integrity": "sha512-OV7JjAgOTfAFJmHZLvpSTb4qi0nIILDV1gWPYDnDJUTNFM5aGlRAhk4QcT8i7TuAleeEV5Fdkqn3t4mS+Q11fg==", + "dev": true, + "dependencies": { + "builtin-modules": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/is-callable": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", @@ -13671,6 +13851,12 @@ "integrity": "sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==", "dev": true }, + "node_modules/is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==", + "dev": true + }, "node_modules/is-negative-zero": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", @@ -15584,6 +15770,231 @@ "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" }, + "node_modules/ng-packagr": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/ng-packagr/-/ng-packagr-14.1.0.tgz", + "integrity": "sha512-08B+bOp53YhmPobI1tK0YwGUAysden/PHtBUtmLaJxIHYVZqzH/RIFVaZLx+k+70TFqs+P2Hjpmo3wblWqFzxg==", + "dev": true, + "dependencies": { + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-node-resolve": "^13.1.3", + "ajv": "^8.10.0", + "ansi-colors": "^4.1.1", + "browserslist": "^4.20.0", + "cacache": "^16.0.0", + "chokidar": "^3.5.3", + "commander": "^9.0.0", + "dependency-graph": "^0.11.0", + "esbuild-wasm": "^0.14.29", + "find-cache-dir": "^3.3.2", + "glob": "^8.0.0", + "injection-js": "^2.4.0", + "jsonc-parser": "^3.0.0", + "less": "^4.1.2", + "ora": "^5.1.0", + "postcss": "^8.4.8", + "postcss-preset-env": "^7.4.2", + "postcss-url": "^10.1.3", + "rollup": "^2.70.0", + "rollup-plugin-sourcemaps": "^0.6.3", + "rxjs": "^7.5.5", + "sass": "^1.49.9", + "stylus": "^0.58.0" + }, + "bin": { + "ng-packagr": "cli/main.js" + }, + "engines": { + "node": "^14.15.0 || >=16.10.0" + }, + "optionalDependencies": { + "esbuild": "^0.14.29" + }, + "peerDependencies": { + "@angular/compiler-cli": "^14.0.0 || ^14.0.0-next || ^14.1.0-next", + "tslib": "^2.3.0", + "typescript": ">=4.6.2 <4.8" + } + }, + "node_modules/ng-packagr/node_modules/ajv": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ng-packagr/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/ng-packagr/node_modules/commander": { + "version": "9.4.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.4.0.tgz", + "integrity": "sha512-sRPT+umqkz90UA8M1yqYfnHlZA7fF6nSphDtxeywPZ49ysjxDQybzk13CL+mXekDRG92skbcqCLVovuCusNmFw==", + "dev": true, + "engines": { + "node": "^12.20.0 || >=14" + } + }, + "node_modules/ng-packagr/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/ng-packagr/node_modules/glob": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", + "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ng-packagr/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "node_modules/ng-packagr/node_modules/jsonc-parser": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.1.0.tgz", + "integrity": "sha512-DRf0QjnNeCUds3xTjKlQQ3DpJD51GvDjJfnxUVWg6PZTo2otSm+slzNAxU/35hF8/oJIKoG9slq30JYOsF2azg==", + "dev": true + }, + "node_modules/ng-packagr/node_modules/minimatch": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", + "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ng-packagr/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/ng-packagr/node_modules/rxjs": { + "version": "7.5.6", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.6.tgz", + "integrity": "sha512-dnyv2/YsXhnm461G+R/Pe5bWP41Nm6LBXEYWI6eiFP4fiwx6WRI/CD0zbdVAudd9xwLEF2IDcKXLHit0FYjUzw==", + "dev": true, + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/ng-packagr/node_modules/source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/ng-packagr/node_modules/stylus": { + "version": "0.58.1", + "resolved": "https://registry.npmjs.org/stylus/-/stylus-0.58.1.tgz", + "integrity": "sha512-AYiCHm5ogczdCPMfe9aeQa4NklB2gcf4D/IhzYPddJjTgPc+k4D/EVE0yfQbZD43MHP3lPy+8NZ9fcFxkrgs/w==", + "dev": true, + "dependencies": { + "css": "^3.0.0", + "debug": "^4.3.2", + "glob": "^7.1.6", + "sax": "~1.2.4", + "source-map": "^0.7.3" + }, + "bin": { + "stylus": "bin/stylus" + }, + "engines": { + "node": "*" + } + }, + "node_modules/ng-packagr/node_modules/stylus/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/ng-packagr/node_modules/stylus/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ng-packagr/node_modules/stylus/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/ngx-build-plus": { "version": "14.0.0", "resolved": "https://registry.npmjs.org/ngx-build-plus/-/ngx-build-plus-14.0.0.tgz", @@ -17839,6 +18250,60 @@ "node": ">=4" } }, + "node_modules/postcss-url": { + "version": "10.1.3", + "resolved": "https://registry.npmjs.org/postcss-url/-/postcss-url-10.1.3.tgz", + "integrity": "sha512-FUzyxfI5l2tKmXdYc6VTu3TWZsInayEKPbiyW+P6vmmIrrb4I6CGX0BFoewgYHLK+oIL5FECEK02REYRpBvUCw==", + "dev": true, + "dependencies": { + "make-dir": "~3.1.0", + "mime": "~2.5.2", + "minimatch": "~3.0.4", + "xxhashjs": "~0.2.2" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "postcss": "^8.0.0" + } + }, + "node_modules/postcss-url/node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/postcss-url/node_modules/minimatch": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz", + "integrity": "sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/postcss-url/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/postcss-value-parser": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", @@ -18544,6 +19009,54 @@ "inherits": "^2.0.1" } }, + "node_modules/rollup": { + "version": "2.77.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.77.1.tgz", + "integrity": "sha512-GhutNJrvTYD6s1moo+kyq7lD9DeR5HDyXo4bDFlDSkepC9kVKY+KK/NSZFzCmeXeia3kEzVuToQmHRdugyZHxw==", + "dev": true, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=10.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/rollup-plugin-sourcemaps": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/rollup-plugin-sourcemaps/-/rollup-plugin-sourcemaps-0.6.3.tgz", + "integrity": "sha512-paFu+nT1xvuO1tPFYXGe+XnQvg4Hjqv/eIhG8i5EspfYYPBKL57X7iVbfv55aNVASg3dzWvES9dmWsL2KhfByw==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^3.0.9", + "source-map-resolve": "^0.6.0" + }, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "@types/node": ">=10.0.0", + "rollup": ">=0.31.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/rollup-plugin-sourcemaps/node_modules/source-map-resolve": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.6.0.tgz", + "integrity": "sha512-KXBr9d/fO/bWo97NXsPIAW1bFSBOuCnjbNTBMO7N59hsv5i9yzRDfcYwwt0l04+VqnKC+EwzvJZIP/qkuMgR/w==", + "deprecated": "See https://github.com/lydell/source-map-resolve#deprecated", + "dev": true, + "dependencies": { + "atob": "^2.1.2", + "decode-uri-component": "^0.2.0" + } + }, "node_modules/run-async": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", @@ -18915,6 +19428,12 @@ "node": ">=0.10.0" } }, + "node_modules/shell-quote": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.3.tgz", + "integrity": "sha512-Vpfqwm4EnqGdlsBFNmHhxhElJYrdfcxPThu+ryKS5J8L/fhAwLazFZtq+S+TWZ9ANj2piSQLGj6NQg+lKPmxrw==", + "dev": true + }, "node_modules/short-uuid": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/short-uuid/-/short-uuid-4.1.0.tgz", @@ -19342,6 +19861,12 @@ "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", "dev": true }, + "node_modules/spawn-command": { + "version": "0.0.2-1", + "resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2-1.tgz", + "integrity": "sha512-n98l9E2RMSJ9ON1AKisHzz7V42VDiBQGY6PB1BwRglz99wpVsSuGzQ+jOi6lFXBGVTCrRpltvjm+/XA+tpeJrg==", + "dev": true + }, "node_modules/spdx-correct": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", @@ -21834,6 +22359,15 @@ "node": ">=0.4" } }, + "node_modules/xxhashjs": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/xxhashjs/-/xxhashjs-0.2.2.tgz", + "integrity": "sha512-AkTuIuVTET12tpsVIQo+ZU6f/qDmKuRUcjaqR+OIvm+aCBsZ95i7UVY5WJ9TMsSaZ0DA2WxoZ4acu0sPH+OKAw==", + "dev": true, + "dependencies": { + "cuint": "^0.2.2" + } + }, "node_modules/y18n": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", @@ -25071,6 +25605,48 @@ } } }, + "@rollup/plugin-json": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-4.1.0.tgz", + "integrity": "sha512-yfLbTdNS6amI/2OpmbiBoW12vngr5NW2jCJVZSBEz+H5KfUJZ2M7sDjk0U6GOOdCWFVScShte29o9NezJ53TPw==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.0.8" + } + }, + "@rollup/plugin-node-resolve": { + "version": "13.3.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-13.3.0.tgz", + "integrity": "sha512-Lus8rbUo1eEcnS4yTFKLZrVumLPY+YayBdWXgFSHYhTT2iJbMhoaaBL3xl5NCdeRytErGr8tZ0L71BMRmnlwSw==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.1.0", + "@types/resolve": "1.17.1", + "deepmerge": "^4.2.2", + "is-builtin-module": "^3.1.0", + "is-module": "^1.0.0", + "resolve": "^1.19.0" + } + }, + "@rollup/pluginutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", + "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", + "dev": true, + "requires": { + "@types/estree": "0.0.39", + "estree-walker": "^1.0.1", + "picomatch": "^2.2.2" + }, + "dependencies": { + "@types/estree": { + "version": "0.0.39", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", + "dev": true + } + } + }, "@s-libs/js-core": { "version": "14.0.0", "resolved": "https://registry.npmjs.org/@s-libs/js-core/-/js-core-14.0.0.tgz", @@ -25343,6 +25919,15 @@ "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==", "dev": true }, + "@types/resolve": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz", + "integrity": "sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "@types/retry": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz", @@ -28278,6 +28863,12 @@ "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=" }, + "builtin-modules": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz", + "integrity": "sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==", + "dev": true + }, "builtin-status-codes": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-2.0.0.tgz", @@ -28833,6 +29424,40 @@ "typedarray": "^0.0.6" } }, + "concurrently": { + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-7.3.0.tgz", + "integrity": "sha512-IiDwm+8DOcFEInca494A8V402tNTQlJaYq78RF2rijOrKEk/AOHTxhN4U1cp7GYKYX5Q6Ymh1dLTBlzIMN0ikA==", + "dev": true, + "requires": { + "chalk": "^4.1.0", + "date-fns": "^2.16.1", + "lodash": "^4.17.21", + "rxjs": "^7.0.0", + "shell-quote": "^1.7.3", + "spawn-command": "^0.0.2-1", + "supports-color": "^8.1.0", + "tree-kill": "^1.2.2", + "yargs": "^17.3.1" + }, + "dependencies": { + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, "connect": { "version": "3.7.0", "resolved": "https://registry.npmjs.org/connect/-/connect-3.7.0.tgz", @@ -29311,6 +29936,12 @@ "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", "dev": true }, + "cuint": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/cuint/-/cuint-0.2.2.tgz", + "integrity": "sha512-d4ZVpCW31eWwCMe1YT3ur7mUDnTXbgwyzaL320DrcRT45rfjYxkt5QWLrmOJ+/UEAI2+fQgKe/fCjR8l4TpRgw==", + "dev": true + }, "custom-event": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/custom-event/-/custom-event-1.0.1.tgz", @@ -29322,6 +29953,12 @@ "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-1.0.1.tgz", "integrity": "sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=" }, + "date-fns": { + "version": "2.29.1", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.29.1.tgz", + "integrity": "sha512-dlLD5rKaKxpFdnjrs+5azHDFOPEu4ANy/LTh04A1DTzMM7qoajmKCBc8pkKRFT41CNzw+4gQh79X5C+Jq27HAw==", + "dev": true + }, "date-format": { "version": "4.0.11", "resolved": "https://registry.npmjs.org/date-format/-/date-format-4.0.11.tgz", @@ -29352,6 +29989,12 @@ "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", "dev": true }, + "deepmerge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", + "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", + "dev": true + }, "default-gateway": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/default-gateway/-/default-gateway-6.0.3.tgz", @@ -30659,6 +31302,12 @@ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==" }, + "estree-walker": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", + "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", + "dev": true + }, "esutils": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", @@ -32000,6 +32649,15 @@ "integrity": "sha512-TxYQaeNW/N8ymDvwAxPyRbhMBtnEwuvaTYpOQkFx1nSeusgezHniEc/l35Vo4iCq/mMiTJbpD7oYxN98hFlfmw==", "dev": true }, + "injection-js": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/injection-js/-/injection-js-2.4.0.tgz", + "integrity": "sha512-6jiJt0tCAo9zjHbcwLiPL+IuNe9SQ6a9g0PEzafThW3fOQi0mrmiJGBJvDD6tmhPh8cQHIQtCOrJuBfQME4kPA==", + "dev": true, + "requires": { + "tslib": "^2.0.0" + } + }, "inquirer": { "version": "8.2.4", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-8.2.4.tgz", @@ -32160,6 +32818,15 @@ "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" }, + "is-builtin-module": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.1.0.tgz", + "integrity": "sha512-OV7JjAgOTfAFJmHZLvpSTb4qi0nIILDV1gWPYDnDJUTNFM5aGlRAhk4QcT8i7TuAleeEV5Fdkqn3t4mS+Q11fg==", + "dev": true, + "requires": { + "builtin-modules": "^3.0.0" + } + }, "is-callable": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", @@ -32263,6 +32930,12 @@ "integrity": "sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==", "dev": true }, + "is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==", + "dev": true + }, "is-negative-zero": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", @@ -33748,6 +34421,180 @@ "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==" }, + "ng-packagr": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/ng-packagr/-/ng-packagr-14.1.0.tgz", + "integrity": "sha512-08B+bOp53YhmPobI1tK0YwGUAysden/PHtBUtmLaJxIHYVZqzH/RIFVaZLx+k+70TFqs+P2Hjpmo3wblWqFzxg==", + "dev": true, + "requires": { + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-node-resolve": "^13.1.3", + "ajv": "^8.10.0", + "ansi-colors": "^4.1.1", + "browserslist": "^4.20.0", + "cacache": "^16.0.0", + "chokidar": "^3.5.3", + "commander": "^9.0.0", + "dependency-graph": "^0.11.0", + "esbuild": "^0.14.29", + "esbuild-wasm": "^0.14.29", + "find-cache-dir": "^3.3.2", + "glob": "^8.0.0", + "injection-js": "^2.4.0", + "jsonc-parser": "^3.0.0", + "less": "^4.1.2", + "ora": "^5.1.0", + "postcss": "^8.4.8", + "postcss-preset-env": "^7.4.2", + "postcss-url": "^10.1.3", + "rollup": "^2.70.0", + "rollup-plugin-sourcemaps": "^0.6.3", + "rxjs": "^7.5.5", + "sass": "^1.49.9", + "stylus": "^0.58.0" + }, + "dependencies": { + "ajv": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0" + } + }, + "commander": { + "version": "9.4.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.4.0.tgz", + "integrity": "sha512-sRPT+umqkz90UA8M1yqYfnHlZA7fF6nSphDtxeywPZ49ysjxDQybzk13CL+mXekDRG92skbcqCLVovuCusNmFw==", + "dev": true + }, + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "glob": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", + "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "jsonc-parser": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.1.0.tgz", + "integrity": "sha512-DRf0QjnNeCUds3xTjKlQQ3DpJD51GvDjJfnxUVWg6PZTo2otSm+slzNAxU/35hF8/oJIKoG9slq30JYOsF2azg==", + "dev": true + }, + "minimatch": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", + "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", + "dev": true, + "requires": { + "brace-expansion": "^2.0.1" + } + }, + "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 + }, + "rxjs": { + "version": "7.5.6", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.6.tgz", + "integrity": "sha512-dnyv2/YsXhnm461G+R/Pe5bWP41Nm6LBXEYWI6eiFP4fiwx6WRI/CD0zbdVAudd9xwLEF2IDcKXLHit0FYjUzw==", + "dev": true, + "requires": { + "tslib": "^2.1.0" + } + }, + "source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "dev": true + }, + "stylus": { + "version": "0.58.1", + "resolved": "https://registry.npmjs.org/stylus/-/stylus-0.58.1.tgz", + "integrity": "sha512-AYiCHm5ogczdCPMfe9aeQa4NklB2gcf4D/IhzYPddJjTgPc+k4D/EVE0yfQbZD43MHP3lPy+8NZ9fcFxkrgs/w==", + "dev": true, + "requires": { + "css": "^3.0.0", + "debug": "^4.3.2", + "glob": "^7.1.6", + "sax": "~1.2.4", + "source-map": "^0.7.3" + }, + "dependencies": { + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + } + } + }, "ngx-build-plus": { "version": "14.0.0", "resolved": "https://registry.npmjs.org/ngx-build-plus/-/ngx-build-plus-14.0.0.tgz", @@ -35373,6 +36220,44 @@ "util-deprecate": "^1.0.2" } }, + "postcss-url": { + "version": "10.1.3", + "resolved": "https://registry.npmjs.org/postcss-url/-/postcss-url-10.1.3.tgz", + "integrity": "sha512-FUzyxfI5l2tKmXdYc6VTu3TWZsInayEKPbiyW+P6vmmIrrb4I6CGX0BFoewgYHLK+oIL5FECEK02REYRpBvUCw==", + "dev": true, + "requires": { + "make-dir": "~3.1.0", + "mime": "~2.5.2", + "minimatch": "~3.0.4", + "xxhashjs": "~0.2.2" + }, + "dependencies": { + "make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "requires": { + "semver": "^6.0.0" + } + }, + "minimatch": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz", + "integrity": "sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, "postcss-value-parser": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", @@ -35926,6 +36811,37 @@ "inherits": "^2.0.1" } }, + "rollup": { + "version": "2.77.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.77.1.tgz", + "integrity": "sha512-GhutNJrvTYD6s1moo+kyq7lD9DeR5HDyXo4bDFlDSkepC9kVKY+KK/NSZFzCmeXeia3kEzVuToQmHRdugyZHxw==", + "dev": true, + "requires": { + "fsevents": "~2.3.2" + } + }, + "rollup-plugin-sourcemaps": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/rollup-plugin-sourcemaps/-/rollup-plugin-sourcemaps-0.6.3.tgz", + "integrity": "sha512-paFu+nT1xvuO1tPFYXGe+XnQvg4Hjqv/eIhG8i5EspfYYPBKL57X7iVbfv55aNVASg3dzWvES9dmWsL2KhfByw==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.0.9", + "source-map-resolve": "^0.6.0" + }, + "dependencies": { + "source-map-resolve": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.6.0.tgz", + "integrity": "sha512-KXBr9d/fO/bWo97NXsPIAW1bFSBOuCnjbNTBMO7N59hsv5i9yzRDfcYwwt0l04+VqnKC+EwzvJZIP/qkuMgR/w==", + "dev": true, + "requires": { + "atob": "^2.1.2", + "decode-uri-component": "^0.2.0" + } + } + } + }, "run-async": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", @@ -36208,6 +37124,12 @@ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" }, + "shell-quote": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.3.tgz", + "integrity": "sha512-Vpfqwm4EnqGdlsBFNmHhxhElJYrdfcxPThu+ryKS5J8L/fhAwLazFZtq+S+TWZ9ANj2piSQLGj6NQg+lKPmxrw==", + "dev": true + }, "short-uuid": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/short-uuid/-/short-uuid-4.1.0.tgz", @@ -36547,6 +37469,12 @@ "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", "dev": true }, + "spawn-command": { + "version": "0.0.2-1", + "resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2-1.tgz", + "integrity": "sha512-n98l9E2RMSJ9ON1AKisHzz7V42VDiBQGY6PB1BwRglz99wpVsSuGzQ+jOi6lFXBGVTCrRpltvjm+/XA+tpeJrg==", + "dev": true + }, "spdx-correct": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", @@ -38410,6 +39338,15 @@ "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" }, + "xxhashjs": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/xxhashjs/-/xxhashjs-0.2.2.tgz", + "integrity": "sha512-AkTuIuVTET12tpsVIQo+ZU6f/qDmKuRUcjaqR+OIvm+aCBsZ95i7UVY5WJ9TMsSaZ0DA2WxoZ4acu0sPH+OKAw==", + "dev": true, + "requires": { + "cuint": "^0.2.2" + } + }, "y18n": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", diff --git a/package.json b/package.json index 8337a257..e14e15b0 100644 --- a/package.json +++ b/package.json @@ -4,17 +4,22 @@ "private": true, "scripts": { "postinstall": "ngcc", - "start": "ng serve --proxy-config proxy.conf.js --port 4200", - "build": "ng build --extra-webpack-config webpack.extra.js", + "start": "concurrently -n LIB,APP -c magenta,cyan npm:dev-libs \"sleep 0.5 && npm run dev\"", + "dev": "ng serve --proxy-config proxy.conf.js --port 4200", + "dev-libs": "ng build ng-core --watch", + "build-app": "ng build --extra-webpack-config webpack.extra.js", + "build-libs": "ng build ng-core", + "build": "npm run build-libs && npm run build-app", "test": "ng test", - "lint-cmd": "eslint \"src/**/*.{ts,js,html}\" --max-warnings 1115", - "lint": "npm run lint-cmd -- --cache", + "lint": "eslint \"src/**/*.{ts,js,html}\" --max-warnings 1115", "lint-fix": "npm run lint -- --fix", "lint-errors": "npm run lint -- --quiet", + "lint-libs": "eslint \"projects/**/*.{ts,js,html}\" --max-warnings 0", + "lint-libs-fix": "npm run lint -- --fix", "prettier-preset": "prettier \"**/*.{html,js,ts,css,scss,md,json,prettierrc,svg,huskyrc,yml,yaml}\"", "prettier": "npm run prettier-preset -- --list-different", - "prettier:fix": "npm run prettier-preset -- --write", - "fix": "npm run lint-fix; npm run prettier:fix" + "prettier-fix": "npm run prettier-preset -- --write", + "fix": "concurrently -n LIB,APP -c magenta,cyan npm:lint-libs-fix npm:lint-fix && npm run prettier-fix" }, "dependencies": { "@angular/animations": "14.0.4", @@ -86,6 +91,7 @@ "@types/uuid": "3.4.3", "@typescript-eslint/eslint-plugin": "^5.29.0", "@typescript-eslint/parser": "^5.29.0", + "concurrently": "7.3.0", "dotenv": "16.0.0", "eslint": "8.20.0", "eslint-config-prettier": "8.5.0", @@ -103,6 +109,7 @@ "karma-coverage-istanbul-reporter": "3.0.3", "karma-jasmine": "5.1.0", "karma-jasmine-html-reporter": "2.0.0", + "ng-packagr": "14.1.0", "ngx-build-plus": "14.0.0", "prettier": "2.7.1", "prettier-plugin-organize-attributes": "0.0.5", diff --git a/projects/ng-core/.browserslistrc b/projects/ng-core/.browserslistrc new file mode 100644 index 00000000..4f9ac269 --- /dev/null +++ b/projects/ng-core/.browserslistrc @@ -0,0 +1,16 @@ +# This file is used by the build system to adjust CSS and JS output to support the specified browsers below. +# For additional information regarding the format and rule options, please see: +# https://github.com/browserslist/browserslist#queries + +# For the full list of supported browsers by the Angular framework, please see: +# https://angular.io/guide/browser-support + +# You can see what browsers were selected by your queries by running: +# npx browserslist + +last 1 Chrome version +last 1 Firefox version +last 2 Edge major versions +last 2 Safari major versions +last 2 iOS major versions +Firefox ESR diff --git a/projects/ng-core/.prettierignore b/projects/ng-core/.prettierignore new file mode 100644 index 00000000..ec6d3cdd --- /dev/null +++ b/projects/ng-core/.prettierignore @@ -0,0 +1 @@ +package.json diff --git a/projects/ng-core/README.md b/projects/ng-core/README.md new file mode 100644 index 00000000..162c77a8 --- /dev/null +++ b/projects/ng-core/README.md @@ -0,0 +1,25 @@ +# NgCore + +This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 14.0.0. + +## Code scaffolding + +Run `ng generate component component-name --project ng-core` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ng-core`. + +> Note: Don't forget to add `--project ng-core` or else it will be added to the default project in your `angular.json` file. + +## Build + +Run `ng build ng-core` to build the project. The build artifacts will be stored in the `dist/` directory. + +## Publishing + +After building your library with `ng build ng-core`, go to the dist folder `cd dist/ng-core` and run `npm publish`. + +## Running unit tests + +Run `ng test ng-core` to execute the unit tests via [Karma](https://karma-runner.github.io). + +## Further help + +To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. diff --git a/projects/ng-core/karma.conf.js b/projects/ng-core/karma.conf.js new file mode 100644 index 00000000..e006db62 --- /dev/null +++ b/projects/ng-core/karma.conf.js @@ -0,0 +1,41 @@ +// Karma configuration file, see link for more information +// https://karma-runner.github.io/1.0/config/configuration-file.html + +module.exports = function (config) { + config.set({ + basePath: '', + frameworks: ['jasmine', '@angular-devkit/build-angular'], + plugins: [ + require('karma-jasmine'), + require('karma-chrome-launcher'), + require('karma-jasmine-html-reporter'), + require('karma-coverage'), + require('@angular-devkit/build-angular/plugins/karma'), + ], + client: { + jasmine: { + // you can add configuration options for Jasmine here + // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html + // for example, you can disable the random execution with `random: false` + // or set a specific seed with `seed: 4321` + }, + clearContext: false, // leave Jasmine Spec Runner output visible in browser + }, + jasmineHtmlReporter: { + suppressAll: true, // removes the duplicated traces + }, + coverageReporter: { + dir: require('path').join(__dirname, '../../coverage/ng-core'), + subdir: '.', + reporters: [{ type: 'html' }, { type: 'text-summary' }], + }, + reporters: ['progress', 'kjhtml'], + port: 9876, + colors: true, + logLevel: config.LOG_INFO, + autoWatch: true, + browsers: ['Chrome'], + singleRun: false, + restartOnFileChange: true, + }); +}; diff --git a/projects/ng-core/ng-package.json b/projects/ng-core/ng-package.json new file mode 100644 index 00000000..fe644b73 --- /dev/null +++ b/projects/ng-core/ng-package.json @@ -0,0 +1,7 @@ +{ + "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", + "dest": "../../dist/ng-core", + "lib": { + "entryFile": "src/public-api.ts" + } +} diff --git a/projects/ng-core/package.json b/projects/ng-core/package.json new file mode 100644 index 00000000..d73feb94 --- /dev/null +++ b/projects/ng-core/package.json @@ -0,0 +1,11 @@ +{ + "name": "@vality/ng-core", + "version": "0.0.1", + "peerDependencies": { + "@angular/common": "^14.0.0", + "@angular/core": "^14.0.0" + }, + "dependencies": { + "tslib": "^2.3.0" + } +} \ No newline at end of file diff --git a/src/components/actions/actions.component.html b/projects/ng-core/src/lib/components/actions/actions.component.html similarity index 100% rename from src/components/actions/actions.component.html rename to projects/ng-core/src/lib/components/actions/actions.component.html diff --git a/src/components/actions/actions.component.scss b/projects/ng-core/src/lib/components/actions/actions.component.scss similarity index 100% rename from src/components/actions/actions.component.scss rename to projects/ng-core/src/lib/components/actions/actions.component.scss diff --git a/src/components/actions/actions.component.ts b/projects/ng-core/src/lib/components/actions/actions.component.ts similarity index 100% rename from src/components/actions/actions.component.ts rename to projects/ng-core/src/lib/components/actions/actions.component.ts diff --git a/src/components/actions/actions.module.ts b/projects/ng-core/src/lib/components/actions/actions.module.ts similarity index 100% rename from src/components/actions/actions.module.ts rename to projects/ng-core/src/lib/components/actions/actions.module.ts diff --git a/projects/ng-core/src/lib/components/actions/index.ts b/projects/ng-core/src/lib/components/actions/index.ts new file mode 100644 index 00000000..26dc132e --- /dev/null +++ b/projects/ng-core/src/lib/components/actions/index.ts @@ -0,0 +1,2 @@ +export * from './actions.module'; +export * from './actions.component'; diff --git a/src/components/base-dialog/base-dialog.component.html b/projects/ng-core/src/lib/components/base-dialog/base-dialog.component.html similarity index 100% rename from src/components/base-dialog/base-dialog.component.html rename to projects/ng-core/src/lib/components/base-dialog/base-dialog.component.html diff --git a/src/components/base-dialog/base-dialog.component.scss b/projects/ng-core/src/lib/components/base-dialog/base-dialog.component.scss similarity index 100% rename from src/components/base-dialog/base-dialog.component.scss rename to projects/ng-core/src/lib/components/base-dialog/base-dialog.component.scss diff --git a/src/components/base-dialog/base-dialog.component.ts b/projects/ng-core/src/lib/components/base-dialog/base-dialog.component.ts similarity index 96% rename from src/components/base-dialog/base-dialog.component.ts rename to projects/ng-core/src/lib/components/base-dialog/base-dialog.component.ts index fc221120..f3f74829 100644 --- a/src/components/base-dialog/base-dialog.component.ts +++ b/projects/ng-core/src/lib/components/base-dialog/base-dialog.component.ts @@ -9,7 +9,7 @@ import { BaseDialogResponseStatus } from './types/base-dialog-response-status'; styleUrls: ['base-dialog.component.scss'], }) export class BaseDialogComponent { - @Input() title: string; + @Input() title!: string; @coerceBoolean @Input() disabled = false; @coerceBoolean @Input() inProgress = false; diff --git a/src/components/base-dialog/base-dialog.module.ts b/projects/ng-core/src/lib/components/base-dialog/base-dialog.module.ts similarity index 92% rename from src/components/base-dialog/base-dialog.module.ts rename to projects/ng-core/src/lib/components/base-dialog/base-dialog.module.ts index b376ab92..80b63929 100644 --- a/src/components/base-dialog/base-dialog.module.ts +++ b/projects/ng-core/src/lib/components/base-dialog/base-dialog.module.ts @@ -7,8 +7,7 @@ import { MatDividerModule } from '@angular/material/divider'; import { MatIconModule } from '@angular/material/icon'; import { MatProgressBarModule } from '@angular/material/progress-bar'; -import { ActionsModule } from '@cc/components/actions'; - +import { ActionsModule } from '../actions'; import { BaseDialogComponent } from './base-dialog.component'; import { BaseDialogActionsComponent } from './components/base-dialog-actions/base-dialog-actions.component'; @@ -21,7 +20,6 @@ const SHARED_DECLARATIONS = [BaseDialogComponent, BaseDialogActionsComponent]; MatDividerModule, MatButtonModule, ActionsModule, - ActionsModule, MatIconModule, MatProgressBarModule, MatDialogModule, diff --git a/src/components/base-dialog/components/base-dialog-actions/base-dialog-actions.component.html b/projects/ng-core/src/lib/components/base-dialog/components/base-dialog-actions/base-dialog-actions.component.html similarity index 100% rename from src/components/base-dialog/components/base-dialog-actions/base-dialog-actions.component.html rename to projects/ng-core/src/lib/components/base-dialog/components/base-dialog-actions/base-dialog-actions.component.html diff --git a/src/components/base-dialog/components/base-dialog-actions/base-dialog-actions.component.ts b/projects/ng-core/src/lib/components/base-dialog/components/base-dialog-actions/base-dialog-actions.component.ts similarity index 100% rename from src/components/base-dialog/components/base-dialog-actions/base-dialog-actions.component.ts rename to projects/ng-core/src/lib/components/base-dialog/components/base-dialog-actions/base-dialog-actions.component.ts diff --git a/projects/ng-core/src/lib/components/base-dialog/index.ts b/projects/ng-core/src/lib/components/base-dialog/index.ts new file mode 100644 index 00000000..aa8b652a --- /dev/null +++ b/projects/ng-core/src/lib/components/base-dialog/index.ts @@ -0,0 +1,8 @@ +export * from './base-dialog.module'; +export * from './types/base-dialog-response-status'; +export * from './types/base-dialog-response'; +export * from './utils/base-dialog-superclass'; +export * from './tokens'; +export * from './base-dialog.component'; +export * from './components/base-dialog-actions/base-dialog-actions.component'; +export * from './services/base-dialog.service'; diff --git a/src/components/base-dialog/services/base-dialog.service.ts b/projects/ng-core/src/lib/components/base-dialog/services/base-dialog.service.ts similarity index 58% rename from src/components/base-dialog/services/base-dialog.service.ts rename to projects/ng-core/src/lib/components/base-dialog/services/base-dialog.service.ts index b58102d2..4e3d8442 100644 --- a/src/components/base-dialog/services/base-dialog.service.ts +++ b/projects/ng-core/src/lib/components/base-dialog/services/base-dialog.service.ts @@ -1,9 +1,10 @@ import { ComponentType } from '@angular/cdk/overlay'; -import { Inject, Injectable } from '@angular/core'; +import { Inject, Injectable, Optional } from '@angular/core'; import { MatDialog, MatDialogConfig, MatDialogRef } from '@angular/material/dialog'; -import { DIALOG_CONFIG, DialogConfig } from '@cc/app/tokens'; -import { BaseDialogResponse, BaseDialogSuperclass } from '@cc/components/base-dialog'; +import { DEFAULT_DIALOG_CONFIG, DIALOG_CONFIG, DialogConfig } from '../tokens'; +import { BaseDialogResponse } from '../types/base-dialog-response'; +import { BaseDialogSuperclass } from '../utils/base-dialog-superclass'; @Injectable({ providedIn: 'root', @@ -11,8 +12,12 @@ import { BaseDialogResponse, BaseDialogSuperclass } from '@cc/components/base-di export class BaseDialogService { constructor( private dialog: MatDialog, - @Inject(DIALOG_CONFIG) private dialogConfig: DialogConfig - ) {} + @Optional() + @Inject(DIALOG_CONFIG) + private dialogConfig: DialogConfig + ) { + if (!dialogConfig) this.dialogConfig = DEFAULT_DIALOG_CONFIG; + } open( dialogComponent: ComponentType>, @@ -25,12 +30,16 @@ export class BaseDialogService { ? [] : [data: D, configOrConfigName?: Omit, 'data'> | keyof DialogConfig] ): MatDialogRef> { + let config: Partial>; + if (!configOrConfigName) config = this.dialogConfig.medium; + else if (typeof configOrConfigName === 'string') + config = this.dialogConfig[configOrConfigName]; + else config = configOrConfigName; + return this.dialog.open(dialogComponent as never, { data, ...(dialogComponent as typeof BaseDialogSuperclass).defaultDialogConfig, - ...(typeof configOrConfigName === 'string' - ? this.dialogConfig[configOrConfigName] - : configOrConfigName), + ...config, }); } } diff --git a/projects/ng-core/src/lib/components/base-dialog/tokens.ts b/projects/ng-core/src/lib/components/base-dialog/tokens.ts new file mode 100644 index 00000000..de9a791a --- /dev/null +++ b/projects/ng-core/src/lib/components/base-dialog/tokens.ts @@ -0,0 +1,20 @@ +import { InjectionToken } from '@angular/core'; +import { MatDialogConfig } from '@angular/material/dialog'; +import { ValuesType } from 'utility-types'; + +export type DialogConfig = Record<'small' | 'medium' | 'large', MatDialogConfig>; + +export const DIALOG_CONFIG = new InjectionToken('dialogConfig'); + +export const BASE_CONFIG: ValuesType = { + maxHeight: '90vh', + disableClose: true, + autoFocus: false, + width: '552px', +}; + +export const DEFAULT_DIALOG_CONFIG: DialogConfig = { + small: { ...BASE_CONFIG, width: '360px' }, + medium: BASE_CONFIG, + large: { ...BASE_CONFIG, width: '648px' }, +}; diff --git a/src/components/base-dialog/types/base-dialog-response-status.ts b/projects/ng-core/src/lib/components/base-dialog/types/base-dialog-response-status.ts similarity index 100% rename from src/components/base-dialog/types/base-dialog-response-status.ts rename to projects/ng-core/src/lib/components/base-dialog/types/base-dialog-response-status.ts diff --git a/src/components/base-dialog/types/base-dialog-response.ts b/projects/ng-core/src/lib/components/base-dialog/types/base-dialog-response.ts similarity index 65% rename from src/components/base-dialog/types/base-dialog-response.ts rename to projects/ng-core/src/lib/components/base-dialog/types/base-dialog-response.ts index d6a9339f..deaf6d04 100644 --- a/src/components/base-dialog/types/base-dialog-response.ts +++ b/projects/ng-core/src/lib/components/base-dialog/types/base-dialog-response.ts @@ -1,4 +1,4 @@ -import { BaseDialogResponseStatus } from '@cc/components/base-dialog'; +import { BaseDialogResponseStatus } from './base-dialog-response-status'; export interface BaseDialogResponse { status: S | BaseDialogResponseStatus; diff --git a/src/components/base-dialog/utils/base-dialog-superclass.ts b/projects/ng-core/src/lib/components/base-dialog/utils/base-dialog-superclass.ts similarity index 92% rename from src/components/base-dialog/utils/base-dialog-superclass.ts rename to projects/ng-core/src/lib/components/base-dialog/utils/base-dialog-superclass.ts index 4329dc3b..b84b6f5d 100644 --- a/src/components/base-dialog/utils/base-dialog-superclass.ts +++ b/projects/ng-core/src/lib/components/base-dialog/utils/base-dialog-superclass.ts @@ -1,8 +1,7 @@ import { Directive, Injector } from '@angular/core'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; -import { DEFAULT_DIALOG_CONFIG } from '@cc/app/tokens'; - +import { DEFAULT_DIALOG_CONFIG } from '../tokens'; import { BaseDialogResponse } from '../types/base-dialog-response'; @Directive() diff --git a/projects/ng-core/src/lib/components/index.ts b/projects/ng-core/src/lib/components/index.ts new file mode 100644 index 00000000..53400852 --- /dev/null +++ b/projects/ng-core/src/lib/components/index.ts @@ -0,0 +1,2 @@ +export * from './actions'; +export * from './base-dialog'; diff --git a/projects/ng-core/src/lib/index.ts b/projects/ng-core/src/lib/index.ts new file mode 100644 index 00000000..07635cbb --- /dev/null +++ b/projects/ng-core/src/lib/index.ts @@ -0,0 +1 @@ +export * from './components'; diff --git a/projects/ng-core/src/public-api.ts b/projects/ng-core/src/public-api.ts new file mode 100644 index 00000000..91fe6f63 --- /dev/null +++ b/projects/ng-core/src/public-api.ts @@ -0,0 +1,5 @@ +/* + * Public API Surface of ng-core + */ + +export * from './lib'; diff --git a/projects/ng-core/src/test.ts b/projects/ng-core/src/test.ts new file mode 100644 index 00000000..47d6b41e --- /dev/null +++ b/projects/ng-core/src/test.ts @@ -0,0 +1,29 @@ +// This file is required by karma.conf.js and loads recursively all the .spec and framework files + +import 'zone.js'; +import 'zone.js/testing'; +import { getTestBed } from '@angular/core/testing'; +import { + BrowserDynamicTestingModule, + platformBrowserDynamicTesting, +} from '@angular/platform-browser-dynamic/testing'; + +// eslint-disable-next-line @typescript-eslint/naming-convention +declare const require: { + context( + path: string, + deep?: boolean, + filter?: RegExp + ): { + (id: string): T; + keys(): string[]; + }; +}; + +// First, initialize the Angular testing environment. +getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting()); + +// Then we find all the tests. +const context = require.context('./', true, /\.spec\.ts$/); +// And load the modules. +context.keys().forEach(context); diff --git a/projects/ng-core/tsconfig.lib.json b/projects/ng-core/tsconfig.lib.json new file mode 100644 index 00000000..08b6e7e6 --- /dev/null +++ b/projects/ng-core/tsconfig.lib.json @@ -0,0 +1,16 @@ +/* To learn more about this file see: https://angular.io/config/tsconfig. */ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "../../out-tsc/lib", + "declaration": true, + "declarationMap": true, + "inlineSources": true, + "types": [], + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitAny": true + }, + "exclude": ["src/test.ts", "**/*.spec.ts"] +} diff --git a/projects/ng-core/tsconfig.lib.prod.json b/projects/ng-core/tsconfig.lib.prod.json new file mode 100644 index 00000000..560c2391 --- /dev/null +++ b/projects/ng-core/tsconfig.lib.prod.json @@ -0,0 +1,10 @@ +/* To learn more about this file see: https://angular.io/config/tsconfig. */ +{ + "extends": "./tsconfig.lib.json", + "compilerOptions": { + "declarationMap": false + }, + "angularCompilerOptions": { + "compilationMode": "partial" + } +} diff --git a/projects/ng-core/tsconfig.spec.json b/projects/ng-core/tsconfig.spec.json new file mode 100644 index 00000000..4ed8f505 --- /dev/null +++ b/projects/ng-core/tsconfig.spec.json @@ -0,0 +1,10 @@ +/* To learn more about this file see: https://angular.io/config/tsconfig. */ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "../../out-tsc/spec", + "types": ["jasmine"] + }, + "files": ["src/test.ts"], + "include": ["**/*.spec.ts", "**/*.d.ts"] +} diff --git a/src/app/app.module.ts b/src/app/app.module.ts index b1e5ffde..dfa0c1e5 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -36,12 +36,10 @@ import { SearchPartiesModule } from './sections/search-parties/search-parties.mo import { SectionsModule } from './sections/sections.module'; import { ThemeManager, ThemeManagerModule, ThemeName } from './theme-manager'; import { - DEFAULT_DIALOG_CONFIG, DEFAULT_MAT_DATE_FORMATS, DEFAULT_QUERY_PARAMS_SERIALIZERS, DEFAULT_SEARCH_LIMIT, DEFAULT_SMALL_SEARCH_LIMIT, - DIALOG_CONFIG, SEARCH_LIMIT, SMALL_SEARCH_LIMIT, } from './tokens'; @@ -87,7 +85,6 @@ moment.locale('en'); { provide: LOCALE_ID, useValue: 'en' }, { provide: SEARCH_LIMIT, useValue: DEFAULT_SEARCH_LIMIT }, { provide: SMALL_SEARCH_LIMIT, useValue: DEFAULT_SMALL_SEARCH_LIMIT }, - { provide: DIALOG_CONFIG, useValue: DEFAULT_DIALOG_CONFIG }, { provide: QUERY_PARAMS_SERIALIZERS, useValue: DEFAULT_QUERY_PARAMS_SERIALIZERS }, ], bootstrap: [AppComponent], diff --git a/src/app/sections/claim/claim.component.ts b/src/app/sections/claim/claim.component.ts index fc25626c..564035ae 100644 --- a/src/app/sections/claim/claim.component.ts +++ b/src/app/sections/claim/claim.component.ts @@ -1,6 +1,7 @@ import { Component } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; +import { BaseDialogResponseStatus, BaseDialogService } from '@vality/ng-core'; import { BehaviorSubject, combineLatest, @@ -19,8 +20,6 @@ import { ChangeStatusDialogComponent } from '@cc/app/sections/claim/components/c import { AllowedClaimStatusesService } from '@cc/app/sections/claim/services/allowed-claim-statuses.service'; import { UploadFileService } from '@cc/app/sections/claim/services/upload-file.service'; import { NotificationService } from '@cc/app/shared/services/notification'; -import { BaseDialogResponseStatus } from '@cc/components/base-dialog'; -import { BaseDialogService } from '@cc/components/base-dialog/services/base-dialog.service'; import { getUnionKey, inProgressFrom, progressTo } from '@cc/utils'; import { AddModificationDialogComponent } from './components/add-modification-dialog/add-modification-dialog.component'; diff --git a/src/app/sections/claim/claim.module.ts b/src/app/sections/claim/claim.module.ts index 5475ac7c..29da3e17 100644 --- a/src/app/sections/claim/claim.module.ts +++ b/src/app/sections/claim/claim.module.ts @@ -15,13 +15,12 @@ import { MatProgressBarModule } from '@angular/material/progress-bar'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { MatSelectModule } from '@angular/material/select'; import { RouterModule } from '@angular/router'; +import { ActionsModule, BaseDialogModule } from '@vality/ng-core'; import { ngfModule } from 'angular-file'; import { MetadataFormModule, StatusModule } from '@cc/app/shared/components'; import { JsonViewerModule } from '@cc/app/shared/components/json-viewer/json-viewer.module'; import { ThriftPipesModule } from '@cc/app/shared/pipes'; -import { ActionsModule } from '@cc/components/actions'; -import { BaseDialogModule } from '@cc/components/base-dialog'; import { TimelineModule } from '@cc/components/timeline'; import { TimelineComponentsModule } from '../party-claim/changeset/timeline-components'; diff --git a/src/app/sections/claim/components/add-modification-dialog/add-modification-dialog.component.ts b/src/app/sections/claim/components/add-modification-dialog/add-modification-dialog.component.ts index 042f5efb..22bf7000 100644 --- a/src/app/sections/claim/components/add-modification-dialog/add-modification-dialog.component.ts +++ b/src/app/sections/claim/components/add-modification-dialog/add-modification-dialog.component.ts @@ -9,12 +9,15 @@ import { PartyModificationChange, } from '@vality/domain-proto/lib/claim_management'; import { Party } from '@vality/domain-proto/lib/domain'; +import { + BaseDialogResponseStatus, + BaseDialogSuperclass, + DEFAULT_DIALOG_CONFIG, +} from '@vality/ng-core'; import { BehaviorSubject } from 'rxjs'; import { ClaimManagementService } from '@cc/app/api/claim-management'; import { NotificationService } from '@cc/app/shared/services/notification'; -import { DEFAULT_DIALOG_CONFIG } from '@cc/app/tokens'; -import { BaseDialogResponseStatus, BaseDialogSuperclass } from '@cc/components/base-dialog'; import { inProgressFrom, progressTo } from '@cc/utils'; @UntilDestroy() diff --git a/src/app/sections/claim/components/change-status-dialog/change-status-dialog.component.ts b/src/app/sections/claim/components/change-status-dialog/change-status-dialog.component.ts index bb310a28..2c136dd0 100644 --- a/src/app/sections/claim/components/change-status-dialog/change-status-dialog.component.ts +++ b/src/app/sections/claim/components/change-status-dialog/change-status-dialog.component.ts @@ -2,12 +2,12 @@ import { Component, Injector } from '@angular/core'; import { Validators, FormBuilder } from '@angular/forms'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; import { Claim, ClaimStatus } from '@vality/domain-proto/lib/claim_management'; +import { BaseDialogResponseStatus, BaseDialogSuperclass } from '@vality/ng-core'; import { BehaviorSubject, Observable } from 'rxjs'; import { ClaimManagementService } from '@cc/app/api/claim-management'; import { AllowedClaimStatusesService } from '@cc/app/sections/claim/services/allowed-claim-statuses.service'; import { NotificationService } from '@cc/app/shared/services/notification'; -import { BaseDialogResponseStatus, BaseDialogSuperclass } from '@cc/components/base-dialog'; import { getUnionKey, inProgressFrom, progressTo } from '@cc/utils'; @UntilDestroy() diff --git a/src/app/sections/claim/components/modification-unit-timeline-item/modification-unit-timeline-item.component.ts b/src/app/sections/claim/components/modification-unit-timeline-item/modification-unit-timeline-item.component.ts index c2003725..8ca1fefb 100644 --- a/src/app/sections/claim/components/modification-unit-timeline-item/modification-unit-timeline-item.component.ts +++ b/src/app/sections/claim/components/modification-unit-timeline-item/modification-unit-timeline-item.component.ts @@ -1,6 +1,7 @@ import { Component, EventEmitter, Input, Output } from '@angular/core'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; import { Claim, ModificationUnit } from '@vality/domain-proto/lib/claim_management'; +import { BaseDialogResponseStatus, BaseDialogService } from '@vality/ng-core'; import { coerceBoolean } from 'coerce-property'; import isEmpty from 'lodash-es/isEmpty'; import { BehaviorSubject, switchMap } from 'rxjs'; @@ -12,8 +13,6 @@ import { getModificationName } from '@cc/app/sections/claim/utils/get-modificati import { Patch } from '@cc/app/shared/components/json-viewer'; import { NotificationService } from '@cc/app/shared/services/notification'; import { Color, StatusColor } from '@cc/app/styles'; -import { BaseDialogResponseStatus } from '@cc/components/base-dialog'; -import { BaseDialogService } from '@cc/components/base-dialog/services/base-dialog.service'; import { ConfirmActionDialogComponent } from '@cc/components/confirm-action-dialog'; import { inProgressFrom, progressTo } from '@cc/utils'; import { getUnionValue } from '@cc/utils/get-union-key'; diff --git a/src/app/sections/claim/services/upload-file.service.ts b/src/app/sections/claim/services/upload-file.service.ts index 699119e6..8ff9b3aa 100644 --- a/src/app/sections/claim/services/upload-file.service.ts +++ b/src/app/sections/claim/services/upload-file.service.ts @@ -1,5 +1,6 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; +import { BaseDialogResponseStatus, BaseDialogService } from '@vality/ng-core'; import moment from 'moment'; import { switchMap } from 'rxjs'; import { filter, map } from 'rxjs/operators'; @@ -7,8 +8,6 @@ import { filter, map } from 'rxjs/operators'; import { ClaimManagementService } from '@cc/app/api/claim-management'; import { FileStorageService } from '@cc/app/api/file-storage'; import { NotificationService } from '@cc/app/shared/services/notification'; -import { BaseDialogResponseStatus } from '@cc/components/base-dialog'; -import { BaseDialogService } from '@cc/components/base-dialog/services/base-dialog.service'; import { ConfirmActionDialogComponent } from '@cc/components/confirm-action-dialog'; @Injectable() diff --git a/src/app/sections/party-claims/party-claims.component.ts b/src/app/sections/party-claims/party-claims.component.ts index 163719bb..2afa5d95 100644 --- a/src/app/sections/party-claims/party-claims.component.ts +++ b/src/app/sections/party-claims/party-claims.component.ts @@ -1,10 +1,9 @@ import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; import { MatSnackBar } from '@angular/material/snack-bar'; +import { BaseDialogResponseStatus, BaseDialogService } from '@vality/ng-core'; import { filter } from 'rxjs/operators'; import { ClaimSearchForm } from '@cc/app/shared/components'; -import { BaseDialogResponseStatus } from '@cc/components/base-dialog'; -import { BaseDialogService } from '@cc/components/base-dialog/services/base-dialog.service'; import { ConfirmActionDialogComponent } from '@cc/components/confirm-action-dialog'; import { CreateClaimService } from './create-claim.service'; diff --git a/src/app/sections/payouts/payout-details/payout-details.module.ts b/src/app/sections/payouts/payout-details/payout-details.module.ts index 52eaaf94..eaf5d134 100644 --- a/src/app/sections/payouts/payout-details/payout-details.module.ts +++ b/src/app/sections/payouts/payout-details/payout-details.module.ts @@ -6,6 +6,7 @@ import { MatCardModule } from '@angular/material/card'; import { MatDividerModule } from '@angular/material/divider'; import { MatPaginatorModule } from '@angular/material/paginator'; import { MatTableModule } from '@angular/material/table'; +import { ActionsModule } from '@vality/ng-core'; import { ShopDetailsModule } from '@cc/app/shared/components'; import { PayoutToolDetailsModule } from '@cc/app/shared/components/payout-tool-details/payout-tool-details.module'; @@ -14,7 +15,6 @@ import { DetailsItemModule } from '@cc/components/details-item'; import { EmptySearchResultModule } from '@cc/components/empty-search-result'; import { HeadlineModule } from '@cc/components/headline'; -import { ActionsModule } from '../../../../components/actions'; import { PayoutDetailsRoutingModule } from './payout-details-routing.module'; import { PayoutDetailsComponent } from './payout-details.component'; diff --git a/src/app/sections/payouts/payouts/components/cancel-payout-dialog/cancel-payout-dialog.component.ts b/src/app/sections/payouts/payouts/components/cancel-payout-dialog/cancel-payout-dialog.component.ts index 04708ad9..727a0604 100644 --- a/src/app/sections/payouts/payouts/components/cancel-payout-dialog/cancel-payout-dialog.component.ts +++ b/src/app/sections/payouts/payouts/components/cancel-payout-dialog/cancel-payout-dialog.component.ts @@ -1,6 +1,7 @@ import { Component, Injector } from '@angular/core'; import { FormControl } from '@ngneat/reactive-forms'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; +import { BaseDialogResponseStatus, BaseDialogSuperclass } from '@vality/ng-core'; import { PayoutID } from '@vality/payout-manager-proto'; import { BehaviorSubject } from 'rxjs'; @@ -8,11 +9,6 @@ import { PayoutManagementService } from '@cc/app/api/payout-manager'; import { NotificationService } from '@cc/app/shared/services/notification'; import { progressTo } from '@cc/utils/operators'; -import { - BaseDialogResponseStatus, - BaseDialogSuperclass, -} from '../../../../../../components/base-dialog'; - @UntilDestroy() @Component({ selector: 'cc-cancel-payout-dialog', diff --git a/src/app/sections/payouts/payouts/components/create-payout-dialog/create-payout-dialog.component.ts b/src/app/sections/payouts/payouts/components/create-payout-dialog/create-payout-dialog.component.ts index 2e8ca5db..c0205954 100644 --- a/src/app/sections/payouts/payouts/components/create-payout-dialog/create-payout-dialog.component.ts +++ b/src/app/sections/payouts/payouts/components/create-payout-dialog/create-payout-dialog.component.ts @@ -1,6 +1,7 @@ import { ChangeDetectionStrategy, Component, Injector } from '@angular/core'; import { FormBuilder } from '@ngneat/reactive-forms'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; +import { BaseDialogResponseStatus, BaseDialogSuperclass } from '@vality/ng-core'; import { PayoutParams } from '@vality/payout-manager-proto'; import isNil from 'lodash-es/isNil'; import omitBy from 'lodash-es/omitBy'; @@ -11,11 +12,6 @@ import { NotificationService } from '@cc/app/shared/services/notification'; import { progressTo } from '@cc/utils/operators'; import { toMinor } from '@cc/utils/to-minor'; -import { - BaseDialogResponseStatus, - BaseDialogSuperclass, -} from '../../../../../../components/base-dialog'; - interface CreatePayoutDialogForm { partyId: string; shopId: string; diff --git a/src/app/sections/payouts/payouts/payouts.component.ts b/src/app/sections/payouts/payouts/payouts.component.ts index a3e46029..5b04b648 100644 --- a/src/app/sections/payouts/payouts/payouts.component.ts +++ b/src/app/sections/payouts/payouts/payouts.component.ts @@ -1,13 +1,12 @@ -import { Component, Inject, OnInit } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; import { FormControl } from '@ngneat/reactive-forms'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; +import { BaseDialogService } from '@vality/ng-core'; import omitBy from 'lodash-es/omitBy'; import { QueryParamsService } from '@cc/app/shared/services'; import { isNilOrEmptyString } from '@cc/utils/is-nil-or-empty-string'; -import { BaseDialogService } from '../../../../components/base-dialog/services/base-dialog.service'; -import { DIALOG_CONFIG, DialogConfig } from '../../../tokens'; import { PayoutActionsService } from '../services/payout-actions.service'; import { CreatePayoutDialogComponent } from './components/create-payout-dialog/create-payout-dialog.component'; import { PayoutsSearchForm } from './components/payouts-search-form/payouts-search-form.component'; @@ -29,8 +28,7 @@ export class PayoutsComponent implements OnInit { constructor( private fetchPayoutsService: FetchPayoutsService, private qp: QueryParamsService>, - private baseDialogService: BaseDialogService, - @Inject(DIALOG_CONFIG) private dialogConfig: DialogConfig + private baseDialogService: BaseDialogService ) {} ngOnInit() { diff --git a/src/app/sections/payouts/payouts/payouts.module.ts b/src/app/sections/payouts/payouts/payouts.module.ts index 08c62515..d77f7cdf 100644 --- a/src/app/sections/payouts/payouts/payouts.module.ts +++ b/src/app/sections/payouts/payouts/payouts.module.ts @@ -13,13 +13,13 @@ import { MatMenuModule } from '@angular/material/menu'; import { MatProgressBarModule } from '@angular/material/progress-bar'; import { MatSelectModule } from '@angular/material/select'; import { MatTableModule } from '@angular/material/table'; +import { BaseDialogModule } from '@vality/ng-core'; import { PayoutToolFieldModule, ShopFieldModule, StatusModule } from '@cc/app/shared/components'; import { MerchantFieldModule } from '@cc/app/shared/components/merchant-field'; import { ApiModelPipesModule, CommonPipesModule, ThriftPipesModule } from '@cc/app/shared/pipes'; import { EmptySearchResultModule } from '@cc/components/empty-search-result'; -import { BaseDialogModule } from '../../../../components/base-dialog'; import { CancelPayoutDialogComponent } from './components/cancel-payout-dialog/cancel-payout-dialog.component'; import { CreatePayoutDialogComponent } from './components/create-payout-dialog/create-payout-dialog.component'; import { PayoutsSearchFormComponent } from './components/payouts-search-form/payouts-search-form.component'; diff --git a/src/app/sections/payouts/services/payout-actions.service.ts b/src/app/sections/payouts/services/payout-actions.service.ts index 42c17105..3924a3b2 100644 --- a/src/app/sections/payouts/services/payout-actions.service.ts +++ b/src/app/sections/payouts/services/payout-actions.service.ts @@ -1,11 +1,10 @@ import { Injectable } from '@angular/core'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; import { PayoutID, PayoutStatus } from '@vality/magista-proto'; +import { BaseDialogResponseStatus, BaseDialogService } from '@vality/ng-core'; import { switchMap } from 'rxjs'; import { filter } from 'rxjs/operators'; -import { BaseDialogResponseStatus } from '../../../../components/base-dialog'; -import { BaseDialogService } from '../../../../components/base-dialog/services/base-dialog.service'; import { ConfirmActionDialogComponent } from '../../../../components/confirm-action-dialog'; import { PayoutManagementService } from '../../../api/payout-manager'; import { NotificationService } from '../../../shared/services/notification'; diff --git a/src/app/sections/repairing/components/repair-by-scenario-dialog/repair-by-scenario-dialog.component.ts b/src/app/sections/repairing/components/repair-by-scenario-dialog/repair-by-scenario-dialog.component.ts index eb977ec3..c19201d9 100644 --- a/src/app/sections/repairing/components/repair-by-scenario-dialog/repair-by-scenario-dialog.component.ts +++ b/src/app/sections/repairing/components/repair-by-scenario-dialog/repair-by-scenario-dialog.component.ts @@ -2,13 +2,10 @@ import { Component, Injector } from '@angular/core'; import { Validators } from '@angular/forms'; import { FormControl } from '@ngneat/reactive-forms'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; +import { BaseDialogResponseStatus, BaseDialogSuperclass } from '@vality/ng-core'; import { RepairInvoicesRequest, RepairWithdrawalsRequest } from '@vality/repairer-proto'; import { BehaviorSubject, from } from 'rxjs'; -import { - BaseDialogResponseStatus, - BaseDialogSuperclass, -} from '../../../../../components/base-dialog'; import { progressTo } from '../../../../../utils'; import { RepairManagementService } from '../../../../api/repairer'; import { ErrorService } from '../../../../shared/services/error'; diff --git a/src/app/sections/repairing/repairing.component.ts b/src/app/sections/repairing/repairing.component.ts index 40461e12..38343f35 100644 --- a/src/app/sections/repairing/repairing.component.ts +++ b/src/app/sections/repairing/repairing.component.ts @@ -3,6 +3,7 @@ import { Component, OnInit } from '@angular/core'; import { FormBuilder } from '@angular/forms'; import { DateRange } from '@angular/material/datepicker'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; +import { BaseDialogResponseStatus, BaseDialogService } from '@vality/ng-core'; import { Machine, Namespace, ProviderID, RepairStatus } from '@vality/repairer-proto'; import isEmpty from 'lodash-es/isEmpty'; import isNil from 'lodash-es/isNil'; @@ -10,8 +11,6 @@ import omitBy from 'lodash-es/omitBy'; import { Moment } from 'moment'; import { filter, map, switchMap } from 'rxjs/operators'; -import { BaseDialogResponseStatus } from '../../../components/base-dialog'; -import { BaseDialogService } from '../../../components/base-dialog/services/base-dialog.service'; import { ConfirmActionDialogComponent } from '../../../components/confirm-action-dialog'; import { getEnumKeys } from '../../../utils'; import { RepairManagementService } from '../../api/repairer'; diff --git a/src/app/sections/repairing/repairing.module.ts b/src/app/sections/repairing/repairing.module.ts index bb2836e3..85930e2f 100644 --- a/src/app/sections/repairing/repairing.module.ts +++ b/src/app/sections/repairing/repairing.module.ts @@ -12,9 +12,8 @@ import { MatRadioModule } from '@angular/material/radio'; import { MatSelectModule } from '@angular/material/select'; import { MatTableModule } from '@angular/material/table'; import { MatTooltipModule } from '@angular/material/tooltip'; +import { ActionsModule, BaseDialogModule } from '@vality/ng-core'; -import { ActionsModule } from '../../../components/actions'; -import { BaseDialogModule } from '../../../components/base-dialog'; import { EmptySearchResultModule } from '../../../components/empty-search-result'; import { TableModule } from '../../../components/table'; import { MetadataFormModule } from '../../shared'; diff --git a/src/app/sections/routing-rules/change-delegate-ruleset-dialog/change-delegate-ruleset-dialog.component.ts b/src/app/sections/routing-rules/change-delegate-ruleset-dialog/change-delegate-ruleset-dialog.component.ts index 44e169b2..7d5ff75d 100644 --- a/src/app/sections/routing-rules/change-delegate-ruleset-dialog/change-delegate-ruleset-dialog.component.ts +++ b/src/app/sections/routing-rules/change-delegate-ruleset-dialog/change-delegate-ruleset-dialog.component.ts @@ -1,10 +1,9 @@ import { ChangeDetectionStrategy, Component, Injector, OnInit } from '@angular/core'; import { UntypedFormBuilder } from '@angular/forms'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; +import { BaseDialogSuperclass } from '@vality/ng-core'; import { map } from 'rxjs/operators'; -import { BaseDialogSuperclass } from '@cc/components/base-dialog'; - import { RoutingRulesService } from '../../../thrift-services'; @UntilDestroy() diff --git a/src/app/sections/routing-rules/change-delegate-ruleset-dialog/change-delegate-ruleset-dialog.module.ts b/src/app/sections/routing-rules/change-delegate-ruleset-dialog/change-delegate-ruleset-dialog.module.ts index 32f5bfaf..dc09cc70 100644 --- a/src/app/sections/routing-rules/change-delegate-ruleset-dialog/change-delegate-ruleset-dialog.module.ts +++ b/src/app/sections/routing-rules/change-delegate-ruleset-dialog/change-delegate-ruleset-dialog.module.ts @@ -5,8 +5,7 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; import { MatInputModule } from '@angular/material/input'; import { MatSelectModule } from '@angular/material/select'; - -import { BaseDialogModule } from '@cc/components/base-dialog'; +import { BaseDialogModule } from '@vality/ng-core'; import { ChangeDelegateRulesetDialogComponent } from './change-delegate-ruleset-dialog.component'; diff --git a/src/app/sections/routing-rules/change-target-dialog/change-target-dialog.component.ts b/src/app/sections/routing-rules/change-target-dialog/change-target-dialog.component.ts index 9ca284cc..07817721 100644 --- a/src/app/sections/routing-rules/change-target-dialog/change-target-dialog.component.ts +++ b/src/app/sections/routing-rules/change-target-dialog/change-target-dialog.component.ts @@ -1,9 +1,9 @@ import { ChangeDetectionStrategy, Component, Injector } from '@angular/core'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; +import { BaseDialogSuperclass } from '@vality/ng-core'; import { BehaviorSubject } from 'rxjs'; import { RoutingRulesType } from '@cc/app/sections/routing-rules/types/routing-rules-type'; -import { BaseDialogSuperclass } from '@cc/components/base-dialog'; import { ErrorService } from '../../../shared/services/error'; import { RoutingRulesService } from '../../../thrift-services'; diff --git a/src/app/sections/routing-rules/change-target-dialog/change-target-dialog.module.ts b/src/app/sections/routing-rules/change-target-dialog/change-target-dialog.module.ts index e5e04875..79b7e5d9 100644 --- a/src/app/sections/routing-rules/change-target-dialog/change-target-dialog.module.ts +++ b/src/app/sections/routing-rules/change-target-dialog/change-target-dialog.module.ts @@ -3,8 +3,7 @@ import { NgModule } from '@angular/core'; import { FlexLayoutModule } from '@angular/flex-layout'; import { MatButtonModule } from '@angular/material/button'; import { MatDialogModule } from '@angular/material/dialog'; - -import { BaseDialogModule } from '@cc/components/base-dialog'; +import { BaseDialogModule } from '@vality/ng-core'; import { TargetRulesetFormModule } from '../target-ruleset-form'; import { ChangeTargetDialogComponent } from './change-target-dialog.component'; diff --git a/src/app/sections/routing-rules/party-delegate-rulesets/attach-new-ruleset-dialog/attach-new-ruleset-dialog.component.ts b/src/app/sections/routing-rules/party-delegate-rulesets/attach-new-ruleset-dialog/attach-new-ruleset-dialog.component.ts index ea7085ee..63578a48 100644 --- a/src/app/sections/routing-rules/party-delegate-rulesets/attach-new-ruleset-dialog/attach-new-ruleset-dialog.component.ts +++ b/src/app/sections/routing-rules/party-delegate-rulesets/attach-new-ruleset-dialog/attach-new-ruleset-dialog.component.ts @@ -1,10 +1,10 @@ import { ChangeDetectionStrategy, Component, Injector } from '@angular/core'; import { UntypedFormBuilder } from '@angular/forms'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; +import { BaseDialogSuperclass } from '@vality/ng-core'; import { BehaviorSubject } from 'rxjs'; import { RoutingRulesType } from '@cc/app/sections/routing-rules/types/routing-rules-type'; -import { BaseDialogSuperclass } from '@cc/components/base-dialog'; import { ErrorService } from '../../../../shared/services/error'; import { RoutingRulesService } from '../../../../thrift-services'; diff --git a/src/app/sections/routing-rules/party-delegate-rulesets/party-delegate-rulesets.component.ts b/src/app/sections/routing-rules/party-delegate-rulesets/party-delegate-rulesets.component.ts index 75678e2d..36988aa6 100644 --- a/src/app/sections/routing-rules/party-delegate-rulesets/party-delegate-rulesets.component.ts +++ b/src/app/sections/routing-rules/party-delegate-rulesets/party-delegate-rulesets.component.ts @@ -1,10 +1,10 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; +import { BaseDialogService } from '@vality/ng-core'; import { first, map } from 'rxjs/operators'; import { RoutingRulesType } from '@cc/app/sections/routing-rules/types/routing-rules-type'; -import { BaseDialogService } from '@cc/components/base-dialog/services/base-dialog.service'; import { handleError } from '../../../../utils/operators/handle-error'; import { ErrorService } from '../../../shared/services/error'; diff --git a/src/app/sections/routing-rules/party-delegate-rulesets/party-delegate-rulesets.module.ts b/src/app/sections/routing-rules/party-delegate-rulesets/party-delegate-rulesets.module.ts index 0665e591..5c18aa50 100644 --- a/src/app/sections/routing-rules/party-delegate-rulesets/party-delegate-rulesets.module.ts +++ b/src/app/sections/routing-rules/party-delegate-rulesets/party-delegate-rulesets.module.ts @@ -14,8 +14,8 @@ import { MatProgressBarModule } from '@angular/material/progress-bar'; import { MatRadioModule } from '@angular/material/radio'; import { MatSelectModule } from '@angular/material/select'; import { RouterModule } from '@angular/router'; +import { BaseDialogModule } from '@vality/ng-core'; -import { BaseDialogModule } from '@cc/components/base-dialog'; import { DetailsItemModule } from '@cc/components/details-item'; import { ChangeTargetDialogModule } from '../change-target-dialog'; diff --git a/src/app/sections/routing-rules/party-routing-ruleset/add-party-routing-rule-dialog/add-party-routing-rule-dialog.component.ts b/src/app/sections/routing-rules/party-routing-ruleset/add-party-routing-rule-dialog/add-party-routing-rule-dialog.component.ts index 7a7cdbee..97a469c7 100644 --- a/src/app/sections/routing-rules/party-routing-ruleset/add-party-routing-rule-dialog/add-party-routing-rule-dialog.component.ts +++ b/src/app/sections/routing-rules/party-routing-ruleset/add-party-routing-rule-dialog/add-party-routing-rule-dialog.component.ts @@ -3,8 +3,7 @@ import { FormBuilder } from '@ngneat/reactive-forms'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; import { Shop } from '@vality/domain-proto/lib/domain'; import { StatWallet } from '@vality/fistful-proto/lib/fistful_stat'; - -import { BaseDialogResponseStatus, BaseDialogSuperclass } from '@cc/components/base-dialog'; +import { BaseDialogResponseStatus, BaseDialogSuperclass } from '@vality/ng-core'; import { ErrorService } from '../../../../shared/services/error'; import { RoutingRulesService } from '../../../../thrift-services'; diff --git a/src/app/sections/routing-rules/party-routing-ruleset/add-party-routing-rule-dialog/add-party-routing-rule-dialog.module.ts b/src/app/sections/routing-rules/party-routing-ruleset/add-party-routing-rule-dialog/add-party-routing-rule-dialog.module.ts index f9a03285..5490d268 100644 --- a/src/app/sections/routing-rules/party-routing-ruleset/add-party-routing-rule-dialog/add-party-routing-rule-dialog.module.ts +++ b/src/app/sections/routing-rules/party-routing-ruleset/add-party-routing-rule-dialog/add-party-routing-rule-dialog.module.ts @@ -11,8 +11,7 @@ import { MatIconModule } from '@angular/material/icon'; import { MatInputModule } from '@angular/material/input'; import { MatRadioModule } from '@angular/material/radio'; import { MatSelectModule } from '@angular/material/select'; - -import { BaseDialogModule } from '@cc/components/base-dialog'; +import { BaseDialogModule } from '@vality/ng-core'; import { AddPartyRoutingRuleDialogComponent } from './add-party-routing-rule-dialog.component'; diff --git a/src/app/sections/routing-rules/party-routing-ruleset/initialize-routing-rules-dialog/initialize-routing-rules-dialog.component.ts b/src/app/sections/routing-rules/party-routing-ruleset/initialize-routing-rules-dialog/initialize-routing-rules-dialog.component.ts index ab8a9b0f..1489f224 100644 --- a/src/app/sections/routing-rules/party-routing-ruleset/initialize-routing-rules-dialog/initialize-routing-rules-dialog.component.ts +++ b/src/app/sections/routing-rules/party-routing-ruleset/initialize-routing-rules-dialog/initialize-routing-rules-dialog.component.ts @@ -1,8 +1,7 @@ import { Component, Injector } from '@angular/core'; import { UntypedFormBuilder } from '@angular/forms'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; - -import { BaseDialogSuperclass } from '@cc/components/base-dialog'; +import { BaseDialogSuperclass } from '@vality/ng-core'; import { ErrorService } from '../../../../shared/services/error'; import { RoutingRulesService } from '../../../../thrift-services'; diff --git a/src/app/sections/routing-rules/party-routing-ruleset/initialize-routing-rules-dialog/initialize-routing-rules-dialog.module.ts b/src/app/sections/routing-rules/party-routing-ruleset/initialize-routing-rules-dialog/initialize-routing-rules-dialog.module.ts index 34551cd4..9615fdc1 100644 --- a/src/app/sections/routing-rules/party-routing-ruleset/initialize-routing-rules-dialog/initialize-routing-rules-dialog.module.ts +++ b/src/app/sections/routing-rules/party-routing-ruleset/initialize-routing-rules-dialog/initialize-routing-rules-dialog.module.ts @@ -11,8 +11,7 @@ import { MatIconModule } from '@angular/material/icon'; import { MatInputModule } from '@angular/material/input'; import { MatRadioModule } from '@angular/material/radio'; import { MatSelectModule } from '@angular/material/select'; - -import { BaseDialogModule } from '@cc/components/base-dialog'; +import { BaseDialogModule } from '@vality/ng-core'; import { InitializeRoutingRulesDialogComponent } from './initialize-routing-rules-dialog.component'; diff --git a/src/app/sections/routing-rules/party-routing-ruleset/party-routing-ruleset.component.ts b/src/app/sections/routing-rules/party-routing-ruleset/party-routing-ruleset.component.ts index 83f2d029..1086d2b3 100644 --- a/src/app/sections/routing-rules/party-routing-ruleset/party-routing-ruleset.component.ts +++ b/src/app/sections/routing-rules/party-routing-ruleset/party-routing-ruleset.component.ts @@ -1,12 +1,10 @@ import { Component } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; +import { BaseDialogService, BaseDialogResponseStatus } from '@vality/ng-core'; import { combineLatest, Observable } from 'rxjs'; import { filter, map, pluck, shareReplay, startWith, switchMap, take } from 'rxjs/operators'; -import { BaseDialogService } from '@cc/components/base-dialog/services/base-dialog.service'; - -import { BaseDialogResponseStatus } from '../../../../components/base-dialog'; import { DomainStoreService } from '../../../thrift-services/damsel/domain-store.service'; import { RoutingRulesType } from '../types/routing-rules-type'; import { AddPartyRoutingRuleDialogComponent } from './add-party-routing-rule-dialog'; diff --git a/src/app/sections/routing-rules/routing-rules-list/routing-rules-list.component.ts b/src/app/sections/routing-rules/routing-rules-list/routing-rules-list.component.ts index f92b5bbd..7076b1a4 100644 --- a/src/app/sections/routing-rules/routing-rules-list/routing-rules-list.component.ts +++ b/src/app/sections/routing-rules/routing-rules-list/routing-rules-list.component.ts @@ -10,12 +10,10 @@ import { MatPaginator } from '@angular/material/paginator'; import { MatTableDataSource } from '@angular/material/table'; import { ActivatedRoute } from '@angular/router'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; +import { BaseDialogResponseStatus, BaseDialogService } from '@vality/ng-core'; import { combineLatest, defer, ReplaySubject } from 'rxjs'; import { filter, map, shareReplay, startWith, switchMap } from 'rxjs/operators'; -import { BaseDialogResponseStatus } from '@cc/components/base-dialog'; -import { BaseDialogService } from '@cc/components/base-dialog/services/base-dialog.service'; - import { ConfirmActionDialogComponent } from '../../../../components/confirm-action-dialog'; import { handleError } from '../../../../utils/operators/handle-error'; import { ErrorService } from '../../../shared/services/error'; diff --git a/src/app/sections/routing-rules/routing-ruleset/add-routing-rule-dialog/add-routing-rule-dialog.component.ts b/src/app/sections/routing-rules/routing-ruleset/add-routing-rule-dialog/add-routing-rule-dialog.component.ts index d22e553d..4e0ef657 100644 --- a/src/app/sections/routing-rules/routing-ruleset/add-routing-rule-dialog/add-routing-rule-dialog.component.ts +++ b/src/app/sections/routing-rules/routing-ruleset/add-routing-rule-dialog/add-routing-rule-dialog.component.ts @@ -3,8 +3,7 @@ import { Validators } from '@angular/forms'; import { FormBuilder } from '@ngneat/reactive-forms'; import { UntilDestroy } from '@ngneat/until-destroy'; import { Predicate, RiskScore } from '@vality/domain-proto/lib/domain'; - -import { BaseDialogSuperclass } from '@cc/components/base-dialog'; +import { BaseDialogSuperclass } from '@vality/ng-core'; import { DomainStoreService } from '../../../../thrift-services/damsel/domain-store.service'; import { AddRoutingRuleDialogService, TerminalType } from './add-routing-rule-dialog.service'; diff --git a/src/app/sections/routing-rules/routing-ruleset/add-routing-rule-dialog/add-routing-rule-dialog.module.ts b/src/app/sections/routing-rules/routing-ruleset/add-routing-rule-dialog/add-routing-rule-dialog.module.ts index 2b133fd9..818fadeb 100644 --- a/src/app/sections/routing-rules/routing-ruleset/add-routing-rule-dialog/add-routing-rule-dialog.module.ts +++ b/src/app/sections/routing-rules/routing-ruleset/add-routing-rule-dialog/add-routing-rule-dialog.module.ts @@ -11,9 +11,9 @@ import { MatIconModule } from '@angular/material/icon'; import { MatInputModule } from '@angular/material/input'; import { MatRadioModule } from '@angular/material/radio'; import { MatSelectModule } from '@angular/material/select'; +import { BaseDialogModule } from '@vality/ng-core'; import { MetadataFormModule } from '@cc/app/shared'; -import { BaseDialogModule } from '@cc/components/base-dialog'; import { AddRoutingRuleDialogComponent } from './add-routing-rule-dialog.component'; import { ExpanderComponent } from './expander'; diff --git a/src/app/sections/routing-rules/routing-ruleset/add-routing-rule-dialog/add-routing-rule-dialog.service.ts b/src/app/sections/routing-rules/routing-ruleset/add-routing-rule-dialog/add-routing-rule-dialog.service.ts index 83cc5623..50767e3b 100644 --- a/src/app/sections/routing-rules/routing-ruleset/add-routing-rule-dialog/add-routing-rule-dialog.service.ts +++ b/src/app/sections/routing-rules/routing-ruleset/add-routing-rule-dialog/add-routing-rule-dialog.service.ts @@ -2,11 +2,10 @@ import { Injectable } from '@angular/core'; import { UntypedFormArray, UntypedFormBuilder, Validators } from '@angular/forms'; import { MatDialogRef } from '@angular/material/dialog'; import { Predicate } from '@vality/domain-proto/lib/domain'; +import { BaseDialogResponseStatus } from '@vality/ng-core'; import { of } from 'rxjs'; import { startWith, switchMap, take } from 'rxjs/operators'; -import { BaseDialogResponseStatus } from '@cc/components/base-dialog'; - import { RoutingRulesService } from '../../../../thrift-services'; import { AddRoutingRuleDialogComponent } from './add-routing-rule-dialog.component'; diff --git a/src/app/sections/routing-rules/routing-ruleset/routing-ruleset.component.ts b/src/app/sections/routing-rules/routing-ruleset/routing-ruleset.component.ts index fe0f7c54..98d10229 100644 --- a/src/app/sections/routing-rules/routing-ruleset/routing-ruleset.component.ts +++ b/src/app/sections/routing-rules/routing-ruleset/routing-ruleset.component.ts @@ -2,14 +2,13 @@ import { Component } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; import { Predicate, TerminalObject } from '@vality/domain-proto/lib/domain'; +import { BaseDialogResponseStatus, BaseDialogService } from '@vality/ng-core'; import { Observable } from 'rxjs'; import { first, map, pluck, shareReplay, switchMap } from 'rxjs/operators'; import { objectToJSON } from '@cc/app/api/utils'; import { RoutingRulesType } from '@cc/app/sections/routing-rules/types/routing-rules-type'; import { NotificationService } from '@cc/app/shared/services/notification'; -import { BaseDialogResponseStatus } from '@cc/components/base-dialog'; -import { BaseDialogService } from '@cc/components/base-dialog/services/base-dialog.service'; import { ErrorService } from '../../../shared/services/error'; import { damselInstanceToObject } from '../../../thrift-services'; diff --git a/src/app/sections/withdrawals/components/create-adjustment-dialog/create-adjustment-dialog.component.ts b/src/app/sections/withdrawals/components/create-adjustment-dialog/create-adjustment-dialog.component.ts index ebff197c..d4e15a8e 100644 --- a/src/app/sections/withdrawals/components/create-adjustment-dialog/create-adjustment-dialog.component.ts +++ b/src/app/sections/withdrawals/components/create-adjustment-dialog/create-adjustment-dialog.component.ts @@ -5,14 +5,11 @@ import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; import { ExternalID } from '@vality/fistful-proto/lib/base'; import { StatWithdrawal } from '@vality/fistful-proto/lib/fistful_stat'; import { Status } from '@vality/fistful-proto/lib/withdrawal'; +import { BaseDialogResponseStatus, BaseDialogSuperclass } from '@vality/ng-core'; import { combineLatest, from, of } from 'rxjs'; import { catchError, finalize } from 'rxjs/operators'; import * as short from 'short-uuid'; -import { - BaseDialogResponseStatus, - BaseDialogSuperclass, -} from '../../../../../components/base-dialog'; import { ManagementService } from '../../../../api/withdrawal'; import { MetadataFormExtension } from '../../../../shared'; import { ErrorService } from '../../../../shared/services/error'; diff --git a/src/app/sections/withdrawals/withdrawals.component.ts b/src/app/sections/withdrawals/withdrawals.component.ts index d6e8cbed..48c3d902 100644 --- a/src/app/sections/withdrawals/withdrawals.component.ts +++ b/src/app/sections/withdrawals/withdrawals.component.ts @@ -6,11 +6,10 @@ import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; import { omitBy } from '@s-libs/micro-dash'; import { PartyID } from '@vality/domain-proto'; import { StatWithdrawal } from '@vality/fistful-proto/lib/fistful_stat'; +import { BaseDialogResponseStatus, BaseDialogService } from '@vality/ng-core'; import { Moment } from 'moment'; import { map } from 'rxjs/operators'; -import { BaseDialogResponseStatus } from '../../../components/base-dialog'; -import { BaseDialogService } from '../../../components/base-dialog/services/base-dialog.service'; import { SELECT_COLUMN_NAME } from '../../../components/table'; import { isNilOrEmptyString } from '../../../utils'; import { WithdrawalParams } from '../../query-dsl'; diff --git a/src/app/sections/withdrawals/withdrawals.module.ts b/src/app/sections/withdrawals/withdrawals.module.ts index a98084be..b5d6d48f 100644 --- a/src/app/sections/withdrawals/withdrawals.module.ts +++ b/src/app/sections/withdrawals/withdrawals.module.ts @@ -12,8 +12,8 @@ import { MatRadioModule } from '@angular/material/radio'; import { MatSelectModule } from '@angular/material/select'; import { MatSortModule } from '@angular/material/sort'; import { MatTableModule } from '@angular/material/table'; +import { BaseDialogModule } from '@vality/ng-core'; -import { BaseDialogModule } from '../../../components/base-dialog'; import { EmptySearchResultModule } from '../../../components/empty-search-result'; import { TableModule } from '../../../components/table'; import { MetadataFormModule, ThriftPipesModule } from '../../shared'; diff --git a/src/app/tokens.ts b/src/app/tokens.ts index 829419db..1c181058 100644 --- a/src/app/tokens.ts +++ b/src/app/tokens.ts @@ -1,7 +1,6 @@ import { InjectionToken } from '@angular/core'; import { MatDateFormats } from '@angular/material/core'; import { DateRange } from '@angular/material/datepicker'; -import { MatDialogConfig } from '@angular/material/dialog'; import { Moment } from 'moment'; import * as moment from 'moment'; @@ -13,23 +12,6 @@ export const DEFAULT_SEARCH_LIMIT = 10; export const SMALL_SEARCH_LIMIT = new InjectionToken('smallSearchLimit'); export const DEFAULT_SMALL_SEARCH_LIMIT = 5; -export type DialogConfig = { - small: MatDialogConfig; - medium: MatDialogConfig; - large: MatDialogConfig; -}; -export const DIALOG_CONFIG = new InjectionToken('dialogConfig'); -const BASE_CONFIG: MatDialogConfig = { - maxHeight: '90vh', - disableClose: true, - autoFocus: false, -}; -export const DEFAULT_DIALOG_CONFIG: DialogConfig = { - small: { ...BASE_CONFIG, width: '360px' }, - medium: { ...BASE_CONFIG, width: '552px' }, - large: { ...BASE_CONFIG, width: '648px' }, -}; - export const DEFAULT_QUERY_PARAMS_SERIALIZERS: Serializer[] = [ { id: 'moment', diff --git a/src/components/actions/index.ts b/src/components/actions/index.ts deleted file mode 100644 index 06e591b9..00000000 --- a/src/components/actions/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './actions.module'; diff --git a/src/components/base-dialog/index.ts b/src/components/base-dialog/index.ts deleted file mode 100644 index af8ddb7e..00000000 --- a/src/components/base-dialog/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './base-dialog.module'; -export * from './types/base-dialog-response-status'; -export * from './types/base-dialog-response'; -export * from './utils/base-dialog-superclass'; diff --git a/src/components/confirm-action-dialog/confirm-action-dialog.component.ts b/src/components/confirm-action-dialog/confirm-action-dialog.component.ts index 79c3eb90..ca6d1fdc 100644 --- a/src/components/confirm-action-dialog/confirm-action-dialog.component.ts +++ b/src/components/confirm-action-dialog/confirm-action-dialog.component.ts @@ -1,6 +1,5 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; - -import { BaseDialogResponseStatus, BaseDialogSuperclass } from '@cc/components/base-dialog'; +import { BaseDialogResponseStatus, BaseDialogSuperclass } from '@vality/ng-core'; @Component({ selector: 'cc-confirm-action-dialog', diff --git a/src/components/confirm-action-dialog/confirm-action-dialog.module.ts b/src/components/confirm-action-dialog/confirm-action-dialog.module.ts index d55c7c77..2426f007 100644 --- a/src/components/confirm-action-dialog/confirm-action-dialog.module.ts +++ b/src/components/confirm-action-dialog/confirm-action-dialog.module.ts @@ -2,8 +2,7 @@ import { NgModule } from '@angular/core'; import { FlexLayoutModule } from '@angular/flex-layout'; import { MatButtonModule } from '@angular/material/button'; import { MatDialogModule } from '@angular/material/dialog'; - -import { BaseDialogModule } from '@cc/components/base-dialog'; +import { BaseDialogModule } from '@vality/ng-core'; import { ConfirmActionDialogComponent } from './confirm-action-dialog.component'; diff --git a/tsconfig.json b/tsconfig.json index 6f037e28..e25a9dd9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,8 +19,8 @@ "skipLibCheck": false, "paths": { "@cc/*": ["src/*"], - "thrift": ["node_modules/@vality/woody/dist/thrift"], - "node-int64": ["node_modules/@vality/thrift-ts/lib/int64"] + "@vality/ng-core": ["dist/ng-core"], + "thrift": ["node_modules/@vality/woody/dist/thrift"] } }, "angularCompilerOptions": { From 26716d7c8a8d58696b6f7e30ae22c43ca0fd24d8 Mon Sep 17 00:00:00 2001 From: Rinat Arsaev <11846445+KrickRay@users.noreply.github.com> Date: Mon, 8 Aug 2022 20:40:04 +0300 Subject: [PATCH 4/9] TD-361: Remove old claim pages (#120) --- .../sections/claim/claim-routing.module.ts | 2 +- src/app/sections/claim/claim.module.ts | 8 +- .../timeline-item-header.component.html | 0 .../timeline-item-header.component.scss | 0 .../timeline-item-header.component.ts | 0 .../_timeline-item-loading-theme.scss | 0 .../timeline-item-loading.component.html | 0 .../timeline-item-loading.component.ts | 0 .../party-claim/_party-claim-theme.scss | 7 - .../changeset-infos/changeset-info.ts | 27 ---- .../changeset/changeset-infos/index.ts | 2 - .../changeset-infos/mark-outdated.ts | 9 -- .../changeset/changeset-infos/mark-removed.ts | 9 -- .../changeset-infos/to-changeset-infos.ts | 43 ------ .../to-comment-modification-changeset-info.ts | 38 ------ ...to-document-modification-changeset-info.ts | 23 ---- .../to-file-modification-changeset-info.ts | 38 ------ .../to-party-modification-changeset-info.ts | 31 ----- .../to-status-modification-changeset-info.ts | 17 --- .../changesets-filter.component.html | 35 ----- .../changesets-filter.component.scss | 3 - .../changesets-filter.component.ts | 31 ----- .../changesets-filter.module.ts | 14 -- .../changesets-filter.service.ts | 42 ------ .../changeset/changesets-filter/index.ts | 1 - .../changesets-filter/infos-filter.ts | 13 -- .../claim-changeset.component.html | 39 ------ .../claim-changeset.component.ts | 53 -------- .../claim-changeset/claim-changeset.module.ts | 38 ------ .../claim-changeset.service.ts | 30 ----- .../create-delete-comment-modification.ts | 14 -- .../create-delete-file-modification.ts | 14 -- .../sections/party-claim/changeset/index.ts | 2 - .../changeset/timeline-components/index.ts | 1 - .../timeline-components.module.ts | 23 ---- .../timeline-item-error.component.html | 1 - .../timeline-item-error.component.ts | 11 -- .../comment-action-icon.pipe.ts | 17 --- .../comment-badge-color.pipe.ts | 17 --- .../comment-content.component.html | 5 - .../comment-content.component.ts | 10 -- .../comment-header.pipe.ts | 17 --- .../comment-timeline-item.component.html | 39 ------ .../comment-timeline-item.component.ts | 30 ----- .../comment-timeline-item.module.ts | 40 ------ .../comment-timeline-item.service.ts | 41 ------ .../created-timeline-item.component.html | 12 -- .../created-timeline-item.component.ts | 11 -- .../created-timeline-item.module.ts | 14 -- .../created-timeline-item/index.ts | 1 - .../file-timeline-item/download.ts | 15 --- .../file-action-icon.pipe.ts | 17 --- .../file-badge-color.pipe.ts | 17 --- .../file-content/file-content.component.html | 8 -- .../file-content/file-content.component.scss | 3 - .../file-content/file-content.component.ts | 22 ---- .../file-timeline-item/file-header.pipe.ts | 17 --- .../file-timeline-item.component.html | 34 ----- .../file-timeline-item.component.ts | 36 ------ .../file-timeline-item.module.ts | 40 ------ .../file-timeline-item.service.ts | 60 --------- .../changeset/timeline-items/menu-config.ts | 14 -- .../party-modification-timeline-item/index.ts | 1 - .../party-modification-content.component.html | 6 - .../party-modification-content.component.ts | 14 -- ...-modification-timeline-item.component.html | 30 ----- ...ty-modification-timeline-item.component.ts | 17 --- ...party-modification-timeline-item.module.ts | 35 ----- .../reason-content.component.html | 5 - .../reason-content.component.ts | 10 -- .../status-action-icon.pipe.ts | 25 ---- .../status-badge-color.pipe.ts | 21 --- .../status-header.pipe.ts | 25 ---- .../status-timeline-item.component.html | 27 ---- .../status-timeline-item.component.ts | 18 --- .../status-timeline-item.module.ts | 40 ------ .../timeline-items/timelime-item.component.ts | 19 --- .../edit-claim-changeset.service.ts | 31 ----- .../edit-unsaved-modification.component.html | 106 --------------- .../edit-unsaved-modification.component.ts | 42 ------ .../edit-unsaved-modification.module.ts | 22 ---- .../prepare-modification-to-edit.ts | 15 --- .../save-claim-changeset.service.ts | 40 ------ .../unsaved-claim-changeset.component.html | 40 ------ .../unsaved-claim-changeset.component.ts | 82 ------------ .../unsaved-claim-changeset.module.ts | 31 ----- .../unsaved-claim-changeset.service.ts | 117 ----------------- .../party-claim/fetch-claim.service.ts | 45 ------- src/app/sections/party-claim/index.ts | 1 - .../file-uploader.component.html | 5 - .../file-uploader.component.scss | 3 - .../file-uploader/file-uploader.component.ts | 28 ---- .../file-uploader/file-uploader.module.ts | 15 --- .../file-uploader/file-uploader.service.ts | 90 ------------- .../party-claim/party-claim-actions/index.ts | 1 - .../party-claim-actions.component.html | 12 -- .../party-claim-actions.component.ts | 77 ----------- .../party-claim-actions.module.ts | 23 ---- .../party-claim-actions/send-comment/index.ts | 1 - .../send-comment/send-comment.component.html | 16 --- .../send-comment/send-comment.component.scss | 7 - .../send-comment/send-comment.component.ts | 25 ---- .../send-comment/send-comment.module.ts | 25 ---- .../send-comment/send-comment.service.ts | 98 -------------- .../get-available-claim-statuses.ts | 26 ---- .../status-changer/index.ts | 2 - .../status-changer-dialog.component.html | 41 ------ .../status-changer-dialog.component.scss | 3 - .../status-changer-dialog.component.ts | 81 ------------ .../status-changer-dialog.service.ts | 122 ------------------ .../status-changer/status-changer.module.ts | 35 ----- .../status-changer/status-changer.service.ts | 54 -------- .../party-claim/party-claim-routing.module.ts | 22 ---- .../_party-claim-title-theme.scss | 9 -- .../party-claim-title.component.html | 6 - .../party-claim-title.component.ts | 15 --- .../party-claim/party-claim.component.html | 33 ----- .../party-claim/party-claim.component.ts | 38 ------ .../party-claim/party-claim.module.ts | 44 ------- .../claims-table/claims-table.component.html | 47 ------- .../claims-table/claims-table.component.scss | 7 - .../claims-table/claims-table.component.ts | 27 ---- .../party-claims/create-claim.service.ts | 44 ------- src/app/sections/party-claims/index.ts | 1 - .../party-claims-routing.module.ts | 22 ---- .../party-claims/party-claims.component.html | 34 ----- .../party-claims/party-claims.component.ts | 52 -------- .../party-claims/party-claims.module.ts | 45 ------- .../party-claims/party-claims.service.ts | 49 ------- .../sections/party/party-routing.module.ts | 10 -- src/app/sections/party/party.component.ts | 7 - .../search-table/search-table.component.html | 10 -- .../search-table/search-table.component.ts | 8 -- src/app/styles/themes/_theme.scss | 2 - 134 files changed, 7 insertions(+), 3336 deletions(-) rename src/app/sections/{party-claim/changeset/timeline-components => claim/components}/timeline-item-header/timeline-item-header.component.html (100%) rename src/app/sections/{party-claim/changeset/timeline-components => claim/components}/timeline-item-header/timeline-item-header.component.scss (100%) rename src/app/sections/{party-claim/changeset/timeline-components => claim/components}/timeline-item-header/timeline-item-header.component.ts (100%) rename src/app/sections/{party-claim/changeset/timeline-components => claim/components}/timeline-item-loading/_timeline-item-loading-theme.scss (100%) rename src/app/sections/{party-claim/changeset/timeline-components => claim/components}/timeline-item-loading/timeline-item-loading.component.html (100%) rename src/app/sections/{party-claim/changeset/timeline-components => claim/components}/timeline-item-loading/timeline-item-loading.component.ts (100%) delete mode 100644 src/app/sections/party-claim/_party-claim-theme.scss delete mode 100644 src/app/sections/party-claim/changeset/changeset-infos/changeset-info.ts delete mode 100644 src/app/sections/party-claim/changeset/changeset-infos/index.ts delete mode 100644 src/app/sections/party-claim/changeset/changeset-infos/mark-outdated.ts delete mode 100644 src/app/sections/party-claim/changeset/changeset-infos/mark-removed.ts delete mode 100644 src/app/sections/party-claim/changeset/changeset-infos/to-changeset-infos.ts delete mode 100644 src/app/sections/party-claim/changeset/changeset-infos/to-comment-modification-changeset-info.ts delete mode 100644 src/app/sections/party-claim/changeset/changeset-infos/to-document-modification-changeset-info.ts delete mode 100644 src/app/sections/party-claim/changeset/changeset-infos/to-file-modification-changeset-info.ts delete mode 100644 src/app/sections/party-claim/changeset/changeset-infos/to-party-modification-changeset-info.ts delete mode 100644 src/app/sections/party-claim/changeset/changeset-infos/to-status-modification-changeset-info.ts delete mode 100644 src/app/sections/party-claim/changeset/changesets-filter/changesets-filter.component.html delete mode 100644 src/app/sections/party-claim/changeset/changesets-filter/changesets-filter.component.scss delete mode 100644 src/app/sections/party-claim/changeset/changesets-filter/changesets-filter.component.ts delete mode 100644 src/app/sections/party-claim/changeset/changesets-filter/changesets-filter.module.ts delete mode 100644 src/app/sections/party-claim/changeset/changesets-filter/changesets-filter.service.ts delete mode 100644 src/app/sections/party-claim/changeset/changesets-filter/index.ts delete mode 100644 src/app/sections/party-claim/changeset/changesets-filter/infos-filter.ts delete mode 100644 src/app/sections/party-claim/changeset/claim-changeset/claim-changeset.component.html delete mode 100644 src/app/sections/party-claim/changeset/claim-changeset/claim-changeset.component.ts delete mode 100644 src/app/sections/party-claim/changeset/claim-changeset/claim-changeset.module.ts delete mode 100644 src/app/sections/party-claim/changeset/claim-changeset/claim-changeset.service.ts delete mode 100644 src/app/sections/party-claim/changeset/claim-changeset/create-delete-comment-modification.ts delete mode 100644 src/app/sections/party-claim/changeset/claim-changeset/create-delete-file-modification.ts delete mode 100644 src/app/sections/party-claim/changeset/index.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-components/index.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-components/timeline-components.module.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-components/timeline-item-error/timeline-item-error.component.html delete mode 100644 src/app/sections/party-claim/changeset/timeline-components/timeline-item-error/timeline-item-error.component.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-action-icon.pipe.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-badge-color.pipe.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-content/comment-content.component.html delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-content/comment-content.component.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-header.pipe.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-timeline-item.component.html delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-timeline-item.component.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-timeline-item.module.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-timeline-item.service.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/created-timeline-item/created-timeline-item.component.html delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/created-timeline-item/created-timeline-item.component.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/created-timeline-item/created-timeline-item.module.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/created-timeline-item/index.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/download.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-action-icon.pipe.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-badge-color.pipe.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-content/file-content.component.html delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-content/file-content.component.scss delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-content/file-content.component.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-header.pipe.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-timeline-item.component.html delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-timeline-item.component.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-timeline-item.module.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-timeline-item.service.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/menu-config.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/party-modification-timeline-item/index.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/party-modification-timeline-item/party-modification-content/party-modification-content.component.html delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/party-modification-timeline-item/party-modification-content/party-modification-content.component.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/party-modification-timeline-item/party-modification-timeline-item.component.html delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/party-modification-timeline-item/party-modification-timeline-item.component.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/party-modification-timeline-item/party-modification-timeline-item.module.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/reason-content/reason-content.component.html delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/reason-content/reason-content.component.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/status-action-icon.pipe.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/status-badge-color.pipe.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/status-header.pipe.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/status-timeline-item.component.html delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/status-timeline-item.component.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/status-timeline-item.module.ts delete mode 100644 src/app/sections/party-claim/changeset/timeline-items/timelime-item.component.ts delete mode 100644 src/app/sections/party-claim/changeset/unsaved-changeset/edit-claim-changeset.service.ts delete mode 100644 src/app/sections/party-claim/changeset/unsaved-changeset/edit-unsaved-modification/edit-unsaved-modification.component.html delete mode 100644 src/app/sections/party-claim/changeset/unsaved-changeset/edit-unsaved-modification/edit-unsaved-modification.component.ts delete mode 100644 src/app/sections/party-claim/changeset/unsaved-changeset/edit-unsaved-modification/edit-unsaved-modification.module.ts delete mode 100644 src/app/sections/party-claim/changeset/unsaved-changeset/prepare-modification-to-edit.ts delete mode 100644 src/app/sections/party-claim/changeset/unsaved-changeset/save-claim-changeset.service.ts delete mode 100644 src/app/sections/party-claim/changeset/unsaved-changeset/unsaved-claim-changeset.component.html delete mode 100644 src/app/sections/party-claim/changeset/unsaved-changeset/unsaved-claim-changeset.component.ts delete mode 100644 src/app/sections/party-claim/changeset/unsaved-changeset/unsaved-claim-changeset.module.ts delete mode 100644 src/app/sections/party-claim/changeset/unsaved-changeset/unsaved-claim-changeset.service.ts delete mode 100644 src/app/sections/party-claim/fetch-claim.service.ts delete mode 100644 src/app/sections/party-claim/index.ts delete mode 100644 src/app/sections/party-claim/party-claim-actions/file-uploader/file-uploader.component.html delete mode 100644 src/app/sections/party-claim/party-claim-actions/file-uploader/file-uploader.component.scss delete mode 100644 src/app/sections/party-claim/party-claim-actions/file-uploader/file-uploader.component.ts delete mode 100644 src/app/sections/party-claim/party-claim-actions/file-uploader/file-uploader.module.ts delete mode 100644 src/app/sections/party-claim/party-claim-actions/file-uploader/file-uploader.service.ts delete mode 100644 src/app/sections/party-claim/party-claim-actions/index.ts delete mode 100644 src/app/sections/party-claim/party-claim-actions/party-claim-actions.component.html delete mode 100644 src/app/sections/party-claim/party-claim-actions/party-claim-actions.component.ts delete mode 100644 src/app/sections/party-claim/party-claim-actions/party-claim-actions.module.ts delete mode 100644 src/app/sections/party-claim/party-claim-actions/send-comment/index.ts delete mode 100644 src/app/sections/party-claim/party-claim-actions/send-comment/send-comment.component.html delete mode 100644 src/app/sections/party-claim/party-claim-actions/send-comment/send-comment.component.scss delete mode 100644 src/app/sections/party-claim/party-claim-actions/send-comment/send-comment.component.ts delete mode 100644 src/app/sections/party-claim/party-claim-actions/send-comment/send-comment.module.ts delete mode 100644 src/app/sections/party-claim/party-claim-actions/send-comment/send-comment.service.ts delete mode 100644 src/app/sections/party-claim/party-claim-actions/status-changer/get-available-claim-statuses.ts delete mode 100644 src/app/sections/party-claim/party-claim-actions/status-changer/index.ts delete mode 100644 src/app/sections/party-claim/party-claim-actions/status-changer/status-changer-dialog.component.html delete mode 100644 src/app/sections/party-claim/party-claim-actions/status-changer/status-changer-dialog.component.scss delete mode 100644 src/app/sections/party-claim/party-claim-actions/status-changer/status-changer-dialog.component.ts delete mode 100644 src/app/sections/party-claim/party-claim-actions/status-changer/status-changer-dialog.service.ts delete mode 100644 src/app/sections/party-claim/party-claim-actions/status-changer/status-changer.module.ts delete mode 100644 src/app/sections/party-claim/party-claim-actions/status-changer/status-changer.service.ts delete mode 100644 src/app/sections/party-claim/party-claim-routing.module.ts delete mode 100644 src/app/sections/party-claim/party-claim-title/_party-claim-title-theme.scss delete mode 100644 src/app/sections/party-claim/party-claim-title/party-claim-title.component.html delete mode 100644 src/app/sections/party-claim/party-claim-title/party-claim-title.component.ts delete mode 100644 src/app/sections/party-claim/party-claim.component.html delete mode 100644 src/app/sections/party-claim/party-claim.component.ts delete mode 100644 src/app/sections/party-claim/party-claim.module.ts delete mode 100644 src/app/sections/party-claims/claims-table/claims-table.component.html delete mode 100644 src/app/sections/party-claims/claims-table/claims-table.component.scss delete mode 100644 src/app/sections/party-claims/claims-table/claims-table.component.ts delete mode 100644 src/app/sections/party-claims/create-claim.service.ts delete mode 100644 src/app/sections/party-claims/index.ts delete mode 100644 src/app/sections/party-claims/party-claims-routing.module.ts delete mode 100644 src/app/sections/party-claims/party-claims.component.html delete mode 100644 src/app/sections/party-claims/party-claims.component.ts delete mode 100644 src/app/sections/party-claims/party-claims.module.ts delete mode 100644 src/app/sections/party-claims/party-claims.service.ts diff --git a/src/app/sections/claim/claim-routing.module.ts b/src/app/sections/claim/claim-routing.module.ts index 4404d7c2..868364fc 100644 --- a/src/app/sections/claim/claim-routing.module.ts +++ b/src/app/sections/claim/claim-routing.module.ts @@ -9,7 +9,7 @@ import { ClaimComponent } from './claim.component'; imports: [ RouterModule.forChild([ { - path: 'party/:partyID/claim/:claimID/new', + path: 'party/:partyID/claim/:claimID', component: ClaimComponent, canActivate: [AppAuthGuardService], data: { diff --git a/src/app/sections/claim/claim.module.ts b/src/app/sections/claim/claim.module.ts index 29da3e17..75be54ae 100644 --- a/src/app/sections/claim/claim.module.ts +++ b/src/app/sections/claim/claim.module.ts @@ -23,7 +23,7 @@ import { JsonViewerModule } from '@cc/app/shared/components/json-viewer/json-vie import { ThriftPipesModule } from '@cc/app/shared/pipes'; import { TimelineModule } from '@cc/components/timeline'; -import { TimelineComponentsModule } from '../party-claim/changeset/timeline-components'; +import { HumanizeDurationModule } from '../../shared/pipes/humanize-duration'; import { ClaimRoutingModule } from './claim-routing.module'; import { ClaimComponent } from './claim.component'; import { AddModificationDialogComponent } from './components/add-modification-dialog/add-modification-dialog.component'; @@ -33,6 +33,8 @@ import { ModificationFormComponent } from './components/modification-form/modifi import { ModificationUnitTimelineItemComponent } from './components/modification-unit-timeline-item/modification-unit-timeline-item.component'; import { ShopModificationTimelineItemComponent } from './components/shop-modification-timeline-item/shop-modification-timeline-item.component'; import { StatusModificationTimelineItemComponent } from './components/status-modification-timeline-item/status-modification-timeline-item.component'; +import { TimelineItemHeaderComponent } from './components/timeline-item-header/timeline-item-header.component'; +import { TimelineItemLoadingComponent } from './components/timeline-item-loading/timeline-item-loading.component'; @NgModule({ declarations: [ @@ -44,6 +46,8 @@ import { StatusModificationTimelineItemComponent } from './components/status-mod AddModificationDialogComponent, ChangeStatusDialogComponent, ModificationFormComponent, + TimelineItemHeaderComponent, + TimelineItemLoadingComponent, ], imports: [ CommonModule, @@ -52,7 +56,6 @@ import { StatusModificationTimelineItemComponent } from './components/status-mod RouterModule, TimelineModule, MatIconModule, - TimelineComponentsModule, ThriftPipesModule, MatExpansionModule, JsonViewerModule, @@ -72,6 +75,7 @@ import { StatusModificationTimelineItemComponent } from './components/status-mod MatProgressBarModule, BaseDialogModule, ActionsModule, + HumanizeDurationModule, ], }) export class ClaimModule {} diff --git a/src/app/sections/party-claim/changeset/timeline-components/timeline-item-header/timeline-item-header.component.html b/src/app/sections/claim/components/timeline-item-header/timeline-item-header.component.html similarity index 100% rename from src/app/sections/party-claim/changeset/timeline-components/timeline-item-header/timeline-item-header.component.html rename to src/app/sections/claim/components/timeline-item-header/timeline-item-header.component.html diff --git a/src/app/sections/party-claim/changeset/timeline-components/timeline-item-header/timeline-item-header.component.scss b/src/app/sections/claim/components/timeline-item-header/timeline-item-header.component.scss similarity index 100% rename from src/app/sections/party-claim/changeset/timeline-components/timeline-item-header/timeline-item-header.component.scss rename to src/app/sections/claim/components/timeline-item-header/timeline-item-header.component.scss diff --git a/src/app/sections/party-claim/changeset/timeline-components/timeline-item-header/timeline-item-header.component.ts b/src/app/sections/claim/components/timeline-item-header/timeline-item-header.component.ts similarity index 100% rename from src/app/sections/party-claim/changeset/timeline-components/timeline-item-header/timeline-item-header.component.ts rename to src/app/sections/claim/components/timeline-item-header/timeline-item-header.component.ts diff --git a/src/app/sections/party-claim/changeset/timeline-components/timeline-item-loading/_timeline-item-loading-theme.scss b/src/app/sections/claim/components/timeline-item-loading/_timeline-item-loading-theme.scss similarity index 100% rename from src/app/sections/party-claim/changeset/timeline-components/timeline-item-loading/_timeline-item-loading-theme.scss rename to src/app/sections/claim/components/timeline-item-loading/_timeline-item-loading-theme.scss diff --git a/src/app/sections/party-claim/changeset/timeline-components/timeline-item-loading/timeline-item-loading.component.html b/src/app/sections/claim/components/timeline-item-loading/timeline-item-loading.component.html similarity index 100% rename from src/app/sections/party-claim/changeset/timeline-components/timeline-item-loading/timeline-item-loading.component.html rename to src/app/sections/claim/components/timeline-item-loading/timeline-item-loading.component.html diff --git a/src/app/sections/party-claim/changeset/timeline-components/timeline-item-loading/timeline-item-loading.component.ts b/src/app/sections/claim/components/timeline-item-loading/timeline-item-loading.component.ts similarity index 100% rename from src/app/sections/party-claim/changeset/timeline-components/timeline-item-loading/timeline-item-loading.component.ts rename to src/app/sections/claim/components/timeline-item-loading/timeline-item-loading.component.ts diff --git a/src/app/sections/party-claim/_party-claim-theme.scss b/src/app/sections/party-claim/_party-claim-theme.scss deleted file mode 100644 index 524269a2..00000000 --- a/src/app/sections/party-claim/_party-claim-theme.scss +++ /dev/null @@ -1,7 +0,0 @@ -@import './changeset/timeline-components/timeline-item-loading/timeline-item-loading-theme'; -@import './party-claim-title/party-claim-title-theme'; - -@mixin cc-party-claim-theme($theme) { - @include cc-party-claim-title-theme($theme); - @include cc-timeline-item-loading-theme($theme); -} diff --git a/src/app/sections/party-claim/changeset/changeset-infos/changeset-info.ts b/src/app/sections/party-claim/changeset/changeset-infos/changeset-info.ts deleted file mode 100644 index 6f90e58e..00000000 --- a/src/app/sections/party-claim/changeset/changeset-infos/changeset-info.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Modification, UserInfo } from '@vality/domain-proto/lib/claim_management'; - -/* eslint-disable @typescript-eslint/naming-convention */ -export enum ChangesetInfoType { - partyModification = 'partyModification', - commentModification = 'commentModification', - fileModification = 'fileModification', - documentModification = 'documentModification', - statusModification = 'statusModification', -} - -export enum ChangesetInfoModificationType { - creation = 'creation', - deletion = 'deletion', -} -/* eslint-enable @typescript-eslint/naming-convention */ - -export interface ChangesetInfo { - createdAt: string; - modification: Modification; - userInfo: UserInfo; - type: ChangesetInfoType; - modificationType: ChangesetInfoModificationType; - hash: string; - outdated?: boolean; - removed?: boolean; -} diff --git a/src/app/sections/party-claim/changeset/changeset-infos/index.ts b/src/app/sections/party-claim/changeset/changeset-infos/index.ts deleted file mode 100644 index c965e85f..00000000 --- a/src/app/sections/party-claim/changeset/changeset-infos/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './to-changeset-infos'; -export * from './changeset-info'; diff --git a/src/app/sections/party-claim/changeset/changeset-infos/mark-outdated.ts b/src/app/sections/party-claim/changeset/changeset-infos/mark-outdated.ts deleted file mode 100644 index c357bf2f..00000000 --- a/src/app/sections/party-claim/changeset/changeset-infos/mark-outdated.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { ChangesetInfo } from './changeset-info'; - -export const markOutdated = (infos: ChangesetInfo[], hash: string): ChangesetInfo[] => - infos.map((info) => { - if (info.hash === hash) { - info.outdated = true; - } - return info; - }); diff --git a/src/app/sections/party-claim/changeset/changeset-infos/mark-removed.ts b/src/app/sections/party-claim/changeset/changeset-infos/mark-removed.ts deleted file mode 100644 index 1b71e359..00000000 --- a/src/app/sections/party-claim/changeset/changeset-infos/mark-removed.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { ChangesetInfo } from './changeset-info'; - -export const markRemoved = (infos: ChangesetInfo[], hash: string): ChangesetInfo[] => - infos.map((info) => { - if (info.hash === hash) { - info.removed = true; - } - return info; - }); diff --git a/src/app/sections/party-claim/changeset/changeset-infos/to-changeset-infos.ts b/src/app/sections/party-claim/changeset/changeset-infos/to-changeset-infos.ts deleted file mode 100644 index 9da2f73d..00000000 --- a/src/app/sections/party-claim/changeset/changeset-infos/to-changeset-infos.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { ModificationUnit } from '@vality/domain-proto/lib/claim_management'; - -import { ChangesetInfo, ChangesetInfoType } from './changeset-info'; -import { toCommentModificationChangesetInfo } from './to-comment-modification-changeset-info'; -import { toDocumentModificationChangesetInfo } from './to-document-modification-changeset-info'; -import { toFileModificationChangesetInfo } from './to-file-modification-changeset-info'; -import { toPartyModificationChangesetInfo } from './to-party-modification-changeset-info'; -import { toStatusModificationChangesetInfo } from './to-status-modification-changeset-info'; - -const getModificationType = (unit: ModificationUnit): ChangesetInfoType | null => { - if (unit.modification.party_modification) { - return ChangesetInfoType.partyModification; - } else if (unit.modification.claim_modification.comment_modification) { - return ChangesetInfoType.commentModification; - } else if (unit.modification.claim_modification.file_modification) { - return ChangesetInfoType.fileModification; - } else if (unit.modification.claim_modification.document_modification) { - return ChangesetInfoType.documentModification; - } else if (unit.modification.claim_modification.status_modification) { - return ChangesetInfoType.statusModification; - } else { - return null; - } -}; - -export const toChangesetInfos = (units: ModificationUnit[]): ChangesetInfo[] => - units.reduce((acc, cur) => { - switch (getModificationType(cur)) { - case ChangesetInfoType.partyModification: - return toPartyModificationChangesetInfo(acc, cur); - case ChangesetInfoType.commentModification: - return toCommentModificationChangesetInfo(acc, cur); - case ChangesetInfoType.fileModification: - return toFileModificationChangesetInfo(acc, cur); - case ChangesetInfoType.documentModification: - return toDocumentModificationChangesetInfo(acc, cur); - case ChangesetInfoType.statusModification: - return toStatusModificationChangesetInfo(acc, cur); - default: - console.error('Changeset infos: Unknown type', cur); - return acc; - } - }, []); diff --git a/src/app/sections/party-claim/changeset/changeset-infos/to-comment-modification-changeset-info.ts b/src/app/sections/party-claim/changeset/changeset-infos/to-comment-modification-changeset-info.ts deleted file mode 100644 index 618fb5d4..00000000 --- a/src/app/sections/party-claim/changeset/changeset-infos/to-comment-modification-changeset-info.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { CommentModification, ModificationUnit } from '@vality/domain-proto/lib/claim_management'; - -import { getUnionKey } from '@cc/utils/get-union-key'; - -import { ChangesetInfo, ChangesetInfoModificationType, ChangesetInfoType } from './changeset-info'; -import { markRemoved } from './mark-removed'; - -const getCommentChangesetInfoHash = (unit: ModificationUnit): string => - `${ChangesetInfoType.commentModification}.${unit.modification.claim_modification.comment_modification.id}`; - -const commentModificationType = (mod: CommentModification): ChangesetInfoModificationType => { - switch (getUnionKey(mod)) { - case 'creation': - return ChangesetInfoModificationType.creation; - case 'deletion': - return ChangesetInfoModificationType.deletion; - } -}; - -const makeCommentChangesetInfo = (unit: ModificationUnit): ChangesetInfo => - ({ - createdAt: unit.created_at, - modification: unit.modification, - userInfo: unit.user_info, - type: ChangesetInfoType.commentModification, - hash: getCommentChangesetInfoHash(unit), - modificationType: commentModificationType( - unit.modification.claim_modification.comment_modification.modification - ), - } as ChangesetInfo); - -export const toCommentModificationChangesetInfo = ( - infos: ChangesetInfo[], - unit: ModificationUnit -): ChangesetInfo[] => { - const commentChangesetInfo = makeCommentChangesetInfo(unit); - return [...markRemoved(infos, commentChangesetInfo.hash), commentChangesetInfo]; -}; diff --git a/src/app/sections/party-claim/changeset/changeset-infos/to-document-modification-changeset-info.ts b/src/app/sections/party-claim/changeset/changeset-infos/to-document-modification-changeset-info.ts deleted file mode 100644 index 26acc03a..00000000 --- a/src/app/sections/party-claim/changeset/changeset-infos/to-document-modification-changeset-info.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ModificationUnit } from '@vality/domain-proto/lib/claim_management'; - -import { ChangesetInfo, ChangesetInfoType } from './changeset-info'; -import { markOutdated } from './mark-outdated'; - -const getDocumentChangesetInfoHash = (): string => `${ChangesetInfoType.documentModification}`; - -const makeDocumentChangesetInfo = (unit: ModificationUnit): ChangesetInfo => - ({ - createdAt: unit.created_at, - modification: unit.modification, - userInfo: unit.user_info, - type: ChangesetInfoType.documentModification, - hash: getDocumentChangesetInfoHash(), - } as ChangesetInfo); - -export const toDocumentModificationChangesetInfo = ( - infos: ChangesetInfo[], - unit: ModificationUnit -): ChangesetInfo[] => { - const documentChangesetInfo = makeDocumentChangesetInfo(unit); - return [...markOutdated(infos, documentChangesetInfo.hash), documentChangesetInfo]; -}; diff --git a/src/app/sections/party-claim/changeset/changeset-infos/to-file-modification-changeset-info.ts b/src/app/sections/party-claim/changeset/changeset-infos/to-file-modification-changeset-info.ts deleted file mode 100644 index 487df45c..00000000 --- a/src/app/sections/party-claim/changeset/changeset-infos/to-file-modification-changeset-info.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { FileModification, ModificationUnit } from '@vality/domain-proto/lib/claim_management'; - -import { getUnionKey } from '@cc/utils/get-union-key'; - -import { ChangesetInfo, ChangesetInfoModificationType, ChangesetInfoType } from './changeset-info'; -import { markRemoved } from './mark-removed'; - -const getFileChangesetInfoHash = (unit: ModificationUnit): string => - `${ChangesetInfoType.fileModification}.${unit.modification.claim_modification.file_modification.id}`; - -const fileModificationType = (mod: FileModification): ChangesetInfoModificationType => { - switch (getUnionKey(mod)) { - case 'creation': - return ChangesetInfoModificationType.creation; - case 'deletion': - return ChangesetInfoModificationType.deletion; - } -}; - -const makeFileChangesetInfo = (unit: ModificationUnit): ChangesetInfo => - ({ - createdAt: unit.created_at, - modification: unit.modification, - userInfo: unit.user_info, - type: ChangesetInfoType.fileModification, - hash: getFileChangesetInfoHash(unit), - modificationType: fileModificationType( - unit.modification.claim_modification.file_modification.modification - ), - } as ChangesetInfo); - -export const toFileModificationChangesetInfo = ( - infos: ChangesetInfo[], - unit: ModificationUnit -): ChangesetInfo[] => { - const fileChangesetInfo = makeFileChangesetInfo(unit); - return [...markRemoved(infos, fileChangesetInfo.hash), fileChangesetInfo]; -}; diff --git a/src/app/sections/party-claim/changeset/changeset-infos/to-party-modification-changeset-info.ts b/src/app/sections/party-claim/changeset/changeset-infos/to-party-modification-changeset-info.ts deleted file mode 100644 index e59f35ea..00000000 --- a/src/app/sections/party-claim/changeset/changeset-infos/to-party-modification-changeset-info.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { ModificationUnit } from '@vality/domain-proto/lib/claim_management'; - -import { getUnionKey } from '@cc/utils/get-union-key'; - -import { ChangesetInfo, ChangesetInfoType } from './changeset-info'; -import { markOutdated } from './mark-outdated'; - -const getHash = (m: any, acc: string = ''): string => { - if (m.id && m.modification) { - return `${acc}.${getUnionKey(m.modification) as string}`; - } - const unionKey = getUnionKey(m) as string; - return getHash(m[unionKey], `${acc}.${unionKey}`); -}; - -const makePartyChangesetInfo = (unit: ModificationUnit): ChangesetInfo => - ({ - createdAt: unit.created_at, - modification: unit.modification, - userInfo: unit.user_info, - type: ChangesetInfoType.partyModification, - hash: getHash(unit.modification), - } as ChangesetInfo); - -export const toPartyModificationChangesetInfo = ( - infos: ChangesetInfo[], - unit: ModificationUnit -): ChangesetInfo[] => { - const partyChangesetInfo = makePartyChangesetInfo(unit); - return [...markOutdated(infos, partyChangesetInfo.hash), partyChangesetInfo]; -}; diff --git a/src/app/sections/party-claim/changeset/changeset-infos/to-status-modification-changeset-info.ts b/src/app/sections/party-claim/changeset/changeset-infos/to-status-modification-changeset-info.ts deleted file mode 100644 index 56c5d1e3..00000000 --- a/src/app/sections/party-claim/changeset/changeset-infos/to-status-modification-changeset-info.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { ModificationUnit } from '@vality/domain-proto/lib/claim_management'; - -import { ChangesetInfo, ChangesetInfoType } from './changeset-info'; - -const makeStatusChangesetInfo = (unit: ModificationUnit): ChangesetInfo => - ({ - createdAt: unit.created_at, - modification: unit.modification, - userInfo: unit.user_info, - type: ChangesetInfoType.statusModification, - hash: ChangesetInfoType.statusModification, - } as ChangesetInfo); - -export const toStatusModificationChangesetInfo = ( - infos: ChangesetInfo[], - unit: ModificationUnit -): ChangesetInfo[] => [...infos, makeStatusChangesetInfo(unit)]; diff --git a/src/app/sections/party-claim/changeset/changesets-filter/changesets-filter.component.html b/src/app/sections/party-claim/changeset/changesets-filter/changesets-filter.component.html deleted file mode 100644 index 63445b6b..00000000 --- a/src/app/sections/party-claim/changeset/changesets-filter/changesets-filter.component.html +++ /dev/null @@ -1,35 +0,0 @@ -
- - Changeset filters - - Hide outdated changes - Hide removed changes - - Party mods - Files - Comments - Documents - - - -
diff --git a/src/app/sections/party-claim/changeset/changesets-filter/changesets-filter.component.scss b/src/app/sections/party-claim/changeset/changesets-filter/changesets-filter.component.scss deleted file mode 100644 index 32b79455..00000000 --- a/src/app/sections/party-claim/changeset/changesets-filter/changesets-filter.component.scss +++ /dev/null @@ -1,3 +0,0 @@ -::ng-deep .mat-select-panel { - max-height: 300px !important; -} diff --git a/src/app/sections/party-claim/changeset/changesets-filter/changesets-filter.component.ts b/src/app/sections/party-claim/changeset/changesets-filter/changesets-filter.component.ts deleted file mode 100644 index 27394502..00000000 --- a/src/app/sections/party-claim/changeset/changesets-filter/changesets-filter.component.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; - -import { ChangesetInfo, ChangesetInfoType } from '../changeset-infos'; -import { ChangesetsFilterService } from './changesets-filter.service'; - -@Component({ - selector: 'cc-changesets-filter', - templateUrl: 'changesets-filter.component.html', - styleUrls: ['changesets-filter.component.scss'], - providers: [ChangesetsFilterService], -}) -export class ChangesetsFilterComponent implements OnInit { - @Input() - set changesetInfos(v: ChangesetInfo[]) { - this.changesetsFilterService.setChangesetInfos(v); - } - - @Output() - filterChange: EventEmitter = new EventEmitter(); - - changesetsFilterForm = this.changesetsFilterService.changesetsFilterForm; - changesetInfoType = ChangesetInfoType; - - constructor(private changesetsFilterService: ChangesetsFilterService) {} - - ngOnInit(): void { - this.changesetsFilterService.filteredChangesetInfos$.subscribe((infos) => { - this.filterChange.emit(infos); - }); - } -} diff --git a/src/app/sections/party-claim/changeset/changesets-filter/changesets-filter.module.ts b/src/app/sections/party-claim/changeset/changesets-filter/changesets-filter.module.ts deleted file mode 100644 index 40c3f5f9..00000000 --- a/src/app/sections/party-claim/changeset/changesets-filter/changesets-filter.module.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { NgModule } from '@angular/core'; -import { FlexModule } from '@angular/flex-layout'; -import { ReactiveFormsModule } from '@angular/forms'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatSelectModule } from '@angular/material/select'; - -import { ChangesetsFilterComponent } from './changesets-filter.component'; - -@NgModule({ - declarations: [ChangesetsFilterComponent], - imports: [ReactiveFormsModule, MatFormFieldModule, MatSelectModule, FlexModule], - exports: [ChangesetsFilterComponent], -}) -export class ChangesetsFilterModule {} diff --git a/src/app/sections/party-claim/changeset/changesets-filter/changesets-filter.service.ts b/src/app/sections/party-claim/changeset/changesets-filter/changesets-filter.service.ts deleted file mode 100644 index fffeeda7..00000000 --- a/src/app/sections/party-claim/changeset/changesets-filter/changesets-filter.service.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Injectable } from '@angular/core'; -import { UntypedFormBuilder } from '@angular/forms'; -import { combineLatest, Subject } from 'rxjs'; -import { map, shareReplay, startWith } from 'rxjs/operators'; - -import { ChangesetInfo, ChangesetInfoType } from '../changeset-infos'; -import { infosFilter } from './infos-filter'; - -@Injectable() -export class ChangesetsFilterService { - private changesetInfos$ = new Subject(); - - // eslint-disable-next-line @typescript-eslint/member-ordering - changesetsFilterForm = this.fb.group({ - filters: [ - [ - ChangesetInfoType.documentModification, - ChangesetInfoType.commentModification, - ChangesetInfoType.fileModification, - ChangesetInfoType.partyModification, - ChangesetInfoType.statusModification, - ], - ], - }); - - // eslint-disable-next-line @typescript-eslint/member-ordering - filteredChangesetInfos$ = combineLatest([ - this.changesetInfos$, - this.changesetsFilterForm.valueChanges.pipe(startWith(this.changesetsFilterForm.value)), - ]).pipe( - map(([infos, { filters }]) => infos.filter((info) => infosFilter(info, filters))), - shareReplay(1) - ); - - constructor(private fb: UntypedFormBuilder) { - this.filteredChangesetInfos$.subscribe(); - } - - setChangesetInfos(changesetInfos: ChangesetInfo[]) { - this.changesetInfos$.next(changesetInfos); - } -} diff --git a/src/app/sections/party-claim/changeset/changesets-filter/index.ts b/src/app/sections/party-claim/changeset/changesets-filter/index.ts deleted file mode 100644 index 5e2efc93..00000000 --- a/src/app/sections/party-claim/changeset/changesets-filter/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './changesets-filter.module'; diff --git a/src/app/sections/party-claim/changeset/changesets-filter/infos-filter.ts b/src/app/sections/party-claim/changeset/changesets-filter/infos-filter.ts deleted file mode 100644 index 0de72f0a..00000000 --- a/src/app/sections/party-claim/changeset/changesets-filter/infos-filter.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { ChangesetInfo } from '../changeset-infos'; - -export const infosFilter = (info: ChangesetInfo, filters: string[]) => { - if ( - filters.length === 0 || - (info.outdated && filters.includes('outdated')) || - (info.removed && filters.includes('removed')) - ) { - return false; - } else { - return filters.includes(info.type); - } -}; diff --git a/src/app/sections/party-claim/changeset/claim-changeset/claim-changeset.component.html b/src/app/sections/party-claim/changeset/claim-changeset/claim-changeset.component.html deleted file mode 100644 index 61ddbc79..00000000 --- a/src/app/sections/party-claim/changeset/claim-changeset/claim-changeset.component.html +++ /dev/null @@ -1,39 +0,0 @@ -
-
-

Changeset

- -
- - - - - - - - - -
diff --git a/src/app/sections/party-claim/changeset/claim-changeset/claim-changeset.component.ts b/src/app/sections/party-claim/changeset/claim-changeset/claim-changeset.component.ts deleted file mode 100644 index f24ba421..00000000 --- a/src/app/sections/party-claim/changeset/claim-changeset/claim-changeset.component.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; -import { PartyID } from '@vality/domain-proto'; -import { ClaimChangeset } from '@vality/domain-proto/lib/claim_management'; -import { BehaviorSubject } from 'rxjs'; - -import { ChangesetInfo, ChangesetInfoType, toChangesetInfos } from '../changeset-infos'; -import { MenuConfigAction, MenuConfigItem } from '../timeline-items/menu-config'; -import { ClaimChangesetService } from './claim-changeset.service'; - -@Component({ - selector: 'cc-claim-changeset', - templateUrl: 'claim-changeset.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, - providers: [ClaimChangesetService], -}) -export class ClaimChangesetComponent { - @Input() - createdAt: string; - - @Input() - set changeset(v: ClaimChangeset) { - this.changesetInfos$.next(toChangesetInfos(v)); - } - - @Input() - partyID: PartyID; - - fileMenuConfig: MenuConfigItem[] = [ - { action: MenuConfigAction.deleteFile, label: 'Delete file' }, - ]; - commentMenuConfig: MenuConfigItem[] = [ - { action: MenuConfigAction.deleteComment, label: 'Delete comment' }, - ]; - partyModMenuConfig: MenuConfigItem[] = []; - - changesetInfoType = ChangesetInfoType; - changesetInfos$ = new BehaviorSubject([]); - filteredChangesetInfos: ChangesetInfo[] = []; - - constructor(private claimChangesetService: ClaimChangesetService) {} - - simpleTrackBy(index: number): number { - return index; - } - - filterChange($event: ChangesetInfo[]) { - this.filteredChangesetInfos = $event; - } - - menuItemSelected($event: MenuConfigItem, i: number) { - this.claimChangesetService.menuItemSelected($event, this.changesetInfos$.getValue(), i); - } -} diff --git a/src/app/sections/party-claim/changeset/claim-changeset/claim-changeset.module.ts b/src/app/sections/party-claim/changeset/claim-changeset/claim-changeset.module.ts deleted file mode 100644 index 1c2451ac..00000000 --- a/src/app/sections/party-claim/changeset/claim-changeset/claim-changeset.module.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { FlexModule } from '@angular/flex-layout'; -import { MatButtonModule } from '@angular/material/button'; -import { MatDialogModule } from '@angular/material/dialog'; - -import { PartyModificationFormsModule } from '@cc/app/shared/components'; -import { TimelineModule } from '@cc/components/timeline'; - -import { ChangesetsFilterModule } from '../changesets-filter'; -import { CommentTimelineItemModule } from '../timeline-items/comment-timeline-item/comment-timeline-item.module'; -import { CreatedTimelineItemModule } from '../timeline-items/created-timeline-item'; -import { FileTimelineItemModule } from '../timeline-items/file-timeline-item/file-timeline-item.module'; -import { PartyModificationTimelineItemModule } from '../timeline-items/party-modification-timeline-item/party-modification-timeline-item.module'; -import { StatusTimelineItemModule } from '../timeline-items/status-timeline-item/status-timeline-item.module'; -import { SaveClaimChangesetService } from '../unsaved-changeset/save-claim-changeset.service'; -import { ClaimChangesetComponent } from './claim-changeset.component'; - -@NgModule({ - imports: [ - FlexModule, - CommonModule, - ChangesetsFilterModule, - TimelineModule, - MatDialogModule, - MatButtonModule, - PartyModificationFormsModule, - CreatedTimelineItemModule, - FileTimelineItemModule, - CommentTimelineItemModule, - PartyModificationTimelineItemModule, - StatusTimelineItemModule, - ], - declarations: [ClaimChangesetComponent], - providers: [SaveClaimChangesetService], - exports: [ClaimChangesetComponent], -}) -export class ClaimChangesetModule {} diff --git a/src/app/sections/party-claim/changeset/claim-changeset/claim-changeset.service.ts b/src/app/sections/party-claim/changeset/claim-changeset/claim-changeset.service.ts deleted file mode 100644 index e87325fd..00000000 --- a/src/app/sections/party-claim/changeset/claim-changeset/claim-changeset.service.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Injectable } from '@angular/core'; - -import { ChangesetInfo } from '../changeset-infos'; -import { MenuConfigAction, MenuConfigItem } from '../timeline-items/menu-config'; -import { UnsavedClaimChangesetService } from '../unsaved-changeset/unsaved-claim-changeset.service'; -import { createDeleteCommentModification } from './create-delete-comment-modification'; -import { createDeleteFileModification } from './create-delete-file-modification'; - -@Injectable() -export class ClaimChangesetService { - constructor(private unsavedClaimChangesetService: UnsavedClaimChangesetService) {} - - menuItemSelected($event: MenuConfigItem, changesetInfos: ChangesetInfo[], index: number) { - const changesetInfo = changesetInfos[index]; - switch ($event.action) { - case MenuConfigAction.deleteComment: - this.unsavedClaimChangesetService.addModification( - createDeleteCommentModification(changesetInfo) - ); - break; - case MenuConfigAction.deleteFile: - this.unsavedClaimChangesetService.addModification( - createDeleteFileModification(changesetInfo) - ); - break; - default: - console.warn('Unsupported method', $event); - } - } -} diff --git a/src/app/sections/party-claim/changeset/claim-changeset/create-delete-comment-modification.ts b/src/app/sections/party-claim/changeset/claim-changeset/create-delete-comment-modification.ts deleted file mode 100644 index 2717730b..00000000 --- a/src/app/sections/party-claim/changeset/claim-changeset/create-delete-comment-modification.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Modification } from '@vality/domain-proto/lib/claim_management'; - -import { ChangesetInfo } from '../changeset-infos'; - -export const createDeleteCommentModification = (info: ChangesetInfo): Modification => ({ - claim_modification: { - comment_modification: { - id: info.modification.claim_modification.comment_modification.id, - modification: { - deletion: {}, - }, - }, - }, -}); diff --git a/src/app/sections/party-claim/changeset/claim-changeset/create-delete-file-modification.ts b/src/app/sections/party-claim/changeset/claim-changeset/create-delete-file-modification.ts deleted file mode 100644 index fe33e30b..00000000 --- a/src/app/sections/party-claim/changeset/claim-changeset/create-delete-file-modification.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Modification } from '@vality/domain-proto/lib/claim_management'; - -import { ChangesetInfo } from '../changeset-infos'; - -export const createDeleteFileModification = (info: ChangesetInfo): Modification => ({ - claim_modification: { - file_modification: { - id: info.modification.claim_modification.file_modification.id, - modification: { - deletion: {}, - }, - }, - }, -}); diff --git a/src/app/sections/party-claim/changeset/index.ts b/src/app/sections/party-claim/changeset/index.ts deleted file mode 100644 index bfdda6d5..00000000 --- a/src/app/sections/party-claim/changeset/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './claim-changeset/claim-changeset.module'; -export * from './unsaved-changeset/unsaved-claim-changeset.module'; diff --git a/src/app/sections/party-claim/changeset/timeline-components/index.ts b/src/app/sections/party-claim/changeset/timeline-components/index.ts deleted file mode 100644 index 7e1521da..00000000 --- a/src/app/sections/party-claim/changeset/timeline-components/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './timeline-components.module'; diff --git a/src/app/sections/party-claim/changeset/timeline-components/timeline-components.module.ts b/src/app/sections/party-claim/changeset/timeline-components/timeline-components.module.ts deleted file mode 100644 index ff9254f5..00000000 --- a/src/app/sections/party-claim/changeset/timeline-components/timeline-components.module.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; - -import { HumanizeDurationModule } from '@cc/app/shared/pipes/humanize-duration'; - -import { TimelineItemErrorComponent } from './timeline-item-error/timeline-item-error.component'; -import { TimelineItemHeaderComponent } from './timeline-item-header/timeline-item-header.component'; -import { TimelineItemLoadingComponent } from './timeline-item-loading/timeline-item-loading.component'; - -@NgModule({ - declarations: [ - TimelineItemLoadingComponent, - TimelineItemErrorComponent, - TimelineItemHeaderComponent, - ], - imports: [CommonModule, HumanizeDurationModule], - exports: [ - TimelineItemLoadingComponent, - TimelineItemErrorComponent, - TimelineItemHeaderComponent, - ], -}) -export class TimelineComponentsModule {} diff --git a/src/app/sections/party-claim/changeset/timeline-components/timeline-item-error/timeline-item-error.component.html b/src/app/sections/party-claim/changeset/timeline-components/timeline-item-error/timeline-item-error.component.html deleted file mode 100644 index ab12566a..00000000 --- a/src/app/sections/party-claim/changeset/timeline-components/timeline-item-error/timeline-item-error.component.html +++ /dev/null @@ -1 +0,0 @@ -

{{ text }}

diff --git a/src/app/sections/party-claim/changeset/timeline-components/timeline-item-error/timeline-item-error.component.ts b/src/app/sections/party-claim/changeset/timeline-components/timeline-item-error/timeline-item-error.component.ts deleted file mode 100644 index 3c589534..00000000 --- a/src/app/sections/party-claim/changeset/timeline-components/timeline-item-error/timeline-item-error.component.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; - -@Component({ - selector: 'cc-timeline-item-error', - templateUrl: 'timeline-item-error.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class TimelineItemErrorComponent { - @Input() - text: string; -} diff --git a/src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-action-icon.pipe.ts b/src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-action-icon.pipe.ts deleted file mode 100644 index 8af154d0..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-action-icon.pipe.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Pipe, PipeTransform } from '@angular/core'; - -import { ChangesetInfoModificationType } from '../../changeset-infos'; - -@Pipe({ - name: 'ccCommentActionIcon', -}) -export class CommentActionIconPipe implements PipeTransform { - transform(type: ChangesetInfoModificationType): string { - return ( - { - [ChangesetInfoModificationType.creation]: 'add_comment', - [ChangesetInfoModificationType.deletion]: 'clear', - } as const - )[type]; - } -} diff --git a/src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-badge-color.pipe.ts b/src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-badge-color.pipe.ts deleted file mode 100644 index 213148ab..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-badge-color.pipe.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Pipe, PipeTransform } from '@angular/core'; - -import { ChangesetInfoModificationType } from '../../changeset-infos'; - -@Pipe({ - name: 'ccCommentBadgeColor', -}) -export class CommentBadgeColorPipe implements PipeTransform { - transform(type: ChangesetInfoModificationType): 'primary' | 'warn' | 'error' | 'success' { - return ( - { - [ChangesetInfoModificationType.creation]: 'primary', - [ChangesetInfoModificationType.deletion]: null, - } as const - )[type]; - } -} diff --git a/src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-content/comment-content.component.html b/src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-content/comment-content.component.html deleted file mode 100644 index 237ebed9..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-content/comment-content.component.html +++ /dev/null @@ -1,5 +0,0 @@ - - - {{ text }} - - diff --git a/src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-content/comment-content.component.ts b/src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-content/comment-content.component.ts deleted file mode 100644 index 70d15502..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-content/comment-content.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Component, Input } from '@angular/core'; - -@Component({ - selector: 'cc-comment-content', - templateUrl: 'comment-content.component.html', -}) -export class CommentContentComponent { - @Input() - text: string; -} diff --git a/src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-header.pipe.ts b/src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-header.pipe.ts deleted file mode 100644 index 21541c77..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-header.pipe.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Pipe, PipeTransform } from '@angular/core'; - -import { ChangesetInfoModificationType } from '../../changeset-infos'; - -@Pipe({ - name: 'ccCommentHeader', -}) -export class CommentHeaderPipe implements PipeTransform { - transform(type: ChangesetInfoModificationType): string { - return ( - { - [ChangesetInfoModificationType.creation]: 'added message', - [ChangesetInfoModificationType.deletion]: 'removed message', - } as const - )[type]; - } -} diff --git a/src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-timeline-item.component.html b/src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-timeline-item.component.html deleted file mode 100644 index 9d8bb5fb..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-timeline-item.component.html +++ /dev/null @@ -1,39 +0,0 @@ - - - -
- - - - -
-
- - - {{ changesetInfo.modificationType | ccCommentActionIcon }} - - - - - - -
diff --git a/src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-timeline-item.component.ts b/src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-timeline-item.component.ts deleted file mode 100644 index cbeb743d..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-timeline-item.component.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core'; - -import { ChangesetInfo } from '../../changeset-infos'; -import { TimelimeItemComponent } from '../timelime-item.component'; -import { CommentTimelineItemService } from './comment-timeline-item.service'; - -@Component({ - selector: 'cc-comment-timeline-item', - templateUrl: 'comment-timeline-item.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, - providers: [CommentTimelineItemService], -}) -export class CommentTimelineItemComponent extends TimelimeItemComponent implements OnInit { - @Input() - changesetInfo: ChangesetInfo; - - isLoading$ = this.commentTimelineItemService.isLoading$; - message$ = this.commentTimelineItemService.message$; - error$ = this.commentTimelineItemService.error$; - - constructor(private commentTimelineItemService: CommentTimelineItemService) { - super(); - } - - ngOnInit(): void { - this.commentTimelineItemService.getMessage([ - this.changesetInfo.modification.claim_modification.comment_modification.id, - ]); - } -} diff --git a/src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-timeline-item.module.ts b/src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-timeline-item.module.ts deleted file mode 100644 index 4ed51612..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-timeline-item.module.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { FlexModule } from '@angular/flex-layout'; -import { MatButtonModule } from '@angular/material/button'; -import { MatCardModule } from '@angular/material/card'; -import { MatIconModule } from '@angular/material/icon'; -import { MatMenuModule } from '@angular/material/menu'; - -import { TimelineModule } from '@cc/components/timeline'; - -import { MessagesModule } from '../../../../../thrift-services/messages'; -import { TimelineComponentsModule } from '../../timeline-components'; -import { CommentActionIconPipe } from './comment-action-icon.pipe'; -import { CommentBadgeColorPipe } from './comment-badge-color.pipe'; -import { CommentContentComponent } from './comment-content/comment-content.component'; -import { CommentHeaderPipe } from './comment-header.pipe'; -import { CommentTimelineItemComponent } from './comment-timeline-item.component'; - -@NgModule({ - imports: [ - MessagesModule, - TimelineModule, - MatButtonModule, - MatIconModule, - MatMenuModule, - FlexModule, - CommonModule, - MatCardModule, - TimelineComponentsModule, - ], - declarations: [ - CommentTimelineItemComponent, - CommentHeaderPipe, - CommentBadgeColorPipe, - CommentActionIconPipe, - CommentContentComponent, - ], - exports: [CommentTimelineItemComponent], -}) -export class CommentTimelineItemModule {} diff --git a/src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-timeline-item.service.ts b/src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-timeline-item.service.ts deleted file mode 100644 index 16f99931..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/comment-timeline-item/comment-timeline-item.service.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { Injectable } from '@angular/core'; -import { ConversationId } from '@vality/messages-proto'; -import { merge, of, Subject } from 'rxjs'; -import { catchError, pluck, shareReplay, switchMap } from 'rxjs/operators'; - -import { progress } from '@cc/app/shared/custom-operators'; - -import { MessagesService } from '../../../../../thrift-services/messages/messages.service'; - -@Injectable() -export class CommentTimelineItemService { - private getConversations$ = new Subject(); - private hasError$ = new Subject(); - - // eslint-disable-next-line @typescript-eslint/member-ordering - message$ = this.getConversations$.pipe( - switchMap((conversationIDs) => - this.messagesService.getConversations(conversationIDs, {}).pipe( - pluck('conversations', '0', 'messages', '0'), - catchError((e) => { - this.hasError$.next(e); - return of(e); - }) - ) - ), - shareReplay(1) - ); - // eslint-disable-next-line @typescript-eslint/member-ordering - error$ = this.hasError$.asObservable(); - - // eslint-disable-next-line @typescript-eslint/member-ordering - isLoading$ = progress(this.getConversations$, merge(this.message$, this.hasError$)); - - constructor(private messagesService: MessagesService) { - this.message$.subscribe(); - } - - getMessage(conversationIDs: ConversationId[]) { - this.getConversations$.next(conversationIDs); - } -} diff --git a/src/app/sections/party-claim/changeset/timeline-items/created-timeline-item/created-timeline-item.component.html b/src/app/sections/party-claim/changeset/timeline-items/created-timeline-item/created-timeline-item.component.html deleted file mode 100644 index 623457b2..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/created-timeline-item/created-timeline-item.component.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - create - - diff --git a/src/app/sections/party-claim/changeset/timeline-items/created-timeline-item/created-timeline-item.component.ts b/src/app/sections/party-claim/changeset/timeline-items/created-timeline-item/created-timeline-item.component.ts deleted file mode 100644 index aef9ee46..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/created-timeline-item/created-timeline-item.component.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; - -@Component({ - selector: 'cc-created-timeline-item', - templateUrl: 'created-timeline-item.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class CreatedTimelineItemComponent { - @Input() - createdAt: string; -} diff --git a/src/app/sections/party-claim/changeset/timeline-items/created-timeline-item/created-timeline-item.module.ts b/src/app/sections/party-claim/changeset/timeline-items/created-timeline-item/created-timeline-item.module.ts deleted file mode 100644 index 288166ce..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/created-timeline-item/created-timeline-item.module.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { NgModule } from '@angular/core'; -import { MatIconModule } from '@angular/material/icon'; - -import { TimelineModule } from '@cc/components/timeline'; - -import { TimelineComponentsModule } from '../../timeline-components'; -import { CreatedTimelineItemComponent } from './created-timeline-item.component'; - -@NgModule({ - declarations: [CreatedTimelineItemComponent], - imports: [TimelineModule, TimelineComponentsModule, MatIconModule], - exports: [CreatedTimelineItemComponent], -}) -export class CreatedTimelineItemModule {} diff --git a/src/app/sections/party-claim/changeset/timeline-items/created-timeline-item/index.ts b/src/app/sections/party-claim/changeset/timeline-items/created-timeline-item/index.ts deleted file mode 100644 index a06d90bb..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/created-timeline-item/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './created-timeline-item.module'; diff --git a/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/download.ts b/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/download.ts deleted file mode 100644 index bf2ad38b..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/download.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * https://github.com/sindresorhus/multi-download/blob/master/index.js - */ -export function download(url: string, name?: string): void { - const a = document.createElement('a'); - a.download = name; - a.href = url; - a.style.display = 'none'; - document.body.append(a); - a.click(); - // Chrome requires the timeout - setTimeout(() => { - a.remove(); - }, 100); -} diff --git a/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-action-icon.pipe.ts b/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-action-icon.pipe.ts deleted file mode 100644 index c42caf0e..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-action-icon.pipe.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Pipe, PipeTransform } from '@angular/core'; - -import { ChangesetInfoModificationType } from '../../changeset-infos'; - -@Pipe({ - name: 'ccFileActionIcon', -}) -export class FileActionIconPipe implements PipeTransform { - transform(type: ChangesetInfoModificationType): string { - return ( - { - [ChangesetInfoModificationType.creation]: 'attach_file', - [ChangesetInfoModificationType.deletion]: 'clear', - } as const - )[type]; - } -} diff --git a/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-badge-color.pipe.ts b/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-badge-color.pipe.ts deleted file mode 100644 index 6e11bb2a..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-badge-color.pipe.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Pipe, PipeTransform } from '@angular/core'; - -import { ChangesetInfoModificationType } from '../../changeset-infos'; - -@Pipe({ - name: 'ccFileBadgeColor', -}) -export class FileBadgeColorPipe implements PipeTransform { - transform(type: ChangesetInfoModificationType): 'primary' | 'warn' | 'error' | 'success' { - return ( - { - [ChangesetInfoModificationType.creation]: 'primary', - [ChangesetInfoModificationType.deletion]: null, - } as const - )[type]; - } -} diff --git a/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-content/file-content.component.html b/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-content/file-content.component.html deleted file mode 100644 index 8ae76b5f..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-content/file-content.component.html +++ /dev/null @@ -1,8 +0,0 @@ - - -
{{ fileData.file_name }}
- cloud_download -
-
diff --git a/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-content/file-content.component.scss b/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-content/file-content.component.scss deleted file mode 100644 index 58491ef3..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-content/file-content.component.scss +++ /dev/null @@ -1,3 +0,0 @@ -.download { - cursor: pointer; -} diff --git a/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-content/file-content.component.ts b/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-content/file-content.component.ts deleted file mode 100644 index 0c9ab19f..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-content/file-content.component.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; -import { FileID } from '@vality/domain-proto/lib/claim_management'; -import { FileData } from '@vality/file-storage-proto'; - -import { FileTimelineItemService } from '../file-timeline-item.service'; - -@Component({ - selector: 'cc-file-content', - templateUrl: 'file-content.component.html', - styleUrls: ['file-content.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class FileContentComponent { - @Input() - fileData: FileData; - - constructor(private fileTimelineItemService: FileTimelineItemService) {} - - downloadFile(fileID: FileID) { - this.fileTimelineItemService.downloadFile(fileID); - } -} diff --git a/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-header.pipe.ts b/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-header.pipe.ts deleted file mode 100644 index d346092f..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-header.pipe.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Pipe, PipeTransform } from '@angular/core'; - -import { ChangesetInfoModificationType } from '../../changeset-infos'; - -@Pipe({ - name: 'ccFileHeader', -}) -export class FileHeaderPipe implements PipeTransform { - transform(type: ChangesetInfoModificationType): string { - return ( - { - [ChangesetInfoModificationType.creation]: 'added files', - [ChangesetInfoModificationType.deletion]: 'removed files', - } as const - )[type]; - } -} diff --git a/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-timeline-item.component.html b/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-timeline-item.component.html deleted file mode 100644 index ff8da878..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-timeline-item.component.html +++ /dev/null @@ -1,34 +0,0 @@ - - - -
- - - - -
-
- - - {{ changesetInfo.modificationType | ccFileActionIcon }} - - - - - - -
diff --git a/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-timeline-item.component.ts b/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-timeline-item.component.ts deleted file mode 100644 index 19500cca..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-timeline-item.component.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core'; - -import { ChangesetInfo } from '../../changeset-infos'; -import { TimelimeItemComponent } from '../timelime-item.component'; -import { FileTimelineItemService } from './file-timeline-item.service'; - -@Component({ - selector: 'cc-file-timeline-item', - templateUrl: 'file-timeline-item.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, - providers: [FileTimelineItemService], -}) -export class FileTimelineItemComponent extends TimelimeItemComponent implements OnInit { - @Input() - changesetInfo: ChangesetInfo; - - isLoading$ = this.fileTimelineItemService.isLoading$; - error$ = this.fileTimelineItemService.error$; - fileData$ = this.fileTimelineItemService.fileData$; - - constructor(private fileTimelineItemService: FileTimelineItemService) { - super(); - } - - ngOnInit() { - this.fileTimelineItemService.getFileInfo( - this.changesetInfo?.modification.claim_modification.file_modification.id - ); - } - - downloadFile() { - this.fileTimelineItemService.downloadFile( - this.changesetInfo.modification.claim_modification.file_modification.id - ); - } -} diff --git a/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-timeline-item.module.ts b/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-timeline-item.module.ts deleted file mode 100644 index cb239ceb..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-timeline-item.module.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { FlexModule } from '@angular/flex-layout'; -import { MatButtonModule } from '@angular/material/button'; -import { MatCardModule } from '@angular/material/card'; -import { MatIconModule } from '@angular/material/icon'; -import { MatMenuModule } from '@angular/material/menu'; - -import { TimelineModule } from '@cc/components/timeline'; - -import { FileStorageModule } from '../../../../../thrift-services/file-storage'; -import { TimelineComponentsModule } from '../../timeline-components'; -import { FileActionIconPipe } from './file-action-icon.pipe'; -import { FileBadgeColorPipe } from './file-badge-color.pipe'; -import { FileContentComponent } from './file-content/file-content.component'; -import { FileHeaderPipe } from './file-header.pipe'; -import { FileTimelineItemComponent } from './file-timeline-item.component'; - -@NgModule({ - imports: [ - FileStorageModule, - TimelineModule, - MatIconModule, - MatMenuModule, - CommonModule, - FlexModule, - MatButtonModule, - MatCardModule, - TimelineComponentsModule, - ], - declarations: [ - FileTimelineItemComponent, - FileHeaderPipe, - FileBadgeColorPipe, - FileActionIconPipe, - FileContentComponent, - ], - exports: [FileTimelineItemComponent], -}) -export class FileTimelineItemModule {} diff --git a/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-timeline-item.service.ts b/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-timeline-item.service.ts deleted file mode 100644 index 539a91d6..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/file-timeline-item/file-timeline-item.service.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { Injectable } from '@angular/core'; -import { FileData } from '@vality/file-storage-proto'; -import * as moment from 'moment'; -import { merge, Observable, of, Subject } from 'rxjs'; -import { catchError, filter, map, shareReplay, switchMap } from 'rxjs/operators'; - -import { progress } from '@cc/app/shared/custom-operators'; - -import { FileStorageService } from '../../../../../thrift-services/file-storage/file-storage.service'; -import { download } from './download'; - -@Injectable() -export class FileTimelineItemService { - private getFileInfo$ = new Subject(); - private hasError$ = new Subject(); - - // eslint-disable-next-line @typescript-eslint/member-ordering - fileData$: Observable = this.getFileInfo$.pipe( - switchMap((fileID) => - this.fileStorageService.getFileData(fileID).pipe( - catchError((e) => { - this.hasError$.next(e); - return of(e); - }) - ) - ), - filter((file) => Object.keys(file).length > 0), - map((file: FileData) => ({ ...file, file_name: decodeURI(file?.file_name) })), - shareReplay(1) - ); - - // eslint-disable-next-line @typescript-eslint/member-ordering - error$ = this.hasError$.asObservable(); - - // eslint-disable-next-line @typescript-eslint/member-ordering - isLoading$ = progress(this.getFileInfo$, merge(this.fileData$, this.hasError$)); - - constructor(private fileStorageService: FileStorageService) { - this.fileData$.subscribe(); - } - - getFileInfo(fileID: string) { - this.getFileInfo$.next(fileID); - } - - downloadFile(fileID: string) { - this.fileStorageService - .generateDownloadUrl(fileID, moment().add(1, 'h').toISOString()) - .subscribe( - (url) => { - if (typeof url === 'string') { - download(url); - } else { - this.hasError$.next('File not found'); - } - }, - (e) => this.hasError$.next(e) - ); - } -} diff --git a/src/app/sections/party-claim/changeset/timeline-items/menu-config.ts b/src/app/sections/party-claim/changeset/timeline-items/menu-config.ts deleted file mode 100644 index 2903d7ea..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/menu-config.ts +++ /dev/null @@ -1,14 +0,0 @@ -export enum MenuConfigAction { - /* eslint-disable @typescript-eslint/naming-convention */ - editPartyModification = 'editPartyModification', - deleteComment = 'deleteComment', - deleteFile = 'deleteFile', - removeUnsavedItem = 'removeUnsavedItem', - /* eslint-enable @typescript-eslint/naming-convention */ -} - -export interface MenuConfigItem { - action: MenuConfigAction; - label: string; - data?: any; -} diff --git a/src/app/sections/party-claim/changeset/timeline-items/party-modification-timeline-item/index.ts b/src/app/sections/party-claim/changeset/timeline-items/party-modification-timeline-item/index.ts deleted file mode 100644 index f58409a2..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/party-modification-timeline-item/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './party-modification-timeline-item.component'; diff --git a/src/app/sections/party-claim/changeset/timeline-items/party-modification-timeline-item/party-modification-content/party-modification-content.component.html b/src/app/sections/party-claim/changeset/timeline-items/party-modification-timeline-item/party-modification-content/party-modification-content.component.html deleted file mode 100644 index cee1959a..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/party-modification-timeline-item/party-modification-content/party-modification-content.component.html +++ /dev/null @@ -1,6 +0,0 @@ - - - {{ modification | ccPartyModificationName }} - - - diff --git a/src/app/sections/party-claim/changeset/timeline-items/party-modification-timeline-item/party-modification-content/party-modification-content.component.ts b/src/app/sections/party-claim/changeset/timeline-items/party-modification-timeline-item/party-modification-content/party-modification-content.component.ts deleted file mode 100644 index 0a8e8637..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/party-modification-timeline-item/party-modification-content/party-modification-content.component.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Component, Input } from '@angular/core'; -import { PartyModification } from '@vality/domain-proto/lib/claim_management'; - -@Component({ - selector: 'cc-party-modification-content', - templateUrl: 'party-modification-content.component.html', -}) -export class PartyModificationContentComponent { - @Input() - expanded = false; - - @Input() - modification: PartyModification; -} diff --git a/src/app/sections/party-claim/changeset/timeline-items/party-modification-timeline-item/party-modification-timeline-item.component.html b/src/app/sections/party-claim/changeset/timeline-items/party-modification-timeline-item/party-modification-timeline-item.component.html deleted file mode 100644 index a299c8a8..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/party-modification-timeline-item/party-modification-timeline-item.component.html +++ /dev/null @@ -1,30 +0,0 @@ - - - -
- - - - -
-
- - - {{ 'add' }} - - - - -
diff --git a/src/app/sections/party-claim/changeset/timeline-items/party-modification-timeline-item/party-modification-timeline-item.component.ts b/src/app/sections/party-claim/changeset/timeline-items/party-modification-timeline-item/party-modification-timeline-item.component.ts deleted file mode 100644 index d33f7831..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/party-modification-timeline-item/party-modification-timeline-item.component.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; - -import { ChangesetInfo } from '../../changeset-infos'; -import { TimelimeItemComponent } from '../timelime-item.component'; - -@Component({ - selector: 'cc-party-modification-timeline-item', - templateUrl: 'party-modification-timeline-item.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class PartyModificationTimelineItemComponent extends TimelimeItemComponent { - @Input() - expanded = false; - - @Input() - changesetInfo: ChangesetInfo; -} diff --git a/src/app/sections/party-claim/changeset/timeline-items/party-modification-timeline-item/party-modification-timeline-item.module.ts b/src/app/sections/party-claim/changeset/timeline-items/party-modification-timeline-item/party-modification-timeline-item.module.ts deleted file mode 100644 index 94a22b78..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/party-modification-timeline-item/party-modification-timeline-item.module.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { FlexModule } from '@angular/flex-layout'; -import { MatButtonModule } from '@angular/material/button'; -import { MatExpansionModule } from '@angular/material/expansion'; -import { MatIconModule } from '@angular/material/icon'; -import { MatMenuModule } from '@angular/material/menu'; - -import { ApiModelPipesModule } from '@cc/app/shared/pipes'; -import { PrettyJsonModule } from '@cc/components/pretty-json'; -import { TimelineModule } from '@cc/components/timeline'; - -import { TimelineComponentsModule } from '../../timeline-components'; -import { CommentTimelineItemModule } from '../comment-timeline-item/comment-timeline-item.module'; -import { PartyModificationContentComponent } from './party-modification-content/party-modification-content.component'; -import { PartyModificationTimelineItemComponent } from './party-modification-timeline-item.component'; - -@NgModule({ - declarations: [PartyModificationTimelineItemComponent, PartyModificationContentComponent], - imports: [ - TimelineModule, - CommentTimelineItemModule, - MatButtonModule, - MatIconModule, - MatMenuModule, - FlexModule, - MatExpansionModule, - TimelineComponentsModule, - CommonModule, - PrettyJsonModule, - ApiModelPipesModule, - ], - exports: [PartyModificationTimelineItemComponent], -}) -export class PartyModificationTimelineItemModule {} diff --git a/src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/reason-content/reason-content.component.html b/src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/reason-content/reason-content.component.html deleted file mode 100644 index 237ebed9..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/reason-content/reason-content.component.html +++ /dev/null @@ -1,5 +0,0 @@ - - - {{ text }} - - diff --git a/src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/reason-content/reason-content.component.ts b/src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/reason-content/reason-content.component.ts deleted file mode 100644 index 5868b6e2..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/reason-content/reason-content.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Component, Input } from '@angular/core'; - -@Component({ - selector: 'cc-reason-content', - templateUrl: 'reason-content.component.html', -}) -export class ReasonContentComponent { - @Input() - text: string; -} diff --git a/src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/status-action-icon.pipe.ts b/src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/status-action-icon.pipe.ts deleted file mode 100644 index 49e1b47a..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/status-action-icon.pipe.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Pipe, PipeTransform } from '@angular/core'; -import { ClaimStatus } from '@vality/domain-proto/lib/claim_management'; - -import { getUnionKey } from '@cc/utils/get-union-key'; - -@Pipe({ - name: 'ccStatusActionIcon', -}) -export class StatusActionIconPipe implements PipeTransform { - transform(status: ClaimStatus): string { - switch (getUnionKey(status)) { - case 'pending_acceptance': - case 'accepted': - return 'check'; - case 'revoked': - return 'block'; - case 'review': - return 'double_arrow'; - case 'pending': - return 'double_arrow'; - case 'denied': - return 'block'; - } - } -} diff --git a/src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/status-badge-color.pipe.ts b/src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/status-badge-color.pipe.ts deleted file mode 100644 index 80965879..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/status-badge-color.pipe.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Pipe, PipeTransform } from '@angular/core'; -import { ClaimStatus } from '@vality/domain-proto/lib/claim_management'; - -import { getUnionKey } from '@cc/utils/get-union-key'; - -@Pipe({ - name: 'ccStatusBadgeColor', -}) -export class StatusBadgeColorPipe implements PipeTransform { - transform(status: ClaimStatus): 'primary' | 'warn' | 'error' | 'success' { - switch (getUnionKey(status)) { - case 'pending_acceptance': - case 'accepted': - return 'success'; - case 'revoked': - return 'warn'; - case 'denied': - return 'error'; - } - } -} diff --git a/src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/status-header.pipe.ts b/src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/status-header.pipe.ts deleted file mode 100644 index 6184d4e9..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/status-header.pipe.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Pipe, PipeTransform } from '@angular/core'; -import { ClaimStatus } from '@vality/domain-proto/lib/claim_management'; - -import { getUnionKey } from '@cc/utils/get-union-key'; - -@Pipe({ - name: 'ccStatusHeader', -}) -export class StatusHeaderPipe implements PipeTransform { - transform(status: ClaimStatus): string { - switch (getUnionKey(status)) { - case 'pending_acceptance': - case 'accepted': - return 'accepted claim'; - case 'revoked': - return 'revoked claim'; - case 'review': - return 'changed claim status to review'; - case 'pending': - return 'changed claim status to pending'; - case 'denied': - return 'denied claim'; - } - } -} diff --git a/src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/status-timeline-item.component.html b/src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/status-timeline-item.component.html deleted file mode 100644 index 89fff89f..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/status-timeline-item.component.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - {{ - changesetInfo.modification.claim_modification.status_modification.status - | ccStatusActionIcon - }} - - - - - diff --git a/src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/status-timeline-item.component.ts b/src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/status-timeline-item.component.ts deleted file mode 100644 index f6d837a0..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/status-timeline-item.component.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; - -import { ChangesetInfo } from '../../changeset-infos'; - -@Component({ - selector: 'cc-status-timeline-item', - templateUrl: 'status-timeline-item.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class StatusTimelineItemComponent { - @Input() - changesetInfo: ChangesetInfo; - - getReason(): string { - const { status } = this.changesetInfo.modification.claim_modification.status_modification; - return status.revoked?.reason || status.denied?.reason; - } -} diff --git a/src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/status-timeline-item.module.ts b/src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/status-timeline-item.module.ts deleted file mode 100644 index 192d78b5..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/status-timeline-item/status-timeline-item.module.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { FlexModule } from '@angular/flex-layout'; -import { MatButtonModule } from '@angular/material/button'; -import { MatCardModule } from '@angular/material/card'; -import { MatIconModule } from '@angular/material/icon'; -import { MatMenuModule } from '@angular/material/menu'; - -import { TimelineModule } from '@cc/components/timeline'; - -import { TimelineComponentsModule } from '../../timeline-components'; -import { CommentTimelineItemModule } from '../comment-timeline-item/comment-timeline-item.module'; -import { ReasonContentComponent } from './reason-content/reason-content.component'; -import { StatusActionIconPipe } from './status-action-icon.pipe'; -import { StatusBadgeColorPipe } from './status-badge-color.pipe'; -import { StatusHeaderPipe } from './status-header.pipe'; -import { StatusTimelineItemComponent } from './status-timeline-item.component'; - -@NgModule({ - declarations: [ - StatusTimelineItemComponent, - StatusHeaderPipe, - StatusBadgeColorPipe, - StatusActionIconPipe, - ReasonContentComponent, - ], - imports: [ - TimelineModule, - CommentTimelineItemModule, - MatButtonModule, - MatIconModule, - MatMenuModule, - FlexModule, - TimelineComponentsModule, - MatCardModule, - CommonModule, - ], - exports: [StatusTimelineItemComponent], -}) -export class StatusTimelineItemModule {} diff --git a/src/app/sections/party-claim/changeset/timeline-items/timelime-item.component.ts b/src/app/sections/party-claim/changeset/timeline-items/timelime-item.component.ts deleted file mode 100644 index 61210374..00000000 --- a/src/app/sections/party-claim/changeset/timeline-items/timelime-item.component.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Component, EventEmitter, Input, Output } from '@angular/core'; - -import { MenuConfigItem } from './menu-config'; - -@Component({ - template: '', - selector: 'cc-timeline-item', -}) -export class TimelimeItemComponent { - @Input() - menuConfig: MenuConfigItem[]; - - @Output() - menuItemSelected: EventEmitter = new EventEmitter(); - - action(item: MenuConfigItem) { - this.menuItemSelected.emit(item); - } -} diff --git a/src/app/sections/party-claim/changeset/unsaved-changeset/edit-claim-changeset.service.ts b/src/app/sections/party-claim/changeset/unsaved-changeset/edit-claim-changeset.service.ts deleted file mode 100644 index 79409788..00000000 --- a/src/app/sections/party-claim/changeset/unsaved-changeset/edit-claim-changeset.service.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Injectable } from '@angular/core'; -import { MatDialog } from '@angular/material/dialog'; -import { Modification } from '@vality/domain-proto/lib/claim_management'; -import { Observable } from 'rxjs'; - -import { EditUnsavedModificationComponent } from './edit-unsaved-modification/edit-unsaved-modification.component'; -import { prepareModificationToEdit } from './prepare-modification-to-edit'; - -type PartyModificationPosition = number; - -@Injectable() -export class EditClaimChangesetService { - constructor(private dialog: MatDialog) {} - - edit(pos: PartyModificationPosition, mods: Modification[]): Observable { - const preparedModification = prepareModificationToEdit(mods[pos].party_modification); - return new Observable((observer) => { - const d = this.dialog.open(EditUnsavedModificationComponent, { - disableClose: true, - data: preparedModification, - width: '800px', - }); - d.afterClosed().subscribe((newMod) => { - if (newMod) { - mods[pos] = newMod; - } - observer.next(mods); - }); - }); - } -} diff --git a/src/app/sections/party-claim/changeset/unsaved-changeset/edit-unsaved-modification/edit-unsaved-modification.component.html b/src/app/sections/party-claim/changeset/unsaved-changeset/edit-unsaved-modification/edit-unsaved-modification.component.html deleted file mode 100644 index 9f7d5bbf..00000000 --- a/src/app/sections/party-claim/changeset/unsaved-changeset/edit-unsaved-modification/edit-unsaved-modification.component.html +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/app/sections/party-claim/changeset/unsaved-changeset/edit-unsaved-modification/edit-unsaved-modification.component.ts b/src/app/sections/party-claim/changeset/unsaved-changeset/edit-unsaved-modification/edit-unsaved-modification.component.ts deleted file mode 100644 index c4cbd61f..00000000 --- a/src/app/sections/party-claim/changeset/unsaved-changeset/edit-unsaved-modification/edit-unsaved-modification.component.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Component, Inject } from '@angular/core'; -import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms'; -import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; -import { PartyModification } from '@vality/domain-proto/lib/claim_management'; - -import { prepareModificationsToBackend } from '@cc/app/shared/components/party-modification-creator/create-modification-dialog/prepare-modifications-to-backend'; -import { getUnionKey, getUnionValue } from '@cc/utils/get-union-key'; - -type ModificationType = - | 'contractor_modification' - | 'contract_modification' - | 'shop_modification' - | 'wallet_modification'; - -@Component({ - templateUrl: 'edit-unsaved-modification.component.html', -}) -export class EditUnsavedModificationComponent { - mod = this.data; - form: UntypedFormGroup = this.fb.group({}); - modType: ModificationType = getUnionKey(this.data); - - constructor( - private dialogRef: MatDialogRef, - private fb: UntypedFormBuilder, - @Inject(MAT_DIALOG_DATA) private data: PartyModification - ) {} - - save(): void { - const modificationUnit = getUnionValue(this.mod); - this.dialogRef.close({ - party_modification: prepareModificationsToBackend({ - [getUnionKey(this.mod)]: { - id: modificationUnit.id, - modification: { - [getUnionKey(modificationUnit.modification)]: this.form.value, - }, - }, - }), - }); - } -} diff --git a/src/app/sections/party-claim/changeset/unsaved-changeset/edit-unsaved-modification/edit-unsaved-modification.module.ts b/src/app/sections/party-claim/changeset/unsaved-changeset/edit-unsaved-modification/edit-unsaved-modification.module.ts deleted file mode 100644 index b2d7bfc4..00000000 --- a/src/app/sections/party-claim/changeset/unsaved-changeset/edit-unsaved-modification/edit-unsaved-modification.module.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { FlexModule } from '@angular/flex-layout'; -import { MatButtonModule } from '@angular/material/button'; -import { MatDialogModule } from '@angular/material/dialog'; - -import { PartyModificationFormsModule } from '@cc/app/shared/components'; - -import { EditUnsavedModificationComponent } from './edit-unsaved-modification.component'; - -@NgModule({ - declarations: [EditUnsavedModificationComponent], - imports: [ - MatDialogModule, - CommonModule, - FlexModule, - MatButtonModule, - PartyModificationFormsModule, - ], - exports: [EditUnsavedModificationComponent], -}) -export class EditUnsavedModificationModule {} diff --git a/src/app/sections/party-claim/changeset/unsaved-changeset/prepare-modification-to-edit.ts b/src/app/sections/party-claim/changeset/unsaved-changeset/prepare-modification-to-edit.ts deleted file mode 100644 index a6d4b134..00000000 --- a/src/app/sections/party-claim/changeset/unsaved-changeset/prepare-modification-to-edit.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { CountryCode } from '@vality/domain-proto'; -import { PartyModification } from '@vality/domain-proto/lib/claim_management'; -import cloneDeep from 'lodash-es/cloneDeep'; - -export const prepareModificationToEdit = (modification: PartyModification): PartyModification => { - const prepared = cloneDeep(modification); - const countryObject = - prepared?.contractor_modification?.modification?.creation?.legal_entity - ?.international_legal_entity?.country; - if (countryObject && typeof countryObject === 'object') { - prepared.contractor_modification.modification.creation.legal_entity.international_legal_entity.country = - CountryCode[countryObject.id] as any; - } - return prepared; -}; diff --git a/src/app/sections/party-claim/changeset/unsaved-changeset/save-claim-changeset.service.ts b/src/app/sections/party-claim/changeset/unsaved-changeset/save-claim-changeset.service.ts deleted file mode 100644 index 1a9da380..00000000 --- a/src/app/sections/party-claim/changeset/unsaved-changeset/save-claim-changeset.service.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { Injectable } from '@angular/core'; -import { MatSnackBar } from '@angular/material/snack-bar'; -import { PartyID } from '@vality/domain-proto'; -import { Modification } from '@vality/domain-proto/lib/claim_management'; -import Int64 from '@vality/thrift-ts/lib/int64'; -import { Observable, of } from 'rxjs'; -import { catchError } from 'rxjs/operators'; - -import { ClaimManagementService } from '../../../../thrift-services/damsel/claim-management.service'; - -@Injectable() -export class SaveClaimChangesetService { - constructor( - private claimManagementService: ClaimManagementService, - private snackBar: MatSnackBar - ) {} - - save(partyID: PartyID, claimID: string, mods: Modification[]) { - return new Observable((observer) => { - if (mods.length === 0) { - observer.error('error'); - } - this.claimManagementService - .updateClaim(partyID, new Int64(parseInt(claimID, 10)) as unknown as number, mods) - .pipe(catchError(() => this.handleError())) - .subscribe((e) => { - if (e) { - observer.error('error'); - } - observer.next(); - observer.complete(); - }); - }); - } - - private handleError() { - this.snackBar.open('An error occurred while saving new modification', 'OK'); - return of('error'); - } -} diff --git a/src/app/sections/party-claim/changeset/unsaved-changeset/unsaved-claim-changeset.component.html b/src/app/sections/party-claim/changeset/unsaved-changeset/unsaved-claim-changeset.component.html deleted file mode 100644 index 7c109c1c..00000000 --- a/src/app/sections/party-claim/changeset/unsaved-changeset/unsaved-claim-changeset.component.html +++ /dev/null @@ -1,40 +0,0 @@ -
-
-

Unsaved changes

- -
- - - - - - - - -
diff --git a/src/app/sections/party-claim/changeset/unsaved-changeset/unsaved-claim-changeset.component.ts b/src/app/sections/party-claim/changeset/unsaved-changeset/unsaved-claim-changeset.component.ts deleted file mode 100644 index eaeae081..00000000 --- a/src/app/sections/party-claim/changeset/unsaved-changeset/unsaved-claim-changeset.component.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { - ChangeDetectionStrategy, - Component, - EventEmitter, - Input, - OnInit, - Output, -} from '@angular/core'; -import { PartyID } from '@vality/domain-proto'; -import { ClaimChangeset } from '@vality/domain-proto/lib/claim_management'; - -import { ChangesetInfoType } from '../changeset-infos'; -import { MenuConfigAction, MenuConfigItem } from '../timeline-items/menu-config'; -import { UnsavedClaimChangesetService } from './unsaved-claim-changeset.service'; - -@Component({ - selector: 'cc-unsaved-claim-changeset', - templateUrl: 'unsaved-claim-changeset.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class UnsavedClaimChangesetComponent implements OnInit { - @Input() - changeset: ClaimChangeset; - - @Input() - partyID: PartyID; - - @Input() - claimID: string; - - @Output() - changesetUpdated = new EventEmitter(); - - inProgress$ = this.unsavedClaimChangesetService.inProgress$; - - unsavedChangesetInfos$ = this.unsavedClaimChangesetService.unsavedChangesetInfos$; - - changesetInfoTypes = ChangesetInfoType; - - fileMenuConfig: MenuConfigItem[] = [ - { action: MenuConfigAction.removeUnsavedItem, label: 'Remove' }, - ]; - commentMenuConfig: MenuConfigItem[] = [ - { action: MenuConfigAction.removeUnsavedItem, label: 'Remove' }, - ]; - partyModMenuConfig: MenuConfigItem[] = [ - { action: MenuConfigAction.removeUnsavedItem, label: 'Remove' }, - { action: MenuConfigAction.editPartyModification, label: 'Edit' }, - ]; - questionaryMenuConfig: MenuConfigItem[] = [ - { action: MenuConfigAction.removeUnsavedItem, label: 'Remove' }, - ]; - - constructor(private unsavedClaimChangesetService: UnsavedClaimChangesetService) {} - - ngOnInit(): void { - this.unsavedClaimChangesetService.changesetUpdated$.subscribe(() => { - this.changesetUpdated.emit(); - }); - } - - simpleTrackBy(index: number): number { - return index; - } - - save(): void { - this.unsavedClaimChangesetService.save(this.partyID, this.claimID); - } - - menuItemSelected($event: MenuConfigItem, i: number): void { - switch ($event.action) { - case MenuConfigAction.removeUnsavedItem: - this.unsavedClaimChangesetService.remove(i); - break; - case MenuConfigAction.editPartyModification: - this.unsavedClaimChangesetService.edit(i); - break; - default: - console.warn('Action not implemented'); - } - } -} diff --git a/src/app/sections/party-claim/changeset/unsaved-changeset/unsaved-claim-changeset.module.ts b/src/app/sections/party-claim/changeset/unsaved-changeset/unsaved-claim-changeset.module.ts deleted file mode 100644 index 48c87564..00000000 --- a/src/app/sections/party-claim/changeset/unsaved-changeset/unsaved-claim-changeset.module.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { FlexModule } from '@angular/flex-layout'; -import { MatButtonModule } from '@angular/material/button'; - -import { TimelineModule } from '@cc/components/timeline'; - -import { CommentTimelineItemModule } from '../timeline-items/comment-timeline-item/comment-timeline-item.module'; -import { FileTimelineItemModule } from '../timeline-items/file-timeline-item/file-timeline-item.module'; -import { PartyModificationTimelineItemModule } from '../timeline-items/party-modification-timeline-item/party-modification-timeline-item.module'; -import { StatusTimelineItemModule } from '../timeline-items/status-timeline-item/status-timeline-item.module'; -import { EditClaimChangesetService } from './edit-claim-changeset.service'; -import { UnsavedClaimChangesetComponent } from './unsaved-claim-changeset.component'; -import { UnsavedClaimChangesetService } from './unsaved-claim-changeset.service'; - -@NgModule({ - declarations: [UnsavedClaimChangesetComponent], - imports: [ - TimelineModule, - FlexModule, - MatButtonModule, - CommonModule, - FileTimelineItemModule, - CommentTimelineItemModule, - PartyModificationTimelineItemModule, - StatusTimelineItemModule, - ], - providers: [EditClaimChangesetService, UnsavedClaimChangesetService], - exports: [UnsavedClaimChangesetComponent], -}) -export class UnsavedClaimChangesetModule {} diff --git a/src/app/sections/party-claim/changeset/unsaved-changeset/unsaved-claim-changeset.service.ts b/src/app/sections/party-claim/changeset/unsaved-changeset/unsaved-claim-changeset.service.ts deleted file mode 100644 index e98fb47d..00000000 --- a/src/app/sections/party-claim/changeset/unsaved-changeset/unsaved-claim-changeset.service.ts +++ /dev/null @@ -1,117 +0,0 @@ -import { Injectable } from '@angular/core'; -import { PartyID } from '@vality/domain-proto'; -import { - Modification, - ModificationUnit, - PartyModification, -} from '@vality/domain-proto/lib/claim_management'; -import { BehaviorSubject, forkJoin, merge, Observable, of, Subject } from 'rxjs'; -import { catchError, first, map, shareReplay, switchMap, tap } from 'rxjs/operators'; - -import { PartyModificationEmitter } from '@cc/app/shared/components'; -import { progress } from '@cc/app/shared/custom-operators'; - -import { KeycloakTokenInfoService } from '../../../../keycloak-token-info.service'; -import { ChangesetInfo, toChangesetInfos } from '../changeset-infos'; -import { EditClaimChangesetService } from './edit-claim-changeset.service'; -import { SaveClaimChangesetService } from './save-claim-changeset.service'; - -type PartyModificationPosition = number; - -@Injectable() -export class UnsavedClaimChangesetService { - private save$: Subject<{ partyID: PartyID; claimID: string }> = new Subject(); - private remove$: Subject = new Subject(); - private edit$: Subject = new Subject(); - private unsaved$ = new BehaviorSubject([]); - private hasError$ = new Subject(); - - // eslint-disable-next-line @typescript-eslint/member-ordering - changesetUpdated$ = new Subject(); - - // eslint-disable-next-line @typescript-eslint/member-ordering - unsavedChangesetInfos$: Observable = this.unsaved$.pipe( - map((mods) => { - const { name } = this.keycloakTokenInfoService.decodedUserToken; - return toChangesetInfos( - mods.map( - (mod) => - ({ - modification: mod, - user_info: { username: name }, - } as ModificationUnit) - ) - ); - }), - shareReplay(1) - ); - - // eslint-disable-next-line @typescript-eslint/member-ordering - inProgress$ = progress(this.save$, merge(this.changesetUpdated$, this.hasError$)); - - constructor( - private keycloakTokenInfoService: KeycloakTokenInfoService, - private saveClaimChangesetService: SaveClaimChangesetService, - private editClaimChangesetService: EditClaimChangesetService, - private partyModificationEmitter: PartyModificationEmitter - ) { - this.unsavedChangesetInfos$.subscribe(); - - this.remove$ - .pipe( - switchMap((pos) => forkJoin([of(pos), this.unsaved$.pipe(first())])), - map(([pos, modifications]) => modifications.filter((_, i) => pos !== i)) - ) - .subscribe((modifications) => this.unsaved$.next(modifications)); - - this.save$ - .pipe( - tap(() => this.hasError$.next()), - switchMap(({ partyID, claimID }) => - this.saveClaimChangesetService - .save(partyID, claimID, this.unsaved$.getValue()) - .pipe( - catchError(() => { - this.hasError$.next(true); - return of(); - }) - ) - ) - ) - .subscribe(() => { - this.unsaved$.next([]); - this.changesetUpdated$.next(); - }); - - this.edit$ - .pipe( - switchMap((pos) => - this.editClaimChangesetService.edit(pos, this.unsaved$.getValue()) - ) - ) - .subscribe((mods) => { - this.unsaved$.next(mods); - }); - - this.partyModificationEmitter.modification$.subscribe( - (partyModification: PartyModification) => - this.addModification({ party_modification: partyModification }) - ); - } - - save(partyID: PartyID, claimID: string) { - this.save$.next({ partyID, claimID }); - } - - edit(pos: number) { - this.edit$.next(pos); - } - - addModification(mod: Modification) { - this.unsaved$.next([...this.unsaved$.getValue(), mod]); - } - - remove(pos: PartyModificationPosition) { - this.remove$.next(pos); - } -} diff --git a/src/app/sections/party-claim/fetch-claim.service.ts b/src/app/sections/party-claim/fetch-claim.service.ts deleted file mode 100644 index 9b6ca8db..00000000 --- a/src/app/sections/party-claim/fetch-claim.service.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Injectable } from '@angular/core'; -import { MatSnackBar } from '@angular/material/snack-bar'; -import { PartyID } from '@vality/domain-proto'; -import Int64 from '@vality/thrift-ts/lib/int64'; -import { of, ReplaySubject } from 'rxjs'; -import { catchError, filter, shareReplay, switchMap } from 'rxjs/operators'; - -import { progress } from '@cc/app/shared/custom-operators'; - -import { ClaimManagementService } from '../../thrift-services/damsel/claim-management.service'; - -@Injectable() -export class FetchClaimService { - private getClaim$: ReplaySubject<{ partyID: PartyID; claimID: string }> = new ReplaySubject(); - - // eslint-disable-next-line @typescript-eslint/member-ordering - claim$ = this.getClaim$.pipe( - switchMap(({ partyID, claimID }) => - this.claimManagementService - .getClaim(partyID, new Int64(parseInt(claimID, 10)) as unknown as number) - .pipe( - catchError((e) => { - console.error(e); - this.snackBar.open('An error occurred while fetching claim', 'OK'); - return of('error'); - }) - ) - ), - filter((result) => result !== 'error'), - shareReplay(1) - ); - // eslint-disable-next-line @typescript-eslint/member-ordering - isLoading$ = progress(this.getClaim$, this.claim$); - - constructor( - private claimManagementService: ClaimManagementService, - private snackBar: MatSnackBar - ) { - this.getClaim$.subscribe(); - } - - getClaim(partyID: PartyID, claimID: string) { - this.getClaim$.next({ partyID, claimID }); - } -} diff --git a/src/app/sections/party-claim/index.ts b/src/app/sections/party-claim/index.ts deleted file mode 100644 index 6a97e077..00000000 --- a/src/app/sections/party-claim/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './party-claim.module'; diff --git a/src/app/sections/party-claim/party-claim-actions/file-uploader/file-uploader.component.html b/src/app/sections/party-claim/party-claim-actions/file-uploader/file-uploader.component.html deleted file mode 100644 index 1e1e98bc..00000000 --- a/src/app/sections/party-claim/party-claim-actions/file-uploader/file-uploader.component.html +++ /dev/null @@ -1,5 +0,0 @@ -
- -
diff --git a/src/app/sections/party-claim/party-claim-actions/file-uploader/file-uploader.component.scss b/src/app/sections/party-claim/party-claim-actions/file-uploader/file-uploader.component.scss deleted file mode 100644 index d637ba16..00000000 --- a/src/app/sections/party-claim/party-claim-actions/file-uploader/file-uploader.component.scss +++ /dev/null @@ -1,3 +0,0 @@ -.cc-file-uploader:hover { - cursor: pointer; -} diff --git a/src/app/sections/party-claim/party-claim-actions/file-uploader/file-uploader.component.ts b/src/app/sections/party-claim/party-claim-actions/file-uploader/file-uploader.component.ts deleted file mode 100644 index 7c060f7e..00000000 --- a/src/app/sections/party-claim/party-claim-actions/file-uploader/file-uploader.component.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core'; -import { Modification } from '@vality/domain-proto/lib/claim_management'; - -import { FileUploaderService } from './file-uploader.service'; - -@Component({ - selector: 'cc-file-uploader', - templateUrl: 'file-uploader.component.html', - styleUrls: ['file-uploader.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, - providers: [FileUploaderService], -}) -export class FileUploaderComponent { - @Output() - filesUploaded: EventEmitter = new EventEmitter(); - - @Input() - disabled: boolean; - - startUploading$ = this.fileUploaderService.startUploading$; - inProgress$ = this.fileUploaderService.inProgress$; - - constructor(private fileUploaderService: FileUploaderService) {} - - startUploading(files: File[]) { - this.startUploading$.next(files); - } -} diff --git a/src/app/sections/party-claim/party-claim-actions/file-uploader/file-uploader.module.ts b/src/app/sections/party-claim/party-claim-actions/file-uploader/file-uploader.module.ts deleted file mode 100644 index f6a01c10..00000000 --- a/src/app/sections/party-claim/party-claim-actions/file-uploader/file-uploader.module.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { FlexModule } from '@angular/flex-layout'; -import { MatButtonModule } from '@angular/material/button'; -import { MatIconModule } from '@angular/material/icon'; -import { ngfModule } from 'angular-file'; - -import { FileUploaderComponent } from './file-uploader.component'; - -@NgModule({ - imports: [FlexModule, CommonModule, MatIconModule, MatButtonModule, ngfModule], - exports: [FileUploaderComponent], - declarations: [FileUploaderComponent], -}) -export class FileUploaderModule {} diff --git a/src/app/sections/party-claim/party-claim-actions/file-uploader/file-uploader.service.ts b/src/app/sections/party-claim/party-claim-actions/file-uploader/file-uploader.service.ts deleted file mode 100644 index d1a1bcd3..00000000 --- a/src/app/sections/party-claim/party-claim-actions/file-uploader/file-uploader.service.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { HttpClient } from '@angular/common/http'; -import { Injectable } from '@angular/core'; -import { MatSnackBar } from '@angular/material/snack-bar'; -import { Modification } from '@vality/domain-proto/lib/claim_management'; -import { NewFileResult } from '@vality/file-storage-proto'; -import { Value } from '@vality/file-storage-proto/lib/msgpack'; -import * as moment from 'moment'; -import { forkJoin, merge, Observable, of, Subject } from 'rxjs'; -import { catchError, filter, map, shareReplay, switchMap } from 'rxjs/operators'; - -import { progress } from '@cc/app/shared/custom-operators'; - -import { FileStorageService } from '../../../../thrift-services/file-storage/file-storage.service'; -import { UnsavedClaimChangesetService } from '../../changeset/unsaved-changeset/unsaved-claim-changeset.service'; - -@Injectable() -export class FileUploaderService { - startUploading$ = new Subject(); - filesUploadingError$ = new Subject(); - - filesUploaded$: Observable = this.startUploading$.pipe( - switchMap((files) => - this.uploadFile(files.pop()).pipe( - catchError((e) => { - this.snackBar.open('File uploading error', 'OK'); - this.filesUploadingError$.next(e); - return of('error'); - }) - ) - ), - filter((result) => result !== 'error'), - shareReplay(1) - ); - - inProgress$: Observable = progress( - this.startUploading$, - merge(this.filesUploaded$, this.filesUploadingError$) - ); - constructor( - private fileStorageService: FileStorageService, - private snackBar: MatSnackBar, - private http: HttpClient, - private unsavedClaimChangesetService: UnsavedClaimChangesetService - ) { - this.filesUploaded$.subscribe((fileId) => - this.unsavedClaimChangesetService.addModification(this.createModification(fileId)) - ); - } - - uploadFile(file: File): Observable { - return this.getUploadLink().pipe( - switchMap((uploadData) => - forkJoin([ - of(uploadData.file_data_id), - this.uploadFileToUrl(file, uploadData.upload_url), - ]) - ), - map(([fileId]) => fileId) - ); - } - - private getUploadLink(): Observable { - return this.fileStorageService.createNewFile( - new Map(), - moment().add(1, 'h').toISOString() - ); - } - - private uploadFileToUrl(file: File, url: string): Observable { - return this.http.put(url, file, { - headers: { - 'Content-Disposition': `attachment;filename=${encodeURI(file.name)}`, - 'Content-Type': '', - }, - }); - } - - private createModification(id: string): Modification { - return { - claim_modification: { - file_modification: { - id, - modification: { - creation: {}, - }, - }, - }, - }; - } -} diff --git a/src/app/sections/party-claim/party-claim-actions/index.ts b/src/app/sections/party-claim/party-claim-actions/index.ts deleted file mode 100644 index ac407fb6..00000000 --- a/src/app/sections/party-claim/party-claim-actions/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './party-claim-actions.module'; diff --git a/src/app/sections/party-claim/party-claim-actions/party-claim-actions.component.html b/src/app/sections/party-claim/party-claim-actions/party-claim-actions.component.html deleted file mode 100644 index 81042cfe..00000000 --- a/src/app/sections/party-claim/party-claim-actions/party-claim-actions.component.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - diff --git a/src/app/sections/party-claim/party-claim-actions/party-claim-actions.component.ts b/src/app/sections/party-claim/party-claim-actions/party-claim-actions.component.ts deleted file mode 100644 index 3e79ed97..00000000 --- a/src/app/sections/party-claim/party-claim-actions/party-claim-actions.component.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { - ChangeDetectionStrategy, - Component, - EventEmitter, - Input, - OnDestroy, - OnInit, - Output, -} from '@angular/core'; -import { PartyID } from '@vality/domain-proto'; -import { ClaimChangeset, ClaimStatus } from '@vality/domain-proto/lib/claim_management'; -import { map, take } from 'rxjs/operators'; - -import { PartyModificationCreatorDialogService } from '@cc/app/shared/components'; - -import { UnsavedClaimChangesetService } from '../changeset/unsaved-changeset/unsaved-claim-changeset.service'; -import { StatusChangerService } from './status-changer'; -import { getAvailableClaimStatuses } from './status-changer/get-available-claim-statuses'; - -@Component({ - selector: 'cc-party-claim-actions', - templateUrl: 'party-claim-actions.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class PartyClaimActionsComponent implements OnInit, OnDestroy { - @Input() - partyID: PartyID; - - @Input() - claimID: string; - - @Input() - status: ClaimStatus; - - @Input() - changeset: ClaimChangeset; - - @Output() - changesetUpdated = new EventEmitter(); - - constructor( - private unsavedClaimChangesetService: UnsavedClaimChangesetService, - private partyModificationCreatorDialogService: PartyModificationCreatorDialogService, - private statusChangerService: StatusChangerService - ) {} - - ngOnInit(): void { - this.statusChangerService.init(); - this.statusChangerService.statusChanged$.subscribe(() => this.changesetUpdated.emit()); - } - - ngOnDestroy(): void { - this.statusChangerService.destroy(); - } - - addPartyModification() { - this.unsavedClaimChangesetService.unsavedChangesetInfos$ - .pipe( - take(1), - map((infos) => infos.map((info) => info.modification)) - ) - .subscribe((unsaved) => - this.partyModificationCreatorDialogService.open(this.partyID, [ - ...unsaved, - ...this.changeset.map((item) => item.modification), - ]) - ); - } - - changeStatus() { - this.statusChangerService.changeStatus(this.partyID, this.claimID, this.status); - } - - canChangeStatus(): boolean { - return getAvailableClaimStatuses(this.status).length > 0; - } -} diff --git a/src/app/sections/party-claim/party-claim-actions/party-claim-actions.module.ts b/src/app/sections/party-claim/party-claim-actions/party-claim-actions.module.ts deleted file mode 100644 index 10e8919f..00000000 --- a/src/app/sections/party-claim/party-claim-actions/party-claim-actions.module.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { NgModule } from '@angular/core'; -import { FlexModule } from '@angular/flex-layout'; -import { MatButtonModule } from '@angular/material/button'; -import { MatCardModule } from '@angular/material/card'; - -import { FileUploaderModule } from './file-uploader/file-uploader.module'; -import { PartyClaimActionsComponent } from './party-claim-actions.component'; -import { SendCommentModule } from './send-comment/send-comment.module'; -import { StatusChangerModule } from './status-changer'; - -@NgModule({ - declarations: [PartyClaimActionsComponent], - imports: [ - MatCardModule, - FlexModule, - MatButtonModule, - SendCommentModule, - FileUploaderModule, - StatusChangerModule, - ], - exports: [PartyClaimActionsComponent], -}) -export class PartyClaimActionsModule {} diff --git a/src/app/sections/party-claim/party-claim-actions/send-comment/index.ts b/src/app/sections/party-claim/party-claim-actions/send-comment/index.ts deleted file mode 100644 index ec71f70b..00000000 --- a/src/app/sections/party-claim/party-claim-actions/send-comment/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './send-comment.component'; diff --git a/src/app/sections/party-claim/party-claim-actions/send-comment/send-comment.component.html b/src/app/sections/party-claim/party-claim-actions/send-comment/send-comment.component.html deleted file mode 100644 index ffc31177..00000000 --- a/src/app/sections/party-claim/party-claim-actions/send-comment/send-comment.component.html +++ /dev/null @@ -1,16 +0,0 @@ -
- - Leave a comment... - - {{ form.controls.comment.value?.length || 0 }}/1000 - -
- -
-
diff --git a/src/app/sections/party-claim/party-claim-actions/send-comment/send-comment.component.scss b/src/app/sections/party-claim/party-claim-actions/send-comment/send-comment.component.scss deleted file mode 100644 index 4f9406ef..00000000 --- a/src/app/sections/party-claim/party-claim-actions/send-comment/send-comment.component.scss +++ /dev/null @@ -1,7 +0,0 @@ -@import '../../../../../../node_modules/@angular/material/theming'; - -$cc-send-comment-action-padding: 8px 0 0 0; - -.send-comment-action { - padding: $cc-send-comment-action-padding; -} diff --git a/src/app/sections/party-claim/party-claim-actions/send-comment/send-comment.component.ts b/src/app/sections/party-claim/party-claim-actions/send-comment/send-comment.component.ts deleted file mode 100644 index 363c1b87..00000000 --- a/src/app/sections/party-claim/party-claim-actions/send-comment/send-comment.component.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; -import { UntypedFormGroup } from '@angular/forms'; - -import { SendCommentService } from './send-comment.service'; - -@Component({ - selector: 'cc-send-comment', - templateUrl: 'send-comment.component.html', - styleUrls: ['send-comment.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, - providers: [SendCommentService], -}) -export class SendCommentComponent { - @Input() - disabled?: boolean; - - form: UntypedFormGroup = this.sendCommentService.form; - inProgress$ = this.sendCommentService.inProgress$; - - constructor(private sendCommentService: SendCommentService) {} - - sendComment() { - this.sendCommentService.sendComment(); - } -} diff --git a/src/app/sections/party-claim/party-claim-actions/send-comment/send-comment.module.ts b/src/app/sections/party-claim/party-claim-actions/send-comment/send-comment.module.ts deleted file mode 100644 index 090d5e38..00000000 --- a/src/app/sections/party-claim/party-claim-actions/send-comment/send-comment.module.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { FlexModule } from '@angular/flex-layout'; -import { ReactiveFormsModule } from '@angular/forms'; -import { MatButtonModule } from '@angular/material/button'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatIconModule } from '@angular/material/icon'; -import { MatInputModule } from '@angular/material/input'; - -import { SendCommentComponent } from './send-comment.component'; - -@NgModule({ - declarations: [SendCommentComponent], - imports: [ - MatIconModule, - MatButtonModule, - MatFormFieldModule, - FlexModule, - MatInputModule, - CommonModule, - ReactiveFormsModule, - ], - exports: [SendCommentComponent], -}) -export class SendCommentModule {} diff --git a/src/app/sections/party-claim/party-claim-actions/send-comment/send-comment.service.ts b/src/app/sections/party-claim/party-claim-actions/send-comment/send-comment.service.ts deleted file mode 100644 index e1cbd084..00000000 --- a/src/app/sections/party-claim/party-claim-actions/send-comment/send-comment.service.ts +++ /dev/null @@ -1,98 +0,0 @@ -import { Injectable } from '@angular/core'; -import { UntypedFormBuilder, Validators } from '@angular/forms'; -import { MatSnackBar } from '@angular/material/snack-bar'; -import { Modification } from '@vality/domain-proto/lib/claim_management'; -import { ConversationId, User } from '@vality/messages-proto'; -import { forkJoin, merge, of, Subject } from 'rxjs'; -import { catchError, filter, shareReplay, switchMap, tap } from 'rxjs/operators'; -import * as uuid from 'uuid/v4'; - -import { progress } from '@cc/app/shared/custom-operators'; - -import { KeycloakTokenInfoService } from '../../../../keycloak-token-info.service'; -import { MessagesService } from '../../../../thrift-services/messages/messages.service'; -import { createSingleMessageConversationParams } from '../../../../thrift-services/messages/utils'; -import { UnsavedClaimChangesetService } from '../../changeset/unsaved-changeset/unsaved-claim-changeset.service'; - -@Injectable() -export class SendCommentService { - private hasError$ = new Subject(); - private sendComment$ = new Subject(); - - // eslint-disable-next-line @typescript-eslint/member-ordering - form = this.fb.group({ - comment: ['', [Validators.maxLength(1000), Validators.required]], - }); - - // eslint-disable-next-line @typescript-eslint/member-ordering - comment$ = this.sendComment$.pipe( - tap(() => this.hasError$.next()), - switchMap(() => { - const text = this.form.value.comment; - const { name, email, sub } = this.keycloakTokenInfoService.decodedUserToken; - const user: User = { fullname: name, email, user_id: sub }; - const conversationId = uuid(); - const conversation = createSingleMessageConversationParams(conversationId, text, sub); - return forkJoin([ - of(conversationId), - this.messagesService.saveConversations([conversation], user).pipe( - catchError((e) => { - console.error(e); - this.snackBar.open(`There was an error when sending the message.`, 'OK', { - duration: 5000, - }); - this.hasError$.next(e); - return of('error'); - }) - ), - ]); - }), - tap(([conversationID]) => - this.unsavedClaimChangesetService.addModification( - this.createModification(conversationID) - ) - ), - filter(([, result]) => result !== 'error'), - shareReplay(1) - ); - - // eslint-disable-next-line @typescript-eslint/member-ordering - inProgress$ = progress(this.sendComment$, merge(this.comment$, this.hasError$)); - - constructor( - private fb: UntypedFormBuilder, - private messagesService: MessagesService, - private keycloakTokenInfoService: KeycloakTokenInfoService, - private snackBar: MatSnackBar, - private unsavedClaimChangesetService: UnsavedClaimChangesetService - ) { - this.inProgress$.subscribe((inProgress) => { - if (inProgress) { - this.form.controls.comment.disable(); - } else { - this.form.controls.comment.enable(); - } - }); - - this.comment$.subscribe(() => { - this.form.reset(); - }); - } - - sendComment() { - this.sendComment$.next(); - } - - private createModification(id: ConversationId): Modification { - return { - claim_modification: { - comment_modification: { - id, - modification: { - creation: {}, - }, - }, - }, - }; - } -} diff --git a/src/app/sections/party-claim/party-claim-actions/status-changer/get-available-claim-statuses.ts b/src/app/sections/party-claim/party-claim-actions/status-changer/get-available-claim-statuses.ts deleted file mode 100644 index 4a93b318..00000000 --- a/src/app/sections/party-claim/party-claim-actions/status-changer/get-available-claim-statuses.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { ClaimStatus as CMClaimStatus } from '@vality/domain-proto/lib/claim_management'; - -import { ClaimStatus } from '@cc/app/api/claim-management'; - -import { extractClaimStatus } from '../../../../shared/utils'; - -export const getAvailableClaimStatuses = (status: CMClaimStatus): ClaimStatus[] => { - switch (extractClaimStatus(status)) { - case ClaimStatus.Pending: - return [ - ClaimStatus.Accepted, - ClaimStatus.Review, - ClaimStatus.Denied, - ClaimStatus.Revoked, - ]; - case ClaimStatus.Review: - return [ - ClaimStatus.Accepted, - ClaimStatus.Pending, - ClaimStatus.Denied, - ClaimStatus.Revoked, - ]; - default: - return []; - } -}; diff --git a/src/app/sections/party-claim/party-claim-actions/status-changer/index.ts b/src/app/sections/party-claim/party-claim-actions/status-changer/index.ts deleted file mode 100644 index 35cf3673..00000000 --- a/src/app/sections/party-claim/party-claim-actions/status-changer/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './status-changer.module'; -export * from './status-changer.service'; diff --git a/src/app/sections/party-claim/party-claim-actions/status-changer/status-changer-dialog.component.html b/src/app/sections/party-claim/party-claim-actions/status-changer/status-changer-dialog.component.html deleted file mode 100644 index db0a89db..00000000 --- a/src/app/sections/party-claim/party-claim-actions/status-changer/status-changer-dialog.component.html +++ /dev/null @@ -1,41 +0,0 @@ -
Change claim status
- -
- - - {{ - status | ccClaimStatus - }} - - - - - - - Reason - - - {{ reason }} - - - -
-
- - - - - diff --git a/src/app/sections/party-claim/party-claim-actions/status-changer/status-changer-dialog.component.scss b/src/app/sections/party-claim/party-claim-actions/status-changer/status-changer-dialog.component.scss deleted file mode 100644 index dd0e4211..00000000 --- a/src/app/sections/party-claim/party-claim-actions/status-changer/status-changer-dialog.component.scss +++ /dev/null @@ -1,3 +0,0 @@ -.hidden { - display: none; -} diff --git a/src/app/sections/party-claim/party-claim-actions/status-changer/status-changer-dialog.component.ts b/src/app/sections/party-claim/party-claim-actions/status-changer/status-changer-dialog.component.ts deleted file mode 100644 index 5d37d9aa..00000000 --- a/src/app/sections/party-claim/party-claim-actions/status-changer/status-changer-dialog.component.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { Component, Inject, OnInit } from '@angular/core'; -import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; -import { ClaimStatus as CMClaimStatus } from '@vality/domain-proto/lib/claim_management'; - -import { ClaimStatus } from '@cc/app/api/claim-management'; -import { AppAuthGuardService, ClaimManagementRole } from '@cc/app/shared/services'; - -import { getAvailableClaimStatuses } from './get-available-claim-statuses'; -import { StatusChangerDialogService } from './status-changer-dialog.service'; - -interface ActionsInterface { - partyID: string; - claimID: string; - claimStatus: CMClaimStatus; -} - -@Component({ - templateUrl: 'status-changer-dialog.component.html', - providers: [StatusChangerDialogService], - styleUrls: ['status-changer-dialog.component.scss'], -}) -export class StatusChangerDialogComponent implements OnInit { - statuses = getAvailableClaimStatuses(this.data.claimStatus).filter((status) => - this.statusFilter(status) - ); - form = this.statusChangerDialogService.form; - inProgress$ = this.statusChangerDialogService.inProgress$; - - // It's necessary to hardcode reasons (backend issue) - revokeReasons = [ - 'Длительное ожидание подключения', - 'Не устраивает комиссия', - 'Большой пакет документов', - 'Не подходит продукт', - 'Нет сплитов', - ]; - - // eslint-disable-next-line @typescript-eslint/naming-convention - ClaimStatus = ClaimStatus; - - constructor( - private dialogRef: MatDialogRef, - private statusChangerDialogService: StatusChangerDialogService, - private appAuthGuardService: AppAuthGuardService, - @Inject(MAT_DIALOG_DATA) private data: ActionsInterface - ) {} - - ngOnInit(): void { - this.statusChangerDialogService.statusChanged$.subscribe(() => this.dialogRef.close(true)); - } - - confirm(): void { - this.statusChangerDialogService.updateClaim(this.data.partyID, this.data.claimID); - } - - isStatus(status: ClaimStatus): boolean { - const { type } = this.form.getRawValue(); - return status === type; - } - - private statusFilter(status: ClaimStatus): boolean { - switch (status) { - case ClaimStatus.Accepted: - return this.appAuthGuardService.userHasRoles([ClaimManagementRole.AcceptClaim]); - case ClaimStatus.Denied: - return this.appAuthGuardService.userHasRoles([ClaimManagementRole.DenyClaim]); - case ClaimStatus.Review: - return this.appAuthGuardService.userHasRoles([ - ClaimManagementRole.RequestClaimReview, - ]); - case ClaimStatus.Revoked: - return this.appAuthGuardService.userHasRoles([ClaimManagementRole.RevokeClaim]); - case ClaimStatus.Pending: - return this.appAuthGuardService.userHasRoles([ - ClaimManagementRole.RequestClaimChanges, - ]); - default: - return false; - } - } -} diff --git a/src/app/sections/party-claim/party-claim-actions/status-changer/status-changer-dialog.service.ts b/src/app/sections/party-claim/party-claim-actions/status-changer/status-changer-dialog.service.ts deleted file mode 100644 index 6a99a96f..00000000 --- a/src/app/sections/party-claim/party-claim-actions/status-changer/status-changer-dialog.service.ts +++ /dev/null @@ -1,122 +0,0 @@ -import { Injectable } from '@angular/core'; -import { UntypedFormBuilder, Validators } from '@angular/forms'; -import { MatSnackBar } from '@angular/material/snack-bar'; -import Int64 from '@vality/thrift-ts/lib/int64'; -import { merge, of, Subject } from 'rxjs'; -import { - catchError, - distinctUntilChanged, - filter, - pairwise, - pluck, - shareReplay, - switchMap, - tap, -} from 'rxjs/operators'; - -import { ClaimStatus } from '@cc/app/api/claim-management'; -import { progress } from '@cc/app/shared/custom-operators'; - -import { ClaimManagementService } from '../../../../thrift-services/damsel/claim-management.service'; - -class UpdateClaim { - partyID: string; - claimID: string; - action: ClaimStatus; -} - -@Injectable() -export class StatusChangerDialogService { - private updateClaim$ = new Subject(); - private hasError$ = new Subject(); - - // eslint-disable-next-line @typescript-eslint/member-ordering - form = this.initForm(); - - // eslint-disable-next-line @typescript-eslint/member-ordering - statusChanged$ = this.updateClaim$.pipe( - tap(() => this.hasError$.next()), - switchMap(({ partyID, claimID, action }) => { - const intClaimID = new Int64(parseInt(claimID, 10)); - switch (action) { - case ClaimStatus.Denied: - return this.claimManagementService - .denyClaim( - partyID, - intClaimID as unknown as number, - this.form.getRawValue().reason - ) - .pipe(catchError(() => this.handleError())); - case ClaimStatus.Pending: - return this.claimManagementService - .requestClaimChanges(partyID, intClaimID as unknown as number) - .pipe(catchError(() => this.handleError())); - case ClaimStatus.Review: - return this.claimManagementService - .requestClaimReview(partyID, intClaimID as unknown as number) - .pipe(catchError(() => this.handleError())); - case ClaimStatus.Accepted: - return this.claimManagementService - .acceptClaim(partyID, intClaimID as unknown as number) - .pipe(catchError(() => this.handleError())); - case ClaimStatus.Revoked: - return this.claimManagementService - .revokeClaim( - partyID, - intClaimID as unknown as number, - this.form.getRawValue().reason - ) - .pipe(catchError(() => this.handleError())); - default: - throw new Error('Wrong action type!'); - } - }), - filter((result) => result !== 'error'), - shareReplay(1) - ); - - // eslint-disable-next-line @typescript-eslint/member-ordering - inProgress$ = progress(this.updateClaim$, merge(this.statusChanged$, this.hasError$)); - - constructor( - private fb: UntypedFormBuilder, - private claimManagementService: ClaimManagementService, - private snackBar: MatSnackBar - ) { - this.form.valueChanges - .pipe( - distinctUntilChanged((p, c) => p.type === c.type && p.reason === c.reason), - pairwise(), - filter(([prev, curr]) => prev.reason === curr.reason), - pluck(1, 'type') - ) - .subscribe((type) => { - switch (type) { - case ClaimStatus.Denied: - case ClaimStatus.Revoked: - this.form.setControl('reason', this.fb.control(null, Validators.required)); - break; - default: - this.form.setControl('reason', this.fb.control(null)); - break; - } - }); - } - - updateClaim(partyID: string, claimID: string) { - this.updateClaim$.next({ partyID, claimID, action: this.form.getRawValue().type }); - } - - private handleError() { - this.snackBar.open('Status change error', 'OK', { duration: 5000 }); - setTimeout(() => this.hasError$.next(true), 300); - return of('error'); - } - - private initForm() { - return this.fb.group({ - type: ['', Validators.required], - reason: null, - }); - } -} diff --git a/src/app/sections/party-claim/party-claim-actions/status-changer/status-changer.module.ts b/src/app/sections/party-claim/party-claim-actions/status-changer/status-changer.module.ts deleted file mode 100644 index 1865154d..00000000 --- a/src/app/sections/party-claim/party-claim-actions/status-changer/status-changer.module.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { FlexModule } from '@angular/flex-layout'; -import { ReactiveFormsModule } from '@angular/forms'; -import { MatButtonModule } from '@angular/material/button'; -import { MatDialogModule } from '@angular/material/dialog'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatInputModule } from '@angular/material/input'; -import { MatProgressBarModule } from '@angular/material/progress-bar'; -import { MatSelectModule } from '@angular/material/select'; - -import { ApiModelPipesModule } from '@cc/app/shared/pipes'; - -import { DamselModule } from '../../../../thrift-services/damsel'; -import { StatusChangerDialogComponent } from './status-changer-dialog.component'; -import { StatusChangerService } from './status-changer.service'; - -@NgModule({ - imports: [ - DamselModule, - MatDialogModule, - FlexModule, - MatFormFieldModule, - MatSelectModule, - CommonModule, - MatProgressBarModule, - MatInputModule, - ReactiveFormsModule, - MatButtonModule, - ApiModelPipesModule, - ], - declarations: [StatusChangerDialogComponent], - providers: [StatusChangerService], -}) -export class StatusChangerModule {} diff --git a/src/app/sections/party-claim/party-claim-actions/status-changer/status-changer.service.ts b/src/app/sections/party-claim/party-claim-actions/status-changer/status-changer.service.ts deleted file mode 100644 index ece343e1..00000000 --- a/src/app/sections/party-claim/party-claim-actions/status-changer/status-changer.service.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { Injectable } from '@angular/core'; -import { MatDialog } from '@angular/material/dialog'; -import { PartyID } from '@vality/domain-proto'; -import { ClaimStatus, PartyModification } from '@vality/domain-proto/lib/claim_management'; -import { Observable, Subject } from 'rxjs'; -import { filter, switchMap, takeUntil } from 'rxjs/operators'; - -import { StatusChangerDialogComponent } from './status-changer-dialog.component'; - -@Injectable() -export class StatusChangerService { - private destroy$: Subject = new Subject(); - private changeStatus$: Subject<{ - partyID: PartyID; - claimID: string; - claimStatus: ClaimStatus; - }> = new Subject(); - private changed$: Subject = new Subject(); - - // eslint-disable-next-line @typescript-eslint/member-ordering - statusChanged$: Observable = this.changed$.asObservable(); - - constructor(private dialog: MatDialog) {} - - init() { - this.changeStatus$ - .pipe( - takeUntil(this.destroy$), - switchMap(({ partyID, claimID, claimStatus }) => - this.dialog - .open(StatusChangerDialogComponent, { - width: '500px', - disableClose: true, - data: { - partyID, - claimID, - claimStatus, - }, - }) - .afterClosed() - .pipe(filter((r) => r)) - ) - ) - .subscribe((r) => this.changed$.next(r)); - } - - changeStatus(partyID: PartyID, claimID: string, claimStatus: ClaimStatus) { - this.changeStatus$.next({ partyID, claimID, claimStatus }); - } - - destroy() { - this.destroy$.next(); - } -} diff --git a/src/app/sections/party-claim/party-claim-routing.module.ts b/src/app/sections/party-claim/party-claim-routing.module.ts deleted file mode 100644 index f2dbd3b6..00000000 --- a/src/app/sections/party-claim/party-claim-routing.module.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { NgModule } from '@angular/core'; -import { RouterModule } from '@angular/router'; - -import { AppAuthGuardService, ClaimManagementRole } from '@cc/app/shared/services'; - -import { PartyClaimComponent } from './party-claim.component'; - -@NgModule({ - imports: [ - RouterModule.forChild([ - { - path: '', - component: PartyClaimComponent, - canActivate: [AppAuthGuardService], - data: { - roles: [ClaimManagementRole.GetClaims], - }, - }, - ]), - ], -}) -export class PartyClaimRoutingModule {} diff --git a/src/app/sections/party-claim/party-claim-title/_party-claim-title-theme.scss b/src/app/sections/party-claim/party-claim-title/_party-claim-title-theme.scss deleted file mode 100644 index a7ee30d8..00000000 --- a/src/app/sections/party-claim/party-claim-title/_party-claim-title-theme.scss +++ /dev/null @@ -1,9 +0,0 @@ -@use '@angular/material' as mat; - -@mixin cc-party-claim-title-theme($theme) { - $foreground: map-get($theme, foreground); - - .cc-party-claim-title { - color: mat.get-color-from-palette($foreground, secondary-text); - } -} diff --git a/src/app/sections/party-claim/party-claim-title/party-claim-title.component.html b/src/app/sections/party-claim/party-claim-title/party-claim-title.component.html deleted file mode 100644 index 10fbde25..00000000 --- a/src/app/sections/party-claim/party-claim-title/party-claim-title.component.html +++ /dev/null @@ -1,6 +0,0 @@ -
-

- Claim #{{ claimID }} -

-

{{ status | ccClaimStatusThrift | ccClaimStatus }}

-
diff --git a/src/app/sections/party-claim/party-claim-title/party-claim-title.component.ts b/src/app/sections/party-claim/party-claim-title/party-claim-title.component.ts deleted file mode 100644 index 1552597c..00000000 --- a/src/app/sections/party-claim/party-claim-title/party-claim-title.component.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; -import { ClaimStatus } from '@vality/domain-proto/lib/claim_management'; - -@Component({ - selector: 'cc-party-claim-title', - templateUrl: 'party-claim-title.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class PartyClaimTitleComponent { - @Input() - status: ClaimStatus; - - @Input() - claimID: string; -} diff --git a/src/app/sections/party-claim/party-claim.component.html b/src/app/sections/party-claim/party-claim.component.html deleted file mode 100644 index df24f0b6..00000000 --- a/src/app/sections/party-claim/party-claim.component.html +++ /dev/null @@ -1,33 +0,0 @@ -
- -
-
-
- - - - -
-
diff --git a/src/app/sections/party-claim/party-claim.component.ts b/src/app/sections/party-claim/party-claim.component.ts deleted file mode 100644 index b9b469b2..00000000 --- a/src/app/sections/party-claim/party-claim.component.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; -import { ActivatedRoute } from '@angular/router'; -import { combineLatest } from 'rxjs'; -import { first, pluck, shareReplay } from 'rxjs/operators'; - -import { FetchClaimService } from './fetch-claim.service'; - -@Component({ - templateUrl: 'party-claim.component.html', - providers: [FetchClaimService], - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class PartyClaimComponent implements OnInit { - claimID$ = this.route.params.pipe(pluck('claimID'), shareReplay(1)); - partyID$ = this.route.params.pipe(pluck('partyID'), shareReplay(1)); - isLoading$ = this.fetchClaimService.isLoading$; - createdAt$ = this.fetchClaimService.claim$.pipe(pluck('created_at')); - changeset$ = this.fetchClaimService.claim$.pipe(pluck('changeset')); - status$ = this.fetchClaimService.claim$.pipe(pluck('status')); - - constructor(private route: ActivatedRoute, private fetchClaimService: FetchClaimService) {} - - ngOnInit(): void { - this.getClaim(); - } - - changesetUpdated() { - this.getClaim(); - } - - private getClaim() { - combineLatest([this.partyID$, this.claimID$]) - .pipe(first()) - .subscribe(([partyID, claimID]) => { - this.fetchClaimService.getClaim(partyID, claimID); - }); - } -} diff --git a/src/app/sections/party-claim/party-claim.module.ts b/src/app/sections/party-claim/party-claim.module.ts deleted file mode 100644 index a88e8435..00000000 --- a/src/app/sections/party-claim/party-claim.module.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { FlexModule } from '@angular/flex-layout'; -import { ReactiveFormsModule } from '@angular/forms'; -import { MatButtonModule } from '@angular/material/button'; -import { MatCardModule } from '@angular/material/card'; -import { MatIconModule } from '@angular/material/icon'; -import { MatInputModule } from '@angular/material/input'; -import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; -import { MatSelectModule } from '@angular/material/select'; - -import { PartyModificationCreatorModule } from '@cc/app/shared/components'; -import { ApiModelPipesModule, ThriftPipesModule } from '@cc/app/shared/pipes'; - -import { ClaimChangesetModule, UnsavedClaimChangesetModule } from './changeset'; -import { EditUnsavedModificationModule } from './changeset/unsaved-changeset/edit-unsaved-modification/edit-unsaved-modification.module'; -import { PartyClaimActionsModule } from './party-claim-actions'; -import { PartyClaimRoutingModule } from './party-claim-routing.module'; -import { PartyClaimTitleComponent } from './party-claim-title/party-claim-title.component'; -import { PartyClaimComponent } from './party-claim.component'; - -@NgModule({ - imports: [ - PartyClaimRoutingModule, - FlexModule, - MatSelectModule, - MatCardModule, - CommonModule, - MatButtonModule, - MatIconModule, - ReactiveFormsModule, - MatInputModule, - EditUnsavedModificationModule, - ClaimChangesetModule, - MatProgressSpinnerModule, - PartyClaimActionsModule, - UnsavedClaimChangesetModule, - PartyModificationCreatorModule, - ThriftPipesModule, - ApiModelPipesModule, - ], - declarations: [PartyClaimComponent, PartyClaimTitleComponent], -}) -export class PartyClaimModule {} diff --git a/src/app/sections/party-claims/claims-table/claims-table.component.html b/src/app/sections/party-claims/claims-table/claims-table.component.html deleted file mode 100644 index eab6ff5a..00000000 --- a/src/app/sections/party-claims/claims-table/claims-table.component.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Claim ID{{ claim.id }}Status - {{ claim.status | ccClaimStatusThrift | ccClaimStatus }} - Created At - {{ claim.created_at | date: 'dd.MM.yyyy HH:mm:ss' }} - Updated At - {{ claim.updated_at | date: 'dd.MM.yyyy HH:mm:ss' }} - - - - - - -
diff --git a/src/app/sections/party-claims/claims-table/claims-table.component.scss b/src/app/sections/party-claims/claims-table/claims-table.component.scss deleted file mode 100644 index f7335e41..00000000 --- a/src/app/sections/party-claims/claims-table/claims-table.component.scss +++ /dev/null @@ -1,7 +0,0 @@ -table { - width: 100%; -} - -.action-cell { - width: 8px; -} diff --git a/src/app/sections/party-claims/claims-table/claims-table.component.ts b/src/app/sections/party-claims/claims-table/claims-table.component.ts deleted file mode 100644 index 2742f243..00000000 --- a/src/app/sections/party-claims/claims-table/claims-table.component.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; -import { Router } from '@angular/router'; -import { PartyID } from '@vality/domain-proto'; -import { Claim, ClaimID } from '@vality/domain-proto/lib/claim_management'; - -@Component({ - selector: 'cc-claims-table', - templateUrl: 'claims-table.component.html', - styleUrls: ['claims-table.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class ClaimsTableComponent { - @Input() - claims: Claim[]; - - displayedColumns: string[] = ['claimID', 'status', 'createdAt', 'updatedAt', 'actions']; - - constructor(private router: Router) {} - - navigateToClaim(partyID: PartyID, claimID: ClaimID) { - void this.router.navigate([`/party/${partyID}/claim/${claimID}`]); - } - - navigateToNewClaim(partyID: PartyID, claimID: ClaimID) { - void this.router.navigate([`/party/${partyID}/claim/${claimID}/new`]); - } -} diff --git a/src/app/sections/party-claims/create-claim.service.ts b/src/app/sections/party-claims/create-claim.service.ts deleted file mode 100644 index 544089f7..00000000 --- a/src/app/sections/party-claims/create-claim.service.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { Injectable } from '@angular/core'; -import { MatSnackBar } from '@angular/material/snack-bar'; -import { ActivatedRoute, Router } from '@angular/router'; -import { Claim } from '@vality/domain-proto/lib/claim_management'; -import { BehaviorSubject, EMPTY, Observable, Subject } from 'rxjs'; -import { catchError, pluck, switchMap } from 'rxjs/operators'; - -import { ClaimManagementService } from '../../thrift-services/damsel/claim-management.service'; - -@Injectable() -export class CreateClaimService { - claimCreation$ = new Subject(); - - claim$: Observable = this.claimCreation$.pipe( - switchMap((partyId) => - this.claimService.createClaim(partyId, []).pipe( - catchError(() => { - this.snackBar.open('An error occurred while claim creation', 'OK'); - this.error$.next({ hasError: true }); - return EMPTY; - }) - ) - ) - ); - - private error$ = new BehaviorSubject({ hasError: false }); - - constructor( - private route: ActivatedRoute, - private router: Router, - private claimService: ClaimManagementService, - private snackBar: MatSnackBar - ) { - this.claim$.subscribe(({ id, party_id }) => { - void this.router.navigate([`party/${party_id}/claim/${id}`]); - }); - } - - createClaim() { - this.route.params.pipe(pluck('partyID')).subscribe((partyID) => { - this.claimCreation$.next(partyID); - }); - } -} diff --git a/src/app/sections/party-claims/index.ts b/src/app/sections/party-claims/index.ts deleted file mode 100644 index 9b9592ca..00000000 --- a/src/app/sections/party-claims/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './party-claims.module'; diff --git a/src/app/sections/party-claims/party-claims-routing.module.ts b/src/app/sections/party-claims/party-claims-routing.module.ts deleted file mode 100644 index 4a17938b..00000000 --- a/src/app/sections/party-claims/party-claims-routing.module.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { NgModule } from '@angular/core'; -import { RouterModule } from '@angular/router'; - -import { AppAuthGuardService, ClaimManagementRole } from '@cc/app/shared/services'; - -import { PartyClaimsComponent } from './party-claims.component'; - -@NgModule({ - imports: [ - RouterModule.forChild([ - { - path: '', - component: PartyClaimsComponent, - canActivate: [AppAuthGuardService], - data: { - roles: [ClaimManagementRole.GetClaims], - }, - }, - ]), - ], -}) -export class PartyClaimsRoutingModule {} diff --git a/src/app/sections/party-claims/party-claims.component.html b/src/app/sections/party-claims/party-claims.component.html deleted file mode 100644 index 4bb520e6..00000000 --- a/src/app/sections/party-claims/party-claims.component.html +++ /dev/null @@ -1,34 +0,0 @@ -
-
-
Merchant's claims
- -
-
- - - - - - - - - - - - - - - -
-
diff --git a/src/app/sections/party-claims/party-claims.component.ts b/src/app/sections/party-claims/party-claims.component.ts deleted file mode 100644 index 2afa5d95..00000000 --- a/src/app/sections/party-claims/party-claims.component.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; -import { MatSnackBar } from '@angular/material/snack-bar'; -import { BaseDialogResponseStatus, BaseDialogService } from '@vality/ng-core'; -import { filter } from 'rxjs/operators'; - -import { ClaimSearchForm } from '@cc/app/shared/components'; -import { ConfirmActionDialogComponent } from '@cc/components/confirm-action-dialog'; - -import { CreateClaimService } from './create-claim.service'; -import { PartyClaimsService } from './party-claims.service'; - -@Component({ - templateUrl: 'party-claims.component.html', - providers: [PartyClaimsService, CreateClaimService], - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class PartyClaimsComponent implements OnInit { - doAction$ = this.partyClaimsService.doAction$; - claims$ = this.partyClaimsService.searchResult$; - hasMore$ = this.partyClaimsService.hasMore$; - - constructor( - private partyClaimsService: PartyClaimsService, - private snackBar: MatSnackBar, - private createClaimService: CreateClaimService, - private baseDialogService: BaseDialogService - ) {} - - ngOnInit() { - this.partyClaimsService.errors$.subscribe((e) => - this.snackBar.open(`An error occurred while search claim (${String(e)})`, 'OK') - ); - } - - fetchMore() { - this.partyClaimsService.fetchMore(); - } - - search({ claim_id, statuses }: ClaimSearchForm) { - this.partyClaimsService.search({ claim_id, statuses }); - } - - createClaim() { - this.baseDialogService - .open(ConfirmActionDialogComponent) - .afterClosed() - .pipe(filter(({ status }) => status === BaseDialogResponseStatus.Success)) - .subscribe(() => { - this.createClaimService.createClaim(); - }); - } -} diff --git a/src/app/sections/party-claims/party-claims.module.ts b/src/app/sections/party-claims/party-claims.module.ts deleted file mode 100644 index 72f37191..00000000 --- a/src/app/sections/party-claims/party-claims.module.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { FlexLayoutModule } from '@angular/flex-layout'; -import { ReactiveFormsModule } from '@angular/forms'; -import { MatButtonModule } from '@angular/material/button'; -import { MatCardModule } from '@angular/material/card'; -import { MatIconModule } from '@angular/material/icon'; -import { MatInputModule } from '@angular/material/input'; -import { MatMenuModule } from '@angular/material/menu'; -import { MatProgressBarModule } from '@angular/material/progress-bar'; -import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; -import { MatSelectModule } from '@angular/material/select'; -import { MatTableModule } from '@angular/material/table'; - -import { ClaimSearchFormModule } from '@cc/app/shared/components'; -import { ApiModelPipesModule, ThriftPipesModule } from '@cc/app/shared/pipes'; -import { EmptySearchResultModule } from '@cc/components/empty-search-result'; - -import { ClaimsTableComponent } from './claims-table/claims-table.component'; -import { PartyClaimsRoutingModule } from './party-claims-routing.module'; -import { PartyClaimsComponent } from './party-claims.component'; - -@NgModule({ - imports: [ - CommonModule, - PartyClaimsRoutingModule, - MatTableModule, - MatCardModule, - FlexLayoutModule, - MatMenuModule, - MatIconModule, - MatButtonModule, - MatProgressBarModule, - MatInputModule, - MatSelectModule, - ReactiveFormsModule, - MatProgressSpinnerModule, - ClaimSearchFormModule, - EmptySearchResultModule, - ThriftPipesModule, - ApiModelPipesModule, - ], - declarations: [PartyClaimsComponent, ClaimsTableComponent], -}) -export class PartyClaimsModule {} diff --git a/src/app/sections/party-claims/party-claims.service.ts b/src/app/sections/party-claims/party-claims.service.ts deleted file mode 100644 index 66e9dd29..00000000 --- a/src/app/sections/party-claims/party-claims.service.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { Injectable } from '@angular/core'; -import { ActivatedRoute } from '@angular/router'; -import { - Claim, - ClaimID, - ClaimSearchQuery, - ClaimStatus, -} from '@vality/domain-proto/lib/claim_management'; -import { Observable } from 'rxjs'; -import { map, pluck, switchMap } from 'rxjs/operators'; - -import { FetchResult, PartialFetcher } from '@cc/app/shared/services'; - -import { ClaimManagementService } from '../../thrift-services/damsel/claim-management.service'; - -const SEARCH_LIMIT = 10; - -type PartyClaimsParams = { claim_id?: ClaimID; statuses?: (keyof ClaimStatus)[] }; - -@Injectable() -export class PartyClaimsService extends PartialFetcher { - constructor( - private claimManagementService: ClaimManagementService, - private route: ActivatedRoute - ) { - super(); - } - - protected fetch( - params: PartyClaimsParams, - continuationToken: string - ): Observable> { - return this.route.params.pipe( - pluck('partyID'), - switchMap((partyId) => - this.claimManagementService.searchClaims({ - ...params, - party_id: partyId, - continuation_token: continuationToken, - limit: SEARCH_LIMIT, - } as ClaimSearchQuery) - ), - map(({ result, continuation_token }) => ({ - result, - continuationToken: continuation_token, - })) - ); - } -} diff --git a/src/app/sections/party/party-routing.module.ts b/src/app/sections/party/party-routing.module.ts index 8477ffa2..c472c6de 100644 --- a/src/app/sections/party/party-routing.module.ts +++ b/src/app/sections/party/party-routing.module.ts @@ -21,16 +21,6 @@ import { PartyComponent } from './party.component'; loadChildren: () => import('../party-payments').then((m) => m.PartyPaymentsModule), }, - { - path: 'claims', - loadChildren: () => - import('../party-claims').then((m) => m.PartyClaimsModule), - }, - { - path: 'claim/:claimID', - loadChildren: () => - import('../party-claim').then((m) => m.PartyClaimModule), - }, { path: 'shops', loadChildren: () => diff --git a/src/app/sections/party/party.component.ts b/src/app/sections/party/party.component.ts index 485588fd..894e0af8 100644 --- a/src/app/sections/party/party.component.ts +++ b/src/app/sections/party/party.component.ts @@ -5,7 +5,6 @@ import { catchError, filter, map, pluck, shareReplay, startWith, switchMap } fro import { AppAuthGuardService, - ClaimManagementRole, DomainConfigRole, OperationRole, PartyRole, @@ -56,12 +55,6 @@ export class PartyComponent { otherActiveUrlFragments: ['payment', 'invoice'], activateRoles: [OperationRole.SearchPayments], }, - { - name: 'Claims', - url: 'claims', - otherActiveUrlFragments: ['claim'], - activateRoles: [ClaimManagementRole.GetClaims], - }, { name: 'Shops', url: 'shops', diff --git a/src/app/sections/search-claims/search-table/search-table.component.html b/src/app/sections/search-claims/search-table/search-table.component.html index 051417b2..78bcb6d9 100644 --- a/src/app/sections/search-claims/search-table/search-table.component.html +++ b/src/app/sections/search-claims/search-table/search-table.component.html @@ -44,16 +44,6 @@ - - - diff --git a/src/app/sections/search-claims/search-table/search-table.component.ts b/src/app/sections/search-claims/search-table/search-table.component.ts index 97e32d95..47b17e23 100644 --- a/src/app/sections/search-claims/search-table/search-table.component.ts +++ b/src/app/sections/search-claims/search-table/search-table.component.ts @@ -23,15 +23,7 @@ export class SearchTableComponent { constructor(private router: Router) {} - navigateToPartyClaims(partyId: string) { - void this.router.navigate([`/party/${partyId}/claims`]); - } - navigateToClaim(partyId: string, claimID: number) { void this.router.navigate([`/party/${partyId}/claim/${claimID}`]); } - - navigateToNewClaim(partyId: string, claimID: number) { - void this.router.navigate([`/party/${partyId}/claim/${claimID}/new`]); - } } diff --git a/src/app/styles/themes/_theme.scss b/src/app/styles/themes/_theme.scss index 33e72175..7335c8b1 100644 --- a/src/app/styles/themes/_theme.scss +++ b/src/app/styles/themes/_theme.scss @@ -5,7 +5,6 @@ @import '../../sections/party/party-theme'; @import '../../sections/routing-rules/routing-rules-theme'; -@import '../../sections/party-claim/party-claim-theme'; @import '../../not-found/not-found-theme'; @@ -25,7 +24,6 @@ @include cc-components-themes($theme); @include cc-shared-components-themes($theme); @include cc-routing-rules-theme($theme); - @include cc-party-claim-theme($theme); @include cc-not-found-theme($theme); } } From 058b7147fd7ebbd5b75f92966e60ba95ed7ce1f1 Mon Sep 17 00:00:00 2001 From: Rinat Arsaev <11846445+KrickRay@users.noreply.github.com> Date: Tue, 9 Aug 2022 21:00:11 +0300 Subject: [PATCH 5/9] TD-369: Change stat service (ANAPI V2) (#121) --- package.json | 2 +- .../utils/base-dialog-superclass.ts | 22 +++ projects/ng-core/src/lib/index.ts | 1 + .../src/lib/utils/objects/clean-object.ts | 26 ++++ .../ng-core/src/lib/utils/objects/index.ts | 1 + src/app/sections/party-payments/index.ts | 1 - .../party-payments-routing.module.ts | 22 --- .../party-payments.component.html | 10 -- .../party-payments.component.ts | 50 ------- .../party-payments/party-payments.module.ts | 51 ------- .../party-payments/party-payments.service.ts | 27 ---- ...payments-searcher-filters-store.service.ts | 27 ---- .../sections/party/party-routing.module.ts | 12 +- src/app/sections/party/party.component.ts | 13 +- .../payment-adjustment.component.ts | 2 +- .../payment-adjustment.service.ts | 50 ++++--- .../search-form/search-form-params.ts | 8 +- .../search-form/search-form.component.html | 4 +- .../search-form/search-form.component.ts | 14 +- .../table/table.component.html | 2 +- .../table/table.component.ts | 12 +- .../payment-details.component.html | 3 +- .../payment-details.component.ts | 6 +- .../payment-details.service.ts | 29 ++-- .../payment-error/payment-error.component.ts | 2 +- .../payment-main-info.component.html | 2 +- .../payment-main-info.component.ts | 18 +-- .../bank-card/bank-card.component.ts | 2 +- .../bank-card/to-card-number.pipe.ts | 4 +- .../payment-tool/payment-tool.component.html | 2 +- .../payment-tool/payment-tool.component.ts | 2 +- .../payment-refunds/fetch-refunds.service.ts | 68 ++++----- .../payment-refunds.component.ts | 8 +- .../payment-refunds/refunds-search-params.ts | 21 --- .../sections/repairing/repairing.module.ts | 3 +- .../add-routing-rule-dialog.module.ts | 2 +- .../search-payments.component.html | 1 - .../search-payments.component.ts | 6 - .../search-payments/search-payments.module.ts | 2 - src/app/sections/sections-routing.module.ts | 4 + .../withdrawals/withdrawals.module.ts | 3 +- .../shared/components/metadata-form/index.ts | 6 +- .../metadata-form/metadata-form.component.ts | 2 +- .../metadata-form/metadata-form.module.ts | 3 +- .../types/metadata-form-extension.ts | 2 +- .../metadata-form/utils/get-default-value.ts | 3 +- .../payments-main-search-filters/index.ts | 1 - .../main-filter-search-type.ts | 11 -- ...ayments-main-search-filters.component.html | 129 +++++++++--------- ...ayments-main-search-filters.component.scss | 3 - .../payments-main-search-filters.component.ts | 44 ++---- .../payments-main-search-filters.module.ts | 2 + .../form-params-to-search-params.ts | 8 +- .../other-filters-dialog/constants.ts | 109 --------------- .../other-filters-dialog.component.html | 100 +++++++------- .../other-filters-dialog.component.ts | 42 +++--- .../other-filters-dialog.module.ts | 9 +- .../other-filters-dialog.service.ts | 8 +- .../payments-other-search-filters.module.ts | 3 - .../payments-other-search-filters.service.ts | 41 +++--- .../search-params-to-form-params.ts | 8 +- .../search-filters-params.ts | 15 +- .../fetch-payments.service.ts | 78 +++++------ .../components/payments-searcher/index.ts | 1 - .../payments-searcher.component.html | 70 +++++----- .../payments-searcher.component.scss | 3 - .../payments-searcher.component.ts | 84 +++--------- .../payments-searcher.module.ts | 4 +- .../payments-searcher/searcher-type.ts | 9 -- .../shared/components/payments-table/index.ts | 1 - .../payments-table.component.html | 2 +- .../payments-table.component.ts | 27 +--- .../payments-table/payments-table.ts | 9 -- .../shared/pipes/thrift/thrift-int64.pipe.ts | 10 +- .../partial-fetcher/partial-fetcher.ts | 2 +- .../thrift-services/damsel/damsel.module.ts | 2 - .../damsel/merchant-statistics.service.ts | 21 --- .../empty-search-result.component.html | 2 +- .../empty-search-result.component.ts | 1 + .../expandable-radio-group.component.html | 32 ----- .../expandable-radio-group.component.scss | 15 -- .../expandable-radio-group.component.ts | 80 ----------- .../expandable-radio-group.module.ts | 27 ---- .../expandable-radio-group/index.ts | 1 - src/utils/get-enum-keys.ts | 8 ++ src/utils/i64-to-number.ts | 28 ---- src/utils/index.ts | 1 - 87 files changed, 480 insertions(+), 1132 deletions(-) create mode 100644 projects/ng-core/src/lib/utils/objects/clean-object.ts create mode 100644 projects/ng-core/src/lib/utils/objects/index.ts delete mode 100644 src/app/sections/party-payments/index.ts delete mode 100644 src/app/sections/party-payments/party-payments-routing.module.ts delete mode 100644 src/app/sections/party-payments/party-payments.component.html delete mode 100644 src/app/sections/party-payments/party-payments.component.ts delete mode 100644 src/app/sections/party-payments/party-payments.module.ts delete mode 100644 src/app/sections/party-payments/party-payments.service.ts delete mode 100644 src/app/sections/party-payments/payments-searcher-filters-store.service.ts delete mode 100644 src/app/sections/payment-details/payment-refunds/refunds-search-params.ts delete mode 100644 src/app/shared/components/payments-search-filters/payments-main-search-filters/main-filter-search-type.ts delete mode 100644 src/app/shared/components/payments-search-filters/payments-main-search-filters/payments-main-search-filters.component.scss delete mode 100644 src/app/shared/components/payments-search-filters/payments-other-search-filters/other-filters-dialog/constants.ts delete mode 100644 src/app/shared/components/payments-searcher/payments-searcher.component.scss delete mode 100644 src/app/shared/components/payments-searcher/searcher-type.ts delete mode 100644 src/app/shared/components/payments-table/payments-table.ts delete mode 100644 src/app/thrift-services/damsel/merchant-statistics.service.ts delete mode 100644 src/components/expandable-radio-group/expandable-radio-group.component.html delete mode 100644 src/components/expandable-radio-group/expandable-radio-group.component.scss delete mode 100644 src/components/expandable-radio-group/expandable-radio-group.component.ts delete mode 100644 src/components/expandable-radio-group/expandable-radio-group.module.ts delete mode 100644 src/components/expandable-radio-group/index.ts delete mode 100644 src/utils/i64-to-number.ts diff --git a/package.json b/package.json index e14e15b0..fdb7b1b5 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "build-libs": "ng build ng-core", "build": "npm run build-libs && npm run build-app", "test": "ng test", - "lint": "eslint \"src/**/*.{ts,js,html}\" --max-warnings 1115", + "lint": "eslint \"src/**/*.{ts,js,html}\" --max-warnings 1033", "lint-fix": "npm run lint -- --fix", "lint-errors": "npm run lint -- --quiet", "lint-libs": "eslint \"projects/**/*.{ts,js,html}\" --max-warnings 0", diff --git a/projects/ng-core/src/lib/components/base-dialog/utils/base-dialog-superclass.ts b/projects/ng-core/src/lib/components/base-dialog/utils/base-dialog-superclass.ts index b84b6f5d..7ea5baa0 100644 --- a/projects/ng-core/src/lib/components/base-dialog/utils/base-dialog-superclass.ts +++ b/projects/ng-core/src/lib/components/base-dialog/utils/base-dialog-superclass.ts @@ -3,6 +3,7 @@ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { DEFAULT_DIALOG_CONFIG } from '../tokens'; import { BaseDialogResponse } from '../types/base-dialog-response'; +import { BaseDialogResponseStatus } from '../types/base-dialog-response-status'; @Directive() export class BaseDialogSuperclass< @@ -18,4 +19,25 @@ export class BaseDialogSuperclass< dialogRef = this.injector.get(MatDialogRef) as MatDialogRef; constructor(private injector: Injector) {} + + closeWithCancellation(data?: DialogResponseData) { + this.dialogRef.close({ + status: BaseDialogResponseStatus.Cancelled, + data, + } as never); + } + + closeWithSuccess(data?: DialogResponseData) { + this.dialogRef.close({ + status: BaseDialogResponseStatus.Success, + data, + } as never); + } + + closeWithError(data?: DialogResponseData) { + this.dialogRef.close({ + status: BaseDialogResponseStatus.Error, + data, + } as never); + } } diff --git a/projects/ng-core/src/lib/index.ts b/projects/ng-core/src/lib/index.ts index 07635cbb..000e1961 100644 --- a/projects/ng-core/src/lib/index.ts +++ b/projects/ng-core/src/lib/index.ts @@ -1 +1,2 @@ export * from './components'; +export * from './utils/objects'; diff --git a/projects/ng-core/src/lib/utils/objects/clean-object.ts b/projects/ng-core/src/lib/utils/objects/clean-object.ts new file mode 100644 index 00000000..5dec394f --- /dev/null +++ b/projects/ng-core/src/lib/utils/objects/clean-object.ts @@ -0,0 +1,26 @@ +import isEmpty from 'lodash-es/isEmpty'; +import isNil from 'lodash-es/isNil'; +import isObject from 'lodash-es/isObject'; +import { ValuesType } from 'utility-types'; + +function isEmptyValue(value: unknown): boolean { + return isNil(value) || value === '' || (typeof value === 'object' && isEmpty(value)); +} + +export function cleanObject( + obj: T, + requiredKeys: (keyof T)[] = [], + isNotDeep = false +): T { + if (!isObject(obj)) return obj; + if (Array.isArray(obj)) + return obj + .slice() + .map((v: unknown) => (isObject(v) && !isNotDeep ? cleanObject(v) : v)) + .filter((v) => !isEmptyValue(v)) as T; + return Object.fromEntries( + (Object.entries(obj) as [keyof T, ValuesType][]) + .map(([k, v]) => [k, isObject(v) && !isNotDeep ? cleanObject(v as object) : v] as const) + .filter(([k, v]) => requiredKeys.includes(k) || !isEmptyValue(v)) + ) as T; +} diff --git a/projects/ng-core/src/lib/utils/objects/index.ts b/projects/ng-core/src/lib/utils/objects/index.ts new file mode 100644 index 00000000..c2712bc6 --- /dev/null +++ b/projects/ng-core/src/lib/utils/objects/index.ts @@ -0,0 +1 @@ +export * from './clean-object'; diff --git a/src/app/sections/party-payments/index.ts b/src/app/sections/party-payments/index.ts deleted file mode 100644 index 887693ea..00000000 --- a/src/app/sections/party-payments/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './party-payments.module'; diff --git a/src/app/sections/party-payments/party-payments-routing.module.ts b/src/app/sections/party-payments/party-payments-routing.module.ts deleted file mode 100644 index 8cc1cf79..00000000 --- a/src/app/sections/party-payments/party-payments-routing.module.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { NgModule } from '@angular/core'; -import { RouterModule } from '@angular/router'; - -import { AppAuthGuardService, OperationRole } from '@cc/app/shared/services'; - -import { PartyPaymentsComponent } from './party-payments.component'; - -@NgModule({ - imports: [ - RouterModule.forChild([ - { - path: '', - component: PartyPaymentsComponent, - canActivate: [AppAuthGuardService], - data: { - roles: [OperationRole.SearchPayments], - }, - }, - ]), - ], -}) -export class PartyPaymentsRoutingModule {} diff --git a/src/app/sections/party-payments/party-payments.component.html b/src/app/sections/party-payments/party-payments.component.html deleted file mode 100644 index c91414ed..00000000 --- a/src/app/sections/party-payments/party-payments.component.html +++ /dev/null @@ -1,10 +0,0 @@ -
-
Merchant's payments
- -
diff --git a/src/app/sections/party-payments/party-payments.component.ts b/src/app/sections/party-payments/party-payments.component.ts deleted file mode 100644 index d40b263b..00000000 --- a/src/app/sections/party-payments/party-payments.component.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { ChangeDetectionStrategy, Component } from '@angular/core'; -import { ActivatedRoute, Router } from '@angular/router'; -import { pluck, shareReplay } from 'rxjs/operators'; - -import { - PaymentActions, - PaymentMenuItemEvent, - SearcherType, - SearchFiltersParams, - SearchType, -} from '@cc/app/shared/components'; - -import { PartyPaymentsService } from './party-payments.service'; - -@Component({ - templateUrl: 'party-payments.component.html', - changeDetection: ChangeDetectionStrategy.OnPush, - providers: [PartyPaymentsService, PartyPaymentsService], -}) -export class PartyPaymentsComponent { - searchType: SearcherType; - initSearchParams$ = this.partyPaymentsService.data$; - - constructor( - private route: ActivatedRoute, - private partyPaymentsService: PartyPaymentsService, - private router: Router - ) { - this.route.params.pipe(pluck('partyID'), shareReplay(1)).subscribe((partyID) => { - this.searchType = { - type: SearchType.PartySearcher, - partyID, - }; - }); - } - - searchParamsUpdated($event: SearchFiltersParams) { - this.partyPaymentsService.preserve($event); - } - - paymentEventFired($event: PaymentMenuItemEvent) { - const { partyID, invoiceID, paymentID } = $event; - switch ($event.action) { - case PaymentActions.NavigateToPayment: - void this.router.navigate([ - `/party/${partyID}/invoice/${invoiceID}/payment/${paymentID}`, - ]); - } - } -} diff --git a/src/app/sections/party-payments/party-payments.module.ts b/src/app/sections/party-payments/party-payments.module.ts deleted file mode 100644 index 6d96cd05..00000000 --- a/src/app/sections/party-payments/party-payments.module.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { FlexModule } from '@angular/flex-layout'; -import { ReactiveFormsModule } from '@angular/forms'; -import { MatBadgeModule } from '@angular/material/badge'; -import { MatButtonModule } from '@angular/material/button'; -import { MatCardModule } from '@angular/material/card'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatIconModule } from '@angular/material/icon'; -import { MatInputModule } from '@angular/material/input'; -import { MatMenuModule } from '@angular/material/menu'; -import { MatProgressBarModule } from '@angular/material/progress-bar'; -import { MatTableModule } from '@angular/material/table'; - -import { - PaymentsMainSearchFiltersModule, - PaymentsOtherSearchFiltersModule, - PaymentsSearcherModule, - PaymentsTableModule, - StatusModule, -} from '@cc/app/shared/components'; -import { EmptySearchResultModule } from '@cc/components/empty-search-result'; - -import { PartyPaymentsRoutingModule } from './party-payments-routing.module'; -import { PartyPaymentsComponent } from './party-payments.component'; - -@NgModule({ - imports: [ - FlexModule, - MatCardModule, - MatProgressBarModule, - CommonModule, - MatButtonModule, - ReactiveFormsModule, - MatFormFieldModule, - MatInputModule, - MatTableModule, - MatMenuModule, - MatIconModule, - PaymentsMainSearchFiltersModule, - PartyPaymentsRoutingModule, - StatusModule, - PaymentsTableModule, - MatBadgeModule, - PaymentsOtherSearchFiltersModule, - EmptySearchResultModule, - PaymentsSearcherModule, - ], - declarations: [PartyPaymentsComponent], -}) -export class PartyPaymentsModule {} diff --git a/src/app/sections/party-payments/party-payments.service.ts b/src/app/sections/party-payments/party-payments.service.ts deleted file mode 100644 index 9fcd0520..00000000 --- a/src/app/sections/party-payments/party-payments.service.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Injectable } from '@angular/core'; -import { ActivatedRoute, Params, Router } from '@angular/router'; -import pickBy from 'lodash-es/pickBy'; - -import { SearchFiltersParams } from '@cc/app/shared/components'; -import { QueryParamsStore } from '@cc/app/shared/services'; -import { wrapValuesToArray } from '@cc/utils/wrap-values-to-array'; - -const SHOP_IDS_AND_PRIMITIVES = (v, k) => typeof v === 'string' && k === 'shopIDs'; - -@Injectable() -export class PartyPaymentsService extends QueryParamsStore { - constructor(protected route: ActivatedRoute, protected router: Router) { - super(router, route); - } - - mapToData(queryParams: Params): SearchFiltersParams { - return { - ...queryParams, - ...wrapValuesToArray(pickBy(queryParams, SHOP_IDS_AND_PRIMITIVES)), - } as SearchFiltersParams; - } - - mapToParams(data: SearchFiltersParams): Params { - return data; - } -} diff --git a/src/app/sections/party-payments/payments-searcher-filters-store.service.ts b/src/app/sections/party-payments/payments-searcher-filters-store.service.ts deleted file mode 100644 index a81aac3e..00000000 --- a/src/app/sections/party-payments/payments-searcher-filters-store.service.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Injectable } from '@angular/core'; -import { ActivatedRoute, Params, Router } from '@angular/router'; -import pickBy from 'lodash-es/pickBy'; - -import { SearchFiltersParams } from '@cc/app/shared/components'; -import { QueryParamsStore } from '@cc/app/shared/services'; -import { wrapValuesToArray } from '@cc/utils/wrap-values-to-array'; - -const shopIdsAndPrimitives = (v, k) => typeof v === 'string' && k === 'shopIDs'; - -@Injectable() -export class PaymentsSearchFiltersStore extends QueryParamsStore { - constructor(protected route: ActivatedRoute, protected router: Router) { - super(router, route); - } - - mapToData(queryParams: Params): SearchFiltersParams { - return { - ...queryParams, - ...wrapValuesToArray(pickBy(queryParams, shopIdsAndPrimitives)), - } as SearchFiltersParams; - } - - mapToParams(data: SearchFiltersParams): Params { - return data; - } -} diff --git a/src/app/sections/party/party-routing.module.ts b/src/app/sections/party/party-routing.module.ts index c472c6de..cf64b536 100644 --- a/src/app/sections/party/party-routing.module.ts +++ b/src/app/sections/party/party-routing.module.ts @@ -16,11 +16,6 @@ import { PartyComponent } from './party.component'; roles: [PartyRole.Get], }, children: [ - { - path: 'payments', - loadChildren: () => - import('../party-payments').then((m) => m.PartyPaymentsModule), - }, { path: 'shops', loadChildren: () => @@ -31,17 +26,12 @@ import { PartyComponent } from './party.component'; loadChildren: () => import('../shop-details').then((m) => m.ShopDetailsModule), }, - { - path: 'invoice/:invoiceID/payment/:paymentID', - loadChildren: () => - import('../payment-details').then((m) => m.PaymentDetailsModule), - }, { path: 'routing-rules', loadChildren: () => import('../routing-rules').then((m) => m.RoutingRulesModule), }, - { path: '', redirectTo: 'payments', pathMatch: 'full' }, + { path: '', redirectTo: 'shops', pathMatch: 'full' }, ], }, ]), diff --git a/src/app/sections/party/party.component.ts b/src/app/sections/party/party.component.ts index 894e0af8..36a30022 100644 --- a/src/app/sections/party/party.component.ts +++ b/src/app/sections/party/party.component.ts @@ -3,12 +3,7 @@ import { ActivatedRoute, NavigationEnd, Router } from '@angular/router'; import { Observable, of } from 'rxjs'; import { catchError, filter, map, pluck, shareReplay, startWith, switchMap } from 'rxjs/operators'; -import { - AppAuthGuardService, - DomainConfigRole, - OperationRole, - PartyRole, -} from '@cc/app/shared/services'; +import { AppAuthGuardService, DomainConfigRole, PartyRole } from '@cc/app/shared/services'; import { DeanonimusService, getMaxSearchHitParty } from '../../thrift-services/deanonimus'; @@ -49,12 +44,6 @@ export class PartyComponent { private getLinks() { const links = [ - { - name: 'Payments', - url: 'payments', - otherActiveUrlFragments: ['payment', 'invoice'], - activateRoles: [OperationRole.SearchPayments], - }, { name: 'Shops', url: 'shops', diff --git a/src/app/sections/payment-adjustment/payment-adjustment.component.ts b/src/app/sections/payment-adjustment/payment-adjustment.component.ts index c1465158..c3da1e59 100644 --- a/src/app/sections/payment-adjustment/payment-adjustment.component.ts +++ b/src/app/sections/payment-adjustment/payment-adjustment.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { MatSnackBar } from '@angular/material/snack-bar'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; -import { StatPayment } from '@vality/domain-proto/lib/merch_stat'; +import { StatPayment } from '@vality/magista-proto'; import { CreateAndCaptureComponent } from './create-and-capture/create-and-capture.component'; import { PaymentAdjustmentService } from './payment-adjustment.service'; diff --git a/src/app/sections/payment-adjustment/payment-adjustment.service.ts b/src/app/sections/payment-adjustment/payment-adjustment.service.ts index d34bb9df..f7cbf70e 100644 --- a/src/app/sections/payment-adjustment/payment-adjustment.service.ts +++ b/src/app/sections/payment-adjustment/payment-adjustment.service.ts @@ -1,11 +1,12 @@ import { Injectable } from '@angular/core'; -import { StatPayment, StatResponse } from '@vality/domain-proto/lib/merch_stat'; +import { StatPayment } from '@vality/magista-proto'; +import { cleanObject } from '@vality/ng-core'; import { Observable, of, Subject } from 'rxjs'; import { mergeMap, shareReplay } from 'rxjs/operators'; +import { MerchantStatisticsService } from '@cc/app/api/magista'; + import { DomainService } from '../../domain'; -import { QueryDsl } from '../../query-dsl'; -import { MerchantStatisticsService } from '../../thrift-services/damsel/merchant-statistics.service'; import { SearchFormParams } from './search-form/search-form-params'; @Injectable() @@ -30,7 +31,7 @@ export class PaymentAdjustmentService { ): Observable { return this.getPayments(params, continuationToken).pipe( mergeMap((res) => { - const mergedPayments = [...payments, ...res.data.payments]; + const mergedPayments = [...payments, ...res.payments]; this.searchPaymentChanges$.next(mergedPayments); return res.continuation_token ? this.getAllPayments(params, res.continuation_token, mergedPayments) @@ -39,10 +40,7 @@ export class PaymentAdjustmentService { ); } - private getPayments( - params: SearchFormParams, - continuationToken?: string - ): Observable { + private getPayments(params: SearchFormParams, continuationToken?: string) { const { fromRevision, toRevision, @@ -55,24 +53,24 @@ export class PaymentAdjustmentService { providerID, terminalID, } = params; - return this.merchantStatisticsService.getPayments({ - dsl: JSON.stringify({ - query: { - payments: { - ...(partyId ? { merchant_id: partyId } : {}), - ...(shopId ? { shop_id: shopId } : {}), - from_time: fromTime, - to_time: toTime, - from_payment_domain_revision: fromRevision, - to_payment_domain_revision: toRevision, - ...(providerID ? { payment_provider_id: providerID } : {}), - ...(terminalID ? { payment_terminal_id: terminalID } : {}), - ...(status ? { payment_status: status } : {}), - ...(invoiceIds ? { invoice_ids: invoiceIds } : {}), - }, + return this.merchantStatisticsService.SearchPayments( + cleanObject({ + common_search_query_params: { + from_time: fromTime, + to_time: toTime, + party_id: partyId, + shop_ids: [shopId], + continuation_token: continuationToken, }, - } as QueryDsl), - ...(continuationToken ? { continuation_token: continuationToken } : {}), - }); + payment_params: { + from_payment_domain_revision: fromRevision, + to_payment_domain_revision: toRevision, + payment_provider_id: providerID, + payment_terminal_id: terminalID, + payment_status: status, + }, + invoice_ids: invoiceIds, + }) + ); } } diff --git a/src/app/sections/payment-adjustment/search-form/search-form-params.ts b/src/app/sections/payment-adjustment/search-form/search-form-params.ts index 40f85307..b73355b8 100644 --- a/src/app/sections/payment-adjustment/search-form/search-form-params.ts +++ b/src/app/sections/payment-adjustment/search-form/search-form-params.ts @@ -1,12 +1,14 @@ +import { InvoicePaymentStatus } from '@vality/magista-proto'; + export interface SearchFormParams { fromTime: string; toTime: string; partyId: string; - fromRevision: string; - toRevision: string; + fromRevision: number; + toRevision: number; providerID: string; terminalID: string; - status: string; + status: InvoicePaymentStatus; shopId: string; invoiceIds: string[]; } diff --git a/src/app/sections/payment-adjustment/search-form/search-form.component.html b/src/app/sections/payment-adjustment/search-form/search-form.component.html index 79a89a77..19ce9cb2 100644 --- a/src/app/sections/payment-adjustment/search-form/search-form.component.html +++ b/src/app/sections/payment-adjustment/search-form/search-form.component.html @@ -25,7 +25,7 @@ any - {{ + {{ status }} @@ -38,6 +38,7 @@ matInput placeholder="From domain revision" required + type="number" /> @@ -46,6 +47,7 @@ matInput placeholder="To domain revision" required + type="number" /> diff --git a/src/app/sections/payment-adjustment/search-form/search-form.component.ts b/src/app/sections/payment-adjustment/search-form/search-form.component.ts index 730b945a..4eede801 100644 --- a/src/app/sections/payment-adjustment/search-form/search-form.component.ts +++ b/src/app/sections/payment-adjustment/search-form/search-form.component.ts @@ -1,9 +1,11 @@ import { Component, EventEmitter, OnInit, Output } from '@angular/core'; import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; +import { InvoicePaymentStatus } from '@vality/magista-proto'; import * as moment from 'moment'; import { map } from 'rxjs/operators'; +import { getEnumKeys } from '../../../../utils'; import { PaymentAdjustmentService } from '../payment-adjustment.service'; import { SearchFormParams } from './search-form-params'; import { toSearchParams } from './to-search-params'; @@ -14,15 +16,13 @@ import { toSearchParams } from './to-search-params'; templateUrl: './search-form.component.html', }) export class SearchFormComponent implements OnInit { - @Output() - valueChanges: EventEmitter = new EventEmitter(); - - @Output() - statusChanges: EventEmitter = new EventEmitter(); + @Output() valueChanges = new EventEmitter(); + @Output() statusChanges = new EventEmitter(); form: UntypedFormGroup; - statuses: string[] = ['pending', 'processed', 'captured', 'cancelled', 'refunded', 'failed']; + statuses = getEnumKeys(InvoicePaymentStatus); + statusEnum = InvoicePaymentStatus; constructor( private paymentAdjustmentService: PaymentAdjustmentService, @@ -34,7 +34,7 @@ export class SearchFormComponent implements OnInit { fromTime: [moment(), Validators.required], toTime: [moment(), Validators.required], invoiceIds: '', - partyId: '', + partyId: ['', Validators.required], shopId: '', fromRevision: [0, Validators.required], toRevision: ['', Validators.required], diff --git a/src/app/sections/payment-adjustment/table/table.component.html b/src/app/sections/payment-adjustment/table/table.component.html index 2e5e26c5..7ee4739d 100644 --- a/src/app/sections/payment-adjustment/table/table.component.html +++ b/src/app/sections/payment-adjustment/table/table.component.html @@ -30,7 +30,7 @@ Revision - {{ payment.domain_revision | ccThriftInt64 }} + {{ payment.domain_revision }} Invoice ID diff --git a/src/app/sections/payment-adjustment/table/table.component.ts b/src/app/sections/payment-adjustment/table/table.component.ts index bd44e58c..620d6eea 100644 --- a/src/app/sections/payment-adjustment/table/table.component.ts +++ b/src/app/sections/payment-adjustment/table/table.component.ts @@ -12,9 +12,6 @@ import { import { MatPaginator } from '@angular/material/paginator'; import { MatTableDataSource } from '@angular/material/table'; import { StatPayment } from '@vality/domain-proto/lib/merch_stat'; -import { Int64 } from '@vality/thrift-ts'; - -import { i64ToNumber } from '@cc/utils/i64-to-number'; @Component({ selector: 'cc-payment-adjustment-table', @@ -48,13 +45,8 @@ export class TableComponent implements OnInit, OnChanges { ngOnInit() { this.selection.changed.subscribe((e) => this.changeSelected.emit(e.source.selected)); - this.dataSource.filterPredicate = ({ domain_revision }, filter) => { - const num = i64ToNumber( - (domain_revision as unknown as Int64).buffer, - (domain_revision as unknown as Int64).offset - ); - return filter === num.toString(); - }; + this.dataSource.filterPredicate = ({ domain_revision }, filter) => + filter === domain_revision.toString(); this.dataSource.paginator = this.paginator; } diff --git a/src/app/sections/payment-details/payment-details.component.html b/src/app/sections/payment-details/payment-details.component.html index 27763d83..184d7a6e 100644 --- a/src/app/sections/payment-details/payment-details.component.html +++ b/src/app/sections/payment-details/payment-details.component.html @@ -1,4 +1,4 @@ -
+
Payment details @@ -14,6 +14,7 @@

Refunds

diff --git a/src/app/sections/payment-details/payment-details.component.ts b/src/app/sections/payment-details/payment-details.component.ts index 68f10a94..6c76413c 100644 --- a/src/app/sections/payment-details/payment-details.component.ts +++ b/src/app/sections/payment-details/payment-details.component.ts @@ -1,7 +1,6 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; -import { Subject } from 'rxjs'; -import { pluck, shareReplay } from 'rxjs/operators'; +import { pluck } from 'rxjs/operators'; import { PaymentDetailsService } from './payment-details.service'; @@ -11,11 +10,10 @@ import { PaymentDetailsService } from './payment-details.service'; providers: [PaymentDetailsService], }) export class PaymentDetailsComponent { - partyID$ = this.route.params.pipe(pluck('partyID'), shareReplay(1)); + partyID$ = this.route.params.pipe(pluck('partyID')); payment$ = this.paymentDetailsService.payment$; isLoading$ = this.paymentDetailsService.isLoading$; shop$ = this.paymentDetailsService.shop$; - updateSearchParams$ = new Subject(); constructor( private paymentDetailsService: PaymentDetailsService, diff --git a/src/app/sections/payment-details/payment-details.service.ts b/src/app/sections/payment-details/payment-details.service.ts index 2c560cae..ae7f91b8 100644 --- a/src/app/sections/payment-details/payment-details.service.ts +++ b/src/app/sections/payment-details/payment-details.service.ts @@ -1,15 +1,14 @@ import { Injectable } from '@angular/core'; import { MatSnackBar } from '@angular/material/snack-bar'; import { ActivatedRoute } from '@angular/router'; +import { cleanObject } from '@vality/ng-core'; import { combineLatest, of } from 'rxjs'; import { map, pluck, shareReplay, switchMap, tap } from 'rxjs/operators'; +import { MerchantStatisticsService } from '@cc/app/api/magista'; import { PartyManagementService } from '@cc/app/api/payment-processing'; import { progress } from '@cc/app/shared/custom-operators'; -import { QueryDsl } from '../../query-dsl'; -import { MerchantStatisticsService } from '../../thrift-services/damsel/merchant-statistics.service'; - @Injectable() export class PaymentDetailsService { private partyID$ = this.route.params.pipe(pluck('partyID'), shareReplay(1)); @@ -20,19 +19,21 @@ export class PaymentDetailsService { payment$ = this.routeParams$.pipe( switchMap(({ partyID, invoiceID, paymentID }) => this.merchantStatisticsService - .getPayments({ - dsl: JSON.stringify({ - query: { - payments: { - ...(paymentID ? { payment_id: paymentID } : {}), - ...(partyID ? { merchant_id: partyID } : {}), - ...(invoiceID ? { invoice_id: invoiceID } : {}), - }, + .SearchPayments( + cleanObject({ + common_search_query_params: { + from_time: new Date('2020-01-01').toISOString(), // TODO + to_time: new Date().toISOString(), + party_id: partyID, }, - } as QueryDsl), - }) + payment_params: { + payment_id: paymentID, + }, + invoice_ids: [invoiceID], + }) + ) .pipe( - map(({ data }) => data.payments[0]), + map(({ payments }) => payments[0]), tap((payment) => { if (!payment) { this.snackBar.open('An error occurred when receiving payment', 'OK'); diff --git a/src/app/sections/payment-details/payment-main-info/payment-error/payment-error.component.ts b/src/app/sections/payment-details/payment-main-info/payment-error/payment-error.component.ts index 18aa1068..b1367778 100644 --- a/src/app/sections/payment-details/payment-main-info/payment-error/payment-error.component.ts +++ b/src/app/sections/payment-details/payment-main-info/payment-error/payment-error.component.ts @@ -4,7 +4,7 @@ import { FailureReason, InvoicePaymentStatus, SubFailure, -} from '@vality/domain-proto/lib/domain'; +} from '@vality/magista-proto/lib/domain'; import { getUnionKey } from '@cc/utils/get-union-key'; diff --git a/src/app/sections/payment-details/payment-main-info/payment-main-info.component.html b/src/app/sections/payment-details/payment-main-info/payment-main-info.component.html index ef764433..9493c767 100644 --- a/src/app/sections/payment-details/payment-main-info/payment-main-info.component.html +++ b/src/app/sections/payment-details/payment-main-info/payment-main-info.component.html @@ -1,7 +1,7 @@
{{ payment.amount | ccThriftInt64 | ccFormatAmount }} + >{{ payment.amount | ccFormatAmount }} {{ payment.currency_symbolic_code | ccCurrency }} {{ diff --git a/src/app/sections/payment-details/payment-main-info/payment-main-info.component.ts b/src/app/sections/payment-details/payment-main-info/payment-main-info.component.ts index 33fa8d67..94ef0040 100644 --- a/src/app/sections/payment-details/payment-main-info/payment-main-info.component.ts +++ b/src/app/sections/payment-details/payment-main-info/payment-main-info.component.ts @@ -1,13 +1,9 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; import { Shop } from '@vality/domain-proto/lib/domain'; -import { - InvoicePaymentStatus, - Payer, - PaymentTool, - StatPayment, -} from '@vality/domain-proto/lib/merch_stat'; +import { Payer, StatPayment } from '@vality/magista-proto'; +import { InvoicePaymentStatus, PaymentTool } from '@vality/magista-proto/lib/domain'; -import { getUnionKey } from '@cc/utils/get-union-key'; +import { getUnionKey } from '../../../../utils'; @Component({ selector: 'cc-payment-main-info', @@ -20,13 +16,13 @@ export class PaymentMainInfoComponent { getPayerEmail(payer: Payer): string { if (payer.customer) { - return payer.customer.email; + return payer.customer.contact_info.email; } if (payer.payment_resource) { - return payer.payment_resource.email; + return payer.payment_resource.contact_info.email; } if (payer.recurrent) { - return payer.recurrent.email; + return payer.recurrent.contact_info.email; } return undefined; } @@ -34,7 +30,7 @@ export class PaymentMainInfoComponent { getPaymentTool(payer: Payer): PaymentTool { return ( payer?.customer?.payment_tool || - payer?.payment_resource?.payment_tool || + payer?.payment_resource?.resource?.payment_tool || payer?.recurrent?.payment_tool ); } diff --git a/src/app/sections/payment-details/payment-main-info/payment-tool/bank-card/bank-card.component.ts b/src/app/sections/payment-details/payment-main-info/payment-tool/bank-card/bank-card.component.ts index 5291c288..9e4ffe84 100644 --- a/src/app/sections/payment-details/payment-main-info/payment-tool/bank-card/bank-card.component.ts +++ b/src/app/sections/payment-details/payment-main-info/payment-tool/bank-card/bank-card.component.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; -import { BankCard } from '@vality/domain-proto/lib/merch_stat'; +import { BankCard } from '@vality/magista-proto/lib/domain'; @Component({ selector: 'cc-bank-card', diff --git a/src/app/sections/payment-details/payment-main-info/payment-tool/bank-card/to-card-number.pipe.ts b/src/app/sections/payment-details/payment-main-info/payment-tool/bank-card/to-card-number.pipe.ts index 72ae8f22..2b1f2a2b 100644 --- a/src/app/sections/payment-details/payment-main-info/payment-tool/bank-card/to-card-number.pipe.ts +++ b/src/app/sections/payment-details/payment-main-info/payment-tool/bank-card/to-card-number.pipe.ts @@ -1,5 +1,5 @@ import { Pipe, PipeTransform } from '@angular/core'; -import { BankCard } from '@vality/domain-proto/lib/merch_stat'; +import { BankCard } from '@vality/magista-proto/lib/domain'; @Pipe({ name: 'toCardNumber', @@ -11,4 +11,4 @@ export class ToCardNumberPipe implements PipeTransform { } export const toCardNumber = (card: BankCard): string => - `${card.bin}******${card.masked_pan}`.replace(/(.{4})/g, '$& '); + `${card.bin}******${card.last_digits}`.replace(/(.{4})/g, '$& '); diff --git a/src/app/sections/payment-details/payment-main-info/payment-tool/payment-tool.component.html b/src/app/sections/payment-details/payment-main-info/payment-tool/payment-tool.component.html index 939deec5..879927ed 100644 --- a/src/app/sections/payment-details/payment-main-info/payment-tool/payment-tool.component.html +++ b/src/app/sections/payment-details/payment-main-info/payment-tool/payment-tool.component.html @@ -1,6 +1,6 @@
- {{ paymentTool.crypto_currency?.crypto_currency?.id }} + {{ paymentTool.crypto_currency?.id }}
{{ paymentTool.digital_wallet?.id }} diff --git a/src/app/sections/payment-details/payment-main-info/payment-tool/payment-tool.component.ts b/src/app/sections/payment-details/payment-main-info/payment-tool/payment-tool.component.ts index 9d3472da..836dbdee 100644 --- a/src/app/sections/payment-details/payment-main-info/payment-tool/payment-tool.component.ts +++ b/src/app/sections/payment-details/payment-main-info/payment-tool/payment-tool.component.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; -import { PaymentTool } from '@vality/domain-proto/lib/merch_stat'; +import { PaymentTool } from '@vality/magista-proto/lib/domain'; @Component({ selector: 'cc-payment-tool', diff --git a/src/app/sections/payment-details/payment-refunds/fetch-refunds.service.ts b/src/app/sections/payment-details/payment-refunds/fetch-refunds.service.ts index a26a7e22..71eda915 100644 --- a/src/app/sections/payment-details/payment-refunds/fetch-refunds.service.ts +++ b/src/app/sections/payment-details/payment-refunds/fetch-refunds.service.ts @@ -1,19 +1,21 @@ import { Injectable } from '@angular/core'; -import { StatRefund } from '@vality/domain-proto/lib/merch_stat'; +import { StatRefund, RefundSearchQuery } from '@vality/magista-proto'; +import { cleanObject } from '@vality/ng-core'; import { Observable } from 'rxjs'; import { map, shareReplay } from 'rxjs/operators'; +import { DeepPartial } from 'utility-types'; +import { MerchantStatisticsService } from '@cc/app/api/magista'; import { FetchResult, PartialFetcher } from '@cc/app/shared/services'; import { booleanDelay } from '@cc/utils/boolean-delay'; -import { QueryDsl } from '../../../query-dsl'; -import { MerchantStatisticsService } from '../../../thrift-services/damsel/merchant-statistics.service'; -import { RefundsSearchParams } from './refunds-search-params'; - const SEARCH_LIMIT = 5; @Injectable() -export class FetchRefundsService extends PartialFetcher { +export class FetchRefundsService extends PartialFetcher< + StatRefund, + DeepPartial +> { isLoading$ = this.doAction$.pipe(booleanDelay(), shareReplay(1)); constructor(private merchantStatisticsService: MerchantStatisticsService) { @@ -21,49 +23,27 @@ export class FetchRefundsService extends PartialFetcher, continuationToken: string ): Observable> { - const { - invoiceID, - id, - paymentID, - ownerID, - shopID, - status, - createdAt, - amount, - fee, - externalID, - currencySymbolicCode, - } = params; return this.merchantStatisticsService - .getStatistics({ - dsl: JSON.stringify({ - query: { - refunds: { - size: SEARCH_LIMIT.toString(), - ...(invoiceID ? { invoice_id: invoiceID } : {}), - ...(id ? { id } : {}), - ...(paymentID ? { payment_id: paymentID } : {}), - ...(ownerID ? { owner_id: ownerID } : {}), - ...(shopID ? { shop_id: shopID } : {}), - ...(status ? { status } : {}), - ...(amount ? { amount } : {}), - ...(createdAt ? { created_at: createdAt } : {}), - ...(fee ? { fee } : {}), - ...(externalID ? { external_id: externalID } : {}), - ...(currencySymbolicCode - ? { currency_symbolic_code: currencySymbolicCode } - : {}), + .SearchRefunds( + cleanObject({ + ...params, + common_search_query_params: Object.assign( + { + continuation_token: continuationToken, + limit: SEARCH_LIMIT, + from_time: new Date('01.01.2020').toISOString(), // TODO + to_time: new Date().toISOString(), }, - }, - } as QueryDsl), - ...(continuationToken ? { continuation_token: continuationToken } : {}), - }) + params.common_search_query_params + ), + }) + ) .pipe( - map(({ data, continuation_token }) => ({ - result: data.refunds, + map(({ refunds, continuation_token }) => ({ + result: refunds, continuationToken: continuation_token, })) ); diff --git a/src/app/sections/payment-details/payment-refunds/payment-refunds.component.ts b/src/app/sections/payment-details/payment-refunds/payment-refunds.component.ts index 27c3116d..b6d294e0 100644 --- a/src/app/sections/payment-details/payment-refunds/payment-refunds.component.ts +++ b/src/app/sections/payment-details/payment-refunds/payment-refunds.component.ts @@ -1,6 +1,6 @@ import { Component, Input, OnInit } from '@angular/core'; import { MatSnackBar } from '@angular/material/snack-bar'; -import { InvoiceID, InvoicePaymentID } from '@vality/domain-proto'; +import { InvoiceID, InvoicePaymentID, PartyID } from '@vality/domain-proto'; import { FetchRefundsService } from './fetch-refunds.service'; @@ -11,6 +11,7 @@ import { FetchRefundsService } from './fetch-refunds.service'; export class PaymentRefundsComponent implements OnInit { @Input() paymentID: InvoicePaymentID; @Input() invoiceID: InvoiceID; + @Input() partyID: PartyID; doAction$ = this.fetchRefundsService.doAction$; isLoading$ = this.fetchRefundsService.isLoading$; @@ -21,8 +22,9 @@ export class PaymentRefundsComponent implements OnInit { ngOnInit() { this.fetchRefundsService.search({ - paymentID: this.paymentID, - invoiceID: this.invoiceID, + common_search_query_params: { party_id: this.partyID }, + payment_id: this.paymentID, + invoice_ids: [this.invoiceID], }); this.fetchRefundsService.errors$.subscribe((e) => this.snackBar.open(`An error occurred while search refunds (${String(e)})`, 'OK') diff --git a/src/app/sections/payment-details/payment-refunds/refunds-search-params.ts b/src/app/sections/payment-details/payment-refunds/refunds-search-params.ts deleted file mode 100644 index 959e4cdd..00000000 --- a/src/app/sections/payment-details/payment-refunds/refunds-search-params.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { - InvoiceID, - InvoicePaymentID, - InvoicePaymentRefundID, - InvoicePaymentRefundStatus, - ShopID, -} from '@vality/domain-proto/lib/domain'; - -export interface RefundsSearchParams { - invoiceID?: InvoiceID; - id?: InvoicePaymentRefundID; - paymentID?: InvoicePaymentID; - ownerID?: string; - shopID?: ShopID; - status?: InvoicePaymentRefundStatus; - createdAt?: string; - amount?; - fee?; - externalID?; - currencySymbolicCode?; -} diff --git a/src/app/sections/repairing/repairing.module.ts b/src/app/sections/repairing/repairing.module.ts index 85930e2f..f53dadd6 100644 --- a/src/app/sections/repairing/repairing.module.ts +++ b/src/app/sections/repairing/repairing.module.ts @@ -14,9 +14,10 @@ import { MatTableModule } from '@angular/material/table'; import { MatTooltipModule } from '@angular/material/tooltip'; import { ActionsModule, BaseDialogModule } from '@vality/ng-core'; +import { MetadataFormModule } from '@cc/app/shared/components/metadata-form'; + import { EmptySearchResultModule } from '../../../components/empty-search-result'; import { TableModule } from '../../../components/table'; -import { MetadataFormModule } from '../../shared'; import { DateRangeModule } from '../../shared/components/date-range/date-range.module'; import { RepairByScenarioDialogComponent } from './components/repair-by-scenario-dialog/repair-by-scenario-dialog.component'; import { RepairingRoutingModule } from './repairing-routing.module'; diff --git a/src/app/sections/routing-rules/routing-ruleset/add-routing-rule-dialog/add-routing-rule-dialog.module.ts b/src/app/sections/routing-rules/routing-ruleset/add-routing-rule-dialog/add-routing-rule-dialog.module.ts index 818fadeb..45bc40ba 100644 --- a/src/app/sections/routing-rules/routing-ruleset/add-routing-rule-dialog/add-routing-rule-dialog.module.ts +++ b/src/app/sections/routing-rules/routing-ruleset/add-routing-rule-dialog/add-routing-rule-dialog.module.ts @@ -13,7 +13,7 @@ import { MatRadioModule } from '@angular/material/radio'; import { MatSelectModule } from '@angular/material/select'; import { BaseDialogModule } from '@vality/ng-core'; -import { MetadataFormModule } from '@cc/app/shared'; +import { MetadataFormModule } from '@cc/app/shared/components/metadata-form'; import { AddRoutingRuleDialogComponent } from './add-routing-rule-dialog.component'; import { ExpanderComponent } from './expander'; diff --git a/src/app/sections/search-payments/search-payments.component.html b/src/app/sections/search-payments/search-payments.component.html index 99f2a05a..3998c2a1 100644 --- a/src/app/sections/search-payments/search-payments.component.html +++ b/src/app/sections/search-payments/search-payments.component.html @@ -1,7 +1,6 @@
diff --git a/src/app/sections/search-payments/search-payments.component.ts b/src/app/sections/search-payments/search-payments.component.ts index d7eae2fc..09664049 100644 --- a/src/app/sections/search-payments/search-payments.component.ts +++ b/src/app/sections/search-payments/search-payments.component.ts @@ -4,9 +4,7 @@ import { Router } from '@angular/router'; import { PaymentActions, PaymentMenuItemEvent, - SearcherType, SearchFiltersParams, - SearchType, } from '@cc/app/shared/components'; import { SearchPaymentsService } from './search-payments.service'; @@ -17,10 +15,6 @@ import { SearchPaymentsService } from './search-payments.service'; providers: [SearchPaymentsService], }) export class SearchPaymentsComponent { - searchType: SearcherType = { - type: SearchType.GlobalSearcher, - }; - initsearchParams$ = this.searchPaymentsService.data$; constructor(private searchPaymentsService: SearchPaymentsService, private router: Router) {} diff --git a/src/app/sections/search-payments/search-payments.module.ts b/src/app/sections/search-payments/search-payments.module.ts index 52d37124..3905deba 100644 --- a/src/app/sections/search-payments/search-payments.module.ts +++ b/src/app/sections/search-payments/search-payments.module.ts @@ -13,7 +13,6 @@ import { } from '@cc/app/shared/components'; import { EmptySearchResultModule } from '@cc/components/empty-search-result'; -import { PartyPaymentsModule } from '../party-payments'; import { SearchPaymentsRoutingModule } from './search-payments-routing.module'; import { SearchPaymentsComponent } from './search-payments.component'; @@ -29,7 +28,6 @@ import { SearchPaymentsComponent } from './search-payments.component'; EmptySearchResultModule, PaymentsTableModule, MatButtonModule, - PartyPaymentsModule, PaymentsSearcherModule, ], declarations: [SearchPaymentsComponent], diff --git a/src/app/sections/sections-routing.module.ts b/src/app/sections/sections-routing.module.ts index 0c021739..dda57835 100644 --- a/src/app/sections/sections-routing.module.ts +++ b/src/app/sections/sections-routing.module.ts @@ -6,6 +6,10 @@ const ROUTES: Routes = [ path: 'party', loadChildren: () => import('./party/party.module').then((m) => m.PartyModule), }, + { + path: 'party/:partyID/invoice/:invoiceID/payment/:paymentID', + loadChildren: () => import('./payment-details').then((m) => m.PaymentDetailsModule), + }, { path: 'withdrawals', loadChildren: () => diff --git a/src/app/sections/withdrawals/withdrawals.module.ts b/src/app/sections/withdrawals/withdrawals.module.ts index b5d6d48f..2396ec4a 100644 --- a/src/app/sections/withdrawals/withdrawals.module.ts +++ b/src/app/sections/withdrawals/withdrawals.module.ts @@ -16,9 +16,10 @@ import { BaseDialogModule } from '@vality/ng-core'; import { EmptySearchResultModule } from '../../../components/empty-search-result'; import { TableModule } from '../../../components/table'; -import { MetadataFormModule, ThriftPipesModule } from '../../shared'; import { DateRangeModule } from '../../shared/components/date-range/date-range.module'; import { MerchantFieldModule } from '../../shared/components/merchant-field'; +import { MetadataFormModule } from '../../shared/components/metadata-form'; +import { ThriftPipesModule } from '../../shared/pipes/thrift'; import { CreateAdjustmentDialogComponent } from './components/create-adjustment-dialog/create-adjustment-dialog.component'; import { WithdrawalsRoutingModule } from './withdrawals-routing.module'; import { WithdrawalsComponent } from './withdrawals.component'; diff --git a/src/app/shared/components/metadata-form/index.ts b/src/app/shared/components/metadata-form/index.ts index ddbb0490..4fe1274b 100644 --- a/src/app/shared/components/metadata-form/index.ts +++ b/src/app/shared/components/metadata-form/index.ts @@ -1,5 +1,5 @@ export * from './metadata-form.module'; export * from './types/metadata-form-data'; -export { MetadataFormExtension } from '@cc/app/shared/components/metadata-form/types/metadata-form-extension'; -export { MetadataFormExtensionResult } from '@cc/app/shared/components/metadata-form/types/metadata-form-extension'; -export { MetadataFormExtensionOption } from '@cc/app/shared/components/metadata-form/types/metadata-form-extension'; +export { MetadataFormExtension } from './types/metadata-form-extension'; +export { MetadataFormExtensionResult } from './types/metadata-form-extension'; +export { MetadataFormExtensionOption } from './types/metadata-form-extension'; diff --git a/src/app/shared/components/metadata-form/metadata-form.component.ts b/src/app/shared/components/metadata-form/metadata-form.component.ts index 4db8cd7d..614317b4 100644 --- a/src/app/shared/components/metadata-form/metadata-form.component.ts +++ b/src/app/shared/components/metadata-form/metadata-form.component.ts @@ -3,10 +3,10 @@ import { Validator } from '@angular/forms'; import { Field, ValueType } from '@vality/thrift-ts'; import { ThriftAstMetadata } from '@cc/app/api/utils'; -import { MetadataFormExtension } from '@cc/app/shared/components/metadata-form/types/metadata-form-extension'; import { createControlProviders, ValidatedFormControlSuperclass } from '@cc/utils'; import { MetadataFormData } from './types/metadata-form-data'; +import { MetadataFormExtension } from './types/metadata-form-extension'; @Component({ selector: 'cc-metadata-form', diff --git a/src/app/shared/components/metadata-form/metadata-form.module.ts b/src/app/shared/components/metadata-form/metadata-form.module.ts index 10804d19..8adb1b6a 100644 --- a/src/app/shared/components/metadata-form/metadata-form.module.ts +++ b/src/app/shared/components/metadata-form/metadata-form.module.ts @@ -15,8 +15,9 @@ import { MatRadioModule } from '@angular/material/radio'; import { MatSelectModule } from '@angular/material/select'; import { MatTooltipModule } from '@angular/material/tooltip'; -import { ThriftPipesModule, ValueTypeTitleModule } from '@cc/app/shared'; import { JsonViewerModule } from '@cc/app/shared/components/json-viewer'; +import { ThriftPipesModule } from '@cc/app/shared/pipes/thrift'; +import { ValueTypeTitleModule } from '@cc/app/shared/pipes/value-type-title'; import { ComplexFormComponent } from './components/complex-form/complex-form.component'; import { EnumFieldComponent } from './components/enum-field/enum-field.component'; diff --git a/src/app/shared/components/metadata-form/types/metadata-form-extension.ts b/src/app/shared/components/metadata-form/types/metadata-form-extension.ts index f409efea..7268a5df 100644 --- a/src/app/shared/components/metadata-form/types/metadata-form-extension.ts +++ b/src/app/shared/components/metadata-form/types/metadata-form-extension.ts @@ -1,7 +1,7 @@ import { ThemePalette } from '@angular/material/core'; import { Observable } from 'rxjs'; -import { MetadataFormData } from '@cc/app/shared'; +import { MetadataFormData } from './metadata-form-data'; export interface MetadataFormExtensionOption { value: unknown; diff --git a/src/app/shared/components/metadata-form/utils/get-default-value.ts b/src/app/shared/components/metadata-form/utils/get-default-value.ts index 0117ef62..91d5b937 100644 --- a/src/app/shared/components/metadata-form/utils/get-default-value.ts +++ b/src/app/shared/components/metadata-form/utils/get-default-value.ts @@ -2,7 +2,8 @@ import { ValueType } from '@vality/thrift-ts'; import { TypeDefs } from '@vality/thrift-ts/src/thrift-parser'; import { ThriftAstMetadata } from '@cc/app/api/utils'; -import { MetadataFormData, TypeGroup } from '@cc/app/shared'; + +import { MetadataFormData, TypeGroup } from '../types/metadata-form-data'; export function getDefaultValue(metadata: ThriftAstMetadata[], namespace: string, type: ValueType) { let data: MetadataFormData; diff --git a/src/app/shared/components/payments-search-filters/payments-main-search-filters/index.ts b/src/app/shared/components/payments-search-filters/payments-main-search-filters/index.ts index 22c8f10f..924aae44 100644 --- a/src/app/shared/components/payments-search-filters/payments-main-search-filters/index.ts +++ b/src/app/shared/components/payments-search-filters/payments-main-search-filters/index.ts @@ -1,3 +1,2 @@ export * from './payments-main-search-filters.module'; export * from './payments-main-search-filters.component'; -export * from './main-filter-search-type'; diff --git a/src/app/shared/components/payments-search-filters/payments-main-search-filters/main-filter-search-type.ts b/src/app/shared/components/payments-search-filters/payments-main-search-filters/main-filter-search-type.ts deleted file mode 100644 index bad2b95d..00000000 --- a/src/app/shared/components/payments-search-filters/payments-main-search-filters/main-filter-search-type.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { PartyID } from '@vality/domain-proto'; - -export enum MainSearchType { - PartySearchFilter = 'PartySearchFilter', - GlobalSearchFilter = 'GlobalSearchFilter', -} - -export interface MainFilterSearchType { - type: MainSearchType; - partyID?: PartyID; -} diff --git a/src/app/shared/components/payments-search-filters/payments-main-search-filters/payments-main-search-filters.component.html b/src/app/shared/components/payments-search-filters/payments-main-search-filters/payments-main-search-filters.component.html index a790a37c..22cfe552 100644 --- a/src/app/shared/components/payments-search-filters/payments-main-search-filters/payments-main-search-filters.component.html +++ b/src/app/shared/components/payments-search-filters/payments-main-search-filters/payments-main-search-filters.component.html @@ -1,66 +1,63 @@ -
-
- - Date Range - - - - - - keyboard_arrow_down - - - - - - - - - Shops - - - {{ shop.details.name }} - - - -
-
- - - - - - - - - -
-
+
+ + Date Range + + + + + + keyboard_arrow_down + + + + + + + + + Shops + + + {{ shop.details.name }} + + + + + + + + + + + + +
diff --git a/src/app/shared/components/payments-search-filters/payments-main-search-filters/payments-main-search-filters.component.scss b/src/app/shared/components/payments-search-filters/payments-main-search-filters/payments-main-search-filters.component.scss deleted file mode 100644 index 49ea12d2..00000000 --- a/src/app/shared/components/payments-search-filters/payments-main-search-filters/payments-main-search-filters.component.scss +++ /dev/null @@ -1,3 +0,0 @@ -.mat-form-field { - min-width: 0; -} diff --git a/src/app/shared/components/payments-search-filters/payments-main-search-filters/payments-main-search-filters.component.ts b/src/app/shared/components/payments-search-filters/payments-main-search-filters/payments-main-search-filters.component.ts index 01c8517d..10362288 100644 --- a/src/app/shared/components/payments-search-filters/payments-main-search-filters/payments-main-search-filters.component.ts +++ b/src/app/shared/components/payments-search-filters/payments-main-search-filters/payments-main-search-filters.component.ts @@ -6,48 +6,24 @@ import { OnInit, Output, } from '@angular/core'; -import { MAT_DATE_FORMATS } from '@angular/material/core'; +import { untilDestroyed, UntilDestroy } from '@ngneat/until-destroy'; +import { filter } from 'rxjs/operators'; import { SearchFiltersParams } from '../search-filters-params'; -import { MainFilterSearchType, MainSearchType } from './main-filter-search-type'; import { PaymentsMainSearchFiltersService } from './payments-main-search-filters.service'; -export const MY_FORMATS = { - parse: { - dateInput: ['l', 'LL'], - }, - display: { - dateInput: 'DD.MM.YYYY', - monthYearLabel: 'DD.MM.YYYY', - dateA11yLabel: 'DD.MM.YYYY', - monthYearA11yLabel: 'DD.MM.YYYY', - }, -}; - +@UntilDestroy() @Component({ selector: 'cc-payments-main-search-filters', templateUrl: 'payments-main-search-filters.component.html', - styleUrls: ['payments-main-search-filters.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, - providers: [ - PaymentsMainSearchFiltersService, - { provide: MAT_DATE_FORMATS, useValue: MY_FORMATS }, - ], + providers: [PaymentsMainSearchFiltersService], }) export class PaymentsMainSearchFiltersComponent implements OnInit { - @Input() - initParams: SearchFiltersParams; - - @Input() - type: MainFilterSearchType; - - @Output() - valueChanges = new EventEmitter(); - - mainSearchType = MainSearchType; + @Input() initParams: SearchFiltersParams; + @Output() valueChanges = new EventEmitter(); shops$ = this.paymentsMainSearchFiltersService.shops$; - form = this.paymentsMainSearchFiltersService.form; constructor(private paymentsMainSearchFiltersService: PaymentsMainSearchFiltersService) { @@ -58,8 +34,10 @@ export class PaymentsMainSearchFiltersComponent implements OnInit { ngOnInit() { this.paymentsMainSearchFiltersService.init(this.initParams); - if (this.type.type === MainSearchType.PartySearchFilter) { - this.paymentsMainSearchFiltersService.getShops(this.type.partyID); - } + this.form.controls.partyID.valueChanges + .pipe(filter(Boolean), untilDestroyed(this)) + .subscribe((partyID: string) => { + this.paymentsMainSearchFiltersService.getShops(partyID); + }); } } diff --git a/src/app/shared/components/payments-search-filters/payments-main-search-filters/payments-main-search-filters.module.ts b/src/app/shared/components/payments-search-filters/payments-main-search-filters/payments-main-search-filters.module.ts index 21f1dcd0..909f1648 100644 --- a/src/app/shared/components/payments-search-filters/payments-main-search-filters/payments-main-search-filters.module.ts +++ b/src/app/shared/components/payments-search-filters/payments-main-search-filters/payments-main-search-filters.module.ts @@ -12,6 +12,7 @@ import { MatIconModule } from '@angular/material/icon'; import { MatInputModule } from '@angular/material/input'; import { MatSelectModule } from '@angular/material/select'; +import { MerchantFieldModule } from '../../merchant-field'; import { MerchantSearcherModule } from '../../merchant-searcher'; import { PaymentsMainSearchFiltersComponent } from './payments-main-search-filters.component'; @@ -30,6 +31,7 @@ import { PaymentsMainSearchFiltersComponent } from './payments-main-search-filte FlexLayoutModule, MatSelectModule, MerchantSearcherModule, + MerchantFieldModule, ], declarations: [PaymentsMainSearchFiltersComponent], exports: [PaymentsMainSearchFiltersComponent], diff --git a/src/app/shared/components/payments-search-filters/payments-other-search-filters/form-params-to-search-params.ts b/src/app/shared/components/payments-search-filters/payments-other-search-filters/form-params-to-search-params.ts index b6d53883..7822571c 100644 --- a/src/app/shared/components/payments-search-filters/payments-other-search-filters/form-params-to-search-params.ts +++ b/src/app/shared/components/payments-search-filters/payments-other-search-filters/form-params-to-search-params.ts @@ -4,10 +4,6 @@ import { SearchFiltersParams } from '../search-filters-params'; export const formParamsToSearchParams = (params: SearchFiltersParams): SearchFiltersParams => ({ ...params, - ...(params.paymentAmountFrom - ? { paymentAmountFrom: amountToMinor(params.paymentAmountFrom) } - : {}), - ...(params.paymentAmountTo ? { paymentAmountTo: amountToMinor(params.paymentAmountTo) } : {}), + ...(params.paymentAmountFrom ? { paymentAmountFrom: toMinor(params.paymentAmountFrom) } : {}), + ...(params.paymentAmountTo ? { paymentAmountTo: toMinor(params.paymentAmountTo) } : {}), }); - -const amountToMinor = (amount: string): string => toMinor(Number(amount)).toString(); diff --git a/src/app/shared/components/payments-search-filters/payments-other-search-filters/other-filters-dialog/constants.ts b/src/app/shared/components/payments-search-filters/payments-other-search-filters/other-filters-dialog/constants.ts deleted file mode 100644 index 1d9ca0ee..00000000 --- a/src/app/shared/components/payments-search-filters/payments-other-search-filters/other-filters-dialog/constants.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { RadioButtonObject } from '@cc/components/utils'; - -export const PAYMENT_STATUSES: RadioButtonObject[] = [ - { - value: 'captured', - title: 'Captured', - }, - { - value: 'failed', - title: 'Failed', - }, - { - value: 'pending', - title: 'Pending', - }, - { - value: 'processed', - title: 'Processed', - }, - { - value: 'cancelled', - title: 'Cancelled', - }, - { - value: 'refunded', - title: 'Refunded', - }, -]; - -export const PAYMENT_METHODS: RadioButtonObject[] = [ - { - value: 'bank_card', - title: 'Bank Card', - }, - { - value: 'terminal', - title: 'Terminal', - }, - { - value: 'mobile', - title: 'Mobile Commerce', - }, -]; - -export const TOKEN_PROVIDERS: RadioButtonObject[] = [ - { - value: 'applepay', - title: 'Apple Pay', - }, - { - value: 'googlepay', - title: 'Google Pay', - }, - { - value: 'samsungpay', - title: 'Mobile Commerce', - }, -]; - -export const PAYMENT_SYSTEMS: RadioButtonObject[] = [ - { - value: 'visa', - title: 'Visa', - }, - { - value: 'mastercard', - title: 'Mastercard', - }, - { - value: 'visaelectron', - title: 'Visa Electron', - }, - { - value: 'maestro', - title: 'Maestro', - }, - { - value: 'forbrugsforeningen', - title: 'Forbrugsforeningen', - }, - { - value: 'dankort', - title: 'Dankort', - }, - { - value: 'amex', - title: 'Amex', - }, - { - value: 'dinersclub', - title: 'Dinersclub', - }, - { - value: 'discover', - title: 'Discover', - }, - { - value: 'unionpay', - title: 'UnionPay', - }, - { - value: 'jcb', - title: 'JCB', - }, - { - value: 'nspkmir', - title: 'NSPK Mir', - }, -]; diff --git a/src/app/shared/components/payments-search-filters/payments-other-search-filters/other-filters-dialog/other-filters-dialog.component.html b/src/app/shared/components/payments-search-filters/payments-other-search-filters/other-filters-dialog/other-filters-dialog.component.html index 2f0533e5..641dbfed 100644 --- a/src/app/shared/components/payments-search-filters/payments-other-search-filters/other-filters-dialog/other-filters-dialog.component.html +++ b/src/app/shared/components/payments-search-filters/payments-other-search-filters/other-filters-dialog/other-filters-dialog.component.html @@ -1,28 +1,53 @@ -
-

Other filters

- -
-
- - - - - - -
-
- - - -
-
+ +
+
+ + + + + +
- -

Payment Status

- + + + + + + + any + + {{ s.key }} + + + + + + + any + + {{ pm.key }} + + + + + + + any + + {{ p.data.name }} + + + + + + + any + + {{ ps.data.name }} + + + +

Domain Revision

@@ -46,27 +71,8 @@
- -

Payment Method

- - -

Token Provider

- - -

Payment System

- - - - +
+ - -
+ + diff --git a/src/app/shared/components/payments-search-filters/payments-other-search-filters/other-filters-dialog/other-filters-dialog.component.ts b/src/app/shared/components/payments-search-filters/payments-other-search-filters/other-filters-dialog/other-filters-dialog.component.ts index bd6e3aa7..f89909a6 100644 --- a/src/app/shared/components/payments-search-filters/payments-other-search-filters/other-filters-dialog/other-filters-dialog.component.ts +++ b/src/app/shared/components/payments-search-filters/payments-other-search-filters/other-filters-dialog/other-filters-dialog.component.ts @@ -1,38 +1,46 @@ -import { ChangeDetectionStrategy, Component, Inject, OnInit } from '@angular/core'; -import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; +import { ChangeDetectionStrategy, Component, OnInit, Injector } from '@angular/core'; +import { PaymentToolType, InvoicePaymentStatus } from '@vality/magista-proto'; +import { BaseDialogSuperclass } from '@vality/ng-core'; +import { getEnumKeyValues } from '../../../../../../utils'; +import { DomainStoreService } from '../../../../../thrift-services/damsel/domain-store.service'; import { SearchFiltersParams } from '../../search-filters-params'; -import { PAYMENT_METHODS, PAYMENT_STATUSES, PAYMENT_SYSTEMS, TOKEN_PROVIDERS } from './constants'; import { OtherFiltersDialogService } from './other-filters-dialog.service'; @Component({ templateUrl: 'other-filters-dialog.component.html', changeDetection: ChangeDetectionStrategy.OnPush, + providers: [OtherFiltersDialogService], }) -export class OtherFiltersDialogComponent implements OnInit { - paymentStatuses = PAYMENT_STATUSES; - paymentMethods = PAYMENT_METHODS; - tokenProviders = TOKEN_PROVIDERS; - paymentSystems = PAYMENT_SYSTEMS; +export class OtherFiltersDialogComponent + extends BaseDialogSuperclass< + OtherFiltersDialogComponent, + SearchFiltersParams, + SearchFiltersParams + > + implements OnInit +{ + paymentStatuses = getEnumKeyValues(InvoicePaymentStatus); + paymentMethods = getEnumKeyValues(PaymentToolType); + tokenProviders$ = this.domainStoreService.getObjects('payment_token'); + paymentSystems$ = this.domainStoreService.getObjects('payment_system'); currentDomainVersion$ = this.paymentsOtherSearchFiltersService.currentDomainVersion$; form = this.paymentsOtherSearchFiltersService.form; constructor( - private dialogRef: MatDialogRef, + injector: Injector, private paymentsOtherSearchFiltersService: OtherFiltersDialogService, - @Inject(MAT_DIALOG_DATA) public initParams: SearchFiltersParams - ) {} - - ngOnInit() { - this.form.patchValue(this.initParams); + private domainStoreService: DomainStoreService + ) { + super(injector); } - cancel() { - this.dialogRef.close(); + ngOnInit() { + this.form.patchValue(this.dialogData); } save() { - this.dialogRef.close(this.form.value); + this.closeWithSuccess(this.form.value); } } diff --git a/src/app/shared/components/payments-search-filters/payments-other-search-filters/other-filters-dialog/other-filters-dialog.module.ts b/src/app/shared/components/payments-search-filters/payments-other-search-filters/other-filters-dialog/other-filters-dialog.module.ts index 9420422a..5ba92d96 100644 --- a/src/app/shared/components/payments-search-filters/payments-other-search-filters/other-filters-dialog/other-filters-dialog.module.ts +++ b/src/app/shared/components/payments-search-filters/payments-other-search-filters/other-filters-dialog/other-filters-dialog.module.ts @@ -10,11 +10,10 @@ import { MatDividerModule } from '@angular/material/divider'; import { MatFormFieldModule } from '@angular/material/form-field'; import { MatIconModule } from '@angular/material/icon'; import { MatInputModule } from '@angular/material/input'; - -import { ExpandableRadioGroupModule } from '@cc/components/expandable-radio-group'; +import { MatSelectModule } from '@angular/material/select'; +import { BaseDialogModule } from '@vality/ng-core'; import { OtherFiltersDialogComponent } from './other-filters-dialog.component'; -import { OtherFiltersDialogService } from './other-filters-dialog.service'; @NgModule({ imports: [ @@ -29,10 +28,10 @@ import { OtherFiltersDialogService } from './other-filters-dialog.service'; MatDialogModule, MatDividerModule, FlexLayoutModule, - ExpandableRadioGroupModule, + MatSelectModule, + BaseDialogModule, ], declarations: [OtherFiltersDialogComponent], exports: [OtherFiltersDialogComponent], - providers: [OtherFiltersDialogService], }) export class OtherFiltersDialogModule {} diff --git a/src/app/shared/components/payments-search-filters/payments-other-search-filters/other-filters-dialog/other-filters-dialog.service.ts b/src/app/shared/components/payments-search-filters/payments-other-search-filters/other-filters-dialog/other-filters-dialog.service.ts index ec27cdaa..23612839 100644 --- a/src/app/shared/components/payments-search-filters/payments-other-search-filters/other-filters-dialog/other-filters-dialog.service.ts +++ b/src/app/shared/components/payments-search-filters/payments-other-search-filters/other-filters-dialog/other-filters-dialog.service.ts @@ -1,11 +1,11 @@ import { Injectable } from '@angular/core'; import { UntypedFormBuilder, Validators } from '@angular/forms'; -import { DomainService } from '../../../../../domain'; +import { DomainStoreService } from '../../../../../thrift-services/damsel/domain-store.service'; @Injectable() export class OtherFiltersDialogService { - currentDomainVersion$ = this.domainService.version$; + currentDomainVersion$ = this.domainStoreService.version$; form = this.fb.group({ payerEmail: ['', [Validators.email]], @@ -18,8 +18,8 @@ export class OtherFiltersDialogService { paymentAmountTo: '', paymentMethod: null, tokenProvider: null, - paymentSystemIs: null, + paymentSystem: null, }); - constructor(private fb: UntypedFormBuilder, private domainService: DomainService) {} + constructor(private fb: UntypedFormBuilder, private domainStoreService: DomainStoreService) {} } diff --git a/src/app/shared/components/payments-search-filters/payments-other-search-filters/payments-other-search-filters.module.ts b/src/app/shared/components/payments-search-filters/payments-other-search-filters/payments-other-search-filters.module.ts index 1207f161..cb95cb35 100644 --- a/src/app/shared/components/payments-search-filters/payments-other-search-filters/payments-other-search-filters.module.ts +++ b/src/app/shared/components/payments-search-filters/payments-other-search-filters/payments-other-search-filters.module.ts @@ -11,8 +11,6 @@ import { MatFormFieldModule } from '@angular/material/form-field'; import { MatIconModule } from '@angular/material/icon'; import { MatInputModule } from '@angular/material/input'; -import { ExpandableRadioGroupModule } from '@cc/components/expandable-radio-group'; - import { OtherFiltersDialogModule } from './other-filters-dialog'; import { PaymentsOtherSearchFiltersComponent } from './payments-other-search-filters.component'; @@ -29,7 +27,6 @@ import { PaymentsOtherSearchFiltersComponent } from './payments-other-search-fil MatDialogModule, MatDividerModule, FlexLayoutModule, - ExpandableRadioGroupModule, OtherFiltersDialogModule, ], declarations: [PaymentsOtherSearchFiltersComponent], diff --git a/src/app/shared/components/payments-search-filters/payments-other-search-filters/payments-other-search-filters.service.ts b/src/app/shared/components/payments-search-filters/payments-other-search-filters/payments-other-search-filters.service.ts index 20281bd6..a22afcdb 100644 --- a/src/app/shared/components/payments-search-filters/payments-other-search-filters/payments-other-search-filters.service.ts +++ b/src/app/shared/components/payments-search-filters/payments-other-search-filters/payments-other-search-filters.service.ts @@ -1,7 +1,8 @@ import { Injectable } from '@angular/core'; -import { MatDialog } from '@angular/material/dialog'; -import { Observable, ReplaySubject, Subject } from 'rxjs'; -import { filter, map, shareReplay, switchMap, take } from 'rxjs/operators'; +import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; +import { BaseDialogService, BaseDialogResponseStatus } from '@vality/ng-core'; +import { ReplaySubject } from 'rxjs'; +import { filter, map, shareReplay, switchMap, first } from 'rxjs/operators'; import { removeEmptyProperties } from '@cc/utils/remove-empty-properties'; @@ -11,11 +12,10 @@ import { OtherFiltersDialogComponent } from './other-filters-dialog'; import { searchParamsToFormParams } from './search-params-to-form-params'; import { toFiltersCount } from './to-filters-count'; +@UntilDestroy() @Injectable() export class PaymentsOtherSearchFiltersService { - private openFiltersDialog$ = new Subject | void>(); - - private formParams = new ReplaySubject(); + private formParams = new ReplaySubject(1); private countableKeys = [ 'payerEmail', @@ -41,29 +41,22 @@ export class PaymentsOtherSearchFiltersService { shareReplay(1) ); - constructor(private dialog: MatDialog) { - this.openFiltersDialog$ - .pipe( - switchMap(() => this.formParams.pipe(shareReplay(1), take(1))), - switchMap((formParams) => - this.dialog - .open(OtherFiltersDialogComponent, { - disableClose: true, - width: '552px', - data: formParams, - }) - .afterClosed() - ), - filter((v) => !!v) - ) - .subscribe((params) => this.formParams.next(params)); - } + constructor(private baseDialogService: BaseDialogService) {} init(params: SearchFiltersParams) { this.formParams.next(searchParamsToFormParams(params)); } openOtherFiltersDialog() { - this.openFiltersDialog$.next(); + this.formParams + .pipe( + first(), + switchMap((data) => + this.baseDialogService.open(OtherFiltersDialogComponent, data).afterClosed() + ), + filter(({ status }) => status === BaseDialogResponseStatus.Success), + untilDestroyed(this) + ) + .subscribe(({ data }) => this.formParams.next(data)); } } diff --git a/src/app/shared/components/payments-search-filters/payments-other-search-filters/search-params-to-form-params.ts b/src/app/shared/components/payments-search-filters/payments-other-search-filters/search-params-to-form-params.ts index d7f96830..4b73d9f0 100644 --- a/src/app/shared/components/payments-search-filters/payments-other-search-filters/search-params-to-form-params.ts +++ b/src/app/shared/components/payments-search-filters/payments-other-search-filters/search-params-to-form-params.ts @@ -4,10 +4,6 @@ import { SearchFiltersParams } from '../search-filters-params'; export const searchParamsToFormParams = (params: SearchFiltersParams): SearchFiltersParams => ({ ...params, - ...(params.paymentAmountFrom - ? { paymentAmountFrom: amountToMajor(params.paymentAmountFrom) } - : {}), - ...(params.paymentAmountTo ? { paymentAmountTo: amountToMajor(params.paymentAmountTo) } : {}), + ...(params.paymentAmountFrom ? { paymentAmountFrom: toMajor(params.paymentAmountFrom) } : {}), + ...(params.paymentAmountTo ? { paymentAmountTo: toMajor(params.paymentAmountTo) } : {}), }); - -const amountToMajor = (amount: string): string => toMajor(Number(amount)).toString(); diff --git a/src/app/shared/components/payments-search-filters/search-filters-params.ts b/src/app/shared/components/payments-search-filters/search-filters-params.ts index a1a99176..82568676 100644 --- a/src/app/shared/components/payments-search-filters/search-filters-params.ts +++ b/src/app/shared/components/payments-search-filters/search-filters-params.ts @@ -1,22 +1,23 @@ +import { InvoicePaymentStatus, PaymentToolType } from '@vality/magista-proto'; + export interface SearchFiltersParams { partyID?: string; fromTime?: string; toTime?: string; invoiceID?: string; - shopID?: string; shopIDs?: string[]; payerEmail?: string; terminalID?: string; providerID?: string; rrn?: string; - paymentMethod?: string; + paymentMethod?: PaymentToolType; paymentSystem?: string; tokenProvider?: string; bin?: string; pan?: string; - domainRevisionFrom?: string; - domainRevisionTo?: string; - paymentAmountFrom?: string; - paymentAmountTo?: string; - paymentStatus?: string; + domainRevisionFrom?: number; + domainRevisionTo?: number; + paymentAmountFrom?: number; + paymentAmountTo?: number; + paymentStatus?: InvoicePaymentStatus; } diff --git a/src/app/shared/components/payments-searcher/fetch-payments.service.ts b/src/app/shared/components/payments-searcher/fetch-payments.service.ts index 8e212fbb..6f3682b9 100644 --- a/src/app/shared/components/payments-searcher/fetch-payments.service.ts +++ b/src/app/shared/components/payments-searcher/fetch-payments.service.ts @@ -1,21 +1,20 @@ import { Injectable } from '@angular/core'; -import { StatPayment } from '@vality/domain-proto/lib/merch_stat'; +import { StatPayment } from '@vality/magista-proto'; +import { cleanObject } from '@vality/ng-core'; import * as moment from 'moment'; import { Observable } from 'rxjs'; -import { map, shareReplay } from 'rxjs/operators'; +import { map } from 'rxjs/operators'; +import { MerchantStatisticsService } from '@cc/app/api/magista'; import { FetchResult, PartialFetcher } from '@cc/app/shared/services'; -import { booleanDelay } from '@cc/utils/boolean-delay'; -import { QueryDsl } from '../../../query-dsl'; -import { MerchantStatisticsService } from '../../../thrift-services/damsel/merchant-statistics.service'; -import { SearchFiltersParams } from '../payments-search-filters/search-filters-params'; +import { SearchFiltersParams } from '../payments-search-filters'; const SEARCH_LIMIT = 10; @Injectable() export class FetchPaymentsService extends PartialFetcher { - isLoading$ = this.doAction$.pipe(booleanDelay(), shareReplay(1)); + isLoading$ = this.doAction$; constructor(private merchantStatisticsService: MerchantStatisticsService) { super(); @@ -30,7 +29,6 @@ export class FetchPaymentsService extends PartialFetcher ({ - result: data.payments, + map(({ payments, continuation_token }) => ({ + result: payments, continuationToken: continuation_token, })) ); diff --git a/src/app/shared/components/payments-searcher/index.ts b/src/app/shared/components/payments-searcher/index.ts index 2757514d..99d9820b 100644 --- a/src/app/shared/components/payments-searcher/index.ts +++ b/src/app/shared/components/payments-searcher/index.ts @@ -1,2 +1 @@ export * from './payments-searcher.module'; -export * from './searcher-type'; diff --git a/src/app/shared/components/payments-searcher/payments-searcher.component.html b/src/app/shared/components/payments-searcher/payments-searcher.component.html index e78b2bc4..ef1ecd97 100644 --- a/src/app/shared/components/payments-searcher/payments-searcher.component.html +++ b/src/app/shared/components/payments-searcher/payments-searcher.component.html @@ -1,43 +1,41 @@
- - - - + - - - - - - - + + + + + + + + +
diff --git a/src/app/shared/components/payments-searcher/payments-searcher.component.scss b/src/app/shared/components/payments-searcher/payments-searcher.component.scss deleted file mode 100644 index 81aafb18..00000000 --- a/src/app/shared/components/payments-searcher/payments-searcher.component.scss +++ /dev/null @@ -1,3 +0,0 @@ -.other-filters-button { - padding-top: 16px; -} diff --git a/src/app/shared/components/payments-searcher/payments-searcher.component.ts b/src/app/shared/components/payments-searcher/payments-searcher.component.ts index 8d53624f..a0f44ccd 100644 --- a/src/app/shared/components/payments-searcher/payments-searcher.component.ts +++ b/src/app/shared/components/payments-searcher/payments-searcher.component.ts @@ -7,94 +7,46 @@ import { Output, } from '@angular/core'; import { MatSnackBar } from '@angular/material/snack-bar'; +import { untilDestroyed, UntilDestroy } from '@ngneat/until-destroy'; -import { - MainFilterSearchType, - MainSearchType, - SearchFiltersParams, -} from '../payments-search-filters'; -import { - PaymentActions, - PaymentMenuItemEvent, - PaymentsTableType, - TableType, -} from '../payments-table'; +import { SearchFiltersParams } from '../payments-search-filters'; +import { PaymentActions, PaymentMenuItemEvent } from '../payments-table'; import { FetchPaymentsService } from './fetch-payments.service'; import { PaymentsSearcherService } from './payments-searcher.service'; -import { SearcherType, SearchType } from './searcher-type'; +@UntilDestroy() @Component({ selector: 'cc-payments-searcher', templateUrl: 'payments-searcher.component.html', - styleUrls: ['payments-searcher.component.scss'], providers: [FetchPaymentsService, PaymentsSearcherService], changeDetection: ChangeDetectionStrategy.OnPush, }) export class PaymentsSearcherComponent implements OnInit { - private searcherType: SearcherType; + @Input() initSearchParams: SearchFiltersParams; + @Output() searchParamsChanged$: EventEmitter = new EventEmitter(); + @Output() paymentEventFired$: EventEmitter = new EventEmitter(); - @Input() - set type(type: SearcherType) { - this.searcherType = type; - switch (type.type) { - case SearchType.GlobalSearcher: - this.tableType = { type: TableType.GlobalTable }; - this.mainFilterSearchType = { type: MainSearchType.GlobalSearchFilter }; - break; - case SearchType.PartySearcher: - this.tableType = { type: TableType.PartyTable, partyID: type.partyID }; - this.mainFilterSearchType = { - type: MainSearchType.PartySearchFilter, - partyID: type.partyID, - }; - break; - default: - console.error('Wrong search type for payments searcher'); - break; - } - } - - // eslint-disable-next-line @typescript-eslint/member-ordering - @Input() - initSearchParams: SearchFiltersParams; - - // eslint-disable-next-line @typescript-eslint/member-ordering - @Output() - searchParamsChanged$: EventEmitter = new EventEmitter(); - - // eslint-disable-next-line @typescript-eslint/member-ordering - @Output() - paymentEventFired$: EventEmitter = new EventEmitter(); - - // eslint-disable-next-line @typescript-eslint/member-ordering isLoading$ = this.fetchPaymentsService.isLoading$; - // eslint-disable-next-line @typescript-eslint/member-ordering doAction$ = this.fetchPaymentsService.doAction$; - // eslint-disable-next-line @typescript-eslint/member-ordering payments$ = this.fetchPaymentsService.searchResult$; - // eslint-disable-next-line @typescript-eslint/member-ordering hasMore$ = this.fetchPaymentsService.hasMore$; - // eslint-disable-next-line @typescript-eslint/member-ordering - tableType: PaymentsTableType; - // eslint-disable-next-line @typescript-eslint/member-ordering - mainFilterSearchType: MainFilterSearchType; + params: SearchFiltersParams; constructor( private fetchPaymentsService: FetchPaymentsService, private paymentsSearcherService: PaymentsSearcherService, private snackBar: MatSnackBar ) { - this.paymentsSearcherService.searchParamsChanges$.subscribe((params) => { - const searchParams = { - ...params, - partyID: - this.mainFilterSearchType.type === MainSearchType.PartySearchFilter - ? this.searcherType.partyID - : params.partyID, - }; - this.fetchPaymentsService.search(searchParams); - this.searchParamsChanged$.emit(searchParams); - }); + this.paymentsSearcherService.searchParamsChanges$ + .pipe(untilDestroyed(this)) + .subscribe((params) => { + this.params = params; + // TODO: the partyID is optional, but the backend returns 500 + if (params.partyID) { + this.fetchPaymentsService.search(params); + } + this.searchParamsChanged$.emit(params); + }); } ngOnInit() { diff --git a/src/app/shared/components/payments-searcher/payments-searcher.module.ts b/src/app/shared/components/payments-searcher/payments-searcher.module.ts index 14b12daf..bdb3061a 100644 --- a/src/app/shared/components/payments-searcher/payments-searcher.module.ts +++ b/src/app/shared/components/payments-searcher/payments-searcher.module.ts @@ -11,6 +11,7 @@ import { MatInputModule } from '@angular/material/input'; import { MatMenuModule } from '@angular/material/menu'; import { MatProgressBarModule } from '@angular/material/progress-bar'; import { MatTableModule } from '@angular/material/table'; +import { ActionsModule } from '@vality/ng-core'; import { EmptySearchResultModule } from '@cc/components/empty-search-result'; @@ -18,7 +19,7 @@ import { PaymentsMainSearchFiltersModule, PaymentsOtherSearchFiltersModule, } from '../payments-search-filters'; -import { PaymentsTableModule } from '../payments-table/payments-table.module'; +import { PaymentsTableModule } from '../payments-table'; import { StatusModule } from '../status'; import { PaymentsSearcherComponent } from './payments-searcher.component'; @@ -41,6 +42,7 @@ import { PaymentsSearcherComponent } from './payments-searcher.component'; MatBadgeModule, PaymentsOtherSearchFiltersModule, EmptySearchResultModule, + ActionsModule, ], declarations: [PaymentsSearcherComponent], exports: [PaymentsSearcherComponent], diff --git a/src/app/shared/components/payments-searcher/searcher-type.ts b/src/app/shared/components/payments-searcher/searcher-type.ts deleted file mode 100644 index cbe19d70..00000000 --- a/src/app/shared/components/payments-searcher/searcher-type.ts +++ /dev/null @@ -1,9 +0,0 @@ -export enum SearchType { - PartySearcher = 'PartySearcher', - GlobalSearcher = 'GlobalSearcher', -} - -export interface SearcherType { - type: SearchType; - partyID?: string; -} diff --git a/src/app/shared/components/payments-table/index.ts b/src/app/shared/components/payments-table/index.ts index 909f3aba..f57bc153 100644 --- a/src/app/shared/components/payments-table/index.ts +++ b/src/app/shared/components/payments-table/index.ts @@ -1,4 +1,3 @@ export * from './payments-table.module'; -export * from './payments-table'; export * from './payment-actions'; export * from './payment-menu-item-event'; diff --git a/src/app/shared/components/payments-table/payments-table.component.html b/src/app/shared/components/payments-table/payments-table.component.html index da2e50f4..1ec45441 100644 --- a/src/app/shared/components/payments-table/payments-table.component.html +++ b/src/app/shared/components/payments-table/payments-table.component.html @@ -26,7 +26,7 @@ Shop - {{ payment.shop_id | shopName: partyID }} + {{ payment.shop_id | shopName: payment.owner_id }} diff --git a/src/app/shared/components/payments-table/payments-table.component.ts b/src/app/shared/components/payments-table/payments-table.component.ts index 788ad162..2539ea44 100644 --- a/src/app/shared/components/payments-table/payments-table.component.ts +++ b/src/app/shared/components/payments-table/payments-table.component.ts @@ -1,10 +1,9 @@ import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core'; import { InvoiceID, InvoicePaymentID, PartyID } from '@vality/domain-proto/lib/domain'; -import { StatPayment } from '@vality/domain-proto/lib/merch_stat'; +import { StatPayment } from '@vality/magista-proto'; import { PaymentActions } from './payment-actions'; import { PaymentMenuItemEvent } from './payment-menu-item-event'; -import { PaymentsTableType, TableType } from './payments-table'; @Component({ selector: 'cc-payments-table', @@ -13,29 +12,11 @@ import { PaymentsTableType, TableType } from './payments-table'; changeDetection: ChangeDetectionStrategy.OnPush, }) export class PaymentsTableComponent { - @Input() - payments: StatPayment[]; - - partyID: string; - - @Input() - set type(type: PaymentsTableType) { - this.displayedColumns = [ - 'amount', - 'status', - 'createdAt', - ...(type.type === TableType.PartyTable ? ['shop'] : []), - 'actions', - ]; - this.partyID = type.partyID; - } - - @Output() - menuItemSelected$: EventEmitter = new EventEmitter(); + @Input() payments: StatPayment[]; + @Output() menuItemSelected$: EventEmitter = new EventEmitter(); paymentActions = Object.keys(PaymentActions); - - displayedColumns: string[]; + displayedColumns = ['amount', 'status', 'createdAt', 'shop', 'actions']; menuItemSelected( action: string, diff --git a/src/app/shared/components/payments-table/payments-table.ts b/src/app/shared/components/payments-table/payments-table.ts deleted file mode 100644 index e63e65c8..00000000 --- a/src/app/shared/components/payments-table/payments-table.ts +++ /dev/null @@ -1,9 +0,0 @@ -export enum TableType { - PartyTable = 'PartyTable', - GlobalTable = 'GlobalTable', -} - -export interface PaymentsTableType { - type: TableType; - partyID?: string; -} diff --git a/src/app/shared/pipes/thrift/thrift-int64.pipe.ts b/src/app/shared/pipes/thrift/thrift-int64.pipe.ts index d683f7a4..087fff6e 100644 --- a/src/app/shared/pipes/thrift/thrift-int64.pipe.ts +++ b/src/app/shared/pipes/thrift/thrift-int64.pipe.ts @@ -1,12 +1,14 @@ import { Pipe, PipeTransform } from '@angular/core'; - -import { i64ToNumber } from '@cc/utils/i64-to-number'; +import { Int64 } from '@vality/thrift-ts'; @Pipe({ name: 'ccThriftInt64', }) +/** + * @deprecated + */ export class ThriftInt64Pipe implements PipeTransform { - transform(value: any): any { - return i64ToNumber(value.buffer, value.offset); + transform(value: Int64 | number): any { + return typeof value === 'number' ? value : value.toNumber(); } } diff --git a/src/app/shared/services/partial-fetcher/partial-fetcher.ts b/src/app/shared/services/partial-fetcher/partial-fetcher.ts index ce9be7db..9c920a77 100644 --- a/src/app/shared/services/partial-fetcher/partial-fetcher.ts +++ b/src/app/shared/services/partial-fetcher/partial-fetcher.ts @@ -65,7 +65,7 @@ export abstract class PartialFetcher { shareReplay(SHARE_REPLAY_CONF) ); - this.doAction$ = progress(actionWithParams$, fetchResult$, true).pipe( + this.doAction$ = progress(actionWithParams$, fetchResult$, false).pipe( shareReplay(SHARE_REPLAY_CONF) ); this.doSearchAction$ = progress( diff --git a/src/app/thrift-services/damsel/damsel.module.ts b/src/app/thrift-services/damsel/damsel.module.ts index 899285d7..e07bab59 100644 --- a/src/app/thrift-services/damsel/damsel.module.ts +++ b/src/app/thrift-services/damsel/damsel.module.ts @@ -3,7 +3,6 @@ import { NgModule } from '@angular/core'; import { ClaimManagementService } from './claim-management.service'; import { DomainStoreService } from './domain-store.service'; import { DomainService } from './domain.service'; -import { MerchantStatisticsService } from './merchant-statistics.service'; import { PaymentProcessingService } from './payment-processing.service'; import { RoutingRulesModule } from './routing-rules'; @@ -12,7 +11,6 @@ import { RoutingRulesModule } from './routing-rules'; providers: [ DomainService, PaymentProcessingService, - MerchantStatisticsService, DomainStoreService, ClaimManagementService, ], diff --git a/src/app/thrift-services/damsel/merchant-statistics.service.ts b/src/app/thrift-services/damsel/merchant-statistics.service.ts deleted file mode 100644 index 0ed4fc66..00000000 --- a/src/app/thrift-services/damsel/merchant-statistics.service.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Injectable, NgZone } from '@angular/core'; -import { StatRequest, StatResponse } from '@vality/domain-proto/lib/merch_stat'; -import { StatRequest as ThriftStatRequest } from '@vality/domain-proto/lib/merch_stat/gen-nodejs/merch_stat_types'; -import * as MerchantStatistics from '@vality/domain-proto/lib/merch_stat/gen-nodejs/MerchantStatistics'; -import { Observable } from 'rxjs'; - -import { KeycloakTokenInfoService } from '../../keycloak-token-info.service'; -import { ThriftService } from '../services/thrift/thrift-service'; - -@Injectable() -export class MerchantStatisticsService extends ThriftService { - constructor(zone: NgZone, keycloakTokenInfoService: KeycloakTokenInfoService) { - super(zone, keycloakTokenInfoService, '/stat', MerchantStatistics); - } - - getPayments = (req: StatRequest): Observable => - this.toObservableAction('GetPayments')(new ThriftStatRequest(req)); - - getStatistics = (req: StatRequest): Observable => - this.toObservableAction('GetStatistics')(new ThriftStatRequest(req)); -} diff --git a/src/components/empty-search-result/empty-search-result.component.html b/src/components/empty-search-result/empty-search-result.component.html index 88059d2d..6da7fafa 100644 --- a/src/components/empty-search-result/empty-search-result.component.html +++ b/src/components/empty-search-result/empty-search-result.component.html @@ -1,6 +1,6 @@
-

Search result is empty

+

{{ label || 'Search result is empty' }}

diff --git a/src/components/empty-search-result/empty-search-result.component.ts b/src/components/empty-search-result/empty-search-result.component.ts index e71b24a9..28befe65 100644 --- a/src/components/empty-search-result/empty-search-result.component.ts +++ b/src/components/empty-search-result/empty-search-result.component.ts @@ -8,4 +8,5 @@ import { coerceBoolean } from 'coerce-property'; }) export class EmptySearchResultComponent { @Input() @coerceBoolean unwrapped = false; + @Input() label: string; } diff --git a/src/components/expandable-radio-group/expandable-radio-group.component.html b/src/components/expandable-radio-group/expandable-radio-group.component.html deleted file mode 100644 index 497b625d..00000000 --- a/src/components/expandable-radio-group/expandable-radio-group.component.html +++ /dev/null @@ -1,32 +0,0 @@ -
- - - - Any - -
- {{ - v.title - }} - {{ values[i + 1].title }} -
-
-
-
-
-
{{ isExpanded ? 'Show less' : 'Show others' }}
- {{ isExpanded ? 'keyboard_arrow_up' : 'keyboard_arrow_down' }} -
-
diff --git a/src/components/expandable-radio-group/expandable-radio-group.component.scss b/src/components/expandable-radio-group/expandable-radio-group.component.scss deleted file mode 100644 index 59b5e3a4..00000000 --- a/src/components/expandable-radio-group/expandable-radio-group.component.scss +++ /dev/null @@ -1,15 +0,0 @@ -.show-others:hover { - cursor: pointer; -} - -input { - display: none; -} - -::ng-deep .mat-form-field-container .mat-form-field-underline { - background-color: transparent !important; -} - -::ng-deep .mat-form-field-container .mat-form-field-infix { - border-top-width: 0; -} diff --git a/src/components/expandable-radio-group/expandable-radio-group.component.ts b/src/components/expandable-radio-group/expandable-radio-group.component.ts deleted file mode 100644 index c83db450..00000000 --- a/src/components/expandable-radio-group/expandable-radio-group.component.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { FocusMonitor } from '@angular/cdk/a11y'; -import { Platform } from '@angular/cdk/platform'; -import { AutofillMonitor } from '@angular/cdk/text-field'; -import { - Component, - ElementRef, - Input, - OnChanges, - Optional, - Self, - SimpleChanges, - ViewEncapsulation, -} from '@angular/core'; -import { UntypedFormControl, FormGroupDirective, NgControl, NgForm } from '@angular/forms'; -import { ErrorStateMatcher } from '@angular/material/core'; - -import { CustomFormControl, RadioButtonObject } from '../utils'; - -@Component({ - selector: 'cc-expandable-radio-group', - templateUrl: 'expandable-radio-group.component.html', - styleUrls: ['expandable-radio-group.component.scss'], - encapsulation: ViewEncapsulation.Emulated, -}) -export class ExpandableRadioGroupComponent extends CustomFormControl implements OnChanges { - form = new UntypedFormControl(); - - @Input() - values: RadioButtonObject[]; - - control = new UntypedFormControl(); - - visibleValues: RadioButtonObject[]; - - isExpandable = false; - - isExpanded = false; - - constructor( - focusMonitor: FocusMonitor, - elementRef: ElementRef, - platform: Platform, - @Optional() @Self() ngControl: NgControl, - autofillMonitor: AutofillMonitor, - defaultErrorStateMatcher: ErrorStateMatcher, - @Optional() parentForm: NgForm, - @Optional() parentFormGroup: FormGroupDirective - ) { - super( - focusMonitor, - elementRef, - platform, - ngControl, - autofillMonitor, - defaultErrorStateMatcher, - parentForm, - parentFormGroup - ); - } - - ngOnChanges(changes?: SimpleChanges) { - this.isExpandable = changes?.values?.currentValue > 4; - this.isExpanded = - this.ngControl.value && - !this.values - .slice(0, 2) - .map((v) => v.value) - .includes(this.ngControl.value); - this.changeVisibility(this.isExpanded); - } - - changeVisibility(value: boolean) { - this.isExpanded = value; - if (value) { - this.visibleValues = this.values; - } else { - this.visibleValues = this.values.slice(0, 2); - } - } -} diff --git a/src/components/expandable-radio-group/expandable-radio-group.module.ts b/src/components/expandable-radio-group/expandable-radio-group.module.ts deleted file mode 100644 index 98d9d450..00000000 --- a/src/components/expandable-radio-group/expandable-radio-group.module.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { FlexLayoutModule } from '@angular/flex-layout'; -import { ReactiveFormsModule } from '@angular/forms'; -import { MatFormFieldModule } from '@angular/material/form-field'; -import { MatIconModule } from '@angular/material/icon'; -import { MatInputModule } from '@angular/material/input'; -import { MatRadioModule } from '@angular/material/radio'; - -import { ExpandableRadioGroupComponent } from './expandable-radio-group.component'; - -const EXPORTED_DECLARATIONS = [ExpandableRadioGroupComponent]; - -@NgModule({ - imports: [ - FlexLayoutModule, - CommonModule, - MatInputModule, - MatFormFieldModule, - MatRadioModule, - ReactiveFormsModule, - MatIconModule, - ], - declarations: EXPORTED_DECLARATIONS, - exports: EXPORTED_DECLARATIONS, -}) -export class ExpandableRadioGroupModule {} diff --git a/src/components/expandable-radio-group/index.ts b/src/components/expandable-radio-group/index.ts deleted file mode 100644 index 098565c1..00000000 --- a/src/components/expandable-radio-group/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './expandable-radio-group.module'; diff --git a/src/utils/get-enum-keys.ts b/src/utils/get-enum-keys.ts index 72e72447..274a0c73 100644 --- a/src/utils/get-enum-keys.ts +++ b/src/utils/get-enum-keys.ts @@ -1,3 +1,11 @@ +import { ValuesType } from 'utility-types'; + +export function getEnumKeyValues>(srcEnum: E) { + return Object.entries(srcEnum) + .filter(([, v]) => typeof v === 'string') + .map(([value, key]) => ({ key, value })) as { key: keyof E; value: ValuesType }[]; +} + export function getEnumKeys>(srcEnum: E): (keyof E)[] { return Object.values(srcEnum).filter((v) => typeof v === 'string') as string[]; } diff --git a/src/utils/i64-to-number.ts b/src/utils/i64-to-number.ts deleted file mode 100644 index 9d50ae72..00000000 --- a/src/utils/i64-to-number.ts +++ /dev/null @@ -1,28 +0,0 @@ -export const i64ToNumber = (buffer: any, offset: number, allowImprecise = false) => { - const b = buffer; - const o = offset; - // Running sum of octets, doing a 2's complement - // eslint-disable-next-line no-bitwise - const negate = b[o] & 0x80; - let x = 0; - let carry = 1; - for (let i = 7, m = 1; i >= 0; i--, m *= 256) { - let v = b[o + i]; - // 2's complement for negative numbers - if (negate) { - // eslint-disable-next-line no-bitwise - v = (v ^ 0xff) + carry; - // eslint-disable-next-line no-bitwise - carry = v >> 8; - // eslint-disable-next-line no-bitwise - v = v & 0xff; - } - x += v * m; - } - // Return Infinity if we've lost integer precision - const maxInt = Math.pow(2, 53); - if (!allowImprecise && x >= maxInt) { - return negate ? -Infinity : Infinity; - } - return negate ? -x : x; -}; diff --git a/src/utils/index.ts b/src/utils/index.ts index 9a4a0099..d0e2138b 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -8,7 +8,6 @@ export * from './wrap-values-to-array'; export * from './get-or'; export * from './skip-null-values'; export * from './thrift-json-converter'; -export * from './i64-to-number'; export * from './to-minor'; export * from './to-major'; export * from './java-thrift-formatter'; From ba22e86d20a8bfd49aeeab0bf73f01f68c833a43 Mon Sep 17 00:00:00 2001 From: Rinat Arsaev <11846445+KrickRay@users.noreply.github.com> Date: Fri, 12 Aug 2022 20:11:58 +0300 Subject: [PATCH 6/9] TD-364: Add chargebacks list, details, actions. Create claim. Fix searching payments (#122) --- .prettierignore | 5 +- .run/App Dev Server.run.xml | 12 ++ .run/Debug.run.xml | 5 + .run/Libs Dev Server.run.xml | 12 ++ .run/Start.run.xml | 7 ++ .../services/base-dialog.service.ts | 4 +- .../src/lib/components/base-dialog/tokens.ts | 2 +- projects/ng-core/src/lib/index.ts | 2 +- projects/ng-core/src/lib/utils/clean.ts | 45 +++++++ projects/ng-core/src/lib/utils/index.ts | 1 + .../src/lib/utils/objects/clean-object.ts | 26 ---- .../ng-core/src/lib/utils/objects/index.ts | 1 - projects/ng-core/tsconfig.lib.json | 5 + src/app/api/payment-processing/index.ts | 1 + .../payment-processing/invoicing.service.ts | 22 ++++ src/app/app.module.ts | 2 +- .../modification-form.component.ts | 20 ++-- ...te-party-claim-metadata-form-extensions.ts | 4 - .../payment-adjustment.service.ts | 12 +- .../search-form/search-form.component.ts | 2 +- .../create-chargeback-dialog.component.html | 15 +++ .../create-chargeback-dialog.component.ts | 58 +++++++++ .../payment-details.component.html | 19 ++- .../payment-details.component.ts | 39 +++++- .../payment-details/payment-details.module.ts | 13 +- .../payment-details.service.ts | 4 +- .../payment-refunds/fetch-refunds.service.ts | 4 +- .../refunds-table.component.html | 3 +- .../refunds-table/refunds-table.module.ts | 3 +- .../create-claim-dialog.component.html | 13 ++ .../create-claim-dialog.component.ts | 52 ++++++++ .../search-claims.component.html | 16 +-- .../search-claims/search-claims.component.ts | 21 +++- .../search-claims/search-claims.module.ts | 15 ++- .../search-claims/search-claims.service.ts | 28 ++--- ...ge-chargeback-status-dialog.component.html | 31 +++++ ...ange-chargeback-status-dialog.component.ts | 112 ++++++++++++++++++ .../chargebacks/chargebacks.component.html | 49 ++++++++ .../chargebacks/chargebacks.component.ts | 56 +++++++++ .../claim-search-form.component.ts | 16 +-- .../claim-search-form/claim-search-form.ts | 6 +- .../form-value-to-search-params.ts | 14 --- .../details-dialog.component.html | 3 + .../details-dialog.component.ts | 17 +++ .../merchant-field.component.ts | 15 +-- .../fetch-payments.service.ts | 61 +++++----- .../payments-searcher.component.html | 11 +- .../payments-searcher.component.ts | 6 +- src/app/shared/pipes/amount-currency.pipe.ts | 62 ++++++++++ src/app/shared/pipes/enum-key.pipe.ts | 15 +++ src/app/shared/pipes/enum-keys.pipe.ts | 13 ++ src/app/shared/pipes/index.ts | 3 + ...domain-metadata-form-extensions.service.ts | 17 ++- .../damsel/claim-management.service.ts | 2 +- .../thrift-services/damsel/damsel.module.ts | 3 + .../damsel/payment-processing.service.ts | 3 + .../confirm-action-dialog.component.html | 6 +- .../confirm-action-dialog.component.ts | 6 +- .../select-search-field.component.html | 11 +- .../select-search-field.component.ts | 6 +- src/components/table/index.ts | 1 + .../table/menu-cell/menu-cell.component.html | 6 + .../table/menu-cell/menu-cell.component.ts | 7 ++ .../no-data-row/no-data-row.component.html | 5 + .../no-data-row/no-data-row.component.ts | 27 +++++ src/components/table/table.module.ts | 21 +++- src/components/table/types/columns.ts | 9 ++ src/utils/get-enum-keys.ts | 7 ++ src/utils/index.ts | 3 - src/utils/is-numeric.ts | 2 - src/utils/map-values-to-number.ts | 4 - src/utils/map-values-to-thrift-enum.ts | 6 - 72 files changed, 921 insertions(+), 214 deletions(-) create mode 100644 .run/App Dev Server.run.xml create mode 100644 .run/Debug.run.xml create mode 100644 .run/Libs Dev Server.run.xml create mode 100644 .run/Start.run.xml create mode 100644 projects/ng-core/src/lib/utils/clean.ts create mode 100644 projects/ng-core/src/lib/utils/index.ts delete mode 100644 projects/ng-core/src/lib/utils/objects/clean-object.ts delete mode 100644 projects/ng-core/src/lib/utils/objects/index.ts create mode 100644 src/app/api/payment-processing/invoicing.service.ts create mode 100644 src/app/sections/payment-details/create-chargeback-dialog/create-chargeback-dialog.component.html create mode 100644 src/app/sections/payment-details/create-chargeback-dialog/create-chargeback-dialog.component.ts create mode 100644 src/app/sections/search-claims/components/create-claim-dialog/create-claim-dialog.component.html create mode 100644 src/app/sections/search-claims/components/create-claim-dialog/create-claim-dialog.component.ts create mode 100644 src/app/shared/components/change-chargeback-status-dialog/change-chargeback-status-dialog.component.html create mode 100644 src/app/shared/components/change-chargeback-status-dialog/change-chargeback-status-dialog.component.ts create mode 100644 src/app/shared/components/chargebacks/chargebacks.component.html create mode 100644 src/app/shared/components/chargebacks/chargebacks.component.ts delete mode 100644 src/app/shared/components/claim-search-form/form-value-to-search-params.ts create mode 100644 src/app/shared/components/details-dialog/details-dialog.component.html create mode 100644 src/app/shared/components/details-dialog/details-dialog.component.ts create mode 100644 src/app/shared/pipes/amount-currency.pipe.ts create mode 100644 src/app/shared/pipes/enum-key.pipe.ts create mode 100644 src/app/shared/pipes/enum-keys.pipe.ts create mode 100644 src/components/table/menu-cell/menu-cell.component.html create mode 100644 src/components/table/menu-cell/menu-cell.component.ts create mode 100644 src/components/table/no-data-row/no-data-row.component.html create mode 100644 src/components/table/no-data-row/no-data-row.component.ts create mode 100644 src/components/table/types/columns.ts delete mode 100644 src/utils/is-numeric.ts delete mode 100644 src/utils/map-values-to-number.ts delete mode 100644 src/utils/map-values-to-thrift-enum.ts diff --git a/.prettierignore b/.prettierignore index 8dd78226..8ff3cf10 100644 --- a/.prettierignore +++ b/.prettierignore @@ -3,4 +3,7 @@ package-lock.json node_modules dist src/assets/icons/ -.angular \ No newline at end of file +.angular + +.github/settings.* +.github/workflows/basic-* \ No newline at end of file diff --git a/.run/App Dev Server.run.xml b/.run/App Dev Server.run.xml new file mode 100644 index 00000000..0df3c0a0 --- /dev/null +++ b/.run/App Dev Server.run.xml @@ -0,0 +1,12 @@ + + + + + +