@kompasid/lit-web-components 0.7.7 → 0.7.9

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.
Files changed (47) hide show
  1. package/demo/index.html +6 -6
  2. package/dist/src/components/kompasid-freewall/KompasFreewall.d.ts +5 -2
  3. package/dist/src/components/kompasid-freewall/KompasFreewall.js +61 -24
  4. package/dist/src/components/kompasid-freewall/KompasFreewall.js.map +1 -1
  5. package/dist/src/components/kompasid-freewall/types.d.ts +12 -0
  6. package/dist/src/components/kompasid-freewall/types.js.map +1 -1
  7. package/dist/src/components/kompasid-freewall-body/KompasFreewallBody.d.ts +2 -1
  8. package/dist/src/components/kompasid-freewall-body/KompasFreewallBody.js +19 -16
  9. package/dist/src/components/kompasid-freewall-body/KompasFreewallBody.js.map +1 -1
  10. package/dist/src/components/kompasid-freewall-head/KompasFreewallHead.d.ts +2 -1
  11. package/dist/src/components/kompasid-freewall-head/KompasFreewallHead.js +6 -6
  12. package/dist/src/components/kompasid-freewall-head/KompasFreewallHead.js.map +1 -1
  13. package/dist/src/components/kompasid-metered-paywall/KompasMeteredPaywall.d.ts +6 -4
  14. package/dist/src/components/kompasid-metered-paywall/KompasMeteredPaywall.js +54 -24
  15. package/dist/src/components/kompasid-metered-paywall/KompasMeteredPaywall.js.map +1 -1
  16. package/dist/src/components/kompasid-metered-paywall/types.d.ts +5 -0
  17. package/dist/src/components/kompasid-metered-paywall/types.js +2 -0
  18. package/dist/src/components/kompasid-metered-paywall/types.js.map +1 -0
  19. package/dist/src/components/kompasid-paywall/KompasPaywall.js +8 -2
  20. package/dist/src/components/kompasid-paywall/KompasPaywall.js.map +1 -1
  21. package/dist/src/components/kompasid-paywall/types.d.ts +7 -1
  22. package/dist/src/components/kompasid-paywall/types.js.map +1 -1
  23. package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.d.ts +3 -1
  24. package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js +16 -12
  25. package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js.map +1 -1
  26. package/dist/src/components/kompasid-widget-recirculations-default/KompasWidgetRecirculationsDefault.d.ts +1 -0
  27. package/dist/src/components/kompasid-widget-recirculations-default/KompasWidgetRecirculationsDefault.js +34 -7
  28. package/dist/src/components/kompasid-widget-recirculations-default/KompasWidgetRecirculationsDefault.js.map +1 -1
  29. package/dist/src/components/kompasid-widget-recirculations-list/KompasWidgetRecirculationsList.d.ts +1 -0
  30. package/dist/src/components/kompasid-widget-recirculations-list/KompasWidgetRecirculationsList.js +19 -4
  31. package/dist/src/components/kompasid-widget-recirculations-list/KompasWidgetRecirculationsList.js.map +1 -1
  32. package/dist/tsconfig.tsbuildinfo +1 -1
  33. package/package.json +1 -1
  34. package/src/components/kompasid-freewall/KompasFreewall.ts +57 -25
  35. package/src/components/kompasid-freewall/readme.md +25 -0
  36. package/src/components/kompasid-freewall/types.ts +13 -0
  37. package/src/components/kompasid-freewall-body/KompasFreewallBody.ts +20 -17
  38. package/src/components/kompasid-freewall-head/KompasFreewallHead.ts +5 -7
  39. package/src/components/kompasid-metered-paywall/KompasMeteredPaywall.ts +54 -26
  40. package/src/components/kompasid-metered-paywall/readme.md +11 -0
  41. package/src/components/kompasid-metered-paywall/types.ts +5 -0
  42. package/src/components/kompasid-paywall/KompasPaywall.ts +10 -2
  43. package/src/components/kompasid-paywall/readme.md +161 -0
  44. package/src/components/kompasid-paywall/types.ts +7 -2
  45. package/src/components/kompasid-paywall-body/KompasPaywallBody.ts +16 -12
  46. package/src/components/kompasid-widget-recirculations-default/KompasWidgetRecirculationsDefault.ts +32 -7
  47. package/src/components/kompasid-widget-recirculations-list/KompasWidgetRecirculationsList.ts +17 -4
