@kompasid/lit-web-components 0.7.0 → 0.7.2

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.
package/demo/index.html CHANGED
@@ -54,6 +54,7 @@
54
54
  import '../dist/src/components/kompasid-freewall/KompasFreewall.js'
55
55
  import '../dist/src/components/kompasid-metered-wall-register/KompasMeteredWallRegister.js'
56
56
  import '../dist/src/components/kompasid-header-account/KompasHeaderAccount.js'
57
+ import '../dist/src/components/kompasid-grace-period/KompasGracePeriod.js'
57
58
 
58
59
  const type = 'reguler'
59
60
  const theme = ''
@@ -250,6 +251,8 @@
250
251
  .tracker_metered_wall_balance=${trackerMeteredWallBalance}
251
252
  .tracker_page_domain=${trackerPageDomain}
252
253
  ></kompasid-metered-wall-register>
254
+
255
+ <!-- <kompasid-grace-period totalGracePeriod="5" subscriptionId="9802032"></kompasid-grace-period> -->
253
256
  `,
254
257
  document.querySelector('#demo')
255
258
  )
@@ -0,0 +1,29 @@
1
+ import { LitElement } from 'lit';
2
+ export declare class KompasGracePeriod extends LitElement {
3
+ static styles: import("lit").CSSResult[];
4
+ /**
5
+ * Props
6
+ */
7
+ /**
8
+ * property totalGracePeriod = how many days are left in grace period
9
+ * property isColumn = changes how the component looks on different screen sizes
10
+ * property isShowButton = shows or hides a subscription button
11
+ * property subscriptionId = used for renewal subs
12
+ */
13
+ totalGracePeriod: number;
14
+ isColumn: boolean;
15
+ isShowButton: boolean;
16
+ subscriptionId: string;
17
+ /**
18
+ * State
19
+ */
20
+ private maxGracePeriod;
21
+ private updateSubscription;
22
+ private getCountdownGracePeriod;
23
+ private redirectToBerlangganan;
24
+ private dataLayeronPerbaruiLanggananButton;
25
+ private dataLayeronGracePeriod;
26
+ private gracePeriodTemplate;
27
+ connectedCallback(): Promise<void>;
28
+ render(): import("lit").TemplateResult<1>;
29
+ }
@@ -0,0 +1,146 @@
1
+ import { __decorate } from "tslib";
2
+ import { LitElement, html, css, nothing } from 'lit';
3
+ import { customElement, property, state } from 'lit/decorators.js';
4
+ import { deviceType } from '../../utils/deviceType.js';
5
+ import { TWStyles } from '../../../tailwind/tailwind.js';
6
+ let KompasGracePeriod = class KompasGracePeriod extends LitElement {
7
+ constructor() {
8
+ super(...arguments);
9
+ /**
10
+ * Props
11
+ */
12
+ /**
13
+ * property totalGracePeriod = how many days are left in grace period
14
+ * property isColumn = changes how the component looks on different screen sizes
15
+ * property isShowButton = shows or hides a subscription button
16
+ * property subscriptionId = used for renewal subs
17
+ */
18
+ this.totalGracePeriod = 0;
19
+ this.isColumn = false;
20
+ this.isShowButton = false;
21
+ this.subscriptionId = '';
22
+ /**
23
+ * State
24
+ */
25
+ this.maxGracePeriod = 7;
26
+ this.updateSubscription = 'https://checkoutv2.kompas.id';
27
+ }
28
+ getCountdownGracePeriod() {
29
+ const { totalGracePeriod } = this;
30
+ const { maxGracePeriod } = this;
31
+ if (totalGracePeriod === 7) {
32
+ return html `
33
+ <p>
34
+ Anda dalam <b class="text-orange-500"> hari terakhir</b> masa tenggang
35
+ langganan. Segera perbarui paket langganan untuk tetap mengakses
36
+ konten premium tanpa batas.
37
+ </p>
38
+ `;
39
+ }
40
+ return html `
41
+ <p>
42
+ Masa tenggang langganan Anda tersisa
43
+ <b class="text-orange-500"
44
+ >${maxGracePeriod - totalGracePeriod + 1} hari lagi</b
45
+ >. Segera perbarui paket langganan untuk tetap mengakses konten premium
46
+ tanpa batas.
47
+ </p>
48
+ `;
49
+ }
50
+ redirectToBerlangganan() {
51
+ this.dataLayeronPerbaruiLanggananButton();
52
+ window.open(`${this.updateSubscription}/kdp?productId=${this.subscriptionId}`);
53
+ }
54
+ dataLayeronPerbaruiLanggananButton() {
55
+ window.dataLayer.push({
56
+ event: 'gracePeriodClick',
57
+ interface: deviceType(),
58
+ dayLeft: this.maxGracePeriod - this.totalGracePeriod,
59
+ urlName: window.location.href,
60
+ });
61
+ }
62
+ dataLayeronGracePeriod() {
63
+ window.dataLayer.push({
64
+ event: 'gracePeriodImpression',
65
+ interface: deviceType(),
66
+ dayLeft: this.maxGracePeriod - this.totalGracePeriod,
67
+ urlName: window.location.href,
68
+ });
69
+ }
70
+ gracePeriodTemplate() {
71
+ return html `
72
+ <div
73
+ class="${this.isColumn
74
+ ? 'rounded-lg'
75
+ : 'md:flex-row lg:px-8'} flex flex-col w-full justify-end py-4 md:space-x-4 px-4 bottom-0 max-w-7xl mx-auto"
76
+ >
77
+ <div class="text-grey-600 text-sm md:text-base self-center text-left">
78
+ ${this.getCountdownGracePeriod()}
79
+ </div>
80
+ ${!this.isShowButton
81
+ ? html `
82
+ <div
83
+ class="flex self-center w-full md:w-1/2 justify-end pt-4 md:pt-0"
84
+ >
85
+ <button
86
+ @click=${this.redirectToBerlangganan}
87
+ class="bg-green-500 p-2 px-5 rounded-md font-bold text-grey-100 text-sm md:text-base w-full md:w-auto"
88
+ >
89
+ Perbarui Langganan
90
+ </button>
91
+ </div>
92
+ `
93
+ : nothing}
94
+ </div>
95
+ `;
96
+ }
97
+ async connectedCallback() {
98
+ super.connectedCallback();
99
+ this.dataLayeronGracePeriod();
100
+ }
101
+ render() {
102
+ return html `
103
+ <div class="sticky bottom-0 w-full h-full bg-orange-100">
104
+ ${this.totalGracePeriod > 0 ? this.gracePeriodTemplate() : nothing}
105
+ </div>
106
+ `;
107
+ }
108
+ };
109
+ KompasGracePeriod.styles = [
110
+ css `
111
+ :host {
112
+ font-family: 'PT Sans', sans-serif;
113
+ }
114
+
115
+ .body {
116
+ position: sticky;
117
+ top: 0;
118
+ height: 100%;
119
+ width: 100%;
120
+ }
121
+ `,
122
+ TWStyles,
123
+ ];
124
+ __decorate([
125
+ property({ type: Number })
126
+ ], KompasGracePeriod.prototype, "totalGracePeriod", void 0);
127
+ __decorate([
128
+ property({ type: Boolean })
129
+ ], KompasGracePeriod.prototype, "isColumn", void 0);
130
+ __decorate([
131
+ property({ type: Boolean })
132
+ ], KompasGracePeriod.prototype, "isShowButton", void 0);
133
+ __decorate([
134
+ property({ type: String })
135
+ ], KompasGracePeriod.prototype, "subscriptionId", void 0);
136
+ __decorate([
137
+ state()
138
+ ], KompasGracePeriod.prototype, "maxGracePeriod", void 0);
139
+ __decorate([
140
+ state()
141
+ ], KompasGracePeriod.prototype, "updateSubscription", void 0);
142
+ KompasGracePeriod = __decorate([
143
+ customElement('kompasid-grace-period')
144
+ ], KompasGracePeriod);
145
+ export { KompasGracePeriod };
146
+ //# sourceMappingURL=KompasGracePeriod.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KompasGracePeriod.js","sourceRoot":"","sources":["../../../../src/components/kompasid-grace-period/KompasGracePeriod.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AAGjD,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,UAAU;IAA1C;;QAiBL;;WAEG;QACH;;;;;WAKG;QAEyB,qBAAgB,GAAG,CAAC,CAAA;QACnB,aAAQ,GAAG,KAAK,CAAA;QAChB,iBAAY,GAAG,KAAK,CAAA;QACrB,mBAAc,GAAG,EAAE,CAAA;QAE/C;;WAEG;QACc,mBAAc,GAAG,CAAC,CAAA;QAClB,uBAAkB,GAAG,8BAA8B,CAAA;IA0FtE,CAAC;IAxFS,uBAAuB;QAC7B,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAAA;QACjC,MAAM,EAAE,cAAc,EAAE,GAAG,IAAI,CAAA;QAC/B,IAAI,gBAAgB,KAAK,CAAC,EAAE;YAC1B,OAAO,IAAI,CAAA;;;;;;OAMV,CAAA;SACF;QACD,OAAO,IAAI,CAAA;;;;aAIF,cAAc,GAAG,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C,CAAC,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC,OAAO;;KAErE,CAAA;IACH,CAAC;;AA5HM,wBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;KAWF;IACD,QAAQ;CACT,CAAA;AAY2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DAAqB;AACnB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDAAiB;AAChB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDAAqB;AACrB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yDAAoB;AAKtC;IAAR,KAAK,EAAE;yDAA2B;AAC1B;IAAR,KAAK,EAAE;6DAA4D;AApCzD,iBAAiB;IAD7B,aAAa,CAAC,uBAAuB,CAAC;GAC1B,iBAAiB,CA8H7B;SA9HY,iBAAiB","sourcesContent":["import { LitElement, html, css, nothing } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { deviceType } from '../../utils/deviceType.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\n\n@customElement('kompasid-grace-period')\nexport class KompasGracePeriod extends LitElement {\n static styles = [\n css`\n :host {\n font-family: 'PT Sans', sans-serif;\n }\n\n .body {\n position: sticky;\n top: 0;\n height: 100%;\n width: 100%;\n }\n `,\n TWStyles,\n ]\n\n /**\n * Props\n */\n /**\n * property totalGracePeriod = how many days are left in grace period\n * property isColumn = changes how the component looks on different screen sizes\n * property isShowButton = shows or hides a subscription button\n * property subscriptionId = used for renewal subs\n */\n\n @property({ type: Number }) totalGracePeriod = 0\n @property({ type: Boolean }) isColumn = false\n @property({ type: Boolean }) isShowButton = false\n @property({ type: String }) subscriptionId = ''\n\n /**\n * State\n */\n @state() private maxGracePeriod = 7\n @state() private updateSubscription = 'https://checkoutv2.kompas.id'\n\n private getCountdownGracePeriod() {\n const { totalGracePeriod } = this\n const { maxGracePeriod } = this\n if (totalGracePeriod === 7) {\n return html`\n <p>\n Anda dalam <b class=\"text-orange-500\"> hari terakhir</b> masa tenggang\n langganan. Segera perbarui paket langganan untuk tetap mengakses\n konten premium tanpa batas.\n </p>\n `\n }\n return html`\n <p>\n Masa tenggang langganan Anda tersisa\n <b class=\"text-orange-500\"\n >${maxGracePeriod - totalGracePeriod + 1} hari lagi</b\n >. Segera perbarui paket langganan untuk tetap mengakses konten premium\n tanpa batas.\n </p>\n `\n }\n\n private redirectToBerlangganan(): void {\n this.dataLayeronPerbaruiLanggananButton()\n window.open(\n `${this.updateSubscription}/kdp?productId=${this.subscriptionId}`\n )\n }\n\n private dataLayeronPerbaruiLanggananButton(): void {\n window.dataLayer.push({\n event: 'gracePeriodClick',\n interface: deviceType(),\n dayLeft: this.maxGracePeriod - this.totalGracePeriod,\n urlName: window.location.href,\n })\n }\n\n private dataLayeronGracePeriod(): void {\n window.dataLayer.push({\n event: 'gracePeriodImpression',\n interface: deviceType(),\n dayLeft: this.maxGracePeriod - this.totalGracePeriod,\n urlName: window.location.href,\n })\n }\n\n private gracePeriodTemplate() {\n return html`\n <div\n class=\"${this.isColumn\n ? 'rounded-lg'\n : 'md:flex-row lg:px-8'} flex flex-col w-full justify-end py-4 md:space-x-4 px-4 bottom-0 max-w-7xl mx-auto\"\n >\n <div class=\"text-grey-600 text-sm md:text-base self-center text-left\">\n ${this.getCountdownGracePeriod()}\n </div>\n ${!this.isShowButton\n ? html`\n <div\n class=\"flex self-center w-full md:w-1/2 justify-end pt-4 md:pt-0\"\n >\n <button\n @click=${this.redirectToBerlangganan}\n class=\"bg-green-500 p-2 px-5 rounded-md font-bold text-grey-100 text-sm md:text-base w-full md:w-auto\"\n >\n Perbarui Langganan\n </button>\n </div>\n `\n : nothing}\n </div>\n `\n }\n\n override async connectedCallback() {\n super.connectedCallback()\n this.dataLayeronGracePeriod()\n }\n\n render() {\n return html`\n <div class=\"sticky bottom-0 w-full h-full bg-orange-100\">\n ${this.totalGracePeriod > 0 ? this.gracePeriodTemplate() : nothing}\n </div>\n `\n }\n}\n"]}
@@ -77,6 +77,10 @@ export declare class KompasMeteredWallRegister extends LitElement {
77
77
  * template button register
78
78
  */
79
79
  private registerButtonTemplate;
80
+ /**
81
+ * mengarahkan ke page checkout promo
82
+ */
83
+ private redirectToCTAUrl;
80
84
  /**
81
85
  * mengarahkan ke page register
82
86
  */
@@ -32,6 +32,8 @@ let KompasMeteredWallRegister = class KompasMeteredWallRegister extends LitEleme
32
32
  description: '',
33
33
  lastArticle: { title: '', description: '' },
34
34
  },
