@kompasid/lit-web-components 0.9.18 → 0.9.20
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/dist/src/components/kompasid-grace-period/KompasGracePeriod.d.ts +3 -0
- package/dist/src/components/kompasid-grace-period/KompasGracePeriod.js +78 -33
- package/dist/src/components/kompasid-grace-period/KompasGracePeriod.js.map +1 -1
- package/dist/src/components/kompasid-menu-side-bar/KompasMenuSideBar.d.ts +22 -61
- package/dist/src/components/kompasid-menu-side-bar/KompasMenuSideBar.js +254 -505
- package/dist/src/components/kompasid-menu-side-bar/KompasMenuSideBar.js.map +1 -1
- package/dist/src/components/kompasid-menu-side-bar/SidebarDataController.d.ts +32 -0
- package/dist/src/components/kompasid-menu-side-bar/SidebarDataController.js +72 -0
- package/dist/src/components/kompasid-menu-side-bar/SidebarDataController.js.map +1 -0
- package/dist/tailwind/tailwind.js +9 -15
- package/dist/tailwind/tailwind.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/kompasid-grace-period/KompasGracePeriod.ts +82 -35
- package/src/components/kompasid-menu-side-bar/KompasMenuSideBar.ts +292 -637
- package/src/components/kompasid-menu-side-bar/SidebarDataController.ts +113 -0
- package/tailwind/tailwind.css +5 -15
- package/tailwind/tailwind.ts +9 -15
|
@@ -54,6 +54,9 @@ export declare class KompasGracePeriod extends LitElement {
|
|
|
54
54
|
private maxGracePeriod;
|
|
55
55
|
private subscriptionPage;
|
|
56
56
|
private checkoutPage;
|
|
57
|
+
private tempTextEachDay;
|
|
58
|
+
private tempButtonA;
|
|
59
|
+
private tempButtonB;
|
|
57
60
|
private getCountdownGracePeriod;
|
|
58
61
|
private redirectToKnowledgeBase;
|
|
59
62
|
private redirectToBerlangganan;
|
|
@@ -59,54 +59,74 @@ let KompasGracePeriod = class KompasGracePeriod extends LitElement {
|
|
|
59
59
|
this.maxGracePeriod = 7;
|
|
60
60
|
this.subscriptionPage = 'https://www.kompas.id/berlangganan';
|
|
61
61
|
this.checkoutPage = 'https://checkoutv2.kompas.id';
|
|
62
|
+
this.tempTextEachDay = [];
|
|
63
|
+
this.tempButtonA = {
|
|
64
|
+
url: '',
|
|
65
|
+
text: '',
|
|
66
|
+
};
|
|
67
|
+
this.tempButtonB = {
|
|
68
|
+
url: '',
|
|
69
|
+
text: '',
|
|
70
|
+
};
|
|
62
71
|
}
|
|
63
72
|
getCountdownGracePeriod() {
|
|
64
73
|
const { totalGracePeriod } = this;
|
|
65
74
|
const { maxGracePeriod } = this;
|
|
66
|
-
if (totalGracePeriod === 7) {
|
|
67
|
-
return html `
|
|
68
|
-
<p>
|
|
69
|
-
Anda dalam
|
|
70
|
-
<a
|
|
71
|
-
href="#"
|
|
72
|
-
class="text-orange-500 underline font-bold cursor-pointer"
|
|
73
|
-
@click=${this.redirectToKnowledgeBase}
|
|
74
|
-
>
|
|
75
|
-
hari terakhir
|
|
76
|
-
</a>
|
|
77
|
-
masa tenggang langganan. Segera perbarui paket langganan untuk tetap
|
|
78
|
-
mengakses konten premium tanpa batas.
|
|
79
|
-
</p>
|
|
80
|
-
`;
|
|
81
|
-
}
|
|
82
75
|
return html `
|
|
83
|
-
<p
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
class="text-orange-500 underline font-bold cursor-pointer"
|
|
88
|
-
@click=${this.redirectToKnowledgeBase}
|
|
89
|
-
>
|
|
90
|
-
${maxGracePeriod - totalGracePeriod + 1} hari lagi </a
|
|
91
|
-
>. Segera perbarui paket langganan untuk tetap mengakses konten premium
|
|
92
|
-
tanpa batas.
|
|
93
|
-
</p>
|
|
76
|
+
<p
|
|
77
|
+
class="message-gp"
|
|
78
|
+
.innerHTML=${this.tempTextEachDay[maxGracePeriod - totalGracePeriod + 1 - 1]}
|
|
79
|
+
></p>
|
|
94
80
|
`;
|
|
81
|
+
// comment old html
|
|
82
|
+
// if (totalGracePeriod === 7) {
|
|
83
|
+
// return html`
|
|
84
|
+
// <p>
|
|
85
|
+
// Anda dalam
|
|
86
|
+
// <a
|
|
87
|
+
// href="#"
|
|
88
|
+
// class="text-orange-500 underline font-bold cursor-pointer"
|
|
89
|
+
// @click=${this.redirectToKnowledgeBase}
|
|
90
|
+
// >
|
|
91
|
+
// hari terakhir
|
|
92
|
+
// </a>
|
|
93
|
+
// masa tenggang langganan. Segera perbarui paket langganan untuk tetap
|
|
94
|
+
// mengakses konten premium tanpa batas.
|
|
95
|
+
// </p>
|
|
96
|
+
// `
|
|
97
|
+
// }
|
|
98
|
+
// return html`
|
|
99
|
+
// <p>
|
|
100
|
+
// Masa tenggang langganan Anda tersisa
|
|
101
|
+
// <a
|
|
102
|
+
// href="#"
|
|
103
|
+
// class="text-orange-500 underline font-bold cursor-pointer"
|
|
104
|
+
// @click=${this.redirectToKnowledgeBase}
|
|
105
|
+
// >
|
|
106
|
+
// ${maxGracePeriod - totalGracePeriod + 1} hari lagi </a
|
|
107
|
+
// >. Segera perbarui paket langganan untuk tetap mengakses konten premium
|
|
108
|
+
// tanpa batas.
|
|
109
|
+
// </p>
|
|
110
|
+
// `
|
|
95
111
|
}
|
|
96
112
|
redirectToKnowledgeBase() {
|
|
97
113
|
window.open('https://kb.kompas.id/baca/berlangganan-kompas-id/masa-tenggang-atau-grace-period-langganan/', '_blank');
|
|
98
114
|
}
|
|
99
115
|
redirectToBerlangganan() {
|
|
116
|
+
const { url = '' } = this.tempButtonB;
|
|
100
117
|
this.dataLayeronPerbaruiLanggananButton();
|
|
101
118
|
this.sendGtmEvent('subscribe_button_clicked', true);
|
|
102
|
-
const
|
|
103
|
-
window.open(
|
|
119
|
+
const urlComputed = url || `${this.subscriptionPage}?open_from=Grace_Period`;
|
|
120
|
+
window.open(urlComputed);
|
|
104
121
|
}
|
|
105
122
|
redirectToCheckout() {
|
|
123
|
+
const { url = '' } = this.tempButtonA;
|
|
106
124
|
this.dataLayeronPerbaruiLanggananButton();
|
|
107
125
|
const originHost = encodeURIComponent(window.location.href);
|
|
108
126
|
this.sendGtmEvent('subscribe_button_clicked');
|
|
109
|
-
|
|
127
|
+
const defaultPath = url ||
|
|
128
|
+
`${this.checkoutPage}/v2/kdp?productId=${this.paywall_subscription_id}&autorenewal=1`;
|
|
129
|
+
window.open(`${defaultPath}&referrer=${originHost}&source=${this.source}`);
|
|
110
130
|
}
|
|
111
131
|
getGtmParams(excludeSubscriptionParams = false) {
|
|
112
132
|
const gtmParams = {};
|
|
@@ -169,6 +189,8 @@ let KompasGracePeriod = class KompasGracePeriod extends LitElement {
|
|
|
169
189
|
}
|
|
170
190
|
gracePeriodTemplate() {
|
|
171
191
|
const { isColumn, isBackgroundOnContentOnly } = this;
|
|
192
|
+
const { text: textA = '' } = this.tempButtonA;
|
|
193
|
+
const { text: textB = '' } = this.tempButtonB;
|
|
172
194
|
const wrapperColumnClass = isColumn
|
|
173
195
|
? 'rounded-lg'
|
|
174
196
|
: 'md:flex-row lg:px-8 md:space-x-4 px-4 py-4';
|
|
@@ -198,14 +220,14 @@ let KompasGracePeriod = class KompasGracePeriod extends LitElement {
|
|
|
198
220
|
@click=${this.redirectToCheckout}
|
|
199
221
|
class="w-full rounded-md bg-green-500 p-2 px-5 text-sm font-bold text-grey-100 md:w-auto md:text-base"
|
|
200
222
|
>
|
|
201
|
-
Perbarui Langganan
|
|
223
|
+
${textA || 'Perbarui Langganan'}
|
|
202
224
|
</button>
|
|
203
225
|
<div class="md:block hidden">
|
|
204
226
|
<button
|
|
205
227
|
@click=${this.redirectToBerlangganan}
|
|
206
228
|
class="bg-transparent w-full rounded-md border border-green-500 p-1.5 px-5 text-sm font-bold text-green-500 md:text-base ${otherBtnColumnClass}"
|
|
207
229
|
>
|
|
208
|
-
Paket Lainnya
|
|
230
|
+
${textB || 'Paket Lainnya'}
|
|
209
231
|
</button>
|
|
210
232
|
</div>
|
|
211
233
|
<div class="md:hidden block">
|
|
@@ -213,7 +235,7 @@ let KompasGracePeriod = class KompasGracePeriod extends LitElement {
|
|
|
213
235
|
@click=${this.redirectToBerlangganan}
|
|
214
236
|
class="bg-transparent w-full rounded-md border border-green-500 p-1.5 px-5 text-sm font-bold text-green-500 md:text-base ${otherBtnColumnClass}"
|
|
215
237
|
>
|
|
216
|
-
Lihat Paket Lainnya
|
|
238
|
+
${textB || 'Lihat Paket Lainnya'}
|
|
217
239
|
</button>
|
|
218
240
|
</div>
|
|
219
241
|
</div>
|
|
@@ -223,6 +245,13 @@ let KompasGracePeriod = class KompasGracePeriod extends LitElement {
|
|
|
223
245
|
`;
|
|
224
246
|
}
|
|
225
247
|
async connectedCallback() {
|
|
248
|
+
// Constructing the URL with parameters
|
|
249
|
+
const endpoint = `https://cdn-www.kompas.id/web-component/grace-period-paywall.json`;
|
|
250
|
+
const response = await fetch(endpoint);
|
|
251
|
+
const result = await response.json();
|
|
252
|
+
this.tempTextEachDay = result.message;
|
|
253
|
+
this.tempButtonA = result.buttonA;
|
|
254
|
+
this.tempButtonB = result.buttonB;
|
|
226
255
|
super.connectedCallback();
|
|
227
256
|
this.sendGtmEvent('paywall_viewed');
|
|
228
257
|
this.dataLayeronGracePeriod();
|
|
@@ -250,6 +279,13 @@ KompasGracePeriod.styles = [
|
|
|
250
279
|
height: 100%;
|
|
251
280
|
width: 100%;
|
|
252
281
|
}
|
|
282
|
+
|
|
283
|
+
.message-gp > a {
|
|
284
|
+
color: #db5d00;
|
|
285
|
+
text-decoration-line: underline;
|
|
286
|
+
font-weight: 700;
|
|
287
|
+
cursor: pointer;
|
|
288
|
+
}
|
|
253
289
|
`,
|
|
254
290
|
TWStyles,
|
|
255
291
|
];
|
|
@@ -328,6 +364,15 @@ __decorate([
|
|
|
328
364
|
__decorate([
|
|
329
365
|
state()
|
|
330
366
|
], KompasGracePeriod.prototype, "checkoutPage", void 0);
|
|
367
|
+
__decorate([
|
|
368
|
+
state()
|
|
369
|
+
], KompasGracePeriod.prototype, "tempTextEachDay", void 0);
|
|
370
|
+
__decorate([
|
|
371
|
+
state()
|
|
372
|
+
], KompasGracePeriod.prototype, "tempButtonA", void 0);
|
|
373
|
+
__decorate([
|
|
374
|
+
state()
|
|
375
|
+
], KompasGracePeriod.prototype, "tempButtonB", void 0);
|
|
331
376
|
KompasGracePeriod = __decorate([
|
|
332
377
|
customElement('kompasid-grace-period')
|
|
333
378
|
], KompasGracePeriod);
|
|
@@ -1 +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;;;;;;;;;;;;;;;;;;;;;WAqBG;QAEyB,qBAAgB,GAAG,CAAC,CAAA;QACnB,aAAQ,GAAG,KAAK,CAAA;QAChB,iBAAY,GAAG,IAAI,CAAA;QACnB,aAAQ,GAAG,KAAK,CAAA;QAChB,8BAAyB,GAAG,KAAK,CAAA;QAClC,WAAM,GAAG,SAAS,CAAA;QAClB,qBAAgB,GAAG,EAAE,CAAA;QACrB,iCAA4B,GAAG,EAAE,CAAA;QACjC,4BAAuB,GAAG,CAAC,CAAA;QAC3B,+BAA0B,GAAG,CAAC,CAAA;QAC9B,qBAAgB,GAAG,CAAC,CAAA;QACpB,sBAAiB,GAAG,EAAE,CAAA;QACtB,uBAAkB,GAAG,EAAE,CAAA;QACvB,0BAAqB,GAAG,EAAE,CAAA;QAC1B,+BAA0B,GAAG,EAAE,CAAA;QAC/B,yBAAoB,GAAG,EAAE,CAAA;QACzB,sBAAi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,EAAE,CAAC;sEAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8DAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oEAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uEAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iEAA4B;AAK9C;IAAR,KAAK,EAAE;yDAA2B;AAC1B;IAAR,KAAK,EAAE;2DAAgE;AAC/D;IAAR,KAAK,EAAE;uDAAsD;AAvEnD,iBAAiB;IAD7B,aAAa,CAAC,uBAAuB,CAAC;GAC1B,iBAAiB,CAyR7B;SAzRY,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 isEpaper = is paywall opened in epaper page\n * property paywall_location = the location where user encounter the paywall\n * property paywall_subscription_package = the name of the subscription package viewed by user\n * property paywall_subscription_id = the ID of the subscription package viewed by user\n * property paywall_subscription_price = the price of the subscriprtion package viewed by user\n * property paywall_position = the position of the subscription package viewed by user\n * property tracker_page_type = type of the page\n * property tracker_content_id = ID of article (slug)\n * property tracker_content_type = whether it's free article or paid article\n * property tracker_content_title = the title of article\n * property tracker_content_categories = the category of the content\n * property tracker_user_type = type of user based on their subscription\n * property tracker_subscription_status = status of their subscription\n * property tracker_page_domain = page Domain\n * property tracker_metered_wall_type = the type of Metered Wall\n * property tracker_metered_wall_balance = the balance of their metered wall\n * property tracker_epaper_edition = the edition of epaper viewed by user\n */\n\n @property({ type: Number }) totalGracePeriod = 0\n @property({ type: Boolean }) isColumn = false\n @property({ type: Boolean }) isShowButton = true\n @property({ type: Boolean }) isEpaper = false\n @property({ type: Boolean }) isBackgroundOnContentOnly = false\n @property({ type: String }) source = 'article'\n @property({ type: String }) paywall_location = ''\n @property({ type: String }) paywall_subscription_package = ''\n @property({ type: Number }) paywall_subscription_id = 0\n @property({ type: Number }) paywall_subscription_price = 0\n @property({ type: Number }) paywall_position = 0\n @property({ type: String }) tracker_page_type = ''\n @property({ type: String }) tracker_content_id = ''\n @property({ type: String }) tracker_content_title = ''\n @property({ type: String }) tracker_content_categories = ''\n @property({ type: String }) tracker_content_type = ''\n @property({ type: String }) tracker_user_type = ''\n @property({ type: String }) tracker_subscription_status = ''\n @property({ type: String }) tracker_page_domain = ''\n @property({ type: String }) tracker_metered_wall_type = ''\n @property({ type: Number }) tracker_metered_wall_balance = 0\n @property({ type: String }) tracker_epaper_edition = ''\n\n /**\n * State\n */\n @state() private maxGracePeriod = 7\n @state() private subscriptionPage = 'https://www.kompas.id/berlangganan'\n @state() private checkoutPage = '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\n <a\n href=\"#\"\n class=\"text-orange-500 underline font-bold cursor-pointer\"\n @click=${this.redirectToKnowledgeBase}\n >\n hari terakhir\n </a>\n masa tenggang langganan. Segera perbarui paket langganan untuk tetap\n mengakses konten premium tanpa batas.\n </p>\n `\n }\n return html`\n <p>\n Masa tenggang langganan Anda tersisa\n <a\n href=\"#\"\n class=\"text-orange-500 underline font-bold cursor-pointer\"\n @click=${this.redirectToKnowledgeBase}\n >\n ${maxGracePeriod - totalGracePeriod + 1} hari lagi </a\n >. Segera perbarui paket langganan untuk tetap mengakses konten premium\n tanpa batas.\n </p>\n `\n }\n\n private redirectToKnowledgeBase(): void {\n window.open(\n 'https://kb.kompas.id/baca/berlangganan-kompas-id/masa-tenggang-atau-grace-period-langganan/',\n '_blank'\n )\n }\n\n private redirectToBerlangganan(): void {\n this.dataLayeronPerbaruiLanggananButton()\n this.sendGtmEvent('subscribe_button_clicked', true)\n\n const url = `${this.subscriptionPage}?open_from=Grace_Period`\n window.open(url)\n }\n\n private redirectToCheckout(): void {\n this.dataLayeronPerbaruiLanggananButton()\n const originHost: string = encodeURIComponent(window.location.href)\n\n this.sendGtmEvent('subscribe_button_clicked')\n\n window.open(\n `${this.checkoutPage}/v2/kdp?productId=${this.paywall_subscription_id}&autorenewal=1&referrer=${originHost}&source=${this.source}`\n )\n }\n\n private getGtmParams(\n excludeSubscriptionParams: boolean = false\n ): Record<string, any> {\n const gtmParams: Record<string, any> = {}\n\n if (!this.isEpaper) {\n gtmParams.content_title = this.tracker_content_title\n gtmParams.content_id = this.tracker_content_id\n gtmParams.content_categories = this.tracker_content_categories\n gtmParams.content_type = this.tracker_content_type\n gtmParams.page_type = this.tracker_page_type\n } else {\n gtmParams.epaper_edition = this.tracker_epaper_edition\n }\n\n if (!excludeSubscriptionParams) {\n gtmParams.paywall_subscription_package = this.paywall_subscription_package\n gtmParams.paywall_subscription_id = this.paywall_subscription_id\n gtmParams.paywall_subscription_price = this.paywall_subscription_price\n }\n\n gtmParams.paywall_location = this.paywall_location\n gtmParams.paywall_position = this.paywall_position\n gtmParams.user_type = this.tracker_user_type\n gtmParams.subscription_status = this.tracker_subscription_status\n gtmParams.page_domain = this.tracker_page_domain || 'Kompas.id'\n gtmParams.metered_wall_type = this.tracker_metered_wall_type || 'GP'\n gtmParams.metered_wall_balance = this.tracker_metered_wall_balance\n\n return gtmParams\n }\n\n private sendGtmEvent(\n event: string,\n excludeSubscriptionParams: boolean = false\n ) {\n let gtmParams: Record<string, any> = { event }\n\n if (event === 'paywall_viewed') {\n gtmParams.impressions = [\n {\n ...this.getGtmParams(excludeSubscriptionParams),\n },\n ]\n } else {\n gtmParams = {\n ...gtmParams,\n ...this.getGtmParams(excludeSubscriptionParams),\n }\n }\n\n window.dataLayer.push(gtmParams)\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 const { isColumn, isBackgroundOnContentOnly } = this\n\n const wrapperColumnClass = isColumn\n ? 'rounded-lg'\n : 'md:flex-row lg:px-8 md:space-x-4 px-4 py-4'\n const buttonColumnClass = isColumn\n ? ''\n : 'md:w-1/2 justify-end md:flex-row pt-4 md:pt-0'\n const otherBtnColumnClass = isColumn ? '' : 'md:w-auto'\n const wrapperBgClass = !isBackgroundOnContentOnly ? 'p-4' : ''\n const contentBgClass = isBackgroundOnContentOnly\n ? 'bg-orange-100 p-4 rounded-lg mb-4'\n : ''\n\n return html`\n <div\n class=\"bottom-0 mx-auto flex w-full max-w-7xl flex-col justify-end ${wrapperColumnClass} ${wrapperBgClass}\"\n >\n <div\n class=\"self-center text-left text-sm text-grey-600 md:text-base ${contentBgClass}\"\n >\n ${this.getCountdownGracePeriod()}\n </div>\n ${this.isShowButton\n ? html`\n <div\n class=\"flex w-full flex-col gap-4 self-center ${buttonColumnClass}\"\n >\n <button\n @click=${this.redirectToCheckout}\n class=\"w-full rounded-md bg-green-500 p-2 px-5 text-sm font-bold text-grey-100 md:w-auto md:text-base\"\n >\n Perbarui Langganan\n </button>\n <div class=\"md:block hidden\">\n <button\n @click=${this.redirectToBerlangganan}\n class=\"bg-transparent w-full rounded-md border border-green-500 p-1.5 px-5 text-sm font-bold text-green-500 md:text-base ${otherBtnColumnClass}\"\n >\n Paket Lainnya\n </button>\n </div>\n <div class=\"md:hidden block\">\n <button\n @click=${this.redirectToBerlangganan}\n class=\"bg-transparent w-full rounded-md border border-green-500 p-1.5 px-5 text-sm font-bold text-green-500 md:text-base ${otherBtnColumnClass}\"\n >\n Lihat Paket Lainnya\n </button>\n </div>\n </div>\n `\n : nothing}\n </div>\n `\n }\n\n override async connectedCallback() {\n super.connectedCallback()\n\n this.sendGtmEvent('paywall_viewed')\n\n this.dataLayeronGracePeriod()\n }\n\n render() {\n const bgClass = !this.isBackgroundOnContentOnly\n ? 'bg-orange-100 sticky bottom-0 z-20'\n : ''\n return html`\n <div class=\"h-full w-full ${bgClass}\">\n ${this.totalGracePeriod > 0 ? this.gracePeriodTemplate() : nothing}\n </div>\n `\n }\n}\n"]}
|
|
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;;QAwBL;;WAEG;QACH;;;;;;;;;;;;;;;;;;;;;WAqBG;QAEyB,qBAAgB,GAAG,CAAC,CAAA;QACnB,aAAQ,GAAG,KAAK,CAAA;QAChB,iBAAY,GAAG,IAAI,CAAA;QACnB,aAAQ,GAAG,KAAK,CAAA;QAChB,8BAAyB,GAAG,KAAK,CAAA;QAClC,WAAM,GAAG,SAAS,CAAA;QAClB,qBAAgB,GAAG,EAAE,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,IAAI,EAAE,MAAM,EAAE,CAAC;6DAAwB;AACvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gEAA2B;AAC1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qEAAgC;AAC/B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+DAA0B;AACzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sEAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8DAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oEAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uEAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iEAA4B;AAK9C;IAAR,KAAK,EAAE;yDAA2B;AAC1B;IAAR,KAAK,EAAE;2DAAgE;AAC/D;IAAR,KAAK,EAAE;uDAAsD;AACrD;IAAR,KAAK,EAAE;0DAA6B;AAC5B;IAAR,KAAK,EAAE;sDAMP;AACQ;IAAR,KAAK,EAAE;sDAMP;AA7FU,iBAAiB;IAD7B,aAAa,CAAC,uBAAuB,CAAC;GAC1B,iBAAiB,CAwU7B;SAxUY,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 .message-gp > a {\n color: #db5d00;\n text-decoration-line: underline;\n font-weight: 700;\n cursor: pointer;\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 isEpaper = is paywall opened in epaper page\n * property paywall_location = the location where user encounter the paywall\n * property paywall_subscription_package = the name of the subscription package viewed by user\n * property paywall_subscription_id = the ID of the subscription package viewed by user\n * property paywall_subscription_price = the price of the subscriprtion package viewed by user\n * property paywall_position = the position of the subscription package viewed by user\n * property tracker_page_type = type of the page\n * property tracker_content_id = ID of article (slug)\n * property tracker_content_type = whether it's free article or paid article\n * property tracker_content_title = the title of article\n * property tracker_content_categories = the category of the content\n * property tracker_user_type = type of user based on their subscription\n * property tracker_subscription_status = status of their subscription\n * property tracker_page_domain = page Domain\n * property tracker_metered_wall_type = the type of Metered Wall\n * property tracker_metered_wall_balance = the balance of their metered wall\n * property tracker_epaper_edition = the edition of epaper viewed by user\n */\n\n @property({ type: Number }) totalGracePeriod = 0\n @property({ type: Boolean }) isColumn = false\n @property({ type: Boolean }) isShowButton = true\n @property({ type: Boolean }) isEpaper = false\n @property({ type: Boolean }) isBackgroundOnContentOnly = false\n @property({ type: String }) source = 'article'\n @property({ type: String }) paywall_location = ''\n @property({ type: String }) paywall_subscription_package = ''\n @property({ type: Number }) paywall_subscription_id = 0\n @property({ type: Number }) paywall_subscription_price = 0\n @property({ type: Number }) paywall_position = 0\n @property({ type: String }) tracker_page_type = ''\n @property({ type: String }) tracker_content_id = ''\n @property({ type: String }) tracker_content_title = ''\n @property({ type: String }) tracker_content_categories = ''\n @property({ type: String }) tracker_content_type = ''\n @property({ type: String }) tracker_user_type = ''\n @property({ type: String }) tracker_subscription_status = ''\n @property({ type: String }) tracker_page_domain = ''\n @property({ type: String }) tracker_metered_wall_type = ''\n @property({ type: Number }) tracker_metered_wall_balance = 0\n @property({ type: String }) tracker_epaper_edition = ''\n\n /**\n * State\n */\n @state() private maxGracePeriod = 7\n @state() private subscriptionPage = 'https://www.kompas.id/berlangganan'\n @state() private checkoutPage = 'https://checkoutv2.kompas.id'\n @state() private tempTextEachDay = []\n @state() private tempButtonA: {\n url: string\n text: string\n } = {\n url: '',\n text: '',\n }\n @state() private tempButtonB: {\n url: string\n text: string\n } = {\n url: '',\n text: '',\n }\n\n private getCountdownGracePeriod() {\n const { totalGracePeriod } = this\n const { maxGracePeriod } = this\n return html`\n <p\n class=\"message-gp\"\n .innerHTML=${this.tempTextEachDay[\n maxGracePeriod - totalGracePeriod + 1 - 1\n ]}\n ></p>\n `\n // comment old html\n // if (totalGracePeriod === 7) {\n // return html`\n // <p>\n // Anda dalam\n // <a\n // href=\"#\"\n // class=\"text-orange-500 underline font-bold cursor-pointer\"\n // @click=${this.redirectToKnowledgeBase}\n // >\n // hari terakhir\n // </a>\n // masa tenggang langganan. Segera perbarui paket langganan untuk tetap\n // mengakses konten premium tanpa batas.\n // </p>\n // `\n // }\n // return html`\n // <p>\n // Masa tenggang langganan Anda tersisa\n // <a\n // href=\"#\"\n // class=\"text-orange-500 underline font-bold cursor-pointer\"\n // @click=${this.redirectToKnowledgeBase}\n // >\n // ${maxGracePeriod - totalGracePeriod + 1} hari lagi </a\n // >. Segera perbarui paket langganan untuk tetap mengakses konten premium\n // tanpa batas.\n // </p>\n // `\n }\n\n private redirectToKnowledgeBase(): void {\n window.open(\n 'https://kb.kompas.id/baca/berlangganan-kompas-id/masa-tenggang-atau-grace-period-langganan/',\n '_blank'\n )\n }\n\n private redirectToBerlangganan(): void {\n const { url = '' } = this.tempButtonB\n this.dataLayeronPerbaruiLanggananButton()\n this.sendGtmEvent('subscribe_button_clicked', true)\n\n const urlComputed = url || `${this.subscriptionPage}?open_from=Grace_Period`\n window.open(urlComputed)\n }\n\n private redirectToCheckout(): void {\n const { url = '' } = this.tempButtonA\n this.dataLayeronPerbaruiLanggananButton()\n const originHost: string = encodeURIComponent(window.location.href)\n\n this.sendGtmEvent('subscribe_button_clicked')\n\n const defaultPath =\n url ||\n `${this.checkoutPage}/v2/kdp?productId=${this.paywall_subscription_id}&autorenewal=1`\n\n window.open(`${defaultPath}&referrer=${originHost}&source=${this.source}`)\n }\n\n private getGtmParams(\n excludeSubscriptionParams: boolean = false\n ): Record<string, any> {\n const gtmParams: Record<string, any> = {}\n\n if (!this.isEpaper) {\n gtmParams.content_title = this.tracker_content_title\n gtmParams.content_id = this.tracker_content_id\n gtmParams.content_categories = this.tracker_content_categories\n gtmParams.content_type = this.tracker_content_type\n gtmParams.page_type = this.tracker_page_type\n } else {\n gtmParams.epaper_edition = this.tracker_epaper_edition\n }\n\n if (!excludeSubscriptionParams) {\n gtmParams.paywall_subscription_package = this.paywall_subscription_package\n gtmParams.paywall_subscription_id = this.paywall_subscription_id\n gtmParams.paywall_subscription_price = this.paywall_subscription_price\n }\n\n gtmParams.paywall_location = this.paywall_location\n gtmParams.paywall_position = this.paywall_position\n gtmParams.user_type = this.tracker_user_type\n gtmParams.subscription_status = this.tracker_subscription_status\n gtmParams.page_domain = this.tracker_page_domain || 'Kompas.id'\n gtmParams.metered_wall_type = this.tracker_metered_wall_type || 'GP'\n gtmParams.metered_wall_balance = this.tracker_metered_wall_balance\n\n return gtmParams\n }\n\n private sendGtmEvent(\n event: string,\n excludeSubscriptionParams: boolean = false\n ) {\n let gtmParams: Record<string, any> = { event }\n\n if (event === 'paywall_viewed') {\n gtmParams.impressions = [\n {\n ...this.getGtmParams(excludeSubscriptionParams),\n },\n ]\n } else {\n gtmParams = {\n ...gtmParams,\n ...this.getGtmParams(excludeSubscriptionParams),\n }\n }\n\n window.dataLayer.push(gtmParams)\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 const { isColumn, isBackgroundOnContentOnly } = this\n\n const { text: textA = '' } = this.tempButtonA\n\n const { text: textB = '' } = this.tempButtonB\n\n const wrapperColumnClass = isColumn\n ? 'rounded-lg'\n : 'md:flex-row lg:px-8 md:space-x-4 px-4 py-4'\n const buttonColumnClass = isColumn\n ? ''\n : 'md:w-1/2 justify-end md:flex-row pt-4 md:pt-0'\n const otherBtnColumnClass = isColumn ? '' : 'md:w-auto'\n const wrapperBgClass = !isBackgroundOnContentOnly ? 'p-4' : ''\n const contentBgClass = isBackgroundOnContentOnly\n ? 'bg-orange-100 p-4 rounded-lg mb-4'\n : ''\n\n return html`\n <div\n class=\"bottom-0 mx-auto flex w-full max-w-7xl flex-col justify-end ${wrapperColumnClass} ${wrapperBgClass}\"\n >\n <div\n class=\"self-center text-left text-sm text-grey-600 md:text-base ${contentBgClass}\"\n >\n ${this.getCountdownGracePeriod()}\n </div>\n ${this.isShowButton\n ? html`\n <div\n class=\"flex w-full flex-col gap-4 self-center ${buttonColumnClass}\"\n >\n <button\n @click=${this.redirectToCheckout}\n class=\"w-full rounded-md bg-green-500 p-2 px-5 text-sm font-bold text-grey-100 md:w-auto md:text-base\"\n >\n ${textA || 'Perbarui Langganan'}\n </button>\n <div class=\"md:block hidden\">\n <button\n @click=${this.redirectToBerlangganan}\n class=\"bg-transparent w-full rounded-md border border-green-500 p-1.5 px-5 text-sm font-bold text-green-500 md:text-base ${otherBtnColumnClass}\"\n >\n ${textB || 'Paket Lainnya'}\n </button>\n </div>\n <div class=\"md:hidden block\">\n <button\n @click=${this.redirectToBerlangganan}\n class=\"bg-transparent w-full rounded-md border border-green-500 p-1.5 px-5 text-sm font-bold text-green-500 md:text-base ${otherBtnColumnClass}\"\n >\n ${textB || 'Lihat Paket Lainnya'}\n </button>\n </div>\n </div>\n `\n : nothing}\n </div>\n `\n }\n\n override async connectedCallback() {\n // Constructing the URL with parameters\n const endpoint = `https://cdn-www.kompas.id/web-component/grace-period-paywall.json`\n const response = await fetch(endpoint)\n const result = await response.json()\n this.tempTextEachDay = result.message\n this.tempButtonA = result.buttonA\n this.tempButtonB = result.buttonB\n\n super.connectedCallback()\n\n this.sendGtmEvent('paywall_viewed')\n\n this.dataLayeronGracePeriod()\n }\n\n render() {\n const bgClass = !this.isBackgroundOnContentOnly\n ? 'bg-orange-100 sticky bottom-0 z-20'\n : ''\n return html`\n <div class=\"h-full w-full ${bgClass}\">\n ${this.totalGracePeriod > 0 ? this.gracePeriodTemplate() : nothing}\n </div>\n `\n }\n}\n"]}
|
|
@@ -1,69 +1,30 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
-
|
|
3
|
-
external?: boolean;
|
|
4
|
-
gtmClass?: string;
|
|
5
|
-
icon: object | null;
|
|
6
|
-
iconify: string | null;
|
|
7
|
-
isNew: boolean;
|
|
8
|
-
name: string;
|
|
9
|
-
url: string;
|
|
10
|
-
}
|
|
11
|
-
interface dataType {
|
|
12
|
-
href: string;
|
|
13
|
-
external?: boolean;
|
|
14
|
-
icon: object | null;
|
|
15
|
-
iconify: string | null;
|
|
16
|
-
name: string;
|
|
17
|
-
slug: string;
|
|
18
|
-
redDot: [
|
|
19
|
-
{
|
|
20
|
-
start: string;
|
|
21
|
-
end: string;
|
|
22
|
-
}
|
|
23
|
-
];
|
|
24
|
-
children: [
|
|
25
|
-
{
|
|
26
|
-
href: string;
|
|
27
|
-
external: boolean;
|
|
28
|
-
icon: string;
|
|
29
|
-
iconify: string | null;
|
|
30
|
-
name: string;
|
|
31
|
-
slug: string;
|
|
32
|
-
redDot: [
|
|
33
|
-
{
|
|
34
|
-
start: string;
|
|
35
|
-
end: string;
|
|
36
|
-
}
|
|
37
|
-
];
|
|
38
|
-
}
|
|
39
|
-
];
|
|
40
|
-
}
|
|
41
|
-
interface DataSideBarLink {
|
|
42
|
-
feature: dataType[];
|
|
43
|
-
category: dataType[];
|
|
44
|
-
lainnya: dataType[];
|
|
45
|
-
}
|
|
2
|
+
import { DataExternalLink, DataSideBarLink } from './SidebarDataController.js';
|
|
46
3
|
export declare class KompasMenuSideBar extends LitElement {
|
|
47
|
-
hasSlotContent: boolean;
|
|
48
|
-
shadowRoot: any;
|
|
49
|
-
firstUpdated(): void;
|
|
50
4
|
static styles: import("lit").CSSResult[];
|
|
51
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Props
|
|
7
|
+
* property kompasProSubscription untuk menghandle apakah user sudah login atau belum
|
|
8
|
+
*/
|
|
52
9
|
isDark: boolean;
|
|
53
|
-
|
|
54
|
-
|
|
10
|
+
isProductionMode: boolean;
|
|
11
|
+
subscriptionPackage: string;
|
|
12
|
+
dataExternal: DataExternalLink[];
|
|
55
13
|
dataSidebar: DataSideBarLink;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
private
|
|
14
|
+
showNavBar: boolean;
|
|
15
|
+
expandedSlug: string | null;
|
|
16
|
+
hasSlotContent: boolean;
|
|
17
|
+
connectedCallback(): Promise<void>;
|
|
18
|
+
private hasKompasOnePackage;
|
|
19
|
+
private hasKompasProPackage;
|
|
20
|
+
private filterBundles;
|
|
21
|
+
private loadData;
|
|
22
|
+
private toggleNavSidebar;
|
|
23
|
+
private rubricClicked;
|
|
24
|
+
private hasChildren;
|
|
64
25
|
private toggleChildren;
|
|
65
|
-
private
|
|
66
|
-
|
|
26
|
+
private renderItem;
|
|
27
|
+
private renderSection;
|
|
28
|
+
private renderChips;
|
|
67
29
|
render(): import("lit-html").TemplateResult<1>;
|
|
68
30
|
}
|
|
69
|
-
export {};
|