@kompasid/lit-web-components 0.9.33 → 0.9.35

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/header.html CHANGED
@@ -21,27 +21,80 @@
21
21
  align-items: center;
22
22
  }
23
23
  </style>
24
- <title>Document</title>
25
- </head>
24
+ <script>
25
+ ;(function initGTM(w, d, s, l, i) {
26
+ const _w = w
27
+ _w[l] = _w[l] || []
28
+ _w[l].push({
29
+ 'gtm.start': new Date().getTime(),
30
+ event: 'gtm.js',
31
+ })
26
32
 
27
- <body>
33
+ const f = d.getElementsByTagName(s)[0]
34
+ const j = d.createElement(s)
35
+ const dl = l !== 'dataLayer' ? `&l=${l}` : ''
36
+
37
+ j.async = true
38
+ j.src = `https://www.googletagmanager.com/gtm.js?id=${i}${dl}`
39
+ f.parentNode.insertBefore(j, f)
40
+ })(window, document, 'script', 'dataLayer')
41
+ </script>
42
+ <title>Document</title>
28
43
  <script type="module">
29
44
  import { html, render } from 'lit'
45
+ import { keyed } from 'lit/directives/keyed.js'
30
46
  import '../dist/src/components/kompasid-header-account/KompasHeaderAccount.js'
31
47
  import '../dist/src/components/kompasid-header-notification/KompasHeaderNotification.js'
32
48
 
33
49
  const urlParams = new URLSearchParams(window.location.search);
34
50
  const headerTheme = urlParams.get('header_theme') || 'default'
35
51
 
36
- const userData = {
52
+ const templates = {
53
+ gracePeriod: {
54
+ "userName": "Clara Wijaya",
55
+ "expired": "2025-12-05 23:59:59",
56
+ "activeInfo": "Pada masa tenggang",
57
+ "isMembership": true,
58
+ "totalGracePeriod": 3,
59
+ "isGracePeriod": true
60
+ },
61
+ moreThan3Days: {
62
+ "userName": "Clara Wijaya",
63
+ "expired": "2025-12-25 23:59:59",
64
+ "activeInfo": "Aktif berlangganan",
65
+ "isMembership": true,
66
+ "totalGracePeriod": 0,
67
+ "isGracePeriod": false
68
+ },
69
+ lessThan3Days: {
70
+ "userName": "Clara Wijaya",
71
+ "expired": "2025-12-19 23:59:59",
72
+ "activeInfo": "Aktif berlangganan",
73
+ "isMembership": true,
74
+ "totalGracePeriod": 0,
75
+ "isGracePeriod": false
76
+ },
77
+ tidakBerlangganan: {
78
+ "userName": "Clara Wijaya",
79
+ "expired": "",
80
+ "activeInfo": "Tidak berlangganan", // ""
81
+ "isMembership": false,
82
+ "totalGracePeriod": 0,
83
+ "isGracePeriod": false
84
+ }
85
+ }
86
+
87
+ let currentUserData = {
37
88
  "userName": "Clara Wijaya",
38
- "expired": "2025-12-05 23:59:59", //
39
- "activeInfo": "Aktif berlangganan",
40
- "isMembership": true,
41
- "updateMembership": "tes", // deprecated
42
- "totalGracePeriod": 3,
89
+ "expired": "",
90
+ "activeInfo": "Tidak berlangganan", // ""
91
+ "isMembership": false,
92
+ "totalGracePeriod": 0,
43
93
  "isGracePeriod": false
44
94
  }
95
+
96
+ let renderKey = 0
97
+
45
98
  const cartUrl = '/cart'
46
99
  const logoutUrl = '/logout'
47
100
  const manageAccountUrl = '/manage-count'
@@ -77,53 +130,104 @@
77
130
  }
78
131
  const accessToken = getCookie('kompas._token')
79
132
  const refreshToken = getCookie('kompas._token_refresh')