35
+ ctaUrl: '',
36
+ ctaText: '',
35
37
  };
36
38
  /**
37
39
  * Props
@@ -75,6 +77,25 @@ let KompasMeteredWallRegister = class KompasMeteredWallRegister extends LitEleme
75
77
  this.tracker_metered_wall_balance = 0;
76
78
  this.tracker_page_domain = '';
77
79
  this.next_param = 'https://www.kompas.id/baca/opini/2023/12/05/masa-depan-wolbachia-sebagai-alternatif-pengendalian-dbd?open_from=Section_Opini';
80
+ /**
81
+ * mengarahkan ke page checkout promo
82
+ */
83
+ this.redirectToCTAUrl = () => {
84
+ const params = new URLSearchParams(window.location.href);
85
+ const newUrl = new URL(this.textTemplate.ctaUrl);
86
+ const referrer = new URLSearchParams(this.textTemplate.ctaUrl).get('referrer');
87
+ this.pushToDataLayer('mrw_clicked');
88
+ if (!referrer) {
89
+ newUrl.searchParams.append('referrer', params.toString());
90
+ window.location.href = newUrl.toString();
91
+ }
92
+ else {
93
+ const currentReferrerValue = newUrl.searchParams.get('referrer');
94
+ const updatedReferrerValue = `${params.toString()},${currentReferrerValue}`;
95
+ newUrl.searchParams.set('referrer', updatedReferrerValue);
96
+ window.location.href = newUrl.toString();
97
+ }
98
+ };
78
99
  /**
79
100
  * mengarahkan ke page register
80
101
  */
