From b6da099bb0f683b57ca049b8b65cf667f90e06f5 Mon Sep 17 00:00:00 2001 From: markuczy Date: Tue, 25 Jun 2024 09:12:57 +0200 Subject: [PATCH 1/6] feat: props passing to webcomponents --- libs/angular-remote-components/src/index.ts | 1 + .../src/lib/components/slot/slot.component.ts | 6 ++++++ .../src/lib/model/remote-webcomponent.ts | 5 +++++ 3 files changed, 12 insertions(+) create mode 100644 libs/angular-remote-components/src/lib/model/remote-webcomponent.ts diff --git a/libs/angular-remote-components/src/index.ts b/libs/angular-remote-components/src/index.ts index d6f8b139..38fc0f6c 100644 --- a/libs/angular-remote-components/src/index.ts +++ b/libs/angular-remote-components/src/index.ts @@ -1,4 +1,5 @@ export * from './lib/model/remote-component' +export * from './lib/model/remote-webcomponent' export * from './lib/model/remote-component-config.model' export * from './lib/model/injection-tokens' export * from './lib/components/slot/slot.component' diff --git a/libs/angular-remote-components/src/lib/components/slot/slot.component.ts b/libs/angular-remote-components/src/lib/components/slot/slot.component.ts index 509dfd8f..b3dded71 100644 --- a/libs/angular-remote-components/src/lib/components/slot/slot.component.ts +++ b/libs/angular-remote-components/src/lib/components/slot/slot.component.ts @@ -84,6 +84,12 @@ export class SlotComponent implements OnInit, OnDestroy { ) { if (componentInfo.remoteComponent.elementName) { const element = document.createElement(componentInfo.remoteComponent.elementName) + ;(element as any)['ocxRemoteComponentConfig'] = { + appId: componentInfo.remoteComponent.appId, + productName: componentInfo.remoteComponent.productName, + baseUrl: componentInfo.remoteComponent.baseUrl, + permissions: permissions, + } viewContainer?.element.nativeElement.appendChild(element) } } diff --git a/libs/angular-remote-components/src/lib/model/remote-webcomponent.ts b/libs/angular-remote-components/src/lib/model/remote-webcomponent.ts new file mode 100644 index 00000000..77c37938 --- /dev/null +++ b/libs/angular-remote-components/src/lib/model/remote-webcomponent.ts @@ -0,0 +1,5 @@ +import { RemoteComponentConfig } from './remote-component-config.model' + +export interface ocxRemoteWebcomponent { + ocxRemoteComponentConfig: RemoteComponentConfig +} From 4bab9ce120d69ae2bc61154971c99a12b15a0126 Mon Sep 17 00:00:00 2001 From: markuczy Date: Tue, 25 Jun 2024 12:52:40 +0200 Subject: [PATCH 2/6] feat: angular-webcomponents init --- libs/angular-webcomponents/.eslintrc.json | 33 +++++++++++++++++++ libs/angular-webcomponents/README.md | 7 ++++ libs/angular-webcomponents/jest.config.ts | 22 +++++++++++++ libs/angular-webcomponents/project.json | 31 +++++++++++++++++ libs/angular-webcomponents/src/index.ts | 1 + .../src/lib/angular-webcomponents.module.ts | 7 ++++ libs/angular-webcomponents/src/test-setup.ts | 8 +++++ libs/angular-webcomponents/tsconfig.json | 29 ++++++++++++++++ libs/angular-webcomponents/tsconfig.lib.json | 12 +++++++ libs/angular-webcomponents/tsconfig.spec.json | 11 +++++++ tsconfig.base.json | 1 + 11 files changed, 162 insertions(+) create mode 100644 libs/angular-webcomponents/.eslintrc.json create mode 100644 libs/angular-webcomponents/README.md create mode 100644 libs/angular-webcomponents/jest.config.ts create mode 100644 libs/angular-webcomponents/project.json create mode 100644 libs/angular-webcomponents/src/index.ts create mode 100644 libs/angular-webcomponents/src/lib/angular-webcomponents.module.ts create mode 100644 libs/angular-webcomponents/src/test-setup.ts create mode 100644 libs/angular-webcomponents/tsconfig.json create mode 100644 libs/angular-webcomponents/tsconfig.lib.json create mode 100644 libs/angular-webcomponents/tsconfig.spec.json diff --git a/libs/angular-webcomponents/.eslintrc.json b/libs/angular-webcomponents/.eslintrc.json new file mode 100644 index 00000000..cf0f0d68 --- /dev/null +++ b/libs/angular-webcomponents/.eslintrc.json @@ -0,0 +1,33 @@ +{ + "extends": ["../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts"], + "extends": ["plugin:@nx/angular", "plugin:@angular-eslint/template/process-inline-templates"], + "rules": { + "@angular-eslint/directive-selector": [ + "error", + { + "type": "attribute", + "prefix": "onecx", + "style": "camelCase" + } + ], + "@angular-eslint/component-selector": [ + "error", + { + "type": "element", + "prefix": "onecx", + "style": "kebab-case" + } + ] + } + }, + { + "files": ["*.html"], + "extends": ["plugin:@nx/angular-template"], + "rules": {} + } + ] +} diff --git a/libs/angular-webcomponents/README.md b/libs/angular-webcomponents/README.md new file mode 100644 index 00000000..dfe97f9b --- /dev/null +++ b/libs/angular-webcomponents/README.md @@ -0,0 +1,7 @@ +# angular-webcomponents + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test angular-webcomponents` to execute the unit tests. diff --git a/libs/angular-webcomponents/jest.config.ts b/libs/angular-webcomponents/jest.config.ts new file mode 100644 index 00000000..95bf190d --- /dev/null +++ b/libs/angular-webcomponents/jest.config.ts @@ -0,0 +1,22 @@ +/* eslint-disable */ +export default { + displayName: 'angular-webcomponents', + preset: '../../jest.preset.js', + setupFilesAfterEnv: ['/src/test-setup.ts'], + coverageDirectory: '../../coverage/libs/angular-webcomponents', + transform: { + '^.+\\.(ts|mjs|js|html)$': [ + 'jest-preset-angular', + { + tsconfig: '/tsconfig.spec.json', + stringifyContentPathRegex: '\\.(html|svg)$', + }, + ], + }, + transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'], + snapshotSerializers: [ + 'jest-preset-angular/build/serializers/no-ng-attributes', + 'jest-preset-angular/build/serializers/ng-snapshot', + 'jest-preset-angular/build/serializers/html-comment', + ], +} diff --git a/libs/angular-webcomponents/project.json b/libs/angular-webcomponents/project.json new file mode 100644 index 00000000..69d8e30d --- /dev/null +++ b/libs/angular-webcomponents/project.json @@ -0,0 +1,31 @@ +{ + "name": "angular-webcomponents", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/angular-webcomponents/src", + "prefix": "onecx", + "tags": [], + "projectType": "library", + "targets": { + "test": { + "executor": "@nx/jest:jest", + "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], + "options": { + "jestConfig": "libs/angular-webcomponents/jest.config.ts", + "passWithNoTests": true + }, + "configurations": { + "ci": { + "ci": true, + "codeCoverage": true + } + } + }, + "lint": { + "executor": "@nx/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["libs/angular-webcomponents/**/*.ts", "libs/angular-webcomponents/**/*.html"] + } + } + } +} diff --git a/libs/angular-webcomponents/src/index.ts b/libs/angular-webcomponents/src/index.ts new file mode 100644 index 00000000..c04affd1 --- /dev/null +++ b/libs/angular-webcomponents/src/index.ts @@ -0,0 +1 @@ +export * from './lib/angular-webcomponents.module' diff --git a/libs/angular-webcomponents/src/lib/angular-webcomponents.module.ts b/libs/angular-webcomponents/src/lib/angular-webcomponents.module.ts new file mode 100644 index 00000000..b22d1d3f --- /dev/null +++ b/libs/angular-webcomponents/src/lib/angular-webcomponents.module.ts @@ -0,0 +1,7 @@ +import { NgModule } from '@angular/core' +import { CommonModule } from '@angular/common' + +@NgModule({ + imports: [CommonModule], +}) +export class AngularWebcomponentsModule {} diff --git a/libs/angular-webcomponents/src/test-setup.ts b/libs/angular-webcomponents/src/test-setup.ts new file mode 100644 index 00000000..a5e675ac --- /dev/null +++ b/libs/angular-webcomponents/src/test-setup.ts @@ -0,0 +1,8 @@ +// @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment +globalThis.ngJest = { + testEnvironmentOptions: { + errorOnUnknownElements: true, + errorOnUnknownProperties: true, + }, +} +import 'jest-preset-angular/setup-jest' diff --git a/libs/angular-webcomponents/tsconfig.json b/libs/angular-webcomponents/tsconfig.json new file mode 100644 index 00000000..92049739 --- /dev/null +++ b/libs/angular-webcomponents/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compilerOptions": { + "target": "es2022", + "useDefineForClassFields": false, + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ], + "extends": "../../tsconfig.base.json", + "angularCompilerOptions": { + "enableI18nLegacyMessageIdFormat": false, + "strictInjectionParameters": true, + "strictInputAccessModifiers": true, + "strictTemplates": true + } +} diff --git a/libs/angular-webcomponents/tsconfig.lib.json b/libs/angular-webcomponents/tsconfig.lib.json new file mode 100644 index 00000000..4cab05d4 --- /dev/null +++ b/libs/angular-webcomponents/tsconfig.lib.json @@ -0,0 +1,12 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "declaration": true, + "declarationMap": true, + "inlineSources": true, + "types": [] + }, + "exclude": ["src/**/*.spec.ts", "src/test-setup.ts", "jest.config.ts", "src/**/*.test.ts"], + "include": ["src/**/*.ts"] +} diff --git a/libs/angular-webcomponents/tsconfig.spec.json b/libs/angular-webcomponents/tsconfig.spec.json new file mode 100644 index 00000000..7870b7c0 --- /dev/null +++ b/libs/angular-webcomponents/tsconfig.spec.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "target": "es2016", + "types": ["jest", "node"] + }, + "files": ["src/test-setup.ts"], + "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] +} diff --git a/tsconfig.base.json b/tsconfig.base.json index 17be2d0c..eec484a8 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -24,6 +24,7 @@ "@onecx/angular-remote-components": ["libs/angular-remote-components/src/index.ts"], "@onecx/angular-standalone-shell": ["libs/angular-standalone-shell/src/index.ts"], "@onecx/angular-testing": ["libs/angular-testing/src/index.ts"], + "@onecx/angular-webcomponents": ["libs/angular-webcomponents/src/index.ts"], "@onecx/integration-interface": ["libs/integration-interface/src/index.ts"], "@onecx/keycloak-auth": ["libs/keycloak-auth/src/index.ts"], "@onecx/portal-integration-angular": ["libs/portal-integration-angular/src/index.ts"], From 1e9c237ff58e72e6fc6d3092eba1f46fa71c9984 Mon Sep 17 00:00:00 2001 From: markuczy Date: Tue, 25 Jun 2024 14:18:51 +0200 Subject: [PATCH 3/6] feat: angular-webcomponents prepared --- libs/angular-remote-components/src/index.ts | 1 - .../src/lib/model/remote-webcomponent.ts | 5 ---- libs/angular-webcomponents/.eslintrc.json | 19 ++++++++++++--- libs/angular-webcomponents/ng-package.json | 7 ++++++ libs/angular-webcomponents/package.json | 10 ++++++++ libs/angular-webcomponents/project.json | 24 +++++++++++++++++++ libs/angular-webcomponents/src/index.ts | 2 +- .../src/lib/angular-webcomponents.module.ts | 7 ------ .../model/remote-webcomponent-config.model.ts | 6 +++++ .../src/lib/model/remote-webcomponent.ts | 5 ++++ libs/angular-webcomponents/tsconfig.json | 8 ++++--- libs/angular-webcomponents/tsconfig.lib.json | 8 ++++--- .../tsconfig.lib.prod.json | 13 ++++++++++ libs/angular-webcomponents/tsconfig.spec.json | 2 +- 14 files changed, 93 insertions(+), 24 deletions(-) delete mode 100644 libs/angular-remote-components/src/lib/model/remote-webcomponent.ts create mode 100644 libs/angular-webcomponents/ng-package.json create mode 100644 libs/angular-webcomponents/package.json delete mode 100644 libs/angular-webcomponents/src/lib/angular-webcomponents.module.ts create mode 100644 libs/angular-webcomponents/src/lib/model/remote-webcomponent-config.model.ts create mode 100644 libs/angular-webcomponents/src/lib/model/remote-webcomponent.ts create mode 100644 libs/angular-webcomponents/tsconfig.lib.prod.json diff --git a/libs/angular-remote-components/src/index.ts b/libs/angular-remote-components/src/index.ts index 38fc0f6c..d6f8b139 100644 --- a/libs/angular-remote-components/src/index.ts +++ b/libs/angular-remote-components/src/index.ts @@ -1,5 +1,4 @@ export * from './lib/model/remote-component' -export * from './lib/model/remote-webcomponent' export * from './lib/model/remote-component-config.model' export * from './lib/model/injection-tokens' export * from './lib/components/slot/slot.component' diff --git a/libs/angular-remote-components/src/lib/model/remote-webcomponent.ts b/libs/angular-remote-components/src/lib/model/remote-webcomponent.ts deleted file mode 100644 index 77c37938..00000000 --- a/libs/angular-remote-components/src/lib/model/remote-webcomponent.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { RemoteComponentConfig } from './remote-component-config.model' - -export interface ocxRemoteWebcomponent { - ocxRemoteComponentConfig: RemoteComponentConfig -} diff --git a/libs/angular-webcomponents/.eslintrc.json b/libs/angular-webcomponents/.eslintrc.json index cf0f0d68..ef759f74 100644 --- a/libs/angular-webcomponents/.eslintrc.json +++ b/libs/angular-webcomponents/.eslintrc.json @@ -10,7 +10,7 @@ "error", { "type": "attribute", - "prefix": "onecx", + "prefix": "ocx", "style": "camelCase" } ], @@ -18,9 +18,15 @@ "error", { "type": "element", - "prefix": "onecx", + "prefix": "ocx", "style": "kebab-case" } + ], + "no-restricted-syntax": [ + "off", + { + "selector": "CallExpression[callee.object.name=\"console\"][callee.property.name=/^(debug|info|time|timeEnd|trace)$/]" + } ] } }, @@ -28,6 +34,13 @@ "files": ["*.html"], "extends": ["plugin:@nx/angular-template"], "rules": {} + }, + { + "files": ["*.json"], + "parser": "jsonc-eslint-parser", + "rules": { + "@nx/dependency-checks": "error" + } } ] -} +} \ No newline at end of file diff --git a/libs/angular-webcomponents/ng-package.json b/libs/angular-webcomponents/ng-package.json new file mode 100644 index 00000000..2613a3ac --- /dev/null +++ b/libs/angular-webcomponents/ng-package.json @@ -0,0 +1,7 @@ +{ + "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", + "dest": "../../dist/libs/angular-webcomponents", + "lib": { + "entryFile": "src/index.ts" + } +} diff --git a/libs/angular-webcomponents/package.json b/libs/angular-webcomponents/package.json new file mode 100644 index 00000000..7d94c298 --- /dev/null +++ b/libs/angular-webcomponents/package.json @@ -0,0 +1,10 @@ +{ + "name": "@onecx/angular-webcomponents", + "version": "4.33.0", + "peerDependencies": { + }, + "dependencies": {}, + "publishConfig": { + "access": "public" + } +} diff --git a/libs/angular-webcomponents/project.json b/libs/angular-webcomponents/project.json index 69d8e30d..dea23065 100644 --- a/libs/angular-webcomponents/project.json +++ b/libs/angular-webcomponents/project.json @@ -6,6 +6,24 @@ "tags": [], "projectType": "library", "targets": { + "build": { + "executor": "@nx/angular:package", + "outputs": [ + "{workspaceRoot}/dist/{projectRoot}" + ], + "options": { + "project": "libs/angular-webcomponents/ng-package.json" + }, + "configurations": { + "production": { + "tsConfig": "libs/angular-webcomponents/tsconfig.lib.prod.json" + }, + "development": { + "tsConfig": "libs/angular-webcomponents/tsconfig.lib.json" + } + }, + "defaultConfiguration": "production" + }, "test": { "executor": "@nx/jest:jest", "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], @@ -26,6 +44,12 @@ "options": { "lintFilePatterns": ["libs/angular-webcomponents/**/*.ts", "libs/angular-webcomponents/**/*.html"] } + }, + "release": { + "executor": "nx-release:build-update-publish", + "options": { + "libName": "angular-webcomponents" + } } } } diff --git a/libs/angular-webcomponents/src/index.ts b/libs/angular-webcomponents/src/index.ts index c04affd1..70a66cd7 100644 --- a/libs/angular-webcomponents/src/index.ts +++ b/libs/angular-webcomponents/src/index.ts @@ -1 +1 @@ -export * from './lib/angular-webcomponents.module' +export * from './lib/model/remote-webcomponent' diff --git a/libs/angular-webcomponents/src/lib/angular-webcomponents.module.ts b/libs/angular-webcomponents/src/lib/angular-webcomponents.module.ts deleted file mode 100644 index b22d1d3f..00000000 --- a/libs/angular-webcomponents/src/lib/angular-webcomponents.module.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { NgModule } from '@angular/core' -import { CommonModule } from '@angular/common' - -@NgModule({ - imports: [CommonModule], -}) -export class AngularWebcomponentsModule {} diff --git a/libs/angular-webcomponents/src/lib/model/remote-webcomponent-config.model.ts b/libs/angular-webcomponents/src/lib/model/remote-webcomponent-config.model.ts new file mode 100644 index 00000000..353b7ca2 --- /dev/null +++ b/libs/angular-webcomponents/src/lib/model/remote-webcomponent-config.model.ts @@ -0,0 +1,6 @@ +export type RemoteWebcomponentConfig = { + appId: string + productName: string + permissions: string[] + baseUrl: string +} diff --git a/libs/angular-webcomponents/src/lib/model/remote-webcomponent.ts b/libs/angular-webcomponents/src/lib/model/remote-webcomponent.ts new file mode 100644 index 00000000..063628c1 --- /dev/null +++ b/libs/angular-webcomponents/src/lib/model/remote-webcomponent.ts @@ -0,0 +1,5 @@ +import { RemoteWebcomponentConfig } from './remote-webcomponent-config.model' + +export interface ocxRemoteWebcomponent { + ocxRemoteComponentConfig: RemoteWebcomponentConfig +} diff --git a/libs/angular-webcomponents/tsconfig.json b/libs/angular-webcomponents/tsconfig.json index 92049739..cd40c79f 100644 --- a/libs/angular-webcomponents/tsconfig.json +++ b/libs/angular-webcomponents/tsconfig.json @@ -1,13 +1,13 @@ { "compilerOptions": { "target": "es2022", - "useDefineForClassFields": false, "forceConsistentCasingInFileNames": true, "strict": true, "noImplicitOverride": true, "noPropertyAccessFromIndexSignature": true, "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true + "noFallthroughCasesInSwitch": true, + "esModuleInterop": true }, "files": [], "include": [], @@ -15,13 +15,15 @@ { "path": "./tsconfig.lib.json" }, + { + "path": "./tsconfig.lib.prod.json" + }, { "path": "./tsconfig.spec.json" } ], "extends": "../../tsconfig.base.json", "angularCompilerOptions": { - "enableI18nLegacyMessageIdFormat": false, "strictInjectionParameters": true, "strictInputAccessModifiers": true, "strictTemplates": true diff --git a/libs/angular-webcomponents/tsconfig.lib.json b/libs/angular-webcomponents/tsconfig.lib.json index 4cab05d4..b9561ca9 100644 --- a/libs/angular-webcomponents/tsconfig.lib.json +++ b/libs/angular-webcomponents/tsconfig.lib.json @@ -5,8 +5,10 @@ "declaration": true, "declarationMap": true, "inlineSources": true, - "types": [] + "types": [], + "target": "es2022", + "useDefineForClassFields": false }, - "exclude": ["src/**/*.spec.ts", "src/test-setup.ts", "jest.config.ts", "src/**/*.test.ts"], - "include": ["src/**/*.ts"] + "exclude": ["**/*.spec.ts", "src/test-setup.ts", "jest.config.ts", "**/*.test.ts", "**/*.stories.ts", "jest.config.ts"], + "include": ["**/*.ts"] } diff --git a/libs/angular-webcomponents/tsconfig.lib.prod.json b/libs/angular-webcomponents/tsconfig.lib.prod.json new file mode 100644 index 00000000..3a838333 --- /dev/null +++ b/libs/angular-webcomponents/tsconfig.lib.prod.json @@ -0,0 +1,13 @@ +{ + "extends": "./tsconfig.lib.json", + "compilerOptions": { + "declarationMap": false, + "target": "es2022", + "useDefineForClassFields": false + }, + "angularCompilerOptions": { + "compilationMode": "partial" + }, + "exclude": ["jest.config.ts"] + } + \ No newline at end of file diff --git a/libs/angular-webcomponents/tsconfig.spec.json b/libs/angular-webcomponents/tsconfig.spec.json index 7870b7c0..4251c922 100644 --- a/libs/angular-webcomponents/tsconfig.spec.json +++ b/libs/angular-webcomponents/tsconfig.spec.json @@ -7,5 +7,5 @@ "types": ["jest", "node"] }, "files": ["src/test-setup.ts"], - "include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"] + "include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] } From 547fd127a1cdbdc73579ad4e7f7e4daccf6a4a95 Mon Sep 17 00:00:00 2001 From: markuczy Date: Wed, 26 Jun 2024 11:31:07 +0200 Subject: [PATCH 4/6] refactor: moved remote-webcomponent interface to angular-remote-components --- libs/angular-remote-components/src/index.ts | 1 + .../src/lib/model/remote-webcomponent.ts | 5 +++++ libs/angular-webcomponents/src/index.ts | 2 +- .../src/lib/model/remote-webcomponent-config.model.ts | 6 ------ .../src/lib/model/remote-webcomponent.ts | 5 ----- .../src/lib/utils/webcomponent-router-initializer.utils.ts | 1 + 6 files changed, 8 insertions(+), 12 deletions(-) create mode 100644 libs/angular-remote-components/src/lib/model/remote-webcomponent.ts delete mode 100644 libs/angular-webcomponents/src/lib/model/remote-webcomponent-config.model.ts delete mode 100644 libs/angular-webcomponents/src/lib/model/remote-webcomponent.ts create mode 100644 libs/angular-webcomponents/src/lib/utils/webcomponent-router-initializer.utils.ts diff --git a/libs/angular-remote-components/src/index.ts b/libs/angular-remote-components/src/index.ts index d6f8b139..38fc0f6c 100644 --- a/libs/angular-remote-components/src/index.ts +++ b/libs/angular-remote-components/src/index.ts @@ -1,4 +1,5 @@ export * from './lib/model/remote-component' +export * from './lib/model/remote-webcomponent' export * from './lib/model/remote-component-config.model' export * from './lib/model/injection-tokens' export * from './lib/components/slot/slot.component' diff --git a/libs/angular-remote-components/src/lib/model/remote-webcomponent.ts b/libs/angular-remote-components/src/lib/model/remote-webcomponent.ts new file mode 100644 index 00000000..77c37938 --- /dev/null +++ b/libs/angular-remote-components/src/lib/model/remote-webcomponent.ts @@ -0,0 +1,5 @@ +import { RemoteComponentConfig } from './remote-component-config.model' + +export interface ocxRemoteWebcomponent { + ocxRemoteComponentConfig: RemoteComponentConfig +} diff --git a/libs/angular-webcomponents/src/index.ts b/libs/angular-webcomponents/src/index.ts index 70a66cd7..3d17abd9 100644 --- a/libs/angular-webcomponents/src/index.ts +++ b/libs/angular-webcomponents/src/index.ts @@ -1 +1 @@ -export * from './lib/model/remote-webcomponent' +export * from './lib/utils/webcomponent-router-initializer.utils' diff --git a/libs/angular-webcomponents/src/lib/model/remote-webcomponent-config.model.ts b/libs/angular-webcomponents/src/lib/model/remote-webcomponent-config.model.ts deleted file mode 100644 index 353b7ca2..00000000 --- a/libs/angular-webcomponents/src/lib/model/remote-webcomponent-config.model.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type RemoteWebcomponentConfig = { - appId: string - productName: string - permissions: string[] - baseUrl: string -} diff --git a/libs/angular-webcomponents/src/lib/model/remote-webcomponent.ts b/libs/angular-webcomponents/src/lib/model/remote-webcomponent.ts deleted file mode 100644 index 063628c1..00000000 --- a/libs/angular-webcomponents/src/lib/model/remote-webcomponent.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { RemoteWebcomponentConfig } from './remote-webcomponent-config.model' - -export interface ocxRemoteWebcomponent { - ocxRemoteComponentConfig: RemoteWebcomponentConfig -} diff --git a/libs/angular-webcomponents/src/lib/utils/webcomponent-router-initializer.utils.ts b/libs/angular-webcomponents/src/lib/utils/webcomponent-router-initializer.utils.ts new file mode 100644 index 00000000..33e9c0ad --- /dev/null +++ b/libs/angular-webcomponents/src/lib/utils/webcomponent-router-initializer.utils.ts @@ -0,0 +1 @@ +export function initializeRouter() {} From a36f1410e88e9d7033055a4a2f0f78a6b12ecf65 Mon Sep 17 00:00:00 2001 From: markuczy Date: Wed, 26 Jun 2024 11:31:37 +0200 Subject: [PATCH 5/6] feat: type check in remote config passing --- .../src/lib/components/slot/slot.component.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/angular-remote-components/src/lib/components/slot/slot.component.ts b/libs/angular-remote-components/src/lib/components/slot/slot.component.ts index b3dded71..23197587 100644 --- a/libs/angular-remote-components/src/lib/components/slot/slot.component.ts +++ b/libs/angular-remote-components/src/lib/components/slot/slot.component.ts @@ -15,6 +15,7 @@ import { BehaviorSubject, Subscription, Observable, combineLatest } from 'rxjs' import { RemoteComponentInfo, SLOT_SERVICE, SlotComponentConfiguration, SlotService } from '../../services/slot.service' import { ocxRemoteComponent } from '../../model/remote-component' import { Technologies } from '@onecx/integration-interface' +import { RemoteComponentConfig } from '../../model/remote-component-config.model' @Component({ selector: 'ocx-slot[name]', @@ -89,7 +90,7 @@ export class SlotComponent implements OnInit, OnDestroy { productName: componentInfo.remoteComponent.productName, baseUrl: componentInfo.remoteComponent.baseUrl, permissions: permissions, - } + } satisfies RemoteComponentConfig viewContainer?.element.nativeElement.appendChild(element) } } From 488a65cc3a26bc99cbd02ecc6c42b2478c48de54 Mon Sep 17 00:00:00 2001 From: markuczy Date: Wed, 26 Jun 2024 11:37:36 +0200 Subject: [PATCH 6/6] fix: lint fix --- .../src/lib/utils/webcomponent-router-initializer.utils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/angular-webcomponents/src/lib/utils/webcomponent-router-initializer.utils.ts b/libs/angular-webcomponents/src/lib/utils/webcomponent-router-initializer.utils.ts index 33e9c0ad..0410e3ed 100644 --- a/libs/angular-webcomponents/src/lib/utils/webcomponent-router-initializer.utils.ts +++ b/libs/angular-webcomponents/src/lib/utils/webcomponent-router-initializer.utils.ts @@ -1 +1,3 @@ -export function initializeRouter() {} +export function initializeRouter() { + console.log('tmp') +}