@kompasid/lit-web-components 0.9.27 → 0.9.29
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 +24 -1
- package/dist/src/components/kompasid-menu-side-bar/KompasMenuSideBar.d.ts +1 -1
- package/dist/src/components/kompasid-menu-side-bar/KompasMenuSideBar.js +36 -24
- package/dist/src/components/kompasid-menu-side-bar/KompasMenuSideBar.js.map +1 -1
- package/dist/src/components/kompasid-metered-paywall-personalize/KompasMeteredPaywallPersonalize.d.ts +67 -0
- package/dist/src/components/kompasid-metered-paywall-personalize/KompasMeteredPaywallPersonalize.js +507 -0
- package/dist/src/components/kompasid-metered-paywall-personalize/KompasMeteredPaywallPersonalize.js.map +1 -0
- package/dist/src/components/kompasid-metered-paywall-personalize/types.d.ts +23 -0
- package/dist/src/components/kompasid-metered-paywall-personalize/types.js +2 -0
- package/dist/src/components/kompasid-metered-paywall-personalize/types.js.map +1 -0
- package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js +2 -2
- package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/tailwind/tailwind.js +151 -6
- 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 +37 -26
- package/src/components/kompasid-menu-side-bar/readme.md +1 -1
- package/src/components/kompasid-metered-paywall-personalize/KompasMeteredPaywallPersonalize.ts +500 -0
- package/src/components/kompasid-metered-paywall-personalize/readme.md +155 -0
- package/src/components/kompasid-metered-paywall-personalize/types.ts +26 -0
- package/src/components/kompasid-paywall-body/KompasPaywallBody.ts +2 -2
- package/src/index.ts +1 -0
- package/tailwind/tailwind.css +151 -6
- package/tailwind/tailwind.ts +151 -6
package/demo/index.html
CHANGED
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
import '../dist/src/components/kompasid-paywall/KompasPaywall.js'
|
|
53
53
|
import '../dist/src/components/kompasid-paywall-video/KompasPaywallVideo.js'
|
|
54
54
|
import '../dist/src/components/kompasid-metered-paywall/KompasMeteredPaywall.js'
|
|
55
|
+
import '../dist/src/components/kompasid-metered-paywall-personalize/KompasMeteredPaywallPersonalize.js'
|
|
55
56
|
import '../dist/src/components/kompasid-freewall/KompasFreewall.js'
|
|
56
57
|
import '../dist/src/components/kompasid-metered-wall-register/KompasMeteredWallRegister.js'
|
|
57
58
|
import '../dist/src/components/kompasid-header-account/KompasHeaderAccount.js'
|
|
@@ -260,7 +261,7 @@
|
|
|
260
261
|
.tracker_subscription_status=${trackerSubscriptionStatus}
|
|
261
262
|
>
|
|
262
263
|
</kompasid-paywall>
|
|
263
|
-
<div class="metered font-sans">
|
|
264
|
+
<div class="metered font-sans" style="position: sticky; bottom: 0; width: 100%; z-index: 999;">
|
|
264
265
|
<kompasid-metered-paywall
|
|
265
266
|
.paywall_location=${paywallLocation}
|
|
266
267
|
.paywall_subscription_id=${paywallSubscriptionId}
|
|
@@ -280,6 +281,28 @@
|
|
|
280
281
|
.metered_wall_balance=${meteredWallBalance}
|
|
281
282
|
>
|
|
282
283
|
</kompasid-metered-paywall>
|
|
284
|
+
<kompasid-metered-paywall-personalize
|
|
285
|
+
segment="Passive Faders"
|
|
286
|
+
offering="Q3"
|
|
287
|
+
user_name="Dummy User"
|
|
288
|
+
.paywall_location=${paywallLocation}
|
|
289
|
+
.paywall_subscription_id=${paywallSubscriptionId}
|
|
290
|
+
.paywall_subscription_price=${paywallSubscriptionPrice}
|
|
291
|
+
.paywall_position=${paywallPosition}
|
|
292
|
+
.tracker_page_type=${trackerPageType}
|
|
293
|
+
.tracker_content_id=${trackerContentId}
|
|
294
|
+
.tracker_content_type=${trackerContentType}
|
|
295
|
+
.tracker_content_title=${trackerContentTitle}
|
|
296
|
+
.tracker_content_categories=${trackerContentCategories}
|
|
297
|
+
.tracker_user_type=${trackerUserType}
|
|
298
|
+
.subscriptionStatus=${subscriptionStatus}
|
|
299
|
+
.tracker_page_domain=${trackerPageDomain}
|
|
300
|
+
.metered_wall_type=${meteredWallType}
|
|
301
|
+
.subscriptionStatus=${subscriptionStatus}
|
|
302
|
+
.tracker_epaper_edition=${trackerEpaperEdition}
|
|
303
|
+
.metered_wall_balance=${meteredWallBalance}
|
|
304
|
+
>
|
|
305
|
+
</kompasid-metered-paywall-personalize>
|
|
283
306
|
</div>
|
|
284
307
|
|
|
285
308
|
<!-- <div style="margin: 20px 0">
|
|
@@ -12,7 +12,7 @@ export declare class KompasMenuSideBar extends LitElement {
|
|
|
12
12
|
dataExternal: DataExternalLink[];
|
|
13
13
|
dataSidebar: DataSideBarLink;
|
|
14
14
|
showNavBar: boolean;
|
|
15
|
-
|
|
15
|
+
expandedSlugs: string[];
|
|
16
16
|
hasSlotContent: boolean;
|
|
17
17
|
connectedCallback(): Promise<void>;
|
|
18
18
|
firstUpdated(): void;
|
|
@@ -27,7 +27,7 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
27
27
|
lainnya: [],
|
|
28
28
|
};
|
|
29
29
|
this.showNavBar = false;
|
|
30
|
-
this.
|
|
30
|
+
this.expandedSlugs = [];
|
|
31
31
|
this.hasSlotContent = false;
|
|
32
32
|
}
|
|
33
33
|
// Fetch data when the component is connected to the DOM
|
|
@@ -107,7 +107,15 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
107
107
|
return Array.isArray(item.children) && item.children.length > 0;
|
|
108
108
|
}
|
|
109
109
|
toggleChildren(item) {
|
|
110
|
-
|
|
110
|
+
const { slug } = item;
|
|
111
|
+
if (this.expandedSlugs.includes(slug)) {
|
|
112
|
+
// close it
|
|
113
|
+
this.expandedSlugs = this.expandedSlugs.filter(s => s !== slug);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
// open it
|
|
117
|
+
this.expandedSlugs = [...this.expandedSlugs, slug];
|
|
118
|
+
}
|
|
111
119
|
}
|
|
112
120
|
hasBundleAccess(item) {
|
|
113
121
|
if (item.name === 'Kompas One')
|
|
@@ -148,10 +156,10 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
148
156
|
>
|
|
149
157
|
<!-- Label / Link area -->
|
|
150
158
|
<div
|
|
151
|
-
class="flex items-center justify-between text-sm font-medium transition-all cursor-pointer"
|
|
159
|
+
class="flex gap-2 items-center justify-between text-sm font-medium transition-all cursor-pointer"
|
|
152
160
|
>
|
|
153
161
|
<div
|
|
154
|
-
class="w-[216px] hover:bg-[#
|
|
162
|
+
class="w-[216px] px-2 hover:bg-[#f4f4f4] rounded h-12 flex items-center space-x-3"
|
|
155
163
|
role="button"
|
|
156
164
|
tabindex="0"
|
|
157
165
|
@click=${(e) => this.rubricClicked(item, e)}
|
|
@@ -171,7 +179,9 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
171
179
|
/>
|
|
172
180
|
</div>`
|
|
173
181
|
: ''}
|
|
174
|
-
<span class="font-bold"
|
|
182
|
+
<span class="font-bold text-grey-600 text-base"
|
|
183
|
+
>${decodeSpecialChars(item.name)}</span
|
|
184
|
+
>
|
|
175
185
|
${timedContent((_a = item.redDot.start) !== null && _a !== void 0 ? _a : '', (_b = item.redDot.end) !== null && _b !== void 0 ? _b : '')
|
|
176
186
|
? html `<span
|
|
177
187
|
class="bg-orange-400 h-2 w-2 rounded-full relative -top-[12px] shrink-0"
|
|
@@ -182,17 +192,17 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
182
192
|
${hasChild
|
|
183
193
|
? html `
|
|
184
194
|
<span
|
|
185
|
-
class="flex justify-center items-center rounded my-1 py-4 w-10 h-10 text-grey-400"
|
|
195
|
+
class="flex justify-center items-center rounded my-1 py-4 w-10 h-10 hover:bg-[#f4f4f4] text-grey-400"
|
|
186
196
|
@click=${(e) => {
|
|
187
197
|
e.stopPropagation();
|
|
188
|
-
this.toggleChildren(item); //
|
|
198
|
+
this.toggleChildren(item); // chevron khusus toggle
|
|
189
199
|
}}
|
|
190
200
|
@keydown=${(e) => {
|
|
191
201
|
if (e.key === 'Enter')
|
|
192
202
|
this.toggleChildren(item);
|
|
193
203
|
}}
|
|
194
204
|
>
|
|
195
|
-
${unsafeSVG(getFontAwesomeIcon('fas', this.
|
|
205
|
+
${unsafeSVG(getFontAwesomeIcon('fas', this.expandedSlugs.includes(item.slug)
|
|
196
206
|
? 'chevron-up'
|
|
197
207
|
: 'chevron-down', 12, 12))}
|
|
198
208
|
</span>
|
|
@@ -202,7 +212,7 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
202
212
|
</div>
|
|
203
213
|
|
|
204
214
|
<!-- Children list -->
|
|
205
|
-
${hasChild && this.
|
|
215
|
+
${hasChild && this.expandedSlugs.includes(item.slug)
|
|
206
216
|
? html `<div
|
|
207
217
|
class="${padClass.includes('px-6')
|
|
208
218
|
? 'pt-1 pb-2 space-y-1 text-black'
|
|
@@ -214,7 +224,7 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
214
224
|
<div
|
|
215
225
|
role="button"
|
|
216
226
|
tabindex="0"
|
|
217
|
-
class="flex items-center justify-between text-sm font-medium
|
|
227
|
+
class="flex items-center justify-between text-sm font-medium transition-all cursor-pointer"
|
|
218
228
|
@click=${() => this.rubricClicked(child)}
|
|
219
229
|
@keydown=${(e) => {
|
|
220
230
|
if (e.key === 'Enter')
|
|
@@ -222,7 +232,7 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
222
232
|
}}
|
|
223
233
|
>
|
|
224
234
|
<div
|
|
225
|
-
class="w-[216px] hover:bg-[#
|
|
235
|
+
class="w-[216px] relative hover:bg-[#f4f4f4] rounded h-12 flex items-center pl-2"
|
|
226
236
|
>
|
|
227
237
|
${decodeSpecialChars(child.name)}
|
|
228
238
|
${timedContent((_a = child.redDot.start) !== null && _a !== void 0 ? _a : '', (_b = child.redDot.end) !== null && _b !== void 0 ? _b : '')
|
|
@@ -230,12 +240,13 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
230
240
|
class="bg-orange-400 h-2 w-2 rounded-full relative -top-[12px] shrink-0"
|
|
231
241
|
></span>`
|
|
232
242
|
: ''}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
243
|
+
|
|
244
|
+
<span class="absolute right-0 text-grey-400">
|
|
245
|
+
${child.external
|
|
236
246
|
? unsafeSVG(getFontAwesomeIcon('fas', 'external-link', 16, 16))
|
|
237
247
|
: ''}
|
|
238
|
-
|
|
248
|
+
</span>
|
|
249
|
+
</div>
|
|
239
250
|
</div>
|
|
240
251
|
`;
|
|
241
252
|
})}
|
|
@@ -249,7 +260,7 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
249
260
|
return null; // skip if empty data
|
|
250
261
|
return html `
|
|
251
262
|
${title
|
|
252
|
-
? html `<span class="text-sm text-grey-400 ${padClass} font-normal"
|
|
263
|
+
? html `<span class="text-sm text-grey-400 ${padClass} font-normal mx-2"
|
|
253
264
|
>${title}</span
|
|
254
265
|
>`
|
|
255
266
|
: null}
|
|
@@ -346,7 +357,7 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
346
357
|
<span
|
|
347
358
|
role="button"
|
|
348
359
|
tabindex="0"
|
|
349
|
-
class="font-bold cursor-pointer text-grey-400 flex h-10 items-center justify-center rounded text-base w-10 py-4"
|
|
360
|
+
class="hover:bg-[#f4f4f4] font-bold cursor-pointer text-grey-400 flex h-10 items-center justify-center rounded text-base w-10 py-4"
|
|
350
361
|
@click=${this.closeNavSidebar}
|
|
351
362
|
@keydown=${(e) => {
|
|
352
363
|
if (e.key === 'Enter')
|
|
@@ -365,11 +376,12 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
365
376
|
${item.icon &&
|
|
366
377
|
Array.isArray(item.icon) &&
|
|
367
378
|
item.icon.length >= 2
|
|
368
|
-
? html `<div class="flex mr-2 text-
|
|
379
|
+
? html `<div class="flex mr-2 text-[#666666]">
|
|
369
380
|
${unsafeSVG(getFontAwesomeIcon(item.icon[0], item.icon[1]))}
|
|
370
381
|
</div>`
|
|
371
382
|
: ''}
|
|
372
|
-
<span
|
|
383
|
+
<span
|
|
384
|
+
class="font-sans font-normal text-xs hover:text-[#222222] text-[#666666]"
|
|
373
385
|
>${item.name}</span
|
|
374
386
|
>
|
|
375
387
|
${item.isNew
|
|
@@ -384,25 +396,25 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
|
|
|
384
396
|
: null}
|
|
385
397
|
|
|
386
398
|
<!-- Bundle Section -->
|
|
387
|
-
${this.renderSection(null, this.dataSidebar.bundles, 'px-
|
|
399
|
+
${this.renderSection(null, this.dataSidebar.bundles, 'px-4')}
|
|
388
400
|
${this.dataSidebar.bundles.length > 0
|
|
389
401
|
? html `<div class="border-b border-[#DDD] mx-6 my-4"></div>`
|
|
390
402
|
: null}
|
|
391
403
|
|
|
392
404
|
<!-- Feature Section -->
|
|
393
|
-
${this.renderSection(null, this.dataSidebar.feature, 'px-
|
|
405
|
+
${this.renderSection(null, this.dataSidebar.feature, 'px-4')}
|
|
394
406
|
${this.dataSidebar.feature.length > 0
|
|
395
407
|
? html `<div class="border-b border-[#DDD] mx-6 my-4"></div>`
|
|
396
408
|
: null}
|
|
397
409
|
|
|
398
410
|
<!-- Category (Redaksional) -->
|
|
399
|
-
${this.renderSection('Redaksional', this.dataSidebar.category, 'px-
|
|
411
|
+
${this.renderSection('Redaksional', this.dataSidebar.category, 'px-4')}
|
|
400
412
|
${this.dataSidebar.category.length > 0
|
|
401
413
|
? html `<div class="border-b border-[#DDD] mx-6 my-4"></div>`
|
|
402
414
|
: null}
|
|
403
415
|
|
|
404
416
|
<!-- Others (Lainnya) -->
|
|
405
|
-
${this.renderSection('Lainnya', this.dataSidebar.lainnya, 'px-
|
|
417
|
+
${this.renderSection('Lainnya', this.dataSidebar.lainnya, 'px-4')}
|
|
406
418
|
</div>
|
|
407
419
|
</nav>
|
|
408
420
|
`;
|
|
@@ -464,7 +476,7 @@ __decorate([
|
|
|
464
476
|
], KompasMenuSideBar.prototype, "showNavBar", void 0);
|
|
465
477
|
__decorate([
|
|
466
478
|
state()
|
|
467
|
-
], KompasMenuSideBar.prototype, "
|
|
479
|
+
], KompasMenuSideBar.prototype, "expandedSlugs", void 0);
|
|
468
480
|
KompasMenuSideBar = __decorate([
|
|
469
481
|
customElement('kompasid-menu-side-bar')
|
|
470
482
|
], KompasMenuSideBar);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KompasMenuSideBar.js","sourceRoot":"","sources":["../../../../src/components/kompasid-menu-side-bar/KompasMenuSideBar.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACjD,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;AAE1D,qCAAqC;AACrC,OAAO,EACL,kBAAkB,EAClB,gBAAgB,GAIjB,MAAM,4BAA4B,CAAA;AAG5B,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,UAAU;IAA1C;;QAsCL;;;WAGG;QAE0B,WAAM,GAAG,KAAK,CAAA;QACd,qBAAgB,GAAG,KAAK,CAAA;QACzB,wBAAmB,GAAG,EA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AyB;AAE3C;IAAR,KAAK,EAAE;uDAAsC;AACrC;IAAR,KAAK,EAAE;sDAKP;AACQ;IAAR,KAAK,EAAE;qDAAmB;AAClB;IAAR,KAAK,EAAE;uDAAmC;AAvDhC,iBAAiB;IAD7B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,iBAAiB,CA4d7B;SA5dY,iBAAiB","sourcesContent":["import { LitElement, html, css } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { repeat } from 'lit/directives/repeat.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\n// Importing the data fetch functions\nimport {\n fetchExternalLinks,\n fetchSidebarData,\n DataExternalLink,\n DataSideBarLink,\n DataSideBarItem,\n} from './SidebarDataController.js'\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 .menu-menu-sidebar::-webkit-scrollbar-track {\n background: white;\n }\n .menu-menu-sidebar::-webkit-scrollbar-thumb {\n background-color: #00557d; /* Replace with your brand color */\n border-radius: 8px;\n }\n .menu-menu-sidebar::-webkit-scrollbar-button,\n .menu-menu-sidebar::-webkit-scrollbar-corner {\n background-color: white;\n }\n /* existing styles */\n `,\n TWStyles,\n ]\n\n /**\n * Props\n * property kompasProSubscription untuk menghandle apakah user sudah login atau belum\n */\n\n @property({ type: Boolean }) isDark = false\n @property({ type: Boolean }) isProductionMode = false\n @property({ type: String }) subscriptionPackage = ''\n\n @state() dataExternal: DataExternalLink[] = []\n @state() dataSidebar: DataSideBarLink = {\n bundles: [],\n feature: [],\n category: [],\n lainnya: [],\n }\n @state() showNavBar = false\n @state() expandedSlug: string | null = null\n hasSlotContent = false\n\n // Fetch data when the component is connected to the DOM\n async connectedCallback() {\n super.connectedCallback()\n await this.loadData()\n }\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 private hasKompasOnePackage(): boolean {\n return this.subscriptionPackage\n ?.split(' ')\n .some(pkg => pkg.includes('kompas-one'))\n }\n\n private hasKompasProPackage(): boolean {\n return this.subscriptionPackage\n ?.split(' ')\n .some(pkg => pkg.includes('kompas-pro'))\n }\n\n private filterBundles(bundles: DataSideBarItem[]): DataSideBarItem[] {\n return bundles\n .filter(b => b.isShow)\n .map(b => {\n if (b.name === 'Kompas One') {\n return {\n ...b,\n children: this.hasKompasOnePackage() ? b.children : [],\n }\n }\n if (b.name === 'Kompas Pro') {\n return {\n ...b,\n children: this.hasKompasProPackage() ? b.children : [],\n }\n }\n return b\n })\n }\n\n // Function to load the data using async API calls\n private async loadData() {\n try {\n const [extData, sbData] = await Promise.all([\n fetchExternalLinks(this.isProductionMode),\n fetchSidebarData(this.isProductionMode),\n ])\n\n this.dataExternal = extData\n this.dataSidebar = {\n ...sbData,\n bundles: this.filterBundles(sbData.bundles),\n }\n } catch (error) {\n console.error('Error loading data:', error)\n }\n }\n\n private toggleNavSidebar(e: Event) {\n e.stopPropagation()\n this.showNavBar = !this.showNavBar\n }\n\n private rubricClicked(item: DataSideBarItem, event?: Event): void {\n if (event) event.stopPropagation()\n\n const isDropdown = this.shouldOpenDropdown(item)\n\n // Kalau bukan dropdown tapi ada href, langsung redirect\n if (!isDropdown && item.href) {\n window.location.href = item.href\n return\n }\n\n // Kalau dropdown, toggle anak\n if (isDropdown) {\n this.toggleChildren(item)\n }\n }\n\n private hasChildren(item: DataSideBarItem): boolean {\n return Array.isArray(item.children) && item.children.length > 0\n }\n\n private toggleChildren(item: DataSideBarItem) {\n this.expandedSlug = this.expandedSlug === item.slug ? null : item.slug\n }\n\n private hasBundleAccess(item: DataSideBarItem): boolean {\n if (item.name === 'Kompas One') return this.hasKompasOnePackage()\n if (item.name === 'Kompas Pro') return this.hasKompasProPackage()\n return true // default non-subscription bundles\n }\n\n private shouldOpenDropdown(item: DataSideBarItem): boolean {\n const hasChild = item.children?.length > 0\n\n // 🔹 1. Parent dengan children + toExpand true\n if (hasChild && item.toExpand) {\n // kalau user nggak punya akses → redirect ke href\n if (!this.hasBundleAccess(item) && item.href) {\n return false\n }\n return true // punya akses → expand\n }\n\n // 🔹 2. Parent dengan children + tidak ada href → dropdown\n if (hasChild && !item.href) {\n return true\n }\n\n // 🔹 3. Parent dengan children + toExpand false + ada href → redirect\n if (hasChild && !item.toExpand && item.href) {\n return false\n }\n\n // 🔹 4. Item biasa tanpa child → redirect\n return false\n }\n\n private renderItem(item: any, padClass: string) {\n const hasChild = this.hasChildren(item)\n\n return html`\n <div class=\"w-full font-sans text-black\">\n <div\n class=\"flex items-center justify-between text-sm font-medium ${padClass}\"\n >\n <!-- Label / Link area -->\n <div\n class=\"flex items-center justify-between text-sm font-medium transition-all cursor-pointer\"\n >\n <div\n class=\"w-[216px] hover:bg-[#f3f4f6] rounded h-12 flex items-center space-x-3\"\n role=\"button\"\n tabindex=\"0\"\n @click=${(e: Event) => this.rubricClicked(item, e)}\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') this.rubricClicked(item, e)\n }}\n >\n ${item.iconSrc\n ? html`<div class=\"flex\">\n <img\n src=\"${item.iconSrc}\"\n alt=\"${item.name}\"\n width=\"20\"\n height=\"20\"\n class=\"block\"\n />\n </div>`\n : ''}\n <span class=\"font-bold\">${decodeSpecialChars(item.name)}</span>\n ${timedContent(item.redDot.start ?? '', item.redDot.end ?? '')\n ? html`<span\n class=\"bg-orange-400 h-2 w-2 rounded-full relative -top-[12px] shrink-0\"\n ></span>`\n : ''}\n </div>\n\n ${hasChild\n ? html`\n <span\n class=\"flex justify-center items-center rounded my-1 py-4 w-10 h-10 text-grey-400\"\n @click=${(e: Event) => {\n e.stopPropagation()\n this.toggleChildren(item) // 🚨 chevron khusus toggle\n }}\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') this.toggleChildren(item)\n }}\n >\n ${unsafeSVG(\n getFontAwesomeIcon(\n 'fas',\n this.expandedSlug === item.slug\n ? 'chevron-up'\n : 'chevron-down',\n 12,\n 12\n )\n )}\n </span>\n `\n : null}\n </div>\n </div>\n\n <!-- Children list -->\n ${hasChild && this.expandedSlug === item.slug\n ? html`<div\n class=\"${padClass.includes('px-6')\n ? 'pt-1 pb-2 space-y-1 text-black'\n : 'pl-14 pt-1 pb-2 space-y-1 text-black'}\"\n >\n ${repeat(\n item.children ?? [],\n (c: DataSideBarItem) => c.slug,\n (child: DataSideBarItem) => html`\n <div\n role=\"button\"\n tabindex=\"0\"\n class=\"flex items-center justify-between text-sm font-medium px-6 transition-all cursor-pointer\"\n @click=${() => this.rubricClicked(child)}\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') this.rubricClicked(child, e)\n }}\n >\n <div\n class=\"w-[216px] hover:bg-[#f3f4f6] rounded h-12 flex items-center pl-8\"\n >\n ${decodeSpecialChars(child.name)}\n ${timedContent(\n child.redDot.start ?? '',\n child.redDot.end ?? ''\n )\n ? html`<span\n class=\"bg-orange-400 h-2 w-2 rounded-full relative -top-[12px] shrink-0\"\n ></span>`\n : ''}\n </div>\n <span class=\"ml-auto text-grey-400\">\n ${child.external\n ? unsafeSVG(\n getFontAwesomeIcon('fas', 'external-link', 16, 16)\n )\n : ''}\n </span>\n </div>\n `\n )}\n </div>`\n : ''}\n </div>\n `\n }\n\n private renderSection(title: string | null, items: any[], padClass: string) {\n if (!items || items.length === 0) return null // skip if empty data\n return html`\n ${title\n ? html`<span class=\"text-sm text-grey-400 ${padClass} font-normal\"\n >${title}</span\n >`\n : null}\n ${repeat(\n items,\n item => item.slug,\n item => this.renderItem(item, padClass)\n )}\n `\n }\n\n private renderChips() {\n return html`\n <div\n class=\"py-0.5 px-1.5 rounded-full bg-[#D71920] inline-flex\"\n style=\"background-color:#D71920;\"\n >\n <span class=\"font-bold font-sans text-xs text-white capitalize\"\n >Baru</span\n >\n </div>\n `\n }\n\n private closeNavSidebar() {\n console.log('closing sidebar')\n this.showNavBar = false\n }\n\n render() {\n return html`\n <!-- Toggle Button -->\n <div\n role=\"button\"\n tabindex=\"0\"\n class=\"w-fit flex items-center justify-center cursor-pointer relative\"\n @click=${this.toggleNavSidebar}\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') this.toggleNavSidebar(e)\n }}\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 <!-- Sidebar Menu -->\n <nav\n class=${this.showNavBar\n ? 'fixed inset-0 z-[100] flex h-screen'\n : 'hidden'}\n >\n <!-- Overlay -->\n <div\n class=\"absolute inset-0 bg-[#00000066]\"\n @click=${this.closeNavSidebar}\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') this.toggleNavSidebar(e)\n }}\n ></div>\n\n <!-- Sidebar Content -->\n <div\n class=\"relative bg-white h-full menu-menu-sidebar overflow-y-auto pb-20 shadow-lg\"\n style=\"width:312px;\"\n >\n <!-- Logo and Close Button -->\n <div\n class=\"bg-[#FFFFFF] flex flex-col items-center justify-center w-full\"\n >\n <div\n ref=\"logo-kompas\"\n class=\"flex items-center justify-between p-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 role=\"button\"\n tabindex=\"0\"\n class=\"font-bold cursor-pointer text-grey-400 flex h-10 items-center justify-center rounded text-base w-10 py-4\"\n @click=${this.closeNavSidebar}\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') this.toggleNavSidebar(e)\n }}\n >\n ${unsafeSVG(getFontAwesomeIcon('fa', 'times', 20, 20))}\n </span>\n </div>\n </div>\n <!-- External Links -->\n <div class=\"flex flex-wrap px-6\">\n ${repeat(\n this.dataExternal,\n item => item.name,\n item => html`\n <a href=\"${item.url}\" class=\"flex w-1/2 no-underline px-2\">\n <div class=\"cursor-pointer flex items-center pb-4\">\n ${item.icon &&\n Array.isArray(item.icon) &&\n item.icon.length >= 2\n ? html`<div class=\"flex mr-2 text-brand-1\">\n ${unsafeSVG(\n getFontAwesomeIcon(item.icon[0], item.icon[1])\n )}\n </div>`\n : ''}\n <span class=\"font-sans text-xs text-[#666666]\"\n >${item.name}</span\n >\n ${item.isNew\n ? html`<span class=\"ml-1\">${this.renderChips()}</span>`\n : ''}\n </div>\n </a>\n `\n )}\n </div>\n ${this.dataExternal.length > 0\n ? html`<div class=\"border-b border-[#DDD] mx-6 my-4\"></div>`\n : null}\n\n <!-- Bundle Section -->\n ${this.renderSection(null, this.dataSidebar.bundles, 'px-6')}\n ${this.dataSidebar.bundles.length > 0\n ? html`<div class=\"border-b border-[#DDD] mx-6 my-4\"></div>`\n : null}\n\n <!-- Feature Section -->\n ${this.renderSection(null, this.dataSidebar.feature, 'px-6')}\n ${this.dataSidebar.feature.length > 0\n ? html`<div class=\"border-b border-[#DDD] mx-6 my-4\"></div>`\n : null}\n\n <!-- Category (Redaksional) -->\n ${this.renderSection(\n 'Redaksional',\n this.dataSidebar.category,\n 'px-6'\n )}\n ${this.dataSidebar.category.length > 0\n ? html`<div class=\"border-b border-[#DDD] mx-6 my-4\"></div>`\n : null}\n\n <!-- Others (Lainnya) -->\n ${this.renderSection('Lainnya', this.dataSidebar.lainnya, 'px-6')}\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,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AACjD,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;AAE1D,qCAAqC;AACrC,OAAO,EACL,kBAAkB,EAClB,gBAAgB,GAIjB,MAAM,4BAA4B,CAAA;AAG5B,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,UAAU;IAA1C;;QAsCL;;;WAGG;QAE0B,WAAM,GAAG,KAAK,CAAA;QACd,qBAAgB,GAAG,KAAK,CAAA;QACzB,wBAAmB,GAAG,EAAE,CAAA;QAE3C,iBAAY,GAAuB,EAAE,CAAA;QACrC,gBAAW,GAAoB;YACtC,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,EAAE;YACZ,OAAO,EAAE,EAAE;SACZ,CAAA;QACQ,eAAU,G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AyB;AACzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8DAAyB;AAE3C;IAAR,KAAK,EAAE;uDAAsC;AACrC;IAAR,KAAK,EAAE;sDAKP;AACQ;IAAR,KAAK,EAAE;qDAAmB;AAClB;IAAR,KAAK,EAAE;wDAA6B;AAvD1B,iBAAiB;IAD7B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,iBAAiB,CAue7B;SAveY,iBAAiB","sourcesContent":["import { LitElement, html, css } from 'lit'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { repeat } from 'lit/directives/repeat.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\n// Importing the data fetch functions\nimport {\n fetchExternalLinks,\n fetchSidebarData,\n DataExternalLink,\n DataSideBarLink,\n DataSideBarItem,\n} from './SidebarDataController.js'\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 .menu-menu-sidebar::-webkit-scrollbar-track {\n background: white;\n }\n .menu-menu-sidebar::-webkit-scrollbar-thumb {\n background-color: #00557d; /* Replace with your brand color */\n border-radius: 8px;\n }\n .menu-menu-sidebar::-webkit-scrollbar-button,\n .menu-menu-sidebar::-webkit-scrollbar-corner {\n background-color: white;\n }\n /* existing styles */\n `,\n TWStyles,\n ]\n\n /**\n * Props\n * property kompasProSubscription untuk menghandle apakah user sudah login atau belum\n */\n\n @property({ type: Boolean }) isDark = false\n @property({ type: Boolean }) isProductionMode = false\n @property({ type: String }) subscriptionPackage = ''\n\n @state() dataExternal: DataExternalLink[] = []\n @state() dataSidebar: DataSideBarLink = {\n bundles: [],\n feature: [],\n category: [],\n lainnya: [],\n }\n @state() showNavBar = false\n @state() expandedSlugs: string[] = []\n hasSlotContent = false\n\n // Fetch data when the component is connected to the DOM\n async connectedCallback() {\n super.connectedCallback()\n await this.loadData()\n }\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 private hasKompasOnePackage(): boolean {\n return this.subscriptionPackage\n ?.split(' ')\n .some(pkg => pkg.includes('kompas-one'))\n }\n\n private hasKompasProPackage(): boolean {\n return this.subscriptionPackage\n ?.split(' ')\n .some(pkg => pkg.includes('kompas-pro'))\n }\n\n private filterBundles(bundles: DataSideBarItem[]): DataSideBarItem[] {\n return bundles\n .filter(b => b.isShow)\n .map(b => {\n if (b.name === 'Kompas One') {\n return {\n ...b,\n children: this.hasKompasOnePackage() ? b.children : [],\n }\n }\n if (b.name === 'Kompas Pro') {\n return {\n ...b,\n children: this.hasKompasProPackage() ? b.children : [],\n }\n }\n return b\n })\n }\n\n // Function to load the data using async API calls\n private async loadData() {\n try {\n const [extData, sbData] = await Promise.all([\n fetchExternalLinks(this.isProductionMode),\n fetchSidebarData(this.isProductionMode),\n ])\n\n this.dataExternal = extData\n this.dataSidebar = {\n ...sbData,\n bundles: this.filterBundles(sbData.bundles),\n }\n } catch (error) {\n console.error('Error loading data:', error)\n }\n }\n\n private toggleNavSidebar(e: Event) {\n e.stopPropagation()\n this.showNavBar = !this.showNavBar\n }\n\n private rubricClicked(item: DataSideBarItem, event?: Event): void {\n if (event) event.stopPropagation()\n\n const isDropdown = this.shouldOpenDropdown(item)\n\n // Kalau bukan dropdown tapi ada href, langsung redirect\n if (!isDropdown && item.href) {\n window.location.href = item.href\n return\n }\n\n // Kalau dropdown, toggle anak\n if (isDropdown) {\n this.toggleChildren(item)\n }\n }\n\n private hasChildren(item: DataSideBarItem): boolean {\n return Array.isArray(item.children) && item.children.length > 0\n }\n\n private toggleChildren(item: DataSideBarItem) {\n const { slug } = item\n if (this.expandedSlugs.includes(slug)) {\n // close it\n this.expandedSlugs = this.expandedSlugs.filter(s => s !== slug)\n } else {\n // open it\n this.expandedSlugs = [...this.expandedSlugs, slug]\n }\n }\n\n private hasBundleAccess(item: DataSideBarItem): boolean {\n if (item.name === 'Kompas One') return this.hasKompasOnePackage()\n if (item.name === 'Kompas Pro') return this.hasKompasProPackage()\n return true // default non-subscription bundles\n }\n\n private shouldOpenDropdown(item: DataSideBarItem): boolean {\n const hasChild = item.children?.length > 0\n\n // 🔹 1. Parent dengan children + toExpand true\n if (hasChild && item.toExpand) {\n // kalau user nggak punya akses → redirect ke href\n if (!this.hasBundleAccess(item) && item.href) {\n return false\n }\n return true // punya akses → expand\n }\n\n // 🔹 2. Parent dengan children + tidak ada href → dropdown\n if (hasChild && !item.href) {\n return true\n }\n\n // 🔹 3. Parent dengan children + toExpand false + ada href → redirect\n if (hasChild && !item.toExpand && item.href) {\n return false\n }\n\n // 🔹 4. Item biasa tanpa child → redirect\n return false\n }\n\n private renderItem(item: any, padClass: string) {\n const hasChild = this.hasChildren(item)\n\n return html`\n <div class=\"w-full font-sans text-black\">\n <div\n class=\"flex items-center justify-between text-sm font-medium ${padClass}\"\n >\n <!-- Label / Link area -->\n <div\n class=\"flex gap-2 items-center justify-between text-sm font-medium transition-all cursor-pointer\"\n >\n <div\n class=\"w-[216px] px-2 hover:bg-[#f4f4f4] rounded h-12 flex items-center space-x-3\"\n role=\"button\"\n tabindex=\"0\"\n @click=${(e: Event) => this.rubricClicked(item, e)}\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') this.rubricClicked(item, e)\n }}\n >\n ${item.iconSrc\n ? html`<div class=\"flex\">\n <img\n src=\"${item.iconSrc}\"\n alt=\"${item.name}\"\n width=\"20\"\n height=\"20\"\n class=\"block\"\n />\n </div>`\n : ''}\n <span class=\"font-bold text-grey-600 text-base\"\n >${decodeSpecialChars(item.name)}</span\n >\n ${timedContent(item.redDot.start ?? '', item.redDot.end ?? '')\n ? html`<span\n class=\"bg-orange-400 h-2 w-2 rounded-full relative -top-[12px] shrink-0\"\n ></span>`\n : ''}\n </div>\n\n ${hasChild\n ? html`\n <span\n class=\"flex justify-center items-center rounded my-1 py-4 w-10 h-10 hover:bg-[#f4f4f4] text-grey-400\"\n @click=${(e: Event) => {\n e.stopPropagation()\n this.toggleChildren(item) // chevron khusus toggle\n }}\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') this.toggleChildren(item)\n }}\n >\n ${unsafeSVG(\n getFontAwesomeIcon(\n 'fas',\n this.expandedSlugs.includes(item.slug)\n ? 'chevron-up'\n : 'chevron-down',\n 12,\n 12\n )\n )}\n </span>\n `\n : null}\n </div>\n </div>\n\n <!-- Children list -->\n ${hasChild && this.expandedSlugs.includes(item.slug)\n ? html`<div\n class=\"${padClass.includes('px-6')\n ? 'pt-1 pb-2 space-y-1 text-black'\n : 'pl-14 pt-1 pb-2 space-y-1 text-black'}\"\n >\n ${repeat(\n item.children ?? [],\n (c: DataSideBarItem) => c.slug,\n (child: DataSideBarItem) => html`\n <div\n role=\"button\"\n tabindex=\"0\"\n class=\"flex items-center justify-between text-sm font-medium transition-all cursor-pointer\"\n @click=${() => this.rubricClicked(child)}\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') this.rubricClicked(child, e)\n }}\n >\n <div\n class=\"w-[216px] relative hover:bg-[#f4f4f4] rounded h-12 flex items-center pl-2\"\n >\n ${decodeSpecialChars(child.name)}\n ${timedContent(\n child.redDot.start ?? '',\n child.redDot.end ?? ''\n )\n ? html`<span\n class=\"bg-orange-400 h-2 w-2 rounded-full relative -top-[12px] shrink-0\"\n ></span>`\n : ''}\n\n <span class=\"absolute right-0 text-grey-400\">\n ${child.external\n ? unsafeSVG(\n getFontAwesomeIcon('fas', 'external-link', 16, 16)\n )\n : ''}\n </span>\n </div>\n </div>\n `\n )}\n </div>`\n : ''}\n </div>\n `\n }\n\n private renderSection(title: string | null, items: any[], padClass: string) {\n if (!items || items.length === 0) return null // skip if empty data\n return html`\n ${title\n ? html`<span class=\"text-sm text-grey-400 ${padClass} font-normal mx-2\"\n >${title}</span\n >`\n : null}\n ${repeat(\n items,\n item => item.slug,\n item => this.renderItem(item, padClass)\n )}\n `\n }\n\n private renderChips() {\n return html`\n <div\n class=\"py-0.5 px-1.5 rounded-full bg-[#D71920] inline-flex\"\n style=\"background-color:#D71920;\"\n >\n <span class=\"font-bold font-sans text-xs text-white capitalize\"\n >Baru</span\n >\n </div>\n `\n }\n\n private closeNavSidebar() {\n console.log('closing sidebar')\n this.showNavBar = false\n }\n\n render() {\n return html`\n <!-- Toggle Button -->\n <div\n role=\"button\"\n tabindex=\"0\"\n class=\"w-fit flex items-center justify-center cursor-pointer relative\"\n @click=${this.toggleNavSidebar}\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') this.toggleNavSidebar(e)\n }}\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 <!-- Sidebar Menu -->\n <nav\n class=${this.showNavBar\n ? 'fixed inset-0 z-[100] flex h-screen'\n : 'hidden'}\n >\n <!-- Overlay -->\n <div\n class=\"absolute inset-0 bg-[#00000066]\"\n @click=${this.closeNavSidebar}\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') this.toggleNavSidebar(e)\n }}\n ></div>\n\n <!-- Sidebar Content -->\n <div\n class=\"relative bg-white h-full menu-menu-sidebar overflow-y-auto pb-20 shadow-lg\"\n style=\"width:312px;\"\n >\n <!-- Logo and Close Button -->\n <div\n class=\"bg-[#FFFFFF] flex flex-col items-center justify-center w-full\"\n >\n <div\n ref=\"logo-kompas\"\n class=\"flex items-center justify-between p-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 role=\"button\"\n tabindex=\"0\"\n class=\"hover:bg-[#f4f4f4] font-bold cursor-pointer text-grey-400 flex h-10 items-center justify-center rounded text-base w-10 py-4\"\n @click=${this.closeNavSidebar}\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') this.toggleNavSidebar(e)\n }}\n >\n ${unsafeSVG(getFontAwesomeIcon('fa', 'times', 20, 20))}\n </span>\n </div>\n </div>\n <!-- External Links -->\n <div class=\"flex flex-wrap px-6\">\n ${repeat(\n this.dataExternal,\n item => item.name,\n item => html`\n <a href=\"${item.url}\" class=\"flex w-1/2 no-underline px-2\">\n <div class=\"cursor-pointer flex items-center pb-4\">\n ${item.icon &&\n Array.isArray(item.icon) &&\n item.icon.length >= 2\n ? html`<div class=\"flex mr-2 text-[#666666]\">\n ${unsafeSVG(\n getFontAwesomeIcon(item.icon[0], item.icon[1])\n )}\n </div>`\n : ''}\n <span\n class=\"font-sans font-normal text-xs hover:text-[#222222] text-[#666666]\"\n >${item.name}</span\n >\n ${item.isNew\n ? html`<span class=\"ml-1\">${this.renderChips()}</span>`\n : ''}\n </div>\n </a>\n `\n )}\n </div>\n ${this.dataExternal.length > 0\n ? html`<div class=\"border-b border-[#DDD] mx-6 my-4\"></div>`\n : null}\n\n <!-- Bundle Section -->\n ${this.renderSection(null, this.dataSidebar.bundles, 'px-4')}\n ${this.dataSidebar.bundles.length > 0\n ? html`<div class=\"border-b border-[#DDD] mx-6 my-4\"></div>`\n : null}\n\n <!-- Feature Section -->\n ${this.renderSection(null, this.dataSidebar.feature, 'px-4')}\n ${this.dataSidebar.feature.length > 0\n ? html`<div class=\"border-b border-[#DDD] mx-6 my-4\"></div>`\n : null}\n\n <!-- Category (Redaksional) -->\n ${this.renderSection(\n 'Redaksional',\n this.dataSidebar.category,\n 'px-4'\n )}\n ${this.dataSidebar.category.length > 0\n ? html`<div class=\"border-b border-[#DDD] mx-6 my-4\"></div>`\n : null}\n\n <!-- Others (Lainnya) -->\n ${this.renderSection('Lainnya', this.dataSidebar.lainnya, 'px-4')}\n </div>\n </nav>\n `\n }\n}\n"]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { LitElement, nothing } from 'lit';
|
|
2
|
+
export declare class KompasMeteredPaywallPersonalize extends LitElement {
|
|
3
|
+
static styles: import("lit").CSSResult[];
|
|
4
|
+
private isLoading;
|
|
5
|
+
private maxQuota;
|
|
6
|
+
private packageData;
|
|
7
|
+
/**
|
|
8
|
+
* Props
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* prop countdownArticle untuk menghandle sudah berapa artikel gratis yang user baca.
|
|
12
|
+
* prop segment untuk menentukan paywall template dari segmen apa yang di pakai, bila tidak ada yang cocok jangan render paywall
|
|
13
|
+
* prop offering untuk handle offering yang akan di berikan, bila tidak di isi maka akan default menjadi Q1
|
|
14
|
+
* prop user_name untuk menerima nama user yang akan di tampilkan paywall specific
|
|
15
|
+
* prop paywall_location = The location where user encounter the paywall
|
|
16
|
+
* prop paywall_subscription_package = The name of the subscription package viewed by user
|
|
17
|
+
* prop paywall_subscription_id = The ID of the subscription package viewed by user
|
|
18
|
+
* prop paywall_subscription_price = The price of the subscriprtion package viewed by user
|
|
19
|
+
* prop paywall_position = The position of ther subscription package viewed by user
|
|
20
|
+
* prop tracker_page_type = Type of the page
|
|
21
|
+
* prop tracker_content_id = ID of article (slug)
|
|
22
|
+
* prop tracker_content_type = Whether it's free article or paid article
|
|
23
|
+
* prop tracker_content_title = The title of article
|
|
24
|
+
* prop tracker_content_categories = The category of the content
|
|
25
|
+
* prop tracker_user_type = Type of user based on their subscription
|
|
26
|
+
* prop tracker_subscription_status = Status of their subscription
|
|
27
|
+
* prop tracker_page_domain = Page Domain
|
|
28
|
+
* prop tracker_metered_wall_type = The type of Metered Wall
|
|
29
|
+
* prop tracker_epaper_edition = The edition of epaper viewed by user
|
|
30
|
+
* prop tracker_metered_wall_balance = The balance of their metered wall
|
|
31
|
+
*/
|
|
32
|
+
countdownArticle: number;
|
|
33
|
+
segment: string;
|
|
34
|
+
offering: string;
|
|
35
|
+
user_name: string;
|
|
36
|
+
paywall_location: string;
|
|
37
|
+
paywall_subscription_package: string;
|
|
38
|
+
paywall_subscription_id: string;
|
|
39
|
+
paywall_subscription_price: number;
|
|
40
|
+
paywall_position: number;
|
|
41
|
+
tracker_page_type: string;
|
|
42
|
+
tracker_content_id: string;
|
|
43
|
+
tracker_content_title: string;
|
|
44
|
+
tracker_content_categories: string;
|
|
45
|
+
tracker_content_type: string;
|
|
46
|
+
tracker_user_type: string;
|
|
47
|
+
tracker_subscription_status: string;
|
|
48
|
+
tracker_page_domain: string;
|
|
49
|
+
tracker_metered_wall_type: string;
|
|
50
|
+
tracker_metered_wall_balance: number;
|
|
51
|
+
connectedCallback(): Promise<void>;
|
|
52
|
+
getMeteredPaywallData(): Promise<void>;
|
|
53
|
+
private redirectToBerlangganan;
|
|
54
|
+
private dataLayeronLanggananButton;
|
|
55
|
+
private dataLayeronMeteredPaywall;
|
|
56
|
+
private stateDefaultPaywall;
|
|
57
|
+
private computedstateDefaultPaywall;
|
|
58
|
+
/**
|
|
59
|
+
* Ganti placeholder _key_ di template dengan nilai dari data offering
|
|
60
|
+
* Hanya replace jika placeholder cocok dan datanya valid
|
|
61
|
+
*/
|
|
62
|
+
private replacePlaceholdersFromOffering;
|
|
63
|
+
private engageReturners;
|
|
64
|
+
private passiveFaders;
|
|
65
|
+
private pickTemplate;
|
|
66
|
+
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
67
|
+
}
|