@@ -90,15 +111,22 @@ let KompasMeteredWallRegister = class KompasMeteredWallRegister extends LitEleme
90
111
  * menentukan template yang akan di render
91
112
  */
92
113
  setTemplate(prop, mode = 'default') {
93
- let template = '';
94
- // dynamicMode dibuat agar typescript bisa akses data lastArticle
95
114
  const dynamicMode = this.textTemplate[mode];
96
- if ('lastArticle' in dynamicMode) {
97
- const lastArticleMode = dynamicMode;
98
- template = lastArticleMode.lastArticle[prop] || '';
99
- }
100
- else {
101
- template = dynamicMode[prop] || '';
115
+ let template = '';
116
+ if (typeof dynamicMode === 'object' && dynamicMode !== null) {
117
+ // Check if dynamicMode has a lastArticle object and if the prop exists within it
118
+ if (dynamicMode.lastArticle && prop in dynamicMode.lastArticle) {
119
+ const value = dynamicMode.lastArticle[prop];
120
+ if (typeof value === 'string') {
121
+ template = value;
122
+ }
123
+ }
124
+ else if (prop in dynamicMode) {
125
+ const value = dynamicMode[prop];
126
+ if (typeof value === 'string') {
127
+ template = value;
128
+ }
129
+ }
102
130
  }
103
131
  return template;
104
132
  }
@@ -180,11 +208,12 @@ let KompasMeteredWallRegister = class KompasMeteredWallRegister extends LitEleme
180
208
  ${this.registerButtonTemplate()}
181
209
  </div>
182
210
  </div>
183
- <div class="flex justify-center">
211
+ <div
212
+ class="flex justify-center md:max-w-[200px] md:max-h-[220px] md:my-auto"
213
+ >
184
214
  <img
185
215
  alt="metered-wall-register"
186
216
  src="https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/paywall_ilustrasi3-03_1.png"
187
- class="h-40 w-40 md:w-full md:h-full"
188
217
  />
189
218
  </div>
190
219
  <button
@@ -209,12 +238,21 @@ let KompasMeteredWallRegister = class KompasMeteredWallRegister extends LitEleme
209
238
  */
210
239
  registerButtonTemplate() {
211
240
  return html `
212
- <button
213
- @click=${this.redirectToRegister}
214
- class="bg-green-500 p-1.5 w-full rounded-md font-bold text-grey-100 text-sm md:text-base"
215
- >
216
- Daftar Akun
217
- </button>
241
+ <div>
242
+ ${!this.textTemplate.ctaUrl
243
+ ? html `<button
244
+ @click=${this.redirectToRegister}
245
+ class="bg-green-500 p-1.5 w-full rounded-md font-bold text-grey-100 text-sm md:text-base"
246
+ >
247
+ Daftar Akun
248
+ </button>`
249
+ : html `<button
250
+ @click=${this.redirectToCTAUrl}
251
+ class="bg-green-500 p-1.5 w-full rounded-md font-bold text-grey-100 px-5 text-sm md:text-base md:w-[165px]"
252
+ >
253
+ ${this.textTemplate.ctaText}
254
+ </button>`}
255
+ </div>
218
256
  `;
219
257
  }
220
258
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"KompasMeteredWallRegister.js","sourceRoot":"","sources":["../../../../src/components/kompasid-metered-wall-register/KompasMeteredWallRegister.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AAIjD,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,UAAU;IAAlD;;QAkCL;;WAEG;QACH;;WAEG;QACM,gBAAW,GAClB,8DAA8D,CAAA;QAChE;;WAEG;QACM,iBAAY,GAAY,IAAI,CAAA;QACrC;;WAEG;QACM,mBAAc,GAAY,IAAI,CAAA;QACvC;;WAEG;QACc,iBAAY,GAA2B;YACtD,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;YAClD,MAAM,EAAE;gBACN,KAAK,EAAE,EAAE;gBACT,WAAW,EAAE,EAAE;gBACf,WAAW,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE;aAC5C;SACF,CAAA;QACD;;WAEG;QACH;;;;;;;;;;;;;;;;;;;WAmBG;QAEyB,qBAAgB,GAAG,CAAC,CAAA;QAC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IAAI,EAAE,MAAM,EAAE,CAAC;6EAAgC;AAC/B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oEAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8EAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4EAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+EAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sEAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6DACqG;AAxGrH,yBAAyB;IADrC,aAAa,CAAC,gCAAgC,CAAC;GACnC,yBAAyB,CAoVrC;SApVY,yBAAyB","sourcesContent":["import { html, css, LitElement } from 'lit'\nimport { customElement, state, property } from 'lit/decorators.js'\nimport { unsafeSVG } from 'lit/directives/unsafe-svg.js'\nimport { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { meteredRegisterContent } from './types.js'\n\n@customElement('kompasid-metered-wall-register')\nexport class KompasMeteredWallRegister extends LitElement {\n static styles = [\n css`\n :host {\n font-family: 'PT Sans', sans-serif;\n }\n\n .body {\n position: sticky;\n top: 0;\n height: 100%;\n width: 100%;\n }\n\n .btn-regis {\n margin-left: 16px;\n width: 127px;\n }\n\n .banner-content {\n gap: 55px;\n }\n\n .cont-banner-content {\n justify-content: space-evenly;\n }\n\n .expanded-btn {\n width: 127px;\n }\n `,\n TWStyles,\n ]\n\n /**\n * state\n */\n /**\n * state registerUrl untuk memberikan link kemana user akan dialihkan.\n */\n @state() registerUrl: string =\n 'https://account.kompas.id/register?loc=metered_register_wall'\n /**\n * state isShowBanner untuk memunculkan component.\n */\n @state() isShowBanner: boolean = true\n /**\n * state isExpandBanner untuk menentukan apakah component sedang dalam mode expand.\n */\n @state() isExpandBanner: boolean = true\n /**\n * state textTemplate untuk menyimpan template yang di berikan.\n */\n @state() private textTemplate: meteredRegisterContent = {\n default: { title: '', lastArticle: { title: '' } },\n expand: {\n title: '',\n description: '',\n lastArticle: { title: '', description: '' },\n },\n }\n /**\n * Props\n */\n /**\n * prop countdownArticle untuk menghandle sudah berapa artikel gratis yang user baca.\n * prop defaultExpandBanner untuk menentukan keadaan awal komponen apakah dalam mode expand atau tidak.\n * prop tracker_page_title untuk title of the page\n * prop tracker_page_type untuk type of the page\n * prop tracker_content_type untuk whether it's a free article or paid article (will only be sent if the user views article detail page)\n * prop tracker_content_id untuk the ID for the article (will only be sent if the user views article detail page)\n * prop tracker_content_title untuk the title of the article (will only be sent if the user views article detail page)\n * prop tracker_content_authors untuk name of the authors (will only be sent if the user views article detail page)\n * prop tracker_content_editors untuk name of the editors (will only be sent if the user views article detail page)\n * prop tracker_content_tags untuk tags inside the article (will only be sent if the user views article detail page)\n * prop tracker_content_published_date untuk the published date (will only be sent if the user views article detail page)\n * prop tracker_content_categories untuk The main category the content belongs to\n * prop tracker_user_type untuk type of user based on their subscription\n * prop tracker_subscription_status untuk status of their subscription\n * prop tracker_metered_wall_type untuk the type of Metered Wall\n * prop tracker_metered_wall_balance untuk the balance of their metered wall\n * prop tracker_page_domain untuk Page Domain\n * prop next_param untuk page Domain\n */\n\n @property({ type: Number }) countdownArticle = 0\n @property({ type: Boolean }) defaultExpandBanner = false\n @property({ type: Boolean }) isDesktop = false\n @property({ type: String }) tracker_page_title = ''\n @property({ type: String }) tracker_page_type = ''\n @property({ type: String }) tracker_content_type = ''\n @property({ type: String }) tracker_content_id = ''\n @property({ type: String }) tracker_content_title = ''\n @property({ type: String }) tracker_content_authors = ''\n @property({ type: String }) tracker_content_editors = ''\n @property({ type: String }) tracker_content_tags = ''\n @property({ type: String }) tracker_content_published_date = ''\n @property({ type: String }) tracker_content_categories = ''\n @property({ type: String }) tracker_user_type = ''\n @property({ type: String }) tracker_subscription_status = ''\n @property({ type: String }) tracker_metered_wall_type = ''\n @property({ type: Number }) tracker_metered_wall_balance = 0\n @property({ type: String }) tracker_page_domain = ''\n @property({ type: String }) next_param =\n 'https://www.kompas.id/baca/opini/2023/12/05/masa-depan-wolbachia-sebagai-alternatif-pengendalian-dbd?open_from=Section_Opini'\n\n /**\n * menentukan template yang akan di render\n */\n private setTemplate(\n prop: string,\n mode: keyof meteredRegisterContent = 'default'\n ): string {\n let template = ''\n\n // dynamicMode dibuat agar typescript bisa akses data lastArticle\n const dynamicMode = this.textTemplate[mode]\n\n if ('lastArticle' in dynamicMode) {\n const lastArticleMode = dynamicMode as {\n lastArticle: { [key: string]: string }\n }\n template = lastArticleMode.lastArticle[prop] || ''\n } else {\n template = dynamicMode[prop] || ''\n }\n return template\n }\n\n private checkIsDesktop() {\n if (window.innerWidth >= 960) {\n this.isDesktop = true\n } else {\n this.isDesktop = false\n }\n }\n\n /**\n * Render Statement\n */\n\n private bannerTemplate() {\n return this.isExpandBanner\n ? this.expandedBannerContent()\n : this.defaultBannerContent()\n }\n\n private defaultBannerContent() {\n return html`\n <div>\n <div\n class=\"${this.isDesktop\n ? 'cont-banner-content'\n : 'justify-between'} flex flex-row\"\n >\n <div .hidden=\"${!this.isDesktop}\" class=\"w-9 h-9\"></div>\n <div class=\"banner-content flex flex-row\">\n <div\n class=\"text-base md:text-lg font-lora mb-3 mt-1 pt-[5px] md:mb-0 md:mt-0 pr-14 md:px-0\"\n .innerHTML=${this.setTemplate('title')}\n ></div>\n <div .hidden=\"${!this.isDesktop}\" class=\"md:self-center btn-regis\">\n ${this.isDesktop\n ? html`<div class=\"ml-4\"></div>\n ${this.registerButtonTemplate()}`\n : null}\n </div>\n </div>\n <div>\n <button\n @click=\"${this.triggerExpandBanner}\"\n class=\"h-9 w-9 flex ml-2 items-center justify-center text-blue-500 rounded bg-blue-200\"\n >\n <div\n class=\"icon icon-blue-600 ${this.isExpandBanner\n ? 'chevron-down'\n : 'rotate-180'}\"\n >\n ${unsafeSVG(getFontAwesomeIcon('fas', 'chevron-down'))}\n </div>\n </button>\n </div>\n </div>\n <div class=\"md:self-center mt-4\">\n ${!this.isDesktop ? html`${this.registerButtonTemplate()} ` : null}\n </div>\n </div>\n `\n }\n\n private expandedBannerContent() {\n return html`\n <div\n class=\"flex flex-col-reverse justify-evenly md:flex-row gap-4 md:gap-8\"\n >\n <div\n class=\"flex flex-col justify-evenly md:text-left md:w-5/12 gap-4 md:gap-2\"\n >\n <p\n class=\"text-lg md:text-2xl font-lora\"\n .innerHTML=${this.setTemplate('title', 'expand')}\n ></p>\n <p\n class=\"text-sm md:text-base\"\n .innerHTML=${this.setTemplate('description', 'expand')}\n ></p>\n <div class=\"${this.isDesktop ? 'expanded-btn' : null} md:self-start\">\n ${this.registerButtonTemplate()}\n </div>\n </div>\n <div class=\"flex justify-center\">\n <img\n alt=\"metered-wall-register\"\n src=\"https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/paywall_ilustrasi3-03_1.png\"\n class=\"h-40 w-40 md:w-full md:h-full\"\n />\n </div>\n <button\n @click=\"${this.triggerExpandBanner}\"\n class=\"h-9 w-9 ${this.isDesktop\n ? null\n : 'ml-auto'} flex items-center justify-center text-blue-500 rounded bg-blue-200\"\n >\n <div\n class=\"icon icon-blue-600 ${this.isExpandBanner\n ? 'chevron-down'\n : 'rotate-180'}\"\n >\n ${unsafeSVG(getFontAwesomeIcon('fas', 'chevron-down'))}\n </div>\n </button>\n </div>\n `\n }\n\n /**\n * template button register\n */\n private registerButtonTemplate() {\n return html`\n <button\n @click=${this.redirectToRegister}\n class=\"bg-green-500 p-1.5 w-full rounded-md font-bold text-grey-100 text-sm md:text-base\"\n >\n Daftar Akun\n </button>\n `\n }\n\n /**\n * mengarahkan ke page register\n */\n private redirectToRegister = (): void => {\n this.pushToDataLayer('mrw_clicked')\n const newUrl = new URL(decodeURIComponent(this.registerUrl))\n if (this.next_param)\n newUrl.searchParams.append('next', decodeURIComponent(this.next_param))\n window.location.href = newUrl.toString()\n }\n\n /**\n * mengirim event ke datalayer\n */\n private pushToDataLayer(eventName: string) {\n window.dataLayer.push({\n event: eventName,\n page_title: this.tracker_page_title,\n page_type: this.tracker_page_type,\n content_type: this.tracker_content_type,\n content_id: this.tracker_content_id,\n content_title: this.tracker_content_title,\n content_authors: this.tracker_content_authors,\n content_editors: this.tracker_content_editors,\n content_tags: this.tracker_content_tags,\n content_published_date: this.tracker_content_published_date,\n content_categories: this.tracker_content_categories,\n user_type: this.tracker_user_type || 'G',\n subscription_status: this.tracker_subscription_status || '',\n metered_wall_type: this.tracker_metered_wall_type || 'MRW',\n metered_wall_balance: this.tracker_metered_wall_balance,\n page_domain: this.tracker_page_domain || 'Kompas.id',\n })\n }\n\n /**\n * toggle isExpandBanner flag\n */\n private triggerExpandBanner() {\n this.isExpandBanner = !this.isExpandBanner\n return !this.isExpandBanner && this.pushToDataLayer('mrw_closed')\n }\n\n /**\n * Lifecycle\n */\n\n override async connectedCallback() {\n super.connectedCallback()\n await this.updateComplete\n this.loadData()\n this.checkIsDesktop()\n }\n\n private async loadData() {\n const req = await fetch(\n `https://d3w4qaq4xm1ncv.cloudfront.net/assets/register_wall.json`\n )\n\n if (req.status !== 200) {\n throw new Error(`${req.status} Ada galat saat memproses permintaan.`)\n }\n\n this.textTemplate = await req.json()\n\n const getCountdown = this.countdownArticle\n\n if (!getCountdown) {\n this.isShowBanner = false\n } else {\n this.isExpandBanner = this.defaultExpandBanner\n }\n\n if (this.isShowBanner) {\n this.pushToDataLayer('mrw_viewed')\n }\n }\n\n render() {\n return this.isShowBanner\n ? html`\n <div class=\"sticky bottom-0 w-full h-full z-20\">\n <div class=\"w-full bg-blue-100 px-4 xl:px-0 bottom-0 py-4\">\n <div class=\"lg:max-w-7xl m-auto relative\">\n <div>${this.bannerTemplate()}</div>\n </div>\n </div>\n </div>\n `\n : null\n }\n}\n"]}
1
+ {"version":3,"file":"KompasMeteredWallRegister.js","sourceRo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AM,EAAE,CAAC;oEAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8EAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4EAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+EAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sEAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6DACqG;AAzGrH,yBAAyB;IADrC,aAAa,CAAC,gCAAgC,CAAC;GACnC,yBAAyB,CAiYrC;SAjYY,yBAAyB","sourcesContent":["import { html, css, LitElement } from 'lit'\nimport { customElement, state, property } from 'lit/decorators.js'\nimport { unsafeSVG } from 'lit/directives/unsafe-svg.js'\nimport { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { meteredRegisterContent } from './types.js'\n\n@customElement('kompasid-metered-wall-register')\nexport class KompasMeteredWallRegister extends LitElement {\n static styles = [\n css`\n :host {\n font-family: 'PT Sans', sans-serif;\n }\n\n .body {\n position: sticky;\n top: 0;\n height: 100%;\n width: 100%;\n }\n\n .btn-regis {\n margin-left: 16px;\n width: 127px;\n }\n\n .banner-content {\n gap: 55px;\n }\n\n .cont-banner-content {\n justify-content: space-evenly;\n }\n\n .expanded-btn {\n width: 127px;\n }\n `,\n TWStyles,\n ]\n\n /**\n * state\n */\n /**\n * state registerUrl untuk memberikan link kemana user akan dialihkan.\n */\n @state() registerUrl: string =\n 'https://account.kompas.id/register?loc=metered_register_wall'\n /**\n * state isShowBanner untuk memunculkan component.\n */\n @state() isShowBanner: boolean = true\n /**\n * state isExpandBanner untuk menentukan apakah component sedang dalam mode expand.\n */\n @state() isExpandBanner: boolean = true\n /**\n * state textTemplate untuk menyimpan template yang di berikan.\n */\n @state() private textTemplate: meteredRegisterContent = {\n default: { title: '', lastArticle: { title: '' } },\n expand: {\n title: '',\n description: '',\n lastArticle: { title: '', description: '' },\n },\n ctaUrl: '',\n ctaText: '',\n }\n /**\n * Props\n */\n /**\n * prop countdownArticle untuk menghandle sudah berapa artikel gratis yang user baca.\n * prop defaultExpandBanner untuk menentukan keadaan awal komponen apakah dalam mode expand atau tidak.\n * prop tracker_page_title untuk title of the page\n * prop tracker_page_type untuk type of the page\n * prop tracker_content_type untuk whether it's a free article or paid article (will only be sent if the user views article detail page)\n * prop tracker_content_id untuk the ID for the article (will only be sent if the user views article detail page)\n * prop tracker_content_title untuk the title of the article (will only be sent if the user views article detail page)\n * prop tracker_content_authors untuk name of the authors (will only be sent if the user views article detail page)\n * prop tracker_content_editors untuk name of the editors (will only be sent if the user views article detail page)\n * prop tracker_content_tags untuk tags inside the article (will only be sent if the user views article detail page)\n * prop tracker_content_published_date untuk the published date (will only be sent if the user views article detail page)\n * prop tracker_content_categories untuk The main category the content belongs to\n * prop tracker_user_type untuk type of user based on their subscription\n * prop tracker_subscription_status untuk status of their subscription\n * prop tracker_metered_wall_type untuk the type of Metered Wall\n * prop tracker_metered_wall_balance untuk the balance of their metered wall\n * prop tracker_page_domain untuk Page Domain\n * prop next_param untuk page Domain\n */\n @property({ type: Number }) countdownArticle = 0\n @property({ type: Boolean }) defaultExpandBanner = false\n @property({ type: Boolean }) isDesktop = false\n @property({ type: String }) tracker_page_title = ''\n @property({ type: String }) tracker_page_type = ''\n @property({ type: String }) tracker_content_type = ''\n @property({ type: String }) tracker_content_id = ''\n @property({ type: String }) tracker_content_title = ''\n @property({ type: String }) tracker_content_authors = ''\n @property({ type: String }) tracker_content_editors = ''\n @property({ type: String }) tracker_content_tags = ''\n @property({ type: String }) tracker_content_published_date = ''\n @property({ type: String }) tracker_content_categories = ''\n @property({ type: String }) tracker_user_type = ''\n @property({ type: String }) tracker_subscription_status = ''\n @property({ type: String }) tracker_metered_wall_type = ''\n @property({ type: Number }) tracker_metered_wall_balance = 0\n @property({ type: String }) tracker_page_domain = ''\n @property({ type: String }) next_param =\n 'https://www.kompas.id/baca/opini/2023/12/05/masa-depan-wolbachia-sebagai-alternatif-pengendalian-dbd?open_from=Section_Opini'\n\n /**\n * menentukan template yang akan di render\n */\n private setTemplate(\n prop: string,\n mode: keyof meteredRegisterContent = 'default'\n ): string {\n interface LastArticle {\n [key: string]: string\n }\n interface DynamicMode {\n lastArticle?: LastArticle\n [key: string]: string | LastArticle | undefined\n }\n const dynamicMode = this.textTemplate[mode] as DynamicMode | string\n\n let template: string = ''\n\n if (typeof dynamicMode === 'object' && dynamicMode !== null) {\n // Check if dynamicMode has a lastArticle object and if the prop exists within it\n if (dynamicMode.lastArticle && prop in dynamicMode.lastArticle) {\n const value = dynamicMode.lastArticle[prop]\n if (typeof value === 'string') {\n template = value\n }\n } else if (prop in dynamicMode) {\n const value = dynamicMode[prop]\n if (typeof value === 'string') {\n template = value\n }\n }\n }\n\n return template\n }\n\n private checkIsDesktop() {\n if (window.innerWidth >= 960) {\n this.isDesktop = true\n } else {\n this.isDesktop = false\n }\n }\n\n /**\n * Render Statement\n */\n\n private bannerTemplate() {\n return this.isExpandBanner\n ? this.expandedBannerContent()\n : this.defaultBannerContent()\n }\n\n private defaultBannerContent() {\n return html`\n <div>\n <div\n class=\"${this.isDesktop\n ? 'cont-banner-content'\n : 'justify-between'} flex flex-row\"\n >\n <div .hidden=\"${!this.isDesktop}\" class=\"w-9 h-9\"></div>\n <div class=\"banner-content flex flex-row\">\n <div\n class=\"text-base md:text-lg font-lora mb-3 mt-1 pt-[5px] md:mb-0 md:mt-0 pr-14 md:px-0\"\n .innerHTML=${this.setTemplate('title')}\n ></div>\n <div .hidden=\"${!this.isDesktop}\" class=\"md:self-center btn-regis\">\n ${this.isDesktop\n ? html`<div class=\"ml-4\"></div>\n ${this.registerButtonTemplate()}`\n : null}\n </div>\n </div>\n <div>\n <button\n @click=\"${this.triggerExpandBanner}\"\n class=\"h-9 w-9 flex ml-2 items-center justify-center text-blue-500 rounded bg-blue-200\"\n >\n <div\n class=\"icon icon-blue-600 ${this.isExpandBanner\n ? 'chevron-down'\n : 'rotate-180'}\"\n >\n ${unsafeSVG(getFontAwesomeIcon('fas', 'chevron-down'))}\n </div>\n </button>\n </div>\n </div>\n <div class=\"md:self-center mt-4\">\n ${!this.isDesktop ? html`${this.registerButtonTemplate()} ` : null}\n </div>\n </div>\n `\n }\n\n private expandedBannerContent() {\n return html`\n <div\n class=\"flex flex-col-reverse justify-evenly md:flex-row gap-4 md:gap-8\"\n >\n <div\n class=\"flex flex-col justify-evenly md:text-left md:w-5/12 gap-4 md:gap-2\"\n >\n <p\n class=\"text-lg md:text-2xl font-lora\"\n .innerHTML=${this.setTemplate('title', 'expand')}\n ></p>\n <p\n class=\"text-sm md:text-base\"\n .innerHTML=${this.setTemplate('description', 'expand')}\n ></p>\n <div class=\"${this.isDesktop ? 'expanded-btn' : null} md:self-start\">\n ${this.registerButtonTemplate()}\n </div>\n </div>\n <div\n class=\"flex justify-center md:max-w-[200px] md:max-h-[220px] md:my-auto\"\n >\n <img\n alt=\"metered-wall-register\"\n src=\"https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/paywall_ilustrasi3-03_1.png\"\n />\n </div>\n <button\n @click=\"${this.triggerExpandBanner}\"\n class=\"h-9 w-9 ${this.isDesktop\n ? null\n : 'ml-auto'} flex items-center justify-center text-blue-500 rounded bg-blue-200\"\n >\n <div\n class=\"icon icon-blue-600 ${this.isExpandBanner\n ? 'chevron-down'\n : 'rotate-180'}\"\n >\n ${unsafeSVG(getFontAwesomeIcon('fas', 'chevron-down'))}\n </div>\n </button>\n </div>\n `\n }\n\n /**\n * template button register\n */\n private registerButtonTemplate() {\n return html`\n <div>\n ${!this.textTemplate.ctaUrl\n ? html`<button\n @click=${this.redirectToRegister}\n class=\"bg-green-500 p-1.5 w-full rounded-md font-bold text-grey-100 text-sm md:text-base\"\n >\n Daftar Akun\n </button>`\n : html`<button\n @click=${this.redirectToCTAUrl}\n class=\"bg-green-500 p-1.5 w-full rounded-md font-bold text-grey-100 px-5 text-sm md:text-base md:w-[165px]\"\n >\n ${this.textTemplate.ctaText}\n </button>`}\n </div>\n `\n }\n\n /**\n * mengarahkan ke page checkout promo\n */\n private redirectToCTAUrl = (): void => {\n const params = new URLSearchParams(window.location.href)\n const newUrl = new URL(this.textTemplate.ctaUrl)\n const referrer = new URLSearchParams(this.textTemplate.ctaUrl).get(\n 'referrer'\n )\n this.pushToDataLayer('mrw_clicked')\n if (!referrer) {\n newUrl.searchParams.append('referrer', params.toString())\n window.location.href = newUrl.toString()\n } else {\n const currentReferrerValue = newUrl.searchParams.get('referrer')\n const updatedReferrerValue = `${params.toString()},${currentReferrerValue}`\n newUrl.searchParams.set('referrer', updatedReferrerValue)\n window.location.href = newUrl.toString()\n }\n }\n\n /**\n * mengarahkan ke page register\n */\n private redirectToRegister = (): void => {\n this.pushToDataLayer('mrw_clicked')\n const newUrl = new URL(decodeURIComponent(this.registerUrl))\n if (this.next_param)\n newUrl.searchParams.append('next', decodeURIComponent(this.next_param))\n window.location.href = newUrl.toString()\n }\n\n /**\n * mengirim event ke datalayer\n */\n private pushToDataLayer(eventName: string) {\n window.dataLayer.push({\n event: eventName,\n page_title: this.tracker_page_title,\n page_type: this.tracker_page_type,\n content_type: this.tracker_content_type,\n content_id: this.tracker_content_id,\n content_title: this.tracker_content_title,\n content_authors: this.tracker_content_authors,\n content_editors: this.tracker_content_editors,\n content_tags: this.tracker_content_tags,\n content_published_date: this.tracker_content_published_date,\n content_categories: this.tracker_content_categories,\n user_type: this.tracker_user_type || 'G',\n subscription_status: this.tracker_subscription_status || '',\n metered_wall_type: this.tracker_metered_wall_type || 'MRW',\n metered_wall_balance: this.tracker_metered_wall_balance,\n page_domain: this.tracker_page_domain || 'Kompas.id',\n })\n }\n\n /**\n * toggle isExpandBanner flag\n */\n private triggerExpandBanner() {\n this.isExpandBanner = !this.isExpandBanner\n return !this.isExpandBanner && this.pushToDataLayer('mrw_closed')\n }\n\n /**\n * Lifecycle\n */\n\n override async connectedCallback() {\n super.connectedCallback()\n await this.updateComplete\n this.loadData()\n this.checkIsDesktop()\n }\n\n private async loadData() {\n const req = await fetch(\n `https://d3w4qaq4xm1ncv.cloudfront.net/assets/register_wall.json`\n )\n\n if (req.status !== 200) {\n throw new Error(`${req.status} Ada galat saat memproses permintaan.`)\n }\n\n this.textTemplate = await req.json()\n\n const getCountdown = this.countdownArticle\n\n if (!getCountdown) {\n this.isShowBanner = false\n } else {\n this.isExpandBanner = this.defaultExpandBanner\n }\n\n if (this.isShowBanner) {\n this.pushToDataLayer('mrw_viewed')\n }\n }\n\n render() {\n return this.isShowBanner\n ? html`\n <div class=\"sticky bottom-0 w-full h-full z-20\">\n <div class=\"w-full bg-blue-100 px-4 xl:px-0 bottom-0 py-4\">\n <div class=\"lg:max-w-7xl m-auto relative\">\n <div>${this.bannerTemplate()}</div>\n </div>\n </div>\n </div>\n `\n : null\n }\n}\n"]}
@@ -13,4 +13,6 @@ export interface meteredRegisterContent {
13
13
  };
14
14
  title: string;
15
15
  };