@@ -113,6 +113,7 @@ export class KompasIdPaywallBody extends LitElement {
113
113
  @state() private swgProductId = 'kompas.id:kompas_digital_premium'
114
114
  @state() private errorFlag = 0
115
115
 
116
+ _packages!: Packages
116
117
  buttonElement!: HTMLButtonElement
117
118
  targetElement!: HTMLElement
118
119
 
@@ -134,6 +135,10 @@ export class KompasIdPaywallBody extends LitElement {
134
135
  return !this.isLogin || this.tracker_subscription_status === 'IA'
135
136
  }
136
137
 
138
+ get packages(): Packages {
139
+ return this._packages
140
+ }
141
+
137
142
  /**
138
143
  * Logic Function
139
144
  */
@@ -181,11 +186,11 @@ export class KompasIdPaywallBody extends LitElement {
181
186
  }
182
187
 
183
188
  private handleClickOutside() {
184
- if (this.targetElement.classList.contains('wrapper-body')) {
189
+ if (this.targetElement?.classList.contains('wrapper-body')) {
185
190
  this.togglePaywall()
186
191
  }
187
192
 
188
- if (this.targetElement.id === 'freeTrialPopup') {
193
+ if (this.targetElement?.id === 'freeTrialPopup') {
189
194
  this.closeFreeTrialPopup()
190
195
  }
191
196
  }
@@ -411,9 +416,12 @@ export class KompasIdPaywallBody extends LitElement {
411
416
  }
412
417
 
413
418
  override async connectedCallback() {
419
+ this._packages = this.paywallData?.packages ?? ({} as Packages)
420
+
414
421
  super.connectedCallback()
415
422
  await this.updateComplete
416
- if (this.swgEnable) {
423
+
424
+ if (this.packages.swgEnable) {
417
425
  this.jsonScript()
418
426
  const appendSWGButton = () => {
419
427
  this.buttonElement = this.shadowRoot?.getElementById(
@@ -928,7 +936,7 @@ export class KompasIdPaywallBody extends LitElement {
928
936
  : this.secondaryPackages(item)
929
937
  )}
930
938
  ${this.freeTrialPackageSection()} ${this.freeTrialPopUp()}
931
- ${this.swgEnable ? this.swgPackageSection() : nothing}
939
+ ${this.packages.swgEnable ? this.swgPackageSection() : nothing}
932
940
  </div>
933
941
  `
934
942
  }
@@ -1122,8 +1130,7 @@ export class KompasIdPaywallBody extends LitElement {
1122
1130
  ? 'text-dark-7'
1123
1131
  : 'text-grey-600'}"
1124
1132
  >
1125
- Coba gratis 3 hari Kompas.id melalui aplikasi. Pindai kode QR
1126
- dengan ponsel atau tablet untuk mengunduh aplikasi.
1133
+ ${this.packages.freeTrial?.desktopText}
1127
1134
  </div>
1128
1135
  </div>
1129
1136
  <div
@@ -1131,8 +1138,7 @@ export class KompasIdPaywallBody extends LitElement {
1131
1138
  ? 'text-dark-7'
1132
1139
  : 'text-grey-600'}"
1133
1140
  >
1134
- Dapatkan akses gratis selama 3 hari ke konten dan fitur premium
1135
- Kompas.id di aplikasi.
1141
+ ${this.packages.freeTrial?.mobileText}
1136
1142
  </div>
1137
1143
  <div class="lg:flex flex justify-center mt-4 hidden lg:block gap-4">
1138
1144
  <a
@@ -1162,9 +1168,7 @@ export class KompasIdPaywallBody extends LitElement {
1162
1168
  }
1163
1169
 
1164
1170
  private freeTrialPackageSection() {
1165
- const packages = this.paywallData?.packages ?? ({} as Packages)
1166
-
1167
- if (packages.freeTrial) {
1171
+ if (this.packages.freeTrial) {
1168
1172
  return html`
1169
1173
  <div
1170
1174
  class="flex flex-wrap items-center justify-between py-3 px-4 rounded-lg md:mx-0 w-full h-[68px] max-w-xs md:max-w-sm md:w-3/5 mt-3 md:mt-4 ${this
@@ -1182,7 +1186,7 @@ export class KompasIdPaywallBody extends LitElement {
1182
1186
  <p
1183
1187
  class="text-xs ${this.isDark ? 'text-dark-7' : 'text-grey-600'}"
1184
1188
  >
1185
- ${packages.freeTrial}
1189
+ ${this.packages.freeTrial?.packageText}
1186
1190
  </p>
1187
1191
  </div>
1188
1192
  </div>
@@ -43,6 +43,8 @@ export class KompasWidgetRecirculationsDefault extends LitElement {
43
43
  @property({ type: String }) titleName = '' // contoh: Artikel Terkait / Lainnya dalam 'kategori'
44
44
  @property({ type: String }) titleLink = '' // contoh: /kategori/opini
45
45
 
46
+ @property({ type: Boolean }) isDark = false
47
+
46
48
  /**
47
49
  * Fetch Data
48
50
  */
@@ -172,7 +174,12 @@ export class KompasWidgetRecirculationsDefault extends LitElement {
172
174
  return html`
173
175
  <div class="flex font-sans uppercase items-start mb-6 mt-8">
174
176
  <div>
175
- <h5 class="capitalize font-bold font-sans text-grey-600">
177
+ <h5
178
+ class="capitalize font-bold font-sans text-lg md:text-xl ${this
179
+ .isDark
180
+ ? 'text-white'
181
+ : 'text-grey-600'}"
182
+ >
176
183
  Artikel Terkait
177
184
  </h5>
178
185
  </div>
@@ -186,7 +193,11 @@ export class KompasWidgetRecirculationsDefault extends LitElement {
186
193
  href="${this.titleLink}"
187
194
  class="flex font-sans uppercase items-start mb-6 mt-8"
188
195
  >
189
- <h5 class="capitalize font-bold font-sans text-brand-1">
196
+ <h5
197
+ class="capitalize font-bold font-sans text-lg md:text-xl ${this.isDark
198
+ ? 'text-blue-200'
199
+ : 'text-brand-1'}"
200
+ >
190
201
  ${this.titleName}
191
202
  </h5>
192
203
  </a>
@@ -253,7 +264,7 @@ export class KompasWidgetRecirculationsDefault extends LitElement {
253
264
 
254
265
  render() {
255
266
  return html`
256
- <div class="w-full">
267
+ <div class="w-full ${this.isDark ? 'bg-dark-5 ' : ''}">
257
268
  <!-- start: widget title -->
258
269
  ${this.type === 'relatedArticle'
259
270
  ? this.titleRelatedArticle()
@@ -273,11 +284,18 @@ export class KompasWidgetRecirculationsDefault extends LitElement {
273
284
  <a href="${post.permalink}">
274
285
  ${this.renderChips(post)}
275
286
  <h5
276
- class="hover:underline font-bold font-sans leading-tight text-grey-600"
287
+ class="hover:underline font-bold font-sans leading-tight text-lg md:text-xl ${this
288
+ .isDark
289
+ ? 'text-white'
290
+ : 'text-grey-600'}"
277
291
  >
278
292
  ${post.title}
279
293
  </h5>
280
- <p class="text-grey-600 pt-2">
294
+ <p
295
+ class="font-sans pt-2 text-sm ${this.isDark
296
+ ? 'text-white'
297
+ : 'text-grey-600'}"
298
+ >
281
299
  ${this.formatDate(post.publishedDate)}
282
300
  </p>
283
301
  </a>
@@ -302,11 +320,18 @@ export class KompasWidgetRecirculationsDefault extends LitElement {
302
320
  <a href="${post.permalink}">
303
321
  ${this.renderChips(post)}
304
322
  <h5
305
- class="hover:underline font-bold font-sans leading-tight text-grey-600"
323
+ class="hover:underline font-bold font-sans leading-tight text-lg md:text-xl ${this
324
+ .isDark
325
+ ? 'text-white'
326
+ : 'text-grey-600'}"
306
327
  >
307
328
  ${post.title}
308
329
  </h5>
309
- <p class="text-grey-600 pt-2">
330
+ <p
331
+ class="font-sans pt-2 text-sm ${this.isDark
332
+ ? 'text-white'
333
+ : 'text-grey-600'}"
334
+ >
310
335
  ${this.formatDate(post.publishedDate)}
311
336
  </p>
312
337
  </a>
@@ -25,6 +25,8 @@ export class KompasWidgetRecirculationsList extends LitElement {
25
25
  @property({ type: String }) accessToken = ''
26
26
  @property({ type: String }) apiSlug = ''
27
27
 
28
+ @property({ type: Boolean }) isDark = false
29
+
28
30
  static styles = [
29
31
  css`
30
32
  :host {
@@ -190,9 +192,14 @@ export class KompasWidgetRecirculationsList extends LitElement {
190
192
 
191
193
  render() {
192
194
  return html`
193
- <div>
195
+ <div class="${this.isDark ? 'bg-dark-5 ' : ''}">
194
196
  <div class="mb-6">
195
- <h5 class="capitalize font-bold text-grey-600 font-sans">
197
+ <h5
198
+ class="capitalize font-bold font-sans text-lg md:text-xl ${this
199
+ .isDark
200
+ ? 'text-white'
201
+ : 'text-grey-600'}"
202
+ >
196
203
  ${this.widgetTitle}
197
204
  </h5>
198
205
  </div>
@@ -207,12 +214,18 @@ export class KompasWidgetRecirculationsList extends LitElement {
207
214
  ${this.renderChips(item)}
208
215
  <a
209
216
  href="${item.permalink}"
210
- class="font-bold font-sans hover:underline leading-tight text-base text-grey-600"
217
+ class="font-bold font-lora hover:underline leading-normal text-xl ${this
218
+ .isDark
219
+ ? 'text-white'
220
+ : 'text-grey-600'}"
211
221
  >
212
222
  ${item.title}
213
223
  </a>
214
224
  <div
215
- class="flex w-full flex-row items-center leading-normal justify-between text-sm text-grey-500 font-sans pt-2"
225
+ class="flex w-full flex-row font-sans items-center leading-normal justify-between pt-2 text-sm ${this
226
+ .isDark
227
+ ? 'text-white'
228
+ : 'text-grey-500'}"
216
229
  >
217
230
  ${item.publishedDate
218
231
  ? this.formatDate(item.publishedDate)