TD-626: Angular 16 (#232)

This commit is contained in:
Rinat Arsaev 2023-06-21 15:21:04 +04:00 committed by GitHub
parent 12628346bc
commit fa49f79051
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
301 changed files with 8854 additions and 29431 deletions

View File

@ -1,12 +0,0 @@
# 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
# You can see what browsers were selected by your queries by running:
# npx browserslist
> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.

View File

@ -1,63 +1,7 @@
const rules = require('./tools/eslint-config/rules');
const baseTsRules = {
parserOptions: {
project: ['tsconfig.json'],
createDefaultProgram: true,
},
extends: [
'./tools/eslint-config/typescript',
'./tools/eslint-config/angular',
'./tools/eslint-config/lodash',
'prettier',
],
rules: {
...rules.createImportOrderRule({ internalPathsPattern: '@cc/**' }),
'@typescript-eslint/unbound-method': ['error', { ignoreStatic: true }],
...rules.createAngularSelectorRules({ prefix: 'cc' }),
},
};
// TODO: pretenders for error
const lenientTsRules = {
'@typescript-eslint/no-unsafe-call': 'warn',
'@typescript-eslint/no-unsafe-member-access': 'warn',
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-unsafe-return': 'warn',
'@typescript-eslint/no-misused-promises': 'warn',
'@typescript-eslint/no-unsafe-argument': 'warn',
};
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
extends: '@vality/eslint-config',
overrides: [
{
...baseTsRules,
files: ['*.ts'],
rules: {
...baseTsRules.rules,
...lenientTsRules,
},
},
{
...baseTsRules,
// TODO: add fixed directories
files: ['**/src/app/core/**/*.ts', '**/projects/**/*.ts'],
},
{
...baseTsRules,
files: ['*.spec.ts'],
extends: [...baseTsRules.extends, './tools/eslint-config/jasmine'],
rules: lenientTsRules,
},
{
files: ['*.html'],
extends: ['plugin:@angular-eslint/template/recommended'],
rules: {
// TODO: pretenders for error
'@angular-eslint/template/no-negated-async': 'warn',
},
},
...require('@vality/eslint-config/configs').angular('cc').overrides,
...require('@vality/eslint-config/configs').importOrder(['@cc/**']).overrides,
],
};

View File

@ -8,9 +8,6 @@
"schematics": {
"@schematics/angular:component": {
"style": "scss"
},
"@schematics/angular:application": {
"strict": true
}
},
"root": "",
@ -20,6 +17,23 @@
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/control-center",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": ["zone.js"],
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/assets",
{
"glob": "**/*",
"input": "./node_modules/monaco-editor/min/vs",
"output": "libs/vs"
}
],
"styles": ["src/app/styles/styles.scss"],
"scripts": [],
"allowedCommonJsDependencies": [
"moment",
"uuid",
@ -39,37 +53,20 @@
"@vality/fistful-proto",
"@vality/file-storage-proto",
"@vality/thrift-ts"
],
"outputPath": "dist/control-center",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/assets",
{
"glob": "**/*",
"input": "./node_modules/monaco-editor/min/vs",
"output": "libs/vs"
}
],
"styles": ["src/app/styles/styles.scss"],
"scripts": ["./node_modules/keycloak-js/dist/keycloak.js"]
]
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumWarning": "7mb",
"maximumError": "8mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"fileReplacements": [
@ -114,13 +111,17 @@
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "mixer-ui:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"polyfills": ["zone.js", "zone.js/testing"],
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
@ -132,18 +133,19 @@
}
],
"styles": ["src/app/styles/styles.scss"],
"scripts": ["./node_modules/keycloak-js/dist/keycloak.js"]
},
"configurations": {
"ci": {
"karmaConfig": "karma-ci.conf.js"
"scripts": []
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": ["src/**/*.ts", "src/**/*.html"]
}
}
}
}
},
"cli": {
"analytics": false
"schematicCollections": ["@angular-eslint/schematics"]
}
}

33494
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,14 +3,12 @@
"version": "0.0.0",
"private": true,
"scripts": {
"postinstall": "ngcc",
"start": "ng serve --proxy-config proxy.conf.js --port 4200",
"stage": "cross-env NODE_ENV=stage ng serve --proxy-config proxy.conf.js --port 4201 --configuration=stage",
"build": "ng build",
"test": "ng test",
"lint": "eslint \"src/**/*.{ts,js,html}\" --max-warnings 420",
"lint:fix": "npm run lint -- --fix",
"lint:errors": "npm run lint -- --quiet",
"lint": "ng lint --max-warnings=0",
"lint:fix": "ng lint --fix",
"format": "prettier * --list-different",
"format:fix": "prettier * --write --loglevel warn",
"spell": "cspell --no-progress **",
@ -18,84 +16,70 @@
"fix": "npm run lint:fix && npm run format:fix"
},
"dependencies": {
"@angular/animations": "15.2.9",
"@angular/cdk": "15.2.9",
"@angular/common": "15.2.9",
"@angular/compiler": "15.2.9",
"@angular/core": "15.2.9",
"@angular/animations": "16.1.1",
"@angular/cdk": "16.1.1",
"@angular/common": "16.1.1",
"@angular/compiler": "16.1.1",
"@angular/core": "16.1.1",
"@angular/flex-layout": "15.0.0-beta.42",
"@angular/forms": "15.2.9",
"@angular/material": "15.2.9",
"@angular/material-moment-adapter": "15.2.9",
"@angular/platform-browser": "15.2.9",
"@angular/platform-browser-dynamic": "15.2.9",
"@angular/platform-server": "15.2.9",
"@angular/router": "15.2.9",
"@angular/forms": "16.1.1",
"@angular/material": "16.1.1",
"@angular/material-moment-adapter": "16.1.1",
"@angular/platform-browser": "16.1.1",
"@angular/platform-browser-dynamic": "16.1.1",
"@angular/platform-server": "16.1.1",
"@angular/router": "16.1.1",
"@ngneat/input-mask": "6.0.0",
"@ngneat/until-destroy": "9.2.2",
"@s-libs/ng-core": "^15.0.0",
"@s-libs/ng-core": "16.0.0",
"@vality/deanonimus-proto": "2.0.1-2a3d5ad.0",
"@vality/domain-proto": "2.0.1-bfedcb9.0",
"@vality/dominant-cache-proto": "2.0.1-99f38c9.0",
"@vality/fistful-proto": "2.0.1-4ff4ea3.0",
"@vality/magista-proto": "2.0.1-cf0eff8.0",
"@vality/ng-core": "15.0.0",
"@vality/ng-core": "16.0.1-pr-27-18c018c.0",
"@vality/payout-manager-proto": "2.0.1-b079679.0",
"@vality/repairer-proto": "2.0.1-8f7973d.0",
"@vality/thrift-ts": "2.4.1-8ad5123.0",
"@vality/woody": "0.1.1",
"angular2-prettyjson": "3.0.1",
"coerce-property": "15.0.1",
"css-element-queries": "1.2.3",
"date-fns": "2.30.0",
"element-resize-detector": "1.2.4",
"humanize-duration": "3.21.0",
"inputmask": "5.0.7",
"keycloak-angular": "13.1.0",
"keycloak-angular": "14.0.0",
"keycloak-js": "18.0.1",
"lodash-es": "4.17.21",
"moment": "2.29.4",
"monaco-editor": "0.21.2",
"ngx-mat-select-search": "7.0.1",
"ngx-mat-select-search": "7.0.2",
"rxjs": "7.8.1",
"short-uuid": "4.1.0",
"short-uuid": "4.2.2",
"tslib": "2.3.1",
"utility-types": "3.10.0",
"yaml": "2.1.3",
"zone.js": "0.11.4"
"yaml": "2.3.1",
"zone.js": "0.13.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "15.2.8",
"@angular-eslint/builder": "15.1.0",
"@angular-eslint/eslint-plugin": "15.1.0",
"@angular-eslint/eslint-plugin-template": "15.1.0",
"@angular-eslint/schematics": "15.1.0",
"@angular-eslint/template-parser": "15.1.0",
"@angular/cli": "15.2.8",
"@angular/compiler-cli": "15.2.9",
"@angular-devkit/build-angular": "16.1.0",
"@angular-eslint/builder": "16.0.3",
"@angular-eslint/schematics": "16.0.3",
"@angular/cli": "16.1.0",
"@angular/compiler-cli": "16.1.1",
"@types/element-resize-detector": "1.1.3",
"@types/humanize-duration": "3.18.0",
"@types/inputmask": "5.0.3",
"@types/jasmine": "4.0.3",
"@types/jwt-decode": "2.2.1",
"@types/lodash-es": "4.17.6",
"@types/node": "16.4.12",
"@types/uuid": "3.4.3",
"@typescript-eslint/eslint-plugin": "5.46.1",
"@typescript-eslint/parser": "5.46.1",
"@vality/cspell-config": "0.1.1-pr-15-020121f.0",
"@vality/eslint-config": "1.0.1-pr-27-18c018c.0",
"@vality/prettier-config": "0.1.1-pr-15-225ffc3.0",
"cross-env": "7.0.3",
"cspell": "6.31.1",
"dotenv": "16.0.0",
"eslint": "8.29.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-jasmine": "4.1.3",
"eslint-plugin-jsdoc": "39.6.4",
"eslint-plugin-prefer-arrow": "1.2.3",
"eslint-plugin-unused-imports": "2.0.0",
"eslint-plugin-you-dont-need-lodash-underscore": "6.12.0",
"eslint": "^8.39.0",
"jasmine-core": "4.2.0",
"jasmine-spec-reporter": "7.0.0",
"jwt-decode": "2.2.0",
@ -105,9 +89,7 @@
"karma-jasmine": "5.1.0",
"karma-jasmine-html-reporter": "2.0.0",
"prettier": "2.8.8",
"ts-mockito": "2.6.1",
"ts-node": "10.9.1",
"typescript": "4.8.4",
"typescript": "~5.0.4",
"typescript-memoize": "1.1.1"
}
}

