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