Skip to content

Commit

Permalink
Use of PCore PConnect typedefs (#88)
Browse files Browse the repository at this point in the history
* TypeDefs added

* Prop types added for all components

* Placeholder added
  • Loading branch information
tumms2021389 authored Dec 22, 2023
1 parent 8e47591 commit ba9f050
Show file tree
Hide file tree
Showing 205 changed files with 2,917 additions and 2,805 deletions.
80 changes: 38 additions & 42 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
},
"ignorePatterns": ["node_modules", "!.storybook", ".storybook/public"],
"rules": {

// Prettier recommends running separately from a linter.
// https://prettier.io/docs/en/integrating-with-linters.html#notes
"prettier/prettier": "off",
Expand Down Expand Up @@ -59,13 +58,12 @@
"jsx-a11y/label-has-associated-control": "off",
"jsx-a11y/no-static-element-interactions": "off",


"sonarjs/prefer-immediate-return": "off",
"sonarjs/no-redundant-boolean": "off",

"@typescript-eslint/dot-notation": "off", // prefer warn but needs different parserOptions
"@typescript-eslint/naming-convention": "off", // prefer warn but needs different parserOptions
"@typescript-eslint/ban-types": "off", // also, see override below
"@typescript-eslint/dot-notation": "off", // prefer warn but needs different parserOptions
"@typescript-eslint/naming-convention": "off", // prefer warn but needs different parserOptions
"@typescript-eslint/ban-types": "off", // also, see override below

//
// Initial release: set to error
Expand All @@ -76,56 +74,55 @@
"no-fallthrough": "error",
"no-undef": "off",
"no-unused-vars": "off",
"no-var": "off",
"prefer-const": "off",
"no-var": "error",
"prefer-const": "error",
"yoda": "error",
"no-irregular-whitespace": "off",
"no-irregular-whitespace": "error",
"no-empty": "off",
"no-new-object": "off",
"no-new-object": "error",

"import/no-mutable-exports": "error",
"sonarjs/max-switch-cases": "error",
"sonarjs/no-collapsible-if": "off",
"sonarjs/no-all-duplicated-branches": "off",
"sonarjs/no-duplicated-branches": "off",
"sonarjs/no-gratuitous-expressions": "off",
"sonarjs/no-ignored-return": "off",
"sonarjs/no-collapsible-if": "error",
"sonarjs/no-all-duplicated-branches": "error",
"sonarjs/no-duplicated-branches": "error",
"sonarjs/no-gratuitous-expressions": "error",
"sonarjs/no-ignored-return": "error",
"sonarjs/no-small-switch": "off",
"sonarjs/prefer-object-literal": "off",
"sonarjs/prefer-single-boolean-return": "off",
"@typescript-eslint/no-shadow": "off",
"array-callback-return": "off",
"camelcase":"error",
"default-case": "off",
"sonarjs/prefer-object-literal": "error",
"sonarjs/prefer-single-boolean-return": "error",
"@typescript-eslint/no-shadow": "error",
"array-callback-return": "error",
"camelcase": "error",
"default-case": "error",
"func-names": "error",
"no-case-declarations": "error",
"no-lonely-if": "off",
"no-lonely-if": "error",
"no-nested-ternary": "error",
"no-plusplus": "off",
"no-restricted-globals": "off",
"no-restricted-properties": "off",
"no-shadow": "off",
"radix": "off",
"spaced-comment": "off",
"no-restricted-globals": "error",
"no-restricted-properties": "error",
"no-shadow": "error",
"radix": "error",
"spaced-comment": "error",

"import/newline-after-import": "off",
"sonarjs/no-nested-switch": "off",
"@typescript-eslint/no-array-constructor": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-useless-constructor": "off",
"@typescript-eslint/no-unused-expressions": "off",
"import/newline-after-import": "error",
"sonarjs/no-nested-switch": "error",
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-function": "error",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-unused-expressions": "error",
"class-methods-use-this": "off",
"guard-for-in": "off",
"no-unneeded-ternary": "off",
"no-unused-expressions": "off",
"operator-assignment": "off",
"prefer-template": "off",
"vars-on-top": "off",
"no-unneeded-ternary": "error",
"no-unused-expressions": "error",
"operator-assignment": "error",
"prefer-template": "error",
"vars-on-top": "error",

"no-use-before-define": "off", // doc for @typescript-eslint/no-use-before-define says to turn off the base implementation
"no-use-before-define": "off", // doc for @typescript-eslint/no-use-before-define says to turn off the base implementation
"@typescript-eslint/no-use-before-define": "error"

},
"overrides": [
{
Expand Down Expand Up @@ -158,8 +155,7 @@
},
{
"files": "*.@(js|jsx|ts|tsx|mdx)",
"rules": {
}
"rules": {}
},
{
"files": ".storybook/*.js",
Expand Down
33 changes: 11 additions & 22 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"index": "packages/angular-sdk-components/src/index.html",
"main": "packages/angular-sdk-components/src/main.ts",
"polyfills": "packages/angular-sdk-components/src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"tsConfig": "packages/angular-sdk-components/tsconfig.app.json",
"aot": true,
"assets": [
"src/favicon.ico",
Expand Down Expand Up @@ -75,17 +75,12 @@
"output": "./constellation/assets/icons"
}
],
"styles": [
"packages/angular-sdk-components/src/styles.scss"
],
"styles": ["packages/angular-sdk-components/src/styles.scss"],
"scripts": [],
"customWebpackConfig": {
"path": "./extra-webpack.config.js"
},
"allowedCommonJsDependencies" : [
"downloadjs",
"rxjs/internal/observable/interval"
]
"allowedCommonJsDependencies": ["downloadjs", "rxjs/internal/observable/interval"]
},
"configurations": {
"production": {
Expand Down Expand Up @@ -137,19 +132,16 @@
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"main": "packages/angular-sdk-components/src/test.ts",
"polyfills": "packages/angular-sdk-components/src/polyfills.ts",
"tsConfig": "packages/angular-sdk-components/tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets",
"src/assets/mdi.svg"
],
"styles": [
"./node_modules/intl-tel-input/build/css/intlTelInput.css",
"src/styles.scss"
"packages/angular-sdk-components/src/favicon.ico",
"packages/angular-sdk-components/src/assets",
"packages/angular-sdk-components/src/assets/mdi.svg"
],
"styles": ["./node_modules/intl-tel-input/build/css/intlTelInput.css", "packages/angular-sdk-components/src/styles.scss"],
"scripts": []
}
},
Expand Down Expand Up @@ -192,10 +184,7 @@
"builder": "@angular-devkit/build-angular:karma",
"options": {
"tsConfig": "projects/angular-sdk-library/tsconfig.spec.json",
"polyfills": [
"zone.js",
"zone.js/testing"
]
"polyfills": ["zone.js", "zone.js/testing"]
}
}
}
Expand Down
15 changes: 11 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"start-prod": "http-server ./dist --port 3500 --gzip --brotli --cors --proxy http://localhost:3500?",
"start-prod-https": "http-server ./dist --ssl --cert private.pem --key private.key --port 3500 --gzip --brotli --cors --proxy https://localhost:3500?",
"_comment": "Commands above are those expected to be run by customers/clients",
"prebuild-sdk": "npm run delete-tsbuildinfo && npm run clear-lib",
"prebuild-sdk": "npm run delete-tsbuildinfo && npm run clear-lib && npm run clear-overrides",
"build-sdk": "npm run compile-ts",
"prebuild-overrides": "shx rm -rf ./packages/angular-sdk-overrides/lib && shx cp -r ./projects/angular-sdk-library/src/lib/_components ./packages/angular-sdk-overrides/lib",
"build-overrides": "node scripts/build-overrides",
Expand All @@ -34,6 +34,7 @@
"clean": "npx shx --yes rm -rf ./node_modules ./.angular/cache && npm run clear-dist && npm run clear-lib",
"clear-dist": "npx shx --yes rm -rf ./dist",
"clear-lib": "npx shx --yes rm -rf ./packages/angular-sdk-components/lib",
"clear-overrides": "npx shx --yes rm -rf ./packages/angular-sdk-overrides/lib",
"ng": "ng",
"build": "ng build --configuration development",
"prod-build": "ng build --configuration production",
Expand Down Expand Up @@ -69,7 +70,7 @@
"@angular/router": "^15.2.8",
"@mdi/angular-material": "^5.0.45",
"@mdi/svg": "^5.0.45",
"@pega/auth": "^0.1.2",
"@pega/auth": "^0.1.4",
"@pega/constellationjs": "SDK-8.23.0",
"core-js": "^2.6.12",
"dayjs": "^1.10.5",
Expand All @@ -90,6 +91,7 @@
"@angular/language-service": "^15.2.8",
"@pega/configs": "^0.5.3",
"@pega/eslint-config": "^0.5.3",
"@pega/pcore-pconnect-typedefs": "^2.0.0",
"@pega/prettier-config": "^0.5.3",
"@playwright/test": "^1.40.0",
"@types/jasmine": "~3.6.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/angular-sdk-components/src/app/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import { endpoints } from '../../../../projects/angular-sdk-library/src/lib/_ser

