@kompasid/lit-web-components 0.9.4 → 0.9.11
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/.yarnrc.yml +1 -0
- package/demo/index.html +6 -1
- package/dist/assets/font-awesome.d.ts +2 -2
- package/dist/src/components/kompasid-footer/KompasFooter.d.ts +1 -1
- package/dist/src/components/kompasid-freewall/KompasFreewall.d.ts +1 -1
- package/dist/src/components/kompasid-freewall-body/KompasFreewallBody.d.ts +1 -1
- package/dist/src/components/kompasid-freewall-head/KompasFreewallHead.d.ts +1 -1
- package/dist/src/components/kompasid-grace-period/KompasGracePeriod.d.ts +1 -1
- package/dist/src/components/kompasid-header-account/KompasHeaderAccount.d.ts +1 -1
- package/dist/src/components/kompasid-header-account-help-center/KompasHeaderAccountHelpCenter.d.ts +1 -1
- package/dist/src/components/kompasid-header-account-menu/KompasHeaderAccountMenu.d.ts +1 -1
- package/dist/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.d.ts +1 -1
- package/dist/src/components/kompasid-header-notification/KompasHeaderNotification.d.ts +1 -1
- package/dist/src/components/kompasid-menu-side-bar/KompasMenuSideBar.d.ts +5 -2
- package/dist/src/components/kompasid-menu-side-bar/KompasMenuSideBar.js +47 -33
- package/dist/src/components/kompasid-menu-side-bar/KompasMenuSideBar.js.map +1 -1
- package/dist/src/components/kompasid-metered-paywall/KompasMeteredPaywall.d.ts +1 -1
- package/dist/src/components/kompasid-metered-paywall/KompasMeteredPaywall.js +19 -17
- package/dist/src/components/kompasid-metered-paywall/KompasMeteredPaywall.js.map +1 -1
- package/dist/src/components/kompasid-metered-wall-register/KompasMeteredWallRegister.d.ts +1 -1
- package/dist/src/components/kompasid-paywall/KompasPaywall.d.ts +1 -1
- package/dist/src/components/kompasid-paywall-banner-registration/KompasPaywallBannerRegistration.d.ts +1 -1
- package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.d.ts +1 -1
- package/dist/src/components/kompasid-paywall-information-header/KompasPaywallInformationHeader.d.ts +1 -1
- package/dist/src/components/kompasid-paywall-video/KompasPaywallVideo.d.ts +1 -1
- package/dist/src/components/kompasid-widget-recirculations-default/KompasWidgetRecirculationsDefault.d.ts +3 -3
- package/dist/src/components/kompasid-widget-recirculations-list/KompasWidgetRecirculationsList.d.ts +2 -2
- package/dist/src/utils/IntersectionObserver.d.ts +1 -1
- package/dist/tailwind/tailwind.js +220 -249
- package/dist/tailwind/tailwind.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/kompasid-menu-side-bar/KompasMenuSideBar.ts +80 -33
- package/src/components/kompasid-metered-paywall/KompasMeteredPaywall.ts +21 -18
- package/tailwind/tailwind.css +216 -241
- package/tailwind/tailwind.ts +220 -249
package/.yarnrc.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
nodeLinker: node-modules
|
package/demo/index.html
CHANGED
|
@@ -197,7 +197,12 @@
|
|
|
197
197
|
apiSlug="popular-article"
|
|
198
198
|
>
|
|
199
199
|
</kompasid-widget-recirculations-list>
|
|
200
|
-
<
|
|
200
|
+
<div style="justify-content: space-between; display: flex; width: 100%;">
|
|
201
|
+
<kompasid-menu-side-bar></kompasid-menu-side-bar>
|
|
202
|
+
<kompasid-menu-side-bar>
|
|
203
|
+
<button>Slot ini</button>
|
|
204
|
+
</kompasid-menu-side-bar>
|
|
205
|
+
</div>
|
|
201
206
|
|
|
202
207
|
<kompasid-widget-recirculations-list
|
|
203
208
|
widgetTitle="Terbaru"
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const faArrowLeft: import("lit").TemplateResult<1>;
|
|
2
|
-
export declare const faCheck: () => import("lit").TemplateResult<1>;
|
|
1
|
+
export declare const faArrowLeft: import("lit-html").TemplateResult<1>;
|
|
2
|
+
export declare const faCheck: () => import("lit-html").TemplateResult<1>;
|
|
@@ -64,5 +64,5 @@ export declare class KompasGracePeriod extends LitElement {
|
|
|
64
64
|
private dataLayeronGracePeriod;
|
|
65
65
|
private gracePeriodTemplate;
|
|
66
66
|
connectedCallback(): Promise<void>;
|
|
67
|
-
render(): import("lit").TemplateResult<1>;
|
|
67
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
68
68
|
}
|
|
@@ -37,5 +37,5 @@ export declare class KompasHeaderAccountProfile extends LitElement {
|
|
|
37
37
|
private renderSkeletonLoading;
|
|
38
38
|
private renderProfileContent;
|
|
39
39
|
connectedCallback(): Promise<void>;
|
|
40
|
-
render(): import("lit").TemplateResult<1>;
|
|
40
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
41
41
|
}
|
|
@@ -43,6 +43,9 @@ interface DataSideBarLink {
|
|
|
43
43
|
category: dataType[];
|
|
44
44
|
}
|
|
45
45
|
export declare class KompasMenuSideBar extends LitElement {
|
|
46
|
+
hasSlotContent: boolean;
|
|
47
|
+
shadowRoot: any;
|
|
48
|
+
firstUpdated(): void;
|
|
46
49
|
static styles: import("lit").CSSResult[];
|
|
47
50
|
dataExternal: DataExternalLink[];
|
|
48
51
|
isDark: boolean;
|
|
@@ -50,7 +53,7 @@ export declare class KompasMenuSideBar extends LitElement {
|
|
|
50
53
|
handleFetchError(error: unknown): void;
|
|
51
54
|
dataSidebar: DataSideBarLink;
|
|
52
55
|
fetchExternal(): Promise<void>;
|
|
53
|
-
renderChips(): import("lit").TemplateResult<1>[];
|
|
56
|
+
renderChips(): import("lit-html").TemplateResult<1>[];
|
|
54
57
|
hasChildren(item: any): boolean;
|
|
55
58
|
rubricClicked(item: {
|
|
56
59
|
name: string;
|
|
@@ -60,6 +63,6 @@ export declare class KompasMenuSideBar extends LitElement {
|
|
|
60
63
|
private toggleChildren;
|
|
61
64
|
private showNavBar;
|
|
62
65
|
toggleNavSidebar: (e: Event) => void;
|
|
63
|
-
render(): import("lit").TemplateResult<1>;
|
|
66
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
64
67
|
}
|
|
65
68
|
export {};
|
|
@@ -10,6 +10,7 @@ import { timedContent } from '../../utils/timedContent.js';
|
|
|
10
10
|
let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
|
+
this.hasSlotContent = false;
|
|
13
14
|
this.dataExternal = [];
|
|
14
15
|
this.isDark = false;
|
|
15
16
|
this.dataSidebar = {
|
|
@@ -23,6 +24,12 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
23
24
|
this.showNavBar = !this.showNavBar;
|
|
24
25
|
};
|
|
25
26
|
}
|
|
27
|
+
firstUpdated() {
|
|
28
|
+
var _a;
|
|
29
|
+
const slot = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('slot');
|
|
30
|
+
const assignedNodes = slot.assignedNodes({ flatten: true });
|
|
31
|
+
this.hasSlotContent = assignedNodes.length > 0;
|
|
32
|
+
}
|
|
26
33
|
async connectedCallback() {
|
|
27
34
|
super.connectedCallback();
|
|
28
35
|
try {
|
|
@@ -165,7 +172,7 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
165
172
|
class="py-0.5 px-1.5 rounded-full"
|
|
166
173
|
style="position: relative; display: inline-flex; background-color:#D71920;"
|
|
167
174
|
>
|
|
168
|
-
<span class="font-bold font-sans text-xs text-white capitalize"
|
|
175
|
+
<span class="font-bold font-pt-sans text-xs text-white capitalize"
|
|
169
176
|
>Baru</span
|
|
170
177
|
>
|
|
171
178
|
</div>
|
|
@@ -195,21 +202,26 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
195
202
|
class="w-fit flex items-center justify-center cursor-pointer relative"
|
|
196
203
|
@click=${this.toggleNavSidebar}
|
|
197
204
|
>
|
|
198
|
-
<
|
|
199
|
-
|
|
200
|
-
?
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
205
|
+
<slot></slot>
|
|
206
|
+
${!this.hasSlotContent
|
|
207
|
+
? html `
|
|
208
|
+
<div
|
|
209
|
+
class="h-4 inline-flex ${this.isDark
|
|
210
|
+
? 'text-[#FFFFFF]'
|
|
211
|
+
: 'text-brand-1'}"
|
|
212
|
+
>
|
|
213
|
+
${unsafeSVG(getFontAwesomeIcon('fas', 'bars'))}
|
|
214
|
+
</div>
|
|
215
|
+
<span
|
|
216
|
+
class="font-pt-sans hidden sm:inline ml-2 tracking-wide font-bold ${this
|
|
217
|
+
.isDark
|
|
218
|
+
? 'text-[#FFFFFF]'
|
|
219
|
+
: 'text-brand-1'}"
|
|
220
|
+
>
|
|
221
|
+
Menu
|
|
222
|
+
</span>
|
|
223
|
+
`
|
|
224
|
+
: ''}
|
|
213
225
|
</div>
|
|
214
226
|
<!-- Side Menu -->
|
|
215
227
|
<nav
|
|
@@ -239,10 +251,10 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
239
251
|
/>
|
|
240
252
|
</a>
|
|
241
253
|
<span
|
|
242
|
-
class="bg-[#E1F0FF] text-brand-1 cursor-pointer flex h-10 items-center justify-center rounded text-base w-10
|
|
254
|
+
class="bg-[#E1F0FF] text-brand-1 cursor-pointer flex h-10 items-center justify-center rounded text-base w-10 py-4"
|
|
243
255
|
@click=${this.toggleNavSidebar}
|
|
244
256
|
>
|
|
245
|
-
${unsafeSVG(getFontAwesomeIcon('fa', 'times'))}
|
|
257
|
+
${unsafeSVG(getFontAwesomeIcon('fa', 'times', 12, 12))}
|
|
246
258
|
</span>
|
|
247
259
|
</div>
|
|
248
260
|
<div class="flex flex-wrap px-4 w-full">
|
|
@@ -260,7 +272,9 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
260
272
|
</div>
|
|
261
273
|
`
|
|
262
274
|
: ''}
|
|
263
|
-
<span
|
|
275
|
+
<span
|
|
276
|
+
class="font-pt-sans relative text-xs text-[#666666]"
|
|
277
|
+
>
|
|
264
278
|
${item.name}
|
|
265
279
|
</span>
|
|
266
280
|
<div class="ml-1">
|
|
@@ -276,7 +290,7 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
276
290
|
<div class="flex">
|
|
277
291
|
<div class="flex justify-between flex-col">
|
|
278
292
|
${this.dataSidebar.feature.map(item => html `
|
|
279
|
-
<div class="w-full font-sans">
|
|
293
|
+
<div class="w-full font-pt-sans">
|
|
280
294
|
<!-- Parent item -->
|
|
281
295
|
<div
|
|
282
296
|
class="flex items-center justify-between px-4 text-sm font-medium text-gray-700 transition-all cursor-pointer"
|
|
@@ -288,12 +302,12 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
288
302
|
<div class="flex items-center space-x-3">
|
|
289
303
|
<span
|
|
290
304
|
class="text-xl text-brand-1 h-8 flex items-center
|
|
291
|
-
${item.icon === null ? 'w-
|
|
305
|
+
${item.icon === null ? 'w-8' : 'max-w-max w-8'}"
|
|
292
306
|
>
|
|
293
307
|
${item.icon &&
|
|
294
308
|
Array.isArray(item.icon) &&
|
|
295
309
|
item.icon.length >= 2
|
|
296
|
-
? unsafeSVG(getFontAwesomeIcon(item.icon[0], item.icon[1]))
|
|
310
|
+
? unsafeSVG(getFontAwesomeIcon(item.icon[0], item.icon[1], 20, 20))
|
|
297
311
|
: ''}
|
|
298
312
|
</span>
|
|
299
313
|
<span class="font-bold relative text-[#333] w-full"
|
|
@@ -301,7 +315,7 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
301
315
|
>
|
|
302
316
|
${timedContent(item.redDot[0].start, item.redDot[0].end)
|
|
303
317
|
? html `<span
|
|
304
|
-
class="bg-orange-
|
|
318
|
+
class="bg-orange-400 h-2 relative rounded-full w-2 flex shrink-0 -top-[12px]"
|
|
305
319
|
></span>`
|
|
306
320
|
: ''}
|
|
307
321
|
</div>
|
|
@@ -318,8 +332,8 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
318
332
|
}}
|
|
319
333
|
>
|
|
320
334
|
${this.expandedSlug === item.slug
|
|
321
|
-
? unsafeSVG(getFontAwesomeIcon('fas', 'chevron-up'))
|
|
322
|
-
: unsafeSVG(getFontAwesomeIcon('fas', 'chevron-down'))}
|
|
335
|
+
? unsafeSVG(getFontAwesomeIcon('fas', 'chevron-up', 12, 12))
|
|
336
|
+
: unsafeSVG(getFontAwesomeIcon('fas', 'chevron-down', 12, 12))}
|
|
323
337
|
</span>
|
|
324
338
|
`
|
|
325
339
|
: null}
|
|
@@ -340,7 +354,7 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
340
354
|
${decodeSpecialChars(child.name)}
|
|
341
355
|
${timedContent(child.redDot[0].start, child.redDot[0].end)
|
|
342
356
|
? html `<span
|
|
343
|
-
class="bg-orange-
|
|
357
|
+
class="bg-orange-400 h-2 relative rounded-full w-2 flex shrink-0 -top-[12px]"
|
|
344
358
|
></span>`
|
|
345
359
|
: ''}
|
|
346
360
|
<div></div>
|
|
@@ -359,7 +373,7 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
359
373
|
<div class="flex">
|
|
360
374
|
<div class="w-full flex justify-between flex-col">
|
|
361
375
|
${this.dataSidebar.category.map(item => html `
|
|
362
|
-
<div class="w-full font-sans">
|
|
376
|
+
<div class="w-full font-pt-sans">
|
|
363
377
|
<!-- Parent item -->
|
|
364
378
|
<div
|
|
365
379
|
class="flex items-center justify-between text-sm font-medium px-4 transition-all cursor-pointer"
|
|
@@ -375,7 +389,7 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
375
389
|
${item.icon &&
|
|
376
390
|
Array.isArray(item.icon) &&
|
|
377
391
|
item.icon.length >= 2
|
|
378
|
-
? unsafeSVG(getFontAwesomeIcon(item.icon[0], item.icon[1]))
|
|
392
|
+
? unsafeSVG(getFontAwesomeIcon(item.icon[0], item.icon[1], 20, 20))
|
|
379
393
|
: ''}
|
|
380
394
|
</span>
|
|
381
395
|
<span
|
|
@@ -387,7 +401,7 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
387
401
|
|
|
388
402
|
${timedContent(item.redDot[0].start, item.redDot[0].end)
|
|
389
403
|
? html `<span
|
|
390
|
-
class="bg-orange-
|
|
404
|
+
class="bg-orange-400 h-2 relative rounded-full w-2 flex shrink-0 -top-[12px]"
|
|
391
405
|
></span>`
|
|
392
406
|
: ''}
|
|
393
407
|
</div>
|
|
@@ -397,15 +411,15 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
397
411
|
${this.hasChildren(item)
|
|
398
412
|
? html `
|
|
399
413
|
<span
|
|
400
|
-
class="
|
|
414
|
+
class="bg-[#e1f0ff] flex justify-center items-center rounded my-1 py-4 w-10 h-10 cursor-pointer font-bold text-brand-1"
|
|
401
415
|
@click=${(e) => {
|
|
402
416
|
e.stopPropagation(); // Prevents click from bubbling to parent
|
|
403
417
|
this.toggleChildren(item);
|
|
404
418
|
}}
|
|
405
419
|
>
|
|
406
420
|
${this.expandedSlug === item.slug
|
|
407
|
-
? unsafeSVG(getFontAwesomeIcon('fas', 'chevron-up'))
|
|
408
|
-
: unsafeSVG(getFontAwesomeIcon('fas', 'chevron-down'))}
|
|
421
|
+
? unsafeSVG(getFontAwesomeIcon('fas', 'chevron-up', 12, 12))
|
|
422
|
+
: unsafeSVG(getFontAwesomeIcon('fas', 'chevron-down', 12, 12))}
|
|
409
423
|
</span>
|
|
410
424
|
`
|
|
411
425
|
: null}
|
|
@@ -426,7 +440,7 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
426
440
|
${decodeSpecialChars(child.name)}
|
|
427
441
|
${timedContent(child.redDot[0].start, child.redDot[0].end)
|
|
428
442
|
? html `<span
|
|
429
|
-
class="bg-orange-
|
|
443
|
+
class="bg-orange-400 h-2 relative rounded-full w-2 flex shrink-0 -top-[12px]"
|
|
430
444
|
></span>`
|
|
431
445
|
: ''}
|
|
432
446
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KompasMenuSideBar.js","sourceRoot":"","sources":["../../../../src/components/kompasid-menu-side-bar/KompasMenuSideBar.ts"],"names":[],"mappings":";AAAA,0DAA0D;AAC1D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAgDnD,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,UAAU;IAA1C;;QAuCsB,iBAAY,GAAuB,EAAE,CAAA;QACnC,WAAM,GAAG,KAAK,CAAA;QAgB3C,gBAAW,GAAoB;YAC7B,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,EAAE;SACb,CAAA;QAsJO,iBAAY,GAAkB,IAAI,CAAA;QAMlC,eAAU,GAAY,KAAK,CAAA;QAEnC,qBAAgB,GAAG,CAAC,CAAQ,EAAE,EAAE;YAC9B,CAAC,CAAC,eAAe,EAAE,CAAA,CAAC,mBAAmB;YACvC,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC,UAAU,CAAA;QACpC,CAAC,CAAA;IAqSH,CAAC;IAvdC,KAAK,CAAC,iBAAiB;QACrB,KAAK,CAAC,iBAAiB,EAAE,CAAA;QACzB,IAAI;YACF,MAAM,IAAI,CAAC,aAAa,EAAE,CAAA;SAC3B;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,CAAC,gBA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Z,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,EACrB,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CACpB;gBACC,CAAC,CAAC,IAAI,CAAA;;iDAEK;gBACX,CAAC,CAAC,EAAE;;;+BAGX,CACF;;yBAEJ;YACH,CAAC,CAAC,EAAE;;iBAET,CACF;;;;;KAKV,CAAA;IACH,CAAC;;AA/fM,wBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkCF;IACD,QAAQ;CACT,CAAA;AAC0B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;uDAAsC;AACnC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;iDAAe;AAyK3C;IADC,KAAK,EAAE;uDACkC;AAM1C;IADC,KAAK,EAAE;qDAC2B;AAvNxB,iBAAiB;IAD7B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,iBAAiB,CAigB7B;SAjgBY,iBAAiB","sourcesContent":["/* eslint-disable lit-a11y/click-events-have-key-events */\nimport { html, css, LitElement } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { unsafeSVG } from 'lit/directives/unsafe-svg.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js'\nimport { decodeSpecialChars } from '../../utils/decodeSpecialChars.js'\nimport { timedContent } from '../../utils/timedContent.js'\n\ninterface DataExternalLink {\n external?: boolean\n gtmClass?: string\n icon: object | null\n iconify: string | null\n isNew: boolean\n name: string\n url: string\n}\n\ninterface dataType {\n href: string\n external?: boolean\n icon: object | null\n iconify: string | null\n name: string\n slug: string\n redDot: [\n {\n start: string\n end: string\n }\n ]\n children: [\n {\n href: string\n external: boolean\n icon: string\n iconify: string | null\n name: string\n slug: string\n redDot: [\n {\n start: string\n end: string\n }\n ]\n }\n ]\n}\ninterface DataSideBarLink {\n feature: dataType[]\n category: dataType[]\n}\n\n@customElement('kompasid-menu-side-bar')\nexport class KompasMenuSideBar extends LitElement {\n static styles = [\n css`\n .slide-side-enter-active,\n .slide-side-leave-active {\n transition: all 0.3s ease-out;\n }\n .slide-side-enter,\n .slide-side-leave-to {\n transform: translateX(-100%);\n }\n /* end: transisi buat sidebar */\n .nuxt-link-exact-active {\n @apply text-brand-1;\n }\n .menu-menu-sidebar {\n z-index: 99999;\n }\n /* Force scrollbar to always show (for debugging) */\n .menu-menu-sidebar::-webkit-scrollbar {\n width: 4px;\n }\n\n .menu-menu-sidebar::-webkit-scrollbar-track {\n background: white;\n }\n\n .menu-menu-sidebar::-webkit-scrollbar-thumb {\n background-color: #00557d; /* Replace with your brand color */\n border-radius: 8px;\n }\n\n .menu-menu-sidebar::-webkit-scrollbar-button,\n .menu-menu-sidebar::-webkit-scrollbar-corner {\n background-color: white;\n }\n `,\n TWStyles,\n ]\n @property({ type: Array }) dataExternal: DataExternalLink[] = []\n @property({ type: Boolean }) isDark = false\n\n async connectedCallback() {\n super.connectedCallback()\n try {\n await this.fetchExternal()\n } catch (error) {\n this.handleFetchError(error)\n }\n }\n handleFetchError(error: unknown) {\n const errorMessage =\n error instanceof Error ? error.message : 'Kesalahan tidak diketahui'\n alert(`Terjadi kesalahan: ${errorMessage}`)\n }\n\n dataSidebar: DataSideBarLink = {\n feature: [],\n category: [],\n }\n async fetchExternal() {\n // External\n const endpointExternal = `https://cdn-www.kompas.id/assets/json/ApiMenuExternalLink.json`\n const response = await fetch(endpointExternal, {\n headers: {\n 'Content-Type': 'application/json',\n },\n })\n const resultExternal = await response.json()\n // eslint-disable-next-line no-undef\n if (!resultExternal || !Array.isArray(resultExternal)) {\n console.error(\n 'Error: resultExternal.result is undefined or not an array',\n resultExternal\n )\n this.dataExternal = [] // Ensure dataExternal is an empty array instead of undefined\n } else {\n this.dataExternal = resultExternal.map(\n (externalLink: Partial<DataExternalLink>) => ({\n external: externalLink.external ?? false,\n gtmClass: externalLink.gtmClass ?? '',\n icon: externalLink.icon ?? null,\n iconify: externalLink.iconify ?? null,\n isNew: externalLink.isNew ?? false,\n name: externalLink.name ?? '',\n url: externalLink.url ?? '',\n })\n )\n }\n // Sidebar\n const endpointSidebar = `https://cdn-www.kompas.id/assets/json/ApiMenuSideV2.json`\n const responseSidebar = await fetch(endpointSidebar, {\n headers: {\n 'Content-Type': 'application/json',\n },\n })\n const resultSidebar = await responseSidebar.json()\n // Validate the structure of the response\n if (!resultSidebar || typeof resultSidebar !== 'object') {\n console.error('Invalid response format:', resultSidebar)\n return\n }\n\n // Convert object to an array\n const sidebarArray = Object.values(resultSidebar)\n const [featureArray, categoryArray] = sidebarArray as [any[], any[]]\n const features: dataType[] =\n featureArray?.map((item: any) => ({\n href: item?.href ?? '',\n external: item?.external ?? false,\n icon: item?.icon ?? null,\n iconify: item?.iconify ?? null,\n name: item?.name ?? '',\n slug: item?.slug ?? '',\n redDot: [\n {\n start: item?.redDot?.start ?? '',\n end: item?.redDot?.end ?? '',\n },\n ],\n children: Array.isArray(item?.children)\n ? item.children.map((child: any) => ({\n href: child?.href ?? '',\n external: child?.external ?? false,\n icon: child?.icon ?? '',\n iconify: child?.iconify ?? '',\n name: child?.name ?? '',\n slug: child?.slug ?? '',\n redDot: [\n {\n start: child?.redDot?.start ?? '',\n end: child?.redDot?.end ?? '',\n },\n ],\n }))\n : [],\n })) ?? []\n\n // Map category data\n const categories: dataType[] =\n categoryArray?.map((item: any) => ({\n href: item?.href ?? '',\n external: item?.external ?? false,\n icon: item?.icon ?? null,\n iconify: item?.iconify ?? null,\n name: item?.name ?? '',\n slug: item?.slug ?? '',\n redDot: [\n {\n start: item?.redDot?.start ?? '',\n end: item?.redDot?.end ?? '',\n },\n ],\n children: Array.isArray(item?.children)\n ? item.children.map((child: any) => ({\n href: child?.href ?? '',\n external: child?.external ?? false,\n icon: child?.icon ?? '',\n iconify: child?.iconify ?? '',\n name: child?.name ?? '',\n slug: child?.slug ?? '',\n redDot: [\n {\n start: child?.redDot?.start ?? '',\n end: child?.redDot?.end ?? '',\n },\n ],\n }))\n : [],\n })) ?? []\n this.dataSidebar = { feature: features, category: categories }\n this.requestUpdate()\n }\n\n renderChips() {\n const chips = []\n chips.push(\n html`\n <div class=\"flex\">\n <div\n class=\"py-0.5 px-1.5 rounded-full\"\n style=\"position: relative; display: inline-flex; background-color:#D71920;\"\n >\n <span class=\"font-bold font-sans text-xs text-white capitalize\"\n >Baru</span\n >\n </div>\n </div>\n `\n )\n return chips\n }\n\n hasChildren(item: any): boolean {\n return Array.isArray(item?.children) && item.children.length > 0\n }\n\n rubricClicked(item: { name: string; href?: string }, event?: Event): void {\n if (event) {\n event.stopPropagation() // Prevent parent click event\n }\n if (item.href) {\n window.location.href = item.href\n }\n\n // add data layer here\n }\n\n @state()\n private expandedSlug: string | null = null\n private toggleChildren(item: any) {\n this.expandedSlug = this.expandedSlug === item.slug ? null : item.slug\n }\n\n @state()\n private showNavBar: boolean = false\n\n toggleNavSidebar = (e: Event) => {\n e.stopPropagation() // prevent bubbling\n this.showNavBar = !this.showNavBar\n }\n\n render() {\n return html`\n <!-- Button Menu -->\n <div\n class=\"w-fit flex items-center justify-center cursor-pointer relative\"\n @click=${this.toggleNavSidebar}\n >\n <div\n class=\"h-4 inline-flex ${this.isDark\n ? 'text-[#FFFFFF]'\n : 'text-brand-1'}\"\n >\n ${unsafeSVG(getFontAwesomeIcon('fas', 'bars'))}\n </div>\n <span\n class=\"font-sans hidden sm:inline ml-2 tracking-wide font-bold ${this\n .isDark\n ? 'text-[#FFFFFF]'\n : 'text-brand-1'}\"\n >\n Menu\n </span>\n </div>\n <!-- Side Menu -->\n <nav\n @click=${this.toggleNavSidebar}\n class=${this.showNavBar\n ? 'fixed left-0 top-0 w-screen z-[100]'\n : 'hidden'}\n >\n <div\n ref=\"toggle-nav-sidebar\"\n class=\"bg-white h-screen menu-menu-sidebar overflow-y-auto pb-20 pt-0 shadow-lg\"\n style=\"width: 312px;\"\n >\n <div\n class=\"bg-[#FFFFFF] flex flex-col items-center justify-center mb-6 w-full\"\n >\n <div\n ref=\"logo-kompas\"\n class=\"flex items-center justify-between px-4 py-6 w-full\"\n >\n <a href=\"/\" class=\"flex h-9 w-9\">\n <img\n src=\"https://cdn-www.kompas.id/assets/img/icons/kompas-icon-gold.svg\"\n alt=\"Kompas.id\"\n scale=\"0\"\n class=\"block w-full\"\n />\n </a>\n <span\n class=\"bg-[#E1F0FF] text-brand-1 cursor-pointer flex h-10 items-center justify-center rounded text-base w-10 p-4\"\n @click=${this.toggleNavSidebar}\n >\n ${unsafeSVG(getFontAwesomeIcon('fa', 'times'))}\n </span>\n </div>\n <div class=\"flex flex-wrap px-4 w-full\">\n ${this.dataExternal.map(\n item => html`\n <a href=\"${item.url}\" class=\"flex w-1/2 no-underline\">\n <div\n class=\"cursor-pointer flex items-center pb-4 w-[312px]\"\n >\n ${item.icon &&\n Array.isArray(item.icon) &&\n item.icon.length >= 2\n ? html`\n <div class=\"flex mr-2 text-brand-1\">\n ${unsafeSVG(\n getFontAwesomeIcon(item.icon[0], item.icon[1])\n )}\n </div>\n `\n : ''}\n <span class=\"font-sans relative text-xs text-[#666666]\">\n ${item.name}\n </span>\n <div class=\"ml-1\">\n ${item.isNew ? this.renderChips() : ''}\n </div>\n </div>\n </a>\n `\n )}\n </div>\n </div>\n <div class=\"border-b border-[#DDD] m-6 \"></div>\n <!-- feature -->\n <div class=\"flex\">\n <div class=\"flex justify-between flex-col\">\n ${this.dataSidebar.feature.map(\n item => html`\n <div class=\"w-full font-sans\">\n <!-- Parent item -->\n <div\n class=\"flex items-center justify-between px-4 text-sm font-medium text-gray-700 transition-all cursor-pointer\"\n @click=${(e: Event) => this.rubricClicked(item, e)}\n >\n <div\n class=\"w-[216px] hover:bg-[#f3f4f6] rounded h-12 flex items-center\"\n >\n <div class=\"flex items-center space-x-3\">\n <span\n class=\"text-xl text-brand-1 h-8 flex items-center \n ${item.icon === null ? 'w-6' : 'max-w-max w-8'}\"\n >\n ${item.icon &&\n Array.isArray(item.icon) &&\n item.icon.length >= 2\n ? unsafeSVG(\n getFontAwesomeIcon(item.icon[0], item.icon[1])\n )\n : ''}\n </span>\n <span class=\"font-bold relative text-[#333] w-full\"\n >${decodeSpecialChars(item.name)}</span\n >\n ${timedContent(\n item.redDot[0].start,\n item.redDot[0].end\n )\n ? html`<span\n class=\"bg-orange-600 h-2 relative rounded-full w-2 -top-[12px]\"\n ></span>`\n : ''}\n </div>\n </div>\n\n <!-- Toggle chevron -->\n ${this.hasChildren(item)\n ? html`\n <span\n class=\"text-xs text-brand-1 bg-[#e1f0ff] flex justify-center items-center rounded my-1 p-4 w-10 h-10 cursor-pointer\"\n @click=${(e: Event) => {\n e.stopPropagation() // Prevents click from bubbling to parent\n this.toggleChildren(item)\n }}\n >\n ${this.expandedSlug === item.slug\n ? unsafeSVG(\n getFontAwesomeIcon('fas', 'chevron-up')\n )\n : unsafeSVG(\n getFontAwesomeIcon('fas', 'chevron-down')\n )}\n </span>\n `\n : null}\n </div>\n\n <!-- Children items -->\n ${this.hasChildren(item) && this.expandedSlug === item.slug\n ? html`\n <div class=\"pl-14 pt-1 pb-2 space-y-1\">\n ${item.children.map(\n child => html`\n <div\n class=\"flex items-center text-sm text-[#333] px-4 cursor-pointer transition-all\"\n @click=${() => this.rubricClicked(child)}\n >\n <div\n class=\"w-[216px] hover:bg-[#f3f4f6] rounded h-12 flex items-center pl-11\"\n >\n ${decodeSpecialChars(child.name)}\n ${timedContent(\n child.redDot[0].start,\n child.redDot[0].end\n )\n ? html`<span\n class=\"bg-orange-600 h-2 relative rounded-full w-2 -top-[12px]\"\n ></span>`\n : ''}\n <div></div>\n </div>\n </div>\n `\n )}\n </div>\n `\n : ''}\n </div>\n `\n )}\n </div>\n </div>\n <div class=\"border-b border-[#DDD] m-6 \"></div>\n <!-- category -->\n <div class=\"flex\">\n <div class=\"w-full flex justify-between flex-col\">\n ${this.dataSidebar.category.map(\n item => html`\n <div class=\"w-full font-sans\">\n <!-- Parent item -->\n <div\n class=\"flex items-center justify-between text-sm font-medium px-4 transition-all cursor-pointer\"\n @click=${(e: Event) => this.rubricClicked(item, e)}\n >\n <div\n class=\"w-[216px] hover:bg-[#f3f4f6] rounded h-12 flex items-center\"\n >\n <div class=\"flex items-center space-x-3\">\n <span\n class=\"text-xl text-brand-1 max-w-max w-8 h-8 flex items-center\"\n >\n ${item.icon &&\n Array.isArray(item.icon) &&\n item.icon.length >= 2\n ? unsafeSVG(\n getFontAwesomeIcon(item.icon[0], item.icon[1])\n )\n : ''}\n </span>\n <span\n class=\"font-bold ${item.name === 'Beranda'\n ? 'text-[#00559a]'\n : 'text-[#333] w-full'}\"\n >${decodeSpecialChars(item.name)}</span\n >\n\n ${timedContent(\n item.redDot[0].start,\n item.redDot[0].end\n )\n ? html`<span\n class=\"bg-orange-600 h-2 relative rounded-full w-2 -top-[12px]\"\n ></span>`\n : ''}\n </div>\n </div>\n\n <!-- Toggle chevron -->\n ${this.hasChildren(item)\n ? html`\n <span\n class=\"text-xs bg-[#e1f0ff] flex justify-center items-center rounded my-1 p-4 w-10 h-10 cursor-pointer font-bold text-brand-1\"\n @click=${(e: Event) => {\n e.stopPropagation() // Prevents click from bubbling to parent\n this.toggleChildren(item)\n }}\n >\n ${this.expandedSlug === item.slug\n ? unsafeSVG(\n getFontAwesomeIcon('fas', 'chevron-up')\n )\n : unsafeSVG(\n getFontAwesomeIcon('fas', 'chevron-down')\n )}\n </span>\n `\n : null}\n </div>\n\n <!-- Children items -->\n ${this.hasChildren(item) && this.expandedSlug === item.slug\n ? html`\n <div class=\"pt-1 pb-2 space-y-1\">\n ${item.children.map(\n child => html`\n <div\n class=\"flex items-center text-sm text-[#333] px-4 cursor-pointer transition-all\"\n @click=${() => this.rubricClicked(child)}\n >\n <div\n class=\"w-[216px] hover:bg-[#f3f4f6] rounded h-12 flex items-center pl-11\"\n >\n ${decodeSpecialChars(child.name)}\n ${timedContent(\n child.redDot[0].start,\n child.redDot[0].end\n )\n ? html`<span\n class=\"bg-orange-600 h-2 relative rounded-full w-2 -top-[12px]\"\n ></span>`\n : ''}\n </div>\n </div>\n `\n )}\n </div>\n `\n : ''}\n </div>\n `\n )}\n </div>\n </div>\n </div>\n </nav>\n `\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"KompasMenuSideBar.js","sourceRoot":"","sources":["../../../../src/components/kompasid-menu-side-bar/KompasMenuSideBar.ts"],"names":[],"mappings":";AAAA,0DAA0D;AAC1D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAgDnD,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,UAAU;IAA1C;;QACL,mBAAc,GAAG,KAAK,CAAA;QAgDK,iBAAY,GAAuB,EAAE,CAAA;QACnC,WAAM,GAAG,KAAK,CAAA;QAgB3C,gBAAW,GAAoB;YAC7B,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,EAAE;SACb,CAAA;QAsJO,iBAAY,GAAkB,IAAI,CAAA;QAMlC,eAAU,GAAY,KAAK,CAAA;QAEnC,qBAAgB,GAAG,CAAC,CAAQ,EAAE,EAAE;YAC9B,CAAC,CAAC,eAAe,EAAE,CAAA,CAAC,mBAAmB;YACvC,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC,UAAU,CAAA;QACpC,CAAC,CAAA;IA0UH,CAAC;IA5iBC,YAAY;;QACV,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;AAjOxB,iBAAiB;IAD7B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,iBAAiB,CAgjB7B;SAhjBY,iBAAiB","sourcesContent":["/* eslint-disable lit-a11y/click-events-have-key-events */\nimport { html, css, LitElement } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { unsafeSVG } from 'lit/directives/unsafe-svg.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js'\nimport { decodeSpecialChars } from '../../utils/decodeSpecialChars.js'\nimport { timedContent } from '../../utils/timedContent.js'\n\ninterface DataExternalLink {\n external?: boolean\n gtmClass?: string\n icon: object | null\n iconify: string | null\n isNew: boolean\n name: string\n url: string\n}\n\ninterface dataType {\n href: string\n external?: boolean\n icon: object | null\n iconify: string | null\n name: string\n slug: string\n redDot: [\n {\n start: string\n end: string\n }\n ]\n children: [\n {\n href: string\n external: boolean\n icon: string\n iconify: string | null\n name: string\n slug: string\n redDot: [\n {\n start: string\n end: string\n }\n ]\n }\n ]\n}\ninterface DataSideBarLink {\n feature: dataType[]\n category: dataType[]\n}\n\n@customElement('kompasid-menu-side-bar')\nexport class KompasMenuSideBar extends LitElement {\n hasSlotContent = false\n shadowRoot: any\n\n firstUpdated() {\n const slot = this.shadowRoot?.querySelector('slot')\n const assignedNodes = slot!.assignedNodes({ flatten: true })\n\n this.hasSlotContent = assignedNodes.length > 0\n }\n\n static styles = [\n css`\n .slide-side-enter-active,\n .slide-side-leave-active {\n transition: all 0.3s ease-out;\n }\n .slide-side-enter,\n .slide-side-leave-to {\n transform: translateX(-100%);\n }\n /* end: transisi buat sidebar */\n .nuxt-link-exact-active {\n @apply text-brand-1;\n }\n .menu-menu-sidebar {\n z-index: 99999;\n }\n /* Force scrollbar to always show (for debugging) */\n .menu-menu-sidebar::-webkit-scrollbar {\n width: 4px;\n }\n\n .menu-menu-sidebar::-webkit-scrollbar-track {\n background: white;\n }\n\n .menu-menu-sidebar::-webkit-scrollbar-thumb {\n background-color: #00557d; /* Replace with your brand color */\n border-radius: 8px;\n }\n\n .menu-menu-sidebar::-webkit-scrollbar-button,\n .menu-menu-sidebar::-webkit-scrollbar-corner {\n background-color: white;\n }\n `,\n TWStyles,\n ]\n @property({ type: Array }) dataExternal: DataExternalLink[] = []\n @property({ type: Boolean }) isDark = false\n\n async connectedCallback() {\n super.connectedCallback()\n try {\n await this.fetchExternal()\n } catch (error) {\n this.handleFetchError(error)\n }\n }\n handleFetchError(error: unknown) {\n const errorMessage =\n error instanceof Error ? error.message : 'Kesalahan tidak diketahui'\n alert(`Terjadi kesalahan: ${errorMessage}`)\n }\n\n dataSidebar: DataSideBarLink = {\n feature: [],\n category: [],\n }\n async fetchExternal() {\n // External\n const endpointExternal = `https://cdn-www.kompas.id/assets/json/ApiMenuExternalLink.json`\n const response = await fetch(endpointExternal, {\n headers: {\n 'Content-Type': 'application/json',\n },\n })\n const resultExternal = await response.json()\n // eslint-disable-next-line no-undef\n if (!resultExternal || !Array.isArray(resultExternal)) {\n console.error(\n 'Error: resultExternal.result is undefined or not an array',\n resultExternal\n )\n this.dataExternal = [] // Ensure dataExternal is an empty array instead of undefined\n } else {\n this.dataExternal = resultExternal.map(\n (externalLink: Partial<DataExternalLink>) => ({\n external: externalLink.external ?? false,\n gtmClass: externalLink.gtmClass ?? '',\n icon: externalLink.icon ?? null,\n iconify: externalLink.iconify ?? null,\n isNew: externalLink.isNew ?? false,\n name: externalLink.name ?? '',\n url: externalLink.url ?? '',\n })\n )\n }\n // Sidebar\n const endpointSidebar = `https://cdn-www.kompas.id/assets/json/ApiMenuSideV2.json`\n const responseSidebar = await fetch(endpointSidebar, {\n headers: {\n 'Content-Type': 'application/json',\n },\n })\n const resultSidebar = await responseSidebar.json()\n // Validate the structure of the response\n if (!resultSidebar || typeof resultSidebar !== 'object') {\n console.error('Invalid response format:', resultSidebar)\n return\n }\n\n // Convert object to an array\n const sidebarArray = Object.values(resultSidebar)\n const [featureArray, categoryArray] = sidebarArray as [any[], any[]]\n const features: dataType[] =\n featureArray?.map((item: any) => ({\n href: item?.href ?? '',\n external: item?.external ?? false,\n icon: item?.icon ?? null,\n iconify: item?.iconify ?? null,\n name: item?.name ?? '',\n slug: item?.slug ?? '',\n redDot: [\n {\n start: item?.redDot?.start ?? '',\n end: item?.redDot?.end ?? '',\n },\n ],\n children: Array.isArray(item?.children)\n ? item.children.map((child: any) => ({\n href: child?.href ?? '',\n external: child?.external ?? false,\n icon: child?.icon ?? '',\n iconify: child?.iconify ?? '',\n name: child?.name ?? '',\n slug: child?.slug ?? '',\n redDot: [\n {\n start: child?.redDot?.start ?? '',\n end: child?.redDot?.end ?? '',\n },\n ],\n }))\n : [],\n })) ?? []\n\n // Map category data\n const categories: dataType[] =\n categoryArray?.map((item: any) => ({\n href: item?.href ?? '',\n external: item?.external ?? false,\n icon: item?.icon ?? null,\n iconify: item?.iconify ?? null,\n name: item?.name ?? '',\n slug: item?.slug ?? '',\n redDot: [\n {\n start: item?.redDot?.start ?? '',\n end: item?.redDot?.end ?? '',\n },\n ],\n children: Array.isArray(item?.children)\n ? item.children.map((child: any) => ({\n href: child?.href ?? '',\n external: child?.external ?? false,\n icon: child?.icon ?? '',\n iconify: child?.iconify ?? '',\n name: child?.name ?? '',\n slug: child?.slug ?? '',\n redDot: [\n {\n start: child?.redDot?.start ?? '',\n end: child?.redDot?.end ?? '',\n },\n ],\n }))\n : [],\n })) ?? []\n this.dataSidebar = { feature: features, category: categories }\n this.requestUpdate()\n }\n\n renderChips() {\n const chips = []\n chips.push(\n html`\n <div class=\"flex\">\n <div\n class=\"py-0.5 px-1.5 rounded-full\"\n style=\"position: relative; display: inline-flex; background-color:#D71920;\"\n >\n <span class=\"font-bold font-pt-sans text-xs text-white capitalize\"\n >Baru</span\n >\n </div>\n </div>\n `\n )\n return chips\n }\n\n hasChildren(item: any): boolean {\n return Array.isArray(item?.children) && item.children.length > 0\n }\n\n rubricClicked(item: { name: string; href?: string }, event?: Event): void {\n if (event) {\n event.stopPropagation() // Prevent parent click event\n }\n if (item.href) {\n window.location.href = item.href\n }\n\n // add data layer here\n }\n\n @state()\n private expandedSlug: string | null = null\n private toggleChildren(item: any) {\n this.expandedSlug = this.expandedSlug === item.slug ? null : item.slug\n }\n\n @state()\n private showNavBar: boolean = false\n\n toggleNavSidebar = (e: Event) => {\n e.stopPropagation() // prevent bubbling\n this.showNavBar = !this.showNavBar\n }\n\n render() {\n return html`\n <!-- Button Menu -->\n <div\n class=\"w-fit flex items-center justify-center cursor-pointer relative\"\n @click=${this.toggleNavSidebar}\n >\n <slot></slot>\n ${!this.hasSlotContent\n ? html`\n <div\n class=\"h-4 inline-flex ${this.isDark\n ? 'text-[#FFFFFF]'\n : 'text-brand-1'}\"\n >\n ${unsafeSVG(getFontAwesomeIcon('fas', 'bars'))}\n </div>\n <span\n class=\"font-pt-sans hidden sm:inline ml-2 tracking-wide font-bold ${this\n .isDark\n ? 'text-[#FFFFFF]'\n : 'text-brand-1'}\"\n >\n Menu\n </span>\n `\n : ''}\n </div>\n <!-- Side Menu -->\n <nav\n @click=${this.toggleNavSidebar}\n class=${this.showNavBar\n ? 'fixed left-0 top-0 w-screen z-[100]'\n : 'hidden'}\n >\n <div\n ref=\"toggle-nav-sidebar\"\n class=\"bg-white h-screen menu-menu-sidebar overflow-y-auto pb-20 pt-0 shadow-lg\"\n style=\"width: 312px;\"\n >\n <div\n class=\"bg-[#FFFFFF] flex flex-col items-center justify-center mb-6 w-full\"\n >\n <div\n ref=\"logo-kompas\"\n class=\"flex items-center justify-between px-4 py-6 w-full\"\n >\n <a href=\"/\" class=\"flex h-9 w-9\">\n <img\n src=\"https://cdn-www.kompas.id/assets/img/icons/kompas-icon-gold.svg\"\n alt=\"Kompas.id\"\n scale=\"0\"\n class=\"block w-full\"\n />\n </a>\n <span\n class=\"bg-[#E1F0FF] text-brand-1 cursor-pointer flex h-10 items-center justify-center rounded text-base w-10 py-4\"\n @click=${this.toggleNavSidebar}\n >\n ${unsafeSVG(getFontAwesomeIcon('fa', 'times', 12, 12))}\n </span>\n </div>\n <div class=\"flex flex-wrap px-4 w-full\">\n ${this.dataExternal.map(\n item => html`\n <a href=\"${item.url}\" class=\"flex w-1/2 no-underline\">\n <div\n class=\"cursor-pointer flex items-center pb-4 w-[312px]\"\n >\n ${item.icon &&\n Array.isArray(item.icon) &&\n item.icon.length >= 2\n ? html`\n <div class=\"flex mr-2 text-brand-1\">\n ${unsafeSVG(\n getFontAwesomeIcon(item.icon[0], item.icon[1])\n )}\n </div>\n `\n : ''}\n <span\n class=\"font-pt-sans relative text-xs text-[#666666]\"\n >\n ${item.name}\n </span>\n <div class=\"ml-1\">\n ${item.isNew ? this.renderChips() : ''}\n </div>\n </div>\n </a>\n `\n )}\n </div>\n </div>\n <div class=\"border-b border-[#DDD] m-6 \"></div>\n <!-- feature -->\n <div class=\"flex\">\n <div class=\"flex justify-between flex-col\">\n ${this.dataSidebar.feature.map(\n item => html`\n <div class=\"w-full font-pt-sans\">\n <!-- Parent item -->\n <div\n class=\"flex items-center justify-between px-4 text-sm font-medium text-gray-700 transition-all cursor-pointer\"\n @click=${(e: Event) => this.rubricClicked(item, e)}\n >\n <div\n class=\"w-[216px] hover:bg-[#f3f4f6] rounded h-12 flex items-center\"\n >\n <div class=\"flex items-center space-x-3\">\n <span\n class=\"text-xl text-brand-1 h-8 flex items-center \n ${item.icon === null ? 'w-8' : 'max-w-max w-8'}\"\n >\n ${item.icon &&\n Array.isArray(item.icon) &&\n item.icon.length >= 2\n ? unsafeSVG(\n getFontAwesomeIcon(\n item.icon[0],\n item.icon[1],\n 20,\n 20\n )\n )\n : ''}\n </span>\n <span class=\"font-bold relative text-[#333] w-full\"\n >${decodeSpecialChars(item.name)}</span\n >\n ${timedContent(\n item.redDot[0].start,\n item.redDot[0].end\n )\n ? html`<span\n class=\"bg-orange-400 h-2 relative rounded-full w-2 flex shrink-0 -top-[12px]\"\n ></span>`\n : ''}\n </div>\n </div>\n\n <!-- Toggle chevron -->\n ${this.hasChildren(item)\n ? html`\n <span\n class=\"text-xs text-brand-1 bg-[#e1f0ff] flex justify-center items-center rounded my-1 p-4 w-10 h-10 cursor-pointer\"\n @click=${(e: Event) => {\n e.stopPropagation() // Prevents click from bubbling to parent\n this.toggleChildren(item)\n }}\n >\n ${this.expandedSlug === item.slug\n ? unsafeSVG(\n getFontAwesomeIcon(\n 'fas',\n 'chevron-up',\n 12,\n 12\n )\n )\n : unsafeSVG(\n getFontAwesomeIcon(\n 'fas',\n 'chevron-down',\n 12,\n 12\n )\n )}\n </span>\n `\n : null}\n </div>\n\n <!-- Children items -->\n ${this.hasChildren(item) && this.expandedSlug === item.slug\n ? html`\n <div class=\"pl-14 pt-1 pb-2 space-y-1\">\n ${item.children.map(\n child => html`\n <div\n class=\"flex items-center text-sm text-[#333] px-4 cursor-pointer transition-all\"\n @click=${() => this.rubricClicked(child)}\n >\n <div\n class=\"w-[216px] hover:bg-[#f3f4f6] rounded h-12 flex items-center pl-11\"\n >\n ${decodeSpecialChars(child.name)}\n ${timedContent(\n child.redDot[0].start,\n child.redDot[0].end\n )\n ? html`<span\n class=\"bg-orange-400 h-2 relative rounded-full w-2 flex shrink-0 -top-[12px]\"\n ></span>`\n : ''}\n <div></div>\n </div>\n </div>\n `\n )}\n </div>\n `\n : ''}\n </div>\n `\n )}\n </div>\n </div>\n <div class=\"border-b border-[#DDD] m-6 \"></div>\n <!-- category -->\n <div class=\"flex\">\n <div class=\"w-full flex justify-between flex-col\">\n ${this.dataSidebar.category.map(\n item => html`\n <div class=\"w-full font-pt-sans\">\n <!-- Parent item -->\n <div\n class=\"flex items-center justify-between text-sm font-medium px-4 transition-all cursor-pointer\"\n @click=${(e: Event) => this.rubricClicked(item, e)}\n >\n <div\n class=\"w-[216px] hover:bg-[#f3f4f6] rounded h-12 flex items-center\"\n >\n <div class=\"flex items-center space-x-3\">\n <span\n class=\"text-xl text-brand-1 max-w-max w-8 h-8 flex items-center\"\n >\n ${item.icon &&\n Array.isArray(item.icon) &&\n item.icon.length >= 2\n ? unsafeSVG(\n getFontAwesomeIcon(\n item.icon[0],\n item.icon[1],\n 20,\n 20\n )\n )\n : ''}\n </span>\n <span\n class=\"font-bold ${item.name === 'Beranda'\n ? 'text-[#00559a]'\n : 'text-[#333] w-full'}\"\n >${decodeSpecialChars(item.name)}</span\n >\n\n ${timedContent(\n item.redDot[0].start,\n item.redDot[0].end\n )\n ? html`<span\n class=\"bg-orange-400 h-2 relative rounded-full w-2 flex shrink-0 -top-[12px]\"\n ></span>`\n : ''}\n </div>\n </div>\n\n <!-- Toggle chevron -->\n ${this.hasChildren(item)\n ? html`\n <span\n class=\"bg-[#e1f0ff] flex justify-center items-center rounded my-1 py-4 w-10 h-10 cursor-pointer font-bold text-brand-1\"\n @click=${(e: Event) => {\n e.stopPropagation() // Prevents click from bubbling to parent\n this.toggleChildren(item)\n }}\n >\n ${this.expandedSlug === item.slug\n ? unsafeSVG(\n getFontAwesomeIcon(\n 'fas',\n 'chevron-up',\n 12,\n 12\n )\n )\n : unsafeSVG(\n getFontAwesomeIcon(\n 'fas',\n 'chevron-down',\n 12,\n 12\n )\n )}\n </span>\n `\n : null}\n </div>\n\n <!-- Children items -->\n ${this.hasChildren(item) && this.expandedSlug === item.slug\n ? html`\n <div class=\"pt-1 pb-2 space-y-1\">\n ${item.children.map(\n child => html`\n <div\n class=\"flex items-center text-sm text-[#333] px-4 cursor-pointer transition-all\"\n @click=${() => this.rubricClicked(child)}\n >\n <div\n class=\"w-[216px] hover:bg-[#f3f4f6] rounded h-12 flex items-center pl-11\"\n >\n ${decodeSpecialChars(child.name)}\n ${timedContent(\n child.redDot[0].start,\n child.redDot[0].end\n )\n ? html`<span\n class=\"bg-orange-400 h-2 relative rounded-full w-2 flex shrink-0 -top-[12px]\"\n ></span>`\n : ''}\n </div>\n </div>\n `\n )}\n </div>\n `\n : ''}\n </div>\n `\n )}\n </div>\n </div>\n </div>\n </nav>\n `\n }\n}\n"]}
|
|
@@ -48,5 +48,5 @@ export declare class KompasMeteredPaywall extends LitElement {
|
|
|
48
48
|
private redirectToBerlangganan;
|
|
49
49
|
private dataLayeronLanggananButton;
|
|
50
50
|
private dataLayeronMeteredPaywall;
|
|
51
|
-
render(): import("lit").TemplateResult<1> | typeof nothing;
|
|
51
|
+
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
52
52
|
}
|
|
@@ -52,23 +52,25 @@ let KompasMeteredPaywall = class KompasMeteredPaywall extends LitElement {
|
|
|
52
52
|
this.tracker_metered_wall_balance = 0;
|
|
53
53
|
}
|
|
54
54
|
getCountdownArticle() {
|
|
55
|
-
const getCountdown = this.countdownArticle
|
|
56
|
-
const { maxQuota } = this
|
|
57
|
-
if (getCountdown > 0 && getCountdown < maxQuota) {
|
|
58
|
-
|
|
59
|
-
<p>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
</p>
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
return html
|
|
67
|
-
|
|
68
|
-
Anda sedang membaca <b>artikel gratis terakhir bulan ini.</b> ${this
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
55
|
+
// const getCountdown = this.countdownArticle
|
|
56
|
+
// const { maxQuota } = this
|
|
57
|
+
// if (getCountdown > 0 && getCountdown < maxQuota) {
|
|
58
|
+
// return html`
|
|
59
|
+
// <p>
|
|
60
|
+
// Anda memiliki sisa
|
|
61
|
+
// <b>${maxQuota - getCountdown} dari ${maxQuota}</b> artikel premium
|
|
62
|
+
// gratis bulan ini. ${this.packageData.subscriptionText}
|
|
63
|
+
// </p>
|
|
64
|
+
// `
|
|
65
|
+
// }
|
|
66
|
+
// return html`
|
|
67
|
+
// <p>
|
|
68
|
+
// Anda sedang membaca <b>artikel gratis terakhir bulan ini.</b> ${this
|
|
69
|
+
// .packageData.subscriptionText}
|
|
70
|
+
// </p>
|
|
71
|
+
// `
|
|
72
|
+
// Handle tanpa kuota
|
|
73
|
+
return html ` <p>${this.packageData.subscriptionText}</p> `;
|
|
72
74
|
}
|
|
73
75
|
connectedCallback() {
|
|
74
76
|
super.connectedCallback();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KompasMeteredPaywall.js","sourceRoot":"","sources":["../../../../src/components/kompasid-metered-paywall/KompasMeteredPaywall.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AAIjD,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,UAAU;IAA7C;;QA+BY,cAAS,GAAY,IAAI,CAAA;QACzB,aAAQ,GAAW,CAAC,CAAA;QACpB,gBAAW,GAAgB;YAC1C,gBAAgB,EAAE,mCAAmC;YACrD,UAAU,EAAE,WAAW;YACvB,eAAe,EACb,8DAA8D;SACjE,CAAA;QAED;;WAEG;QACH;;;;;;;;;;;;;;;;;;WAkBG;QACyB,qBAAgB,GAAG,CAAC,CAAA;QACpB,qBAAgB,GAAG,EAAE,CAAA;QACrB,iCAA4B,GAAG,EAAE,CAAA;QACjC,4BAAuB,GAAG,EAAE,CAAA;QAC5B,+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,sBAAiB,GAAG,EAAE,CAAA;QACtB,gCAA2B,GAAG,EAAE,CAAA;QAChC,wBAAmB,GAAG,EAAE,CAAA;QACxB,8BAAyB,GAAG,EAAE,CAAA;QAC9B,iCAA4B,GAAG,CAAC,CAAA;IAyH9D,CAAC;I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,MAAM,EAAE,CAAC;qEAA6B;AAC5B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wEAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8DAAqB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+DAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gEAAwB;AACvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mEAA2B;AAC1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wEAAgC;AAC/B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kEAA0B;AACzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+DAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yEAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iEAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uEAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0EAAiC;AA7EjD,oBAAoB;IADhC,aAAa,CAAC,0BAA0B,CAAC;GAC7B,oBAAoB,CAsMhC;SAtMY,oBAAoB","sourcesContent":["import { html, css, LitElement, nothing } from 'lit'\nimport { customElement, state, property } from 'lit/decorators.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { PackageData } from './types.js'\n\n@customElement('kompasid-metered-paywall')\nexport class KompasMeteredPaywall extends LitElement {\n static styles = [\n css`\n .text-transition {\n width: 100%;\n height: 5rem;\n }\n\n .body {\n position: sticky;\n top: 0;\n height: 100%;\n width: 100%;\n }\n\n .icon {\n height: 1rem;\n color: #48bb78;\n }\n\n .icon.lg {\n height: 1.5rem;\n }\n\n .icon.lg svg {\n height: 1.5rem;\n }\n `,\n TWStyles,\n ]\n\n @state() private isLoading: Boolean = true\n @state() private maxQuota: number = 3\n @state() private packageData: PackageData = {\n subscriptionText: 'Langganan untuk akses tanpa batas',\n buttonText: 'Langganan',\n subscriptionUrl:\n 'https://www.kompas.id/berlangganan?open_from=Metered_Paywall',\n }\n\n /**\n * Props\n */\n /**\n * prop countdownArticle untuk menghandle sudah berapa artikel gratis yang user baca.\n * prop paywall_location = The location where user encounter the paywall\n * prop paywall_subscription_package = The name of the subscription package viewed by user\n * prop paywall_subscription_id = The ID of the subscription package viewed by user\n * prop paywall_subscription_price = The price of the subscriprtion package viewed by user\n * prop paywall_position = The position of ther subscription package viewed by user\n * prop tracker_page_type = Type of the page\n * prop tracker_content_id = ID of article (slug)\n * prop tracker_content_type = Whether it's free article or paid article\n * prop tracker_content_title = The title of article\n * prop tracker_content_categories = The category of the content\n * prop tracker_user_type = Type of user based on their subscription\n * prop tracker_subscription_status = Status of their subscription\n * prop tracker_page_domain = Page Domain\n * prop tracker_metered_wall_type = The type of Metered Wall\n * prop tracker_epaper_edition = The edition of epaper viewed by user\n * prop tracker_metered_wall_balance = The balance of their metered wall\n */\n @property({ type: Number }) countdownArticle = 0\n @property({ type: String }) paywall_location = ''\n @property({ type: String }) paywall_subscription_package = ''\n @property({ type: String }) paywall_subscription_id = ''\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\n private getCountdownArticle() {\n const getCountdown = this.countdownArticle\n const { maxQuota } = this\n\n if (getCountdown > 0 && getCountdown < maxQuota) {\n return html`\n <p>\n Anda memiliki sisa\n <b>${maxQuota - getCountdown} dari ${maxQuota}</b> artikel premium\n gratis bulan ini. ${this.packageData.subscriptionText}\n </p>\n `\n }\n return html`\n <p>\n Anda sedang membaca <b>artikel gratis terakhir bulan ini.</b> ${this\n .packageData.subscriptionText}\n </p>\n `\n }\n\n override connectedCallback() {\n super.connectedCallback()\n this.getMeteredPaywallData()\n this.dataLayeronMeteredPaywall()\n }\n\n async getMeteredPaywallData() {\n try {\n const response = await fetch(\n 'https://cdn-www.kompas.id/web-component/metered-paywall.json'\n )\n const json = await response.json()\n this.packageData = {\n subscriptionText: json.subscriptionText,\n buttonText: json.buttonText,\n subscriptionUrl: json.subscriptionUrl,\n }\n } catch (error) {\n throw Error('Failed to get metered paywall data')\n } finally {\n this.isLoading = false\n }\n }\n\n private redirectToBerlangganan() {\n this.dataLayeronLanggananButton()\n const { origin, pathname } = window.location\n const referrer = origin + pathname\n window.location.href = `${this.packageData.subscriptionUrl}&referrer=${referrer}`\n }\n\n private dataLayeronLanggananButton() {\n window.dataLayer.push({\n event: 'subscribe_button_clicked',\n paywall_location: this.paywall_location || '',\n paywall_subscription_package: this.paywall_subscription_package || '',\n paywall_subscription_id: this.paywall_subscription_id || '',\n paywall_subscription_price: this.paywall_subscription_price || 0,\n paywall_position: this.paywall_position || 0,\n page_type: this.tracker_page_type,\n content_id: this.tracker_content_id,\n content_title: this.tracker_content_title,\n content_categories: this.tracker_content_categories,\n content_type: this.tracker_content_type,\n user_type: this.tracker_user_type || 'R',\n subscription_status: this.tracker_subscription_status,\n page_domain: this.tracker_page_domain || 'Kompas.id',\n metered_wall_type: this.tracker_metered_wall_type || 'MP',\n metered_wall_balance: this.maxQuota - this.countdownArticle + 1,\n })\n }\n\n private dataLayeronMeteredPaywall() {\n window.dataLayer.push({\n event: 'paywall_viewed',\n paywall_location: this.paywall_location || '',\n paywall_subscription_package: this.paywall_subscription_package || '',\n paywall_subscription_id: this.paywall_subscription_id || '',\n paywall_subscription_price: this.paywall_subscription_price || 0,\n paywall_position: this.paywall_position || 0,\n page_type: this.tracker_page_type,\n content_id: this.tracker_content_id,\n content_title: this.tracker_content_title,\n content_categories: this.tracker_content_categories,\n content_type: this.tracker_content_type,\n user_type: this.tracker_user_type || 'R',\n subscription_status: this.tracker_subscription_status,\n page_domain: this.tracker_page_domain || 'Kompas.id',\n metered_wall_type: this.tracker_metered_wall_type || 'MP',\n metered_wall_balance: this.maxQuota - this.countdownArticle + 1,\n })\n }\n\n render() {\n return !this.isLoading\n ? html`\n <div class=\"sticky bottom-0 w-full h-full\">\n <div\n class=\"flex flex-row w-full bg-blue-100 py-4 justify-center space-x-4 px-4 lg:px-0 bottom-0\"\n >\n <div\n class=\"text-grey-600 text-sm md:text-lg self-center text-left\"\n >\n ${this.getCountdownArticle()}\n </div>\n <div class=\"self-center\">\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 font-sans\"\n >\n ${this.packageData.buttonText}\n </button>\n </div>\n </div>\n </div>\n `\n : nothing\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"KompasMeteredPaywall.js","sourceRoot":"","sources":["../../../../src/components/kompasid-metered-paywall/KompasMeteredPaywall.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AAIjD,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,UAAU;IAA7C;;QA+BY,cAAS,GAAY,IAAI,CAAA;QACzB,aAAQ,GAAW,CA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AAE,MAAM,EAAE,CAAC;+DAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yEAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iEAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uEAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0EAAiC;AA7EjD,oBAAoB;IADhC,aAAa,CAAC,0BAA0B,CAAC;GAC7B,oBAAoB,CAyMhC;SAzMY,oBAAoB","sourcesContent":["import { html, css, LitElement, nothing } from 'lit'\nimport { customElement, state, property } from 'lit/decorators.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { PackageData } from './types.js'\n\n@customElement('kompasid-metered-paywall')\nexport class KompasMeteredPaywall extends LitElement {\n static styles = [\n css`\n .text-transition {\n width: 100%;\n height: 5rem;\n }\n\n .body {\n position: sticky;\n top: 0;\n height: 100%;\n width: 100%;\n }\n\n .icon {\n height: 1rem;\n color: #48bb78;\n }\n\n .icon.lg {\n height: 1.5rem;\n }\n\n .icon.lg svg {\n height: 1.5rem;\n }\n `,\n TWStyles,\n ]\n\n @state() private isLoading: Boolean = true\n @state() private maxQuota: number = 3\n @state() private packageData: PackageData = {\n subscriptionText: 'Langganan untuk akses tanpa batas',\n buttonText: 'Langganan',\n subscriptionUrl:\n 'https://www.kompas.id/berlangganan?open_from=Metered_Paywall',\n }\n\n /**\n * Props\n */\n /**\n * prop countdownArticle untuk menghandle sudah berapa artikel gratis yang user baca.\n * prop paywall_location = The location where user encounter the paywall\n * prop paywall_subscription_package = The name of the subscription package viewed by user\n * prop paywall_subscription_id = The ID of the subscription package viewed by user\n * prop paywall_subscription_price = The price of the subscriprtion package viewed by user\n * prop paywall_position = The position of ther subscription package viewed by user\n * prop tracker_page_type = Type of the page\n * prop tracker_content_id = ID of article (slug)\n * prop tracker_content_type = Whether it's free article or paid article\n * prop tracker_content_title = The title of article\n * prop tracker_content_categories = The category of the content\n * prop tracker_user_type = Type of user based on their subscription\n * prop tracker_subscription_status = Status of their subscription\n * prop tracker_page_domain = Page Domain\n * prop tracker_metered_wall_type = The type of Metered Wall\n * prop tracker_epaper_edition = The edition of epaper viewed by user\n * prop tracker_metered_wall_balance = The balance of their metered wall\n */\n @property({ type: Number }) countdownArticle = 0\n @property({ type: String }) paywall_location = ''\n @property({ type: String }) paywall_subscription_package = ''\n @property({ type: String }) paywall_subscription_id = ''\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\n private getCountdownArticle() {\n // const getCountdown = this.countdownArticle\n // const { maxQuota } = this\n\n // if (getCountdown > 0 && getCountdown < maxQuota) {\n // return html`\n // <p>\n // Anda memiliki sisa\n // <b>${maxQuota - getCountdown} dari ${maxQuota}</b> artikel premium\n // gratis bulan ini. ${this.packageData.subscriptionText}\n // </p>\n // `\n // }\n // return html`\n // <p>\n // Anda sedang membaca <b>artikel gratis terakhir bulan ini.</b> ${this\n // .packageData.subscriptionText}\n // </p>\n // `\n\n // Handle tanpa kuota\n return html` <p>${this.packageData.subscriptionText}</p> `\n }\n\n override connectedCallback() {\n super.connectedCallback()\n this.getMeteredPaywallData()\n this.dataLayeronMeteredPaywall()\n }\n\n async getMeteredPaywallData() {\n try {\n const response = await fetch(\n 'https://cdn-www.kompas.id/web-component/metered-paywall.json'\n )\n const json = await response.json()\n this.packageData = {\n subscriptionText: json.subscriptionText,\n buttonText: json.buttonText,\n subscriptionUrl: json.subscriptionUrl,\n }\n } catch (error) {\n throw Error('Failed to get metered paywall data')\n } finally {\n this.isLoading = false\n }\n }\n\n private redirectToBerlangganan() {\n this.dataLayeronLanggananButton()\n const { origin, pathname } = window.location\n const referrer = origin + pathname\n window.location.href = `${this.packageData.subscriptionUrl}&referrer=${referrer}`\n }\n\n private dataLayeronLanggananButton() {\n window.dataLayer.push({\n event: 'subscribe_button_clicked',\n paywall_location: this.paywall_location || '',\n paywall_subscription_package: this.paywall_subscription_package || '',\n paywall_subscription_id: this.paywall_subscription_id || '',\n paywall_subscription_price: this.paywall_subscription_price || 0,\n paywall_position: this.paywall_position || 0,\n page_type: this.tracker_page_type,\n content_id: this.tracker_content_id,\n content_title: this.tracker_content_title,\n content_categories: this.tracker_content_categories,\n content_type: this.tracker_content_type,\n user_type: this.tracker_user_type || 'R',\n subscription_status: this.tracker_subscription_status,\n page_domain: this.tracker_page_domain || 'Kompas.id',\n metered_wall_type: this.tracker_metered_wall_type || 'MP',\n metered_wall_balance: this.maxQuota - this.countdownArticle + 1,\n })\n }\n\n private dataLayeronMeteredPaywall() {\n window.dataLayer.push({\n event: 'paywall_viewed',\n paywall_location: this.paywall_location || '',\n paywall_subscription_package: this.paywall_subscription_package || '',\n paywall_subscription_id: this.paywall_subscription_id || '',\n paywall_subscription_price: this.paywall_subscription_price || 0,\n paywall_position: this.paywall_position || 0,\n page_type: this.tracker_page_type,\n content_id: this.tracker_content_id,\n content_title: this.tracker_content_title,\n content_categories: this.tracker_content_categories,\n content_type: this.tracker_content_type,\n user_type: this.tracker_user_type || 'R',\n subscription_status: this.tracker_subscription_status,\n page_domain: this.tracker_page_domain || 'Kompas.id',\n metered_wall_type: this.tracker_metered_wall_type || 'MP',\n metered_wall_balance: this.maxQuota - this.countdownArticle + 1,\n })\n }\n\n render() {\n return !this.isLoading\n ? html`\n <div class=\"sticky bottom-0 w-full h-full\">\n <div\n class=\"flex flex-row w-full bg-blue-100 py-4 justify-center space-x-4 px-4 lg:px-0 bottom-0\"\n >\n <div\n class=\"text-grey-600 text-sm md:text-lg self-center text-left\"\n >\n ${this.getCountdownArticle()}\n </div>\n <div class=\"self-center\">\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 font-sans\"\n >\n ${this.packageData.buttonText}\n </button>\n </div>\n </div>\n </div>\n `\n : nothing\n }\n}\n"]}
|