View File

@ -15,7 +15,7 @@ export interface Refund {
owner_id: PartyID;
shop_id: ShopID;
status: InvoicePaymentRefundStatus;
created_at: any;
created_at: string;
amount: Amount;
fee: Amount;
currency_symbolic_code: string;

View File

@ -5,6 +5,7 @@ export interface WithdrawalParams {
party_id?: string;
wallet_id?: string;
withdrawal_id?: string;
withdrawal_ids?: string;
identity_id?: string;
destination_id?: string;
status?: Capitalize<keyof WithdrawalStatus>;

View File

@ -1,6 +1,7 @@
import { StatRequest } from '@vality/fistful-proto/fistful_stat';
import { QueryDsl } from '../query-dsl';
import { DepositParams } from './deposit-params';
export const depositParamsToRequest = (

View File

@ -1,7 +1,6 @@
import { registerLocaleData } from '@angular/common';
import localeRu from '@angular/common/locales/ru';
import { LOCALE_ID, NgModule, Injector } from '@angular/core';
import { MAT_MOMENT_DATE_ADAPTER_OPTIONS } from '@angular/material-moment-adapter';
import { MAT_AUTOCOMPLETE_SCROLL_STRATEGY_FACTORY_PROVIDER } from '@angular/material/autocomplete';
import { MatButtonModule } from '@angular/material/button';
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core';
@ -11,6 +10,7 @@ import { MatListModule } from '@angular/material/list';
import { MatMenuModule } from '@angular/material/menu';
import { MatSidenavModule } from '@angular/material/sidenav';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MAT_MOMENT_DATE_ADAPTER_OPTIONS } from '@angular/material-moment-adapter';
import { BrowserModule, DomSanitizer } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { InputMaskModule } from '@ngneat/input-mask';

View File

@ -2,6 +2,7 @@ import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { environment } from '../../environments/environment';
import { AppConfig } from './types/app-config';
@Injectable()

View File

@ -4,6 +4,7 @@ import { APP_INITIALIZER, NgModule } from '@angular/core';
import { KeycloakAngularModule, KeycloakService } from 'keycloak-angular';
import { environment } from '../../environments/environment';
import { ConfigService } from './config.service';
const initializer = (keycloak: KeycloakService, configService: ConfigService) => () =>

View File

@ -11,6 +11,7 @@ import { NotificationService } from '@cc/app/shared/services/notification';
import { getUnionKey, inProgressFrom, progressTo } from '@cc/utils';
import { NotificationErrorService, handleError } from '../../shared/services/notification-error';
import { AddModificationDialogComponent } from './components/add-modification-dialog/add-modification-dialog.component';
import { ChangeStatusDialogComponent } from './components/change-status-dialog/change-status-dialog.component';
import { AllowedClaimStatusesService } from './services/allowed-claim-statuses.service';

View File

@ -25,6 +25,7 @@ import { TimelineModule } from '@cc/components/timeline';
import { PageLayoutModule } from '../../shared';
import { MetadataFormModule } from '../../shared/components/metadata-form';
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';

View File

@ -2,6 +2,7 @@ import { Modification } from '@vality/domain-proto/claim_management';
import isObject from 'lodash-es/isObject';
import { getUnionKey } from '../../../../utils';
import { MODIFICATIONS_NAME_TREE } from './types/modifications-name-tree';
export function getModificationName(modification: Modification) {

View File

@ -1,7 +1,7 @@
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { Router } from '@angular/router';
import { Claim, ClaimStatus } from '@vality/domain-proto/claim_management';
import { Column, LoadOptions, TagColumn } from '@vality/ng-core';
import { Column, LoadOptions, TagColumn, createOperationColumn } from '@vality/ng-core';
import startCase from 'lodash-es/startCase';
import { map } from 'rxjs/operators';
@ -47,21 +47,12 @@ export class ClaimsTableComponent {
'revision',
{ field: 'created_at', type: 'datetime' },
{ field: 'updated_at', type: 'datetime' },
{
field: 'operation',
header: '',
type: 'menu',
pinned: 'right',
width: '0',
typeParameters: {
items: [
createOperationColumn([
{
label: 'Details',
click: (claim) => this.navigateToClaim(claim.party_id, claim.id),
},
],
},
},
]),
];
constructor(private router: Router, private partiesStoreService: PartiesStoreService) {}

View File

@ -7,6 +7,7 @@ import { debounceTime } from 'rxjs';
import { startWith } from 'rxjs/operators';
import { CLAIM_STATUSES } from '../../api/claim-management';
import { CreateClaimDialogComponent } from './components/create-claim-dialog/create-claim-dialog.component';
import { FetchClaimsService } from './fetch-claims.service';

View File

@ -13,12 +13,11 @@ import { MatMenuModule } from '@angular/material/menu';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatSelectModule } from '@angular/material/select';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { MatTableModule } from '@angular/material/table';
import { ActionsModule, DialogModule, TableModule, FiltersModule } from '@vality/ng-core';
import { PageLayoutModule } from '@cc/app/shared/components';
import { MerchantFieldModule } from '@cc/app/shared/components/merchant-field';
import { ApiModelPipesModule, ThriftPipesModule } from '@cc/app/shared/pipes';
import { ThriftPipesModule } from '@cc/app/shared/pipes';
import { EmptySearchResultModule } from '@cc/components/empty-search-result';
import { ClaimsComponentRouting } from './claims-routing.module';
@ -40,14 +39,11 @@ import { CreateClaimDialogComponent } from './components/create-claim-dialog/cre
MatProgressBarModule,
MatSelectModule,
MatSnackBarModule,
MatTableModule,
ReactiveFormsModule,
FlexLayoutModule,
MatExpansionModule,
EmptySearchResultModule,
ApiModelPipesModule,
ThriftPipesModule,
TableModule,
ActionsModule,
DialogModule,
MerchantFieldModule,

View File

@ -8,6 +8,7 @@ import { BehaviorSubject } from 'rxjs';
import { ManagementService } from '@cc/app/api/deposit';
import { UserInfoBasedIdGeneratorService } from '../../../../shared/services';
import { CreateRevertDialogConfig } from './types/create-revert-dialog-config';
@UntilDestroy()

View File

@ -8,6 +8,7 @@ import { first } from 'rxjs/operators';
import { ConfigService } from '../../../core/config.service';
import { FetchSourcesService } from '../../sources';
import { CreateDepositService } from './services/create-deposit/create-deposit.service';
@UntilDestroy()

View File

@ -9,6 +9,7 @@ import { DepositsTableModule } from '@cc/app/shared/components/deposits-table';
import { EmptySearchResultModule } from '@cc/components/empty-search-result';
import { PageLayoutModule } from '../../shared';
import { CreateDepositDialogModule } from './create-deposit-dialog/create-deposit-dialog.module';
import { DepositsRoutingModule } from './deposits-routing.module';
import { DepositsComponent } from './deposits.component';

View File

@ -11,6 +11,7 @@ import { MAT_DATE_FORMATS } from '@angular/material/core';
import { ConfigService } from '../../../core/config.service';
import { FetchSourcesService } from '../../sources';
import { SearchParams } from '../types/search-params';
import { SearchFiltersService } from './services/search-filters/search-filters.service';
export const MY_FORMATS = {

View File

@ -14,6 +14,7 @@ import { MatInputModule } from '@angular/material/input';
import { MatSelectModule } from '@angular/material/select';
import { MerchantFieldModule } from '../../../shared/components/merchant-field';
import { SearchFiltersComponent } from './search-filters.component';
@NgModule({

View File

@ -17,6 +17,7 @@ import { objectToJSON } from '@cc/utils/thrift-instance';
import { Columns } from '../../../../../components/table';
import { QueryParamsService } from '../../../../shared/services';
import { MetadataService } from '../../services/metadata.service';
import { DataSourceItem } from './types/data-source-item';
import { filterPredicate } from './utils/filter-predicate';
import { sortData } from './utils/sort-table-data';

View File

@ -21,6 +21,7 @@ import { PrettyJsonModule } from '@cc/components/pretty-json';
import { TableModule } from '../../../../../components/table';
import { ThriftPipesModule } from '../../../../shared';
import { SelectModule } from '../../../../shared/components/select';
import { DomainGroupComponent } from './domain-group.component';
@NgModule({

View File

@ -15,6 +15,7 @@ import { MonacoEditorModule } from '@cc/components/monaco-editor';
import { ThriftPipesModule, PageLayoutModule } from '../../../shared';
import { ThriftViewerModule } from '../../../shared/components/thrift-viewer';
import { DomainGroupModule } from './domain-group';
import { DomainInfoComponent } from './domain-info.component';

View File

@ -15,6 +15,7 @@ import { MonacoEditorModule } from '@cc/components/monaco-editor';
import { PageLayoutModule } from '../../../shared';
import { ThriftViewerModule } from '../../../shared/components/thrift-viewer';
import { DomainObjCreationComponent } from './domain-obj-creation.component';
@NgModule({

View File

@ -13,6 +13,7 @@ import { DomainMetadataFormExtensionsService } from '../../../shared/services';
import { DomainNavigateService } from '../services/domain-navigate.service';
import { DomainObjModificationService } from '../services/domain-obj-modification.service';
import { ModifiedDomainObjectService } from '../services/modified-domain-object.service';
import { DomainObjCodeLensProvider } from './domain-obj-code-lens-provider';
import { DomainObjCompletionProvider } from './domain-obj-completion-provider';

View File

@ -14,6 +14,7 @@ import { ThriftEditorModule } from '@cc/app/shared/components/thrift-editor';
import { MonacoEditorModule } from '@cc/components/monaco-editor';
import { PageLayoutModule } from '../../../shared';
import { DomainObjModificationComponent } from './domain-obj-modification.component';
@NgModule({

View File

@ -15,6 +15,7 @@ import { MonacoEditorModule } from '@cc/components/monaco-editor';
import { PageLayoutModule } from '../../../shared';
import { ThriftEditorModule } from '../../../shared/components/thrift-editor';
import { ThriftViewerModule } from '../../../shared/components/thrift-viewer';
import { DomainObjReviewComponent } from './domain-obj-review.component';
@NgModule({

View File

@ -5,6 +5,7 @@ import { MatButtonModule } from '@angular/material/button';
import { MatTabsModule } from '@angular/material/tabs';
import { PageLayoutModule } from '../../shared';
import { PartyRouting } from './party-routing.module';
import { PartyComponent } from './party.component';

View File

@ -16,6 +16,7 @@ import { ChargebacksComponent } from '../../shared/components/chargebacks/charge
import { JsonViewerModule } from '../../shared/components/json-viewer';
import { MetadataFormModule } from '../../shared/components/metadata-form';
import { ThriftViewerModule } from '../../shared/components/thrift-viewer';
import { CreateChargebackDialogComponent } from './create-chargeback-dialog/create-chargeback-dialog.component';
import { PaymentDetailsRoutingModule } from './payment-details-routing.module';
import { PaymentDetailsComponent } from './payment-details.component';

View File

@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { ContractID, PartyID } from '@vality/domain-proto/domain';
import { forkJoin, merge, Observable, of, Subject } from 'rxjs';
import { ContractID, PartyID, Party } from '@vality/domain-proto/domain';
import { forkJoin, merge, of, Subject } from 'rxjs';
import { catchError, filter, map, shareReplay, startWith, switchMap } from 'rxjs/operators';
import { PartyManagementService } from '@cc/app/api/payment-processing';
@ -13,8 +13,7 @@ export class FetchContractorService {
// eslint-disable-next-line @typescript-eslint/member-ordering
contractor$ = this.getContractor$.pipe(
switchMap(
({ partyID, contractID }): Observable<[ContractID, any]> =>
switchMap(({ partyID, contractID }) =>
forkJoin([
of(contractID),
this.partyManagementService.Get(partyID).pipe(
@ -26,7 +25,7 @@ export class FetchContractorService {
),
])
),
map(([contractID, party]) => {
map(([contractID, party]: [ContractID, Party]) => {
const contractorID = party.contracts.get(contractID)?.contractor_id;
return party.contractors.get(contractorID)?.contractor;
}),

View File

@ -20,13 +20,13 @@ import { InvoicingService } from '../../../../api/payment-processing';
export class CreatePaymentAdjustmentComponent extends DialogSuperclass<
CreatePaymentAdjustmentComponent,
{ payments: StatPayment[] },
{ withError?: { payment: StatPayment; error: any }[] }
{ withError?: { payment: StatPayment; error: unknown }[] }
> {
control = new FormControl<InvoicePaymentAdjustmentParams>(null);
progress$ = new BehaviorSubject(0);
metadata$ = from(import('@vality/domain-proto/metadata.json').then((m) => m.default));
extensions$ = this.domainMetadataFormExtensionsService.extensions$;
withError: { payment: StatPayment; error: any }[] = [];
withError: { payment: StatPayment; error: unknown }[] = [];
constructor(
injector: Injector,
@ -73,7 +73,8 @@ export class CreatePaymentAdjustmentComponent extends DialogSuperclass<
} else {
const errors = this.withError
.map((w) => {
const error: string = w.error?.name || w.error?.message || '';
const error: string =
w.error?.['name'] || w.error?.['message'] || '';
if (error) return `${w.payment.id}: ${error}`;
return null;
})

View File

@ -2,7 +2,7 @@ import { Component, Input, Output, EventEmitter } from '@angular/core';
import { Router } from '@angular/router';
import { InvoicePaymentStatus } from '@vality/domain-proto/domain';
import { StatPayment } from '@vality/magista-proto/magista';
import { Column, TagColumn, LoadOptions } from '@vality/ng-core';
import { Column, TagColumn, LoadOptions, createOperationColumn } from '@vality/ng-core';
import startCase from 'lodash-es/startCase';
import { map } from 'rxjs/operators';
@ -81,14 +81,7 @@ export class PaymentsTableComponent {
'domain_revision',
{ field: 'terminal_id.id', header: 'Terminal' },
{ field: 'provider_id.id', header: 'Provider' },
{
field: 'menu',
header: '',
pinned: 'right',
width: '0',
type: 'menu',
typeParameters: {
items: [
createOperationColumn([
{
label: 'Details',
click: (data) =>
@ -101,9 +94,7 @@ export class PaymentsTableComponent {
data.id,
]),
},
],
},
},
]),
];
constructor(

View File

@ -19,6 +19,7 @@ import { startWith } from 'rxjs/operators';
import { MetadataFormExtension, isTypeWithAliases } from '../../shared/components/metadata-form';
import { QueryParamsService } from '../../shared/services';
import { CreatePaymentAdjustmentComponent } from './components/create-payment-adjustment/create-payment-adjustment.component';
import { FetchPaymentsService } from './services/fetch-payments.service';

View File

@ -1,7 +1,7 @@
import { Component } from '@angular/core';
import { Validators, FormBuilder } from '@angular/forms';
import { Validators, FormBuilder, FormGroup } from '@angular/forms';
import { DateRange } from '@angular/material/datepicker';
import { PartyID, ShopID, Party, Shop } from '@vality/domain-proto/domain';
import { PartyID, Party, Shop, ShopID } from '@vality/domain-proto/domain';
import { magista } from '@vality/magista-proto';
import { Moment } from 'moment';
@ -23,7 +23,7 @@ export interface PayoutsSearchForm {
providers: createControlProviders(() => PayoutsSearchFormComponent),
})
export class PayoutsSearchFormComponent extends ValidatedControlSuperclass<PayoutsSearchForm> {
control = this.fb.group({
control: FormGroup = this.fb.group({
payoutId: null as string,
partyId: null as PartyID,
dateRange: [null, Validators.required],

View File

@ -10,6 +10,7 @@ import { isNilOrEmptyString } from '@cc/utils/is-nil-or-empty-string';
import { getValidValueChanges } from '../../../../utils';
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';
import { FetchPayoutsService, SearchParams } from './services/fetch-payouts.service';

View File

@ -22,10 +22,11 @@ import {
PageLayoutModule,
} from '@cc/app/shared/components';
import { MerchantFieldModule } from '@cc/app/shared/components/merchant-field';
import { ApiModelPipesModule, CommonPipesModule, ThriftPipesModule } from '@cc/app/shared/pipes';
import { ShopNameModule, CommonPipesModule, ThriftPipesModule } from '@cc/app/shared/pipes';
import { EmptySearchResultModule } from '@cc/components/empty-search-result';
import { DateRangeModule } from '../../../shared/components/date-range/date-range.module';
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';
@ -59,7 +60,7 @@ import { PayoutsComponent } from './payouts.component';
MatIconModule,
MatTableModule,
MatMenuModule,
ApiModelPipesModule,
ShopNameModule,
CommonPipesModule,
ThriftPipesModule,
StatusModule,

View File

@ -2,6 +2,7 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { AppAuthGuardService } from '../../shared/services';
import { RepairingComponent } from './repairing.component';
import { ROUTING_CONFIG } from './routing-config';

View File

@ -24,6 +24,7 @@ import { getEnumKey } from '@cc/utils';
import { RepairManagementService } from '../../api/repairer';
import { QueryParamsService } from '../../shared/services';
import { NotificationService } from '../../shared/services/notification';
import { RepairByScenarioDialogComponent } from './components/repair-by-scenario-dialog/repair-by-scenario-dialog.component';
import { MachinesService } from './services/machines.service';

View File

@ -25,6 +25,7 @@ import { MetadataFormModule } from '@cc/app/shared/components/metadata-form';
import { EmptySearchResultModule } from '../../../components/empty-search-result';
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';
import { RepairingComponent } from './repairing.component';

View File

@ -6,6 +6,7 @@ import { MatDialogModule } from '@angular/material/dialog';
import { DialogModule } from '@vality/ng-core';
import { TargetRulesetFormModule } from '../target-ruleset-form';
import { ChangeTargetDialogComponent } from './change-target-dialog.component';
@NgModule({

View File

@ -10,6 +10,7 @@ import { NotificationErrorService } from '@cc/app/shared/services/notification-e
import { handleError } from '../../../../utils/operators/handle-error';
import { RoutingRulesService } from '../services/routing-rules';
import { AttachNewRulesetDialogComponent } from './attach-new-ruleset-dialog';
import { PartyDelegateRulesetsService } from './party-delegate-rulesets.service';

View File

@ -22,6 +22,7 @@ import { ChangeTargetDialogModule } from '../change-target-dialog';
import { RoutingRulesListModule } from '../routing-rules-list';
import { RoutingRulesetHeaderModule } from '../routing-ruleset-header';
import { TargetRulesetFormModule } from '../target-ruleset-form';
import { AttachNewRulesetDialogComponent } from './attach-new-ruleset-dialog';
import { PartyDelegateRulesetsRoutingModule } from './party-delegate-rulesets-routing.module';
import { PartyDelegateRulesetsComponent } from './party-delegate-rulesets.component';

View File

@ -8,6 +8,7 @@ import { filter, map, pluck, shareReplay, startWith, switchMap, take } from 'rxj
import { DomainStoreService } from '@cc/app/api/deprecated-damsel';
import { RoutingRulesType } from '../types/routing-rules-type';
import { AddPartyRoutingRuleDialogComponent } from './add-party-routing-rule-dialog';
import { InitializeRoutingRulesDialogComponent } from './initialize-routing-rules-dialog';
import { PartyRoutingRulesetService } from './party-routing-ruleset.service';

View File

@ -21,6 +21,7 @@ import { RouterModule } from '@angular/router';
import { ChangeTargetDialogModule } from '../change-target-dialog';
import { RoutingRulesListModule } from '../routing-rules-list';
import { RoutingRulesetHeaderModule } from '../routing-ruleset-header';
import { AddPartyRoutingRuleDialogModule } from './add-party-routing-rule-dialog';
import { InitializeRoutingRulesDialogModule } from './initialize-routing-rules-dialog';
import { PartyRoutingRulesetRoutingModule } from './party-routing-ruleset-routing.module';

View File

@ -32,7 +32,11 @@ type DelegateId = {
templateUrl: 'routing-rules-list.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class RoutingRulesListComponent<T extends { [N in PropertyKey]: any } & DelegateId = any> {
export class RoutingRulesListComponent<
T extends { [N in PropertyKey]: unknown } & DelegateId = {
[N in PropertyKey]: unknown;
} & DelegateId
> {
@Input() displayedColumns: { key: keyof T; name: string }[];
@Input() set data(data: T[]) {

View File

@ -7,6 +7,7 @@ import { of } from 'rxjs';
import { startWith, switchMap, take } from 'rxjs/operators';
import { RoutingRulesService } from '../../services/routing-rules';
import { AddRoutingRuleDialogComponent } from './add-routing-rule-dialog.component';
export enum TerminalType {

View File

@ -22,6 +22,7 @@ import { RouterModule } from '@angular/router';
import { PrettyJsonModule } from '@cc/components/pretty-json';
import { RoutingRulesetHeaderModule } from '../routing-ruleset-header';
import { AddRoutingRuleDialogModule } from './add-routing-rule-dialog';
import { RoutingRulesetRoutingModule } from './routing-ruleset-routing.module';
import { RoutingRulesetComponent } from './routing-ruleset.component';

View File

@ -18,6 +18,7 @@ import { ComponentChanges } from '@cc/app/shared/utils';
import { RoutingRulesService } from '../services/routing-rules';
import { RoutingRulesType } from '../types/routing-rules-type';
import { getPoliciesIdByType } from '../utils/get-policies-id-by-type';
import { Target } from './types/target';
import { TargetRuleset } from './types/target-ruleset';

View File

@ -10,6 +10,7 @@ import { MatRadioModule } from '@angular/material/radio';
import { MatSelectModule } from '@angular/material/select';
import { DetailsItemModule } from '../../../../components/details-item';
import { TargetRulesetFormComponent } from './target-ruleset-form.component';
@NgModule({

View File

@ -13,7 +13,7 @@ export class PartiesSearchFiltersComponent implements OnInit {
initParams: PartiesSearchFiltersParams;
@Output()
searchParamsChanged$: EventEmitter<any> = new EventEmitter();
searchParamsChanged$ = new EventEmitter();
form = this.partiesSearchFiltersService.form;

View File

@ -7,6 +7,7 @@ import { MatProgressBarModule } from '@angular/material/progress-bar';
import { EmptySearchResultModule } from '@cc/components/empty-search-result';
import { PageLayoutModule } from '../../shared';
import { PartiesSearchFiltersModule } from './parties-search-filters';
import { PartiesTableModule } from './parties-table';
import { SearchPartiesRoutingModule } from './search-parties-routing.module';

View File

@ -11,6 +11,7 @@ import { NotificationErrorService } from '@cc/app/shared/services/notification-e
import { getUnionKey } from '../../../utils';
import { PartyManagementService } from '../../api/payment-processing';
import { NotificationService } from '../../shared/services/notification';
import { FetchShopService } from './services/fetch-shop.service';
@UntilDestroy()

View File

@ -10,6 +10,7 @@ import { JsonViewerModule } from '@cc/app/shared/components/json-viewer';
import { HeadlineModule } from '@cc/components/headline';
import { ThriftPipesModule } from '../../shared';
import { ShopDetailsRoutingModule } from './shop-details-routing.module';
import { ShopDetailsComponent } from './shop-details.component';

View File

@ -12,6 +12,7 @@ import { EmptySearchResultModule } from '../../../components/empty-search-result
import { PageLayoutModule } from '../../shared';
import { FistfulThriftFormComponent } from '../../shared/components/fistful-thrift-form';
import { MetadataFormModule } from '../../shared/components/metadata-form';
import { CreateSourceComponent } from './create-source/create-source.component';
import { SourcesRoutingModule } from './sources-routing.module';
import { SourcesComponent } from './sources.component';

View File

@ -2,6 +2,7 @@ import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { AppAuthGuardService } from '../../shared/services';
import { ROUTING_CONFIG } from './routing-config';
import { WalletsComponent } from './wallets.component';

View File

@ -7,7 +7,6 @@ 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 { MatTableModule } from '@angular/material/table';
import { MtxButtonModule } from '@ng-matero/extensions/button';
import { TableModule } from '@vality/ng-core';
@ -25,7 +24,6 @@ import { WalletsComponent } from './wallets.component';
WalletsRoutingModule,
MatCardModule,
FlexModule,
MatTableModule,
TableModule,
EmptySearchResultModule,
MatProgressSpinnerModule,

View File

@ -36,7 +36,7 @@ export class CreateAdjustmentDialogComponent extends DialogSuperclass<
extension: () => of({ label: 'External ID' }),
},
];
typeControl = new FormControl<number>(0);
typeControl = new FormControl<number>(1);
metadata$ = from(import('@vality/fistful-proto/metadata.json').then((m) => m.default));
progress = -1;

View File

@ -12,10 +12,7 @@
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-label>Withdrawal ID</mat-label>
<input formControlName="withdrawalId" matInput />
</mat-form-field>
<v-list-field formControlName="withdrawalIds" label="Withdrawal IDs"></v-list-field>
<mat-form-field>
<mat-label>Wallet ID</mat-label>
<input formControlName="walletId" matInput />

View File

@ -17,6 +17,7 @@ import { SELECT_COLUMN_NAME } from '../../../components/table';
import { isNilOrEmptyString } from '../../../utils';
import { QueryParamsService } from '../../shared/services';
import { NotificationService } from '../../shared/services/notification';
import { CreateAdjustmentDialogComponent } from './components/create-adjustment-dialog/create-adjustment-dialog.component';
import { FetchWithdrawalsService } from './services/fetch-withdrawals.service';
@ -26,7 +27,7 @@ interface WithdrawalsForm {
status: WithdrawalParams['status'];
amountFrom: WithdrawalParams['amount_from'];
amountTo: WithdrawalParams['amount_to'];
withdrawalId: WithdrawalParams['withdrawal_id'];
withdrawalIds: WithdrawalParams['withdrawal_ids'];
walletId: WithdrawalParams['wallet_id'];
}
@ -43,7 +44,7 @@ export class WithdrawalsComponent implements OnInit {
status: null,
amountFrom: null,
amountTo: null,
withdrawalId: null,
withdrawalIds: null,
walletId: null,
...this.qp.params,
});
@ -85,7 +86,7 @@ export class WithdrawalsComponent implements OnInit {
this.qp.params$
.pipe(untilDestroyed(this))
.subscribe(
({ dateRange, merchant, status, amountFrom, amountTo, withdrawalId, walletId }) =>
({ dateRange, merchant, status, amountFrom, amountTo, withdrawalIds, walletId }) =>
this.fetchWithdrawalsService.search({
party_id: merchant,
from_time: dateRange?.start?.toISOString(),
@ -93,7 +94,7 @@ export class WithdrawalsComponent implements OnInit {
status: status,
amount_from: amountFrom,
amount_to: amountTo,
withdrawal_id: withdrawalId,
withdrawal_ids: withdrawalIds,
wallet_id: walletId,
})
);

View File

@ -12,7 +12,7 @@ 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 { DialogModule } from '@vality/ng-core';
import { DialogModule, ListFieldModule } from '@vality/ng-core';
import { EmptySearchResultModule } from '../../../components/empty-search-result';
import { TableModule } from '../../../components/table';
@ -21,6 +21,7 @@ import { DateRangeModule } from '../../shared/components/date-range/date-range.m
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';
@ -50,6 +51,7 @@ import { WithdrawalsComponent } from './withdrawals.component';
MatInputModule,
MatRadioModule,
PageLayoutModule,
ListFieldModule,
],
declarations: [WithdrawalsComponent, CreateAdjustmentDialogComponent],
})

View File

@ -1,7 +1,5 @@
@import './status/status-theme';
@import './party-modification-creator/party-modification-creator-theme';
@mixin cc-shared-components-themes($theme) {
@include cc-status-theme($theme);
@include cc-party-modification-creator-theme($theme);
}

View File

@ -1,5 +1,5 @@
import { Component } from '@angular/core';
import { FormBuilder, ValidationErrors } from '@angular/forms';
import { FormBuilder, ValidationErrors, FormGroup } from '@angular/forms';
import { DateRange } from '@angular/material/datepicker';
import { Moment } from 'moment';
@ -12,7 +12,7 @@ import { createControlProviders, ValidatedControlSuperclass } from '../../../../
providers: createControlProviders(() => DateRangeComponent),
})
export class DateRangeComponent extends ValidatedControlSuperclass<DateRange<Moment>> {
control = this.fb.group({
control: FormGroup = this.fb.group({
start: null,
end: null,
});

View File

@ -6,8 +6,9 @@ import { MatIconModule } from '@angular/material/icon';
import { MatMenuModule } from '@angular/material/menu';
import { MatTableModule } from '@angular/material/table';
import { ApiModelPipesModule, CommonPipesModule } from '../../pipes';
import { CommonPipesModule } from '../../pipes';
import { StatusModule } from '../status';
import { DepositActionsPipe } from './deposit-actions.pipe';
import { DepositsTableComponent } from './deposits-table.component';
@ -21,7 +22,6 @@ import { DepositsTableComponent } from './deposits-table.component';
MatIconModule,
MatMenuModule,
CommonPipesModule,
ApiModelPipesModule,
],
declarations: [DepositsTableComponent, DepositActionsPipe],
exports: [DepositsTableComponent],

View File

@ -1,5 +1,3 @@
export * from './party-modification-creator';
export * from './party-modification-forms';
export * from './status';
export * from './shop-field';
export * from './shop-details';

View File

@ -6,6 +6,7 @@ import { map } from 'rxjs';
import yaml from 'yaml';
import { MetadataFormData } from '../metadata-form';
import { MetadataViewItem } from './utils/metadata-view';
import {
MetadataViewExtension,
@ -71,7 +72,7 @@ export class JsonViewerComponent implements OnChanges {
}
}
getTooltip(tooltip: any) {
getTooltip(tooltip: unknown) {
return typeof tooltip === 'object' ? yaml.stringify(tooltip) : String(tooltip);
}
}

View File

@ -1,4 +1,4 @@
export function getEntries(obj: any): [number | string, any][] {
export function getEntries(obj: unknown): [number | string, unknown][] {
if (!obj) return [];
return Array.isArray(obj) || obj instanceof Set
? Array.from(obj).map((v, idx) => [idx, v])

View File

@ -7,19 +7,19 @@ import { MetadataFormData } from '../../metadata-form';
export interface MetadataViewExtensionResult {
key?: string;
value: string;
tooltip?: any;
tooltip?: unknown;
link?: Parameters<Router['navigate']>;
}
export type MetadataViewExtension = {
determinant: (data: MetadataFormData, value: any) => Observable<boolean>;
extension: (data: MetadataFormData, value: any) => Observable<MetadataViewExtensionResult>;
determinant: (data: MetadataFormData, value: unknown) => Observable<boolean>;
extension: (data: MetadataFormData, value: unknown) => Observable<MetadataViewExtensionResult>;
};
export function getFirstDeterminedExtensionsResult(
sourceExtensions: MetadataViewExtension[],
data: MetadataFormData,
value: any
value: unknown
): Observable<MetadataViewExtensionResult> {
return sourceExtensions?.length
? combineLatest(sourceExtensions.map(({ determinant }) => determinant(data, value))).pipe(

View File

@ -6,6 +6,7 @@ import { Observable, of, switchMap, combineLatest } from 'rxjs';
import { map, shareReplay } from 'rxjs/operators';
import { MetadataFormData } from '../../metadata-form';
import { getChildrenTypes } from './get-children-types';
import { getEntries } from './get-entries';
import {
@ -146,7 +147,7 @@ export class MetadataViewItem {
isNumberKey$ = this.key$.pipe(map(({ value }) => typeof value === 'number'));
constructor(
private value: any,
private value: unknown,
private key?: MetadataViewItem,
private data?: MetadataFormData,
private extensions?: MetadataViewExtension[]

View File

@ -1,5 +1,5 @@
import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
import { ValidationErrors, Validators, FormBuilder } from '@angular/forms';
import { ValidationErrors, Validators, FormBuilder, FormGroup } from '@angular/forms';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import isNil from 'lodash-es/isNil';
import omitBy from 'lodash-es/omitBy';
@ -24,7 +24,7 @@ export class StructFormComponent<T extends { [N in string]: unknown }>
@Input() data: MetadataFormData<string, 'struct'>;
@Input() extensions: MetadataFormExtension[];
control = this.fb.group<T>({} as never);
control: FormGroup = this.fb.group<T>({} as T);
labelControl = this.fb.control(false);
get hasLabel() {

View File

@ -23,6 +23,7 @@ import { ValueTypeTitleModule } from '@cc/app/shared/pipes/value-type-title';
import { CashModule } from '@cc/components/cash-field';
import { DatetimeComponent } from '../datetime';
import { ComplexFormComponent } from './components/complex-form/complex-form.component';
import { EnumFieldComponent } from './components/enum-field/enum-field.component';
import { ExtensionFieldComponent } from './components/extension-field/extension-field.component';

View File

@ -1,5 +0,0 @@
@import './party-modification-target/target-table/target-table-theme';
@mixin cc-party-modification-creator-theme($theme) {
@include cc-target-table-theme($theme);
}

View File

@ -1,38 +0,0 @@
<div class="mat-dialog-title">
{{ action.name | ccModificationName : getContainerType(action.type) }}
</div>
<mat-dialog-content>
<mat-vertical-stepper [selectedIndex]="currentStep">
<mat-step>
<ng-template matStepLabel>Prepare party modification target</ng-template>
<cc-party-modification-target
[fromClaim]="fromClaim"
[partyID]="partyID"
[partyTarget]="getPartyTarget(action.type)"
[unitID]="unitID"
(valueChanges)="unitIDChange($event)"
>
</cc-party-modification-target>
</mat-step>
<mat-step>
<form>
<ng-template matStepLabel>Fill in party modification params</ng-template>
<cc-party-modification-creation
[action]="action"
[modification]="data?.modification?.modification"
[unitID]="unitID"
[unitIDDisabled]="true"
(statusChanges)="statusChanges($event)"
(valueChanges)="valueChanges($event)"
>
</cc-party-modification-creation>
</form>
</mat-step>
</mat-vertical-stepper>
</mat-dialog-content>
<mat-dialog-actions *ngIf="initialized">
<button [disabled]="isLoading || !valid" color="primary" mat-button (click)="apply()">
Apply
</button>
<button [disabled]="isLoading" [mat-dialog-close]="false" mat-button>Cancel</button>
</mat-dialog-actions>

View File

@ -1,117 +0,0 @@
import { Component, Inject, OnInit } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import {
ContractModificationUnit,
ContractorModificationUnit,
Modification,
PartyModification,
ShopModificationUnit,
} from '@vality/domain-proto/claim_management';
import { prepareModificationsToBackend } from '@cc/app/shared/components/party-modification-creator/create-modification-dialog/prepare-modifications-to-backend';
import { ActionType, ModificationAction, ModificationGroupType } from '../model';
import { PartyModificationEmitter } from '../party-modification-emitter.service';
import { PartyTarget } from '../party-modification-target';
export interface CreateModificationData {
action: ModificationAction;
partyID: string;
unitID?: string;
modification?: ShopModificationUnit | ContractModificationUnit | ContractorModificationUnit;
fromClaim: Modification[];
}
enum Step {
PrepareTarget = '0',
FillInModification = '1',
}
@Component({
templateUrl: 'create-modification-dialog.component.html',
})
export class CreateModificationDialogComponent implements OnInit {
isLoading = false;
valid = false;
initialized = false;
partyID: string;
values: PartyModification;
unitID: string;
action: ModificationAction;
currentStep = Step.PrepareTarget;
fromClaim: Modification[];
constructor(
private dialogRef: MatDialogRef<CreateModificationDialogComponent>,
private partyModificationEmitter: PartyModificationEmitter,
@Inject(MAT_DIALOG_DATA) public data: CreateModificationData
) {}
ngOnInit(): void {
if (this.data.unitID) {
this.unitID = this.data.unitID;
this.currentStep = Step.FillInModification;
}
this.partyID = this.data.partyID;
this.action = this.data.action;
this.fromClaim = this.data.fromClaim;
this.initialized = true;
}
valueChanges(e: any): void {
this.values = e;
}
unitIDChange(unitID: string): void {
this.unitID = unitID;
}
statusChanges(status: string): void {
this.valid = status === 'VALID';
}
apply(): void {
switch (this.data.action.type) {
case ActionType.ShopAction:
case ActionType.ContractAction:
case ActionType.ContractorAction:
this.addChange();
break;
}
}
getContainerType(type: ActionType): string {
switch (type) {
case ActionType.ShopAction:
return ModificationGroupType.ShopUnitContainer;
case ActionType.ContractAction:
return ModificationGroupType.ContractUnitContainer;
case ActionType.ContractorAction:
return ModificationGroupType.ContractorUnitContainer;
}
}
getPartyTarget(type: ActionType): PartyTarget {
switch (type) {
case ActionType.ShopAction:
return PartyTarget.Shop;
case ActionType.ContractAction:
return PartyTarget.Contract;
case ActionType.ContractorAction:
return PartyTarget.Contractor;
}
}
private addChange() {
this.partyModificationEmitter.modificationCreated(
prepareModificationsToBackend(this.values)
);
this.dialogRef.close();
}
}

View File

@ -1,26 +0,0 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatDialogModule } from '@angular/material/dialog';
import { MatStepperModule } from '@angular/material/stepper';
import { ModificationNameModule } from '../modification-name';
import { PartyModificationCreationModule } from '../party-modification-creation';
import { PartyModificationEmitter } from '../party-modification-emitter.service';
import { PartyModificationTargetModule } from '../party-modification-target';
import { CreateModificationDialogComponent } from './create-modification-dialog.component';
@NgModule({
imports: [
CommonModule,
MatDialogModule,
MatStepperModule,
MatButtonModule,
PartyModificationCreationModule,
PartyModificationTargetModule,
ModificationNameModule,
],
declarations: [CreateModificationDialogComponent],
providers: [PartyModificationEmitter],
})
export class CreateModificationDialogModule {}

View File

@ -1,2 +0,0 @@
export * from './create-modification-dialog.module';
export * from './create-modification-dialog.component';

View File

@ -1,19 +0,0 @@
import { domain } from '@vality/domain-proto';
import { PartyModification } from '@vality/domain-proto/claim_management';
import cloneDeep from 'lodash-es/cloneDeep';
export const prepareModificationsToBackend = (
modification: PartyModification
): PartyModification => {
const prepared = cloneDeep(modification);
const countryCode =
prepared?.contractor_modification?.modification?.creation?.legal_entity
?.international_legal_entity?.country;
if (countryCode && typeof countryCode === 'string') {
prepared.contractor_modification.modification.creation.legal_entity.international_legal_entity.country =
{
id: domain.CountryCode[countryCode] as any,
};
}
return prepared;
};

View File

@ -1,4 +0,0 @@
export * from './party-modification-creator.module';
export * from './party-modification-emitter.service';
export * from './party-modification-creator-dialog.service';
export * from './model';

View File

@ -1,13 +0,0 @@
export enum ContractModificationName {
/* eslint-disable @typescript-eslint/naming-convention */
creation = 'creation',
legacyCreation = 'legacyCreation',
termination = 'termination',
adjustmentModification = 'adjustment_modification',
payoutToolModification = 'payout_tool_modification',
legalAgreementBinding = 'legal_agreement_binding',
reportPreferencesModification = 'report_preferences_modification',
contractorModification = 'contractor_modification',
unknown = 'unknown',
/* eslint-enable @typescript-eslint/naming-convention */
}

View File

@ -1,6 +0,0 @@
export enum ContractorModificationName {
/* eslint-disable @typescript-eslint/naming-convention */
creation = 'creation',
unknown = 'unknown',
/* eslint-enable @typescript-eslint/naming-convention */
}

View File

@ -1,6 +0,0 @@
export * from './contract-modification-name';
export * from './contractor-modification-name';
export * from './modification-action';
export * from './shop-modification-name';
export * from './unit-action-data';
export * from './modification-group-type';

View File

@ -1,14 +0,0 @@
import { ContractModificationName } from './contract-modification-name';
import { ContractorModificationName } from './contractor-modification-name';
import { ShopModificationName } from './shop-modification-name';
export enum ActionType {
ContractAction = 'contractAction',
ShopAction = 'shopAction',
ContractorAction = 'contractorAction',
}
export interface ModificationAction {
type: ActionType;
name?: ContractModificationName | ShopModificationName | ContractorModificationName;
}

View File

@ -1,6 +0,0 @@
export enum ModificationGroupType {
ShopUnitContainer = 'ShopUnitContainer',
ContractUnitContainer = 'ContractUnitContainer',
ContractorUnitContainer = 'ContractorUnitContainer',
Unknown = 'unknown',
}

View File

@ -1,13 +0,0 @@
export enum ShopModificationName {
/* eslint-disable @typescript-eslint/naming-convention */
creation = 'creation',
categoryModification = 'category_modification',
detailsModification = 'details_modification',
contractModification = 'contract_modification',
payoutToolModification = 'payout_tool_modification',
locationModification = 'location_modification',
shopAccountCreation = 'shop_account_creation',
payoutScheduleModification = 'payout_schedule_modification',
unknown = 'unknown',
/* eslint-enable @typescript-eslint/naming-convention */
}

View File

@ -1,15 +0,0 @@
import { Modification } from '@vality/domain-proto/claim_management';
export enum UnitActionType {
AllActions = 'allActions',
ContractActions = 'contractActions',
ShopActions = 'shopActions',
ContractorActions = 'contractorActions',
}
export interface UnitActionData {
type: UnitActionType;
partyID: string;
unitID?: string;
fromClaim: Modification[];
}

View File

@ -1,2 +0,0 @@
export * from './modification-name.module';
export * from './modification-name.pipe';

View File

@ -1,9 +0,0 @@
import { NgModule } from '@angular/core';
import { ModificationNamePipe } from './modification-name.pipe';
@NgModule({
declarations: [ModificationNamePipe],
exports: [ModificationNamePipe],
})
export class ModificationNameModule {}

View File

@ -1,79 +0,0 @@
import { Pipe, PipeTransform } from '@angular/core';
import { ContractModificationName, ModificationGroupType, ShopModificationName } from '../model';
import { ContractorModificationName } from '../model/contractor-modification-name';
@Pipe({
name: 'ccModificationName',
})
export class ModificationNamePipe implements PipeTransform {
transform(value: any, ...args: any[]): any {
if (args.length < 1) {
return value;
}
const type = args[0] as ModificationGroupType;
switch (type) {
case ModificationGroupType.ShopUnitContainer:
return this.transformShopModification(value);
case ModificationGroupType.ContractUnitContainer:
return this.transformContractModificationName(value);
case ModificationGroupType.ContractorUnitContainer:
return this.transformContractorModification(value);
default:
return value;
}
}
private transformContractorModification(value: ContractorModificationName): string {
switch (value) {
case ContractorModificationName.creation:
return 'Contractor creation';
default:
return value;
}
}
private transformShopModification(value: ShopModificationName): string {
switch (value) {
case ShopModificationName.creation:
return 'Shop creation';
case ShopModificationName.categoryModification:
return 'Shop category modification';
case ShopModificationName.detailsModification:
return 'Shop details modification';
case ShopModificationName.contractModification:
return 'Shop contract modification';
case ShopModificationName.payoutToolModification:
return 'Shop payout tool modification';
case ShopModificationName.locationModification:
return 'Shop location modification';
case ShopModificationName.shopAccountCreation:
return 'Shop account creation';
case ShopModificationName.payoutScheduleModification:
return 'Shop schedule modification';
default:
return value;
}
}
private transformContractModificationName(value: ContractModificationName): string {
switch (value) {
case ContractModificationName.legacyCreation:
return 'Contract creation (legacy)';
case ContractModificationName.creation:
return 'Contract creation';
case ContractModificationName.termination:
return 'Contract termination';
case ContractModificationName.adjustmentModification:
return 'Contract adjustment modification';
case ContractModificationName.payoutToolModification:
return 'Contract payout tool modification';
case ContractModificationName.legalAgreementBinding:
return 'Contract legal agreement binding';
case ContractModificationName.reportPreferencesModification:
return 'Contract report preferences modification';
default:
return value;
}
}
}

View File

@ -1,41 +0,0 @@
import isDate from 'lodash-es/isDate';
import isObject from 'lodash-es/isObject';
import reduce from 'lodash-es/reduce';
import * as moment from 'moment';
type Filter = (value: any) => boolean;
function filterObject(object: any, filter: Filter): any {
return reduce(
object,
(result, value, key) => {
if (filter(value)) {
return {
...result,
[key]: filterValues(value, filter),
};
}
return result;
},
{}
);
}
export function filterValues(value: any, filter: Filter): any {
if (isDate(value)) {
return value;
}
if (moment.isMoment(value)) {
return value.toISOString();
}
if (Array.isArray(value)) {
console.error('Array is not supported', value);
return value;
}
if (isObject(value)) {
return filterObject(value, filter);
}
return value;
}
export const filterEmptyStringValues = (value: any) => filterValues(value, (v) => v !== '');

View File

@ -1 +0,0 @@
export * from './party-modification-creation.module';

View File

@ -1,112 +0,0 @@
<form [formGroup]="form" fxLayout="column" fxLayoutGap="5px">
<mat-form-field fxFlex>
<input formControlName="unitID" matInput placeholder="Unit ID" required />
</mat-form-field>
<div *ngIf="action.type === actionTypes.ContractorAction">
<cc-contractor
*ngIf="action.name === contractorModificationNames.creation"
[form]="form.get('modification')"
[initialValue]="modification?.creation"
></cc-contractor>
</div>
<div *ngIf="action.type === actionTypes.ContractAction">
<cc-contract-params
*ngIf="action.name === contractModificationNames.creation"
[form]="form.get('modification')"
[initialValue]="modification?.creation"
>
</cc-contract-params>
<cc-contract-params-legacy
*ngIf="action.name === contractModificationNames.legacyCreation"
[form]="form.get('modification')"
[initialValue]="modification?.creation"
>
</cc-contract-params-legacy>
<cc-contract-payout-tool-modification-unit
*ngIf="action.name === contractModificationNames.payoutToolModification"
[form]="form.get('modification')"
[initialValue]="modification?.payout_tool_modification"
>
</cc-contract-payout-tool-modification-unit>
<cc-legal-agreement-binding
*ngIf="action.name === contractModificationNames.legalAgreementBinding"
[form]="form.get('modification')"
[initialValue]="modification?.legal_agreement_binding"
>
</cc-legal-agreement-binding>
<cc-adjustment-modification-unit
*ngIf="action.name === contractModificationNames.adjustmentModification"
[form]="form.get('modification')"
[initialValue]="modification?.adjustment_modification"
>
</cc-adjustment-modification-unit>
<cc-report-preferences
*ngIf="action.name === contractModificationNames.reportPreferencesModification"
[form]="form.get('modification')"
[initialValue]="modification?.report_preferences_modification"
>
</cc-report-preferences>
<cc-termination
*ngIf="action.name === contractModificationNames.termination"
[form]="form.get('modification')"
[initialValue]="modification?.termination"
>
</cc-termination>
<cc-contractor-id
*ngIf="action.name === contractModificationNames.contractorModification"
[form]="form"
>
</cc-contractor-id>
</div>
<div *ngIf="action.type === actionTypes.ShopAction">
<cc-category-ref
*ngIf="action.name === shopModificationNames.categoryModification"
[form]="form.get('modification')"
[initialValue]="modification?.category_modification"
[required]="true"
>
</cc-category-ref>
<cc-shop-details
*ngIf="action.name === shopModificationNames.detailsModification"
[form]="form.get('modification')"
[initialValue]="modification?.details_modification"
>
</cc-shop-details>
<cc-shop-location
*ngIf="action.name === shopModificationNames.locationModification"
[form]="form.get('modification')"
[initialValue]="modification?.location_modification"
>
</cc-shop-location>
<cc-shop-account-creation
*ngIf="action.name === shopModificationNames.shopAccountCreation"
[form]="form.get('modification')"
[initialValue]="modification?.shop_account_creation"
>
</cc-shop-account-creation>
<cc-shop-schedule-modification
*ngIf="action.name === shopModificationNames.payoutScheduleModification"
[form]="form.get('modification')"
[initialValue]="modification?.payout_schedule_modification"
>
</cc-shop-schedule-modification>
<cc-shop-contract-modification
*ngIf="action.name === shopModificationNames.contractModification"
[form]="form.get('modification')"
[initialValue]="modification?.contract_modification"
>
</cc-shop-contract-modification>
<cc-shop-payout-tool-modification
*ngIf="action.name === shopModificationNames.payoutToolModification"
[form]="form.get('modification')"
[initialValue]="modification?.payout_tool_modification"
>
</cc-shop-payout-tool-modification>
<cc-shop-params
*ngIf="action.name === shopModificationNames.creation"
[form]="form.get('modification')"
[initialValue]="modification?.creation"
>
</cc-shop-params>
</div>
</form>

View File

@ -1,90 +0,0 @@
import {
Component,
EventEmitter,
Input,
OnChanges,
OnInit,
Output,
SimpleChanges,
} from '@angular/core';
import {
UntypedFormBuilder,
FormControlStatus,
UntypedFormGroup,
Validators,
} from '@angular/forms';
import { ContractorModification } from '@vality/domain-proto/claim_management';
import {
ContractModification,
PartyModification,
ShopModification,
} from '@vality/domain-proto/payment_processing';
import {
ActionType,
ContractModificationName,
ContractorModificationName,
ModificationAction,
ShopModificationName,
} from '../model';
import { filterEmptyStringValues } from './filter-empty-string-value';
import { toPartyModification } from './to-party-modification';
@Component({
selector: 'cc-party-modification-creation',
templateUrl: 'party-modification-creation.component.html',
})
export class PartyModificationCreationComponent implements OnInit, OnChanges {
@Input()
unitID;
@Input()
action: ModificationAction;
@Input()
unitIDDisabled;
@Input()
modification: ShopModification & ContractModification & ContractorModification; // TODO: bad type, should be '|' instead '&'
@Output()
valueChanges: EventEmitter<PartyModification> = new EventEmitter();
@Output()
statusChanges: EventEmitter<FormControlStatus> = new EventEmitter();
actionTypes = ActionType;
shopModificationNames = ShopModificationName;
contractModificationNames = ContractModificationName;
contractorModificationNames = ContractorModificationName;
form: UntypedFormGroup;
constructor(private fb: UntypedFormBuilder) {}
ngOnInit() {
this.form = this.fb.group({
unitID: [
{
value: this.unitID,
disabled: this.unitIDDisabled,
},
Validators.required,
],
modification: this.fb.group({}),
});
this.form.statusChanges.subscribe((status) => this.statusChanges.emit(status));
this.form.valueChanges.subscribe(() => {
const filtered = filterEmptyStringValues(this.form.getRawValue());
const modification = toPartyModification(this.action, filtered);
this.valueChanges.emit(modification);
});
}
ngOnChanges(changes: SimpleChanges) {
const { unitID } = changes;
if (unitID && !unitID.firstChange) {
this.form.patchValue({ unitID: unitID.currentValue });
}
}
}

View File

@ -1,21 +0,0 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FlexLayoutModule } from '@angular/flex-layout';
import { ReactiveFormsModule } from '@angular/forms';
import { MatInputModule } from '@angular/material/input';
import { PartyModificationFormsModule } from '../../party-modification-forms';
import { PartyModificationCreationComponent } from './party-modification-creation.component';
@NgModule({
imports: [
CommonModule,
ReactiveFormsModule,
FlexLayoutModule,
MatInputModule,
PartyModificationFormsModule,
],
declarations: [PartyModificationCreationComponent],
exports: [PartyModificationCreationComponent],
})
export class PartyModificationCreationModule {}

View File

@ -1,38 +0,0 @@
import {
ActionType,
ContractModificationName,
ModificationAction,
ShopModificationName,
} from '../model';
import { UnitName } from './unit-name';
const removeLegacyMark = (name: ShopModificationName | ContractModificationName): string =>
name.replace('legacy', '').toLocaleLowerCase();
const toModification = (
unitID: string,
modification: any,
unitName: UnitName,
modificationName: ShopModificationName | ContractModificationName
) => ({
[unitName]: {
id: unitID,
modification: {
[removeLegacyMark(modificationName)]: modification,
},
},
});
export const toPartyModification = (action: ModificationAction, formValue: any) => {
const { unitID, modification } = formValue;
const toMod = toModification.bind(null, unitID, modification);
const { type, name } = action;
switch (type) {
case ActionType.ShopAction:
return toMod(UnitName.ShopModification, name);
case ActionType.ContractAction:
return toMod(UnitName.ContractModification, name);
case ActionType.ContractorAction:
return toMod(UnitName.ContractorModification, name);
}
};

View File

@ -1,5 +0,0 @@
export enum UnitName {
ShopModification = 'shop_modification',
ContractModification = 'contract_modification',
ContractorModification = 'contractor_modification',
}

View File

@ -1,42 +0,0 @@
import { Injectable } from '@angular/core';
import { MatBottomSheet } from '@angular/material/bottom-sheet';
import { Modification } from '@vality/domain-proto/claim_management';
import { PartyID } from '@vality/domain-proto/domain';
import { Observable, Subject } from 'rxjs';
import { switchMap } from 'rxjs/operators';
import { UnitActionType } from './model';
import { UnitActionsNavListComponent } from './unit-actions-nav-list';
@Injectable()
export class PartyModificationCreatorDialogService {
private open$ = new Subject<{
partyID: PartyID;
fromClaim: Modification[];
}>();
// eslint-disable-next-line @typescript-eslint/member-ordering
opened$ = this.open$.pipe(
switchMap(
({ partyID, fromClaim }) =>
new Observable((observer) => {
this.bottomSheet.open(UnitActionsNavListComponent, {
data: {
type: UnitActionType.AllActions,
partyID,
fromClaim,
},
});
observer.next();
})
)
);
constructor(private bottomSheet: MatBottomSheet) {
this.opened$.subscribe();
}
open(partyID: PartyID, fromClaim: Modification[]) {
this.open$.next({ partyID, fromClaim });
}
}

View File

@ -1,12 +0,0 @@
import { NgModule } from '@angular/core';
import { CreateModificationDialogModule } from './create-modification-dialog';
import { PartyModificationCreatorDialogService } from './party-modification-creator-dialog.service';
import { PartyModificationEmitter } from './party-modification-emitter.service';
import { UnitActionsNavListModule } from './unit-actions-nav-list';
@NgModule({
imports: [UnitActionsNavListModule, CreateModificationDialogModule],
providers: [PartyModificationEmitter, PartyModificationCreatorDialogService],
})
export class PartyModificationCreatorModule {}

View File

@ -1,15 +0,0 @@
import { Injectable } from '@angular/core';
import { PartyModification } from '@vality/domain-proto/claim_management';
import { Observable, Subject } from 'rxjs';
@Injectable()
export class PartyModificationEmitter {
private modificationCreated$: Subject<PartyModification> = new Subject();
// eslint-disable-next-line @typescript-eslint/member-ordering
modification$: Observable<PartyModification> = this.modificationCreated$.asObservable();
modificationCreated(modification: PartyModification) {
this.modificationCreated$.next(modification);
}
}

View File

@ -1,6 +0,0 @@
<form [formGroup]="form" fxLayout="column">
<mat-form-field>
<input formControlName="unitID" matInput placeholder="Unit ID" />
</mat-form-field>
<div><button mat-stroked-button (click)="generate()">Generate new value</button></div>
</form>

Some files were not shown because too many files have changed in this diff Show More