// Adding path to remove "Cannot match routes" error at launch
// Tried this at one point... Need to add /app in path now...
// const appName = window.PCore.getStore().getState().data.app.Application.pyLabel;
// const appName = PCore.getStore().getState().data.app.Application.pyLabel;
// Unfortunately, called before onPCoreReady...
//
// But we can get it from window.location.pathname

const appName = window.location.pathname.split('/')[3];
// const appName = window.location.pathname.split('/')[3];

// TopAppComponent no longer used (was for when login into PegaInfinity and being directed from there to an Angular app,
// similiar to Nebula/Constellaion)
Expand Down
6 changes: 3 additions & 3 deletions packages/angular-sdk-components/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { APP_BASE_HREF } from '@angular/common';
import { HttpClientModule, provideHttpClient } from '@angular/common/http';
import { BrowserModule, bootstrapApplication } from '@angular/platform-browser';
import { provideHttpClient } from '@angular/common/http';
import { bootstrapApplication } from '@angular/platform-browser';
import { provideAnimations } from '@angular/platform-browser/animations';
import { provideRouter } from '@angular/router';
import { routes } from './app/routes';
import { AppComponent } from './app/app.component';

bootstrapApplication(AppComponent, {
providers: [provideRouter(routes), provideHttpClient(), provideAnimations(), { provide: APP_BASE_HREF, useValue: '/' }]
}).catch((err) => console.error(err));
}).catch((err) => console.error(err));
9 changes: 4 additions & 5 deletions packages/angular-sdk-components/src/polyfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* Learn more in https://angular.io/guide/browser-support
*/

