@kompasid/lit-web-components 0.9.47 → 0.9.49

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 (42) hide show
  1. package/demo/header.html +21 -5
  2. package/demo/paywall.html +3 -2
  3. package/dist/src/components/kompasid-header-account/KompasHeaderAccount.d.ts +1 -0
  4. package/dist/src/components/kompasid-header-account/KompasHeaderAccount.js +8 -0
  5. package/dist/src/components/kompasid-header-account/KompasHeaderAccount.js.map +1 -1
  6. package/dist/src/components/kompasid-header-account-menu/KompasHeaderAccountMenu.d.ts +1 -0
  7. package/dist/src/components/kompasid-header-account-menu/KompasHeaderAccountMenu.js +23 -6
  8. package/dist/src/components/kompasid-header-account-menu/KompasHeaderAccountMenu.js.map +1 -1
  9. package/dist/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.d.ts +3 -0
  10. package/dist/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.js +83 -6
  11. package/dist/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.js.map +1 -1
  12. package/dist/src/components/kompasid-paywall/KompasPaywall.js +0 -3
  13. package/dist/src/components/kompasid-paywall/KompasPaywall.js.map +1 -1
  14. package/dist/src/components/kompasid-paywall/types.d.ts +1 -0
  15. package/dist/src/components/kompasid-paywall/types.js.map +1 -1
  16. package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.d.ts +1 -0
  17. package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js +22 -1
  18. package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js.map +1 -1
  19. package/dist/src/components/kompasid-paywall-modal-register/KompasPaywallModalRegister.d.ts +36 -0
  20. package/dist/src/components/kompasid-paywall-modal-register/KompasPaywallModalRegister.js +589 -0
  21. package/dist/src/components/kompasid-paywall-modal-register/KompasPaywallModalRegister.js.map +1 -0
  22. package/dist/src/components/kompasid-paywall-modal-register/types.d.ts +33 -0
  23. package/dist/src/components/kompasid-paywall-modal-register/types.js +2 -0
  24. package/dist/src/components/kompasid-paywall-modal-register/types.js.map +1 -0
  25. package/dist/src/index.d.ts +1 -0
  26. package/dist/src/index.js +1 -0
  27. package/dist/src/index.js.map +1 -1
  28. package/dist/tailwind/tailwind.js +160 -5
  29. package/dist/tailwind/tailwind.js.map +1 -1
  30. package/dist/tsconfig.tsbuildinfo +1 -1
  31. package/package.json +1 -1
  32. package/src/components/kompasid-header-account/KompasHeaderAccount.ts +5 -0
  33. package/src/components/kompasid-header-account-menu/KompasHeaderAccountMenu.ts +25 -8
  34. package/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.ts +78 -6
  35. package/src/components/kompasid-paywall/KompasPaywall.ts +0 -4
  36. package/src/components/kompasid-paywall/types.ts +1 -0
  37. package/src/components/kompasid-paywall-body/KompasPaywallBody.ts +22 -1
  38. package/src/components/kompasid-paywall-modal-register/KompasPaywallModalRegister.ts +613 -0
  39. package/src/components/kompasid-paywall-modal-register/types.ts +39 -0
  40. package/src/index.ts +1 -0
  41. package/tailwind/tailwind.css +160 -5
  42. package/tailwind/tailwind.ts +160 -5
