@kompasid/lit-web-components 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/.editorconfig +29 -0
  2. package/.github/workflows/npm-publish.yml +35 -0
  3. package/LICENSE +21 -0
  4. package/README.md +62 -0
  5. package/assets/font-awesome.ts +21 -0
  6. package/components.d.ts +4 -0
  7. package/demo/index.html +137 -0
  8. package/dist/assets/font-awesome.d.ts +2 -0
  9. package/dist/assets/font-awesome.js +20 -0
  10. package/dist/assets/font-awesome.js.map +1 -0
  11. package/dist/src/components/kompas-footer/KompasFooter.d.ts +13 -0
  12. package/dist/src/components/kompas-footer/KompasFooter.js +304 -0
  13. package/dist/src/components/kompas-footer/KompasFooter.js.map +1 -0
  14. package/dist/src/components/kompas-footer/types.d.ts +47 -0
  15. package/dist/src/components/kompas-footer/types.js +2 -0
  16. package/dist/src/components/kompas-footer/types.js.map +1 -0
  17. package/dist/src/components/kompas-metered-paywall/KompasMeteredPaywall.d.ts +50 -0
  18. package/dist/src/components/kompas-metered-paywall/KompasMeteredPaywall.js +225 -0
  19. package/dist/src/components/kompas-metered-paywall/KompasMeteredPaywall.js.map +1 -0
  20. package/dist/src/components/kompas-paywall/KompasPaywall.d.ts +73 -0
  21. package/dist/src/components/kompas-paywall/KompasPaywall.js +470 -0
  22. package/dist/src/components/kompas-paywall/KompasPaywall.js.map +1 -0
  23. package/dist/src/components/kompas-paywall/types.d.ts +53 -0
  24. package/dist/src/components/kompas-paywall/types.js +2 -0
  25. package/dist/src/components/kompas-paywall/types.js.map +1 -0
  26. package/dist/src/components/kompas-paywall-banner-registration/KompasPaywallBannerRegistration.d.ts +11 -0
  27. package/dist/src/components/kompas-paywall-banner-registration/KompasPaywallBannerRegistration.js +100 -0
  28. package/dist/src/components/kompas-paywall-banner-registration/KompasPaywallBannerRegistration.js.map +1 -0
  29. package/dist/src/components/kompas-paywall-body/KompasPaywallBody.d.ts +107 -0
  30. package/dist/src/components/kompas-paywall-body/KompasPaywallBody.js +843 -0
  31. package/dist/src/components/kompas-paywall-body/KompasPaywallBody.js.map +1 -0
  32. package/dist/src/components/kompas-paywall-information-header/KompasPaywallInformationHeader.d.ts +8 -0
  33. package/dist/src/components/kompas-paywall-information-header/KompasPaywallInformationHeader.js +39 -0
  34. package/dist/src/components/kompas-paywall-information-header/KompasPaywallInformationHeader.js.map +1 -0
  35. package/dist/src/components/kompas-paywall-video/KompasPaywallVideo.d.ts +53 -0
  36. package/dist/src/components/kompas-paywall-video/KompasPaywallVideo.js +245 -0
  37. package/dist/src/components/kompas-paywall-video/KompasPaywallVideo.js.map +1 -0
  38. package/dist/src/index.d.ts +10 -0
  39. package/dist/src/index.js +5 -0
  40. package/dist/src/index.js.map +1 -0
  41. package/dist/src/utils/deviceType.d.ts +2 -0
  42. package/dist/src/utils/deviceType.js +11 -0
  43. package/dist/src/utils/deviceType.js.map +1 -0
  44. package/dist/src/utils/fontawesome-setup.d.ts +1 -0
  45. package/dist/src/utils/fontawesome-setup.js +25 -0
  46. package/dist/src/utils/fontawesome-setup.js.map +1 -0
  47. package/dist/tailwind/tailwind.d.ts +1 -0
  48. package/dist/tailwind/tailwind.js +1654 -0
  49. package/dist/tailwind/tailwind.js.map +1 -0
  50. package/dist/tsconfig.tsbuildinfo +1 -0
  51. package/package.json +94 -0
  52. package/src/components/kompas-footer/KompasFooter.ts +331 -0
  53. package/src/components/kompas-footer/types.ts +54 -0
  54. package/src/components/kompas-metered-paywall/KompasMeteredPaywall.ts +174 -0
  55. package/src/components/kompas-metered-paywall/readme.md +32 -0
  56. package/src/components/kompas-paywall/KompasPaywall.ts +398 -0
  57. package/src/components/kompas-paywall/readme.md +166 -0
  58. package/src/components/kompas-paywall/types.ts +53 -0
  59. package/src/components/kompas-paywall-banner-registration/KompasPaywallBannerRegistration.ts +92 -0
  60. package/src/components/kompas-paywall-banner-registration/readme.md +31 -0
  61. package/src/components/kompas-paywall-body/KompasPaywallBody.ts +844 -0
  62. package/src/components/kompas-paywall-body/readme.md +54 -0
  63. package/src/components/kompas-paywall-information-header/KompasPaywallInformationHeader.ts +29 -0
  64. package/src/components/kompas-paywall-information-header/readme.md +30 -0
  65. package/src/components/kompas-paywall-video/KompasPaywallVideo.ts +194 -0
  66. package/src/components/kompas-paywall-video/readme.md +46 -0
  67. package/src/index.ts +11 -0
  68. package/src/utils/deviceType.ts +11 -0
  69. package/src/utils/fontawesome-setup.ts +40 -0
  70. package/tailwind/tailwind.css +1635 -0
  71. package/tailwind/tailwind.ts +1654 -0
  72. package/tailwind/tailwindlib.css +3 -0
  73. package/tailwind.config.js +96 -0
  74. package/tsconfig.json +21 -0
  75. package/web-dev-server.config.mjs +27 -0
  76. package/web-test-runner.config.mjs +41 -0