16
+ ctaUrl: string;
17
+ ctaText: string;
16
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/kompasid-metered-wall-register/types.ts"],"names":[],"mappings":"","sourcesContent":["export interface meteredRegisterContent {\n expand: {\n lastArticle: {\n title: string\n description: string\n }\n title: string\n description: string\n }\n default: {\n lastArticle: {\n title: string\n }\n title: string\n }\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/kompasid-metered-wall-register/types.ts"],"names":[],"mappings":"","sourcesContent":["export interface meteredRegisterContent {\n expand: {\n lastArticle: {\n title: string\n description: string\n }\n title: string\n description: string\n }\n default: {\n lastArticle: {\n title: string\n }\n title: string\n }\n ctaUrl: string\n ctaText: string\n}\n"]}
@@ -7,6 +7,7 @@ export { KompasMeteredPaywall } from './components/kompasid-metered-paywall/Komp
7
7
  export { KompasFreewall } from './components/kompasid-freewall/KompasFreewall.js';
8
8
  export { KompasMeteredWallRegister } from './components/kompasid-metered-wall-register/KompasMeteredWallRegister.js';
9
9
  export { KompasHeaderAccount } from './components/kompasid-header-account/KompasHeaderAccount.js';
10
+ export { KompasGracePeriod } from './components/kompasid-grace-period/KompasGracePeriod.js';
10
11
  declare global {
11
12
  interface Window {
12
13
  gtag: (...args: any[]) => void;
package/dist/src/index.js CHANGED
@@ -7,4 +7,5 @@ export { KompasMeteredPaywall } from './components/kompasid-metered-paywall/Komp
7
7
  export { KompasFreewall } from './components/kompasid-freewall/KompasFreewall.js';
8
8
  export { KompasMeteredWallRegister } from './components/kompasid-metered-wall-register/KompasMeteredWallRegister.js';
9
9
  export { KompasHeaderAccount } from './components/kompasid-header-account/KompasHeaderAccount.js';
10
+ export { KompasGracePeriod } from './components/kompasid-grace-period/KompasGracePeriod.js';
10
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iCAAiC,EAAE,MAAM,0FAA0F,CAAA;AAC5I,OAAO,EAAE,8BAA8B,EAAE,MAAM,oFAAoF,CAAA;AACnI,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAA;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,8CAA8C,CAAA;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,2DAA2D,CAAA;AAC9F,OAAO,EAAE,oBAAoB,EAAE,MAAM,+DAA+D,CAAA;AACpG,OAAO,EAAE,cAAc,EAAE,MAAM,kDAAkD,CAAA;AACjF,OAAO,EAAE,yBAAyB,EAAE,MAAM,0EAA0E,CAAA;AACpH,OAAO,EAAE,mBAAmB,EAAE,MAAM,6DAA6D,CAAA","sourcesContent":["export { KompasWidgetRecirculationsDefault } from './components/kompasid-widget-recirculations-default/KompasWidgetRecirculationsDefault.js'\nexport { KompasWidgetRecirculationsList } from './components/kompasid-widget-recirculations-list/KompasWidgetRecirculationsList.js'\nexport { KompasPaywall } from './components/kompasid-paywall/KompasPaywall.js'\nexport { KompasFooter } from './components/kompasid-footer/KompasFooter.js'\nexport { KompasPaywallVideo } from './components/kompasid-paywall-video/KompasPaywallVideo.js'\nexport { KompasMeteredPaywall } from './components/kompasid-metered-paywall/KompasMeteredPaywall.js'\nexport { KompasFreewall } from './components/kompasid-freewall/KompasFreewall.js'\nexport { KompasMeteredWallRegister } from './components/kompasid-metered-wall-register/KompasMeteredWallRegister.js'\nexport { KompasHeaderAccount } from './components/kompasid-header-account/KompasHeaderAccount.js'\n\ndeclare global {\n interface Window {\n gtag: (...args: any[]) => void\n dataLayer: Record<string, any>\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iCAAiC,EAAE,MAAM,0FAA0F,CAAA;AAC5I,OAAO,EAAE,8BAA8B,EAAE,MAAM,oFAAoF,CAAA;AACnI,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAA;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,8CAA8C,CAAA;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,2DAA2D,CAAA;AAC9F,OAAO,EAAE,oBAAoB,EAAE,MAAM,+DAA+D,CAAA;AACpG,OAAO,EAAE,cAAc,EAAE,MAAM,kDAAkD,CAAA;AACjF,OAAO,EAAE,yBAAyB,EAAE,MAAM,0EAA0E,CAAA;AACpH,OAAO,EAAE,mBAAmB,EAAE,MAAM,6DAA6D,CAAA;AACjG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAA","sourcesContent":["export { KompasWidgetRecirculationsDefault } from './components/kompasid-widget-recirculations-default/KompasWidgetRecirculationsDefault.js'\nexport { KompasWidgetRecirculationsList } from './components/kompasid-widget-recirculations-list/KompasWidgetRecirculationsList.js'\nexport { KompasPaywall } from './components/kompasid-paywall/KompasPaywall.js'\nexport { KompasFooter } from './components/kompasid-footer/KompasFooter.js'\nexport { KompasPaywallVideo } from './components/kompasid-paywall-video/KompasPaywallVideo.js'\nexport { KompasMeteredPaywall } from './components/kompasid-metered-paywall/KompasMeteredPaywall.js'\nexport { KompasFreewall } from './components/kompasid-freewall/KompasFreewall.js'\nexport { KompasMeteredWallRegister } from './components/kompasid-metered-wall-register/KompasMeteredWallRegister.js'\nexport { KompasHeaderAccount } from './components/kompasid-header-account/KompasHeaderAccount.js'\nexport { KompasGracePeriod } from './components/kompasid-grace-period/KompasGracePeriod.js'\n\ndeclare global {\n interface Window {\n gtag: (...args: any[]) => void\n dataLayer: Record<string, any>\n }\n}\n"]}
@@ -834,10 +834,6 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
834
834
  height: 1rem;
835
835
  }
836
836
 
837
- .h-40 {
838
- height: 10rem;
839
- }
840
-
841
837
  .h-5 {
842
838
  height: 1.25rem;
843
839
  }
@@ -1475,6 +1471,11 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
1475
1471
  padding-right: 1rem;
1476
1472
  }
1477
1473
 
1474
+ .px-5 {
1475
+ padding-left: 1.25rem;
1476
+ padding-right: 1.25rem;
1477
+ }
1478
+
1478
1479
  .px-8 {
1479
1480
  padding-left: 2rem;
1480
1481
  padding-right: 2rem;
@@ -1919,6 +1920,11 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
1919
1920
  margin-bottom: 2rem;
1920
1921
  }
1921
1922
 
1923
+ .md\\:my-auto {
1924
+ margin-top: auto;
1925
+ margin-bottom: auto;
1926
+ }
1927
+
1922
1928
  .md\\:mb-0 {
1923
1929
  margin-bottom: 0px;
1924
1930
  }
@@ -1979,15 +1985,15 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
1979
1985
  height: 68px;
1980
1986
  }
1981
1987
 
1982
- .md\\:h-full {
1983
- height: 100%;
1984
- }
1985
-
1986
1988
  .md\\:h-max {
1987
1989
  height: -moz-max-content;
1988
1990
  height: max-content;
1989
1991
  }
1990
1992
 
1993
+ .md\\:max-h-\\[220px\\] {
1994
+ max-height: 220px;
1995
+ }
1996
+
1991
1997
  .md\\:min-h-\\[244px\\] {
1992
1998
  min-height: 244px;
1993
1999
  }
@@ -2012,6 +2018,10 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
2012
2018
  width: 13rem;
2013
2019
  }
2014
2020
 
2021
+ .md\\:w-\\[165px\\] {
2022
+ width: 165px;
2023
+ }
2024
+
2015
2025
  .md\\:w-\\[350px\\] {
2016
2026
  width: 350px;
2017
2027
  }
@@ -2036,10 +2046,18 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
2036
2046
  width: 100%;
2037
2047
  }
