@kompasid/lit-web-components 0.9.48 → 0.9.50
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 +18 -2
- package/demo/paywall.html +3 -2
- package/dist/src/components/kompasid-header-account/KompasHeaderAccount.d.ts +1 -0
- package/dist/src/components/kompasid-header-account/KompasHeaderAccount.js +8 -0
- package/dist/src/components/kompasid-header-account/KompasHeaderAccount.js.map +1 -1
- package/dist/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.d.ts +3 -0
- package/dist/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.js +83 -6
- package/dist/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.js.map +1 -1
- package/dist/src/components/kompasid-paywall/types.d.ts +1 -0
- package/dist/src/components/kompasid-paywall/types.js.map +1 -1
- package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.d.ts +1 -0
- package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js +22 -1
- package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js.map +1 -1
- package/dist/src/components/kompasid-paywall-modal-register/KompasPaywallModalRegister.d.ts +36 -0
- package/dist/src/components/kompasid-paywall-modal-register/KompasPaywallModalRegister.js +605 -0
- package/dist/src/components/kompasid-paywall-modal-register/KompasPaywallModalRegister.js.map +1 -0
- package/dist/src/components/kompasid-paywall-modal-register/types.d.ts +33 -0
- package/dist/src/components/kompasid-paywall-modal-register/types.js +2 -0
- package/dist/src/components/kompasid-paywall-modal-register/types.js.map +1 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/tailwind/tailwind.js +165 -0
- package/dist/tailwind/tailwind.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/kompasid-header-account/KompasHeaderAccount.ts +5 -0
- package/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.ts +78 -6
- package/src/components/kompasid-paywall/types.ts +1 -0
- package/src/components/kompasid-paywall-body/KompasPaywallBody.ts +22 -1
- package/src/components/kompasid-paywall-modal-register/KompasPaywallModalRegister.ts +629 -0
- package/src/components/kompasid-paywall-modal-register/types.ts +39 -0
- package/src/index.ts +1 -0
- package/tailwind/tailwind.css +165 -0
- package/tailwind/tailwind.ts +165 -0
|
@@ -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
|
-
|
|
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
|
-
<
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
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()
|
|
@@ -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
|
}
|