Skip to content

Commit

Permalink
Modernize Bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
sholtkamp committed Dec 16, 2024
1 parent e70cfc2 commit 9c1105b
Show file tree
Hide file tree
Showing 13 changed files with 169 additions and 125 deletions.
43 changes: 0 additions & 43 deletions src/main/js/bundles/dn_imprintprivacy/ToolHandler.js

This file was deleted.

50 changes: 50 additions & 0 deletions src/main/js/bundles/dn_imprintprivacy/ToolHandler.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
///
/// Copyright (C) 2024 con terra GmbH ([email protected])
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///

import type { InjectedReference } from "apprt-core/InjectedReference";
import type { UrlConfigObject } from "./api";

import Locale from "ct/Locale";

export class ToolHandler {
private _toolsetManager: InjectedReference<any>;
private _properties: InjectedReference<Record<string, any>>;

public activate(): void {
const toolsetManager = this._toolsetManager;
const toolset = this._properties!.toolsetDefinition;
toolsetManager.addToolsetDefinition(toolset);
}

public openImprint(): void {
const locale = Locale.getCurrent().getLanguage();
const imprintUrls = this._properties!.imprintUrls;
const imprintUrl = imprintUrls.find((url: UrlConfigObject) => url.locale === locale).url;
if (!imprintUrl) { return; }

window.open(imprintUrl, '_blank');
}

public openPrivacyStatements(): void {
const locale = Locale.getCurrent().getLanguage();
const privacyUrls = this._properties!.privacyUrls;
const privacyUrl = privacyUrls.find((url: UrlConfigObject) => url.locale === locale).url;
if (!privacyUrl) { return; }

window.open(privacyUrl, '_blank');
}

}
20 changes: 20 additions & 0 deletions src/main/js/bundles/dn_imprintprivacy/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
///
/// Copyright (C) 2024 con terra GmbH ([email protected])
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///

export interface UrlConfigObject {
locale: string;
url: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@
* limitations under the License.
*/
module.exports = {
bundleName: "Imprint Privacy",
bundleDescription: "Dieses Bundle f\u00fcgt zwei Buttons zur App hinzu, die auf das Impressum und die Datenschutzerkl\u00e4rung verweisen.",
imprint: "Impressum",
privacyStatements: "Datenschutzerkl\u00e4rung"
// normally the type should be "bundle"
type: "bundle",
// list all files, which should stay after the build
// In this case only the "module.js" is the remaining artifact, all other files will be integrated into this file.
entryPoints: ["./module"]
};


16 changes: 0 additions & 16 deletions src/main/js/bundles/dn_imprintprivacy/main.js

This file was deleted.

9 changes: 6 additions & 3 deletions src/main/js/bundles/dn_imprintprivacy/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
"description": "${bundleDescription}",
"vendor": "con terra GmbH",
"keywords": [
"sample"
"imprint",
"privacy"
],
"icon": {},
"license": {},
"main": "",
"productName": "devnet-mapapps-imprint-privacy",
"dependencies": {
"ct": "^4.10.0"
},
"CSS-Themes-Extension": [
{
"name": "*",
Expand Down
17 changes: 0 additions & 17 deletions src/main/js/bundles/dn_imprintprivacy/module.js

This file was deleted.

17 changes: 17 additions & 0 deletions src/main/js/bundles/dn_imprintprivacy/module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
///
/// Copyright (C) 2024 con terra GmbH ([email protected])
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///

export { ToolHandler } from "./ToolHandler";
25 changes: 0 additions & 25 deletions src/main/js/bundles/dn_imprintprivacy/nls/bundle.js

This file was deleted.

28 changes: 28 additions & 0 deletions src/main/js/bundles/dn_imprintprivacy/nls/bundle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
///
/// Copyright (C) 2024 con terra GmbH ([email protected])
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///

const i18n = {
root: {
bundleName: "Imprint Privacy",
bundleDescription: "This bundle adds two buttons to the app, which refer to the imprint and the privacy statements.",
imprint: "Imprint",
privacyStatements: "Privacy Statements"
},
"de": true
};

export type Messages = (typeof i18n)["root"];
export default i18n;
26 changes: 26 additions & 0 deletions src/main/js/bundles/dn_imprintprivacy/nls/de/bundle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
///
/// Copyright (C) 2024 con terra GmbH ([email protected])
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///

import { type Messages } from "../bundle";

const i18n = {
bundleName: "Imprint Privacy",
bundleDescription: "Dieses Bundle f\u00fcgt zwei Buttons zur App hinzu, die auf das Impressum und die Datenschutzerkl\u00e4rung verweisen.",
imprint: "Impressum",
privacyStatements: "Datenschutzerkl\u00e4rung"
} satisfies Messages;

export default i18n;
15 changes: 0 additions & 15 deletions src/main/js/bundles/dn_imprintprivacy/tests/all.js

This file was deleted.

17 changes: 17 additions & 0 deletions src/main/js/bundles/dn_imprintprivacy/tests/all.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
///
/// Copyright (C) 2024 con terra GmbH ([email protected])
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///

///

0 comments on commit 9c1105b

Please sign in to comment.