/***************************************************************************************************
/** *************************************************************************************************
* BROWSER POLYFILLS
*/

Expand Down Expand Up @@ -42,12 +42,11 @@
*
*/

/***************************************************************************************************
/** *************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js'; // Included with Angular CLI.
import 'zone.js'; // Included with Angular CLI.


/***************************************************************************************************
/** *************************************************************************************************
* APPLICATION IMPORTS
*/
9 changes: 3 additions & 6 deletions packages/angular-sdk-components/tests/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@ const login = async (username, password, page) => {
await page.locator('#submit_row .loginButton').click();
};

const getAttributes = async element => {
const attributes = await element.evaluate(async ele => ele.getAttributeNames());
const getAttributes = async (element) => {
const attributes = await element.evaluate(async (ele) => ele.getAttributeNames());
return attributes;
};

const getFormattedDate = (date) => {
if (!date) {
return date;
}
const formattedDate = `${(date.getMonth() + 1).toString().padStart(2, '0')}/${date
.getDate()
.toString()
.padStart(2, '0')}/${date.getFullYear()}`;
const formattedDate = `${(date.getMonth() + 1).toString().padStart(2, '0')}/${date.getDate().toString().padStart(2, '0')}/${date.getFullYear()}`;
return formattedDate;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ test.describe('E2E test', () => {

/** Field sub category tests */

let selectedSubCategory = await page.locator('mat-select[data-test-id="c2adefb64c594c6b634b3be9a40f6c83"]');
const selectedSubCategory = await page.locator('mat-select[data-test-id="c2adefb64c594c6b634b3be9a40f6c83"]');
await selectedSubCategory.click();
await page.locator('mat-option > span:has-text("Field")').click();

/** Dropdown-Local field type tests */
let selectedTestName = page.locator('mat-select[data-test-id="3e9562266329f358c8fad0ce1094def9"]');
const selectedTestName = page.locator('mat-select[data-test-id="3e9562266329f358c8fad0ce1094def9"]');
await selectedTestName.click();
await page.locator('mat-option > span:has-text("Dropdown-Local")').click();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test.describe('E2E test', () => {
await expect(worklist).toBeVisible();

/** Click on the Create Case button */
let createCase = page.locator('mat-list-item[id="create-case-button"]');
const createCase = page.locator('mat-list-item[id="create-case-button"]');
await createCase.click();

/** Creating a Complex Fields case-type */
Expand Down
Loading

0 comments on commit ba9f050

Please sign in to comment.