@kompasid/lit-web-components 0.9.10 → 0.9.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/demo/index.html +2 -2
- package/dist/src/components/kompasid-freewall/KompasFreewall.d.ts +9 -24
- package/dist/src/components/kompasid-freewall/KompasFreewall.js +44 -100
- package/dist/src/components/kompasid-freewall/KompasFreewall.js.map +1 -1
- package/dist/src/components/kompasid-freewall/old_KompasFreewall.d.ts +96 -0
- package/dist/src/components/kompasid-freewall/old_KompasFreewall.js +305 -0
- package/dist/src/components/kompasid-freewall/old_KompasFreewall.js.map +1 -0
- package/dist/src/components/kompasid-freewall/types.d.ts +26 -0
- package/dist/src/components/kompasid-freewall/types.js.map +1 -1
- package/dist/src/components/kompasid-freewall-body/KompasFreewallBody.d.ts +9 -14
- package/dist/src/components/kompasid-freewall-body/KompasFreewallBody.js +58 -102
- package/dist/src/components/kompasid-freewall-body/KompasFreewallBody.js.map +1 -1
- package/dist/src/components/kompasid-freewall-body/old_KompasFreewallBody.d.ts +34 -0
- package/dist/src/components/kompasid-freewall-body/old_KompasFreewallBody.js +228 -0
- package/dist/src/components/kompasid-freewall-body/old_KompasFreewallBody.js.map +1 -0
- package/dist/src/components/kompasid-freewall-head/KompasFreewallHead.d.ts +8 -19
- package/dist/src/components/kompasid-freewall-head/KompasFreewallHead.js +33 -52
- package/dist/src/components/kompasid-freewall-head/KompasFreewallHead.js.map +1 -1
- package/dist/src/components/kompasid-freewall-head/old_KompasFreewallHead.d.ts +38 -0
- package/dist/src/components/kompasid-freewall-head/old_KompasFreewallHead.js +125 -0
- package/dist/src/components/kompasid-freewall-head/old_KompasFreewallHead.js.map +1 -0
- package/dist/src/components/kompasid-grace-period/KompasGracePeriod.js +1 -1
- package/dist/src/components/kompasid-grace-period/KompasGracePeriod.js.map +1 -1
- package/dist/src/components/kompasid-menu-side-bar/KompasMenuSideBar.js +10 -13
- package/dist/src/components/kompasid-menu-side-bar/KompasMenuSideBar.js.map +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/tailwind/tailwind.js +50 -10
- package/dist/tailwind/tailwind.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/kompasid-freewall/KompasFreewall.ts +52 -85
- package/src/components/kompasid-freewall/old_KompasFreewall.ts +255 -0
- package/src/components/kompasid-freewall/readme.md +40 -84
- package/src/components/kompasid-freewall/types.ts +29 -0
- package/src/components/kompasid-freewall-body/KompasFreewallBody.ts +59 -101
- package/src/components/kompasid-freewall-body/old_KompasFreewallBody.ts +224 -0
- package/src/components/kompasid-freewall-body/readme.md +31 -7
- package/src/components/kompasid-freewall-head/KompasFreewallHead.ts +31 -39
- package/src/components/kompasid-freewall-head/old_KompasFreewallHead.ts +103 -0
- package/src/components/kompasid-freewall-head/readme.md +29 -13
- package/src/components/kompasid-grace-period/KompasGracePeriod.ts +1 -1
- package/src/components/kompasid-menu-side-bar/KompasMenuSideBar.ts +10 -13
- package/src/components/kompasid-metered-paywall/KompasMeteredPaywall.ts +21 -18
- package/tailwind/tailwind.css +50 -8
- package/tailwind/tailwind.ts +50 -10
- package/tailwind.config.js +1 -1
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { html, css, LitElement, nothing } from 'lit';
|
|
3
|
+
import { property, customElement } from 'lit/decorators.js';
|
|
4
|
+
import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
5
|
+
import { TWStyles } from '../../../tailwind/tailwind.js';
|
|
6
|
+
import { addGoogleFonts } from '../../utils/googleFont.js';
|
|
7
|
+
import { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js';
|
|
8
|
+
let KompasFreewallHead = class KompasFreewallHead extends LitElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
/**
|
|
12
|
+
* Props
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* property isLogin untuk menghandle apakah user sudah login atau belum
|
|
16
|
+
* property type untuk menghandle tipe freewall
|
|
17
|
+
* property head_copy_expand to update copy header when expand
|
|
18
|
+
* property head_copy_collapse to update copy header when collapse
|
|
19
|
+
* property expand to handle expand/collapse
|
|
20
|
+
* property toggleExpand to handle toggle expand/collapse
|
|
21
|
+
* property onSubscriptionClick to handle cta when subscription button is clicked
|
|
22
|
+
*/
|
|
23
|
+
this.isLogin = false;
|
|
24
|
+
this.type = 'article';
|
|
25
|
+
this.head_copy_expand = '';
|
|
26
|
+
this.head_copy_collapse = '';
|
|
27
|
+
this.expand = true;
|
|
28
|
+
this.toggleExpand = () => { };
|
|
29
|
+
this.onSubscriptionClick = () => { };
|
|
30
|
+
this.packageData = {};
|
|
31
|
+
this.jsonPackageData = {};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Getter
|
|
35
|
+
*/
|
|
36
|
+
get headCopy() {
|
|
37
|
+
return ((this.expand ? this.head_copy_expand : this.head_copy_collapse) ||
|
|
38
|
+
'Akses seluruh konten dan fitur Kompas.id dengan berlangganan.');
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Lifecycle
|
|
42
|
+
*/
|
|
43
|
+
async connectedCallback() {
|
|
44
|
+
super.connectedCallback();
|
|
45
|
+
await this.updateComplete;
|
|
46
|
+
addGoogleFonts(['pt-sans']);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Render Statement
|
|
50
|
+
*/
|
|
51
|
+
render() {
|
|
52
|
+
return html `
|
|
53
|
+
<div class="flex flex-col px-4 md:px-0 space-y-4 pt-4 pb-5 md:py-2">
|
|
54
|
+
<div class="flex justify-between items-center h-full">
|
|
55
|
+
<div
|
|
56
|
+
class="hidden ${this.expand ? 'md:block' : 'lg:block'} w-9 h-9"
|
|
57
|
+
></div>
|
|
58
|
+
<div class="flex items-center md:justify-start">
|
|
59
|
+
<p class="w-full text-grey-600">${this.headCopy}</p>
|
|
60
|
+
${!this.expand
|
|
61
|
+
? html `<button
|
|
62
|
+
@click=${this.onSubscriptionClick}
|
|
63
|
+
class="bg-green-500 hidden md:block ml-3 whitespace-nowrap rounded md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-white font-bold leading-[18px]"
|
|
64
|
+
>
|
|
65
|
+
${this.jsonPackageData.subscriptionButtonText}
|
|
66
|
+
</button>`
|
|
67
|
+
: nothing}
|
|
68
|
+
</div>
|
|
69
|
+
<div>
|
|
70
|
+
<button
|
|
71
|
+
@click=${this.toggleExpand}
|
|
72
|
+
aria-label="Toggle Expand"
|
|
73
|
+
class="h-9 w-9 flex ml-2 items-center justify-center text-blue-500 rounded bg-blue-200"
|
|
74
|
+
>
|
|
75
|
+
<div class="${!this.expand && 'rotate-180'}">
|
|
76
|
+
${unsafeSVG(getFontAwesomeIcon('fas', 'chevron-down'))}
|
|
77
|
+
</div>
|
|
78
|
+
</button>
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
${!this.expand
|
|
82
|
+
? html `<button
|
|
83
|
+
@click=${this.onSubscriptionClick}
|
|
84
|
+
class="bg-green-500 block md:hidden whitespace-nowrap rounded md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-white font-bold leading-[18px]"
|
|
85
|
+
>
|
|
86
|
+
${this.jsonPackageData.subscriptionButtonText}
|
|
87
|
+
</button>`
|
|
88
|
+
: nothing}
|
|
89
|
+
</div>
|
|
90
|
+
`;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
KompasFreewallHead.styles = [css ``, TWStyles];
|
|
94
|
+
__decorate([
|
|
95
|
+
property({ type: Boolean })
|
|
96
|
+
], KompasFreewallHead.prototype, "isLogin", void 0);
|
|
97
|
+
__decorate([
|
|
98
|
+
property({ type: String })
|
|
99
|
+
], KompasFreewallHead.prototype, "type", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
property({ type: String })
|
|
102
|
+
], KompasFreewallHead.prototype, "head_copy_expand", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
property({ type: String })
|
|
105
|
+
], KompasFreewallHead.prototype, "head_copy_collapse", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
property({ type: Boolean })
|
|
108
|
+
], KompasFreewallHead.prototype, "expand", void 0);
|
|
109
|
+
__decorate([
|
|
110
|
+
property()
|
|
111
|
+
], KompasFreewallHead.prototype, "toggleExpand", void 0);
|
|
112
|
+
__decorate([
|
|
113
|
+
property()
|
|
114
|
+
], KompasFreewallHead.prototype, "onSubscriptionClick", void 0);
|
|
115
|
+
__decorate([
|
|
116
|
+
property({ type: Object })
|
|
117
|
+
], KompasFreewallHead.prototype, "packageData", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
property({ type: Object })
|
|
120
|
+
], KompasFreewallHead.prototype, "jsonPackageData", void 0);
|
|
121
|
+
KompasFreewallHead = __decorate([
|
|
122
|
+
customElement('kompasid-freewall-head')
|
|
123
|
+
], KompasFreewallHead);
|
|
124
|
+
export { KompasFreewallHead };
|
|
125
|
+
//# sourceMappingURL=old_KompasFreewallHead.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"old_KompasFreewallHead.js","sourceRoot":"","sources":["../../../../src/components/kompasid-freewall-head/old_KompasFreewallHead.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AAI9D,IAAM,kBA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cAAc,CAAC,CAAC;;;;;UAK5D,CAAC,IAAI,CAAC,MAAM;YACZ,CAAC,CAAC,IAAI,CAAA;uBACO,IAAI,CAAC,mBAAmB;;;gBAG/B,IAAI,CAAC,eAAe,CAAC,sBAAsB;sBACrC;YACZ,CAAC,CAAC,OAAO;;KAEd,CAAA;IACH,CAAC;;AA3FM,yBAAM,GAAG,CAAC,GAAG,CAAA,EAAE,EAAE,QAAQ,CAAC,CAAA;AAeJ;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDAAgB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAA6C;AAC5C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAAsB;AACrB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8DAAwB;AACtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDAAc;AAC9B;IAAX,QAAQ,EAAE;wDAAwB;AACvB;IAAX,QAAQ,EAAE;+DAA+B;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAA6C;AAC5C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DACJ;AAzBZ,kBAAkB;IAD9B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,kBAAkB,CA6F9B;SA7FY,kBAAkB","sourcesContent":["import { html, css, LitElement, nothing } from 'lit'\nimport { property, customElement } from 'lit/decorators.js'\nimport { unsafeSVG } from 'lit/directives/unsafe-svg.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { addGoogleFonts } from '../../utils/googleFont.js'\nimport { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js'\nimport { JsonPackageData, PackageData } from '../kompasid-freewall/types.js'\n\n@customElement('kompasid-freewall-head')\nexport class KompasFreewallHead extends LitElement {\n static styles = [css``, TWStyles]\n\n /**\n * Props\n */\n /**\n * property isLogin untuk menghandle apakah user sudah login atau belum\n * property type untuk menghandle tipe freewall\n * property head_copy_expand to update copy header when expand\n * property head_copy_collapse to update copy header when collapse\n * property expand to handle expand/collapse\n * property toggleExpand to handle toggle expand/collapse\n * property onSubscriptionClick to handle cta when subscription button is clicked\n */\n\n @property({ type: Boolean }) isLogin = false\n @property({ type: String }) type: 'article' | 'landing_page' = 'article'\n @property({ type: String }) head_copy_expand = ''\n @property({ type: String }) head_copy_collapse = ''\n @property({ type: Boolean }) expand = true\n @property() toggleExpand = () => {}\n @property() onSubscriptionClick = () => {}\n @property({ type: Object }) packageData: PackageData = {} as PackageData\n @property({ type: Object }) jsonPackageData: JsonPackageData =\n {} as JsonPackageData\n\n /**\n * Getter\n */\n\n get headCopy() {\n return (\n (this.expand ? this.head_copy_expand : this.head_copy_collapse) ||\n 'Akses seluruh konten dan fitur Kompas.id dengan berlangganan.'\n )\n }\n\n /**\n * Lifecycle\n */\n\n override async connectedCallback() {\n super.connectedCallback()\n await this.updateComplete\n addGoogleFonts(['pt-sans'])\n }\n\n /**\n * Render Statement\n */\n\n render() {\n return html`\n <div class=\"flex flex-col px-4 md:px-0 space-y-4 pt-4 pb-5 md:py-2\">\n <div class=\"flex justify-between items-center h-full\">\n <div\n class=\"hidden ${this.expand ? 'md:block' : 'lg:block'} w-9 h-9\"\n ></div>\n <div class=\"flex items-center md:justify-start\">\n <p class=\"w-full text-grey-600\">${this.headCopy}</p>\n ${!this.expand\n ? html`<button\n @click=${this.onSubscriptionClick}\n class=\"bg-green-500 hidden md:block ml-3 whitespace-nowrap rounded md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-white font-bold leading-[18px]\"\n >\n ${this.jsonPackageData.subscriptionButtonText}\n </button>`\n : nothing}\n </div>\n <div>\n <button\n @click=${this.toggleExpand}\n aria-label=\"Toggle Expand\"\n class=\"h-9 w-9 flex ml-2 items-center justify-center text-blue-500 rounded bg-blue-200\"\n >\n <div class=\"${!this.expand && 'rotate-180'}\">\n ${unsafeSVG(getFontAwesomeIcon('fas', 'chevron-down'))}\n </div>\n </button>\n </div>\n </div>\n ${!this.expand\n ? html`<button\n @click=${this.onSubscriptionClick}\n class=\"bg-green-500 block md:hidden whitespace-nowrap rounded md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-white font-bold leading-[18px]\"\n >\n ${this.jsonPackageData.subscriptionButtonText}\n </button>`\n : nothing}\n </div>\n `\n }\n}\n"]}
|
|
@@ -106,7 +106,7 @@ let KompasGracePeriod = class KompasGracePeriod extends LitElement {
|
|
|
106
106
|
this.dataLayeronPerbaruiLanggananButton();
|
|
107
107
|
const originHost = encodeURIComponent(window.location.href);
|
|
108
108
|
this.sendGtmEvent('subscribe_button_clicked');
|
|
109
|
-
window.open(`${this.checkoutPage}/kdp?productId=${this.paywall_subscription_id}&referrer=${originHost}&source=${this.source}`);
|
|
109
|
+
window.open(`${this.checkoutPage}/v2/kdp?productId=${this.paywall_subscription_id}&autorenewal=1&referrer=${originHost}&source=${this.source}`);
|
|
110
110
|
}
|
|
111
111
|
getGtmParams(excludeSubscriptionParams = false) {
|
|
112
112
|
const gtmParams = {};
|
|
@@ -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;;;;;;;;;;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AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DAAqB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,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;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}/kdp?productId=${this.paywall_subscription_id}&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,OAA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;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"]}
|
|
@@ -29,7 +29,6 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
29
29
|
const slot = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('slot');
|
|
30
30
|
const assignedNodes = slot.assignedNodes({ flatten: true });
|
|
31
31
|
this.hasSlotContent = assignedNodes.length > 0;
|
|
32
|
-
console.log('Slot content exists?', this.hasSlotContent);
|
|
33
32
|
}
|
|
34
33
|
async connectedCallback() {
|
|
35
34
|
super.connectedCallback();
|
|
@@ -173,7 +172,7 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
173
172
|
class="py-0.5 px-1.5 rounded-full"
|
|
174
173
|
style="position: relative; display: inline-flex; background-color:#D71920;"
|
|
175
174
|
>
|
|
176
|
-
<span class="font-bold font-
|
|
175
|
+
<span class="font-bold font-sans text-xs text-white capitalize"
|
|
177
176
|
>Baru</span
|
|
178
177
|
>
|
|
179
178
|
</div>
|
|
@@ -214,7 +213,7 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
214
213
|
${unsafeSVG(getFontAwesomeIcon('fas', 'bars'))}
|
|
215
214
|
</div>
|
|
216
215
|
<span
|
|
217
|
-
class="font-
|
|
216
|
+
class="font-sans hidden sm:inline ml-2 tracking-wide font-bold ${this
|
|
218
217
|
.isDark
|
|
219
218
|
? 'text-[#FFFFFF]'
|
|
220
219
|
: 'text-brand-1'}"
|
|
@@ -273,9 +272,7 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
273
272
|
</div>
|
|
274
273
|
`
|
|
275
274
|
: ''}
|
|
276
|
-
<span
|
|
277
|
-
class="font-pt-sans relative text-xs text-[#666666]"
|
|
278
|
-
>
|
|
275
|
+
<span class="font-sans relative text-xs text-[#666666]">
|
|
279
276
|
${item.name}
|
|
280
277
|
</span>
|
|
281
278
|
<div class="ml-1">
|
|
@@ -291,7 +288,7 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
291
288
|
<div class="flex">
|
|
292
289
|
<div class="flex justify-between flex-col">
|
|
293
290
|
${this.dataSidebar.feature.map(item => html `
|
|
294
|
-
<div class="w-full font-
|
|
291
|
+
<div class="w-full font-sans">
|
|
295
292
|
<!-- Parent item -->
|
|
296
293
|
<div
|
|
297
294
|
class="flex items-center justify-between px-4 text-sm font-medium text-gray-700 transition-all cursor-pointer"
|
|
@@ -303,7 +300,7 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
303
300
|
<div class="flex items-center space-x-3">
|
|
304
301
|
<span
|
|
305
302
|
class="text-xl text-brand-1 h-8 flex items-center
|
|
306
|
-
${item.icon === null ? 'w-
|
|
303
|
+
${item.icon === null ? 'w-8' : 'max-w-max w-8'}"
|
|
307
304
|
>
|
|
308
305
|
${item.icon &&
|
|
309
306
|
Array.isArray(item.icon) &&
|
|
@@ -316,7 +313,7 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
316
313
|
>
|
|
317
314
|
${timedContent(item.redDot[0].start, item.redDot[0].end)
|
|
318
315
|
? html `<span
|
|
319
|
-
class="bg-orange-
|
|
316
|
+
class="bg-orange-400 h-2 relative rounded-full w-2 flex shrink-0 -top-[12px]"
|
|
320
317
|
></span>`
|
|
321
318
|
: ''}
|
|
322
319
|
</div>
|
|
@@ -355,7 +352,7 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
355
352
|
${decodeSpecialChars(child.name)}
|
|
356
353
|
${timedContent(child.redDot[0].start, child.redDot[0].end)
|
|
357
354
|
? html `<span
|
|
358
|
-
class="bg-orange-
|
|
355
|
+
class="bg-orange-400 h-2 relative rounded-full w-2 flex shrink-0 -top-[12px]"
|
|
359
356
|
></span>`
|
|
360
357
|
: ''}
|
|
361
358
|
<div></div>
|
|
@@ -374,7 +371,7 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
374
371
|
<div class="flex">
|
|
375
372
|
<div class="w-full flex justify-between flex-col">
|
|
376
373
|
${this.dataSidebar.category.map(item => html `
|
|
377
|
-
<div class="w-full font-
|
|
374
|
+
<div class="w-full font-sans">
|
|
378
375
|
<!-- Parent item -->
|
|
379
376
|
<div
|
|
380
377
|
class="flex items-center justify-between text-sm font-medium px-4 transition-all cursor-pointer"
|
|
@@ -402,7 +399,7 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
402
399
|
|
|
403
400
|
${timedContent(item.redDot[0].start, item.redDot[0].end)
|
|
404
401
|
? html `<span
|
|
405
|
-
class="bg-orange-
|
|
402
|
+
class="bg-orange-400 h-2 relative rounded-full w-2 flex shrink-0 -top-[12px]"
|
|
406
403
|
></span>`
|
|
407
404
|
: ''}
|
|
408
405
|
</div>
|
|
@@ -441,7 +438,7 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
441
438
|
${decodeSpecialChars(child.name)}
|
|
442
439
|
${timedContent(child.redDot[0].start, child.redDot[0].end)
|
|
443
440
|
? html `<span
|
|
444
|
-
class="bg-orange-
|
|
441
|
+
class="bg-orange-400 h-2 relative rounded-full w-2 flex shrink-0 -top-[12px]"
|
|
445
442
|
></span>`
|
|
446
443
|
: ''}
|
|
447
444
|
</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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KAAK,IAAI,CAAC,IAAI;YACzD,CAAC,CAAC,IAAI,CAAA;;8BAEE,IAAI,CAAC,QAAQ,CAAC,GAAG,CACjB,KAAK,CAAC,EAAE,CAAC,IAAI,CAAA;;;2CAGA,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;;;;;sCAKpC,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC;sCAC9B,YAAY,CACZ,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;;AApiBM,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;AAlOxB,iBAAiB;IAD7B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,iBAAiB,CAijB7B;SAjjBY,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 console.log('Slot content exists?', this.hasSlotContent)\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-6' : '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-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(\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-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-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-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=\"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-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,kCAA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BAAkB,CAAC,KAAK,CAAC,IAAI,CAAC;sCAC9B,YAAY,CACZ,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;;AAliBM,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;AAjOxB,iBAAiB;IAD7B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,iBAAiB,CA8iB7B;SA9iBY,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-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-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 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-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-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"]}
|
|
@@ -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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C;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/KompasM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AAE,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,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"]}
|