@kompasid/lit-web-components 0.6.3 → 0.6.6

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 (50) hide show
  1. package/assets/kompas-free-trial.png +0 -0
  2. package/assets/qr-code.png +0 -0
  3. package/demo/index.html +33 -2
  4. package/dist/src/components/kompasid-header-account/KompasHeaderAccount.d.ts +27 -0
  5. package/dist/src/components/kompasid-header-account/KompasHeaderAccount.js +233 -0
  6. package/dist/src/components/kompasid-header-account/KompasHeaderAccount.js.map +1 -0
  7. package/dist/src/components/kompasid-header-account/types.d.ts +8 -0
  8. package/dist/src/components/kompasid-header-account/types.js +2 -0
  9. package/dist/src/components/kompasid-header-account/types.js.map +1 -0
  10. package/dist/src/components/kompasid-header-account-help-center/KompasHeaderAccountHelpCenter.d.ts +13 -0
  11. package/dist/src/components/kompasid-header-account-help-center/KompasHeaderAccountHelpCenter.js +172 -0
  12. package/dist/src/components/kompasid-header-account-help-center/KompasHeaderAccountHelpCenter.js.map +1 -0
  13. package/dist/src/components/kompasid-header-account-menu/KompasHeaderAccountMenu.d.ts +37 -0
  14. package/dist/src/components/kompasid-header-account-menu/KompasHeaderAccountMenu.js +185 -0
  15. package/dist/src/components/kompasid-header-account-menu/KompasHeaderAccountMenu.js.map +1 -0
  16. package/dist/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.d.ts +12 -0
  17. package/dist/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.js +172 -0
  18. package/dist/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.js.map +1 -0
  19. package/dist/src/components/kompasid-metered-wall-register/KompasMeteredWallRegister.js +8 -8
  20. package/dist/src/components/kompasid-metered-wall-register/KompasMeteredWallRegister.js.map +1 -1
  21. package/dist/src/components/kompasid-paywall/KompasPaywall.js +7 -20
  22. package/dist/src/components/kompasid-paywall/KompasPaywall.js.map +1 -1
  23. package/dist/src/components/kompasid-paywall/types.d.ts +5 -0
  24. package/dist/src/components/kompasid-paywall/types.js.map +1 -1
  25. package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.d.ts +4 -0
  26. package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js +178 -28
  27. package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js.map +1 -1
  28. package/dist/src/index.d.ts +1 -0
  29. package/dist/src/index.js +1 -0
  30. package/dist/src/index.js.map +1 -1
  31. package/dist/src/utils/text.d.ts +2 -0
  32. package/dist/src/utils/text.js +9 -0
  33. package/dist/src/utils/text.js.map +1 -0
  34. package/dist/tailwind/tailwind.js +391 -5
  35. package/dist/tailwind/tailwind.js.map +1 -1
  36. package/dist/tsconfig.tsbuildinfo +1 -1
  37. package/package.json +1 -1
  38. package/src/components/kompasid-header-account/KompasHeaderAccount.ts +197 -0
  39. package/src/components/kompasid-header-account/types.ts +8 -0
  40. package/src/components/kompasid-header-account-help-center/KompasHeaderAccountHelpCenter.ts +177 -0
  41. package/src/components/kompasid-header-account-menu/KompasHeaderAccountMenu.ts +172 -0
  42. package/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.ts +161 -0
  43. package/src/components/kompasid-metered-wall-register/KompasMeteredWallRegister.ts +8 -8
  44. package/src/components/kompasid-paywall/KompasPaywall.ts +7 -20
  45. package/src/components/kompasid-paywall/types.ts +5 -0
  46. package/src/components/kompasid-paywall-body/KompasPaywallBody.ts +189 -36
  47. package/src/index.ts +1 -0
  48. package/src/utils/text.ts +9 -0
  49. package/tailwind/tailwind.css +382 -5
  50. package/tailwind/tailwind.ts +391 -5
