@kompasid/lit-web-components 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/npm-publish.yml +2 -2
- package/assets/video.jpg +0 -0
- package/demo/index.html +28 -27
- package/dist/src/components/kompasid-paywall/KompasPaywall.js +5 -8
- package/dist/src/components/kompasid-paywall/KompasPaywall.js.map +1 -1
- package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.d.ts +34 -7
- package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js +363 -246
- package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js.map +1 -1
- package/dist/src/components/kompasid-paywall-video/KompasPaywallVideo.d.ts +41 -5
- package/dist/src/components/kompasid-paywall-video/KompasPaywallVideo.js +168 -106
- package/dist/src/components/kompasid-paywall-video/KompasPaywallVideo.js.map +1 -1
- package/dist/src/utils/formatRupiah.d.ts +1 -0
- package/dist/src/utils/formatRupiah.js +7 -0
- package/dist/src/utils/formatRupiah.js.map +1 -0
- package/dist/tailwind/tailwind.js +123 -95
- package/dist/tailwind/tailwind.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/kompasid-paywall/KompasPaywall.ts +5 -8
- package/src/components/kompasid-paywall-body/KompasPaywallBody.ts +342 -194
- package/src/components/kompasid-paywall-video/KompasPaywallVideo.ts +163 -89
- package/src/components/kompasid-paywall-video/readme.md +1 -0
- package/src/utils/formatRupiah.ts +6 -0
- package/tailwind/tailwind.css +120 -92
- package/tailwind/tailwind.ts +123 -95
- package/tailwind.config.js +3 -1
|
@@ -1,9 +1,10 @@
|
|
|
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';
|
|
7
8
|
let KompasPaywallVideo = class KompasPaywallVideo extends LitElement {
|
|
8
9
|
constructor() {
|
|
9
10
|
super(...arguments);
|
|
@@ -27,8 +28,8 @@ let KompasPaywallVideo = class KompasPaywallVideo extends LitElement {
|
|
|
27
28
|
* prop page_domain = Page Domain
|
|
28
29
|
* prop metered_wall_type = The type of Metered Wall
|
|
29
30
|
* prop metered_wall_balance = The balance of their metered wall
|
|
31
|
+
* prop type = The type of video paywall
|
|
30
32
|
*/
|
|
31
|
-
this.subscriptionUrl = 'https://www.kompas.id/berlangganan';
|
|
32
33
|
this.isLogin = false;
|
|
33
34
|
this.paywall_location = '';
|
|
34
35
|
this.paywall_subscription_package = '';
|
|
@@ -45,77 +46,37 @@ let KompasPaywallVideo = class KompasPaywallVideo extends LitElement {
|
|
|
45
46
|
this.tracker_page_domain = '';
|
|
46
47
|
this.tracker_metered_wall_type = '';
|
|
47
48
|
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
|
-
};
|
|
49
|
+
this.type = 'article';
|
|
50
|
+
/**
|
|
51
|
+
* State
|
|
52
|
+
*/
|
|
53
|
+
this.subscriptionUrl = 'https://www.kompas.id/berlangganan';
|
|
54
|
+
this.checkoutHost = 'https://checkoutv2.kompas.id';
|
|
101
55
|
}
|
|
102
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Component
|
|
58
|
+
*/
|
|
59
|
+
regulerRegistrationSection() {
|
|
103
60
|
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">
|
|
61
|
+
<div
|
|
62
|
+
class="flex flex-col text-white text-sm md:text-base font-sans items-center justify-center"
|
|
63
|
+
>
|
|
64
|
+
<div>
|
|
114
65
|
<button
|
|
115
|
-
@click=${() => this.
|
|
116
|
-
class="
|
|
66
|
+
@click=${() => this.redirectToRegister('Daftar')}
|
|
67
|
+
class="text-blue-300 font-bold"
|
|
117
68
|
>
|
|
118
|
-
|
|
69
|
+
Daftar
|
|
70
|
+
</button>
|
|
71
|
+
<span> untuk akses konten gratis.</span>
|
|
72
|
+
</div>
|
|
73
|
+
<div>
|
|
74
|
+
<span>Sudah punya akun? </span>
|
|
75
|
+
<button
|
|
76
|
+
@click=${this.redirectToLogin}
|
|
77
|
+
class="text-blue-300 font-bold"
|
|
78
|
+
>
|
|
79
|
+
Masuk<span class="text-white font-normal">.</span>
|
|
119
80
|
</button>
|
|
120
81
|
</div>
|
|
121
82
|
</div>
|
|
@@ -123,68 +84,160 @@ let KompasPaywallVideo = class KompasPaywallVideo extends LitElement {
|
|
|
123
84
|
}
|
|
124
85
|
defaultComponent() {
|
|
125
86
|
return html `
|
|
126
|
-
<div>
|
|
127
|
-
${this.sendDataLayeronNonLogin()} ${this.
|
|
87
|
+
<div class="flex font-sans flex-col items-center space-y-2 md:space-y-4">
|
|
88
|
+
${this.sendDataLayeronNonLogin()} ${this.sendDataLayerPaywallViewed()}
|
|
128
89
|
<h5
|
|
129
|
-
class="leading-6 text-white text-center text-base md:
|
|
90
|
+
class="leading-5 md:leading-6 w-[296px] md:w-[400px] text-white text-center text-base mb-2 md:mb-0 ${!this
|
|
91
|
+
.isLogin &&
|
|
92
|
+
!this.isArticle &&
|
|
93
|
+
'mb-0'} md:text-xl max-w-xl"
|
|
130
94
|
>
|
|
131
|
-
|
|
132
|
-
|
|
95
|
+
${this.isArticle
|
|
96
|
+
? 'Langganan untuk lanjut menonton video'
|
|
97
|
+
: 'Langganan sekarang untuk akses seluruh konten Kompas.id'}
|
|
133
98
|
</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"
|
|
99
|
+
<button
|
|
100
|
+
@click=${this.redirectToSelectedPackage}
|
|
101
|
+
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
102
|
>
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
103
|
+
Langganan ${formatRupiah(this.showPackage.price)}
|
|
104
|
+
/${this.generateCopyDuration(this.showPackage.durationType)}
|
|
105
|
+
</button>
|
|
106
|
+
<button
|
|
107
|
+
@click=${this.redirectToBerlangganan}
|
|
108
|
+
class="text-sm md:text-lg leading-[22px] text-white font-bold underline ${!this
|
|
109
|
+
.isLogin && this.isArticle
|
|
110
|
+
? 'pb-3'
|
|
111
|
+
: 'pb-2'} md:pb-4"
|
|
112
|
+
>
|
|
113
|
+
Paket Lainnya
|
|
114
|
+
</button>
|
|
115
|
+
${!this.isLogin ? this.regulerRegistrationSection() : nothing}
|
|
160
116
|
</div>
|
|
161
117
|
`;
|
|
162
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Data Layer
|
|
121
|
+
*/
|
|
122
|
+
sendDataLayer(event) {
|
|
123
|
+
const baseData = {
|
|
124
|
+
event,
|
|
125
|
+
paywall_location: this.paywall_location,
|
|
126
|
+
paywall_subscription_package: this.paywall_subscription_package || this.showPackage.title,
|
|
127
|
+
paywall_subscription_id: this.paywall_subscription_id || this.showPackage.id,
|
|
128
|
+
paywall_subscription_price: this.paywall_subscription_price || this.showPackage.price,
|
|
129
|
+
paywall_position: this.paywall_position || this.showPackage.position,
|
|
130
|
+
user_type: this.tracker_user_type,
|
|
131
|
+
subscription_status: this.tracker_subscription_status,
|
|
132
|
+
page_domain: this.tracker_page_domain || 'Kompas.id',
|
|
133
|
+
metered_wall_type: this.tracker_metered_wall_type || 'HP',
|
|
134
|
+
metered_wall_balance: this.tracker_metered_wall_balance,
|
|
135
|
+
};
|
|
136
|
+
const data = this.isArticle
|
|
137
|
+
? {
|
|
138
|
+
...baseData,
|
|
139
|
+
page_type: this.tracker_page_type,
|
|
140
|
+
content_id: this.tracker_content_id,
|
|
141
|
+
content_title: this.tracker_content_title,
|
|
142
|
+
content_categories: this.tracker_content_categories,
|
|
143
|
+
content_type: this.tracker_content_type,
|
|
144
|
+
}
|
|
145
|
+
: baseData;
|
|
146
|
+
window.dataLayer.push(data);
|
|
147
|
+
}
|
|
148
|
+
sendDataLayerPaywallViewed() {
|
|
149
|
+
this.sendDataLayer('paywall_viewed');
|
|
150
|
+
}
|
|
151
|
+
sendDataLayerSubscribeButtonClicked() {
|
|
152
|
+
this.sendDataLayer('subscribe_button_clicked');
|
|
153
|
+
}
|
|
154
|
+
sendDataLayerOtherPackagesClicked() {
|
|
155
|
+
this.sendDataLayer('other_packages_clicked');
|
|
156
|
+
}
|
|
157
|
+
sendDataLayeronButtonLogin(triggerClick) {
|
|
158
|
+
window.dataLayer.push({
|
|
159
|
+
event: 'registrationOfferClick',
|
|
160
|
+
interface: deviceType(),
|
|
161
|
+
buttonClicked: triggerClick,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
sendDataLayeronNonLogin() {
|
|
165
|
+
window.dataLayer.push({
|
|
166
|
+
event: 'registrationOfferimppression',
|
|
167
|
+
interface: deviceType(),
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Getter
|
|
172
|
+
*/
|
|
173
|
+
get isArticle() {
|
|
174
|
+
return this.type === 'article';
|
|
175
|
+
}
|
|
176
|
+
// temporary mocking data package for component and dataLayer
|
|
177
|
+
get showPackage() {
|
|
178
|
+
return {
|
|
179
|
+
duration: 1,
|
|
180
|
+
durationType: 3,
|
|
181
|
+
id: '9802035',
|
|
182
|
+
link: 'kdp?productId=9802035&referrer=https%3A%2F%2Fwww.kompas.cloud%2Fberlangganan',
|
|
183
|
+
price: 50000,
|
|
184
|
+
position: 1,
|
|
185
|
+
title: 'Kompas Digital Premium 1 Bulan',
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Logic Function
|
|
190
|
+
*/
|
|
163
191
|
redirectToRegister(triggerClick) {
|
|
164
192
|
this.sendDataLayeronButtonLogin(triggerClick);
|
|
165
193
|
const registerHost = 'https://account.kompas.id/register';
|
|
166
194
|
const nextParams = encodeURIComponent(window.location.href);
|
|
167
|
-
const directUrlRegister = `${registerHost}?next=${nextParams}?status=sukses_login&status_login=login`;
|
|
195
|
+
const directUrlRegister = `${registerHost}?next=${nextParams}?status=sukses_login&status_login=login&loc=video_paywall`;
|
|
168
196
|
window.open(directUrlRegister, '_blank');
|
|
169
197
|
}
|
|
198
|
+
redirectToLogin() {
|
|
199
|
+
const loginHost = 'https://account.kompas.id/login';
|
|
200
|
+
const nextParams = encodeURIComponent(window.location.href);
|
|
201
|
+
const directUrlLogin = `${loginHost}?next=${nextParams}&loc=video_paywall`;
|
|
202
|
+
window.open(directUrlLogin, '_blank');
|
|
203
|
+
}
|
|
204
|
+
redirectToSelectedPackage() {
|
|
205
|
+
const url = `${this.checkoutHost}/${this.showPackage.link}&source=${this.type}`;
|
|
206
|
+
this.sendDataLayerSubscribeButtonClicked();
|
|
207
|
+
window.open(url, '_blank');
|
|
208
|
+
}
|
|
170
209
|
redirectToBerlangganan() {
|
|
171
|
-
this.
|
|
210
|
+
this.sendDataLayerOtherPackagesClicked();
|
|
172
211
|
window.open(this.subscriptionUrl, '_blank');
|
|
173
212
|
}
|
|
213
|
+
generateCopyDuration(type) {
|
|
214
|
+
switch (type) {
|
|
215
|
+
case 1:
|
|
216
|
+
return 'hari';
|
|
217
|
+
case 2:
|
|
218
|
+
return 'minggu';
|
|
219
|
+
case 3:
|
|
220
|
+
return 'bulan';
|
|
221
|
+
case 4:
|
|
222
|
+
return 'tahun';
|
|
223
|
+
default:
|
|
224
|
+
return '';
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Render Statement
|
|
229
|
+
*/
|
|
174
230
|
render() {
|
|
175
231
|
return html `
|
|
176
232
|
<div
|
|
177
|
-
class="radius absolute z-20 bg-black bg-opacity-
|
|
233
|
+
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
234
|
>
|
|
179
|
-
${this.
|
|
235
|
+
${this.defaultComponent()}
|
|
180
236
|
</div>
|
|
181
237
|
`;
|
|
182
238
|
}
|
|
183
239
|
};
|
|
184
240
|
KompasPaywallVideo.styles = [css ``, TWStyles];
|
|
185
|
-
__decorate([
|
|
186
|
-
state()
|
|
187
|
-
], KompasPaywallVideo.prototype, "subscriptionUrl", void 0);
|
|
188
241
|
__decorate([
|
|
189
242
|
property({ type: Boolean })
|
|
190
243
|
], KompasPaywallVideo.prototype, "isLogin", void 0);
|
|
@@ -233,6 +286,15 @@ __decorate([
|
|
|
233
286
|
__decorate([
|
|
234
287
|
property({ type: Number })
|
|
235
288
|
], KompasPaywallVideo.prototype, "tracker_metered_wall_balance", void 0);
|
|
289
|
+
__decorate([
|
|
290
|
+
property({ type: String })
|
|
291
|
+
], KompasPaywallVideo.prototype, "type", void 0);
|
|
292
|
+
__decorate([
|
|
293
|
+
state()
|
|
294
|
+
], KompasPaywallVideo.prototype, "subscriptionUrl", void 0);
|
|
295
|
+
__decorate([
|
|
296
|
+
state()
|
|
297
|
+
], KompasPaywallVideo.prototype, "checkoutHost", void 0);
|
|
236
298
|
KompasPaywallVideo = __decorate([
|
|
237
299
|
customElement('kompasid-paywall-video')
|
|
238
300
|
], 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;AAC3C,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;AAG/C,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,UAAU;IAA3C;;QAGL;;WAEG;QACH;;;;;;;;;;;;;;;;;WAiBG;QAEc,oBAAe,GAC9B,oCAAoC,CAAA;QAET,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,GA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sB;AACrB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wEAAkC;AACjC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mEAA6B;AAC5B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sEAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAAqB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6DAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8DAAwB;AACvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iEAA2B;AAC1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sEAAgC;AAC/B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gEAA0B;AACzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,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,KA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AC,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;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAyC;AAM3D;IAAR,KAAK,EAAE;2DAC8B;AAC7B;IAAR,KAAK,EAAE;wDAA8D;AAlD3D,kBAAkB;IAD9B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,kBAAkB,CAoQ9B;SApQY,kBAAkB","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'\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 * 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 font-sans 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 font-sans 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 /**\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"]}
|