@@ -60,19 +60,17 @@ export class KompasHeaderAccountMenu extends LitElement {
60
60
  /**
61
61
  * Logout Url
62
62
  */
63
- @property({ type: String }) logout_url = 'https://auth.kompas.id/logout'
63
+ @property({ type: String }) logout_url = ''
64
64
 
65
65
  /**
66
66
  * Manage Account Url
67
67
  */
68
- @property({ type: String }) manage_account_url =
69
- 'https://manage-account.kompas.id/manage-account/my-account'
68
+ @property({ type: String }) manage_account_url = ''
70
69
 
71
70
  /**
72
71
  * Read Later Url
73
72
  */
74
- @property({ type: String }) read_later_url =
75
- 'https://www.kompas.id/baca-nanti'
73
+ @property({ type: String }) read_later_url = ''
76
74
 
77
75
  // Render Total Bubble
78
76
  private renderTotalBubble = (total: number) => {
@@ -95,6 +93,16 @@ export class KompasHeaderAccountMenu extends LitElement {
95
93
  `
96
94
  }
97
95
 
96
+ private komputasiUrl() {
97
+ return {
98
+ read_later_url: this.read_later_url || 'https://www.kompas.id/baca-nanti',
99
+ manage_account_url:
100
+ this.manage_account_url ||
101
+ 'https://manage-account.kompas.id/manage-account/my-account',
102
+ logout_url: this.logout_url || 'https://auth.kompas.id/logout',
103
+ }
104
+ }
105
+
98
106
  override async connectedCallback() {
99
107
  super.connectedCallback()
100
108
  }
@@ -111,7 +119,10 @@ export class KompasHeaderAccountMenu extends LitElement {
111
119
  <p class="header-account-menu--title">Keranjang</p>
112
120
  </a> -->
113
121
  <!-- Manage Account -->
114
- <a href=${this.manage_account_url} class="header-account-menu--item">
122
+ <a
123
+ href=${this.komputasiUrl().manage_account_url}
124
+ class="header-account-menu--item"
125
+ >
115
126
  <div class="icon icon-md icon-blue-600">
116
127
  ${unsafeSVG(getFontAwesomeIcon('fas', 'user-gear'))}
117
128
  </div>
@@ -123,14 +134,20 @@ export class KompasHeaderAccountMenu extends LitElement {
123
134
  <p class="header-account-menu--title">Transaksi</p>
124
135
  </a> -->
125
136
  <!-- Read Later -->
126
- <a href=${this.read_later_url} class="header-account-menu--item">
137
+ <a
138
+ href=${this.komputasiUrl().read_later_url}
139
+ class="header-account-menu--item"
140
+ >
127
141
  <div class="icon icon-md icon-blue-600">
128
142
  ${unsafeSVG(getFontAwesomeIcon('fas', 'bookmark'))}
129
143
  </div>
130
144
  <p class="header-account-menu--title">Baca Nanti</p>
131
145
  </a>
132
146
  <!-- Logout -->
133
- <a href=${this.logout_url} class="header-account-menu--item">
147
+ <a
148
+ href=${this.komputasiUrl().logout_url}
149
+ class="header-account-menu--item"
150
+ >
134
151
  <div class="icon icon-md icon-blue-600">
135
152
  ${unsafeSVG(getFontAwesomeIcon('fas', 'right-from-bracket'))}
136
153
  </div>
@@ -1,9 +1,11 @@
1
- import { LitElement, html, css } from 'lit'
1
+ import { LitElement, html, css, nothing } from 'lit'
2
2
  import { format, addDays, differenceInDays } from 'date-fns'
3
3
  import { id } from 'date-fns/locale/id'
4
4
  import { customElement, property, state } from 'lit/decorators.js'
5
+ import { unsafeSVG } from 'lit/directives/unsafe-svg.js'
5
6
  import { TWStyles } from '../../../tailwind/tailwind.js'
6
7
  import { User } from '../kompasid-header-account/types.js'
8
+ import { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js'
7
9
  import '../kompasid-grace-period/KompasGracePeriod.js'
8
10
 
9
11
  @customElement('kompasid-header-account-profile')
@@ -15,6 +17,18 @@ export class KompasHeaderAccountProfile extends LitElement {
15
17
  bottom: -2px;
16
18
  right: -2px;
17
19
  }
20
+
21
+ .tooltip::after {
22
+ content: '';
23
+ position: absolute;
24
+ width: 24px;
25
+ height: 16px;
26
+ background-color: #333333;
27
+ /* Memotong kotak menjadi segitiga */
28
+ clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
29
+ /* Menghaluskan sudut potongan */
30
+ border-radius: 4px;
31
+ }
18
32
  `,
19
33
  TWStyles,
20
34
  ]
@@ -25,6 +39,8 @@ export class KompasHeaderAccountProfile extends LitElement {
25
39
  @property({ type: String }) userInitialName = ''
26
40
  @property({ type: Object }) userData = {} as User
27
41
  @property({ type: String }) subscriptionUrl = ''
42
+ @property({ type: String }) company_name = ''
43
+ @property({ type: String }) manage_account_url = ''
28
44
  @property({ type: String }) openFrom = ''
29
45
  /**
30
46
  * Props For Grace Period Tracker
@@ -186,13 +202,53 @@ export class KompasHeaderAccountProfile extends LitElement {
186
202
  </p>`
187
203
  }
188
204
 
205
+ /**
206
+ * Kompeni Element
207
+ */
208
+ const kompeniTemplate = () => html` <div
209
+ class="flex relative group bg-[#FFF8D6] text-yellow-700 gap-1 p-2 mt-2 rounded items-center justify-center text-xs max-w-[190px] font-sans leading-none"
210
+ >
211
+ <div class="w-5 h-5 flex items-center justify-center flex-shrink-0">
212
+ ${unsafeSVG(getFontAwesomeIcon('fa', 'building-circle-check', 13, 10))}
213
+ </div>
214
+ <p class="truncate">${this.company_name}</p>
215
+ <div
216
+ class="absolute px-2 top-full -right-[5%] w-max max-w-[300px] mt-1 hidden group-hover:block"
217
+ >
218
+ <div
219
+ class="bg-grey-600 text-white text-sm font-sans p-4 rounded-lg relative leading-5"
220
+ >
221
+ ${this.company_name}
222
+ <svg
223
+ width="16"
224
+ height="12"
225
+ viewBox="0 0 24 13"
226
+ class="text-grey-600 absolute left-[80%] -top-[11px]"
227
+ >
228
+ <polygon
229
+ points="3,15 12,3 21,15"
230
+ fill="currentColor"
231
+ stroke="currentColor"
232
+ stroke-width="4"
233
+ stroke-linejoin="round"
234
+ />
235
+ </svg>
236
+ </div>
237
+ </div>
238
+ </div>`
239
+
189
240
  return html`
190
241
  <div
191
242
  class="active-info flex flex-col items-start leading-none text-left font-sans"
192
243
  >
193
244
  <div class="flex flex-row items-center gap-4">
194
245
  <div
195
- class="flex bg-brand-1 flex-shrink-0 p-5 rounded-full h-16 w-16 items-center justify-center relative"
246
+ @click=${() => this.clickToManageAccount()}
247
+ @keydown=${() => this.clickToManageAccount()}
248
+ class="flex bg-brand-1 flex-shrink-0 p-5 rounded-full h-16 w-16 items-center justify-center relative select-none ${this
249
+ .manage_account_url
250
+ ? 'cursor-pointer'
251
+ : ''}"
196
252
  >
197
253
  <span class="capitalize text-2xl text-grey-100 font-bold">
198
254
  ${this.userInitialName}
@@ -201,10 +257,21 @@ export class KompasHeaderAccountProfile extends LitElement {
201
257
  </div>
202
258
 
203
259
  <div class="flex flex-col text-left">
204
- <p class="capitalize font-bold text-base text-blue-600">
205
- ${this.userData.userName}
206
- </p>
207
- ${activeInfoTemplate()}
260
+ <div
261
+ @click=${() => this.clickToManageAccount()}
262
+ @keydown=${() => this.clickToManageAccount()}
263
+ class="select-none"
264
+ >
265
+ <p
266
+ class="capitalize font-bold text-base ${this.manage_account_url
267
+ ? 'text-blue-600 cursor-pointer'
268
+ : 'text-grey-600'}"
269
+ >
270
+ ${this.userData.userName}
271
+ </p>
272
+ ${activeInfoTemplate()}
273
+ </div>
274
+ ${this.company_name ? kompeniTemplate() : nothing}
208
275
  </div>
209
276
  </div>
210
277
 
@@ -238,6 +305,11 @@ export class KompasHeaderAccountProfile extends LitElement {
238
305
  </div>
239
306
  `
240
307
  }
308
+ clickToManageAccount() {
309
+ if (this.manage_account_url) {
310
+ window.location.href = this.manage_account_url
311
+ }
312
+ }
241
313
 
242
314
  override async connectedCallback() {
243
315
  super.connectedCallback()
@@ -382,10 +382,6 @@ export class KompasPaywall extends LitElement {
382
382
  tracker_content_variant: trackerVariant,
383
383
  } = this
384
384
 
385
- if (!publishedDate || !trackerVariant || !trackerTags) {
386
- return false
387
- }
388
-
389
385
  const nowDate = new Date()
390
386
  const isoDateString = publishedDate.replace(' ', 'T')
391
387
  const publishedDateObj = new Date(isoDateString)
@@ -6,6 +6,7 @@ export interface Product {
6
6
  discountPrice: number
7
7
  savingPrice: number
8
8
  saveLabel: string
9
+ labelPackage: string
9
10
  periode: string
10
11
  isHighlight: boolean
11
12
  isButtonSolid: boolean
@@ -19,6 +19,7 @@ import { redirectToLogin } from '../../utils/cta.js'
19
19
  import { customFetch } from '../../utils/customFetch.js'
20
20
  import { getCookie } from '../../utils/getCookies.js'
21
21
  import { getLoginGuest } from '../../utils/api/getLoginGuest.js'
22
+ import '../kompasid-paywall-modal-register/KompasPaywallModalRegister.js'
22
23
 
23
24
  @customElement('kompasid-paywall-body')
24
25
  export class KompasIdPaywallBody extends LitElement {
@@ -551,6 +552,10 @@ export class KompasIdPaywallBody extends LitElement {
551
552
  page_domain: this.tracker_page_domain || 'Kompas.id',
552
553
  metered_wall_type: this.tracker_metered_wall_type || 'HP',
553
554
  metered_wall_balance: this.tracker_metered_wall_balance,
555
+ content_tags: this.tracker_content_tags || '',
556
+ content_published_date: this.tracker_content_published_date || '',
557
+ content_variant: this.tracker_content_variant || '',
558
+ variant: this.paywallData?.informations?.typeVariant || '',
554
559
  }
555
560
 
556
561
  if (this.type !== 'epaper') {
@@ -853,7 +858,7 @@ export class KompasIdPaywallBody extends LitElement {
853
858
  ) {
854
859
  const { isDark } = this
855
860
 
856
- const containerClass = `px-4 flex flex-wrap items-center justify-between rounded-lg md:mx-0 w-full max-w-xs md:max-w-sm md:w-3/5 min-h-[68px]
861
+ const containerClass = `px-4 py-4 flex flex-wrap items-center justify-between rounded-lg md:mx-0 w-full max-w-xs md:max-w-sm md:w-3/5 min-h-[68px]
857
862
  ${isDark ? ' bg-grey-600' : ' bg-white'}
858
863
  ${
859
864
  isHighlight ? 'outline-yellow-400 outline-2 outline mt-2' : ''
@@ -885,6 +890,12 @@ export class KompasIdPaywallBody extends LitElement {
885
890
  return html`
886
891
  <div class="${containerClass}">
887
892
  <div class="flex flex-col gap-1">
893
+ <span
894
+ class="${product.labelPackage
895
+ ? 'block text-grey-500 text-xs font-sans leading-none'
896
+ : 'hidden'}"
897
+ >${product.labelPackage}</span
898
+ >
888
899
  <div class="flex items-baseline">
889
900
  <h5 class="text-base font-bold text-orange-400 leading-none">
890
901
  ${formatRupiah(product.price)}
@@ -952,6 +963,8 @@ export class KompasIdPaywallBody extends LitElement {
952
963
  }
953
964
 
954
965
  private packagesSection(data: Packages) {
966
+ const isPro =
967
+ this.type === 'proMiningArticle' || this.type === 'proMiningOutlook'
955
968
  return html`
956
969
  <div
957
970
  class="flex flex-col w-full items-center gap-2 md:gap-3 mt-4 md:mt-5"
@@ -961,6 +974,14 @@ export class KompasIdPaywallBody extends LitElement {
961
974
  )}
962
975
  ${this.freeTrialPackageSection()} ${this.freeTrialPopUp()}
963
976
  ${this.packages.swgEnable ? this.swgPackageSection() : nothing}
977
+ ${isPro
978
+ ? html`
979
+ <kompasid-paywall-modal-register
980
+ class="w-full max-w-xs md:max-w-sm"
981
+ >
982
+ </kompasid-paywall-modal-register>
983
+ `
984
+ : nothing}
964
985
  </div>
965
986
  `
966
987
  }