@@ -0,0 +1,161 @@
1
+ import { LitElement, html, css } from 'lit'
2
+ import { customElement, property } from 'lit/decorators.js'
3
+ import { TWStyles } from '../../../tailwind/tailwind.js'
4
+ import { truncate } from '../../utils/text.js'
5
+
6
+ @customElement('kompasid-header-account-profile')
7
+ export class KompasHeaderAccountProfile extends LitElement {
8
+ static styles = [
9
+ css`
10
+ .header-account--membership-icon {
11
+ position: absolute;
12
+ bottom: -2px;
13
+ right: -2px;
14
+ }
15
+ `,
16
+ TWStyles,
17
+ ]
18
+
19
+ @property({ type: String }) userInitialName = ''
20
+ @property({ type: Object }) userData = {}
21
+ @property({ type: String }) subscriptionUrl = ''
22
+ @property({ type: Number }) totalGracePeriod = 0
23
+
24
+ private renderSkeletonLoading() {
25
+ return html`
26
+ <div>
27
+ <div class="flex flex-row mb-5 items-center gap-4 leading-none">
28
+ <div
29
+ class="bg-grey-300 py-5 rounded-full h-16 w-16 animate-pulse"
30
+ ></div>
31
+ <div class="flex flex-col text-left w-40 gap-y-2">
32
+ <div class="h-3 rounded-sm w-full bg-grey-300 animate-pulse"></div>
33
+ <div class="h-3 rounded-sm w-full bg-grey-300 animate-pulse"></div>
34
+ <div class="h-3 rounded-sm w-full bg-grey-300 animate-pulse"></div>
35
+ </div>
36
+ </div>
37
+ <div>
38
+ <div class="h-6 rounded-sm w-full bg-grey-300 animate-pulse"></div>
39
+ </div>
40
+ </div>
41
+ `
42
+ }
43
+
44
+ private renderProfileContent() {
45
+ /**
46
+ * Expired Button Element
47
+ */
48
+ const subscribeButton = () => {
49
+ if (!(this.userData as any)?.updateMembership) {
50
+ return html``
51
+ }
52
+ const handleSubscribe = () => {
53
+ window.location.href = this.subscriptionUrl
54
+ }
55
+
56
+ return html`
57
+ <div class="w-full">
58
+ <button
59
+ onClick=${handleSubscribe}
60
+ class="w-full rounded-lg px-4 py-3 mt-4 h-10 flex justify-center items-center bg-green-500 text-grey-100 font-bold text-base focus:outline-none"
61
+ >
62
+ ${(this.userData as any)?.updateMembership}
63
+ </button>
64
+ </div>
65
+ `
66
+ }
67
+ /**
68
+ * expired Info Element
69
+ */
70
+ const expiredInfo = () => {
71
+ const isNearExpired = (this.userData as any)?.isNearExpired
72
+ const expiredTextColor = isNearExpired
73
+ ? `text-orange-400`
74
+ : `text-grey-600`
75
+
76
+ return html`<p class="${expiredTextColor} font-bold">
77
+ ${(this.userData as any)?.expired}
78
+ </p>`
79
+ }
80
+
81
+ /**
82
+ * membership icon element, show if isMebership has truthy value
83
+ */
84
+ const membershipIcon = () => {
85
+ if (!(this.userData as any)?.isMembership) {
86
+ return html``
87
+ }
88
+
89
+ return html`
90
+ <div>
91
+ <img
92
+ class="header-account--membership-icon"
93
+ src="https://d3w4qaq4xm1ncv.cloudfront.net/global-header/crown-blue-10.svg"
94
+ alt="membership-crown-icon"
95
+ />
96
+ </div>
97
+ `
98
+ }
99
+
100
+ /**
101
+ * Active Info Element
102
+ */
103
+
104
+ const activeInfo = () => {
105
+ const isNearExpired = (this.userData as any)?.isNearExpired
106
+ const expiredTextColor = isNearExpired
107
+ ? `text-orange-400`
108
+ : `text-grey-600`
109
+
110
+ return html`<p class="capitalize text-sm ${expiredTextColor}">
111
+ ${(this.userData as any)?.activeInfo}
112
+ </p>`
113
+ }
114
+
115
+ return html`<div
116
+ class="active-info flex flex-col items-start leading-none text-left"
117
+ >
118
+ <div class="flex flex-row items-center gap-4">
119
+ <div
120
+ class="flex bg-brand-1 flex-shrink-0 p-5 rounded-full h-16 w-16 items-center justify-center relative"
121
+ >
122
+ <span class="capitalize text-2xl text-grey-100 font-bold"
123
+ >${this.userInitialName}</span
124
+ >
125
+ ${membershipIcon()}
126
+ </div>
127
+
128
+ <div class="flex flex-col text-left">
129
+ <p class="capitalize font-bold text-base text-blue-600">
130
+ ${truncate((this.userData as any)?.userName, 25)}
131
+ </p>
132
+ ${activeInfo()} ${expiredInfo()}
133
+ </div>
134
+ </div>
135
+
136
+ <div class="mt-4">
137
+ <!-- <kompas-grace-period
138
+ totalGracePeriod="{this.totalGracePeriod}"
139
+ isColoumn="{true}"
140
+ isShowButton="{true}"
141
+ /> -->
142
+ </div>
143
+
144
+ ${subscribeButton()}
145
+ </div>`
146
+ }
147
+
148
+ override async connectedCallback() {
149
+ super.connectedCallback()
150
+ }
151
+
152
+ render() {
153
+ return html`
154
+ <div class="flex flex-shrink-0 flex-col bg-blue-100 p-4">
155
+ ${!this.userData
156
+ ? this.renderSkeletonLoading()
157
+ : this.renderProfileContent()}
158
+ </div>
159
+ `
160
+ }
161
+ }
@@ -27,11 +27,10 @@ export class KompasMeteredWallRegister extends LitElement {
27
27
 
28
28
  .banner-content {
29
29
  gap: 55px;
30
- justify-content: space-between;
31
30
  }
32
31
 
33
32
  .cont-banner-content {
34
- gap: 201px;
33
+ justify-content: space-evenly;
35
34
  }
36
35
 
37
36
  .expanded-btn {
@@ -159,12 +158,13 @@ export class KompasMeteredWallRegister extends LitElement {
159
158
  <div>
160
159
  <div
161
160
  class="${this.isDesktop
162
- ? 'cont-banner-content justify-center'
163
- : null} flex flex-row justify-between"
161
+ ? 'cont-banner-content'
162
+ : 'justify-between'} flex flex-row"
164
163
  >
164
+ <div .hidden="${!this.isDesktop}" class="w-9 h-9"></div>
165
165
  <div class="banner-content flex flex-row">
166
166
  <div
167
- class="text-base md:text-lg font-lora mb-3 mt-1 md:mb-0 md:mt-0 pr-14 md:px-0"
167
+ class="text-base md:text-lg font-lora mb-3 mt-1 pt-[5px] md:mb-0 md:mt-0 pr-14 md:px-0"
168
168
  .innerHTML=${this.setTemplate('title')}
169
169
  ></div>
170
170
  <div .hidden="${!this.isDesktop}" class="md:self-center btn-regis">
@@ -212,7 +212,7 @@ export class KompasMeteredWallRegister extends LitElement {
212
212
  class="text-sm md:text-base"
213
213
  .innerHTML=${this.setTemplate('description', 'expand')}
214
214
  ></p>
215
- <div class="${this.isDesktop ? null : 'expanded-btn'} md:self-start">
215
+ <div class="${this.isDesktop ? 'expanded-btn' : null} md:self-start">
216
216
  ${this.registerButtonTemplate()}
217
217
  </div>
218
218
  </div>
@@ -247,8 +247,8 @@ export class KompasMeteredWallRegister extends LitElement {
247
247
  private registerButtonTemplate() {
248
248
  return html`
249
249
  <button
250
- onClick=${this.redirectToRegister}
251
- class="bg-green-500 px-5 py-3 w-full rounded-md font-bold text-grey-100 text-sm md:text-base"
250
+ @click=${this.redirectToRegister}
251
+ class="bg-green-500 p-1.5 w-full rounded-md font-bold text-grey-100 text-sm md:text-base"
252
252
  >
253
253
  Daftar Akun
254
254
  </button>
@@ -120,26 +120,8 @@ export class KompasPaywall extends LitElement {
120
120
  },
121
121
  packages: {
122
122
  title: 'Sekali bayar, tanpa perpanjang otomatis',
123
- memberships: [
124
- {
125
- title: 'Kompas Digital Premium 12 Bulan (Hemat 40%)',
126
- percentage: 40,
127
- price: 360000,
128
- discountPrice: 600000,
129
- periode: 'Tahun',
130
- isHighlight: true,
131
- url: 'https://checkoutv2.kompas.id/kdp?productId=9802032&referrer=',
132
- },
133
- {
134
- title: 'Kompas Digital Premium 1 Bulan',
135
- percentage: 0,
136
- discountPrice: 0,
137
- price: 50000,
138
- periode: 'Bulan',
139
- isHighlight: false,
140
- url: 'https://checkoutv2.kompas.id/kdp?productId=9802035&referrer=',
141
- },
142
- ],
123
+ memberships: [],
124
+ freeTrial: 'untuk 3 hari pertama',
143
125
  },
144
126
  payment: {
145
127
  desktop: [
@@ -277,6 +259,11 @@ export class KompasPaywall extends LitElement {
277
259
  title: json[this.type].head,
278
260
  description: json[this.type].content,
279
261
  },
262
+ packages: {
263
+ ...this.mockResult.packages,
264
+ memberships: json[this.type].memberships,
265
+ freeTrial: json[this.type].freeTrial,
266
+ },
280
267
  }
281
268
  } catch (error) {
282
269
  throw Error('failed to get paywall data')
@@ -3,9 +3,13 @@ export interface Product {
3
3
  percentage: number
4
4
  price: number
5
5
  discountPrice: number
6
+ savingPrice: number
6
7
  periode: string
7
8
  isHighlight: boolean
8
9
  url: string
10
+ package: string
11
+ subscriptionId: string
12
+ position: number
9
13
  }
10
14
  export interface Metered {
11
15
  maxQuota: number
@@ -36,6 +40,7 @@ export interface Informations {
36
40
  export interface Packages {
37
41
  title: string
38
42
  memberships: Array<Product>
43
+ freeTrial: string
39
44
  }
40
45
  export interface PaywallProduct {
41
46
  informations: {
@@ -179,6 +179,10 @@ export class KompasIdPaywallBody extends LitElement {
179
179
  if (this.targetElement.classList.contains('wrapper-body')) {
180
180
  this.togglePaywall()
181
181
  }
182
+
183
+ if (this.targetElement.id === 'freeTrialPopup') {
184
+ this.closeFreeTrialPopup()
185
+ }
182
186
  }
183
187
 
184
188
  private parsePrice(price: string): number {
@@ -480,18 +484,13 @@ export class KompasIdPaywallBody extends LitElement {
480
484
  }
481
485
 
482
486
  private generalPaywallDataLayer(event: string): Record<string, any> {
483
- const impressions = [
484
- {
485
- package: 'Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 12',
486
- subscription_id: '9802032',
487
- price: '360000',
488
- },
489
- {
490
- package: 'Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 1',
491
- subscription_id: '9802035',
492
- price: '50000',
493
- },
494
- ]
487
+ const packages = this.paywallData?.packages ?? ({} as Packages)
488
+
489
+ const impressions = packages.memberships.map(membership => ({
490
+ package: membership.package,
491
+ subscription_id: membership.subscriptionId,
492
+ price: membership.price.toString(),
493
+ }))
495
494
 
496
495
  return this.buildGtmParams(event, impressions)
497
496
  }
@@ -816,11 +815,23 @@ export class KompasIdPaywallBody extends LitElement {
816
815
  / ${product.periode}
817
816
  </h6>
818
817
  </div>
819
- <div class="flex items-center">
820
- <p class="text-xs ${this.isDark ? 'text-dark-7' : 'text-grey-600'}">
821
- hanya <span class="text-orange-400">Rp 30.000</span> / bulan
822
- </p>
823
- </div>
818
+ ${product.savingPrice
819
+ ? html`
820
+ <div class="flex items-center">
821
+ <p
822
+ class="text-xs ${this.isDark
823
+ ? 'text-dark-7'
824
+ : 'text-grey-600'}"
825
+ >
826
+ hanya
827
+ <span class="text-orange-400"
828
+ >${formatRupiah(product.savingPrice)}</span
829
+ >
830
+ / bulan
831
+ </p>
832
+ </div>
833
+ `
834
+ : nothing}
824
835
  </div>
825
836
  <button
826
837
  class="h-8 ${this.isDark
@@ -829,10 +840,10 @@ export class KompasIdPaywallBody extends LitElement {
829
840
  @click=${() =>
830
841
  this.redirectToCheckout(
831
842
  product.url,
832
- 'Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 12',
833
- '9802032',
834
- 360000,
835
- 1
843
+ product.package,
844
+ product.subscriptionId,
845
+ product.price,
846
+ product.position
836
847
  )}
837
848
  >
838
849
  <h6
@@ -859,26 +870,45 @@ export class KompasIdPaywallBody extends LitElement {
859
870
  ? 'bg-grey-600'
860
871
  : 'bg-white'} 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"
861
872
  >
862
- <div class="flex items-center">
863
- <h5 class="text-base md:text-lg font-bold text-orange-400">
864
- ${formatRupiah(product.price)}
865
- </h5>
866
- <h6
867
- class="text-xs md:text-base ${this.isDark
868
- ? 'text-dark-7'
869
- : 'text-grey-600'} font-bold pl-1"
870
- >
871
- / ${product.periode}
872
- </h6>
873
+ <div class="flex flex-col">
874
+ <div class="flex items-center">
875
+ <h5 class="text-base md:text-lg font-bold text-orange-400">
876
+ ${formatRupiah(product.price)}
877
+ </h5>
878
+ <h6
879
+ class="text-xs md:text-base ${this.isDark
880
+ ? 'text-dark-7'
881
+ : 'text-grey-600'} font-bold pl-1"
882
+ >
883
+ / ${product.periode}
884
+ </h6>
885
+ </div>
886
+ ${product.savingPrice
887
+ ? html`
888
+ <div class="flex items-center">
889
+ <p
890
+ class="text-xs ${this.isDark
891
+ ? 'text-dark-7'
892
+ : 'text-grey-600'}"
893
+ >
894
+ hanya
895
+ <span class="text-orange-400"
896
+ >${formatRupiah(product.savingPrice)}</span
897
+ >
898
+ / bulan
899
+ </p>
900
+ </div>
901
+ `
902
+ : nothing}
873
903
  </div>
874
904
  <button
875
905
  @click=${() =>
876
906
  this.redirectToCheckout(
877
907
  product.url,
878
- 'Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 1',
879
- '9802035',
880
- 50000,
881
- 2
908
+ product.package,
909
+ product.subscriptionId,
910
+ product.price,
911
+ product.position
882
912
  )}
883
913
  class="h-8 ${!this.isDark &&
884
914
  'bg-white'} border border-green-500 rounded"
@@ -904,6 +934,7 @@ export class KompasIdPaywallBody extends LitElement {
904
934
  : this.secondaryPackages(item)
905
935
  )}
906
936
  ${this.swgEnable ? this.swgPackageSection() : nothing}
937
+ ${this.freeTrialPackageSection()} ${this.freeTrialPopUp()}
907
938
  </div>
908
939
  `
909
940
  }
@@ -1027,6 +1058,128 @@ export class KompasIdPaywallBody extends LitElement {
1027
1058
  `
1028
1059
  }
1029
1060
 
1061
+ private openFreeTrialPopup() {
1062
+ const popup = this.shadowRoot?.getElementById('freeTrialPopup')
1063
+ popup?.classList.remove('hidden')
1064
+ }
1065
+
1066
+ private closeFreeTrialPopup() {
1067
+ const popup = this.shadowRoot?.getElementById('freeTrialPopup')
1068
+ popup?.classList.add('hidden')
1069
+ }
1070
+
1071
+ private freeTrialPopUp() {
1072
+ return html`
1073
+ <div
1074
+ id="freeTrialPopup"
1075
+ class="fixed w-full h-full inset-0 flex justify-center items-center z-50 bg-black bg-opacity-75 hidden"
1076
+ >
1077
+ <div
1078
+ class="bg-white rounded w-11/12 sm:w-3/4 md:w-1/2 lg:w-1/3 2xl:w-1/4 p-6 text-center"
1079
+ >
1080
+ <div class="w-full flex justify-end px-2">
1081
+ <button
1082
+ @click=${this.closeFreeTrialPopup}
1083
+ class="w-8 h-8 pl-4 text-grey-400"
1084
+ >
1085
+ ${unsafeSVG(getFontAwesomeIcon('fas', 'xmark', 24, 24))}
1086
+ </button>
1087
+ </div>
1088
+ <div class="w-full flex justify-center">
1089
+ <div class="w-3/4 lg:w-1/2">
1090
+ <img src="/assets/kompas-free-trial.png" alt="Free Trial" />
1091
+ </div>
1092
+ </div>
1093
+ <p class="font-bold text-lg text-grey-600 mt-4">
1094
+ Coba Gratis Kompas.id di Aplikasi
1095
+ </p>
1096
+ <div
1097
+ class="hidden lg:block lg:flex flex border border-grey-300 rounded mt-4 px-8 py-4 items-center"
1098
+ >
1099
+ <div class="w-1/3 flex mr-6">
1100
+ <img src="/assets/qr-code.png" alt="QR Code Deep Link" />
1101
+ </div>
1102
+ <div class="w-2/3 text-base text-grey-600 text-left">
1103
+ Coba gratis 3 hari Kompas.id melalui aplikasi. Pindai kode QR
1104
+ dengan ponsel atau tablet untuk mengunduh aplikasi.
1105
+ </div>
1106
+ </div>
1107
+ <div
1108
+ class="text-base text-grey-600 text-center lg:hidden px-2 md:px-8"
1109
+ >
1110
+ Dapatkan akses gratis selama 3 hari ke konten dan fitur premium
1111
+ Kompas.id di aplikasi.
1112
+ </div>
1113
+ <div class="lg:flex flex justify-center mt-4 hidden lg:block gap-4">
1114
+ <a
1115
+ href="https://play.google.com/store/apps/details?id=id.kompas.app"
1116
+ target="_blank"
1117
+ ><img
1118
+ src="https://cdn-www.kompas.id/halaman-unduh/image/google-play-badge.png"
1119
+ alt="Google Play Badge"
1120
+ /></a>
1121
+ <a
1122
+ href="https://apps.apple.com/id/app/kompas-id/id1242195037?l=id"
1123
+ target="_blank"
1124
+ ><img
1125
+ src="https://cdn-www.kompas.id/halaman-unduh/image/ios-badge.png"
1126
+ alt="iOS App Store Badge"
1127
+ /></a>
1128
+ </div>
1129
+ <button
1130
+ onclick="window.open('https://app.komp.as/langganan', '_blank')"
1131
+ class="h-12 bg-green-500 rounded-md mt-4 flex w-full items-center justify-center lg:hidden"
1132
+ >
1133
+ <h6 class="text-white font-bold p-4">Unduh Sekarang</h6>
1134
+ </button>
1135
+ </div>
1136
+ </div>
1137
+ `
1138
+ }
1139
+
1140
+ private freeTrialPackageSection() {
1141
+ const packages = this.paywallData?.packages ?? ({} as Packages)
1142
+
1143
+ if (packages.freeTrial) {
1144
+ return html`
1145
+ <div
1146
+ class="flex flex-wrap items-center justify-between ${this.isDark
1147
+ ? 'bg-grey-600'
1148
+ : 'bg-white'} 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"
1149
+ >
1150
+ <div class="flex flex-col">
1151
+ <div class="flex items-center">
1152
+ <h5 class="text-base md:text-lg font-bold text-orange-400">
1153
+ ${formatRupiah(0)}
1154
+ </h5>
1155
+ </div>
1156
+ <div class="flex items-center">
1157
+ <p
1158
+ class="text-xs ${this.isDark ? 'text-dark-7' : 'text-grey-600'}"
1159
+ >
1160
+ ${packages.freeTrial}
1161
+ </p>
1162
+ </div>
1163
+ </div>
1164
+ <button
1165
+ @click=${this.openFreeTrialPopup}
1166
+ class="h-8 ${!this.isDark &&
1167
+ 'bg-white'} border border-green-500 rounded"
1168
+ >
1169
+ <h6
1170
+ class="text-xs md:text-sm ${this.isDark
1171
+ ? 'text-green-300'
1172
+ : 'text-green-500'} font-bold px-4"
1173
+ >
1174
+ Coba Gratis
1175
+ </h6>
1176
+ </button>
1177
+ </div>
1178
+ `
1179
+ }
1180
+ return nothing
1181
+ }
1182
+
1030
1183
  /**
1031
1184
  * Render Statement
1032
1185
  */
package/src/index.ts CHANGED
@@ -4,6 +4,7 @@ export { KompasPaywallVideo } from './components/kompasid-paywall-video/KompasPa
4
4
  export { KompasMeteredPaywall } from './components/kompasid-metered-paywall/KompasMeteredPaywall.js'
5
5
  export { KompasFreewall } from './components/kompasid-freewall/KompasFreewall.js'
6
6
  export { KompasMeteredWallRegister } from './components/kompasid-metered-wall-register/KompasMeteredWallRegister.js'
7
+ export { KompasHeaderAccount } from './components/kompasid-header-account/KompasHeaderAccount.js'
7
8
 
8
9
  declare global {
9
10
  interface Window {
@@ -0,0 +1,9 @@
1
+ const truncate = (str: string, len: number = 155): string => {
2
+ if (str.length <= len) {
3
+ return str
4
+ }
5
+ const truncatedStr = str.substr(0, len - 1)
6
+ return `${truncatedStr.substr(0, truncatedStr.lastIndexOf(' '))}...`
7
+ }
8
+
9
+ export { truncate }