@kompasid/lit-web-components 0.4.0 → 0.4.1
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/.github/workflows/npm-publish.yml +2 -2
- package/assets/video.jpg +0 -0
- package/demo/index.html +28 -27
- package/dist/src/components/kompasid-paywall/KompasPaywall.js +5 -8
- package/dist/src/components/kompasid-paywall/KompasPaywall.js.map +1 -1
- package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.d.ts +34 -7
- package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js +363 -246
- package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js.map +1 -1
- package/dist/src/components/kompasid-paywall-video/KompasPaywallVideo.d.ts +41 -5
- package/dist/src/components/kompasid-paywall-video/KompasPaywallVideo.js +168 -106
- package/dist/src/components/kompasid-paywall-video/KompasPaywallVideo.js.map +1 -1
- package/dist/src/utils/formatRupiah.d.ts +1 -0
- package/dist/src/utils/formatRupiah.js +7 -0
- package/dist/src/utils/formatRupiah.js.map +1 -0
- package/dist/tailwind/tailwind.js +123 -95
- package/dist/tailwind/tailwind.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/kompasid-paywall/KompasPaywall.ts +5 -8
- package/src/components/kompasid-paywall-body/KompasPaywallBody.ts +342 -194
- package/src/components/kompasid-paywall-video/KompasPaywallVideo.ts +163 -89
- package/src/components/kompasid-paywall-video/readme.md +1 -0
- package/src/utils/formatRupiah.ts +6 -0
- package/tailwind/tailwind.css +120 -92
- package/tailwind/tailwind.ts +123 -95
- package/tailwind.config.js +3 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-return-assign */
|
|
2
2
|
|
|
3
|
-
import { html, css, LitElement } from 'lit'
|
|
3
|
+
import { html, css, LitElement, nothing } from 'lit'
|
|
4
4
|
import { property, state, customElement } from 'lit/decorators.js'
|
|
5
5
|
import { unsafeSVG } from 'lit/directives/unsafe-svg.js'
|
|
6
6
|
import { TWStyles } from '../../../tailwind/tailwind.js'
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
} from '../kompasid-paywall/types.js'
|
|
13
13
|
import { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js'
|
|
14
14
|
import { deviceType } from '../../utils/deviceType.js'
|
|
15
|
+
import { formatRupiah } from '../../utils/formatRupiah.js'
|
|
15
16
|
|
|
16
17
|
@customElement('kompasid-paywall-body')
|
|
17
18
|
export class KompasIdPaywallBody extends LitElement {
|
|
@@ -23,6 +24,10 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
23
24
|
justify-items: center;
|
|
24
25
|
align-items: center;
|
|
25
26
|
}
|
|
27
|
+
|
|
28
|
+
.font-lora {
|
|
29
|
+
font-family: 'Lora', 'Georgia', 'serif';
|
|
30
|
+
}
|
|
26
31
|
`,
|
|
27
32
|
TWStyles,
|
|
28
33
|
]
|
|
@@ -86,6 +91,10 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
86
91
|
@property({ type: String }) tracker_epaper_edition = ''
|
|
87
92
|
@property({ type: String }) theme = ''
|
|
88
93
|
|
|
94
|
+
/**
|
|
95
|
+
* State
|
|
96
|
+
*/
|
|
97
|
+
|
|
89
98
|
@state() private isExtensionsOpened = false
|
|
90
99
|
@state() private kompasAkunHost = 'https://akun.kompas.id'
|
|
91
100
|
@state() private kompasApigenHost = 'https://apigen.kompas.id'
|
|
@@ -99,13 +108,24 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
99
108
|
|
|
100
109
|
buttonElement!: HTMLButtonElement
|
|
101
110
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
111
|
+
/**
|
|
112
|
+
* Getter
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
get loginUrl() {
|
|
116
|
+
return `${this.kompasLoginHost}?next=${encodeURIComponent(
|
|
117
|
+
this.selfHost + window.location.pathname
|
|
118
|
+
)}`
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
get isDark() {
|
|
122
|
+
return this.theme === 'dark'
|
|
107
123
|
}
|
|
108
124
|
|
|
125
|
+
/**
|
|
126
|
+
* Logic Function
|
|
127
|
+
*/
|
|
128
|
+
|
|
109
129
|
private redirectToCheckout(
|
|
110
130
|
url: string,
|
|
111
131
|
name: string,
|
|
@@ -115,7 +135,7 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
115
135
|
): void {
|
|
116
136
|
this.sendDataLayeronButtonBuyPackage(name, id, price, position)
|
|
117
137
|
const originHost: string = encodeURIComponent(window.location.href)
|
|
118
|
-
const source: string = this.type === 'epaper' ? 'epaper' : ''
|
|
138
|
+
const source: string = this.type === 'epaper' ? 'epaper' : 'article'
|
|
119
139
|
const directUrlCheckout: string = `${url}${originHost}&source=${source}`
|
|
120
140
|
window.open(directUrlCheckout)
|
|
121
141
|
}
|
|
@@ -130,12 +150,16 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
130
150
|
}
|
|
131
151
|
|
|
132
152
|
private redirectToRegister(): void {
|
|
133
|
-
const loginHost: string = 'https://account.kompas.id/
|
|
153
|
+
const loginHost: string = 'https://account.kompas.id/register'
|
|
134
154
|
const nextParams: string = encodeURIComponent(window.location.href)
|
|
135
155
|
const directUrlRegister: string = `${loginHost}?next=${nextParams}?status=sukses_login&status_login=login`
|
|
136
156
|
window.location.href = directUrlRegister
|
|
137
157
|
}
|
|
138
158
|
|
|
159
|
+
private redirectToLogin = (): void => {
|
|
160
|
+
window.location.href = this.loginUrl
|
|
161
|
+
}
|
|
162
|
+
|
|
139
163
|
private redirectToHelpdesk(): void {
|
|
140
164
|
this.sendDataLayeronHelpDesk()
|
|
141
165
|
window.open(
|
|
@@ -143,18 +167,14 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
143
167
|
)
|
|
144
168
|
}
|
|
145
169
|
|
|
146
|
-
private
|
|
147
|
-
|
|
148
|
-
}
|
|
170
|
+
private parsePrice(price: string): number {
|
|
171
|
+
const lowerCasePrice = price.toLowerCase()
|
|
149
172
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
173
|
+
if (lowerCasePrice.startsWith('rp')) {
|
|
174
|
+
return parseFloat(price.replace(/[^0-9,]/g, ''))
|
|
175
|
+
}
|
|
153
176
|
|
|
154
|
-
|
|
155
|
-
return `${this.kompasLoginHost}?next=${encodeURIComponent(
|
|
156
|
-
this.selfHost + window.location.pathname
|
|
157
|
-
)}`
|
|
177
|
+
return parseFloat(price.replace(/[^0-9.]/g, ''))
|
|
158
178
|
}
|
|
159
179
|
|
|
160
180
|
private async getRegisterToken(path: string, payload: any): Promise<string> {
|
|
@@ -233,7 +253,7 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
233
253
|
})
|
|
234
254
|
}
|
|
235
255
|
|
|
236
|
-
private subscribeWithGoogleButton
|
|
256
|
+
private subscribeWithGoogleButton(): any {
|
|
237
257
|
// @ts-ignore
|
|
238
258
|
// eslint-disable-next-line no-restricted-globals
|
|
239
259
|
;(self.SWG = self.SWG || []).push((subscriptions: any) => {
|
|
@@ -243,10 +263,27 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
243
263
|
subscriptions.attachButton(
|
|
244
264
|
this.buttonElement,
|
|
245
265
|
{ theme: 'light', lang: 'en' },
|
|
246
|
-
() => {
|
|
266
|
+
async () => {
|
|
247
267
|
subscriptions.showOffers({ isClosable: true })
|
|
248
268
|
subscriptions.setOnLoginRequest(() => {
|
|
249
|
-
window.location.href = this.
|
|
269
|
+
window.location.href = this.loginUrl
|
|
270
|
+
})
|
|
271
|
+
const offers = await subscriptions.getOffers()
|
|
272
|
+
subscriptions.setOnFlowStarted((callback: any) => {
|
|
273
|
+
if (callback.flow === 'showOffers') {
|
|
274
|
+
window.dataLayer.push(this.swgPackageViewedDataLayer(offers))
|
|
275
|
+
} else if (callback.flow === 'subscribe') {
|
|
276
|
+
const selectedOfferSkuId = callback.data.skuId
|
|
277
|
+
const selectedOffer = offers.find(
|
|
278
|
+
(offer: any) => offer.skuId === selectedOfferSkuId
|
|
279
|
+
)
|
|
280
|
+
window.dataLayer.push(
|
|
281
|
+
this.swgSubscribeButtonClicked(
|
|
282
|
+
selectedOffer,
|
|
283
|
+
offers.indexOf(selectedOffer)
|
|
284
|
+
)
|
|
285
|
+
)
|
|
286
|
+
}
|
|
250
287
|
})
|
|
251
288
|
subscriptions.setOnPaymentResponse(async (paymentResponse: any) => {
|
|
252
289
|
const response = await paymentResponse
|
|
@@ -300,7 +337,7 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
300
337
|
}
|
|
301
338
|
}
|
|
302
339
|
response.complete().then(() => {
|
|
303
|
-
window.location.href = this.
|
|
340
|
+
window.location.href = this.loginUrl
|
|
304
341
|
})
|
|
305
342
|
})
|
|
306
343
|
}
|
|
@@ -359,6 +396,94 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
359
396
|
|
|
360
397
|
setTimeout(appendSWGButton, 500)
|
|
361
398
|
}
|
|
399
|
+
this.addStylesheetToHead()
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
private addStylesheetToHead() {
|
|
403
|
+
const loraCssUrl =
|
|
404
|
+
'https://fonts.googleapis.com/css2?family=Lora:wght@700&display=swap'
|
|
405
|
+
const ptSansCssUrl =
|
|
406
|
+
'https://fonts.googleapis.com/css2?family=PT+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap'
|
|
407
|
+
|
|
408
|
+
let loraElement = document.querySelector(`link[href="${loraCssUrl}"]`)
|
|
409
|
+
if (!loraElement) {
|
|
410
|
+
loraElement = document.createElement('link')
|
|
411
|
+
loraElement.setAttribute('rel', 'stylesheet')
|
|
412
|
+
loraElement.setAttribute('href', loraCssUrl)
|
|
413
|
+
document.head.appendChild(loraElement)
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
let ptSansElement = document.querySelector(`link[href="${ptSansCssUrl}"]`)
|
|
417
|
+
if (!ptSansElement) {
|
|
418
|
+
ptSansElement = document.createElement('link')
|
|
419
|
+
ptSansElement.setAttribute('rel', 'stylesheet')
|
|
420
|
+
ptSansElement.setAttribute('href', ptSansCssUrl)
|
|
421
|
+
document.head.appendChild(ptSansElement)
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
private otherPackagesClicked() {
|
|
426
|
+
this.sendDataLayerOtherPackagesClicked()
|
|
427
|
+
this.redirectToSubscriber()
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
private customerServiceClicked() {
|
|
431
|
+
this.sendDataLayerCustomerServiceClicked()
|
|
432
|
+
this.redirectToHelpdesk()
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Data Layer
|
|
437
|
+
*/
|
|
438
|
+
|
|
439
|
+
private buildGtmParams(
|
|
440
|
+
event: string,
|
|
441
|
+
impressions: Record<string, any>[],
|
|
442
|
+
index: number = 0
|
|
443
|
+
) {
|
|
444
|
+
const gtmParams: Record<string, any> = {
|
|
445
|
+
event,
|
|
446
|
+
impressions: impressions.map((impression, i) => ({
|
|
447
|
+
paywall_location: this.paywall_location || '',
|
|
448
|
+
paywall_subscription_package: impression.package,
|
|
449
|
+
paywall_subscription_id: impression.subscription_id,
|
|
450
|
+
paywall_subscription_price: this.parsePrice(impression.price),
|
|
451
|
+
paywall_position: index + i + 1,
|
|
452
|
+
user_type: this.tracker_user_type,
|
|
453
|
+
subscription_status: this.tracker_subscription_status,
|
|
454
|
+
page_domain: this.tracker_page_domain || 'Kompas.id',
|
|
455
|
+
metered_wall_type: this.tracker_metered_wall_type || 'HP',
|
|
456
|
+
metered_wall_balance: this.tracker_metered_wall_balance,
|
|
457
|
+
...(this.type === 'epaper'
|
|
458
|
+
? { epaper_edition: this.tracker_epaper_edition }
|
|
459
|
+
: {
|
|
460
|
+
page_type: this.tracker_page_type,
|
|
461
|
+
content_id: this.tracker_content_id,
|
|
462
|
+
content_title: this.tracker_content_title,
|
|
463
|
+
content_categories: this.tracker_content_categories,
|
|
464
|
+
content_type: this.tracker_content_type,
|
|
465
|
+
}),
|
|
466
|
+
})),
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
return gtmParams
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
private generalPaywallDataLayer(event: string): Record<string, any> {
|
|
473
|
+
const impressions = [
|
|
474
|
+
{
|
|
475
|
+
package: 'Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 12',
|
|
476
|
+
subscription_id: '9802032',
|
|
477
|
+
price: '360000',
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
package: 'Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 1',
|
|
481
|
+
subscription_id: '9802035',
|
|
482
|
+
price: '50000',
|
|
483
|
+
},
|
|
484
|
+
]
|
|
485
|
+
|
|
486
|
+
return this.buildGtmParams(event, impressions)
|
|
362
487
|
}
|
|
363
488
|
|
|
364
489
|
private sendDataLayer(): void {
|
|
@@ -412,78 +537,99 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
412
537
|
window.dataLayer.push(gtmParams)
|
|
413
538
|
}
|
|
414
539
|
|
|
415
|
-
private sendDataLayeronPaywallBody
|
|
416
|
-
const gtmParams
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
540
|
+
private sendDataLayeronPaywallBody(): void {
|
|
541
|
+
const gtmParams = this.generalPaywallDataLayer('paywall_viewed')
|
|
542
|
+
window.dataLayer.push(gtmParams)
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
private sendDataLayerOtherPackagesClicked(): void {
|
|
546
|
+
const gtmParams = this.generalPaywallDataLayer('other_packages_clicked')
|
|
547
|
+
window.dataLayer.push(gtmParams)
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
private sendDataLayerCustomerServiceClicked(): void {
|
|
551
|
+
const gtmParams = this.generalPaywallDataLayer('customer_service_clicked')
|
|
552
|
+
window.dataLayer.push(gtmParams)
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
private swgPackageViewedDataLayer(data: any): Record<string, any> {
|
|
556
|
+
const impressions = data.map(
|
|
557
|
+
(item: {
|
|
558
|
+
title: string
|
|
559
|
+
skuId: string
|
|
560
|
+
price: string
|
|
561
|
+
introductoryPrice: string
|
|
562
|
+
}) => ({
|
|
563
|
+
package: item.title,
|
|
564
|
+
subscription_id: item.skuId,
|
|
565
|
+
price: item.introductoryPrice || item.price,
|
|
566
|
+
})
|
|
567
|
+
)
|
|
568
|
+
|
|
569
|
+
return this.buildGtmParams('subscription_package_viewed', impressions)
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
private swgSubscribeButtonClicked(item: any, index: number) {
|
|
573
|
+
const gtmParams: any = {
|
|
574
|
+
event: 'subscribe_button_clicked',
|
|
575
|
+
paywall_location: this.paywall_location || '',
|
|
576
|
+
paywall_subscription_package: item.title,
|
|
577
|
+
paywall_subscription_id: item.skuId,
|
|
578
|
+
paywall_subscription_price: this.parsePrice(
|
|
579
|
+
item.introductoryPrice || item.price
|
|
580
|
+
),
|
|
581
|
+
paywall_position: index + 1,
|
|
582
|
+
user_type: this.tracker_user_type,
|
|
583
|
+
subscription_status: this.tracker_subscription_status,
|
|
584
|
+
page_domain: this.tracker_page_domain || 'Kompas.id',
|
|
585
|
+
metered_wall_type: this.tracker_metered_wall_type || 'HP',
|
|
586
|
+
metered_wall_balance: this.tracker_metered_wall_balance,
|
|
446
587
|
}
|
|
447
588
|
|
|
448
589
|
if (this.type === 'epaper') {
|
|
449
|
-
gtmParams.
|
|
450
|
-
gtmParams.impressions[1].epaper_edition = this.tracker_epaper_edition
|
|
590
|
+
gtmParams.epaper_edition = this.tracker_epaper_edition
|
|
451
591
|
} else {
|
|
452
|
-
gtmParams.
|
|
453
|
-
gtmParams.
|
|
454
|
-
gtmParams.
|
|
455
|
-
gtmParams.
|
|
456
|
-
|
|
457
|
-
gtmParams.impressions[0].content_type = this.tracker_content_type
|
|
458
|
-
|
|
459
|
-
gtmParams.impressions[1].page_type = this.tracker_page_type
|
|
460
|
-
gtmParams.impressions[1].content_id = this.tracker_content_id
|
|
461
|
-
gtmParams.impressions[1].content_title = this.tracker_content_title
|
|
462
|
-
gtmParams.impressions[1].content_categories =
|
|
463
|
-
this.tracker_content_categories
|
|
464
|
-
gtmParams.impressions[1].content_type = this.tracker_content_type
|
|
592
|
+
gtmParams.page_type = this.tracker_page_type
|
|
593
|
+
gtmParams.content_id = this.tracker_content_id
|
|
594
|
+
gtmParams.content_title = this.tracker_content_title
|
|
595
|
+
gtmParams.content_categories = this.tracker_content_categories
|
|
596
|
+
gtmParams.content_type = this.tracker_content_type
|
|
465
597
|
}
|
|
466
598
|
|
|
467
|
-
|
|
599
|
+
return gtmParams
|
|
468
600
|
}
|
|
469
601
|
|
|
602
|
+
/**
|
|
603
|
+
* Component
|
|
604
|
+
*/
|
|
605
|
+
|
|
470
606
|
private headerSection(type: 'epaper' | 'reguler') {
|
|
607
|
+
const headerSectionText =
|
|
608
|
+
type === 'epaper'
|
|
609
|
+
? 'Akses ePaper Ini dengan Berlangganan'
|
|
610
|
+
: 'Lanjut Baca Artikel Ini dengan Berlangganan'
|
|
471
611
|
return html`
|
|
472
|
-
<div class="flex w-full items-center">
|
|
612
|
+
<div class="flex w-full items-center justify-center">
|
|
473
613
|
${type === 'epaper'
|
|
474
614
|
? html`<button
|
|
475
|
-
@click=${
|
|
615
|
+
@click=${this.redirectToPrevUrl}
|
|
476
616
|
class="hidden lg:block w-8 h-8 text-blue-600 pl-4"
|
|
477
617
|
>
|
|
478
618
|
${unsafeSVG(getFontAwesomeIcon('fas', 'arrow-left'))}
|
|
479
619
|
</button>`
|
|
480
|
-
:
|
|
620
|
+
: nothing}
|
|
481
621
|
<h4
|
|
482
|
-
class="text-base md:text-xl ${this
|
|
483
|
-
|
|
622
|
+
class="text-base flex justify-center self-center md:block md:text-xl ${this
|
|
623
|
+
.isDark
|
|
624
|
+
? 'text-white'
|
|
625
|
+
: 'text-grey-600'}
|
|
626
|
+
text-center font-lora font-bold tracking-wide md:tracking-normal w-4/5 md:w-full"
|
|
484
627
|
>
|
|
485
|
-
|
|
628
|
+
${headerSectionText}
|
|
486
629
|
</h4>
|
|
630
|
+
${type === 'epaper'
|
|
631
|
+
? html`<div class="w-10 hidden lg:flex"></div>`
|
|
632
|
+
: nothing}
|
|
487
633
|
</div>
|
|
488
634
|
`
|
|
489
635
|
}
|
|
@@ -495,12 +641,13 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
495
641
|
item =>
|
|
496
642
|
html`
|
|
497
643
|
<div class="flex items-center">
|
|
498
|
-
<div class
|
|
644
|
+
<div class=${this.isDark ? 'text-green-400' : 'text-green-500'}>
|
|
499
645
|
${unsafeSVG(getFontAwesomeIcon('fas', 'check', 12, 12))}
|
|
500
646
|
</div>
|
|
501
647
|
<h6
|
|
502
|
-
class="text-xs md:text-base ${this.isDark
|
|
503
|
-
|
|
648
|
+
class="text-xs md:text-base ${this.isDark
|
|
649
|
+
? 'text-white'
|
|
650
|
+
: 'text-grey-600'} ml-0.5 md:ml-1"
|
|
504
651
|
>
|
|
505
652
|
${item}
|
|
506
653
|
</h6>
|
|
@@ -514,7 +661,7 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
514
661
|
private informationPackages() {
|
|
515
662
|
return html` <div class="mt-4 flex justify-center">
|
|
516
663
|
<button
|
|
517
|
-
@click=${
|
|
664
|
+
@click=${this.otherPackagesClicked}
|
|
518
665
|
class="text-sm md:text-base font-bold ${this.isDark
|
|
519
666
|
? 'text-blue-300'
|
|
520
667
|
: 'text-blue-600'} underline"
|
|
@@ -527,63 +674,73 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
527
674
|
private separatorLine() {
|
|
528
675
|
return html`
|
|
529
676
|
<div class="flex flex-row w-full justify-center">
|
|
530
|
-
<
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
: 'border-blue-200'} w-1/4 my-4 flex justify-center"
|
|
534
|
-
></div>
|
|
535
|
-
<p class="px-4 pt-1 ${this.isDark && 'text-dark-1'}">atau</p>
|
|
536
|
-
<div
|
|
537
|
-
class="border-b-2 ${this.isDark
|
|
538
|
-
? 'border-dark-2'
|
|
539
|
-
: 'border-blue-200'} w-1/4 my-4 flex justify-center"
|
|
540
|
-
></div>
|
|
677
|
+
<p class="px-4 pt-1 ${this.isDark ? 'text-dark-1' : 'text-grey-500'}">
|
|
678
|
+
atau
|
|
679
|
+
</p>
|
|
541
680
|
</div>
|
|
542
681
|
`
|
|
543
682
|
}
|
|
544
683
|
|
|
545
|
-
private
|
|
684
|
+
private epaperRegistrationSection() {
|
|
546
685
|
return html`
|
|
547
|
-
<div
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
686
|
+
<div>
|
|
687
|
+
<button
|
|
688
|
+
@click=${this.redirectToLogin}
|
|
689
|
+
class="text-sm md:text-base font-bold ${this.isDark
|
|
690
|
+
? 'text-blue-300'
|
|
691
|
+
: 'text-blue-600'} underline"
|
|
692
|
+
>
|
|
693
|
+
Masuk
|
|
694
|
+
</button>
|
|
695
|
+
<span class=${this.isDark && 'text-white'}>
|
|
696
|
+
jika sudah berlangganan.</span
|
|
697
|
+
>
|
|
558
698
|
</div>
|
|
559
699
|
`
|
|
560
700
|
}
|
|
561
701
|
|
|
562
|
-
private
|
|
702
|
+
private regulerRegistrationSection() {
|
|
563
703
|
return html`
|
|
564
|
-
<div
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
704
|
+
<div class="flex flex-col items-center justify-center">
|
|
705
|
+
<div>
|
|
706
|
+
<button
|
|
707
|
+
@click=${this.redirectToRegister}
|
|
708
|
+
class="text-sm md:text-base font-bold ${this.isDark
|
|
709
|
+
? 'text-blue-300'
|
|
710
|
+
: 'text-blue-600'} underline"
|
|
711
|
+
>
|
|
712
|
+
Daftar
|
|
713
|
+
</button>
|
|
714
|
+
<span class=${this.isDark ? 'text-white' : 'text-grey-600'}>
|
|
715
|
+
untuk kuota artikel gratis</span
|
|
716
|
+
>
|
|
717
|
+
</div>
|
|
718
|
+
<div>
|
|
719
|
+
<span class=${this.isDark ? 'text-white' : 'text-grey-600'}
|
|
720
|
+
>atau
|
|
721
|
+
</span>
|
|
722
|
+
<button
|
|
723
|
+
@click=${this.redirectToLogin}
|
|
724
|
+
class="text-sm md:text-base font-bold ${this.isDark
|
|
725
|
+
? 'text-blue-300'
|
|
726
|
+
: 'text-blue-600'} underline"
|
|
727
|
+
>
|
|
728
|
+
Masuk
|
|
729
|
+
</button>
|
|
730
|
+
<span class=${this.isDark ? 'text-white' : 'text-grey-600'}>
|
|
731
|
+
jika sudah punya akun.</span
|
|
732
|
+
>
|
|
733
|
+
</div>
|
|
583
734
|
</div>
|
|
584
735
|
`
|
|
585
736
|
}
|
|
586
737
|
|
|
738
|
+
private registrationSection(type: 'epaper' | 'reguler') {
|
|
739
|
+
return type === 'epaper'
|
|
740
|
+
? this.epaperRegistrationSection()
|
|
741
|
+
: this.regulerRegistrationSection()
|
|
742
|
+
}
|
|
743
|
+
|
|
587
744
|
private paymentMobileExtension(data: Array<PaymentImage>) {
|
|
588
745
|
return html`
|
|
589
746
|
<div
|
|
@@ -628,22 +785,23 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
628
785
|
<div
|
|
629
786
|
class="flex flex-wrap justify-between items-center ${this.isDark
|
|
630
787
|
? 'bg-grey-600'
|
|
631
|
-
: 'bg-white'} rounded md:mx-0 w-full max-w-xs md:max-w-sm md:w-3/5 mt-2.5 md:mt-4 border border-yellow-400 relative"
|
|
788
|
+
: 'bg-white'} rounded-lg md:mx-0 w-full max-w-xs md:max-w-sm md:w-3/5 mt-2.5 md:mt-4 border border-yellow-400 relative"
|
|
632
789
|
>
|
|
633
790
|
<div class="flex flex-col py-3 px-4">
|
|
634
791
|
<div class="flex flex-none items-center">
|
|
635
792
|
<h5 class="text-base md:text-lg font-bold text-orange-400">
|
|
636
|
-
${
|
|
793
|
+
${formatRupiah(product.price)}
|
|
637
794
|
</h5>
|
|
638
795
|
<h6
|
|
639
|
-
class="text-xs md:text-base ${this.isDark
|
|
640
|
-
|
|
796
|
+
class="text-xs md:text-base ${this.isDark
|
|
797
|
+
? 'text-dark-7'
|
|
798
|
+
: 'text-grey-600'} font-bold pl-1"
|
|
641
799
|
>
|
|
642
800
|
/ ${product.periode}
|
|
643
801
|
</h6>
|
|
644
802
|
</div>
|
|
645
803
|
<div class="flex items-center">
|
|
646
|
-
<p class="text-xs ${this.isDark
|
|
804
|
+
<p class="text-xs ${this.isDark ? 'text-dark-7' : 'text-grey-600'}">
|
|
647
805
|
hanya <span class="text-orange-400">Rp 30.000</span> / bulan
|
|
648
806
|
</p>
|
|
649
807
|
</div>
|
|
@@ -671,7 +829,7 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
671
829
|
</button>
|
|
672
830
|
<div class="absolute -top-2 left-4">
|
|
673
831
|
<div class="rounded bg-yellow-300 px-2 py-0.5 text-xs">
|
|
674
|
-
<b>Harga Terbaik</b>
|
|
832
|
+
<b class="text-grey-600">Harga Terbaik</b>
|
|
675
833
|
</div>
|
|
676
834
|
</div>
|
|
677
835
|
</div>
|
|
@@ -683,15 +841,16 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
683
841
|
<div
|
|
684
842
|
class="flex flex-wrap justify-between ${this.isDark
|
|
685
843
|
? 'bg-grey-600'
|
|
686
|
-
: 'bg-white'} py-3 px-4 rounded md:mx-0 w-full max-w-xs md:max-w-sm md:w-3/5 mt-3 md:mt-4"
|
|
844
|
+
: 'bg-white'} py-3 px-4 rounded-lg md:mx-0 w-full max-w-xs md:max-w-sm md:w-3/5 mt-3 md:mt-4"
|
|
687
845
|
>
|
|
688
846
|
<div class="flex items-center">
|
|
689
847
|
<h5 class="text-base md:text-lg font-bold text-orange-400">
|
|
690
|
-
${
|
|
848
|
+
${formatRupiah(product.price)}
|
|
691
849
|
</h5>
|
|
692
850
|
<h6
|
|
693
|
-
class="text-xs md:text-base ${this.isDark
|
|
694
|
-
|
|
851
|
+
class="text-xs md:text-base ${this.isDark
|
|
852
|
+
? 'text-dark-7'
|
|
853
|
+
: 'text-grey-600'} font-bold pl-1"
|
|
695
854
|
>
|
|
696
855
|
/ ${product.periode}
|
|
697
856
|
</h6>
|
|
@@ -722,12 +881,7 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
722
881
|
|
|
723
882
|
private packagesSection(data: Packages) {
|
|
724
883
|
return html`
|
|
725
|
-
<div class="flex flex-col w-full items-center mt-8 lg:mt-2 px-
|
|
726
|
-
<h6
|
|
727
|
-
class="text-sm md:text-base ${this.isDark && 'text-white'} font-bold"
|
|
728
|
-
>
|
|
729
|
-
${data.title}
|
|
730
|
-
</h6>
|
|
884
|
+
<div class="flex flex-col w-full items-center mt-8 lg:mt-2 px-4">
|
|
731
885
|
${data.memberships.map(item =>
|
|
732
886
|
item.isHighlight
|
|
733
887
|
? this.primaryPackages(item)
|
|
@@ -741,7 +895,7 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
741
895
|
return html`
|
|
742
896
|
<div class="flex lg:hidden items-center w-full pb-4 ">
|
|
743
897
|
<button
|
|
744
|
-
@click=${
|
|
898
|
+
@click=${this.redirectToPrevUrl}
|
|
745
899
|
class="text-xs md:text-lg text-white flex flex-row"
|
|
746
900
|
>
|
|
747
901
|
<div class="icon-lg icon-white w-4 h-4 mr-3.5 md:mr-5 pt-0.5">
|
|
@@ -754,74 +908,55 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
754
908
|
}
|
|
755
909
|
|
|
756
910
|
private helpDesk() {
|
|
757
|
-
return html`
|
|
758
|
-
<div class="py-2.5 text-white self-center text-xs md:text-sm">
|
|
759
|
-
Mengalami masalah? Hubungi
|
|
760
|
-
<button
|
|
761
|
-
@click=${() => this.redirectToHelpdesk()}
|
|
762
|
-
class="font-bold ${this.isDark && 'text-blue-300'} underline"
|
|
763
|
-
>
|
|
764
|
-
Layanan Pelanggan.
|
|
765
|
-
</button>
|
|
766
|
-
</div>
|
|
767
|
-
`
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
private authRegister() {
|
|
771
911
|
return html`
|
|
772
912
|
<div
|
|
773
|
-
class="
|
|
913
|
+
class="${this.isDark
|
|
914
|
+
? 'text-dark-7'
|
|
915
|
+
: 'text-white'} self-center text-xs md:text-sm"
|
|
774
916
|
>
|
|
775
|
-
|
|
776
|
-
<b>Sudah berlangganan Kompas.id?</b>
|
|
777
|
-
<p>Masuk untuk lanjut membaca.</p>
|
|
778
|
-
</div>
|
|
917
|
+
Butuh bantuan? Hubungi
|
|
779
918
|
<button
|
|
780
|
-
@click=${
|
|
781
|
-
class="
|
|
782
|
-
? 'bg-blue-300'
|
|
783
|
-
: 'bg-grey-100'} rounded mr-3"
|
|
919
|
+
@click=${this.customerServiceClicked}
|
|
920
|
+
class="font-bold underline"
|
|
784
921
|
>
|
|
785
|
-
|
|
786
|
-
class="text-xs md:text-sm ${this.isDark
|
|
787
|
-
? 'text-black'
|
|
788
|
-
: 'text-blue-600'} font-bold py-2 px-4"
|
|
789
|
-
>
|
|
790
|
-
Masuk / Daftar
|
|
791
|
-
</p>
|
|
922
|
+
Layanan Pelanggan.
|
|
792
923
|
</button>
|
|
793
924
|
</div>
|
|
794
925
|
`
|
|
795
926
|
}
|
|
796
927
|
|
|
797
|
-
private userAction(
|
|
928
|
+
private userAction() {
|
|
798
929
|
return html`
|
|
799
930
|
<div
|
|
800
|
-
class="flex
|
|
931
|
+
class="flex py-5 px-8 md:py-6 ${this.isDark
|
|
801
932
|
? 'bg-dark-4'
|
|
802
|
-
: 'bg-blue-600'} w-full justify-evenly rounded-b mt-6 md:mt-8 relative"
|
|
933
|
+
: 'bg-blue-600'} w-full justify-evenly rounded-b-xl mt-6 md:mt-8 relative"
|
|
803
934
|
>
|
|
804
|
-
${
|
|
935
|
+
${this.helpDesk()}
|
|
805
936
|
</div>
|
|
806
937
|
`
|
|
807
938
|
}
|
|
808
939
|
|
|
940
|
+
/**
|
|
941
|
+
* Render Statement
|
|
942
|
+
*/
|
|
943
|
+
|
|
809
944
|
render() {
|
|
810
945
|
return html`
|
|
811
946
|
<div
|
|
812
947
|
class="${this.type === 'epaper'
|
|
813
|
-
? 'bg-transparent wrapper-body'
|
|
948
|
+
? 'bg-transparent wrapper-body mx-2'
|
|
814
949
|
: 'wrapper-body'}"
|
|
815
950
|
>
|
|
816
951
|
<div
|
|
817
|
-
class="flex flex-col justify-center items-center w-full max-w-screen-sm
|
|
952
|
+
class="flex flex-col justify-center items-center w-full max-w-screen-sm my-5 relative"
|
|
818
953
|
>
|
|
819
|
-
${this.type === 'epaper' ? this.topNavigator() :
|
|
954
|
+
${this.type === 'epaper' ? this.topNavigator() : nothing}
|
|
820
955
|
<div
|
|
821
956
|
class="flex w-full flex-col items-center justify-center ${this
|
|
822
957
|
.isDark
|
|
823
958
|
? 'bg-dark-3'
|
|
824
|
-
: 'bg-blue-100'} rounded pt-6 md:pt-8 relative"
|
|
959
|
+
: 'bg-blue-100'} rounded-xl pt-6 md:pt-8 relative"
|
|
825
960
|
>
|
|
826
961
|
${this.headerSection(this.type)}
|
|
827
962
|
${this.descriptionSection(
|
|
@@ -831,30 +966,43 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
831
966
|
this.paywallData?.packages ?? ({} as Packages)
|
|
832
967
|
)}
|
|
833
968
|
${this.informationPackages()}
|
|
834
|
-
${this.swgEnable ? this.separatorLine() :
|
|
969
|
+
${this.swgEnable ? this.separatorLine() : nothing}
|
|
835
970
|
${this.swgEnable
|
|
836
971
|
? html`<button
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
972
|
+
class="${this.isDark
|
|
973
|
+
? 'bg-grey-600'
|
|
974
|
+
: 'border-2 bg-grey-100 border-grey-100'} rounded-lg px-6 shadow-sm flex flex-row py-2 mt-1 items-center"
|
|
975
|
+
id="subscribe-with-google"
|
|
976
|
+
>
|
|
977
|
+
<p class=${this.isDark ? 'text-dark-7' : 'text-grey-500'}>
|
|
978
|
+
Subscribe with
|
|
979
|
+
</p>
|
|
980
|
+
<img
|
|
981
|
+
class="pl-2 object-scale-down w-20 pt-0.5"
|
|
982
|
+
src=${this.isDark
|
|
983
|
+
? 'https://kompasid-production-www.s3.ap-southeast-1.amazonaws.com/paywall-asset/google-white.png'
|
|
984
|
+
: 'https://kompasid-production-www.s3.ap-southeast-1.amazonaws.com/paywall-asset/google.png'}
|
|
985
|
+
alt="subscribe with google"
|
|
986
|
+
/>
|
|
987
|
+
</button>`
|
|
988
|
+
: nothing}
|
|
989
|
+
${!this.isLogin
|
|
990
|
+
? html`
|
|
991
|
+
<div
|
|
992
|
+
class="border-b ${this.isDark
|
|
993
|
+
? 'border-dark-8'
|
|
994
|
+
: 'border-blue-200'} w-1/5 my-4 flex justify-center"
|
|
995
|
+
></div>
|
|
996
|
+
${this.registrationSection(this.type)}
|
|
997
|
+
`
|
|
998
|
+
: nothing}
|
|
999
|
+
${this.userAction()} ${this.sendDataLayeronPaywallBody()}
|
|
852
1000
|
</div>
|
|
853
1001
|
${this.isExtensionsOpened
|
|
854
1002
|
? this.paymentMobileExtension(
|
|
855
1003
|
this.paywallData?.payment?.ekstension ?? []
|
|
856
1004
|
)
|
|
857
|
-
:
|
|
1005
|
+
: nothing}
|
|
858
1006
|
</div>
|
|
859
1007
|
</div>
|
|
860
1008
|
`
|