package/.editorconfig ADDED
@@ -0,0 +1,29 @@
1
+ # EditorConfig helps developers define and maintain consistent
2
+ # coding styles between different editors and IDEs
3
+ # editorconfig.org
4
+
5
+ root = true
6
+
7
+
8
+ [*]
9
+
10
+ # Change these settings to your own preference
11
+ indent_style = space
12
+ indent_size = 2
13
+
14
+ # We recommend you to keep these unchanged
15
+ end_of_line = lf
16
+ charset = utf-8
17
+ trim_trailing_whitespace = true
18
+ insert_final_newline = true
19
+
20
+ [*.md]
21
+ trim_trailing_whitespace = false
22
+
23
+ [*.json]
24
+ indent_size = 2
25
+
26
+ [*.{html,js,md}]
27
+ block_comment_start = /**
28
+ block_comment = *
29
+ block_comment_end = */
@@ -0,0 +1,35 @@
1
+ # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
+ # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3
+
4
+ name: Node.js Package
5
+
6
+ on:
7
+ push:
8
+ branches:
9
+ - master
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v3
16
+ - uses: actions/setup-node@v3
17
+ with:
18
+ node-version: 18
19
+ - run: yarn install --frozen-lockfile
20
+
21
+ publish-npm:
22
+ needs: build
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - uses: actions/checkout@v3
26
+ - uses: actions/setup-node@v3
27
+ with:
28
+ node-version: 18
29
+ registry-url: https://registry.npmjs.org/
30
+ scope: '@kompasid'
31
+ - run: yarn install --frozen-lockfile
32
+ - run: tsc && npm run analyze -- --exclude dist
33
+ - run: npm publish --access=public
34
+ env:
35
+ NODE_AUTH_TOKEN: ${{secrets.npm_token}}
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 lit-web-component
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,62 @@
1
+ # \<lit-web-component>
2
+
3
+ This web component follows the [open-wc](https://github.com/open-wc/open-wc) recommendation.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm i lit-web-component
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```html
14
+ <script type="module">
15
+ import 'lit-web-component/lit-web-component.js';
16
+ </script>
17
+
18
+ <lit-web-component></lit-web-component>
19
+ ```
20
+
21
+ ## Linting and formatting
22
+
23
+ To scan the project for linting and formatting errors, run
24
+
25
+ ```bash
26
+ npm run lint
27
+ ```
28
+
29
+ To automatically fix linting and formatting errors, run
30
+
31
+ ```bash
32
+ npm run format
33
+ ```
34
+
35
+ ## Testing with Web Test Runner
36
+
37
+ To execute a single test run:
38
+
39
+ ```bash
40
+ npm run test
41
+ ```
42
+
43
+ To run the tests in interactive watch mode run:
44
+
45
+ ```bash
46
+ npm run test:watch
47
+ ```
48
+
49
+
50
+ ## Tooling configs
51
+
52
+ For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.
53
+
54
+ If you customize the configuration a lot, you can consider moving them to individual files.
55
+
56
+ ## Local Demo with `web-dev-server`
57
+
58
+ ```bash
59
+ npm start
60
+ ```
61
+
62
+ To run a local development server that serves the basic demo located in `demo/index.html`
@@ -0,0 +1,21 @@
1
+ import { html } from 'lit'
2
+
3
+ export const faArrowLeft = html`<svg
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ viewBox="0 0 448 512"
6
+ >
7
+ <!-- Font Awesome Free 5.15.3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) -->
8
+ <path
9
+ d="M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"
10
+ />
11
+ </svg>`
12
+
13
+ export const faCheck = html`<svg
14
+ xmlns="http://www.w3.org/2000/svg"
15
+ viewBox="0 0 512 512"
16
+ >
17
+ <!-- Font Awesome Free 5.15.3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) -->
18
+ <path
19
+ d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"
20
+ />
21
+ </svg>`
@@ -0,0 +1,4 @@
1
+ declare module '*.svg' {
2
+ const content: any
3
+ export default content
4
+ }
@@ -0,0 +1,137 @@
1
+ <!doctype html>
2
+ <html lang="en-GB">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <style>
7
+ body {
8
+ background: #fafafa;
9
+ }
10
+ .video {
11
+ background-color: green;
12
+ position: relative;
13
+ width: 70%;
14
+ height: 400px;
15
+ margin: 20px 0;
16
+ }
17
+ @media screen and (max-width: 600px) {
18
+ .video {
19
+ width: 100%;
20
+ }
21
+ }
22
+ </style>
23
+ <script>
24
+ (function initGTM(w, d, s, l, i) {
25
+ const _w = w;
26
+ _w[l] = _w[l] || [];
27
+ _w[l].push({
28
+ 'gtm.start': new Date().getTime(),
29
+ 'event': 'gtm.js'
30
+ });
31
+
32
+ const f = d.getElementsByTagName(s)[0];
33
+ const j = d.createElement(s);
34
+ const dl = l !== 'dataLayer' ? `&l=${l}` : '';
35
+
36
+ j.async = true;
37
+ j.src = `https://www.googletagmanager.com/gtm.js?id=${i}${dl}`;
38
+ f.parentNode.insertBefore(j, f);
39
+
40
+ })(window, document, 'script', 'dataLayer');
41
+ </script>
42
+ </head>
43
+ <body>
44
+ <div id="demo"></div>
45
+
46
+ <script type="module">
47
+ import { html, render } from 'lit';
48
+ import '../dist/src/components/kompas-footer/KompasFooter.js'
49
+ import '../dist/src/components/kompas-paywall/KompasPaywall.js'
50
+ import '../dist/src/components/kompas-paywall-video/KompasPaywallVideo.js'
51
+ import '../dist/src/components/kompas-metered-paywall/KompasMeteredPaywall.js'
52
+
53
+ const type = 'epaper'
54
+ const theme=""
55
+ const paywallLocation = "Article Detail Page";
56
+ const paywallSubscriptionId = "testId";
57
+ const paywallSubscriptionPrice = 0;
58
+ const paywallPosition = 1;
59
+ const paywallSubscriptionPackage = "test subscription";
60
+ const trackerPageType = "page_type";
61
+ const trackerContentId = "content_id";
62
+ const trackerContentType = "content_type";
63
+ const trackerContentTitle = "content_title";
64
+ const trackerContentCategories = "content_categories";
65
+ const trackerUserType = "user_type";
66
+ const trackerMeteredWallBalance = "metered_wall_balance";
67
+ const subscriptionStatus = "subscription_status";
68
+ const trackerPageDomain = "page_domain";
69
+ const meteredWallType = "metered_wall_type";
70
+ const trackerEpaperEdition = "edition";
71
+ const meteredWallBalance = 0;
72
+ const isLogin = true;
73
+ const isWithHeader = true;
74
+ const textHeader = "this is message for header information";
75
+ const userGuid = "111000";
76
+ const trackerSubscriptionStatus = "register";
77
+ const swgEnable = true;
78
+ const pageDomain = 'kompas.id'
79
+
80
+ render(
81
+ html`
82
+ <kompas-paywall
83
+ .type=${type}
84
+ .theme=${theme}
85
+ .paywall_location=${paywallLocation}
86
+ .paywall_subscription_id=${paywallSubscriptionId}
87
+ .paywall_subscription_price=${paywallSubscriptionPrice}
88
+ .paywall_position=${paywallPosition}
89
+ .tracker_page_type=${trackerPageType}
90
+ .tracker_content_id=${trackerContentId}
91
+ .tracker_content_type=${trackerContentType}
92
+ .tracker_content_title=${trackerContentTitle}
93
+ .tracker_content_categories=${trackerContentCategories}
94
+ .tracker_user_type=${trackerUserType}
95
+ .subscriptionStatus=${subscriptionStatus}
96
+ .tracker_page_domain=${trackerPageDomain}
97
+ .metered_wall_type=${meteredWallType}
98
+ .subscriptionStatus=${subscriptionStatus}
99
+ .tracker_epaper_edition=${trackerEpaperEdition}
100
+ .metered_wall_balance=${meteredWallBalance}
101
+ .isLogin=${isLogin}
102
+ .isWithHeader=${isWithHeader}
103
+ .swgEnable=${swgEnable}
104
+ .textHeader=${textHeader}
105
+ .userGuid=${userGuid}
106
+ .tracker_subscription_status=${trackerSubscriptionStatus}
107
+ >
108
+ </kompas-paywall>
109
+ <div class="video">
110
+ <kompas-paywall-video
111
+ .paywall_location=${paywallLocation}
112
+ .paywall_subscription_package=${paywallSubscriptionPackage}
113
+ .paywall_subscription_id=${paywallSubscriptionId}
114
+ .paywall_subscription_price=${paywallSubscriptionPrice}
115
+ .paywall_position=${paywallPosition}
116
+ .tracker_page_type=${trackerPageType}
117
+ .tracker_content_id=${trackerContentId}
118
+ .tracker_content_type=${trackerContentType}
119
+ .tracker_content_title=${trackerContentTitle}
120
+ .tracker_content_categories=${trackerContentCategories}
121
+ .tracker_user_type=${trackerUserType}
122
+ .tracker_subscription_status=${trackerSubscriptionStatus}
123
+ .page_domain=${pageDomain}
124
+ .metered_wall_type=${meteredWallType}
125
+ .tracker_metered_wall_balance=${trackerMeteredWallBalance}
126
+ >
127
+ </kompas-paywall-video>
128
+ </div>
129
+ <kompas-footer></kompas-footer>
130
+ <kompas-metered-paywall></kompas-metered-paywall>
131
+ `,
132
+ document.querySelector('#demo')
133
+ );
134
+ window.dataLayer = window.dataLayer || [];
135
+ </script>
136
+ </body>
137
+ </html>
@@ -0,0 +1,2 @@
1
+ export declare const faArrowLeft: import("lit-html").TemplateResult<1>;
2
+ export declare const faCheck: import("lit-html").TemplateResult<1>;
@@ -0,0 +1,20 @@
1
+ import { html } from 'lit';
2
+ export const faArrowLeft = html `<svg
3
+ xmlns="http://www.w3.org/2000/svg"
4
+ viewBox="0 0 448 512"
5
+ >
6
+ <!-- Font Awesome Free 5.15.3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) -->
7
+ <path
8
+ d="M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"
9
+ />
10
+ </svg>`;
11
+ export const faCheck = html `<svg
12
+ xmlns="http://www.w3.org/2000/svg"
13
+ viewBox="0 0 512 512"
14
+ >
15
+ <!-- Font Awesome Free 5.15.3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) -->
16
+ <path
17
+ d="M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"
18
+ />
19
+ </svg>`;
20
+ //# sourceMappingURL=font-awesome.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"font-awesome.js","sourceRoot":"","sources":["../../assets/font-awesome.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAE1B,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAA;;;;;;;;OAQxB,CAAA;AAEP,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAA;;;;;;;;OAQpB,CAAA","sourcesContent":["import { html } from 'lit'\n\nexport const faArrowLeft = html`<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 448 512\"\n>\n <!-- Font Awesome Free 5.15.3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) -->\n <path\n d=\"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z\"\n />\n</svg>`\n\nexport const faCheck = html`<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 512 512\"\n>\n <!-- Font Awesome Free 5.15.3 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) -->\n <path\n d=\"M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z\"\n />\n</svg>`\n"]}
@@ -0,0 +1,13 @@
1
+ import { LitElement } from 'lit';
2
+ import { Footer } from './types.js';
3
+ export declare class KompasFooter extends LitElement {
4
+ static styles: import("lit").CSSResult[];
5
+ footer: Footer | null;
6
+ isDark: boolean;
7
+ connectedCallback(): void;
8
+ private addStylesheetToHead;
9
+ private initializeFooter;
10
+ fetchFooter(): Promise<void>;
11
+ getYear(): number;
12
+ render(): import("lit-html").TemplateResult<1>;
13
+ }
@@ -0,0 +1,304 @@
1
+ import { __decorate } from "tslib";
2
+ import { html, css, LitElement } from 'lit';
3
+ import { customElement, property } from 'lit/decorators.js';
4
+ import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
5
+ import { TWStyles } from '../../../tailwind/tailwind.js';
6
+ import { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js';
7
+ let KompasFooter = class KompasFooter extends LitElement {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.footer = null;
11
+ this.isDark = false;
12
+ }
13
+ connectedCallback() {
14
+ super.connectedCallback();
15
+ this.addStylesheetToHead();
16
+ this.initializeFooter();
17
+ }
18
+ addStylesheetToHead() {
19
+ const link = document.createElement('link');
20
+ link.rel = 'stylesheet';
21
+ link.href =
22
+ 'https://fonts.googleapis.com/css2?family=PT+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap';
23
+ document.head.appendChild(link);
24
+ }
25
+ initializeFooter() {
26
+ if (this.footer === undefined || this.footer === null) {
27
+ this.fetchFooter();
28
+ }
29
+ }
30
+ async fetchFooter() {
31
+ const response = await fetch('https://d3w4qaq4xm1ncv.cloudfront.net/assets/json/footer/ApiFooterDefault.json');
32
+ const jsonResponse = await response.json();
33
+ this.footer = jsonResponse;
34
+ }
35
+ getYear() {
36
+ return new Date().getFullYear();
37
+ }
38
+ render() {
39
+ if (this.footer) {
40
+ const { isDark } = this;
41
+ const bgClass = isDark ? 'bg-[#2C2C2C]' : 'bg-transparent';
42
+ const primaryTextColor = isDark ? 'text-[#FFFFFF]' : '';
43
+ const secondaryTextColor = isDark ? 'text-[#FFFFFF]' : 'text-grey-60';
44
+ const itemTextColor = isDark ? 'text-[#FFFFFF]' : 'text-[#00559a]';
45
+ return html `
46
+ <div
47
+ class="border-t border-grey-30 mx-auto w-full md:px-20 px-4 ${bgClass} ${primaryTextColor}"
48
+ >
49
+ <div class="max-w-7xl mx-auto">
50
+ <div class="md:px-0 pb-6 lg:pb-0 mx-auto w-full">
51
+ <div
52
+ class="grid grid-cols-4 lg:grid-cols-12 gap-6 lg:gap-8 lg:justify-between pt-10 pb-8 lg:py-10"
53
+ >
54
+ ${Object.values(this.footer.brands.itemsLeft).map(brand => html `
55
+ <a
56
+ class="col-span-4 lg:col-span-2 flex gap-4 cursor-pointer"
57
+ title="Kompas.id"
58
+ href="${brand.permalink}"
59
+ >
60
+ <img
61
+ src="https://d3w4qaq4xm1ncv.cloudfront.net/assets/img/logos/kompas-logo-footer.svg"
62
+ height="${brand.image.height}"
63
+ width="${brand.image.width}"
64
+ alt="${brand.image.alt}"
65
+ class="w-auto h-10 lg:mx-auto"
66
+ />
67
+ </a>
68
+ `)}
69
+ <div
70
+ class="col-span-4 lg:col-start-10 lg:col-span-3 gap-4 flex lg:justify-end mx-auto w-full"
71
+ >
72
+ <a
73
+ class="cursor-pointer"
74
+ href="${this.footer.brands.itemsRight[0].permalink}"
75
+ target="_blank"
76
+ >
77
+ <img
78
+ src="https://d3w4qaq4xm1ncv.cloudfront.net/halaman-unduh/image/ios-badge.png"
79
+ class="h-10 w-[120px]"
80
+ alt="Logo iOS"
81
+ /></a>
82
+ <a
83
+ class="cursor-pointer"
84
+ href="${this.footer.brands.itemsRight[1].permalink}"
85
+ target="_blank"
86
+ >
87
+ <img
88
+ src="https://d3w4qaq4xm1ncv.cloudfront.net/halaman-unduh/image/google-play-badge.png"
89
+ class="h-10 w-[138px]"
90
+ alt="Logo Android"
91
+ /></a>
92
+ </div>
93
+ </div>
94
+ </div>
95
+ <div class="grid grid-cols-4 lg:grid-cols-12 gap-8 pb-2">
96
+ <div
97
+ class="col-span-4 lg:col-span-3 flex flex-row lg:flex-col gap-8 lg:gap-0"
98
+ >
99
+ ${Object.values(this.footer.address.items).map(address => html ` <div class="lg:pb-6">
100
+ <div
101
+ class="font-bold leading-none pb-3 text-sm ${itemTextColor}"
102
+ >
103
+ ${address.title}
104
+ </div>
105
+ <div class="leading-normal pb-3 text-sm ${secondaryTextColor}">
106
+ ${address.text}
107
+ </div>
108
+ <div class="flex flex-row">
109
+ <div
110
+ class="font-bold leading-none pb-3 pr-2 text-sm ${itemTextColor} hidden lg:block"
111
+ >
112
+ Tlp.
113
+ </div>
114
+ <div
115
+ class="grid lg:gap-x-6 lg:grid-cols-2 md:grid-cols-1 grid-cols-1"
116
+ >
117
+ ${Object.values(address.phones).map(num => html `
118
+ <div
119
+ class="leading-normal pb-2 text-sm ${secondaryTextColor}"
120
+ >
121
+ ${num.number}
122
+ </div>
123
+ `)}
124
+ </div>
125
+ </div>
126
+ </div>`)}
127
+ </div>
128
+ <div class="col-span-4 lg:col-span-5 gap-4">
129
+ <div class="grid grid-cols-2 sm:grid-cols-4 gap-6 shrink-0">
130
+ ${Object.values(this.footer.products.items).map(product => html `
131
+ <div>
132
+ <div
133
+ class="font-bold leading-none pb-4 text-sm ${itemTextColor}"
134
+ >
135
+ ${product.title}
136
+ </div>
137
+ ${Object.values(product.sites).map(prod => html `
138
+ <a
139
+ class="leading-normal text-sm ${secondaryTextColor}"
140
+ href="${prod.permalink}"
141
+ >
142
+ <div class="flex flex-col pb-4 cursor-pointer">
143
+ ${prod.text}
144
+ </div>
145
+ </a>
146
+ `)}
147
+ </div>
148
+ `)}
149
+ </div>
150
+ </div>
151
+ <div class="col-span-2 flex flex-col">
152
+ <div
153
+ class="font-bold leading-none pb-4 text-sm ${itemTextColor}"
154
+ >
155
+ ${this.footer.contacts.title}
156
+ </div>
157
+ ${Object.values(this.footer.contacts.items).map(contact => html ` <div class="flex flex-row pb-4">
158
+ <div
159
+ class="flex items-center mr-3 text-base ${itemTextColor}"
160
+ >
161
+ ${unsafeSVG(getFontAwesomeIcon(contact.icon[0], contact.icon[1]))}
162
+ </div>
163
+ <div class="flex flex-col">
164
+ <div class="pb-1 text-sm w-full ${secondaryTextColor}">
165
+ ${contact.label}
166
+ </div>
167
+ <a
168
+ class="font-bold text-sm w-full cursor-pointer"
169
+ href="${contact.action}"
170
+ >
171
+ <span class="text-gray-500"> ${contact.text} </span>
172
+ </a>
173
+ </div>
174
+ </div>`)}
175
+ </div>
176
+ <div class="col-span-2 flex flex-col">
177
+ <div
178
+ class="font-bold leading-none pb-4 text-sm ${itemTextColor}"
179
+ >
180
+ ${this.footer.sosmed.title}
181
+ </div>
182
+ ${Object.values(this.footer.sosmed.items).map(sosmed => html `
183
+ <a
184
+ class="border border-grey-30 hover-border-blue-20 hover-bg-blue-10 p-2 mb-2 flex flex-row md:self-end rounded w-full cursor-pointer"
185
+ href="${sosmed.url}"
186
+ >
187
+ <div
188
+ class="h-5 flex justify-center items-center rounded text-white w-5 ${sosmed.color}"
189
+ >
190
+ <div class="h-3 text-xs">
191
+ ${unsafeSVG(getFontAwesomeIcon(sosmed.icon[0], sosmed.icon[1], 12, 12))}
192
+ </div>
193
+ </div>
194
+ <div class="leading-normal pl-2 text-sm ${secondaryTextColor}">
195
+ ${sosmed.name}
196
+ </div>
197
+ </a>
198
+ `)}
199
+ </div>
200
+ </div>
201
+ </div>
202
+ </div>
203
+ <div class="flex flex-col pb-32 pt-6 px-4 text-xs bg-black">
204
+ <div class="flex flex-col lg:flex-row max-w-7xl mx-auto w-full">
205
+ <div class="flex flex-wrap mb-2 lg:mb-0 w-full">
206
+ <div
207
+ class="flex flex-col lg:flex-row flex-grow lg:justify-between"
208
+ >
209
+ <div class="flex flex-wrap">
210
+ <div class="flex text-white">
211
+ &copy; ${this.getYear()} PT Kompas Media Nusantara
212
+ <span class="mx-2 text-grey-50">&centerdot;</span>
213
+ </div>
214
+ ${Object.values(this.footer.universal.itemsLeft).map(universal => html ` <a
215
+ class="flex justify-center items-center"
216
+ href="${universal.url}"
217
+ >
218
+ <div class="pb-2 lg:pb-0 text-white cursor-pointer">
219
+ ${universal.name}
220
+ <span class="mx-2 text-grey-50">&centerdot;</span>
221
+ </div>
222
+ </a>`)}
223
+ </div>
224
+ <div class="flex flex-wrap shrink-0">
225
+ ${Object.values(this.footer.universal.itemsRight).map(universal => html `
226
+ <a class="flex cursor-pointer" href="${universal.url}">
227
+ <div class="text-white flex items-center">
228
+ ${universal.name}
229
+ <span class="mx-2 text-grey-50">&centerdot;</span>
230
+ </div>
231
+ </a>
232
+ `)}
233
+ </div>
234
+ </div>
235
+ </div>
236
+ </div>
237
+ </div>
238
+ `;
239
+ }
240
+ return html ``;
241
+ }
242
+ };
243
+ KompasFooter.styles = [
244
+ css `
245
+ :host {
246
+ font-family: 'PT Sans', sans-serif;
247
+ }
248
+
249
+ .bg-instagram {
250
+ background-image: linear-gradient(90deg, #ffc107, #f44336, #9c27b0);
251
+ }
252
+
253
+ .bg-sosmed-facebook {
254
+ background-color: #3d5b9b;
255
+ }
256
+
257
+ .bg-sosmed-twitter {
258
+ background-color: #2daae4;
259
+ }
260
+
261
+ .bg-sosmed-youtube {
262
+ background-color: #f44336;
263
+ }
264
+
265
+ .text-brand-1 {
266
+ color: #00559a;
267
+ }
268
+
269
+ .text-grey-50 {
270
+ color: #666;
271
+ color: rgb(102 102 102/1);
272
+ }
273
+
274
+ .text-grey-60 {
275
+ color: #333;
276
+ color: rgb(51 51 51/1);
277
+ }
278
+
279
+ .border-grey-30 {
280
+ --tw-border-opacity: 1;
281
+ border-color: rgb(221 221 221 / var(--tw-border-opacity));
282
+ }
283
+
284
+ .hover-bg-blue-10:hover {
285
+ background-color: #e1f0ff;
286
+ }
287
+
288
+ .hover-border-blue-20:hover {
289
+ border-color: #93c8fd;
290
+ }
291
+ `,
292
+ TWStyles,
293
+ ];
294
+ __decorate([
295
+ property({ type: Object })
296
+ ], KompasFooter.prototype, "footer", void 0);
297
+ __decorate([
298
+ property({ type: Boolean })
299
+ ], KompasFooter.prototype, "isDark", void 0);
300
+ KompasFooter = __decorate([
301
+ customElement('kompas-footer')
302
+ ], KompasFooter);
303
+ export { KompasFooter };
304
+ //# sourceMappingURL=KompasFooter.js.map