80
- render(
81
- html`
82
- <header class="header" >
83
- <div class="header-content" >
84
- <kompasid-header-notification
85
- style="margin-left: auto; padding-right: 8px;"
86
- .accessToken=${accessToken}
87
- .refreshToken=${refreshToken}
88
- .theme=${headerTheme}
89
- domain="cloud"
90
- ></kompasid-header-notification>
91
- <kompasid-header-account
92
- .userData=${userData}
93
- .cart_url=${cartUrl}
94
- .logout_url=${logoutUrl}
95
- sidebarTopSpacing="49"
96
- .manage_account_url=${manageAccountUrl}
97
- .notification_url=${notificationUrl}
98
- .notification_total=${notificationTotal}
99
- .orders_url=${ordersUrl}
100
- .subscriptionUrl=${subscriptionUrl}
101
- .read_later_url=${readLaterUrl}
102
- .total_grace_period=${totalGracePeriod}
103
- .paywall_location=${paywallLocation}
104
- .paywall_subscription_package=${paywallSubscriptionPackage}
105
- .paywall_subscription_id=${productId}
106
- .paywall_subscription_price=${paywallSubscriptionPrice}
107
- .paywall_position=${paywallPosition}
108
- .tracker_page_type=${trackerPageType}
109
- .tracker_content_id=${trackerContentId}
110
- .tracker_content_type=${trackerContentType}
111
- .tracker_content_title=${trackerContentTitle}
112
- .tracker_content_categories=${trackerContentCategories}
113
- .tracker_user_type=${trackerUserType}
114
- .tracker_subscription_status=${trackerSubscriptionStatus}
115
- .tracker_page_domain=${trackerPageDomain}
116
- .metered_wall_type=${meteredWallType}
117
- .tracker_metered_wall_balance=${trackerMeteredWallBalance}
118
- style="margin-left: 10px; height: 25px; display: flex; align-items: center"
119
- .theme=${headerTheme}
120
- ></kompasid-header-account>
121
- </div>
122
- </header>
133
+
134
+ function renderHeader(userData) {
135
+ render(
136
+ html`
137
+ <header class="header" >
138
+ <div class="header-content" >
139
+ <kompasid-header-notification
140
+ style="margin-left: auto; padding-right: 8px;"
141
+ .accessToken=${accessToken}
142
+ .refreshToken=${refreshToken}
143
+ .theme=${headerTheme}
144
+ domain="cloud"
145
+ ></kompasid-header-notification>
146
+ ${keyed(renderKey, html`
147
+ <kompasid-header-account
148
+ .userData=${userData}
149
+ .cart_url=${cartUrl}
150
+ .logout_url=${logoutUrl}
151
+ sidebarTopSpacing="49"
152
+ .manage_account_url=${manageAccountUrl}
153
+ .notification_url=${notificationUrl}
154
+ .notification_total=${notificationTotal}
155
+ .orders_url=${ordersUrl}
156
+ .subscriptionUrl=${subscriptionUrl}
157
+ .read_later_url=${readLaterUrl}
158
+ .total_grace_period=${totalGracePeriod}
159
+ .paywall_location=${paywallLocation}
160
+ .paywall_subscription_package=${paywallSubscriptionPackage}
161
+ .paywall_subscription_id=${productId}
162
+ .paywall_subscription_price=${paywallSubscriptionPrice}
163
+ .paywall_position=${paywallPosition}
164
+ .tracker_page_type=${trackerPageType}
165
+ .tracker_content_id=${trackerContentId}
166
+ .tracker_content_type=${trackerContentType}
167
+ .tracker_content_title=${trackerContentTitle}
168
+ .tracker_content_categories=${trackerContentCategories}
169
+ .tracker_user_type=${trackerUserType}
170
+ .tracker_subscription_status=${trackerSubscriptionStatus}
171
+ .tracker_page_domain=${trackerPageDomain}
172
+ .metered_wall_type=${meteredWallType}
173
+ .tracker_metered_wall_balance=${trackerMeteredWallBalance}
174
+ style="margin-left: 10px; height: 25px; display: flex; align-items: center"
175
+ .theme=${headerTheme}
176
+ ></kompasid-header-account>
177
+ `)}
178
+ </div>
179
+ </header>
123
180
  `,
124
- document.body
125
- )
181
+ document.getElementById('header-container')
182
+ )
183
+ }
184
+
185
+
186
+
187
+ function handleInput(e) {
188
+ try {
189
+ currentUserData = JSON.parse(e.target.value)
190
+ renderKey += 1
191
+ renderHeader(currentUserData)
192
+ } catch (err) {
193
+ // ignore
194
+ }
195
+ }
196
+ // prevent used-before-define
197
+ let handleTemplateClick
198
+
199
+ function renderController(userData) {
200
+ render(
201
+ html`
202
+ <h3>User Data Controller</h3>
203
+ <div style="margin-bottom: 10px;">
204
+ <button @click=${() => handleTemplateClick('gracePeriod')}>grace period</button>
205
+ <button @click=${() => handleTemplateClick('moreThan3Days')}>moreThan3Days</button>
206
+ <button @click=${() => handleTemplateClick('lessThan3Days')}>lessThan3Days</button>
207
+ <button @click=${() => handleTemplateClick('tidakBerlangganan')}>Tidak berlangganan</button>
208
+ </div>
209
+ <textarea @input=${handleInput} .value=${JSON.stringify(userData, null, 2)} style="width: 100%; height: 200px; font-family: monospace;"></textarea>
210
+ `,
211
+ document.getElementById('controller-container')
212
+ )
213
+ }
214
+
215
+ handleTemplateClick = (key) => {
216
+ currentUserData = templates[key]
217
+ renderKey += 1
218
+ renderHeader(currentUserData)
219
+ renderController(currentUserData)
220
+ }
221
+
222
+
223
+ renderHeader(currentUserData)
224
+ renderController(currentUserData)
126
225
  </script>
226
+ </head>
227
+
228
+ <body>
229
+ <div id="controller-container" style="margin-top: 100px; padding: 20px;"></div>
230
+ <div id="header-container"></div>
127
231
  </body>
128
232
 
129
- </html>
233
+ </html>
package/demo/index.html CHANGED
@@ -59,7 +59,7 @@
59
59
  import '../dist/src/components/kompasid-header-notification/KompasHeaderNotification.js'
60
60
  import '../dist/src/components/kompasid-grace-period/KompasGracePeriod.js'
61
61
 
62
- const type = 'proMiningArticle'
62
+ const type = 'proMiningOutlook'
63
63
  const theme = ''
64
64
  const paywallLocation = 'paywall_location'
65
65
  const paywallSubscriptionId = 'testId'
@@ -282,7 +282,7 @@
282
282
  >
283
283
  </kompasid-metered-paywall>
284
284
  <kompasid-metered-paywall-personalize
285
- segment="Unaware"
285
+ segment="lost but curious"
286
286
  offering="Q3"
287
287
  user_name="Dummy User"
288
288
  rubrik="Politik &amp; Hukum"
@@ -67,8 +67,7 @@ let KompasHeaderAccountProfile = class KompasHeaderAccountProfile extends LitEle
67
67
  * Subs Button Element
68
68
  */
69
69
  const subscribeButton = () => {
70
- var _a;
71
- if (!((_a = this.userData) === null || _a === void 0 ? void 0 : _a.isMembership)) {
70
+ if (this.userData.isMembership) {
72
71
  return html ``;
73
72
  }
74
73
  const handleSubscribe = () => {
@@ -109,7 +108,7 @@ let KompasHeaderAccountProfile = class KompasHeaderAccountProfile extends LitEle
109
108
  */
110
109
  const activeInfoTemplate = () => {
111
110
  const { isGracePeriod, totalGracePeriod, activeInfo, expired } = this.userData;
112
- let result = html ``;
111
+ let result = html `${activeInfo}`;
113
112
  let endGracePeriodDate = '';
114
113
  const nowDate = new Date();
115
114
  const isoDateString = expired.replace(' ', 'T');
@@ -1 +1 @@
1
- {"version":3,"file":"KompasHeaderAccountProfile.js","sourceRoot":"","sources":["../../../../src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,a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AR,KAAK,EAAE;kEAA2B;AA1CxB,0BAA0B;IADtC,aAAa,CAAC,iCAAiC,CAAC;GACpC,0BAA0B,CAmPtC;SAnPY,0BAA0B","sourcesContent":["import { LitElement, html, css } from 'lit'\nimport { format, addDays, differenceInDays } from 'date-fns'\nimport { id } from 'date-fns/locale/id'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { User } from '../kompasid-header-account/types.js'\nimport '../kompasid-grace-period/KompasGracePeriod.js'\n\n@customElement('kompasid-header-account-profile')\nexport class KompasHeaderAccountProfile extends LitElement {\n static styles = [\n css`\n .header-account--membership-icon {\n position: absolute;\n bottom: -2px;\n right: -2px;\n }\n `,\n TWStyles,\n ]\n\n /**\n * Props\n */\n @property({ type: String }) userInitialName = ''\n @property({ type: Object }) userData = {} as User\n @property({ type: String }) subscriptionUrl = ''\n @property({ type: Number }) totalGracePeriod = 0\n @property({ type: String }) openFrom = ''\n /**\n * Props For Grace Period Tracker\n */\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\n /**\n * State\n */\n @state() private maxGracePeriod = 7\n\n formatDate(date: Date | string) {\n return format(new Date(date), 'dd MMM yyyy', { locale: id })\n }\n\n private renderSkeletonLoading() {\n return html`\n <div>\n <div class=\"flex flex-row mb-5 items-center gap-4 leading-none\">\n <div\n class=\"bg-grey-300 py-5 rounded-full h-16 w-16 animate-pulse\"\n ></div>\n <div class=\"flex flex-col text-left w-40 gap-y-2\">\n <div class=\"h-3 rounded-sm w-full bg-grey-300 animate-pulse\"></div>\n <div class=\"h-3 rounded-sm w-full bg-grey-300 animate-pulse\"></div>\n <div class=\"h-3 rounded-sm w-full bg-grey-300 animate-pulse\"></div>\n </div>\n </div>\n <div>\n <div class=\"h-6 rounded-sm w-full bg-grey-300 animate-pulse\"></div>\n </div>\n </div>\n `\n }\n\n private renderProfileContent() {\n /**\n * Subs Button Element\n */\n const subscribeButton = () => {\n if (!(this.userData as any)?.isMembership) {\n return html``\n }\n const handleSubscribe = () => {\n const openFromValue = this.openFrom || 'Sidebar_Menu'\n window.location.href = `${this.subscriptionUrl}?open_from=${openFromValue}`\n }\n\n return html`\n <div class=\"w-full\">\n <button\n @click=${handleSubscribe}\n class=\"w-full rounded-lg px-4 py-3 mt-4 h-10 flex justify-center items-center bg-brand-1 text-grey-100 font-bold text-base focus:outline-none\"\n >\n Berlangganan Sekarang\n </button>\n </div>\n `\n }\n /**\n * membership icon element, show if isMebership has truthy value\n */\n const membershipIcon = () => {\n if (!this.userData?.isMembership) {\n return html``\n }\n\n return html`\n <div>\n <img\n class=\"header-account--membership-icon h-6 w-6\"\n src=\"https://cdn-www.kompas.id/global-header/crown-royal-blue-60.svg\"\n alt=\"membership-crown-icon\"\n />\n </div>\n `\n }\n\n /**\n * Active Info Element\n */\n\n const activeInfoTemplate = () => {\n const { isGracePeriod, totalGracePeriod, activeInfo, expired } =\n this.userData\n let result = html``\n let endGracePeriodDate = ''\n\n const nowDate = new Date()\n const isoDateString = expired.replace(' ', 'T')\n const expiredDate = new Date(isoDateString)\n const subsDaysLeft: number = differenceInDays(expiredDate, nowDate)\n\n const gracePeriodCard = () => {\n if (isGracePeriod) {\n const totalGraceSubs = Math.max(totalGracePeriod - 1, 0)\n endGracePeriodDate = this.formatDate(\n addDays(new Date(), this.maxGracePeriod - totalGraceSubs)\n )\n }\n const label = activeInfo ?? 'Periode Masa Tenggang'\n return html`\n <div class=\"text-orange-500 gracePeriodCard\">\n <span>${label}</span>\n <p class=\"font-bold\">hingga ${endGracePeriodDate}</p>\n </div>\n `\n }\n\n const lessThan3daysCard = () => {\n const label = activeInfo ?? 'Aktif Berlangganan'\n return html`\n <div class=\"lessThan3daysCard\">\n <span> ${label} </span>\n <p class=\"font-bold\">Berakhir ${subsDaysLeft} hari lagi</p>\n </div>\n `\n }\n\n const moreThan3daysCard = () => {\n const formattedExpired = this.formatDate(expired)\n const label = activeInfo ?? 'Aktif Berlangganan'\n return html`\n <div class=\"moreThan3daysCard\">\n <span>${label}</span>\n <p class=\"font-bold\">hingga ${formattedExpired}</p>\n </div>\n `\n }\n\n if (isGracePeriod) {\n result = gracePeriodCard()\n } else if (subsDaysLeft > 0 && subsDaysLeft <= 3) {\n result = lessThan3daysCard()\n } else if (subsDaysLeft > 3) {\n result = moreThan3daysCard()\n }\n\n return html`<p class=\"text-sm text-grey-600 ${subsDaysLeft}-days-left\">\n ${result}\n </p>`\n }\n\n return html`\n <div\n class=\"active-info flex flex-col items-start leading-none text-left font-sans\"\n >\n <div class=\"flex flex-row items-center gap-4\">\n <div\n class=\"flex bg-brand-1 flex-shrink-0 p-5 rounded-full h-16 w-16 items-center justify-center relative\"\n >\n <span class=\"capitalize text-2xl text-grey-100 font-bold\">\n ${this.userInitialName}\n </span>\n ${membershipIcon()}\n </div>\n\n <div class=\"flex flex-col text-left\">\n <p class=\"capitalize font-bold text-base text-blue-600\">\n ${this.userData.userName}\n </p>\n ${activeInfoTemplate()}\n </div>\n </div>\n\n ${this.userData?.isGracePeriod\n ? html` <div class=\"mt-4 kompasid-grace-period\">\n <kompasid-grace-period\n totalGracePeriod=${this.userData.totalGracePeriod}\n isColumn=\"true\"\n isShowButton=\"true\"\n isBackgroundOnContentOnly=\"true\"\n paywall_location=${this.paywall_location}\n paywall_subscription_package=${this\n .paywall_subscription_package}\n paywall_subscription_id=${this.paywall_subscription_id}\n paywall_subscription_price=${this.paywall_subscription_price}\n paywall_position=${this.paywall_position}\n tracker_page_type=${this.tracker_page_type}\n tracker_content_id=${this.tracker_content_id}\n tracker_content_title=${this.tracker_content_title}\n tracker_content_categories=${this.tracker_content_categories}\n tracker_content_type=${this.tracker_content_type}\n tracker_user_type=${this.tracker_user_type}\n tracker_subscription_status=${this.tracker_subscription_status}\n tracker_page_domain=${this.tracker_page_domain}\n tracker_metered_wall_type=${this.tracker_metered_wall_type}\n tracker_metered_wall_balance=${this\n .tracker_metered_wall_balance}\n ></kompasid-grace-period>\n </div>`\n : subscribeButton()}\n </div>\n `\n }\n\n override async connectedCallback() {\n super.connectedCallback()\n }\n\n render() {\n return html`\n <div class=\"flex flex-shrink-0 flex-col p-4\">\n ${!this.userData\n ? this.renderSkeletonLoading()\n : this.renderProfileContent()}\n </div>\n <hr class=\"border-grey-300 mx-4\" />\n `\n }\n}\n"]}
1
+ {"version":3,"file":"KompasHeaderAccountProfile.js","sourceRoot":"","sources":["../../../../src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AAExD,OAAO,+CAA+C,CAAA;AAG/C,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,UAAU;IAAnD;;QAYL;;WAEG;QACyB,oBAAe,GAAG,EAAE,CAAA;QACpB,aAAQ,GAAG,EAAU,CAAA;QACrB,oBAAe,GAAG,EAAE,CAAA;QACpB,qBAAgB,GAAG,CAAC,CAAA;QACpB,aAA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4B;AAC3B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8EAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oEAAqB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qEAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sEAAwB;AACvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yEAA2B;AAC1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8EAAgC;AAC/B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wEAA0B;AACzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qEAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+EAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uEAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6EAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gFAAiC;AAKnD;IAAR,KAAK,EAAE;kEAA2B;AA1CxB,0BAA0B;IADtC,aAAa,CAAC,iCAAiC,CAAC;GACpC,0BAA0B,CAoPtC;SApPY,0BAA0B","sourcesContent":["import { LitElement, html, css } from 'lit'\nimport { format, addDays, differenceInDays } from 'date-fns'\nimport { id } from 'date-fns/locale/id'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { User } from '../kompasid-header-account/types.js'\nimport '../kompasid-grace-period/KompasGracePeriod.js'\n\n@customElement('kompasid-header-account-profile')\nexport class KompasHeaderAccountProfile extends LitElement {\n static styles = [\n css`\n .header-account--membership-icon {\n position: absolute;\n bottom: -2px;\n right: -2px;\n }\n `,\n TWStyles,\n ]\n\n /**\n * Props\n */\n @property({ type: String }) userInitialName = ''\n @property({ type: Object }) userData = {} as User\n @property({ type: String }) subscriptionUrl = ''\n @property({ type: Number }) totalGracePeriod = 0\n @property({ type: String }) openFrom = ''\n /**\n * Props For Grace Period Tracker\n */\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\n /**\n * State\n */\n @state() private maxGracePeriod = 7\n\n formatDate(date: Date | string) {\n return format(new Date(date), 'dd MMM yyyy', { locale: id })\n }\n\n private renderSkeletonLoading() {\n return html`\n <div>\n <div class=\"flex flex-row mb-5 items-center gap-4 leading-none\">\n <div\n class=\"bg-grey-300 py-5 rounded-full h-16 w-16 animate-pulse\"\n ></div>\n <div class=\"flex flex-col text-left w-40 gap-y-2\">\n <div class=\"h-3 rounded-sm w-full bg-grey-300 animate-pulse\"></div>\n <div class=\"h-3 rounded-sm w-full bg-grey-300 animate-pulse\"></div>\n <div class=\"h-3 rounded-sm w-full bg-grey-300 animate-pulse\"></div>\n </div>\n </div>\n <div>\n <div class=\"h-6 rounded-sm w-full bg-grey-300 animate-pulse\"></div>\n </div>\n </div>\n `\n }\n\n private renderProfileContent() {\n /**\n * Subs Button Element\n */\n const subscribeButton = () => {\n if (this.userData.isMembership) {\n return html``\n }\n const handleSubscribe = () => {\n const openFromValue = this.openFrom || 'Sidebar_Menu'\n window.location.href = `${this.subscriptionUrl}?open_from=${openFromValue}`\n }\n\n return html`\n <div class=\"w-full\">\n <button\n @click=${handleSubscribe}\n class=\"w-full rounded-lg px-4 py-3 mt-4 h-10 flex justify-center items-center bg-brand-1 text-grey-100 font-bold text-base focus:outline-none\"\n >\n Berlangganan Sekarang\n </button>\n </div>\n `\n }\n /**\n * membership icon element, show if isMebership has truthy value\n */\n const membershipIcon = () => {\n if (!this.userData?.isMembership) {\n return html``\n }\n\n return html`\n <div>\n <img\n class=\"header-account--membership-icon h-6 w-6\"\n src=\"https://cdn-www.kompas.id/global-header/crown-royal-blue-60.svg\"\n alt=\"membership-crown-icon\"\n />\n </div>\n `\n }\n\n /**\n * Active Info Element\n */\n\n const activeInfoTemplate = () => {\n const { isGracePeriod, totalGracePeriod, activeInfo, expired } =\n this.userData\n\n let result = html`${activeInfo}`\n let endGracePeriodDate = ''\n\n const nowDate = new Date()\n const isoDateString = expired.replace(' ', 'T')\n const expiredDate = new Date(isoDateString)\n const subsDaysLeft: number = differenceInDays(expiredDate, nowDate)\n\n const gracePeriodCard = () => {\n if (isGracePeriod) {\n const totalGraceSubs = Math.max(totalGracePeriod - 1, 0)\n endGracePeriodDate = this.formatDate(\n addDays(new Date(), this.maxGracePeriod - totalGraceSubs)\n )\n }\n const label = activeInfo ?? 'Periode Masa Tenggang'\n return html`\n <div class=\"text-orange-500 gracePeriodCard\">\n <span>${label}</span>\n <p class=\"font-bold\">hingga ${endGracePeriodDate}</p>\n </div>\n `\n }\n\n const lessThan3daysCard = () => {\n const label = activeInfo ?? 'Aktif Berlangganan'\n return html`\n <div class=\"lessThan3daysCard\">\n <span> ${label} </span>\n <p class=\"font-bold\">Berakhir ${subsDaysLeft} hari lagi</p>\n </div>\n `\n }\n\n const moreThan3daysCard = () => {\n const formattedExpired = this.formatDate(expired)\n const label = activeInfo ?? 'Aktif Berlangganan'\n return html`\n <div class=\"moreThan3daysCard\">\n <span>${label}</span>\n <p class=\"font-bold\">hingga ${formattedExpired}</p>\n </div>\n `\n }\n\n if (isGracePeriod) {\n result = gracePeriodCard()\n } else if (subsDaysLeft > 0 && subsDaysLeft <= 3) {\n result = lessThan3daysCard()\n } else if (subsDaysLeft > 3) {\n result = moreThan3daysCard()\n }\n\n return html`<p class=\"text-sm text-grey-600 ${subsDaysLeft}-days-left\">\n ${result}\n </p>`\n }\n\n return html`\n <div\n class=\"active-info flex flex-col items-start leading-none text-left font-sans\"\n >\n <div class=\"flex flex-row items-center gap-4\">\n <div\n class=\"flex bg-brand-1 flex-shrink-0 p-5 rounded-full h-16 w-16 items-center justify-center relative\"\n >\n <span class=\"capitalize text-2xl text-grey-100 font-bold\">\n ${this.userInitialName}\n </span>\n ${membershipIcon()}\n </div>\n\n <div class=\"flex flex-col text-left\">\n <p class=\"capitalize font-bold text-base text-blue-600\">\n ${this.userData.userName}\n </p>\n ${activeInfoTemplate()}\n </div>\n </div>\n\n ${this.userData?.isGracePeriod\n ? html` <div class=\"mt-4 kompasid-grace-period\">\n <kompasid-grace-period\n totalGracePeriod=${this.userData.totalGracePeriod}\n isColumn=\"true\"\n isShowButton=\"true\"\n isBackgroundOnContentOnly=\"true\"\n paywall_location=${this.paywall_location}\n paywall_subscription_package=${this\n .paywall_subscription_package}\n paywall_subscription_id=${this.paywall_subscription_id}\n paywall_subscription_price=${this.paywall_subscription_price}\n paywall_position=${this.paywall_position}\n tracker_page_type=${this.tracker_page_type}\n tracker_content_id=${this.tracker_content_id}\n tracker_content_title=${this.tracker_content_title}\n tracker_content_categories=${this.tracker_content_categories}\n tracker_content_type=${this.tracker_content_type}\n tracker_user_type=${this.tracker_user_type}\n tracker_subscription_status=${this.tracker_subscription_status}\n tracker_page_domain=${this.tracker_page_domain}\n tracker_metered_wall_type=${this.tracker_metered_wall_type}\n tracker_metered_wall_balance=${this\n .tracker_metered_wall_balance}\n ></kompasid-grace-period>\n </div>`\n : subscribeButton()}\n </div>\n `\n }\n\n override async connectedCallback() {\n super.connectedCallback()\n }\n\n render() {\n return html`\n <div class=\"flex flex-shrink-0 flex-col p-4\">\n ${!this.userData\n ? this.renderSkeletonLoading()\n : this.renderProfileContent()}\n </div>\n <hr class=\"border-grey-300 mx-4\" />\n `\n }\n}\n"]}
@@ -265,7 +265,7 @@ let KompasHeaderNotification = class KompasHeaderNotification extends LitElement
265
265
  </div>
266
266
  <div class="text-grey-600">
267
267
  <p class="text-sm font-bold break-words">${item.title}</p>
268
- <p class="text-sm">${item.description}</p>
268
+ <p class="text-sm" .innerHTML=${item.description}></p>
269
269
  </div>
270
270
  </div>
271
271
  <div class="w-1/4">
@@ -1 +1 @@
1
- {"version":3,"file":"KompasHeaderNotification.js","sourceRoot":"","sources":["../../../../src/components/kompasid-header-notification/KompasHeaderNotification.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AACzE,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAA;AAC9C,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AAOxD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAG3D,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,UAAU;IAsJtD;QACE,KAAK,EAAE,CAAA;QA7BA,mBAAc,GA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;IAAR,KAAK,EAAE;gEAAgC;AAC/B;IAAR,KAAK,EAAE;6DAA6B;AAC5B;IAAR,KAAK,EAAE;sEAAgE;AAC/D;IAAR,KAAK,EAAE;yEAAoC;AACnC;IAAR,KAAK,EAAE;8DAA8B;AAC7B;IAAR,KAAK,EAAE;2DAAsB;AAYF;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6DAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8DAAkB;AACjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAAc;AACb;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAAyC;AAExC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mEAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6EAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qEAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2EAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8EAAiC;AApJjD,wBAAwB;IADpC,aAAa,CAAC,8BAA8B,CAAC;GACjC,wBAAwB,CAkpBpC;SAlpBY,wBAAwB","sourcesContent":["import { LitElement, html, css } from 'lit'\nimport { format, isToday, formatDistanceStrict, subDays } from 'date-fns'\nimport { cva } from 'class-variance-authority'\nimport { id } from 'date-fns/locale/id'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { unsafeSVG } from 'lit/directives/unsafe-svg.js'\nimport { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport {\n UserNotification,\n NotificationList,\n ApiResponse,\n ApiRubrikResponse,\n} from './types.js'\nimport { customFetch } from './utils.js'\nimport { getHeaderTheme } from '../../utils/api/getHeaderTheme.js'\n\n@customElement('kompasid-header-notification')\nexport class KompasHeaderNotification extends LitElement {\n static styles = [\n css`\n :host {\n font-family: 'PT Sans', sans-serif;\n }\n\n .header-account--notification-indicator {\n position: absolute;\n top: 0;\n height: 0.5rem;\n width: 0.5rem;\n background-color: #ff7a00;\n border-radius: 50%;\n right: 0.03rem;\n top: 0.09rem;\n border: 1.2px solid white;\n }\n\n .break-words {\n overflow-wrap: break-word;\n }\n\n .header-notification-dropdown {\n width: 20.5rem;\n background-color: #ffffff;\n font-family: 'PT Sans', sans-serif;\n font-size: 0.875rem;\n position: absolute;\n right: -7.5vmax;\n }\n\n .w-14 {\n width: 3.25rem;\n }\n\n .pb-18 {\n padding-bottom: 4.5rem;\n }\n\n .h-\\\\[300px\\\\] {\n height: 300px;\n }\n\n .h-14 {\n height: 3.25rem;\n }\n\n .bg-green-100 {\n --tw-bg-opacity: 1;\n background-color: rgb(238 252 210 / var(--tw-bg-opacity));\n }\n\n .overflow-y-scroll {\n overflow-y: scroll;\n }\n\n .link-active {\n color: #0468cb;\n border-color: #0468cb;\n border-bottom-width: 3px;\n background-color: transparent !important;\n }\n\n .animate-spin {\n animation: spin 2s linear infinite;\n }\n\n @keyframes spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n }\n\n .object-cover {\n object-fit: cover;\n }\n\n .z-index-max {\n z-index: 99999;\n }\n\n /* Custom Scrollbar for header */\n /* width */\n ::-webkit-scrollbar {\n width: 4px;\n }\n\n /* Track */\n ::-webkit-scrollbar-track {\n background: transparent;\n }\n\n /* Handle */\n ::-webkit-scrollbar-thumb {\n background: #0356a8;\n border-radius: 100px;\n }\n\n /* Handle on hover */\n ::-webkit-scrollbar-thumb:hover {\n background: #0356a8;\n }\n\n @media (min-width: 1024px) {\n .header-notification-dropdown {\n right: -4vmax;\n }\n }\n\n @media (max-width: 360px) {\n .header-notification-dropdown {\n right: -10vmax;\n }\n }\n `,\n TWStyles,\n ]\n\n @state() isShowDropdown: boolean = false\n @state() selectedTab: string = 'Info'\n @state() notificationInfoData: UserNotification = {} as UserNotification\n @state() notificationContentData: any[] = []\n @state() isDataLoaded: boolean = false\n @state() themeList: any = null\n /*\n * property accessToken is the access token of the user\n * property refreshToken is the refresh token of the user\n * property domain is the domain of the API based on website\n * property tracker_user_type is the type of user based on their subscription\n * property tracker_subscription_status is the status of their subscription\n * property tracker_page_domain is the page domain\n * property tracker_metered_wall_type is the type of metered wall\n * property tracker_metered_wall_balance is the balance of their metered wall\n */\n\n @property({ type: String }) accessToken = ''\n @property({ type: String }) refreshToken = ''\n @property({ type: String }) domain = 'id' // 'id' | 'cloud'\n @property({ type: String }) theme: 'default' | 'primary' = 'default'\n\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 constructor() {\n super()\n this.handleClickOutside = this.handleClickOutside.bind(this)\n }\n\n /**\n * Function to format date\n */\n formatDate(date: string) {\n // Check if the provided date is today\n let result\n if (isToday(date)) {\n // Return time difference if it's today (e.g., \"7 hours ago\")\n result = `${formatDistanceStrict(date, new Date(), { locale: id })} lalu`\n } else {\n // Return formatted date (e.g., \"12 Sep 2024, 09:00\")\n result = format(date, 'dd MMM yyyy, HH:mm', { locale: id })\n }\n return result\n }\n\n override async connectedCallback() {\n super.connectedCallback()\n this.isShowDropdown = false\n this.themeList = await getHeaderTheme()\n\n if ((this.accessToken || this.refreshToken) && this.domain)\n await this.loadData()\n document.addEventListener('click', this.handleClickOutside)\n }\n\n override async disconnectedCallback() {\n super.disconnectedCallback()\n document.removeEventListener('click', this.handleClickOutside)\n }\n\n private setTheme(param: any): String {\n if (!this.themeList) return 'text-grey-100'\n const cvaFn = cva('', { variants: this.themeList })\n\n return cvaFn(param)\n }\n\n private async apiFetch(url: string, options: any) {\n const response = await customFetch(\n url,\n this.refreshToken,\n this.accessToken,\n this.domain,\n { ...options }\n )\n\n return response\n }\n\n private async getNotifRubrik() {\n const req = this.apiFetch(\n `https://cds.kompas.${this.domain}/api/v1/article/pilihanku`,\n {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n }\n )\n return req\n }\n\n private async getNotifList() {\n const req = await this.apiFetch(\n `https://api.kompas.${this.domain}/account/api/v1/users/notification`,\n {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n }\n )\n return req\n }\n\n private async getEpaperData() {\n const formatDate = 'yyyy/MM/dd'\n const startDate = format(subDays(new Date(), 1), formatDate)\n const endDate = format(new Date(), formatDate).toString()\n const req = await this.apiFetch(\n `https://apiepaper.kompas.${this.domain}/products?startDate=${startDate}&endDate=${endDate}&sort=desc`,\n {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n }\n )\n\n return req\n }\n\n private async notifRead(notifId: string) {\n const req = await this.apiFetch(\n `https://api.kompas.${this.domain}/account/api/v1/users/notification/read`,\n {\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'PUT',\n body: JSON.stringify({\n notificationId: notifId,\n }),\n }\n )\n return req\n }\n\n private async loadData() {\n const apiCalls = [\n this.getNotifList(),\n this.getNotifRubrik(),\n this.getEpaperData(),\n ]\n this.isDataLoaded = false\n\n Promise.all(apiCalls)\n .then(responses =>\n Promise.all(responses.map(response => response.json()))\n )\n .then(values => {\n this.notificationInfoData = (\n values[0] as ApiResponse<UserNotification>\n ).data\n this.notificationInfoData.notificationList =\n this.notificationInfoData.notificationList || []\n const rubrikData = (values[1] as ApiRubrikResponse<any>).result || []\n const ePaperData = (values[2] as ApiResponse<any>).data[0] || {}\n\n const { publishDate, description, thumbnail, title, url } = ePaperData\n\n const data = {\n title,\n category: [{ name: 'ePaper', slug: 'epaper' }],\n publishedDate: format(new Date(publishDate), 'yyyy-MM-dd HH:mm:ss'),\n permalink: url,\n thumbnails: {\n sizes: { thumbnailSquareMedium: { permalink: thumbnail } },\n },\n excerpt: description,\n }\n\n this.notificationContentData = [data, ...rubrikData]\n this.notificationContentData.sort(\n (a: any, b: any) =>\n new Date(b.publishedDate).getTime() -\n new Date(a.publishedDate).getTime()\n )\n\n this.isDataLoaded = true\n })\n }\n\n private toggleDropdown() {\n this.isShowDropdown = !this.isShowDropdown\n\n // if opened, fire the datalayer\n if (this.isShowDropdown) this.pushDataLayer('notification_opened')\n }\n\n private notificationIcon() {\n const notificationIndicator = () => {\n if (!this.notificationInfoData.notificationCount) return html``\n return html`<div class=\"header-account--notification-indicator\"></div>`\n }\n\n return html`\n <button\n @click=${this.toggleDropdown}\n class=\"cursor-pointer relative flex items-center\"\n >\n ${notificationIndicator()}\n <div class=\"flex flex-row items-center self-center\">\n <div\n class=\"cursor-pointer mt-0.5 ${this.setTheme({\n icon: this.theme,\n })}\"\n >\n ${unsafeSVG(getFontAwesomeIcon('fas', 'bell', 21, 21))}\n </div>\n </div>\n </button>\n `\n }\n\n private handleClick = (value: string) => {\n this.selectedTab = value\n }\n\n private handleNotificationUrlParam = (url: string, type: string) => {\n const params = {\n open_from: type,\n }\n const newUrl = new URL(decodeURIComponent(url))\n if (newUrl.search) {\n for (const [key, value] of Object.entries(params)) {\n if (!newUrl.searchParams.has(key)) {\n newUrl.searchParams.append(key, value)\n }\n }\n } else {\n newUrl.search = new URLSearchParams(params).toString()\n }\n\n return newUrl.toString()\n }\n\n private redirectTo = async (notifData: NotificationList) => {\n const { notificationId: notifId, link, label } = notifData\n const res = await this.notifRead(notifId)\n\n if (res.status === 200) {\n this.notificationInfoData = {\n ...this.notificationInfoData,\n notificationList: this.notificationInfoData.notificationList\n ? this.notificationInfoData.notificationList.map(notifItem => ({\n ...notifItem,\n isRead:\n notifItem.notificationId === notifId ? true : notifItem.isRead,\n }))\n : [],\n }\n }\n\n this.pushDataLayer('notification_clicked', 'Information', label)\n if (link) {\n const url = this.handleNotificationUrlParam(link, 'Notification_Info')\n window.open(url, '_blank')\n }\n }\n\n private handleClickOutside(event: Event) {\n if (!this.isShowDropdown) return\n\n const popup = this.shadowRoot?.getElementById('headerNotification')\n const ev = event.composedPath()\n if (this.isShowDropdown && popup && !ev?.includes(popup as HTMLElement)) {\n this.isShowDropdown = false // Close the popup\n }\n }\n\n // Notification Info\n private notificationInfoSection() {\n const {\n notificationList,\n }: { notificationList: NotificationList[] | null } =\n this.notificationInfoData\n\n // Empty state\n if (!notificationList || !notificationList.length)\n return html`\n <div class=\"text-center px-4 pt-6 pb-18\">\n <img\n src=\"https://cdn-www.kompas.id/assets/empty-state-notification.png\"\n alt=\"empty-state-notification\"\n class=\"w-auto mx-auto\"\n />\n <p class=\"font-bold text-center text-lg py-2\">Belum Ada Notifikasi</p>\n <p class=\"px-2\">\n Kami akan memberitahukan Anda ketika ada informasi dan pemberitahuan\n terbaru.\n </p>\n </div>\n `\n\n const notificationInfoListTemplate = (item: NotificationList) => {\n const imgUrl =\n item.label === 'Akun'\n ? `https://cdn-www.kompas.id/assets/notifikasi-akun.svg`\n : `https://cdn-www.kompas.id/assets/langganan-anda-telah-berakhir.svg`\n\n return html`<div class=\"w-3/4 pr-1\">\n <div class=\"flex items-center mb-1 text-xs font-bold\">\n <span class=\"text-green-500 bg-green-100 rounded-sm p-1 px-2\">\n ${item.label}\n </span>\n <span class=\"text-grey-400 ml-2\"\n >${this.formatDate(item.time)}</span\n >\n </div>\n <div class=\"text-grey-600\">\n <p class=\"text-sm font-bold break-words\">${item.title}</p>\n <p class=\"text-sm\">${item.description}</p>\n </div>\n </div>\n <div class=\"w-1/4\">\n <img src=\"${imgUrl}\" alt=\"${item.label}-alt\" class=\"w-14 h-14\" />\n </div>`\n }\n\n return html`<div class=\"h-[300px] overflow-y-scroll\">\n ${notificationList.map(\n item =>\n html`<button\n class=\"flex w-full text-left items-start p-4 cursor-pointer justify-between ${!item.isRead\n ? 'bg-blue-100'\n : ''}\"\n @click=${() => this.redirectTo(item)}\n >\n ${notificationInfoListTemplate(item)}\n </button> `\n )}\n </div>\n <!-- Footer Link -->\n <div class=\"px-4 py-4 text-center\">\n <a href=\"#\" @click=\"${() =>\n this.redirectToNotification(\n 'info'\n )}\" class=\"text-base font-bold text-blue-500\">\n Lihat Selengkapnya</a\n >\n </div>\n </div>`\n }\n\n private redirectToNotification(tab: string) {\n window.open(\n `https://manage-account.kompas.${this.domain}/manage-account/notification/${tab}`,\n '_blank'\n )\n }\n\n // Notification Content\n private notificationContentSection() {\n // Empty state\n if (!this.notificationContentData.length) {\n return html`\n <div class=\"text-center px-4 pt-6 pb-18\">\n <img\n src=\"https://cdn-www.kompas.id/assets/empty-state-notification.png\"\n alt=\"empty-state-notification\"\n class=\"w-auto mx-auto\"\n />\n <p class=\"font-bold text-center text-lg py-2\">Belum Ada Notifikasi</p>\n <p class=\"px-2\">\n Kami akan memberitahukan Anda ketika ada informasi dan pemberitahuan\n terbaru.\n </p>\n </div>\n `\n }\n const notificationContentListTemplate = (item: any) => html`<div\n class=\"w-3/4 pr-1 \"\n >\n <div class=\"flex items-center mb-1 text-xs font-bold\">\n <span class=\"text-green-500 bg-green-100 rounded-sm p-1 px-2\">\n ${item.category[0].name}\n </span>\n <span class=\"text-grey-400 ml-2\">\n ${this.formatDate(item.publishedDate)}</span\n >\n </div>\n <p class=\"font-bold text-sm text-grey-600 py-1 break-words\">\n ${item.title}\n </p>\n </div>\n <div class=\"w-1/4\">\n <img\n src=\"${item.thumbnails.sizes.thumbnailSquareMedium.permalink}\"\n alt=\"content-img-alt\"\n class=\"w-14 h-14 object-cover\"\n />\n </div>`\n\n return html`<div class=\"h-[300px] overflow-y-scroll\">\n ${this.notificationContentData.map(\n item =>\n html`<button\n class=\"flex w-full text-left items-start p-4 cursor-pointer justify-between ${!item.isRead\n ? 'bg-blue-100'\n : ''}\"\n @click=${() => {\n this.pushDataLayer('notification_clicked', 'Content', 'Content')\n window.open(\n this.handleNotificationUrlParam(\n item.permalink,\n 'Notification_Content'\n ),\n '_blank'\n )\n }}\n >\n ${notificationContentListTemplate(item)}\n </button> `\n )}\n </div>\n <!-- Footer Link -->\n <div class=\"px-4 py-4 text-center\">\n <a href=\"#\" @click=\"${() =>\n this.redirectToNotification(\n 'konten'\n )}\" class=\"text-base font-bold text-blue-500\">\n Lihat Selengkapnya</a\n >\n </div>\n </div>`\n }\n\n private notificationPopup() {\n const tab = ['Info', 'Konten']\n\n return html`\n <div\n id=\"notificationPopup\"\n class=\"header-notification-dropdown rounded-lg shadow-lg z-50 mt-2 ${this\n .isShowDropdown\n ? 'active'\n : ''}\"\n >\n <div class=\"sticky\">\n <div class=\"flex justify-center py-4 border-b border-grey-300\">\n <span class=\"font-bold text-base text-grey-700\">Notifikasi</span>\n </div>\n <!-- Tabs for Info and Content -->\n <div class=\"flex justify-between text-grey-400\">\n ${tab.map(\n item =>\n html`\n <button\n class=\"focus:outline-none font-bold py-2 w-1/2 ${this\n .selectedTab === item && 'link-active'}\"\n @click=${() => this.handleClick(item)}\n >\n ${item}\n </button>\n `\n )}\n </div>\n </div>\n\n <!-- Notification Content -->\n ${this.selectedTab === 'Info'\n ? this.notificationInfoSection()\n : this.notificationContentSection()}\n </div>\n `\n }\n\n private getParamsData(tab?: string, type?: string): any {\n let notificationData = {}\n let notifType = type\n\n if (type && tab) {\n if (type !== 'Content') {\n switch (true) {\n case /langganan/i.test(type):\n notifType = 'Subscription'\n break\n case type === 'Akun':\n notifType = 'Account'\n break\n case /bayar/i.test(type):\n notifType = 'Payment'\n break\n default:\n notifType = 'Information'\n break\n }\n }\n\n notificationData = {\n notification_tab: tab,\n notification_type: notifType,\n }\n }\n\n const data = {\n user_type: this.tracker_user_type,\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 || 'FP',\n metered_wall_balance: this.tracker_metered_wall_balance,\n }\n\n return {\n ...notificationData,\n ...data,\n }\n }\n\n private pushDataLayer(eventName: string, tab?: string, type?: string): void {\n const data = this.getParamsData(tab, type)\n window.dataLayer.push({\n event: eventName,\n ...data,\n })\n }\n\n render() {\n return html`<div id=\"headerNotification\" class=\"relative\">\n ${this.isDataLoaded\n ? this.notificationIcon()\n : html`<div\n class=\"cursor-pointer mt-0.5 animate-spin ${this.setTheme({\n icon: this.theme,\n })}\"\n >\n ${unsafeSVG(getFontAwesomeIcon('fa', 'circle-notch', 21, 21))}\n </div>`}\n ${this.isShowDropdown ? this.notificationPopup() : ''}\n </div>`\n }\n}\n"]}
1
+ {"version":3,"file":"KompasHeaderNotification.js","sourceRoot":"","sources":["../../../../src/components/kompasid-header-notification/KompasHeaderNotification.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AACzE,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAA;AAC9C,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AAOxD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAG3D,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,UAAU;IAsJtD;QACE,KAAK,EAAE,CAAA;QA7BA,mBAAc,GAAY,KAAK,CAAA;QAC/B,gBAAW,GAAW,MAAM,CAAA;QAC5B,yBAAoB,GAAqB,EAAsB,CAAA;QAC/D,4BAAuB,GAAU,EAA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AAK,EAAE;yEAAoC;AACnC;IAAR,KAAK,EAAE;8DAA8B;AAC7B;IAAR,KAAK,EAAE;2DAAsB;AAYF;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6DAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8DAAkB;AACjB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAAc;AACb;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAAyC;AAExC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mEAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6EAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qEAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2EAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8EAAiC;AApJjD,wBAAwB;IADpC,aAAa,CAAC,8BAA8B,CAAC;GACjC,wBAAwB,CAkpBpC;SAlpBY,wBAAwB","sourcesContent":["import { LitElement, html, css } from 'lit'\nimport { format, isToday, formatDistanceStrict, subDays } from 'date-fns'\nimport { cva } from 'class-variance-authority'\nimport { id } from 'date-fns/locale/id'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { unsafeSVG } from 'lit/directives/unsafe-svg.js'\nimport { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport {\n UserNotification,\n NotificationList,\n ApiResponse,\n ApiRubrikResponse,\n} from './types.js'\nimport { customFetch } from './utils.js'\nimport { getHeaderTheme } from '../../utils/api/getHeaderTheme.js'\n\n@customElement('kompasid-header-notification')\nexport class KompasHeaderNotification extends LitElement {\n static styles = [\n css`\n :host {\n font-family: 'PT Sans', sans-serif;\n }\n\n .header-account--notification-indicator {\n position: absolute;\n top: 0;\n height: 0.5rem;\n width: 0.5rem;\n background-color: #ff7a00;\n border-radius: 50%;\n right: 0.03rem;\n top: 0.09rem;\n border: 1.2px solid white;\n }\n\n .break-words {\n overflow-wrap: break-word;\n }\n\n .header-notification-dropdown {\n width: 20.5rem;\n background-color: #ffffff;\n font-family: 'PT Sans', sans-serif;\n font-size: 0.875rem;\n position: absolute;\n right: -7.5vmax;\n }\n\n .w-14 {\n width: 3.25rem;\n }\n\n .pb-18 {\n padding-bottom: 4.5rem;\n }\n\n .h-\\\\[300px\\\\] {\n height: 300px;\n }\n\n .h-14 {\n height: 3.25rem;\n }\n\n .bg-green-100 {\n --tw-bg-opacity: 1;\n background-color: rgb(238 252 210 / var(--tw-bg-opacity));\n }\n\n .overflow-y-scroll {\n overflow-y: scroll;\n }\n\n .link-active {\n color: #0468cb;\n border-color: #0468cb;\n border-bottom-width: 3px;\n background-color: transparent !important;\n }\n\n .animate-spin {\n animation: spin 2s linear infinite;\n }\n\n @keyframes spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n }\n\n .object-cover {\n object-fit: cover;\n }\n\n .z-index-max {\n z-index: 99999;\n }\n\n /* Custom Scrollbar for header */\n /* width */\n ::-webkit-scrollbar {\n width: 4px;\n }\n\n /* Track */\n ::-webkit-scrollbar-track {\n background: transparent;\n }\n\n /* Handle */\n ::-webkit-scrollbar-thumb {\n background: #0356a8;\n border-radius: 100px;\n }\n\n /* Handle on hover */\n ::-webkit-scrollbar-thumb:hover {\n background: #0356a8;\n }\n\n @media (min-width: 1024px) {\n .header-notification-dropdown {\n right: -4vmax;\n }\n }\n\n @media (max-width: 360px) {\n .header-notification-dropdown {\n right: -10vmax;\n }\n }\n `,\n TWStyles,\n ]\n\n @state() isShowDropdown: boolean = false\n @state() selectedTab: string = 'Info'\n @state() notificationInfoData: UserNotification = {} as UserNotification\n @state() notificationContentData: any[] = []\n @state() isDataLoaded: boolean = false\n @state() themeList: any = null\n /*\n * property accessToken is the access token of the user\n * property refreshToken is the refresh token of the user\n * property domain is the domain of the API based on website\n * property tracker_user_type is the type of user based on their subscription\n * property tracker_subscription_status is the status of their subscription\n * property tracker_page_domain is the page domain\n * property tracker_metered_wall_type is the type of metered wall\n * property tracker_metered_wall_balance is the balance of their metered wall\n */\n\n @property({ type: String }) accessToken = ''\n @property({ type: String }) refreshToken = ''\n @property({ type: String }) domain = 'id' // 'id' | 'cloud'\n @property({ type: String }) theme: 'default' | 'primary' = 'default'\n\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 constructor() {\n super()\n this.handleClickOutside = this.handleClickOutside.bind(this)\n }\n\n /**\n * Function to format date\n */\n formatDate(date: string) {\n // Check if the provided date is today\n let result\n if (isToday(date)) {\n // Return time difference if it's today (e.g., \"7 hours ago\")\n result = `${formatDistanceStrict(date, new Date(), { locale: id })} lalu`\n } else {\n // Return formatted date (e.g., \"12 Sep 2024, 09:00\")\n result = format(date, 'dd MMM yyyy, HH:mm', { locale: id })\n }\n return result\n }\n\n override async connectedCallback() {\n super.connectedCallback()\n this.isShowDropdown = false\n this.themeList = await getHeaderTheme()\n\n if ((this.accessToken || this.refreshToken) && this.domain)\n await this.loadData()\n document.addEventListener('click', this.handleClickOutside)\n }\n\n override async disconnectedCallback() {\n super.disconnectedCallback()\n document.removeEventListener('click', this.handleClickOutside)\n }\n\n private setTheme(param: any): String {\n if (!this.themeList) return 'text-grey-100'\n const cvaFn = cva('', { variants: this.themeList })\n\n return cvaFn(param)\n }\n\n private async apiFetch(url: string, options: any) {\n const response = await customFetch(\n url,\n this.refreshToken,\n this.accessToken,\n this.domain,\n { ...options }\n )\n\n return response\n }\n\n private async getNotifRubrik() {\n const req = this.apiFetch(\n `https://cds.kompas.${this.domain}/api/v1/article/pilihanku`,\n {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n }\n )\n return req\n }\n\n private async getNotifList() {\n const req = await this.apiFetch(\n `https://api.kompas.${this.domain}/account/api/v1/users/notification`,\n {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n }\n )\n return req\n }\n\n private async getEpaperData() {\n const formatDate = 'yyyy/MM/dd'\n const startDate = format(subDays(new Date(), 1), formatDate)\n const endDate = format(new Date(), formatDate).toString()\n const req = await this.apiFetch(\n `https://apiepaper.kompas.${this.domain}/products?startDate=${startDate}&endDate=${endDate}&sort=desc`,\n {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n }\n )\n\n return req\n }\n\n private async notifRead(notifId: string) {\n const req = await this.apiFetch(\n `https://api.kompas.${this.domain}/account/api/v1/users/notification/read`,\n {\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'PUT',\n body: JSON.stringify({\n notificationId: notifId,\n }),\n }\n )\n return req\n }\n\n private async loadData() {\n const apiCalls = [\n this.getNotifList(),\n this.getNotifRubrik(),\n this.getEpaperData(),\n ]\n this.isDataLoaded = false\n\n Promise.all(apiCalls)\n .then(responses =>\n Promise.all(responses.map(response => response.json()))\n )\n .then(values => {\n this.notificationInfoData = (\n values[0] as ApiResponse<UserNotification>\n ).data\n this.notificationInfoData.notificationList =\n this.notificationInfoData.notificationList || []\n const rubrikData = (values[1] as ApiRubrikResponse<any>).result || []\n const ePaperData = (values[2] as ApiResponse<any>).data[0] || {}\n\n const { publishDate, description, thumbnail, title, url } = ePaperData\n\n const data = {\n title,\n category: [{ name: 'ePaper', slug: 'epaper' }],\n publishedDate: format(new Date(publishDate), 'yyyy-MM-dd HH:mm:ss'),\n permalink: url,\n thumbnails: {\n sizes: { thumbnailSquareMedium: { permalink: thumbnail } },\n },\n excerpt: description,\n }\n\n this.notificationContentData = [data, ...rubrikData]\n this.notificationContentData.sort(\n (a: any, b: any) =>\n new Date(b.publishedDate).getTime() -\n new Date(a.publishedDate).getTime()\n )\n\n this.isDataLoaded = true\n })\n }\n\n private toggleDropdown() {\n this.isShowDropdown = !this.isShowDropdown\n\n // if opened, fire the datalayer\n if (this.isShowDropdown) this.pushDataLayer('notification_opened')\n }\n\n private notificationIcon() {\n const notificationIndicator = () => {\n if (!this.notificationInfoData.notificationCount) return html``\n return html`<div class=\"header-account--notification-indicator\"></div>`\n }\n\n return html`\n <button\n @click=${this.toggleDropdown}\n class=\"cursor-pointer relative flex items-center\"\n >\n ${notificationIndicator()}\n <div class=\"flex flex-row items-center self-center\">\n <div\n class=\"cursor-pointer mt-0.5 ${this.setTheme({\n icon: this.theme,\n })}\"\n >\n ${unsafeSVG(getFontAwesomeIcon('fas', 'bell', 21, 21))}\n </div>\n </div>\n </button>\n `\n }\n\n private handleClick = (value: string) => {\n this.selectedTab = value\n }\n\n private handleNotificationUrlParam = (url: string, type: string) => {\n const params = {\n open_from: type,\n }\n const newUrl = new URL(decodeURIComponent(url))\n if (newUrl.search) {\n for (const [key, value] of Object.entries(params)) {\n if (!newUrl.searchParams.has(key)) {\n newUrl.searchParams.append(key, value)\n }\n }\n } else {\n newUrl.search = new URLSearchParams(params).toString()\n }\n\n return newUrl.toString()\n }\n\n private redirectTo = async (notifData: NotificationList) => {\n const { notificationId: notifId, link, label } = notifData\n const res = await this.notifRead(notifId)\n\n if (res.status === 200) {\n this.notificationInfoData = {\n ...this.notificationInfoData,\n notificationList: this.notificationInfoData.notificationList\n ? this.notificationInfoData.notificationList.map(notifItem => ({\n ...notifItem,\n isRead:\n notifItem.notificationId === notifId ? true : notifItem.isRead,\n }))\n : [],\n }\n }\n\n this.pushDataLayer('notification_clicked', 'Information', label)\n if (link) {\n const url = this.handleNotificationUrlParam(link, 'Notification_Info')\n window.open(url, '_blank')\n }\n }\n\n private handleClickOutside(event: Event) {\n if (!this.isShowDropdown) return\n\n const popup = this.shadowRoot?.getElementById('headerNotification')\n const ev = event.composedPath()\n if (this.isShowDropdown && popup && !ev?.includes(popup as HTMLElement)) {\n this.isShowDropdown = false // Close the popup\n }\n }\n\n // Notification Info\n private notificationInfoSection() {\n const {\n notificationList,\n }: { notificationList: NotificationList[] | null } =\n this.notificationInfoData\n\n // Empty state\n if (!notificationList || !notificationList.length)\n return html`\n <div class=\"text-center px-4 pt-6 pb-18\">\n <img\n src=\"https://cdn-www.kompas.id/assets/empty-state-notification.png\"\n alt=\"empty-state-notification\"\n class=\"w-auto mx-auto\"\n />\n <p class=\"font-bold text-center text-lg py-2\">Belum Ada Notifikasi</p>\n <p class=\"px-2\">\n Kami akan memberitahukan Anda ketika ada informasi dan pemberitahuan\n terbaru.\n </p>\n </div>\n `\n\n const notificationInfoListTemplate = (item: NotificationList) => {\n const imgUrl =\n item.label === 'Akun'\n ? `https://cdn-www.kompas.id/assets/notifikasi-akun.svg`\n : `https://cdn-www.kompas.id/assets/langganan-anda-telah-berakhir.svg`\n\n return html`<div class=\"w-3/4 pr-1\">\n <div class=\"flex items-center mb-1 text-xs font-bold\">\n <span class=\"text-green-500 bg-green-100 rounded-sm p-1 px-2\">\n ${item.label}\n </span>\n <span class=\"text-grey-400 ml-2\"\n >${this.formatDate(item.time)}</span\n >\n </div>\n <div class=\"text-grey-600\">\n <p class=\"text-sm font-bold break-words\">${item.title}</p>\n <p class=\"text-sm\" .innerHTML=${item.description}></p>\n </div>\n </div>\n <div class=\"w-1/4\">\n <img src=\"${imgUrl}\" alt=\"${item.label}-alt\" class=\"w-14 h-14\" />\n </div>`\n }\n\n return html`<div class=\"h-[300px] overflow-y-scroll\">\n ${notificationList.map(\n item =>\n html`<button\n class=\"flex w-full text-left items-start p-4 cursor-pointer justify-between ${!item.isRead\n ? 'bg-blue-100'\n : ''}\"\n @click=${() => this.redirectTo(item)}\n >\n ${notificationInfoListTemplate(item)}\n </button> `\n )}\n </div>\n <!-- Footer Link -->\n <div class=\"px-4 py-4 text-center\">\n <a href=\"#\" @click=\"${() =>\n this.redirectToNotification(\n 'info'\n )}\" class=\"text-base font-bold text-blue-500\">\n Lihat Selengkapnya</a\n >\n </div>\n </div>`\n }\n\n private redirectToNotification(tab: string) {\n window.open(\n `https://manage-account.kompas.${this.domain}/manage-account/notification/${tab}`,\n '_blank'\n )\n }\n\n // Notification Content\n private notificationContentSection() {\n // Empty state\n if (!this.notificationContentData.length) {\n return html`\n <div class=\"text-center px-4 pt-6 pb-18\">\n <img\n src=\"https://cdn-www.kompas.id/assets/empty-state-notification.png\"\n alt=\"empty-state-notification\"\n class=\"w-auto mx-auto\"\n />\n <p class=\"font-bold text-center text-lg py-2\">Belum Ada Notifikasi</p>\n <p class=\"px-2\">\n Kami akan memberitahukan Anda ketika ada informasi dan pemberitahuan\n terbaru.\n </p>\n </div>\n `\n }\n const notificationContentListTemplate = (item: any) => html`<div\n class=\"w-3/4 pr-1 \"\n >\n <div class=\"flex items-center mb-1 text-xs font-bold\">\n <span class=\"text-green-500 bg-green-100 rounded-sm p-1 px-2\">\n ${item.category[0].name}\n </span>\n <span class=\"text-grey-400 ml-2\">\n ${this.formatDate(item.publishedDate)}</span\n >\n </div>\n <p class=\"font-bold text-sm text-grey-600 py-1 break-words\">\n ${item.title}\n </p>\n </div>\n <div class=\"w-1/4\">\n <img\n src=\"${item.thumbnails.sizes.thumbnailSquareMedium.permalink}\"\n alt=\"content-img-alt\"\n class=\"w-14 h-14 object-cover\"\n />\n </div>`\n\n return html`<div class=\"h-[300px] overflow-y-scroll\">\n ${this.notificationContentData.map(\n item =>\n html`<button\n class=\"flex w-full text-left items-start p-4 cursor-pointer justify-between ${!item.isRead\n ? 'bg-blue-100'\n : ''}\"\n @click=${() => {\n this.pushDataLayer('notification_clicked', 'Content', 'Content')\n window.open(\n this.handleNotificationUrlParam(\n item.permalink,\n 'Notification_Content'\n ),\n '_blank'\n )\n }}\n >\n ${notificationContentListTemplate(item)}\n </button> `\n )}\n </div>\n <!-- Footer Link -->\n <div class=\"px-4 py-4 text-center\">\n <a href=\"#\" @click=\"${() =>\n this.redirectToNotification(\n 'konten'\n )}\" class=\"text-base font-bold text-blue-500\">\n Lihat Selengkapnya</a\n >\n </div>\n </div>`\n }\n\n private notificationPopup() {\n const tab = ['Info', 'Konten']\n\n return html`\n <div\n id=\"notificationPopup\"\n class=\"header-notification-dropdown rounded-lg shadow-lg z-50 mt-2 ${this\n .isShowDropdown\n ? 'active'\n : ''}\"\n >\n <div class=\"sticky\">\n <div class=\"flex justify-center py-4 border-b border-grey-300\">\n <span class=\"font-bold text-base text-grey-700\">Notifikasi</span>\n </div>\n <!-- Tabs for Info and Content -->\n <div class=\"flex justify-between text-grey-400\">\n ${tab.map(\n item =>\n html`\n <button\n class=\"focus:outline-none font-bold py-2 w-1/2 ${this\n .selectedTab === item && 'link-active'}\"\n @click=${() => this.handleClick(item)}\n >\n ${item}\n </button>\n `\n )}\n </div>\n </div>\n\n <!-- Notification Content -->\n ${this.selectedTab === 'Info'\n ? this.notificationInfoSection()\n : this.notificationContentSection()}\n </div>\n `\n }\n\n private getParamsData(tab?: string, type?: string): any {\n let notificationData = {}\n let notifType = type\n\n if (type && tab) {\n if (type !== 'Content') {\n switch (true) {\n case /langganan/i.test(type):\n notifType = 'Subscription'\n break\n case type === 'Akun':\n notifType = 'Account'\n break\n case /bayar/i.test(type):\n notifType = 'Payment'\n break\n default:\n notifType = 'Information'\n break\n }\n }\n\n notificationData = {\n notification_tab: tab,\n notification_type: notifType,\n }\n }\n\n const data = {\n user_type: this.tracker_user_type,\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 || 'FP',\n metered_wall_balance: this.tracker_metered_wall_balance,\n }\n\n return {\n ...notificationData,\n ...data,\n }\n }\n\n private pushDataLayer(eventName: string, tab?: string, type?: string): void {\n const data = this.getParamsData(tab, type)\n window.dataLayer.push({\n event: eventName,\n ...data,\n })\n }\n\n render() {\n return html`<div id=\"headerNotification\" class=\"relative\">\n ${this.isDataLoaded\n ? this.notificationIcon()\n : html`<div\n class=\"cursor-pointer mt-0.5 animate-spin ${this.setTheme({\n icon: this.theme,\n })}\"\n >\n ${unsafeSVG(getFontAwesomeIcon('fa', 'circle-notch', 21, 21))}\n </div>`}\n ${this.isShowDropdown ? this.notificationPopup() : ''}\n </div>`\n }\n}\n"]}
@@ -6,6 +6,7 @@ import { unsafeHTML } from 'lit/directives/unsafe-html.js';
6
6
  import { TWStyles } from '../../../tailwind/tailwind.js';
7
7
  import { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js';
8
8
  import { formatRupiah } from '../../utils/formatRupiah.js';
9
+ import { addGoogleFonts } from '../../utils/googleFont.js';
9
10
  let KompasMeteredPaywallPersonalize = class KompasMeteredPaywallPersonalize extends LitElement {
10
11
  constructor() {
11
12
  super(...arguments);
@@ -63,6 +64,7 @@ let KompasMeteredPaywallPersonalize = class KompasMeteredPaywallPersonalize exte
63
64
  super.connectedCallback();
64
65
  await this.getMeteredPaywallData();
65
66
  this.dataLayeronMeteredPaywall();
67
+ addGoogleFonts(['pt-sans', 'lora', 'roboto-condensed']);
66
68
  }
67
69
  async getMeteredPaywallData() {
68
70
  try {
@@ -187,10 +189,10 @@ let KompasMeteredPaywallPersonalize = class KompasMeteredPaywallPersonalize exte
187
189
  <image
188
190
  src="${(_c = this.packageData) === null || _c === void 0 ? void 0 : _c.paywall.image}"
189
191
  alt="content"
190
- class="w-[248px] lg:w-[364px]"
192
+ class="w-auto max-h-40"
191
193
  />
192
194
  <div
193
- class="font-lora font-bold text-grey-600 lg:text-2xl text-center"
195
+ class="font-lora font-bold text-grey-600 lg:text-2xl text-center pt-6"
194
196
  >
195
197
  <div>Halo ${this.user_name},</div>
196
198
  <div>${(_d = this.packageData) === null || _d === void 0 ? void 0 : _d.paywall.messageTitleExpand}</div>
@@ -230,7 +232,7 @@ let KompasMeteredPaywallPersonalize = class KompasMeteredPaywallPersonalize exte
230
232
  : html `
231
233
  <div class="sticky bottom-0 w-full h-full">
232
234
  <div
233
- class="flex flex-col lg:flex-row w-full bg-blue-100 py-4 justify-center gap-4 px-4 lg:px-0 bottom-0"
235
+ class="flex flex-col lg:flex-row w-full bg-blue-100 py-3 justify-center gap-4 px-4 lg:px-0 bottom-0"
234
236
  >
235
237
  <div
236
238
  class="text-grey-600 text-base self-center text-left message-formatter font-bold"
@@ -297,7 +299,7 @@ let KompasMeteredPaywallPersonalize = class KompasMeteredPaywallPersonalize exte
297
299
  : nothing}
298
300
  </div>
299
301
  <div
300
- class="text-grey-600 font-sans text-sm lg:text-base self-center text-left message-formatter mb-4"
302
+ class="text-grey-600 font-sans text-base self-center text-left message-formatter mb-4 leading-[150%]"
301
303
  >
302
304
  ${unsafeHTML(descriptionExpand)}
303
305
  </div>
@@ -405,7 +407,7 @@ let KompasMeteredPaywallPersonalize = class KompasMeteredPaywallPersonalize exte
405
407
  >
406
408
  <div class="text-grey-600 font-sans order-2">
407
409
  <div
408
- class="text-xl lg:text-2xl font-lora font-bold mb-3 lg:mb-2 text-center lg:text-start"
410
+ class="text-xl lg:text-2xl font-lora font-bold mb-3 lg:mb-2 text-start lg:text-start"
409
411
  >
410
412
  <span
411
413
  >Halo
@@ -535,14 +537,14 @@ let KompasMeteredPaywallPersonalize = class KompasMeteredPaywallPersonalize exte
535
537
  >
536
538
  <div class="text-grey-600 font-lora message-formatter order-2">
537
539
  <div
538
- class="text-xl lg:text-2xl font-bold mb-2 text-center lg:text-start"
540
+ class="text-xl lg:text-2xl font-bold mb-3 text-start lg:text-start"
539
541
  >
540
542
  ${(_c = this.packageData) === null || _c === void 0 ? void 0 : _c.paywall.messageTitleExpand}${this
541
543
  .user_name
542
544
  ? `, ${this.user_name}!`
543
545
  : ''}
544
546
  </div>
545
- <div class="mb-2 font-sans">
547
+ <div class="mb-3 font-sans">
546
548
  ${unsafeHTML(descriptionExpand)}
547
549
  </div>
548
550
  <div class="flex flex-col font-sans gap-3 mb-4">
@@ -569,12 +571,12 @@ let KompasMeteredPaywallPersonalize = class KompasMeteredPaywallPersonalize exte
569
571
  </div>
570
572
  </div>
571
573
  <div
572
- class="flex self-center mt-10 mb-3 lg:mb-0 lg:mt-0 lg:ml-6 order-1 lg:order-2"
574
+ class="flex self-center mb-3 lg:mb-0 lg:mt-0 lg:ml-6 order-1 lg:order-2"
573
575
  >
574
576
  <image
575
577
  src="${(_g = this.packageData) === null || _g === void 0 ? void 0 : _g.paywall.image}"
576
578
  alt="content"
577
- class="w-[112px] lg:w-[202px]"
579
+ class="w-full lg:w-[202px] max-h-[116px] lg:max-h-none"
578
580
  />
579
581
  </div>
580
582
  </div>
@@ -625,6 +627,7 @@ KompasMeteredPaywallPersonalize.styles = [
625
627
  color: #999999;
626
628
  text-wrap: nowrap;
627
629
  font-weight: 400;
630
+ font-size: 14px;
628
631
  }
629
632
 
630
633
  .font-lora {