2038
2048
 
2049
+ .md\\:w-auto {
2050
+ width: auto;
2051
+ }
2052
+
2039
2053
  .md\\:max-w-\\[137px\\] {
2040
2054
  max-width: 137px;
2041
2055
  }
2042
2056
 
2057
+ .md\\:max-w-\\[200px\\] {
2058
+ max-width: 200px;
2059
+ }
2060
+
2043
2061
  .md\\:max-w-full {
2044
2062
  max-width: 100%;
2045
2063
  }
@@ -2096,6 +2114,12 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
2096
2114
  margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse)));
2097
2115
  }
2098
2116
 
2117
+ .md\\:space-x-4 > :not([hidden]) ~ :not([hidden]) {
2118
+ --tw-space-x-reverse: 0;
2119
+ margin-right: calc(1rem * var(--tw-space-x-reverse));
2120
+ margin-left: calc(1rem * calc(1 - var(--tw-space-x-reverse)));
2121
+ }
2122
+
2099
2123
  .md\\:space-x-5 > :not([hidden]) ~ :not([hidden]) {
2100
2124
  --tw-space-x-reverse: 0;
2101
2125
  margin-right: calc(1.25rem * var(--tw-space-x-reverse));
@@ -2196,6 +2220,10 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
2196
2220
  padding-bottom: 1.75rem;
2197
2221
  }
2198
2222
 
2223
+ .md\\:pt-0 {
2224
+ padding-top: 0px;
2225
+ }
2226
+
2199
2227
  .md\\:pt-3 {
2200
2228
  padding-top: 0.75rem;
2201
2229
  }
@@ -2359,6 +2387,11 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
2359
2387
  padding-right: 0px;
2360
2388
  }
2361
2389
 
2390
+ .lg\\:px-20 {
2391
+ padding-left: 5rem;
2392
+ padding-right: 5rem;
2393
+ }
2394
+
2362
2395
  .lg\\:px-24 {
2363
2396
  padding-left: 6rem;
2364
2397
  padding-right: 6rem;
@@ -2369,6 +2402,11 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
2369
2402
  padding-bottom: 2.5rem;
2370
2403
  }
2371
2404
 
2405
+ .lg\\:px-8 {
2406
+ padding-left: 2rem;
2407
+ padding-right: 2rem;
2408
+ }
2409
+
2372
2410
  .lg\\:pb-0 {
2373
2411
  padding-bottom: 0px;
2374
2412
  }