@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,9 +1,11 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
/* eslint-disable class-methods-use-this */
|
|
3
|
-
import { html, css, LitElement } from 'lit';
|
|
3
|
+
import { html, css, LitElement, nothing } from 'lit';
|
|
4
4
|
import { property, customElement, state } from 'lit/decorators.js';
|
|
5
5
|
import { TWStyles } from '../../../tailwind/tailwind.js';
|
|
6
6
|
import { deviceType } from '../../utils/deviceType.js';
|
|
7
|
+
import { formatRupiah } from '../../utils/formatRupiah.js';
|
|
8
|
+
import { addGoogleFonts } from '../../utils/googleFont.js';
|
|
7
9
|
let KompasPaywallVideo = class KompasPaywallVideo extends LitElement {
|
|
8
10
|
constructor() {
|
|
9
11
|
super(...arguments);
|
|
@@ -27,8 +29,8 @@ let KompasPaywallVideo = class KompasPaywallVideo extends LitElement {
|
|
|
27
29
|
* prop page_domain = Page Domain
|
|
28
30
|
* prop metered_wall_type = The type of Metered Wall
|
|
29
31
|
* prop metered_wall_balance = The balance of their metered wall
|
|
32
|
+
* prop type = The type of video paywall
|
|
30
33
|
*/
|
|
31
|
-
this.subscriptionUrl = 'https://www.kompas.id/berlangganan';
|
|
32
34
|
this.isLogin = false;
|
|
33
35
|
this.paywall_location = '';
|
|
34
36
|
this.paywall_subscription_package = '';
|
|
@@ -45,77 +47,37 @@ let KompasPaywallVideo = class KompasPaywallVideo extends LitElement {
|
|
|
45
47
|
this.tracker_page_domain = '';
|
|
46
48
|
this.tracker_metered_wall_type = '';
|
|
47
49
|
this.tracker_metered_wall_balance = 0;
|
|
48
|
-
this.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
this.sendDataLayeronBerlangganan = () => {
|
|
55
|
-
window.dataLayer.push({
|
|
56
|
-
event: 'paywall_viewed',
|
|
57
|
-
paywall_location: this.paywall_location,
|
|
58
|
-
paywall_subscription_package: this.paywall_subscription_package,
|
|
59
|
-
paywall_subscription_id: this.paywall_subscription_id,
|
|
60
|
-
paywall_subscription_price: this.paywall_subscription_price,
|
|
61
|
-
paywall_position: this.paywall_position,
|
|
62
|
-
page_type: this.tracker_page_type,
|
|
63
|
-
content_id: this.tracker_content_id,
|
|
64
|
-
content_title: this.tracker_content_title,
|
|
65
|
-
content_categories: this.tracker_content_categories,
|
|
66
|
-
content_type: this.tracker_content_type,
|
|
67
|
-
user_type: this.tracker_user_type,
|
|
68
|
-
subscription_status: this.tracker_subscription_status,
|
|
69
|
-
page_domain: this.tracker_page_domain || 'Kompas.id',
|
|
70
|
-
metered_wall_type: this.tracker_metered_wall_type || 'HP',
|
|
71
|
-
metered_wall_balance: this.tracker_metered_wall_balance,
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
this.sendDataLayeronButtonLogin = (triggerClick) => {
|
|
75
|
-
window.dataLayer.push({
|
|
76
|
-
event: 'registrationOfferClick',
|
|
77
|
-
interface: deviceType(),
|
|
78
|
-
buttonClicked: triggerClick,
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
this.sendDataLayeronButtonBerlangganan = () => {
|
|
82
|
-
window.dataLayer.push({
|
|
83
|
-
event: 'subscribe_button_clicked',
|
|
84
|
-
paywall_location: this.paywall_location,
|
|
85
|
-
paywall_subscription_package: this.paywall_subscription_package,
|
|
86
|
-
paywall_subscription_id: this.paywall_subscription_id,
|
|
87
|
-
paywall_subscription_price: this.paywall_subscription_price,
|
|
88
|
-
paywall_position: this.paywall_position,
|
|
89
|
-
page_type: this.tracker_page_type,
|
|
90
|
-
content_id: this.tracker_content_id,
|
|
91
|
-
content_title: this.tracker_content_title,
|
|
92
|
-
content_categories: this.tracker_content_categories,
|
|
93
|
-
content_type: this.tracker_content_type,
|
|
94
|
-
user_type: this.tracker_user_type,
|
|
95
|
-
subscription_status: this.tracker_subscription_status,
|
|
96
|
-
page_domain: this.tracker_page_domain || 'Kompas.id',
|
|
97
|
-
metered_wall_type: this.tracker_metered_wall_type || 'HP',
|
|
98
|
-
metered_wall_balance: this.tracker_metered_wall_balance,
|
|
99
|
-
});
|
|
100
|
-
};
|
|
50
|
+
this.type = 'article';
|
|
51
|
+
/**
|
|
52
|
+
* State
|
|
53
|
+
*/
|
|
54
|
+
this.subscriptionUrl = 'https://www.kompas.id/berlangganan';
|
|
55
|
+
this.checkoutHost = 'https://checkoutv2.kompas.id';
|
|
101
56
|
}
|
|
102
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Component
|
|
59
|
+
*/
|
|
60
|
+
regulerRegistrationSection() {
|
|
103
61
|
return html `
|
|
104
|
-
<div
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
>
|
|
109
|
-
Akses konten premium Anda bulan ini sudah habis. Aktifkan langganan
|
|
110
|
-
untuk akses tanpa batas, mulai dari
|
|
111
|
-
<span class="font-bold">Rp50.000/bulan.</span>
|
|
112
|
-
</h5>
|
|
113
|
-
<div class="flex justify-between mt-4">
|
|
62
|
+
<div
|
|
63
|
+
class="flex flex-col text-white text-sm md:text-base items-center justify-center"
|
|
64
|
+
>
|
|
65
|
+
<div>
|
|
114
66
|
<button
|
|
115
|
-
@click=${() => this.
|
|
116
|
-
class="
|
|
67
|
+
@click=${() => this.redirectToRegister('Daftar')}
|
|
68
|
+
class="text-blue-300 font-bold"
|
|
117
69
|
>
|
|
118
|
-
|
|
70
|
+
Daftar
|
|
71
|
+
</button>
|
|
72
|
+
<span> untuk akses konten gratis.</span>
|
|
73
|
+
</div>
|
|
74
|
+
<div>
|
|
75
|
+
<span>Sudah punya akun? </span>
|
|
76
|
+
<button
|
|
77
|
+
@click=${this.redirectToLogin}
|
|
78
|
+
class="text-blue-300 font-bold"
|
|
79
|
+
>
|
|
80
|
+
Masuk<span class="text-white font-normal">.</span>
|
|
119
81
|
</button>
|
|
120
82
|
</div>
|
|
121
83
|
</div>
|
|
@@ -123,68 +85,172 @@ let KompasPaywallVideo = class KompasPaywallVideo extends LitElement {
|
|
|
123
85
|
}
|
|
124
86
|
defaultComponent() {
|
|
125
87
|
return html `
|
|
126
|
-
<div>
|
|
127
|
-
${this.sendDataLayeronNonLogin()} ${this.
|
|
88
|
+
<div class="flex flex-col items-center space-y-2 md:space-y-4">
|
|
89
|
+
${this.sendDataLayeronNonLogin()} ${this.sendDataLayerPaywallViewed()}
|
|
128
90
|
<h5
|
|
129
|
-
class="leading-6 text-white text-center text-base md:
|
|
91
|
+
class="leading-5 md:leading-6 w-[296px] md:w-[400px] text-white text-center text-base mb-2 md:mb-0 ${!this
|
|
92
|
+
.isLogin &&
|
|
93
|
+
!this.isArticle &&
|
|
94
|
+
'mb-0'} md:text-xl max-w-xl"
|
|
130
95
|
>
|
|
131
|
-
|
|
132
|
-
|
|
96
|
+
${this.isArticle
|
|
97
|
+
? 'Langganan untuk lanjut menonton video'
|
|
98
|
+
: 'Langganan sekarang untuk akses seluruh konten Kompas.id'}
|
|
133
99
|
</h5>
|
|
134
|
-
<
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
class="rounded text-sm text-white px-4 py-1.5 ring-1 ring-grey-100"
|
|
138
|
-
>
|
|
139
|
-
Masuk
|
|
140
|
-
</button>
|
|
141
|
-
<button
|
|
142
|
-
@click=${() => this.redirectToBerlangganan()}
|
|
143
|
-
class="bg-green-500 rounded px-4 py-1.5 text-sm text-white font-bold"
|
|
144
|
-
>
|
|
145
|
-
Berlangganan
|
|
146
|
-
</button>
|
|
147
|
-
</div>
|
|
148
|
-
<p
|
|
149
|
-
class="text-center text-sm leading-4 text-white mt-6 max-w-xs md:max-w-none"
|
|
100
|
+
<button
|
|
101
|
+
@click=${this.redirectToSelectedPackage}
|
|
102
|
+
class="bg-green-500 rounded md:rounded-lg h-8 md:h-12 px-4 md:px-6 text-sm md:text-lg text-white font-bold leading-[18px]"
|
|
150
103
|
>
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
104
|
+
Langganan ${formatRupiah(this.showPackage.price)}
|
|
105
|
+
/${this.generateCopyDuration(this.showPackage.durationType)}
|
|
106
|
+
</button>
|
|
107
|
+
<button
|
|
108
|
+
@click=${this.redirectToBerlangganan}
|
|
109
|
+
class="text-sm md:text-lg leading-[22px] text-white font-bold underline ${!this
|
|
110
|
+
.isLogin && this.isArticle
|
|
111
|
+
? 'pb-3'
|
|
112
|
+
: 'pb-2'} md:pb-4"
|
|
113
|
+
>
|
|
114
|
+
Paket Lainnya
|
|
115
|
+
</button>
|
|
116
|
+
${!this.isLogin ? this.regulerRegistrationSection() : nothing}
|
|
160
117
|
</div>
|
|
161
118
|
`;
|
|
162
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Data Layer
|
|
122
|
+
*/
|
|
123
|
+
sendDataLayer(event) {
|
|
124
|
+
const baseData = {
|
|
125
|
+
event,
|
|
126
|
+
paywall_location: this.paywall_location,
|
|
127
|
+
paywall_subscription_package: this.paywall_subscription_package || this.showPackage.title,
|
|
128
|
+
paywall_subscription_id: this.paywall_subscription_id || this.showPackage.id,
|
|
129
|
+
paywall_subscription_price: this.paywall_subscription_price || this.showPackage.price,
|
|
130
|
+
paywall_position: this.paywall_position || this.showPackage.position,
|
|
131
|
+
user_type: this.tracker_user_type,
|
|
132
|
+
subscription_status: this.tracker_subscription_status,
|
|
133
|
+
page_domain: this.tracker_page_domain || 'Kompas.id',
|
|
134
|
+
metered_wall_type: this.tracker_metered_wall_type || 'HP',
|
|
135
|
+
metered_wall_balance: this.tracker_metered_wall_balance,
|
|
136
|
+
};
|
|
137
|
+
const data = this.isArticle
|
|
138
|
+
? {
|
|
139
|
+
...baseData,
|
|
140
|
+
page_type: this.tracker_page_type,
|
|
141
|
+
content_id: this.tracker_content_id,
|
|
142
|
+
content_title: this.tracker_content_title,
|
|
143
|
+
content_categories: this.tracker_content_categories,
|
|
144
|
+
content_type: this.tracker_content_type,
|
|
145
|
+
}
|
|
146
|
+
: baseData;
|
|
147
|
+
window.dataLayer.push(data);
|
|
148
|
+
}
|
|
149
|
+
sendDataLayerPaywallViewed() {
|
|
150
|
+
this.sendDataLayer('paywall_viewed');
|
|
151
|
+
}
|
|
152
|
+
sendDataLayerSubscribeButtonClicked() {
|
|
153
|
+
this.sendDataLayer('subscribe_button_clicked');
|
|
154
|
+
}
|
|
155
|
+
sendDataLayerOtherPackagesClicked() {
|
|
156
|
+
this.sendDataLayer('other_packages_clicked');
|
|
157
|
+
}
|
|
158
|
+
sendDataLayeronButtonLogin(triggerClick) {
|
|
159
|
+
window.dataLayer.push({
|
|
160
|
+
event: 'registrationOfferClick',
|
|
161
|
+
interface: deviceType(),
|
|
162
|
+
buttonClicked: triggerClick,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
sendDataLayeronNonLogin() {
|
|
166
|
+
window.dataLayer.push({
|
|
167
|
+
event: 'registrationOfferimppression',
|
|
168
|
+
interface: deviceType(),
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Getter
|
|
173
|
+
*/
|
|
174
|
+
get isArticle() {
|
|
175
|
+
return this.type === 'article';
|
|
176
|
+
}
|
|
177
|
+
// temporary mocking data package for component and dataLayer
|
|
178
|
+
get showPackage() {
|
|
179
|
+
return {
|
|
180
|
+
duration: 1,
|
|
181
|
+
durationType: 3,
|
|
182
|
+
id: '9802035',
|
|
183
|
+
link: 'kdp?productId=9802035&referrer=https%3A%2F%2Fwww.kompas.cloud%2Fberlangganan',
|
|
184
|
+
price: 50000,
|
|
185
|
+
position: 1,
|
|
186
|
+
title: 'Kompas Digital Premium 1 Bulan',
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Logic Function
|
|
191
|
+
*/
|
|
163
192
|
redirectToRegister(triggerClick) {
|
|
164
193
|
this.sendDataLayeronButtonLogin(triggerClick);
|
|
165
194
|
const registerHost = 'https://account.kompas.id/register';
|
|
166
195
|
const nextParams = encodeURIComponent(window.location.href);
|
|
167
|
-
const directUrlRegister = `${registerHost}?next=${nextParams}?status=sukses_login&status_login=login`;
|
|
196
|
+
const directUrlRegister = `${registerHost}?next=${nextParams}?status=sukses_login&status_login=login&loc=video_paywall`;
|
|
168
197
|
window.open(directUrlRegister, '_blank');
|
|
169
198
|
}
|
|
199
|
+
redirectToLogin() {
|
|
200
|
+
const loginHost = 'https://account.kompas.id/login';
|
|
201
|
+
const nextParams = encodeURIComponent(window.location.href);
|
|
202
|
+
const directUrlLogin = `${loginHost}?next=${nextParams}&loc=video_paywall`;
|
|
203
|
+
window.open(directUrlLogin, '_blank');
|
|
204
|
+
}
|
|
205
|
+
redirectToSelectedPackage() {
|
|
206
|
+
const url = `${this.checkoutHost}/${this.showPackage.link}&source=${this.type}`;
|
|
207
|
+
this.sendDataLayerSubscribeButtonClicked();
|
|
208
|
+
window.open(url, '_blank');
|
|
209
|
+
}
|
|
170
210
|
redirectToBerlangganan() {
|
|
171
|
-
this.
|
|
211
|
+
this.sendDataLayerOtherPackagesClicked();
|
|
172
212
|
window.open(this.subscriptionUrl, '_blank');
|
|
173
213
|
}
|
|
214
|
+
generateCopyDuration(type) {
|
|
215
|
+
switch (type) {
|
|
216
|
+
case 1:
|
|
217
|
+
return 'hari';
|
|
218
|
+
case 2:
|
|
219
|
+
return 'minggu';
|
|
220
|
+
case 3:
|
|
221
|
+
return 'bulan';
|
|
222
|
+
case 4:
|
|
223
|
+
return 'tahun';
|
|
224
|
+
default:
|
|
225
|
+
return '';
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
async connectedCallback() {
|
|
229
|
+
super.connectedCallback();
|
|
230
|
+
await this.updateComplete;
|
|
231
|
+
addGoogleFonts(['pt-sans']);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Render Statement
|
|
235
|
+
*/
|
|
174
236
|
render() {
|
|
175
237
|
return html `
|
|
176
238
|
<div
|
|
177
|
-
class="radius absolute z-20 bg-black bg-opacity-
|
|
239
|
+
class="radius absolute z-20 bg-black bg-opacity-75 p-4 top-0 bottom-0 left-0 flex flex-col w-full h-full justify-center items-center"
|
|
178
240
|
>
|
|
179
|
-
${this.
|
|
241
|
+
${this.defaultComponent()}
|
|
180
242
|
</div>
|
|
181
243
|
`;
|
|
182
244
|
}
|
|
183
245
|
};
|
|
184
|
-
KompasPaywallVideo.styles = [
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
246
|
+
KompasPaywallVideo.styles = [
|
|
247
|
+
css `
|
|
248
|
+
:host {
|
|
249
|
+
font-family: 'PT Sans', sans-serif;
|
|
250
|
+
}
|
|
251
|
+
`,
|
|
252
|
+
TWStyles,
|
|
253
|
+
];
|
|
188
254
|
__decorate([
|
|
189
255
|
property({ type: Boolean })
|
|
190
256
|
], KompasPaywallVideo.prototype, "isLogin", void 0);
|
|
@@ -233,6 +299,15 @@ __decorate([
|
|
|
233
299
|
__decorate([
|
|
234
300
|
property({ type: Number })
|
|
235
301
|
], KompasPaywallVideo.prototype, "tracker_metered_wall_balance", void 0);
|
|
302
|
+
__decorate([
|
|
303
|
+
property({ type: String })
|
|
304
|
+
], KompasPaywallVideo.prototype, "type", void 0);
|
|
305
|
+
__decorate([
|
|
306
|
+
state()
|
|
307
|
+
], KompasPaywallVideo.prototype, "subscriptionUrl", void 0);
|
|
308
|
+
__decorate([
|
|
309
|
+
state()
|
|
310
|
+
], KompasPaywallVideo.prototype, "checkoutHost", void 0);
|
|
236
311
|
KompasPaywallVideo = __decorate([
|
|
237
312
|
customElement('kompasid-paywall-video')
|
|
238
313
|
], KompasPaywallVideo);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KompasPaywallVideo.js","sourceRoot":"","sources":["../../../../src/components/kompasid-paywall-video/KompasPaywallVideo.ts"],"names":[],"mappings":";AAAA,2CAA2C;AAC3C,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3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,CAAC;6DAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uEAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+DAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qEAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wEAAiC;AA3CjD,kBAAkB;IAD9B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,kBAAkB,CA2L9B;SA3LY,kBAAkB","sourcesContent":["/* eslint-disable class-methods-use-this */\nimport { html, css, LitElement } from 'lit'\nimport { property, customElement, state } from 'lit/decorators.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { deviceType } from '../../utils/deviceType.js'\n\n@customElement('kompasid-paywall-video')\nexport class KompasPaywallVideo extends LitElement {\n static styles = [css``, TWStyles]\n\n /**\n * Props\n */\n /**\n * prop isLogin untuk menghandle apakah user sudah login atau belum\n * prop paywall_location = The location where user encounter the paywall\n * prop paywall_subscription_package = The name of the subscription package viewed by user\n * prop paywall_subscription_id = The ID of the subscription package viewed by user\n * prop paywall_subscription_price = The price of the subscriprtion package viewed by user\n * prop paywall_position = The position of the subscription package viewed by user\n * prop page_type = Type of the page\n * prop content_id = ID of article (slug)\n * prop content_type = Whether it's free article or paid article\n * prop content_title = The title of article\n * prop tracker_content_categories = The category of the content\n * prop user_type = Type of user based on their subscription\n * prop subscription_status = Status of their subscription\n * prop page_domain = Page Domain\n * prop metered_wall_type = The type of Metered Wall\n * prop metered_wall_balance = The balance of their metered wall\n */\n\n @state() private subscriptionUrl: string =\n 'https://www.kompas.id/berlangganan'\n\n @property({ type: Boolean }) isLogin = false\n @property({ type: String }) paywall_location = ''\n @property({ type: String }) paywall_subscription_package = ''\n @property({ type: String }) paywall_subscription_id = ''\n @property({ type: Number }) paywall_subscription_price = 0\n @property({ type: Number }) paywall_position = 0\n @property({ type: String }) tracker_page_type = ''\n @property({ type: String }) tracker_content_id = ''\n @property({ type: String }) tracker_content_title = ''\n @property({ type: String }) tracker_content_categories = ''\n @property({ type: String }) tracker_content_type = ''\n @property({ type: String }) tracker_user_type = ''\n @property({ type: String }) tracker_subscription_status = ''\n @property({ type: String }) tracker_page_domain = ''\n @property({ type: String }) tracker_metered_wall_type = ''\n @property({ type: Number }) tracker_metered_wall_balance = 0\n\n private isLoginComponent() {\n return html`\n <div>\n ${this.sendDataLayeronBerlangganan()}\n <h5\n class=\"leading-6 text-white text-center text-base md:text-xl max-w-2xl\"\n >\n Akses konten premium Anda bulan ini sudah habis. Aktifkan langganan\n untuk akses tanpa batas, mulai dari\n <span class=\"font-bold\">Rp50.000/bulan.</span>\n </h5>\n <div class=\"flex justify-between mt-4\">\n <button\n @click=${() => this.redirectToBerlangganan()}\n class=\"bg-green-500 rounded px-4 py-1.5 text-sm text-white font-bold\"\n >\n Berlangganan\n </button>\n </div>\n </div>\n `\n }\n\n private defaultComponent() {\n return html`\n <div>\n ${this.sendDataLayeronNonLogin()} ${this.sendDataLayeronBerlangganan()}\n <h5\n class=\"leading-6 text-white text-center text-base md:text-xl max-w-xl\"\n >\n Langganan untuk akses ke seluruh konten premium, mulai dari\n <span class=\"font-bold\">Rp50.000/bulan.</span>\n </h5>\n <div class=\"flex justify-center mt-4 space-x-3\">\n <button\n @click=${() => this.redirectToRegister('Masuk')}\n class=\"rounded text-sm text-white px-4 py-1.5 ring-1 ring-grey-100\"\n >\n Masuk\n </button>\n <button\n @click=${() => this.redirectToBerlangganan()}\n class=\"bg-green-500 rounded px-4 py-1.5 text-sm text-white font-bold\"\n >\n Berlangganan\n </button>\n </div>\n <p\n class=\"text-center text-sm leading-4 text-white mt-6 max-w-xs md:max-w-none\"\n >\n Dapatkan 5 konten premium gratis tiap bulan!\n <button\n @click=${() => this.redirectToRegister('Coba Sekarang')}\n target=\"_blank\"\n class=\"text-blue-300 font-bold cursor-pointer\"\n >\n Coba Sekarang\n </button>\n </p>\n </div>\n `\n }\n\n private sendDataLayeronNonLogin = (): void => {\n window.dataLayer.push({\n event: 'registrationOfferimppression',\n interface: deviceType(),\n })\n }\n\n private sendDataLayeronBerlangganan = (): void => {\n window.dataLayer.push({\n event: 'paywall_viewed',\n paywall_location: this.paywall_location,\n paywall_subscription_package: this.paywall_subscription_package,\n paywall_subscription_id: this.paywall_subscription_id,\n paywall_subscription_price: this.paywall_subscription_price,\n paywall_position: this.paywall_position,\n page_type: this.tracker_page_type,\n content_id: this.tracker_content_id,\n content_title: this.tracker_content_title,\n content_categories: this.tracker_content_categories,\n content_type: this.tracker_content_type,\n user_type: this.tracker_user_type,\n subscription_status: this.tracker_subscription_status,\n page_domain: this.tracker_page_domain || 'Kompas.id',\n metered_wall_type: this.tracker_metered_wall_type || 'HP',\n metered_wall_balance: this.tracker_metered_wall_balance,\n })\n }\n\n private sendDataLayeronButtonLogin = (triggerClick: string): void => {\n window.dataLayer.push({\n event: 'registrationOfferClick',\n interface: deviceType(),\n buttonClicked: triggerClick,\n })\n }\n\n private sendDataLayeronButtonBerlangganan = (): void => {\n window.dataLayer.push({\n event: 'subscribe_button_clicked',\n paywall_location: this.paywall_location,\n paywall_subscription_package: this.paywall_subscription_package,\n paywall_subscription_id: this.paywall_subscription_id,\n paywall_subscription_price: this.paywall_subscription_price,\n paywall_position: this.paywall_position,\n page_type: this.tracker_page_type,\n content_id: this.tracker_content_id,\n content_title: this.tracker_content_title,\n content_categories: this.tracker_content_categories,\n content_type: this.tracker_content_type,\n user_type: this.tracker_user_type,\n subscription_status: this.tracker_subscription_status,\n page_domain: this.tracker_page_domain || 'Kompas.id',\n metered_wall_type: this.tracker_metered_wall_type || 'HP',\n metered_wall_balance: this.tracker_metered_wall_balance,\n })\n }\n\n private redirectToRegister(triggerClick: string): void {\n this.sendDataLayeronButtonLogin(triggerClick)\n const registerHost: string = 'https://account.kompas.id/register'\n const nextParams: string = encodeURIComponent(window.location.href)\n const directUrlRegister: string = `${registerHost}?next=${nextParams}?status=sukses_login&status_login=login`\n window.open(directUrlRegister, '_blank')\n }\n\n private redirectToBerlangganan(): void {\n this.sendDataLayeronButtonBerlangganan()\n window.open(this.subscriptionUrl, '_blank')\n }\n\n render() {\n return html`\n <div\n class=\"radius absolute z-20 bg-black bg-opacity-50 p-4 top-0 bottom-0 left-0 flex flex-col w-full h-full justify-center items-center\"\n >\n ${this.isLogin ? this.isLoginComponent() : this.defaultComponent()}\n </div>\n `\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"KompasPaywallVideo.js","sourceRoot":"","sources":["../../../../src/components/kompasid-paywall-video/KompasPaywallVideo.ts"],"names":[],"mappings":";AAAA,2CAA2C;AAC3C,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAGnD,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,UAAU;IAA3C;;QAUL;;WAEG;QACH;;;;;;;;;;;;;;;;;;WAkBG;QAE0B,YAAO,GAAG,KAAK,CAAA;QAChB,qBAAgB,GAAG,EAAE,CAAA;QACrB,iCAA4B,GAAG,EAAE,CAAA;QACjC,4BAAuB,GAAG,EAAE,CAAA;QAC5B,+BAA0B,GAAG,CAAC,CAAA;QAC9B,qBAAgB,GAAG,CAAC,CAAA;QACpB,sBAAiB,GAAG,EAAE,CAAA;QACtB,uBAAkB,GAAG,EAAE,CAAA;QACvB,0BAAqB,GAAG,EAAE,CAAA;QAC1B,+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AkB","sourcesContent":["/* eslint-disable class-methods-use-this */\nimport { html, css, LitElement, nothing } from 'lit'\nimport { property, customElement, state } from 'lit/decorators.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { deviceType } from '../../utils/deviceType.js'\nimport { formatRupiah } from '../../utils/formatRupiah.js'\nimport { addGoogleFonts } from '../../utils/googleFont.js'\n\n@customElement('kompasid-paywall-video')\nexport class KompasPaywallVideo extends LitElement {\n static styles = [\n css`\n :host {\n font-family: 'PT Sans', sans-serif;\n }\n `,\n TWStyles,\n ]\n\n /**\n * Props\n */\n /**\n * prop isLogin untuk menghandle apakah user sudah login atau belum\n * prop paywall_location = The location where user encounter the paywall\n * prop paywall_subscription_package = The name of the subscription package viewed by user\n * prop paywall_subscription_id = The ID of the subscription package viewed by user\n * prop paywall_subscription_price = The price of the subscriprtion package viewed by user\n * prop paywall_position = The position of the subscription package viewed by user\n * prop page_type = Type of the page\n * prop content_id = ID of article (slug)\n * prop content_type = Whether it's free article or paid article\n * prop content_title = The title of article\n * prop tracker_content_categories = The category of the content\n * prop user_type = Type of user based on their subscription\n * prop subscription_status = Status of their subscription\n * prop page_domain = Page Domain\n * prop metered_wall_type = The type of Metered Wall\n * prop metered_wall_balance = The balance of their metered wall\n * prop type = The type of video paywall\n */\n\n @property({ type: Boolean }) isLogin = false\n @property({ type: String }) paywall_location = ''\n @property({ type: String }) paywall_subscription_package = ''\n @property({ type: String }) paywall_subscription_id = ''\n @property({ type: Number }) paywall_subscription_price = 0\n @property({ type: Number }) paywall_position = 0\n @property({ type: String }) tracker_page_type = ''\n @property({ type: String }) tracker_content_id = ''\n @property({ type: String }) tracker_content_title = ''\n @property({ type: String }) tracker_content_categories = ''\n @property({ type: String }) tracker_content_type = ''\n @property({ type: String }) tracker_user_type = ''\n @property({ type: String }) tracker_subscription_status = ''\n @property({ type: String }) tracker_page_domain = ''\n @property({ type: String }) tracker_metered_wall_type = ''\n @property({ type: Number }) tracker_metered_wall_balance = 0\n @property({ type: String }) type: 'article' | 'homepage' = 'article'\n\n /**\n * State\n */\n\n @state() private subscriptionUrl: string =\n 'https://www.kompas.id/berlangganan'\n @state() private checkoutHost: string = 'https://checkoutv2.kompas.id'\n\n /**\n * Component\n */\n\n private regulerRegistrationSection() {\n return html`\n <div\n class=\"flex flex-col text-white text-sm md:text-base items-center justify-center\"\n >\n <div>\n <button\n @click=${() => this.redirectToRegister('Daftar')}\n class=\"text-blue-300 font-bold\"\n >\n Daftar\n </button>\n <span> untuk akses konten gratis.</span>\n </div>\n <div>\n <span>Sudah punya akun? </span>\n <button\n @click=${this.redirectToLogin}\n class=\"text-blue-300 font-bold\"\n >\n Masuk<span class=\"text-white font-normal\">.</span>\n </button>\n </div>\n </div>\n `\n }\n\n private defaultComponent() {\n return html`\n <div class=\"flex flex-col items-center space-y-2 md:space-y-4\">\n ${this.sendDataLayeronNonLogin()} ${this.sendDataLayerPaywallViewed()}\n <h5\n class=\"leading-5 md:leading-6 w-[296px] md:w-[400px] text-white text-center text-base mb-2 md:mb-0 ${!this\n .isLogin &&\n !this.isArticle &&\n 'mb-0'} md:text-xl max-w-xl\"\n >\n ${this.isArticle\n ? 'Langganan untuk lanjut menonton video'\n : 'Langganan sekarang untuk akses seluruh konten Kompas.id'}\n </h5>\n <button\n @click=${this.redirectToSelectedPackage}\n class=\"bg-green-500 rounded md:rounded-lg h-8 md:h-12 px-4 md:px-6 text-sm md:text-lg text-white font-bold leading-[18px]\"\n >\n Langganan ${formatRupiah(this.showPackage.price)}\n /${this.generateCopyDuration(this.showPackage.durationType)}\n </button>\n <button\n @click=${this.redirectToBerlangganan}\n class=\"text-sm md:text-lg leading-[22px] text-white font-bold underline ${!this\n .isLogin && this.isArticle\n ? 'pb-3'\n : 'pb-2'} md:pb-4\"\n >\n Paket Lainnya\n </button>\n ${!this.isLogin ? this.regulerRegistrationSection() : nothing}\n </div>\n `\n }\n\n /**\n * Data Layer\n */\n\n private sendDataLayer(event: string): void {\n const baseData = {\n event,\n paywall_location: this.paywall_location,\n paywall_subscription_package:\n this.paywall_subscription_package || this.showPackage.title,\n paywall_subscription_id:\n this.paywall_subscription_id || this.showPackage.id,\n paywall_subscription_price:\n this.paywall_subscription_price || this.showPackage.price,\n paywall_position: this.paywall_position || this.showPackage.position,\n user_type: this.tracker_user_type,\n subscription_status: this.tracker_subscription_status,\n page_domain: this.tracker_page_domain || 'Kompas.id',\n metered_wall_type: this.tracker_metered_wall_type || 'HP',\n metered_wall_balance: this.tracker_metered_wall_balance,\n }\n\n const data = this.isArticle\n ? {\n ...baseData,\n page_type: this.tracker_page_type,\n content_id: this.tracker_content_id,\n content_title: this.tracker_content_title,\n content_categories: this.tracker_content_categories,\n content_type: this.tracker_content_type,\n }\n : baseData\n\n window.dataLayer.push(data)\n }\n\n private sendDataLayerPaywallViewed(): void {\n this.sendDataLayer('paywall_viewed')\n }\n\n private sendDataLayerSubscribeButtonClicked(): void {\n this.sendDataLayer('subscribe_button_clicked')\n }\n\n private sendDataLayerOtherPackagesClicked(): void {\n this.sendDataLayer('other_packages_clicked')\n }\n\n private sendDataLayeronButtonLogin(triggerClick: string): void {\n window.dataLayer.push({\n event: 'registrationOfferClick',\n interface: deviceType(),\n buttonClicked: triggerClick,\n })\n }\n\n private sendDataLayeronNonLogin(): void {\n window.dataLayer.push({\n event: 'registrationOfferimppression',\n interface: deviceType(),\n })\n }\n\n /**\n * Getter\n */\n\n get isArticle() {\n return this.type === 'article'\n }\n\n // temporary mocking data package for component and dataLayer\n get showPackage() {\n return {\n duration: 1,\n durationType: 3,\n id: '9802035',\n link: 'kdp?productId=9802035&referrer=https%3A%2F%2Fwww.kompas.cloud%2Fberlangganan',\n price: 50000,\n position: 1,\n title: 'Kompas Digital Premium 1 Bulan',\n }\n }\n\n /**\n * Logic Function\n */\n\n private redirectToRegister(triggerClick: string): void {\n this.sendDataLayeronButtonLogin(triggerClick)\n const registerHost: string = 'https://account.kompas.id/register'\n const nextParams: string = encodeURIComponent(window.location.href)\n const directUrlRegister: string = `${registerHost}?next=${nextParams}?status=sukses_login&status_login=login&loc=video_paywall`\n window.open(directUrlRegister, '_blank')\n }\n\n private redirectToLogin(): void {\n const loginHost: string = 'https://account.kompas.id/login'\n const nextParams: string = encodeURIComponent(window.location.href)\n const directUrlLogin: string = `${loginHost}?next=${nextParams}&loc=video_paywall`\n window.open(directUrlLogin, '_blank')\n }\n\n private redirectToSelectedPackage(): void {\n const url = `${this.checkoutHost}/${this.showPackage.link}&source=${this.type}`\n this.sendDataLayerSubscribeButtonClicked()\n window.open(url, '_blank')\n }\n\n private redirectToBerlangganan(): void {\n this.sendDataLayerOtherPackagesClicked()\n window.open(this.subscriptionUrl, '_blank')\n }\n\n private generateCopyDuration(type: number): string {\n switch (type) {\n case 1:\n return 'hari'\n case 2:\n return 'minggu'\n case 3:\n return 'bulan'\n case 4:\n return 'tahun'\n default:\n return ''\n }\n }\n\n override async connectedCallback() {\n super.connectedCallback()\n await this.updateComplete\n addGoogleFonts(['pt-sans'])\n }\n\n /**\n * Render Statement\n */\n\n render() {\n return html`\n <div\n class=\"radius absolute z-20 bg-black bg-opacity-75 p-4 top-0 bottom-0 left-0 flex flex-col w-full h-full justify-center items-center\"\n >\n ${this.defaultComponent()}\n </div>\n `\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const formatRupiah: (value: number) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatRupiah.js","sourceRoot":"","sources":["../../../src/utils/formatRupiah.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,EAAE;IAC5C,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IACtC,OAAO,MAAM,YAAY;SACtB,QAAQ,EAAE;SACV,OAAO,CAAC,yBAAyB,EAAE,KAAK,CAAC,EAAE,CAAA;AAChD,CAAC,CAAA","sourcesContent":["export const formatRupiah = (value: number) => {\n const roundedValue = Math.round(value)\n return `Rp ${roundedValue\n .toString()\n .replace(/(\\d)(?=(\\d{3})+(?!\\d))/g, '$1.')}`\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const addGoogleFonts: (fonts: string[]) => void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const addGoogleFonts = (fonts) => {
|
|
2
|
+
const fontMap = {
|
|
3
|
+
lora: 'https://fonts.googleapis.com/css2?family=Lora:wght@700&display=swap',
|
|
4
|
+
'pt-sans': 'https://fonts.googleapis.com/css2?family=PT+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap',
|
|
5
|
+
};
|
|
6
|
+
fonts.forEach(font => {
|
|
7
|
+
const fontCssUrl = fontMap[font];
|
|
8
|
+
const existingElement = document.querySelector(`link[href="${fontCssUrl}"]`);
|
|
9
|
+
if (!existingElement && fontCssUrl) {
|
|
10
|
+
const newElement = document.createElement('link');
|
|
11
|
+
newElement.setAttribute('rel', 'stylesheet');
|
|
12
|
+
newElement.setAttribute('href', fontCssUrl);
|
|
13
|
+
document.head.appendChild(newElement);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=googleFont.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"googleFont.js","sourceRoot":"","sources":["../../../src/utils/googleFont.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAe,EAAE,EAAE;IAChD,MAAM,OAAO,GAA8B;QACzC,IAAI,EAAE,qEAAqE;QAC3E,SAAS,EACP,iGAAiG;KACpG,CAAA;IAED,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACnB,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;QAChC,MAAM,eAAe,GAAG,QAAQ,CAAC,aAAa,CAAC,cAAc,UAAU,IAAI,CAAC,CAAA;QAE5E,IAAI,CAAC,eAAe,IAAI,UAAU,EAAE;YAClC,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;YACjD,UAAU,CAAC,YAAY,CAAC,KAAK,EAAE,YAAY,CAAC,CAAA;YAC5C,UAAU,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;YAC3C,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAA;SACtC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["export const addGoogleFonts = (fonts: string[]) => {\n const fontMap: { [key: string]: string } = {\n lora: 'https://fonts.googleapis.com/css2?family=Lora:wght@700&display=swap',\n 'pt-sans':\n 'https://fonts.googleapis.com/css2?family=PT+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap',\n }\n\n fonts.forEach(font => {\n const fontCssUrl = fontMap[font]\n const existingElement = document.querySelector(`link[href=\"${fontCssUrl}\"]`)\n\n if (!existingElement && fontCssUrl) {\n const newElement = document.createElement('link')\n newElement.setAttribute('rel', 'stylesheet')\n newElement.setAttribute('href', fontCssUrl)\n document.head.appendChild(newElement)\n }\n })\n}\n"]}
|