@kompasid/lit-web-components 0.7.7 → 0.7.8
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/dist/src/components/kompasid-freewall/KompasFreewall.d.ts +5 -2
- package/dist/src/components/kompasid-freewall/KompasFreewall.js +61 -24
- package/dist/src/components/kompasid-freewall/KompasFreewall.js.map +1 -1
- package/dist/src/components/kompasid-freewall/types.d.ts +12 -0
- package/dist/src/components/kompasid-freewall/types.js.map +1 -1
- package/dist/src/components/kompasid-freewall-body/KompasFreewallBody.d.ts +2 -1
- package/dist/src/components/kompasid-freewall-body/KompasFreewallBody.js +19 -16
- package/dist/src/components/kompasid-freewall-body/KompasFreewallBody.js.map +1 -1
- package/dist/src/components/kompasid-freewall-head/KompasFreewallHead.d.ts +2 -1
- package/dist/src/components/kompasid-freewall-head/KompasFreewallHead.js +6 -6
- package/dist/src/components/kompasid-freewall-head/KompasFreewallHead.js.map +1 -1
- package/dist/src/components/kompasid-metered-paywall/KompasMeteredPaywall.d.ts +6 -4
- package/dist/src/components/kompasid-metered-paywall/KompasMeteredPaywall.js +54 -24
- package/dist/src/components/kompasid-metered-paywall/KompasMeteredPaywall.js.map +1 -1
- package/dist/src/components/kompasid-metered-paywall/types.d.ts +5 -0
- package/dist/src/components/kompasid-metered-paywall/types.js +2 -0
- package/dist/src/components/kompasid-metered-paywall/types.js.map +1 -0
- package/dist/src/components/kompasid-paywall/KompasPaywall.js +8 -2
- package/dist/src/components/kompasid-paywall/KompasPaywall.js.map +1 -1
- package/dist/src/components/kompasid-paywall/types.d.ts +7 -1
- package/dist/src/components/kompasid-paywall/types.js.map +1 -1
- package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.d.ts +3 -1
- package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js +16 -12
- package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/kompasid-freewall/KompasFreewall.ts +57 -25
- package/src/components/kompasid-freewall/readme.md +25 -0
- package/src/components/kompasid-freewall/types.ts +13 -0
- package/src/components/kompasid-freewall-body/KompasFreewallBody.ts +20 -17
- package/src/components/kompasid-freewall-head/KompasFreewallHead.ts +5 -7
- package/src/components/kompasid-metered-paywall/KompasMeteredPaywall.ts +54 -26
- package/src/components/kompasid-metered-paywall/readme.md +11 -0
- package/src/components/kompasid-metered-paywall/types.ts +5 -0
- package/src/components/kompasid-paywall/KompasPaywall.ts +10 -2
- package/src/components/kompasid-paywall/readme.md +161 -0
- package/src/components/kompasid-paywall/types.ts +7 -2
- package/src/components/kompasid-paywall-body/KompasPaywallBody.ts +16 -12
|
@@ -45,6 +45,31 @@
|
|
|
45
45
|
| `paywall_subscription_price` | `paywall_subscription_price` | property paywall_subscription_price is the price of the subscription package viewed by user | `number` | `0` |
|
|
46
46
|
| `paywall_position` | `paywall_position` | property paywall_position is the position of the subscription package viewed by user | `number` | `1` |
|
|
47
47
|
|
|
48
|
+
|
|
49
|
+
## JSON ([https://cdn-www.kompas.id/web-component/freewall.json](https://cdn-www.kompas.id/web-component/freewall.json))
|
|
50
|
+
Example:
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"headCopyCollapse": "Akses seluruh konten dan fitur Kompas.id dengan berlangganan.",
|
|
55
|
+
"headCopyExpand": "Akses seluruh konten dan fitur Kompas.id dengan berlangganan.",
|
|
56
|
+
"subscriptionUrl": "kdp?productId=9802035",
|
|
57
|
+
"subscriptionTitle": "Dukung Jurnalisme Mencerahkan dengan Berlangganan",
|
|
58
|
+
"subscriptionTitleGuest": "Mulai Berlangganan",
|
|
59
|
+
"subscriptionDescription": [
|
|
60
|
+
"Akses seluruh konten Kompas.id di web & aplikasi",
|
|
61
|
+
"ePaper hingga 30 edisi terakhir",
|
|
62
|
+
"Buku digital tiap bulannya di aplikasi"
|
|
63
|
+
],
|
|
64
|
+
"subscriptionButtonText": "Langganan Rp 50.000 / bulan",
|
|
65
|
+
"registerTitle": "Daftar Akun Gratis",
|
|
66
|
+
"registerDescription": [
|
|
67
|
+
"Akses ke 3 artikel berbayar gratis tiap bulan"
|
|
68
|
+
],
|
|
69
|
+
"registerButtonText": "Daftar Gratis"
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
48
73
|
## Dependencies
|
|
49
74
|
|
|
50
75
|
### Depends on
|
|
@@ -8,3 +8,16 @@ export interface PackageData {
|
|
|
8
8
|
title: string
|
|
9
9
|
referrer: string
|
|
10
10
|
}
|
|
11
|
+
|
|
12
|
+
export interface JsonPackageData {
|
|
13
|
+
headCopyCollapse: string
|
|
14
|
+
headCopyExpand: string
|
|
15
|
+
subscriptionUrl: string
|
|
16
|
+
subscriptionTitle: string
|
|
17
|
+
subscriptionTitleGuest: string
|
|
18
|
+
subscriptionDescription: string[]
|
|
19
|
+
subscriptionButtonText: string
|
|
20
|
+
registerTitle: string
|
|
21
|
+
registerDescription: string[]
|
|
22
|
+
registerButtonText: string
|
|
23
|
+
}
|
|
@@ -2,9 +2,7 @@ import { html, css, LitElement, nothing } from 'lit'
|
|
|
2
2
|
import { property, customElement } from 'lit/decorators.js'
|
|
3
3
|
import { TWStyles } from '../../../tailwind/tailwind.js'
|
|
4
4
|
import { addGoogleFonts } from '../../utils/googleFont.js'
|
|
5
|
-
import {
|
|
6
|
-
import { generateCopyDuration } from '../../utils/generateCopyDuration.js'
|
|
7
|
-
import { PackageData } from '../kompasid-freewall/types.js'
|
|
5
|
+
import { JsonPackageData, PackageData } from '../kompasid-freewall/types.js'
|
|
8
6
|
import { faCheck } from '../../../assets/font-awesome.js'
|
|
9
7
|
import { redirectToRegister } from '../../utils/cta.js'
|
|
10
8
|
|
|
@@ -93,6 +91,8 @@ export class KompasFreewallBody extends LitElement {
|
|
|
93
91
|
@property({ type: String }) type: 'article' | 'landing_page' = 'article'
|
|
94
92
|
@property() onSubscriptionClick = () => {}
|
|
95
93
|
@property({ type: Object }) packageData: PackageData = {} as PackageData
|
|
94
|
+
@property({ type: Object }) jsonPackageData: JsonPackageData =
|
|
95
|
+
{} as JsonPackageData
|
|
96
96
|
|
|
97
97
|
description = [
|
|
98
98
|
'Akses seluruh konten Kompas.id di web & aplikasi',
|
|
@@ -134,8 +134,8 @@ export class KompasFreewallBody extends LitElement {
|
|
|
134
134
|
.isLogin && 'w-60 md:w-full'} text-grey-600"
|
|
135
135
|
>
|
|
136
136
|
${this.isLogin
|
|
137
|
-
?
|
|
138
|
-
:
|
|
137
|
+
? this.jsonPackageData.subscriptionTitle
|
|
138
|
+
: this.jsonPackageData.subscriptionTitleGuest}
|
|
139
139
|
</h5>
|
|
140
140
|
${this.descriptionSection()}
|
|
141
141
|
</div>
|
|
@@ -145,8 +145,7 @@ export class KompasFreewallBody extends LitElement {
|
|
|
145
145
|
.isLogin &&
|
|
146
146
|
'md:w-[370px]'} md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-white font-bold leading-[18px]"
|
|
147
147
|
>
|
|
148
|
-
|
|
149
|
-
/${generateCopyDuration(this.packageData.durationType)}
|
|
148
|
+
${this.jsonPackageData.subscriptionButtonText}
|
|
150
149
|
</button>
|
|
151
150
|
</div>
|
|
152
151
|
<div id="ribbon-container">
|
|
@@ -169,22 +168,26 @@ export class KompasFreewallBody extends LitElement {
|
|
|
169
168
|
<h5
|
|
170
169
|
class="font-lora text-lg md:text-xl font-bold leading-[30px] text-grey-600"
|
|
171
170
|
>
|
|
172
|
-
|
|
171
|
+
${this.jsonPackageData.registerTitle}
|
|
173
172
|
</h5>
|
|
174
|
-
<div
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
173
|
+
<div class="flex flex-col space-y-1 mt-3 mb-4 md:mt-4 md:mb-5">
|
|
174
|
+
${this.jsonPackageData.registerDescription.map(
|
|
175
|
+
item => html`
|
|
176
|
+
<div class="flex items-start lg:items-center">
|
|
177
|
+
<div class="mt-1 lg:mt-0">${faCheck()}</div>
|
|
178
|
+
<h6 class="text-base text-grey-600 ml-1 text-start">
|
|
179
|
+
${item}
|
|
180
|
+
</h6>
|
|
181
|
+
</div>
|
|
182
|
+
`
|
|
183
|
+
)}
|
|
181
184
|
</div>
|
|
182
185
|
</div>
|
|
183
186
|
<button
|
|
184
187
|
@click=${() => redirectToRegister('freewall')}
|
|
185
188
|
class="bg-white border border-brand-1 whitespace-nowrap rounded md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-brand-1 font-bold leading-[18px]"
|
|
186
189
|
>
|
|
187
|
-
|
|
190
|
+
${this.jsonPackageData.registerButtonText}
|
|
188
191
|
</button>
|
|
189
192
|
</div>
|
|
190
193
|
`
|
|
@@ -192,7 +195,7 @@ export class KompasFreewallBody extends LitElement {
|
|
|
192
195
|
|
|
193
196
|
private descriptionSection() {
|
|
194
197
|
return html`<div class="flex flex-col space-y-1 mt-3 mb-4 md:mt-4 md:mb-5">
|
|
195
|
-
${this.
|
|
198
|
+
${this.jsonPackageData.subscriptionDescription.map(
|
|
196
199
|
item =>
|
|
197
200
|
html`
|
|
198
201
|
<div class="flex items-start lg:items-center">
|
|
@@ -4,9 +4,7 @@ import { unsafeSVG } from 'lit/directives/unsafe-svg.js'
|
|
|
4
4
|
import { TWStyles } from '../../../tailwind/tailwind.js'
|
|
5
5
|
import { addGoogleFonts } from '../../utils/googleFont.js'
|
|
6
6
|
import { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js'
|
|
7
|
-
import {
|
|
8
|
-
import { generateCopyDuration } from '../../utils/generateCopyDuration.js'
|
|
9
|
-
import { PackageData } from '../kompasid-freewall/types.js'
|
|
7
|
+
import { JsonPackageData, PackageData } from '../kompasid-freewall/types.js'
|
|
10
8
|
|
|
11
9
|
@customElement('kompasid-freewall-head')
|
|
12
10
|
export class KompasFreewallHead extends LitElement {
|
|
@@ -33,6 +31,8 @@ export class KompasFreewallHead extends LitElement {
|
|
|
33
31
|
@property() toggleExpand = () => {}
|
|
34
32
|
@property() onSubscriptionClick = () => {}
|
|
35
33
|
@property({ type: Object }) packageData: PackageData = {} as PackageData
|
|
34
|
+
@property({ type: Object }) jsonPackageData: JsonPackageData =
|
|
35
|
+
{} as JsonPackageData
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Getter
|
|
@@ -73,8 +73,7 @@ export class KompasFreewallHead extends LitElement {
|
|
|
73
73
|
@click=${this.onSubscriptionClick}
|
|
74
74
|
class="bg-green-500 hidden md:block ml-3 whitespace-nowrap rounded md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-white font-bold leading-[18px]"
|
|
75
75
|
>
|
|
76
|
-
|
|
77
|
-
/${generateCopyDuration(this.packageData.durationType)}
|
|
76
|
+
${this.jsonPackageData.subscriptionButtonText}
|
|
78
77
|
</button>`
|
|
79
78
|
: nothing}
|
|
80
79
|
</div>
|
|
@@ -95,8 +94,7 @@ export class KompasFreewallHead extends LitElement {
|
|
|
95
94
|
@click=${this.onSubscriptionClick}
|
|
96
95
|
class="bg-green-500 block md:hidden whitespace-nowrap rounded md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-white font-bold leading-[18px]"
|
|
97
96
|
>
|
|
98
|
-
|
|
99
|
-
/${generateCopyDuration(this.packageData.durationType)}
|
|
97
|
+
${this.jsonPackageData.subscriptionButtonText}
|
|
100
98
|
</button>`
|
|
101
99
|
: nothing}
|
|
102
100
|
</div>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { html, css, LitElement } from 'lit'
|
|
1
|
+
import { html, css, LitElement, nothing } from 'lit'
|
|
2
2
|
import { customElement, state, property } from 'lit/decorators.js'
|
|
3
3
|
import { TWStyles } from '../../../tailwind/tailwind.js'
|
|
4
|
+
import { PackageData } from './types.js'
|
|
4
5
|
|
|
5
6
|
@customElement('kompasid-metered-paywall')
|
|
6
7
|
export class KompasMeteredPaywall extends LitElement {
|
|
@@ -34,9 +35,14 @@ export class KompasMeteredPaywall extends LitElement {
|
|
|
34
35
|
TWStyles,
|
|
35
36
|
]
|
|
36
37
|
|
|
37
|
-
@state()
|
|
38
|
+
@state() private isLoading: Boolean = true
|
|
39
|
+
@state() private maxQuota: number = 3
|
|
40
|
+
@state() private packageData: PackageData = {
|
|
41
|
+
subscriptionText: 'Langganan untuk akses tanpa batas',
|
|
42
|
+
buttonText: 'Langganan',
|
|
43
|
+
subscriptionUrl: 'https://www.kompas.id/berlangganan',
|
|
44
|
+
}
|
|
38
45
|
|
|
39
|
-
@state() subscriptionUrl: string = 'https://www.kompas.id/berlangganan'
|
|
40
46
|
/**
|
|
41
47
|
* Props
|
|
42
48
|
*/
|
|
@@ -85,27 +91,45 @@ export class KompasMeteredPaywall extends LitElement {
|
|
|
85
91
|
<p>
|
|
86
92
|
Anda memiliki sisa
|
|
87
93
|
<b>${maxQuota - getCountdown} dari ${maxQuota}</b> artikel premium
|
|
88
|
-
gratis bulan ini.
|
|
94
|
+
gratis bulan ini. ${this.packageData.subscriptionText}
|
|
89
95
|
</p>
|
|
90
96
|
`
|
|
91
97
|
}
|
|
92
98
|
return html`
|
|
93
99
|
<p>
|
|
94
|
-
Anda sedang membaca <b>artikel gratis terakhir bulan ini.</b>
|
|
95
|
-
|
|
100
|
+
Anda sedang membaca <b>artikel gratis terakhir bulan ini.</b> ${this
|
|
101
|
+
.packageData.subscriptionText}
|
|
96
102
|
</p>
|
|
97
103
|
`
|
|
98
104
|
}
|
|
99
105
|
|
|
100
|
-
connectedCallback() {
|
|
106
|
+
override connectedCallback() {
|
|
101
107
|
super.connectedCallback()
|
|
102
|
-
|
|
108
|
+
this.getMeteredPaywallData()
|
|
103
109
|
this.dataLayeronMeteredPaywall()
|
|
104
110
|
}
|
|
105
111
|
|
|
112
|
+
async getMeteredPaywallData() {
|
|
113
|
+
try {
|
|
114
|
+
const response = await fetch(
|
|
115
|
+
'https://cdn-www.kompas.id/web-component/metered-paywall.json'
|
|
116
|
+
)
|
|
117
|
+
const json = await response.json()
|
|
118
|
+
this.packageData = {
|
|
119
|
+
subscriptionText: json.subscriptionText,
|
|
120
|
+
buttonText: json.buttonText,
|
|
121
|
+
subscriptionUrl: json.subscriptionUrl,
|
|
122
|
+
}
|
|
123
|
+
} catch (error) {
|
|
124
|
+
throw Error('Failed to get metered paywall data')
|
|
125
|
+
} finally {
|
|
126
|
+
this.isLoading = false
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
106
130
|
private redirectToBerlangganan() {
|
|
107
131
|
this.dataLayeronLanggananButton()
|
|
108
|
-
window.location.href = this.subscriptionUrl
|
|
132
|
+
window.location.href = this.packageData.subscriptionUrl
|
|
109
133
|
}
|
|
110
134
|
|
|
111
135
|
private dataLayeronLanggananButton() {
|
|
@@ -151,24 +175,28 @@ export class KompasMeteredPaywall extends LitElement {
|
|
|
151
175
|
}
|
|
152
176
|
|
|
153
177
|
render() {
|
|
154
|
-
return
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
<div class="text-grey-600 text-sm md:text-lg self-center text-left">
|
|
160
|
-
${this.getCountdownArticle()}
|
|
161
|
-
</div>
|
|
162
|
-
<div class="self-center">
|
|
163
|
-
<button
|
|
164
|
-
@click="${this.redirectToBerlangganan}"
|
|
165
|
-
class="bg-green-400 p-2 rounded-md font-bold text-grey-100 text-sm md:text-xl"
|
|
178
|
+
return !this.isLoading
|
|
179
|
+
? html`
|
|
180
|
+
<div class="sticky bottom-0 w-full h-full">
|
|
181
|
+
<div
|
|
182
|
+
class="flex flex-row w-full bg-blue-100 py-4 justify-center space-x-4 px-4 lg:px-0 bottom-0"
|
|
166
183
|
>
|
|
167
|
-
|
|
168
|
-
|
|
184
|
+
<div
|
|
185
|
+
class="text-grey-600 text-sm md:text-lg self-center text-left"
|
|
186
|
+
>
|
|
187
|
+
${this.getCountdownArticle()}
|
|
188
|
+
</div>
|
|
189
|
+
<div class="self-center">
|
|
190
|
+
<button
|
|
191
|
+
@click="${this.redirectToBerlangganan}"
|
|
192
|
+
class="bg-green-400 p-2 rounded-md font-bold text-grey-100 text-sm md:text-xl"
|
|
193
|
+
>
|
|
194
|
+
${this.packageData.buttonText}
|
|
195
|
+
</button>
|
|
196
|
+
</div>
|
|
197
|
+
</div>
|
|
169
198
|
</div>
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
`
|
|
199
|
+
`
|
|
200
|
+
: nothing
|
|
173
201
|
}
|
|
174
202
|
}
|
|
@@ -23,4 +23,15 @@
|
|
|
23
23
|
|
|
24
24
|
----------------------------------------------
|
|
25
25
|
|
|
26
|
+
## JSON ([https://cdn-www.kompas.id/web-component/metered-paywall.json](https://cdn-www.kompas.id/web-component/metered-paywall.json))
|
|
27
|
+
Example:
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"subscriptionText": "Langganan untuk akses tanpa batas",
|
|
32
|
+
"buttonText": "Langganan",
|
|
33
|
+
"subscriptionUrl": "https://www.kompas.id/berlangganan"
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
26
37
|
*Terbikin oleh tim front-end kompas.id*
|
|
@@ -121,7 +121,14 @@ export class KompasPaywall extends LitElement {
|
|
|
121
121
|
packages: {
|
|
122
122
|
title: 'Sekali bayar, tanpa perpanjang otomatis',
|
|
123
123
|
memberships: [],
|
|
124
|
-
|
|
124
|
+
swgEnable: false,
|
|
125
|
+
freeTrial: {
|
|
126
|
+
packageText: 'untuk 3 hari pertama',
|
|
127
|
+
desktopText:
|
|
128
|
+
'Coba gratis 3 hari Kompas.id melalui aplikasi. Pindai kode QR dengan ponsel atau tablet untuk mengunduh aplikasi.',
|
|
129
|
+
mobileText:
|
|
130
|
+
'Dapatkan akses gratis selama 3 hari ke konten dan fitur premium Kompas.id di aplikasi.',
|
|
131
|
+
},
|
|
125
132
|
},
|
|
126
133
|
payment: {
|
|
127
134
|
desktop: [
|
|
@@ -262,11 +269,12 @@ export class KompasPaywall extends LitElement {
|
|
|
262
269
|
packages: {
|
|
263
270
|
...this.mockResult.packages,
|
|
264
271
|
memberships: json[this.type].memberships,
|
|
272
|
+
swgEnable: json[this.type].swgEnable,
|
|
265
273
|
freeTrial: json[this.type].freeTrial,
|
|
266
274
|
},
|
|
267
275
|
}
|
|
268
276
|
} catch (error) {
|
|
269
|
-
throw Error('
|
|
277
|
+
throw Error('Failed to get paywall data')
|
|
270
278
|
} finally {
|
|
271
279
|
this.isLoading = false
|
|
272
280
|
}
|
|
@@ -33,6 +33,167 @@ Ini adalah redesign komponen _paywall_ yang digunakan pada [epaper.kompas.id](ht
|
|
|
33
33
|
| `userGuid` | `user-guid` | | `string` | `''` |
|
|
34
34
|
|
|
35
35
|
|
|
36
|
+
## JSON ([https://cdn-www.kompas.id/web-component/paywall.json](https://cdn-www.kompas.id/web-component/paywall.json))
|
|
37
|
+
Example:
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"epaper": {
|
|
42
|
+
"head": "Akses ePaper Ini dengan Berlangganan",
|
|
43
|
+
"content": [
|
|
44
|
+
"10+ buku digital dan 5+ Political Insight eksklusif di aplikasi",
|
|
45
|
+
"Akses ePaper hingga 30 edisi terakhir",
|
|
46
|
+
"Undangan prioritas webinar eksklusif bersama redaksi",
|
|
47
|
+
"Klaim voucer digital Hotel Santika dan mitra Kompas.id lainnya"
|
|
48
|
+
],
|
|
49
|
+
"memberships": [
|
|
50
|
+
{
|
|
51
|
+
"title": "Kompas Digital Premium 12 Bulan (Hemat 40%)",
|
|
52
|
+
"percentage": 40,
|
|
53
|
+
"price": 360000,
|
|
54
|
+
"discountPrice": 600000,
|
|
55
|
+
"savingPrice": 30000,
|
|
56
|
+
"periode": "Tahun",
|
|
57
|
+
"isHighlight": true,
|
|
58
|
+
"url": "https://checkoutv2.kompas.id/kdp?productId=9802032&referrer=",
|
|
59
|
+
"package": "Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 12",
|
|
60
|
+
"subscriptionId": "9802032",
|
|
61
|
+
"position": 1
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"title": "Kompas Digital Premium 1 Bulan",
|
|
65
|
+
"percentage": 0,
|
|
66
|
+
"discountPrice": 0,
|
|
67
|
+
"price": 50000,
|
|
68
|
+
"periode": "Bulan",
|
|
69
|
+
"isHighlight": false,
|
|
70
|
+
"url": "https://checkoutv2.kompas.id/kdp?productId=9802035&referrer=",
|
|
71
|
+
"package": "Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 1",
|
|
72
|
+
"subscriptionId": "9802035",
|
|
73
|
+
"position": 2
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"swgEnable": true
|
|
77
|
+
},
|
|
78
|
+
"reguler": {
|
|
79
|
+
"head": "Baca Lengkap Seluruh Artikel dengan Berlangganan",
|
|
80
|
+
"content": [
|
|
81
|
+
"10+ buku digital dan 5+ Political Insight eksklusif di aplikasi",
|
|
82
|
+
"Akses ePaper hingga 30 edisi terakhir",
|
|
83
|
+
"Undangan prioritas webinar eksklusif bersama redaksi",
|
|
84
|
+
"Klaim voucer digital Hotel Santika dan mitra Kompas.id lainnya"
|
|
85
|
+
],
|
|
86
|
+
"memberships": [
|
|
87
|
+
{
|
|
88
|
+
"title": "Kompas Digital Premium 12 Bulan (Hemat 40%)",
|
|
89
|
+
"percentage": 40,
|
|
90
|
+
"price": 360000,
|
|
91
|
+
"discountPrice": 600000,
|
|
92
|
+
"savingPrice": 30000,
|
|
93
|
+
"periode": "Tahun",
|
|
94
|
+
"isHighlight": true,
|
|
95
|
+
"url": "https://checkoutv2.kompas.id/kdp?productId=9802032&referrer=",
|
|
96
|
+
"package": "Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 12",
|
|
97
|
+
"subscriptionId": "9802032",
|
|
98
|
+
"position": 1
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"title": "Kompas Digital Premium 1 Bulan",
|
|
102
|
+
"percentage": 0,
|
|
103
|
+
"discountPrice": 0,
|
|
104
|
+
"price": 50000,
|
|
105
|
+
"periode": "Bulan",
|
|
106
|
+
"isHighlight": false,
|
|
107
|
+
"url": "https://checkoutv2.kompas.id/kdp?productId=9802035&referrer=",
|
|
108
|
+
"package": "Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 1",
|
|
109
|
+
"subscriptionId": "9802035",
|
|
110
|
+
"position": 2
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
"swgEnable": true
|
|
114
|
+
},
|
|
115
|
+
"audio": {
|
|
116
|
+
"head": "Akses Audio Berita dan Keuntungan Lainnya dengan Berlangganan",
|
|
117
|
+
"content": [
|
|
118
|
+
"10+ buku digital dan 5+ Political Insight eksklusif di aplikasi",
|
|
119
|
+
"Akses ePaper hingga 30 edisi terakhir",
|
|
120
|
+
"Undangan prioritas webinar eksklusif bersama redaksi",
|
|
121
|
+
"Klaim voucer digital Hotel Santika dan mitra Kompas.id lainnya"
|
|
122
|
+
],
|
|
123
|
+
"memberships": [
|
|
124
|
+
{
|
|
125
|
+
"title": "Kompas Digital Premium 12 Bulan (Hemat 40%)",
|
|
126
|
+
"percentage": 40,
|
|
127
|
+
"price": 360000,
|
|
128
|
+
"discountPrice": 600000,
|
|
129
|
+
"savingPrice": 30000,
|
|
130
|
+
"periode": "Tahun",
|
|
131
|
+
"isHighlight": true,
|
|
132
|
+
"url": "https://checkoutv2.kompas.id/kdp?productId=9802032&referrer=",
|
|
133
|
+
"package": "Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 12",
|
|
134
|
+
"subscriptionId": "9802032",
|
|
135
|
+
"position": 1
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"title": "Kompas Digital Premium 1 Bulan",
|
|
139
|
+
"percentage": 0,
|
|
140
|
+
"discountPrice": 0,
|
|
141
|
+
"price": 50000,
|
|
142
|
+
"periode": "Bulan",
|
|
143
|
+
"isHighlight": false,
|
|
144
|
+
"url": "https://checkoutv2.kompas.id/kdp?productId=9802035&referrer=",
|
|
145
|
+
"package": "Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 1",
|
|
146
|
+
"subscriptionId": "9802035",
|
|
147
|
+
"position": 2
|
|
148
|
+
}
|
|
149
|
+
],
|
|
150
|
+
"swgEnable": false
|
|
151
|
+
},
|
|
152
|
+
"custom": {
|
|
153
|
+
"head": "ini title custom",
|
|
154
|
+
"content": [
|
|
155
|
+
"Akses seluruh konten Kompas.id web dan aplikasi",
|
|
156
|
+
"ePaper hingga 30 edisi terakhir",
|
|
157
|
+
"Artikel Riset dan Opini eksklusif dari para ahli",
|
|
158
|
+
"Buku digital tiap bulannya di aplikasi"
|
|
159
|
+
],
|
|
160
|
+
"memberships": [
|
|
161
|
+
{
|
|
162
|
+
"title": "Kompas Digital Premium 12 Bulan (Hemat 40%)",
|
|
163
|
+
"percentage": 40,
|
|
164
|
+
"price": 360000,
|
|
165
|
+
"discountPrice": 600000,
|
|
166
|
+
"savingPrice": 30000,
|
|
167
|
+
"periode": "Tahun",
|
|
168
|
+
"isHighlight": true,
|
|
169
|
+
"url": "https://checkoutv2.kompas.id/kdp?productId=9802032&referrer=",
|
|
170
|
+
"package": "Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 12",
|
|
171
|
+
"subscriptionId": "9802032",
|
|
172
|
+
"position": 1
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"title": "Kompas Digital Premium 1 Bulan",
|
|
176
|
+
"percentage": 0,
|
|
177
|
+
"discountPrice": 0,
|
|
178
|
+
"price": 50000,
|
|
179
|
+
"periode": "Bulan",
|
|
180
|
+
"isHighlight": false,
|
|
181
|
+
"url": "https://checkoutv2.kompas.id/kdp?productId=9802035&referrer=",
|
|
182
|
+
"package": "Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 1",
|
|
183
|
+
"subscriptionId": "9802035",
|
|
184
|
+
"position": 2
|
|
185
|
+
}
|
|
186
|
+
],
|
|
187
|
+
"swgEnable": true,
|
|
188
|
+
"freeTrial": {
|
|
189
|
+
"packageText": "untuk 3 hari pertama",
|
|
190
|
+
"desktopText": "Coba gratis 3 hari Kompas.id melalui aplikasi. Pindai kode QR dengan ponsel atau tablet untuk mengunduh aplikasi.",
|
|
191
|
+
"mobileText": "Dapatkan akses gratis selama 3 hari ke konten dan fitur premium Kompas.id di aplikasi."
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
36
197
|
## Dependencies
|
|
37
198
|
|
|
38
199
|
### Depends on
|
|
@@ -37,10 +37,16 @@ export interface Informations {
|
|
|
37
37
|
label: string
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
+
export interface FreeTrial {
|
|
41
|
+
packageText: string
|
|
42
|
+
desktopText: string
|
|
43
|
+
mobileText: string
|
|
44
|
+
}
|
|
40
45
|
export interface Packages {
|
|
41
46
|
title: string
|
|
42
47
|
memberships: Array<Product>
|
|
43
|
-
|
|
48
|
+
swgEnable: boolean
|
|
49
|
+
freeTrial: FreeTrial
|
|
44
50
|
}
|
|
45
51
|
export interface PaywallProduct {
|
|
46
52
|
informations: {
|
|
@@ -56,5 +62,4 @@ export interface PaywallProduct {
|
|
|
56
62
|
ekstension: Array<PaymentImage>
|
|
57
63
|
}
|
|
58
64
|
}
|
|
59
|
-
|
|
60
65
|
export type PaywallType = 'epaper' | 'reguler' | 'audio' | 'custom'
|
|
@@ -113,6 +113,7 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
113
113
|
@state() private swgProductId = 'kompas.id:kompas_digital_premium'
|
|
114
114
|
@state() private errorFlag = 0
|
|
115
115
|
|
|
116
|
+
_packages!: Packages
|
|
116
117
|
buttonElement!: HTMLButtonElement
|
|
117
118
|
targetElement!: HTMLElement
|
|
118
119
|
|
|
@@ -134,6 +135,10 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
134
135
|
return !this.isLogin || this.tracker_subscription_status === 'IA'
|
|
135
136
|
}
|
|
136
137
|
|
|
138
|
+
get packages(): Packages {
|
|
139
|
+
return this._packages
|
|
140
|
+
}
|
|
141
|
+
|
|
137
142
|
/**
|
|
138
143
|
* Logic Function
|
|
139
144
|
*/
|
|
@@ -181,11 +186,11 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
181
186
|
}
|
|
182
187
|
|
|
183
188
|
private handleClickOutside() {
|
|
184
|
-
if (this.targetElement
|
|
189
|
+
if (this.targetElement?.classList.contains('wrapper-body')) {
|
|
185
190
|
this.togglePaywall()
|
|
186
191
|
}
|
|
187
192
|
|
|
188
|
-
if (this.targetElement
|
|
193
|
+
if (this.targetElement?.id === 'freeTrialPopup') {
|
|
189
194
|
this.closeFreeTrialPopup()
|
|
190
195
|
}
|
|
191
196
|
}
|
|
@@ -411,9 +416,12 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
411
416
|
}
|
|
412
417
|
|
|
413
418
|
override async connectedCallback() {
|
|
419
|
+
this._packages = this.paywallData?.packages ?? ({} as Packages)
|
|
420
|
+
|
|
414
421
|
super.connectedCallback()
|
|
415
422
|
await this.updateComplete
|
|
416
|
-
|
|
423
|
+
|
|
424
|
+
if (this.packages.swgEnable) {
|
|
417
425
|
this.jsonScript()
|
|
418
426
|
const appendSWGButton = () => {
|
|
419
427
|
this.buttonElement = this.shadowRoot?.getElementById(
|
|
@@ -928,7 +936,7 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
928
936
|
: this.secondaryPackages(item)
|
|
929
937
|
)}
|
|
930
938
|
${this.freeTrialPackageSection()} ${this.freeTrialPopUp()}
|
|
931
|
-
${this.swgEnable ? this.swgPackageSection() : nothing}
|
|
939
|
+
${this.packages.swgEnable ? this.swgPackageSection() : nothing}
|
|
932
940
|
</div>
|
|
933
941
|
`
|
|
934
942
|
}
|
|
@@ -1122,8 +1130,7 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
1122
1130
|
? 'text-dark-7'
|
|
1123
1131
|
: 'text-grey-600'}"
|
|
1124
1132
|
>
|
|
1125
|
-
|
|
1126
|
-
dengan ponsel atau tablet untuk mengunduh aplikasi.
|
|
1133
|
+
${this.packages.freeTrial?.desktopText}
|
|
1127
1134
|
</div>
|
|
1128
1135
|
</div>
|
|
1129
1136
|
<div
|
|
@@ -1131,8 +1138,7 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
1131
1138
|
? 'text-dark-7'
|
|
1132
1139
|
: 'text-grey-600'}"
|
|
1133
1140
|
>
|
|
1134
|
-
|
|
1135
|
-
Kompas.id di aplikasi.
|
|
1141
|
+
${this.packages.freeTrial?.mobileText}
|
|
1136
1142
|
</div>
|
|
1137
1143
|
<div class="lg:flex flex justify-center mt-4 hidden lg:block gap-4">
|
|
1138
1144
|
<a
|
|
@@ -1162,9 +1168,7 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
1162
1168
|
}
|
|
1163
1169
|
|
|
1164
1170
|
private freeTrialPackageSection() {
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
if (packages.freeTrial) {
|
|
1171
|
+
if (this.packages.freeTrial) {
|
|
1168
1172
|
return html`
|
|
1169
1173
|
<div
|
|
1170
1174
|
class="flex flex-wrap items-center justify-between 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 ${this
|
|
@@ -1182,7 +1186,7 @@ export class KompasIdPaywallBody extends LitElement {
|
|
|
1182
1186
|
<p
|
|
1183
1187
|
class="text-xs ${this.isDark ? 'text-dark-7' : 'text-grey-600'}"
|
|
1184
1188
|
>
|
|
1185
|
-
${packages.freeTrial}
|
|
1189
|
+
${this.packages.freeTrial?.packageText}
|
|
1186
1190
|
</p>
|
|
1187
1191
|
</div>
|
|
1188
1192
|
</div>
|