@kompasid/lit-web-components 0.9.25 → 0.9.27

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.
@@ -24,8 +24,11 @@ export declare class KompasMenuSideBar extends LitElement {
24
24
  private rubricClicked;
25
25
  private hasChildren;
26
26
  private toggleChildren;
27
+ private hasBundleAccess;
28
+ private shouldOpenDropdown;
27
29
  private renderItem;
28
30
  private renderSection;
29
31
  private renderChips;
32
+ private closeNavSidebar;
30
33
  render(): import("lit-html").TemplateResult<1>;
31
34
  }
@@ -90,13 +90,18 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
90
90
  this.showNavBar = !this.showNavBar;
91
91
  }
92
92
  rubricClicked(item, event) {
93
- if (event) {
94
- event.stopPropagation(); // Prevent parent click event
95
- }
96
- if (item.href) {
93
+ if (event)
94
+ event.stopPropagation();
95
+ const isDropdown = this.shouldOpenDropdown(item);
96
+ // Kalau bukan dropdown tapi ada href, langsung redirect
97
+ if (!isDropdown && item.href) {
97
98
  window.location.href = item.href;
99
+ return;
100
+ }
101
+ // Kalau dropdown, toggle anak
102
+ if (isDropdown) {
103
+ this.toggleChildren(item);
98
104
  }
99
- // add data layer here
100
105
  }
101
106
  hasChildren(item) {
102
107
  return Array.isArray(item.children) && item.children.length > 0;
@@ -104,71 +109,99 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
104
109
  toggleChildren(item) {
105
110
  this.expandedSlug = this.expandedSlug === item.slug ? null : item.slug;
106
111
  }
112
+ hasBundleAccess(item) {
113
+ if (item.name === 'Kompas One')
114
+ return this.hasKompasOnePackage();
115
+ if (item.name === 'Kompas Pro')
116
+ return this.hasKompasProPackage();
117
+ return true; // default non-subscription bundles
118
+ }
119
+ shouldOpenDropdown(item) {
120
+ var _a;
121
+ const hasChild = ((_a = item.children) === null || _a === void 0 ? void 0 : _a.length) > 0;
122
+ // 🔹 1. Parent dengan children + toExpand true
123
+ if (hasChild && item.toExpand) {
124
+ // kalau user nggak punya akses → redirect ke href
125
+ if (!this.hasBundleAccess(item) && item.href) {
126
+ return false;
127
+ }
128
+ return true; // punya akses → expand
129
+ }
130
+ // 🔹 2. Parent dengan children + tidak ada href → dropdown
131
+ if (hasChild && !item.href) {
132
+ return true;
133
+ }
134
+ // 🔹 3. Parent dengan children + toExpand false + ada href → redirect
135
+ if (hasChild && !item.toExpand && item.href) {
136
+ return false;
137
+ }
138
+ // 🔹 4. Item biasa tanpa child → redirect
139
+ return false;
140
+ }
107
141
  renderItem(item, padClass) {
108
142
  var _a, _b, _c;
109
143
  const hasChild = this.hasChildren(item);
110
144
  return html `
111
145
  <div class="w-full font-sans text-black">
112
146
  <div
113
- class="flex items-center justify-between text-sm font-medium ${padClass} transition-all cursor-pointer"
114
- role="button"
115
- tabindex="0"
116
- @click=${(e) => {
117
- e.stopPropagation();
118
- if (hasChild) {
119
- this.toggleChildren(item);
120
- }
121
- else {
122
- this.rubricClicked(item, e);
123
- }
124
- }}
125
- @keydown=${(e) => {
126
- if (e.key === 'Enter') {
127
- e.stopPropagation();
128
- if (hasChild) {
129
- this.toggleChildren(item);
130
- }
131
- else {
132
- this.rubricClicked(item, e);
133
- }
134
- }
135
- }}
147
+ class="flex items-center justify-between text-sm font-medium ${padClass}"
136
148
  >
149
+ <!-- Label / Link area -->
137
150
  <div
138
- class="w-[216px] hover:bg-[#f3f4f6] rounded h-12 flex items-center space-x-3"
151
+ class="flex items-center justify-between text-sm font-medium transition-all cursor-pointer"
139
152
  >
140
- ${item.iconSrc
153
+ <div
154
+ class="w-[216px] hover:bg-[#f3f4f6] rounded h-12 flex items-center space-x-3"
155
+ role="button"
156
+ tabindex="0"
157
+ @click=${(e) => this.rubricClicked(item, e)}
158
+ @keydown=${(e) => {
159
+ if (e.key === 'Enter')
160
+ this.rubricClicked(item, e);
161
+ }}
162
+ >
163
+ ${item.iconSrc
141
164
  ? html `<div class="flex">
142
- <img
143
- src="${item.iconSrc}"
144
- alt="${item.name}"
145
- width="20"
146
- height="20"
147
- class="block"
148
- />
149
- </div>`
165
+ <img
166
+ src="${item.iconSrc}"
167
+ alt="${item.name}"
168
+ width="20"
169
+ height="20"
170
+ class="block"
171
+ />
172
+ </div>`
150
173
  : ''}
151
- <span class="font-bold">${decodeSpecialChars(item.name)}</span>
152
- ${timedContent((_a = item.redDot.start) !== null && _a !== void 0 ? _a : '', (_b = item.redDot.end) !== null && _b !== void 0 ? _b : '')
174
+ <span class="font-bold">${decodeSpecialChars(item.name)}</span>
175
+ ${timedContent((_a = item.redDot.start) !== null && _a !== void 0 ? _a : '', (_b = item.redDot.end) !== null && _b !== void 0 ? _b : '')
153
176
  ? html `<span
154
- class="bg-orange-400 h-2 w-2 rounded-full relative -top-[12px] shrink-0"
155
- ></span>`
177
+ class="bg-orange-400 h-2 w-2 rounded-full relative -top-[12px] shrink-0"
178
+ ></span>`
156
179
  : ''}
157
- </div>
180
+ </div>
158
181
 
159
- ${hasChild
182
+ ${hasChild
160
183
  ? html `
161
- <span
162
- class="flex justify-center items-center rounded my-1 py-4 w-10 h-10 text-grey-400"
163
- >
164
- ${unsafeSVG(getFontAwesomeIcon('fas', this.expandedSlug === item.slug
184
+ <span
185
+ class="flex justify-center items-center rounded my-1 py-4 w-10 h-10 text-grey-400"
186
+ @click=${(e) => {
187
+ e.stopPropagation();
188
+ this.toggleChildren(item); // 🚨 chevron khusus toggle
189
+ }}
190
+ @keydown=${(e) => {
191
+ if (e.key === 'Enter')
192
+ this.toggleChildren(item);
193
+ }}
194
+ >
195
+ ${unsafeSVG(getFontAwesomeIcon('fas', this.expandedSlug === item.slug
165
196
  ? 'chevron-up'
166
197
  : 'chevron-down', 12, 12))}
167
- </span>
168
- `
198
+ </span>
199
+ `
169
200
  : null}
201
+ </div>
170
202
  </div>
171
203
 
204
+ <!-- Children list -->
172
205
  ${hasChild && this.expandedSlug === item.slug
173
206
  ? html `<div
174
207
  class="${padClass.includes('px-6')
@@ -235,6 +268,10 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
235
268
  </div>
236
269
  `;
237
270
  }
271
+ closeNavSidebar() {
272
+ console.log('closing sidebar');
273
+ this.showNavBar = false;
274
+ }
238
275
  render() {
239
276
  return html `
240
277
  <!-- Toggle Button -->
@@ -272,12 +309,22 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
272
309
  <!-- Sidebar Menu -->
273
310
  <nav
274
311
  class=${this.showNavBar
275
- ? 'fixed left-0 top-0 w-screen z-[100]'
312
+ ? 'fixed inset-0 z-[100] flex h-screen'
276
313
  : 'hidden'}
277
314
  >
315
+ <!-- Overlay -->
316
+ <div
317
+ class="absolute inset-0 bg-[#00000066]"
318
+ @click=${this.closeNavSidebar}
319
+ @keydown=${(e) => {
320
+ if (e.key === 'Enter')
321
+ this.toggleNavSidebar(e);
322
+ }}
323
+ ></div>
324
+
278
325
  <!-- Sidebar Content -->
279
326
  <div
280
- class="bg-white h-screen menu-menu-sidebar overflow-y-auto pb-20 shadow-lg"
327
+ class="relative bg-white h-full menu-menu-sidebar overflow-y-auto pb-20 shadow-lg"
281
328
  style="width:312px;"
282
329
  >
283
330
  <!-- Logo and Close Button -->
@@ -300,7 +347,7 @@ let KompasMenuSideBar = class KompasMenuSideBar extends LitElement {
300
347
  role="button"
301
348
  tabindex="0"
302
349
  class="font-bold cursor-pointer text-grey-400 flex h-10 items-center justify-center rounded text-base w-10 py-4"
303
- @click=${this.toggleNavSidebar}
350
+ @click=${this.closeNavSidebar}
304
351
  @keydown=${(e) => {
305
352
  if (e.key === 'Enter')
306
353
  this.toggleNavSidebar(e);
@@ -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,MAA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sDAAsD;YAC5D,CAAC,CAAC,IAAI;;;YAGN,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC;;;KAGtE,CAAA;IACH,CAAC;;AA1aM,wBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgCF;IACD,QAAQ;CACT,CAAA;AAO4B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;iDAAe;AACd;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2DAAyB;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;uDAAmC;AAvDhC,iBAAiB;IAD7B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,iBAAiB,CA4a7B;SA5aY,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(\n item: { name: string; href?: string },\n event?: Event\n ): 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 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 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} transition-all cursor-pointer\"\n role=\"button\"\n tabindex=\"0\"\n @click=${(e: Event) => {\n e.stopPropagation()\n if (hasChild) {\n this.toggleChildren(item)\n } else {\n this.rubricClicked(item, e)\n }\n }}\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') {\n e.stopPropagation()\n if (hasChild) {\n this.toggleChildren(item)\n } else {\n this.rubricClicked(item, e)\n }\n }\n }}\n >\n <div\n class=\"w-[216px] hover:bg-[#f3f4f6] rounded h-12 flex items-center space-x-3\"\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 >\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\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 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 left-0 top-0 w-screen z-[100]'\n : 'hidden'}\n >\n <!-- Sidebar Content -->\n <div\n class=\"bg-white h-screen 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.toggleNavSidebar}\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;A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,CAAC,aAAa,CAClB,aAAa,EACb,IAAI,CAAC,WAAW,CAAC,QAAQ,EACzB,MAAM,CACP;YACC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;YACpC,CAAC,CAAC,IAAI,CAAA,sDAAsD;YAC5D,CAAC,CAAC,IAAI;;;YAGN,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC;;;KAGtE,CAAA;IACH,CAAC;;AA1dM,wBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgCF;IACD,QAAQ;CACT,CAAA;AAO4B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;iDAAe;AACd;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2DAAyB;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;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"]}
@@ -15,6 +15,7 @@ export interface DataSideBarItem {
15
15
  isShow: boolean;
16
16
  href: string;
17
17
  external?: boolean;
18
+ toExpand?: boolean;
18
19
  icon: string | null;
19
20
  iconify: string | null;
20
21
  iconSrc: string | null;
@@ -36,19 +36,20 @@ export async function fetchSidebarData(isProduction) {
36
36
  const data = await response.json();
37
37
  if (data && typeof data === 'object') {
38
38
  const mapItem = (item) => {
39
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
39
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
40
40
  return ({
41
41
  isShow: (_a = item.isShow) !== null && _a !== void 0 ? _a : true,
42
- href: (_b = item.href) !== null && _b !== void 0 ? _b : '',
43
- external: (_c = item.external) !== null && _c !== void 0 ? _c : false,
44
- icon: (_d = item.icon) !== null && _d !== void 0 ? _d : null,
45
- iconify: (_e = item.iconify) !== null && _e !== void 0 ? _e : null,
46
- iconSrc: (_f = item.iconSrc) !== null && _f !== void 0 ? _f : null,
47
- name: (_g = item.name) !== null && _g !== void 0 ? _g : '',
48
- slug: (_h = item.slug) !== null && _h !== void 0 ? _h : '',
42
+ toExpand: (_b = item.toExpand) !== null && _b !== void 0 ? _b : false,
43
+ href: (_c = item.href) !== null && _c !== void 0 ? _c : '',
44
+ external: (_d = item.external) !== null && _d !== void 0 ? _d : false,
45
+ icon: (_e = item.icon) !== null && _e !== void 0 ? _e : null,
46
+ iconify: (_f = item.iconify) !== null && _f !== void 0 ? _f : null,
47
+ iconSrc: (_g = item.iconSrc) !== null && _g !== void 0 ? _g : null,
48
+ name: (_h = item.name) !== null && _h !== void 0 ? _h : '',
49
+ slug: (_j = item.slug) !== null && _j !== void 0 ? _j : '',
49
50
  redDot: {
50
- start: (_k = (_j = item.redDot) === null || _j === void 0 ? void 0 : _j.start) !== null && _k !== void 0 ? _k : '',
51
- end: (_m = (_l = item.redDot) === null || _l === void 0 ? void 0 : _l.end) !== null && _m !== void 0 ? _m : '',
51
+ start: (_l = (_k = item.redDot) === null || _k === void 0 ? void 0 : _k.start) !== null && _l !== void 0 ? _l : '',
52
+ end: (_o = (_m = item.redDot) === null || _m === void 0 ? void 0 : _m.end) !== null && _o !== void 0 ? _o : '',
52
53
  },
53
54
  children: Array.isArray(item.children)
54
55
  ? item.children.map(mapItem)
@@ -1 +1 @@
1
- {"version":3,"file":"SidebarDataController.js","sourceRoot":"","sources":["../../../../src/components/kompasid-menu-side-bar/SidebarDataController.ts"],"names":[],"mappings":"AAoCA,iCAAiC;AACjC,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,YA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C,OAAO,CAAC;gBAC7B,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;gBAC7B,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;gBAC/B,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;aAC9B,CAAA;SACF;QAED,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAA;KAC/D;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAA;QACpD,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAA;KAC/D;AACH,CAAC","sourcesContent":["// SidebarDataController.ts\nexport interface DataExternalLink {\n external: boolean\n gtmClass: string\n icon: string | null\n iconify: string | null\n isNew: boolean\n name: string\n url: string\n}\n\nexport interface DataRedDot {\n start: string | null\n end: string | null\n}\n\nexport interface DataSideBarItem {\n isShow: boolean\n href: string\n external?: boolean\n icon: string | null\n iconify: string | null\n iconSrc: string | null\n name: string\n slug: string\n redDot: DataRedDot\n children: DataSideBarItem[]\n}\n\nexport interface DataSideBarLink {\n bundles: DataSideBarItem[]\n feature: DataSideBarItem[]\n category: DataSideBarItem[]\n lainnya: DataSideBarItem[]\n}\n\n// ---- Fetch External Links ----\nexport async function fetchExternalLinks(\n isProduction: boolean\n): Promise<DataExternalLink[]> {\n try {\n const baseUrl = isProduction\n ? 'https://cdn-www.kompas.id'\n : 'https://cdn-dev-www.kompas.id'\n const response = await fetch(\n `${baseUrl}/assets/json/ApiMenuExternalLinkV2.json`\n )\n const data = await response.json()\n\n return Array.isArray(data)\n ? data.map(\n (item: any): DataExternalLink => ({\n external: item.external ?? false,\n gtmClass: item.gtmClass ?? '',\n icon: item.icon ?? null,\n iconify: item.iconify ?? null,\n isNew: item.isNew ?? false,\n name: item.name ?? '',\n url: item.url ?? '',\n })\n )\n : []\n } catch (error) {\n console.error('Error fetching external links:', error)\n return []\n }\n}\n\n// ---- Fetch Sidebar Data ----\nexport async function fetchSidebarData(\n isProduction: Boolean\n): Promise<DataSideBarLink> {\n try {\n const baseUrl = isProduction\n ? 'https://cdn-www.kompas.id'\n : 'https://cdn-dev-www.kompas.id'\n const response = await fetch(`${baseUrl}/assets/json/ApiMenuSideV4.json`)\n const data = await response.json()\n\n if (data && typeof data === 'object') {\n const mapItem = (item: any): DataSideBarItem => ({\n isShow: item.isShow ?? true,\n href: item.href ?? '',\n external: item.external ?? false,\n icon: item.icon ?? null,\n iconify: item.iconify ?? null,\n iconSrc: item.iconSrc ?? null,\n name: item.name ?? '',\n slug: item.slug ?? '',\n redDot: {\n start: item.redDot?.start ?? '',\n end: item.redDot?.end ?? '',\n },\n children: Array.isArray(item.children)\n ? item.children.map(mapItem)\n : [],\n })\n\n const mapper = (list: any[]): DataSideBarItem[] =>\n Array.isArray(list) ? list.map(mapItem) : []\n\n return {\n bundles: mapper(data.bundles),\n feature: mapper(data.feature),\n category: mapper(data.category),\n lainnya: mapper(data.lainnya),\n }\n }\n\n return { bundles: [], feature: [], category: [], lainnya: [] }\n } catch (error) {\n console.error('Error fetching sidebar data:', error)\n return { bundles: [], feature: [], category: [], lainnya: [] }\n }\n}\n"]}
1
+ {"version":3,"file":"SidebarDataController.js","sourceRoot":"","sources":["../../../../src/components/kompasid-menu-side-bar/SidebarDataController.ts"],"names":[],"mappings":"AAqCA,iCAAiC;AACjC,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,YAAqB;IAErB,IAAI;QACF,MAAM,OAAO,GAAG,YAAY;YAC1B,CAAC,CAAC,2BAA2B;YAC7B,CAAC,CAAC,+BAA+B,CAAA;QACnC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAC1B,GAAG,OAAO,yCAAyC,CACpD,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AQ,CAAC;gBAC/B,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;aAC9B,CAAA;SACF;QAED,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAA;KAC/D;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAA;QACpD,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAA;KAC/D;AACH,CAAC","sourcesContent":["// SidebarDataController.ts\nexport interface DataExternalLink {\n external: boolean\n gtmClass: string\n icon: string | null\n iconify: string | null\n isNew: boolean\n name: string\n url: string\n}\n\nexport interface DataRedDot {\n start: string | null\n end: string | null\n}\n\nexport interface DataSideBarItem {\n isShow: boolean\n href: string\n external?: boolean\n toExpand?: boolean\n icon: string | null\n iconify: string | null\n iconSrc: string | null\n name: string\n slug: string\n redDot: DataRedDot\n children: DataSideBarItem[]\n}\n\nexport interface DataSideBarLink {\n bundles: DataSideBarItem[]\n feature: DataSideBarItem[]\n category: DataSideBarItem[]\n lainnya: DataSideBarItem[]\n}\n\n// ---- Fetch External Links ----\nexport async function fetchExternalLinks(\n isProduction: boolean\n): Promise<DataExternalLink[]> {\n try {\n const baseUrl = isProduction\n ? 'https://cdn-www.kompas.id'\n : 'https://cdn-dev-www.kompas.id'\n const response = await fetch(\n `${baseUrl}/assets/json/ApiMenuExternalLinkV2.json`\n )\n const data = await response.json()\n\n return Array.isArray(data)\n ? data.map(\n (item: any): DataExternalLink => ({\n external: item.external ?? false,\n gtmClass: item.gtmClass ?? '',\n icon: item.icon ?? null,\n iconify: item.iconify ?? null,\n isNew: item.isNew ?? false,\n name: item.name ?? '',\n url: item.url ?? '',\n })\n )\n : []\n } catch (error) {\n console.error('Error fetching external links:', error)\n return []\n }\n}\n\n// ---- Fetch Sidebar Data ----\nexport async function fetchSidebarData(\n isProduction: Boolean\n): Promise<DataSideBarLink> {\n try {\n const baseUrl = isProduction\n ? 'https://cdn-www.kompas.id'\n : 'https://cdn-dev-www.kompas.id'\n const response = await fetch(`${baseUrl}/assets/json/ApiMenuSideV4.json`)\n const data = await response.json()\n\n if (data && typeof data === 'object') {\n const mapItem = (item: any): DataSideBarItem => ({\n isShow: item.isShow ?? true,\n toExpand: item.toExpand ?? false,\n href: item.href ?? '',\n external: item.external ?? false,\n icon: item.icon ?? null,\n iconify: item.iconify ?? null,\n iconSrc: item.iconSrc ?? null,\n name: item.name ?? '',\n slug: item.slug ?? '',\n redDot: {\n start: item.redDot?.start ?? '',\n end: item.redDot?.end ?? '',\n },\n children: Array.isArray(item.children)\n ? item.children.map(mapItem)\n : [],\n })\n\n const mapper = (list: any[]): DataSideBarItem[] =>\n Array.isArray(list) ? list.map(mapItem) : []\n\n return {\n bundles: mapper(data.bundles),\n feature: mapper(data.feature),\n category: mapper(data.category),\n lainnya: mapper(data.lainnya),\n }\n }\n\n return { bundles: [], feature: [], category: [], lainnya: [] }\n } catch (error) {\n console.error('Error fetching sidebar data:', error)\n return { bundles: [], feature: [], category: [], lainnya: [] }\n }\n}\n"]}
@@ -534,7 +534,7 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
534
534
  ${unsafeSVG(getFontAwesomeIcon('fas', 'check', 12, 12))}
535
535
  </div>
536
536
  <h6
537
- class="text-xs md:text-base ml-0.5 md:ml-1 ${buttonTextColorClass}"
537
+ class="text-sm md:text-base ml-0.5 md:ml-1 ${buttonTextColorClass}"
538
538
  >
539
539
  ${item}
540
540
  </h6>
@@ -585,24 +585,33 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
585
585
  regulerRegistrationSection() {
586
586
  const textColorClass = this.isDark ? 'text-blue-300' : 'text-blue-600';
587
587
  const buttonTextColorClass = this.isDark ? 'text-white' : 'text-grey-600';
588
+ const isPro = this.type === 'proMiningArticle' || this.type === 'proMiningOutlook';
588
589
  return html `
589
- <div class="flex flex-col items-center justify-center">
590
- <div>
591
- <button
592
- @click=${() => redirectToRegister('hard_paywall')}
593
- class="text-sm md:text-base font-bold underline ${textColorClass}"
594
- >
595
- Daftar
596
- </button>
597
- <span class="${buttonTextColorClass}"
598
- >untuk kuota artikel gratis</span
599
- >
600
- </div>
590
+ <div
591
+ class="flex flex-col items-center justify-center text-sm md:text-base"
592
+ >
593
+ ${!isPro
594
+ ? html `
595
+ <div>
596
+ <button
597
+ @click=${() => redirectToRegister('hard_paywall')}
598
+ class="font-bold underline ${textColorClass}"
599
+ >
600
+ Daftar
601
+ </button>
602
+ <span class="${buttonTextColorClass}"
603
+ >untuk kuota artikel gratis</span
604
+ >
605
+ </div>
606
+ `
607
+ : nothing}
601
608
  <div>
602
- <span class="${buttonTextColorClass}">atau</span>
609
+ ${!isPro
610
+ ? html ` <span class="${buttonTextColorClass}">atau</span>`
611
+ : nothing}
603
612
  <button
604
613
  @click=${() => redirectToLogin({ loc: 'hard_paywall' })}
605
- class="text-sm md:text-base font-bold underline ${textColorClass}"
614
+ class="font-bold underline ${textColorClass}"
606
615
  >
607
616
  Masuk
608
617
  </button>