@kompasid/lit-web-components 0.9.28 → 0.9.29
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/demo/index.html +24 -1
- package/dist/src/components/kompasid-metered-paywall-personalize/KompasMeteredPaywallPersonalize.d.ts +67 -0
- package/dist/src/components/kompasid-metered-paywall-personalize/KompasMeteredPaywallPersonalize.js +507 -0
- package/dist/src/components/kompasid-metered-paywall-personalize/KompasMeteredPaywallPersonalize.js.map +1 -0
- package/dist/src/components/kompasid-metered-paywall-personalize/types.d.ts +23 -0
- package/dist/src/components/kompasid-metered-paywall-personalize/types.js +2 -0
- package/dist/src/components/kompasid-metered-paywall-personalize/types.js.map +1 -0
- package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js +2 -2
- package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/tailwind/tailwind.js +142 -16
- package/dist/tailwind/tailwind.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/kompasid-metered-paywall-personalize/KompasMeteredPaywallPersonalize.ts +500 -0
- package/src/components/kompasid-metered-paywall-personalize/readme.md +155 -0
- package/src/components/kompasid-metered-paywall-personalize/types.ts +26 -0
- package/src/components/kompasid-paywall-body/KompasPaywallBody.ts +2 -2
- package/src/index.ts +1 -0
- package/tailwind/tailwind.css +151 -6
- package/tailwind/tailwind.ts +142 -16
package/demo/index.html
CHANGED
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
import '../dist/src/components/kompasid-paywall/KompasPaywall.js'
|
|
53
53
|
import '../dist/src/components/kompasid-paywall-video/KompasPaywallVideo.js'
|
|
54
54
|
import '../dist/src/components/kompasid-metered-paywall/KompasMeteredPaywall.js'
|
|
55
|
+
import '../dist/src/components/kompasid-metered-paywall-personalize/KompasMeteredPaywallPersonalize.js'
|
|
55
56
|
import '../dist/src/components/kompasid-freewall/KompasFreewall.js'
|
|
56
57
|
import '../dist/src/components/kompasid-metered-wall-register/KompasMeteredWallRegister.js'
|
|
57
58
|
import '../dist/src/components/kompasid-header-account/KompasHeaderAccount.js'
|
|
@@ -260,7 +261,7 @@
|
|
|
260
261
|
.tracker_subscription_status=${trackerSubscriptionStatus}
|
|
261
262
|
>
|
|
262
263
|
</kompasid-paywall>
|
|
263
|
-
<div class="metered font-sans">
|
|
264
|
+
<div class="metered font-sans" style="position: sticky; bottom: 0; width: 100%; z-index: 999;">
|
|
264
265
|
<kompasid-metered-paywall
|
|
265
266
|
.paywall_location=${paywallLocation}
|
|
266
267
|
.paywall_subscription_id=${paywallSubscriptionId}
|
|
@@ -280,6 +281,28 @@
|
|
|
280
281
|
.metered_wall_balance=${meteredWallBalance}
|
|
281
282
|
>
|
|
282
283
|
</kompasid-metered-paywall>
|
|
284
|
+
<kompasid-metered-paywall-personalize
|
|
285
|
+
segment="Passive Faders"
|
|
286
|
+
offering="Q3"
|
|
287
|
+
user_name="Dummy User"
|
|
288
|
+
.paywall_location=${paywallLocation}
|
|
289
|
+
.paywall_subscription_id=${paywallSubscriptionId}
|
|
290
|
+
.paywall_subscription_price=${paywallSubscriptionPrice}
|
|
291
|
+
.paywall_position=${paywallPosition}
|
|
292
|
+
.tracker_page_type=${trackerPageType}
|
|
293
|
+
.tracker_content_id=${trackerContentId}
|
|
294
|
+
.tracker_content_type=${trackerContentType}
|
|
295
|
+
.tracker_content_title=${trackerContentTitle}
|
|
296
|
+
.tracker_content_categories=${trackerContentCategories}
|
|
297
|
+
.tracker_user_type=${trackerUserType}
|
|
298
|
+
.subscriptionStatus=${subscriptionStatus}
|
|
299
|
+
.tracker_page_domain=${trackerPageDomain}
|
|
300
|
+
.metered_wall_type=${meteredWallType}
|
|
301
|
+
.subscriptionStatus=${subscriptionStatus}
|
|
302
|
+
.tracker_epaper_edition=${trackerEpaperEdition}
|
|
303
|
+
.metered_wall_balance=${meteredWallBalance}
|
|
304
|
+
>
|
|
305
|
+
</kompasid-metered-paywall-personalize>
|
|
283
306
|
</div>
|
|
284
307
|
|
|
285
308
|
<!-- <div style="margin: 20px 0">
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { LitElement, nothing } from 'lit';
|
|
2
|
+
export declare class KompasMeteredPaywallPersonalize extends LitElement {
|
|
3
|
+
static styles: import("lit").CSSResult[];
|
|
4
|
+
private isLoading;
|
|
5
|
+
private maxQuota;
|
|
6
|
+
private packageData;
|
|
7
|
+
/**
|
|
8
|
+
* Props
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* prop countdownArticle untuk menghandle sudah berapa artikel gratis yang user baca.
|
|
12
|
+
* prop segment untuk menentukan paywall template dari segmen apa yang di pakai, bila tidak ada yang cocok jangan render paywall
|
|
13
|
+
* prop offering untuk handle offering yang akan di berikan, bila tidak di isi maka akan default menjadi Q1
|
|
14
|
+
* prop user_name untuk menerima nama user yang akan di tampilkan paywall specific
|
|
15
|
+
* prop paywall_location = The location where user encounter the paywall
|
|
16
|
+
* prop paywall_subscription_package = The name of the subscription package viewed by user
|
|
17
|
+
* prop paywall_subscription_id = The ID of the subscription package viewed by user
|
|
18
|
+
* prop paywall_subscription_price = The price of the subscriprtion package viewed by user
|
|
19
|
+
* prop paywall_position = The position of ther subscription package viewed by user
|
|
20
|
+
* prop tracker_page_type = Type of the page
|
|
21
|
+
* prop tracker_content_id = ID of article (slug)
|
|
22
|
+
* prop tracker_content_type = Whether it's free article or paid article
|
|
23
|
+
* prop tracker_content_title = The title of article
|
|
24
|
+
* prop tracker_content_categories = The category of the content
|
|
25
|
+
* prop tracker_user_type = Type of user based on their subscription
|
|
26
|
+
* prop tracker_subscription_status = Status of their subscription
|
|
27
|
+
* prop tracker_page_domain = Page Domain
|
|
28
|
+
* prop tracker_metered_wall_type = The type of Metered Wall
|
|
29
|
+
* prop tracker_epaper_edition = The edition of epaper viewed by user
|
|
30
|
+
* prop tracker_metered_wall_balance = The balance of their metered wall
|
|
31
|
+
*/
|
|
32
|
+
countdownArticle: number;
|
|
33
|
+
segment: string;
|
|
34
|
+
offering: string;
|
|
35
|
+
user_name: string;
|
|
36
|
+
paywall_location: string;
|
|
37
|
+
paywall_subscription_package: string;
|
|
38
|
+
paywall_subscription_id: string;
|
|
39
|
+
paywall_subscription_price: number;
|
|
40
|
+
paywall_position: number;
|
|
41
|
+
tracker_page_type: string;
|
|
42
|
+
tracker_content_id: string;
|
|
43
|
+
tracker_content_title: string;
|
|
44
|
+
tracker_content_categories: string;
|
|
45
|
+
tracker_content_type: string;
|
|
46
|
+
tracker_user_type: string;
|
|
47
|
+
tracker_subscription_status: string;
|
|
48
|
+
tracker_page_domain: string;
|
|
49
|
+
tracker_metered_wall_type: string;
|
|
50
|
+
tracker_metered_wall_balance: number;
|
|
51
|
+
connectedCallback(): Promise<void>;
|
|
52
|
+
getMeteredPaywallData(): Promise<void>;
|
|
53
|
+
private redirectToBerlangganan;
|
|
54
|
+
private dataLayeronLanggananButton;
|
|
55
|
+
private dataLayeronMeteredPaywall;
|
|
56
|
+
private stateDefaultPaywall;
|
|
57
|
+
private computedstateDefaultPaywall;
|
|
58
|
+
/**
|
|
59
|
+
* Ganti placeholder _key_ di template dengan nilai dari data offering
|
|
60
|
+
* Hanya replace jika placeholder cocok dan datanya valid
|
|
61
|
+
*/
|
|
62
|
+
private replacePlaceholdersFromOffering;
|
|
63
|
+
private engageReturners;
|
|
64
|
+
private passiveFaders;
|
|
65
|
+
private pickTemplate;
|
|
66
|
+
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
67
|
+
}
|
package/dist/src/components/kompasid-metered-paywall-personalize/KompasMeteredPaywallPersonalize.js
ADDED
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { html, css, LitElement, nothing } from 'lit';
|
|
3
|
+
import { customElement, state, property } from 'lit/decorators.js';
|
|
4
|
+
import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
5
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
6
|
+
import { TWStyles } from '../../../tailwind/tailwind.js';
|
|
7
|
+
import { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js';
|
|
8
|
+
import { formatRupiah } from '../../utils/formatRupiah.js';
|
|
9
|
+
let KompasMeteredPaywallPersonalize = class KompasMeteredPaywallPersonalize extends LitElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.isLoading = true;
|
|
13
|
+
this.maxQuota = 3;
|
|
14
|
+
/**
|
|
15
|
+
* Props
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* prop countdownArticle untuk menghandle sudah berapa artikel gratis yang user baca.
|
|
19
|
+
* prop segment untuk menentukan paywall template dari segmen apa yang di pakai, bila tidak ada yang cocok jangan render paywall
|
|
20
|
+
* prop offering untuk handle offering yang akan di berikan, bila tidak di isi maka akan default menjadi Q1
|
|
21
|
+
* prop user_name untuk menerima nama user yang akan di tampilkan paywall specific
|
|
22
|
+
* prop paywall_location = The location where user encounter the paywall
|
|
23
|
+
* prop paywall_subscription_package = The name of the subscription package viewed by user
|
|
24
|
+
* prop paywall_subscription_id = The ID of the subscription package viewed by user
|
|
25
|
+
* prop paywall_subscription_price = The price of the subscriprtion package viewed by user
|
|
26
|
+
* prop paywall_position = The position of ther subscription package viewed by user
|
|
27
|
+
* prop tracker_page_type = Type of the page
|
|
28
|
+
* prop tracker_content_id = ID of article (slug)
|
|
29
|
+
* prop tracker_content_type = Whether it's free article or paid article
|
|
30
|
+
* prop tracker_content_title = The title of article
|
|
31
|
+
* prop tracker_content_categories = The category of the content
|
|
32
|
+
* prop tracker_user_type = Type of user based on their subscription
|
|
33
|
+
* prop tracker_subscription_status = Status of their subscription
|
|
34
|
+
* prop tracker_page_domain = Page Domain
|
|
35
|
+
* prop tracker_metered_wall_type = The type of Metered Wall
|
|
36
|
+
* prop tracker_epaper_edition = The edition of epaper viewed by user
|
|
37
|
+
* prop tracker_metered_wall_balance = The balance of their metered wall
|
|
38
|
+
*/
|
|
39
|
+
this.countdownArticle = 0;
|
|
40
|
+
this.segment = '';
|
|
41
|
+
this.offering = '';
|
|
42
|
+
this.user_name = '';
|
|
43
|
+
this.paywall_location = '';
|
|
44
|
+
this.paywall_subscription_package = '';
|
|
45
|
+
this.paywall_subscription_id = '';
|
|
46
|
+
this.paywall_subscription_price = 0;
|
|
47
|
+
this.paywall_position = 0;
|
|
48
|
+
this.tracker_page_type = '';
|
|
49
|
+
this.tracker_content_id = '';
|
|
50
|
+
this.tracker_content_title = '';
|
|
51
|
+
this.tracker_content_categories = '';
|
|
52
|
+
this.tracker_content_type = '';
|
|
53
|
+
this.tracker_user_type = '';
|
|
54
|
+
this.tracker_subscription_status = '';
|
|
55
|
+
this.tracker_page_domain = '';
|
|
56
|
+
this.tracker_metered_wall_type = '';
|
|
57
|
+
this.tracker_metered_wall_balance = 0;
|
|
58
|
+
this.stateDefaultPaywall = false;
|
|
59
|
+
}
|
|
60
|
+
async connectedCallback() {
|
|
61
|
+
super.connectedCallback();
|
|
62
|
+
await this.getMeteredPaywallData();
|
|
63
|
+
this.dataLayeronMeteredPaywall();
|
|
64
|
+
}
|
|
65
|
+
async getMeteredPaywallData() {
|
|
66
|
+
try {
|
|
67
|
+
const getSegment = this.segment.toLocaleLowerCase().replace(' ', '_');
|
|
68
|
+
const response = await fetch(`https://cdn-www.kompas.id/web-component/metered-paywall-personalize/${getSegment}.json`);
|
|
69
|
+
const json = await response.json();
|
|
70
|
+
this.packageData = json;
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
throw Error('Failed to get metered paywall data');
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
this.isLoading = false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
redirectToBerlangganan() {
|
|
80
|
+
var _a, _b;
|
|
81
|
+
this.dataLayeronLanggananButton();
|
|
82
|
+
// Pastikan data tersedia
|
|
83
|
+
const offeringKey = this.offering || 'Q1';
|
|
84
|
+
const offeringData = (_b = (_a = this.packageData) === null || _a === void 0 ? void 0 : _a.offering) === null || _b === void 0 ? void 0 : _b[offeringKey];
|
|
85
|
+
const checkoutUrl = (offeringData === null || offeringData === void 0 ? void 0 : offeringData.checkout_url) || '';
|
|
86
|
+
// Encode referrer dengan aman
|
|
87
|
+
const { origin, pathname, search } = window.location;
|
|
88
|
+
const referrer = encodeURIComponent(`${origin}${pathname}${search}`);
|
|
89
|
+
// Bangun URL dengan parameter tambahan aman
|
|
90
|
+
const url = new URL(checkoutUrl);
|
|
91
|
+
url.searchParams.set('referrer', referrer);
|
|
92
|
+
// Redirect ke URL akhir
|
|
93
|
+
window.location.href = url.toString();
|
|
94
|
+
}
|
|
95
|
+
dataLayeronLanggananButton() {
|
|
96
|
+
var _a;
|
|
97
|
+
window.dataLayer.push({
|
|
98
|
+
event: 'subscribe_button_clicked',
|
|
99
|
+
paywall_location: this.paywall_location || '',
|
|
100
|
+
paywall_subscription_package: this.paywall_subscription_package || '',
|
|
101
|
+
paywall_subscription_id: this.paywall_subscription_id || '',
|
|
102
|
+
paywall_subscription_price: this.paywall_subscription_price || 0,
|
|
103
|
+
paywall_position: this.paywall_position || 0,
|
|
104
|
+
page_type: this.tracker_page_type,
|
|
105
|
+
content_id: this.tracker_content_id,
|
|
106
|
+
content_title: this.tracker_content_title,
|
|
107
|
+
content_categories: this.tracker_content_categories,
|
|
108
|
+
content_type: this.tracker_content_type,
|
|
109
|
+
user_type: this.tracker_user_type || 'R',
|
|
110
|
+
subscription_status: this.tracker_subscription_status,
|
|
111
|
+
page_domain: this.tracker_page_domain || 'Kompas.id',
|
|
112
|
+
metered_wall_type: this.tracker_metered_wall_type || 'MP',
|
|
113
|
+
metered_wall_balance: this.maxQuota - this.countdownArticle + 1,
|
|
114
|
+
paywall_segment: this.segment || '',
|
|
115
|
+
checkout_url: (_a = this.packageData) === null || _a === void 0 ? void 0 : _a.offering[this.offering ? this.offering : 'Q1'].checkout_url,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
dataLayeronMeteredPaywall() {
|
|
119
|
+
var _a;
|
|
120
|
+
window.dataLayer.push({
|
|
121
|
+
event: 'paywall_viewed',
|
|
122
|
+
paywall_location: this.paywall_location || '',
|
|
123
|
+
paywall_subscription_package: this.paywall_subscription_package || '',
|
|
124
|
+
paywall_subscription_id: this.paywall_subscription_id || '',
|
|
125
|
+
paywall_subscription_price: this.paywall_subscription_price || 0,
|
|
126
|
+
paywall_position: this.paywall_position || 0,
|
|
127
|
+
page_type: this.tracker_page_type,
|
|
128
|
+
content_id: this.tracker_content_id,
|
|
129
|
+
content_title: this.tracker_content_title,
|
|
130
|
+
content_categories: this.tracker_content_categories,
|
|
131
|
+
content_type: this.tracker_content_type,
|
|
132
|
+
user_type: this.tracker_user_type || 'R',
|
|
133
|
+
subscription_status: this.tracker_subscription_status,
|
|
134
|
+
page_domain: this.tracker_page_domain || 'Kompas.id',
|
|
135
|
+
metered_wall_type: this.tracker_metered_wall_type || 'MP',
|
|
136
|
+
metered_wall_balance: this.maxQuota - this.countdownArticle + 1,
|
|
137
|
+
paywall_segment: this.segment || '',
|
|
138
|
+
checkout_url: (_a = this.packageData) === null || _a === void 0 ? void 0 : _a.offering[this.offering ? this.offering : 'Q1'].checkout_url,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
computedstateDefaultPaywall() {
|
|
142
|
+
this.stateDefaultPaywall = !this.stateDefaultPaywall;
|
|
143
|
+
this.requestUpdate();
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Ganti placeholder _key_ di template dengan nilai dari data offering
|
|
147
|
+
* Hanya replace jika placeholder cocok dan datanya valid
|
|
148
|
+
*/
|
|
149
|
+
replacePlaceholdersFromOffering(template, offeringData) {
|
|
150
|
+
if (!offeringData)
|
|
151
|
+
return template;
|
|
152
|
+
// regex cari placeholder seperti _harga_coret_, _offering_price_, dst.
|
|
153
|
+
return template.replace(/_([a-zA-Z0-9_]+)_/g, (match, key) => {
|
|
154
|
+
// cek apakah key ada di dalam data
|
|
155
|
+
if (key in offeringData) {
|
|
156
|
+
const value = offeringData[key];
|
|
157
|
+
// jika value number, auto format ke rupiah
|
|
158
|
+
if (typeof value === 'number') {
|
|
159
|
+
return formatRupiah(value);
|
|
160
|
+
}
|
|
161
|
+
// jika string, langsung return
|
|
162
|
+
return String(value);
|
|
163
|
+
}
|
|
164
|
+
// kalau placeholder tidak dikenal, biarkan apa adanya
|
|
165
|
+
return match;
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
engageReturners() {
|
|
169
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
170
|
+
const textTemplateFormater = this.replacePlaceholdersFromOffering(((_a = this.packageData) === null || _a === void 0 ? void 0 : _a.paywall.messageTitleCollapse) || '', ((_b = this.packageData) === null || _b === void 0 ? void 0 : _b.offering[this.offering ? this.offering : 'Q1']) ||
|
|
171
|
+
{});
|
|
172
|
+
return !this.stateDefaultPaywall
|
|
173
|
+
? html `
|
|
174
|
+
<div
|
|
175
|
+
class="fixed w-full inset-0 px-4 lg:px-0 h-full flex justify-center items-center bg-black bg-opacity-75 z-[999]"
|
|
176
|
+
>
|
|
177
|
+
<div
|
|
178
|
+
class="bg-white max-w-[460px] w-full justify-center items-center flex flex-col p-6 lg:pb-6 lg:px-6 lg:pt-9 relative rounded"
|
|
179
|
+
>
|
|
180
|
+
<button
|
|
181
|
+
class="font-bold cursor-pointer text-grey-400 flex rounded text-base absolute right-0 top-0 w-6 h-6 lg:w-8 lg:h-8 justify-center items-center mt-4 mr-4"
|
|
182
|
+
@click=${this.computedstateDefaultPaywall}
|
|
183
|
+
>
|
|
184
|
+
${unsafeSVG(getFontAwesomeIcon('fa', 'times', 20, 20))}
|
|
185
|
+
</button>
|
|
186
|
+
<image
|
|
187
|
+
src="${(_c = this.packageData) === null || _c === void 0 ? void 0 : _c.paywall.image}"
|
|
188
|
+
alt="content"
|
|
189
|
+
class="w-[248px] lg:w-[364px]"
|
|
190
|
+
/>
|
|
191
|
+
<div
|
|
192
|
+
class="font-lora font-bold text-grey-600 lg:text-2xl text-center"
|
|
193
|
+
>
|
|
194
|
+
<div>Halo ${this.user_name},</div>
|
|
195
|
+
<div>${(_d = this.packageData) === null || _d === void 0 ? void 0 : _d.paywall.messageTitleExpand}</div>
|
|
196
|
+
</div>
|
|
197
|
+
<div
|
|
198
|
+
class="pt-3 text-center font-sans text-grey-600 text-sm lg:text-base leading-none"
|
|
199
|
+
>
|
|
200
|
+
<div>${(_e = this.packageData) === null || _e === void 0 ? void 0 : _e.paywall.descriptionExpand}</div>
|
|
201
|
+
<div class="text-base lg:text-lg text-grey-400 py-3">
|
|
202
|
+
<s
|
|
203
|
+
>${formatRupiah(((_f = this.packageData) === null || _f === void 0 ? void 0 : _f.offering[this.offering ? this.offering : 'Q1'].harga_coret) || 0)}</s
|
|
204
|
+
>
|
|
205
|
+
<span class="text-lg lg:text-2xl text-orange-400 font-bold">
|
|
206
|
+
${formatRupiah(((_g = this.packageData) === null || _g === void 0 ? void 0 : _g.offering[this.offering ? this.offering : 'Q1'].offering_price) || 0)}
|
|
207
|
+
</span>
|
|
208
|
+
${((_h = this.packageData) === null || _h === void 0 ? void 0 : _h.offering[this.offering ? this.offering : 'Q1'].duration)
|
|
209
|
+
? html `
|
|
210
|
+
<span class="text-base lg:text-lg text-grey-600"
|
|
211
|
+
>${(_j = this.packageData) === null || _j === void 0 ? void 0 : _j.offering[this.offering ? this.offering : 'Q1'].duration}</span
|
|
212
|
+
>
|
|
213
|
+
`
|
|
214
|
+
: nothing}
|
|
215
|
+
</div>
|
|
216
|
+
<div>untuk tahun pertama.</div>
|
|
217
|
+
</div>
|
|
218
|
+
<div class="w-full pt-6">
|
|
219
|
+
<button
|
|
220
|
+
@click="${this.redirectToBerlangganan}"
|
|
221
|
+
class="bg-brand-1 whitespace-nowrap rounded md:rounded h-8 lg:h-10 px-4 md:px-5 text-sm lg:text-base text-white font-bold leading-none w-full"
|
|
222
|
+
>
|
|
223
|
+
${(_k = this.packageData) === null || _k === void 0 ? void 0 : _k.offering[this.offering ? this.offering : 'Q1'].checkout_text}
|
|
224
|
+
</button>
|
|
225
|
+
</div>
|
|
226
|
+
</div>
|
|
227
|
+
</div>
|
|
228
|
+
`
|
|
229
|
+
: html `
|
|
230
|
+
<div class="sticky bottom-0 w-full h-full">
|
|
231
|
+
<div
|
|
232
|
+
class="flex flex-col lg:flex-row w-full bg-blue-100 py-4 justify-center gap-4 px-4 lg:px-0 bottom-0"
|
|
233
|
+
>
|
|
234
|
+
<div
|
|
235
|
+
class="text-grey-600 text-base self-center text-left message-collapse-engage-returners font-bold"
|
|
236
|
+
>
|
|
237
|
+
${unsafeHTML(textTemplateFormater)}
|
|
238
|
+
</div>
|
|
239
|
+
<div>
|
|
240
|
+
<button
|
|
241
|
+
@click="${this.redirectToBerlangganan}"
|
|
242
|
+
class="bg-brand-1 whitespace-nowrap rounded md:rounded h-10 px-4 md:px-5 text-base text-white font-bold leading-[18px] w-full lg:w-auto"
|
|
243
|
+
>
|
|
244
|
+
${(_l = this.packageData) === null || _l === void 0 ? void 0 : _l.offering[this.offering ? this.offering : 'Q1'].checkout_text}
|
|
245
|
+
</button>
|
|
246
|
+
</div>
|
|
247
|
+
</div>
|
|
248
|
+
</div>
|
|
249
|
+
`;
|
|
250
|
+
}
|
|
251
|
+
passiveFaders() {
|
|
252
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
253
|
+
const messageTitleCollapse = this.replacePlaceholdersFromOffering(((_a = this.packageData) === null || _a === void 0 ? void 0 : _a.paywall.messageTitleCollapse) || '', ((_b = this.packageData) === null || _b === void 0 ? void 0 : _b.offering[this.offering ? this.offering : 'Q1']) ||
|
|
254
|
+
{});
|
|
255
|
+
const descriptionExpand = this.replacePlaceholdersFromOffering(((_c = this.packageData) === null || _c === void 0 ? void 0 : _c.paywall.descriptionExpand) || '', ((_d = this.packageData) === null || _d === void 0 ? void 0 : _d.offering[this.offering ? this.offering : 'Q1']) ||
|
|
256
|
+
{});
|
|
257
|
+
return html `
|
|
258
|
+
<div class="sticky bottom-0 w-full h-full">
|
|
259
|
+
<div
|
|
260
|
+
class="flex flex-col lg:flex-row w-full bg-blue-100 py-4 gap-4 px-4 bottom-0"
|
|
261
|
+
>
|
|
262
|
+
<div
|
|
263
|
+
class="flex flex-col lg:flex-row w-full justify-between max-w-[1200px] gap-4 mx-auto "
|
|
264
|
+
>
|
|
265
|
+
${!this.stateDefaultPaywall
|
|
266
|
+
? html `
|
|
267
|
+
<div class="h-9 w-9 hidden lg:flex"></div>
|
|
268
|
+
<div
|
|
269
|
+
class="flex flex-col lg:flex-row justify-center items-center lg:items-start lg:justify-between w-full max-w-5xl"
|
|
270
|
+
>
|
|
271
|
+
<div
|
|
272
|
+
class="text-grey-600 font-lora message-collapse-engage-returners order-2"
|
|
273
|
+
>
|
|
274
|
+
<div
|
|
275
|
+
class="text-xl lg:text-2xl font-bold mb-3 text-center lg:text-start"
|
|
276
|
+
>
|
|
277
|
+
${(_e = this.packageData) === null || _e === void 0 ? void 0 : _e.paywall.messageTitleExpand}
|
|
278
|
+
</div>
|
|
279
|
+
<div class="flex flex-col font-sans gap-3 mb-3">
|
|
280
|
+
${((_f = this.packageData) === null || _f === void 0 ? void 0 : _f.paywall.listBenefits)
|
|
281
|
+
? (_g = this.packageData) === null || _g === void 0 ? void 0 : _g.paywall.listBenefits.map(item => html `
|
|
282
|
+
<div
|
|
283
|
+
class="flex items-baseline align-baseline"
|
|
284
|
+
>
|
|
285
|
+
<div
|
|
286
|
+
class="bg-white text-green-500 h-3 w-3 mr-1 rounded-full flex justify-center items-center"
|
|
287
|
+
>
|
|
288
|
+
${unsafeSVG(getFontAwesomeIcon('fas', 'circle-check', 12, 12))}
|
|
289
|
+
</div>
|
|
290
|
+
<h6 class="text-base ml-1">${item}</h6>
|
|
291
|
+
</div>
|
|
292
|
+
`)
|
|
293
|
+
: nothing}
|
|
294
|
+
</div>
|
|
295
|
+
<div
|
|
296
|
+
class="text-grey-600 font-sans text-sm lg:text-base self-center text-left message-collapse-engage-returners mb-4"
|
|
297
|
+
>
|
|
298
|
+
${unsafeHTML(descriptionExpand)}
|
|
299
|
+
</div>
|
|
300
|
+
<div>
|
|
301
|
+
<button
|
|
302
|
+
@click="${this.redirectToBerlangganan}"
|
|
303
|
+
class="bg-brand-1 flex whitespace-nowrap items-center justify-center rounded md:rounded h-10 px-4 md:px-5 text-base text-white font-bold leading-[18px] w-full lg:w-auto"
|
|
304
|
+
>
|
|
305
|
+
${(_h = this.packageData) === null || _h === void 0 ? void 0 : _h.offering[this.offering ? this.offering : 'Q1'].checkout_text}
|
|
306
|
+
</button>
|
|
307
|
+
</div>
|
|
308
|
+
</div>
|
|
309
|
+
<div
|
|
310
|
+
class="flex self-center mt-10 mb-3 lg:mb-0 lg:mt-0 lg:ml-6 order-1 lg:order-2"
|
|
311
|
+
>
|
|
312
|
+
<image
|
|
313
|
+
src="${(_j = this.packageData) === null || _j === void 0 ? void 0 : _j.paywall.image}"
|
|
314
|
+
alt="content"
|
|
315
|
+
class="w-[112px] lg:w-[202px]"
|
|
316
|
+
/>
|
|
317
|
+
</div>
|
|
318
|
+
</div>
|
|
319
|
+
<div>
|
|
320
|
+
<button
|
|
321
|
+
@click="${this.computedstateDefaultPaywall}"
|
|
322
|
+
class="h-9 w-9 absolute lg:static flex items-center justify-center text-blue-500 rounded bg-blue-200 right-4 top-4"
|
|
323
|
+
>
|
|
324
|
+
<div>
|
|
325
|
+
${unsafeSVG(getFontAwesomeIcon('fas', 'chevron-down'))}
|
|
326
|
+
</div>
|
|
327
|
+
</button>
|
|
328
|
+
</div>
|
|
329
|
+
`
|
|
330
|
+
: html `
|
|
331
|
+
<div class="h-9 w-9 flex"></div>
|
|
332
|
+
<div class="flex justify-between">
|
|
333
|
+
<div
|
|
334
|
+
class="text-grey-600 text-base self-center text-left message-collapse-engage-returners font-bold"
|
|
335
|
+
>
|
|
336
|
+
${unsafeHTML(messageTitleCollapse)}
|
|
337
|
+
</div>
|
|
338
|
+
<div class="hidden lg:flex ml-6">
|
|
339
|
+
<button
|
|
340
|
+
@click="${this.redirectToBerlangganan}"
|
|
341
|
+
class="bg-brand-1 whitespace-nowrap rounded md:rounded h-10 px-4 md:px-5 text-base text-white font-bold leading-[18px] w-full lg:w-auto"
|
|
342
|
+
>
|
|
343
|
+
${(_k = this.packageData) === null || _k === void 0 ? void 0 : _k.offering[this.offering ? this.offering : 'Q1'].checkout_text}
|
|
344
|
+
</button>
|
|
345
|
+
</div>
|
|
346
|
+
<div class="flex lg:hidden ml-4">
|
|
347
|
+
<button
|
|
348
|
+
@click="${this.computedstateDefaultPaywall}"
|
|
349
|
+
class="h-9 w-9 flex items-center justify-center text-blue-500 rounded bg-blue-200"
|
|
350
|
+
>
|
|
351
|
+
<div>
|
|
352
|
+
${unsafeSVG(getFontAwesomeIcon('fas', 'chevron-up'))}
|
|
353
|
+
</div>
|
|
354
|
+
</button>
|
|
355
|
+
</div>
|
|
356
|
+
</div>
|
|
357
|
+
<div>
|
|
358
|
+
<button
|
|
359
|
+
@click="${this.computedstateDefaultPaywall}"
|
|
360
|
+
class="h-9 w-9 hidden lg:flex items-center justify-center text-blue-500 rounded bg-blue-200"
|
|
361
|
+
>
|
|
362
|
+
<div>
|
|
363
|
+
${unsafeSVG(getFontAwesomeIcon('fas', 'chevron-up'))}
|
|
364
|
+
</div>
|
|
365
|
+
</button>
|
|
366
|
+
<button
|
|
367
|
+
@click="${this.redirectToBerlangganan}"
|
|
368
|
+
class="bg-brand-1 lg:hidden flex whitespace-nowrap items-center justify-center rounded md:rounded h-10 px-4 md:px-5 text-base text-white font-bold leading-[18px] w-full"
|
|
369
|
+
>
|
|
370
|
+
${(_l = this.packageData) === null || _l === void 0 ? void 0 : _l.offering[this.offering ? this.offering : 'Q1'].checkout_text}
|
|
371
|
+
</button>
|
|
372
|
+
</div>
|
|
373
|
+
`}
|
|
374
|
+
</div>
|
|
375
|
+
</div>
|
|
376
|
+
</div>
|
|
377
|
+
`;
|
|
378
|
+
}
|
|
379
|
+
pickTemplate() {
|
|
380
|
+
switch (this.segment) {
|
|
381
|
+
case 'Engaged Returners':
|
|
382
|
+
return this.engageReturners();
|
|
383
|
+
case 'Passive Faders':
|
|
384
|
+
return this.passiveFaders();
|
|
385
|
+
default:
|
|
386
|
+
return nothing;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
render() {
|
|
390
|
+
return !this.isLoading ? this.pickTemplate() : nothing;
|
|
391
|
+
}
|
|
392
|
+
};
|
|
393
|
+
KompasMeteredPaywallPersonalize.styles = [
|
|
394
|
+
css `
|
|
395
|
+
.text-transition {
|
|
396
|
+
width: 100%;
|
|
397
|
+
height: 5rem;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
.body {
|
|
401
|
+
position: sticky;
|
|
402
|
+
top: 0;
|
|
403
|
+
height: 100%;
|
|
404
|
+
width: 100%;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.message-collapse-engage-returners span {
|
|
408
|
+
color: #ff7a00;
|
|
409
|
+
font-weight: 700;
|
|
410
|
+
text-wrap: nowrap;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
.message-collapse-engage-returners s {
|
|
414
|
+
color: #999999;
|
|
415
|
+
text-wrap: nowrap;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
.font-lora {
|
|
419
|
+
font-family: 'Lora', 'Georgia', 'serif';
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.icon {
|
|
423
|
+
height: 1rem;
|
|
424
|
+
color: #48bb78;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
.icon.lg {
|
|
428
|
+
height: 1.5rem;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.icon.lg svg {
|
|
432
|
+
height: 1.5rem;
|
|
433
|
+
}
|
|
434
|
+
`,
|
|
435
|
+
TWStyles,
|
|
436
|
+
];
|
|
437
|
+
__decorate([
|
|
438
|
+
state()
|
|
439
|
+
], KompasMeteredPaywallPersonalize.prototype, "isLoading", void 0);
|
|
440
|
+
__decorate([
|
|
441
|
+
state()
|
|
442
|
+
], KompasMeteredPaywallPersonalize.prototype, "maxQuota", void 0);
|
|
443
|
+
__decorate([
|
|
444
|
+
state()
|
|
445
|
+
], KompasMeteredPaywallPersonalize.prototype, "packageData", void 0);
|
|
446
|
+
__decorate([
|
|
447
|
+
property({ type: Number })
|
|
448
|
+
], KompasMeteredPaywallPersonalize.prototype, "countdownArticle", void 0);
|
|
449
|
+
__decorate([
|
|
450
|
+
property({ type: String })
|
|
451
|
+
], KompasMeteredPaywallPersonalize.prototype, "segment", void 0);
|
|
452
|
+
__decorate([
|
|
453
|
+
property({ type: String })
|
|
454
|
+
], KompasMeteredPaywallPersonalize.prototype, "offering", void 0);
|
|
455
|
+
__decorate([
|
|
456
|
+
property({ type: String })
|
|
457
|
+
], KompasMeteredPaywallPersonalize.prototype, "user_name", void 0);
|
|
458
|
+
__decorate([
|
|
459
|
+
property({ type: String })
|
|
460
|
+
], KompasMeteredPaywallPersonalize.prototype, "paywall_location", void 0);
|
|
461
|
+
__decorate([
|
|
462
|
+
property({ type: String })
|
|
463
|
+
], KompasMeteredPaywallPersonalize.prototype, "paywall_subscription_package", void 0);
|
|
464
|
+
__decorate([
|
|
465
|
+
property({ type: String })
|
|
466
|
+
], KompasMeteredPaywallPersonalize.prototype, "paywall_subscription_id", void 0);
|
|
467
|
+
__decorate([
|
|
468
|
+
property({ type: Number })
|
|
469
|
+
], KompasMeteredPaywallPersonalize.prototype, "paywall_subscription_price", void 0);
|
|
470
|
+
__decorate([
|
|
471
|
+
property({ type: Number })
|
|
472
|
+
], KompasMeteredPaywallPersonalize.prototype, "paywall_position", void 0);
|
|
473
|
+
__decorate([
|
|
474
|
+
property({ type: String })
|
|
475
|
+
], KompasMeteredPaywallPersonalize.prototype, "tracker_page_type", void 0);
|
|
476
|
+
__decorate([
|
|
477
|
+
property({ type: String })
|
|
478
|
+
], KompasMeteredPaywallPersonalize.prototype, "tracker_content_id", void 0);
|
|
479
|
+
__decorate([
|
|
480
|
+
property({ type: String })
|
|
481
|
+
], KompasMeteredPaywallPersonalize.prototype, "tracker_content_title", void 0);
|
|
482
|
+
__decorate([
|
|
483
|
+
property({ type: String })
|
|
484
|
+
], KompasMeteredPaywallPersonalize.prototype, "tracker_content_categories", void 0);
|
|
485
|
+
__decorate([
|
|
486
|
+
property({ type: String })
|
|
487
|
+
], KompasMeteredPaywallPersonalize.prototype, "tracker_content_type", void 0);
|
|
488
|
+
__decorate([
|
|
489
|
+
property({ type: String })
|
|
490
|
+
], KompasMeteredPaywallPersonalize.prototype, "tracker_user_type", void 0);
|
|
491
|
+
__decorate([
|
|
492
|
+
property({ type: String })
|
|
493
|
+
], KompasMeteredPaywallPersonalize.prototype, "tracker_subscription_status", void 0);
|
|
494
|
+
__decorate([
|
|
495
|
+
property({ type: String })
|
|
496
|
+
], KompasMeteredPaywallPersonalize.prototype, "tracker_page_domain", void 0);
|
|
497
|
+
__decorate([
|
|
498
|
+
property({ type: String })
|
|
499
|
+
], KompasMeteredPaywallPersonalize.prototype, "tracker_metered_wall_type", void 0);
|
|
500
|
+
__decorate([
|
|
501
|
+
property({ type: Number })
|
|
502
|
+
], KompasMeteredPaywallPersonalize.prototype, "tracker_metered_wall_balance", void 0);
|
|
503
|
+
KompasMeteredPaywallPersonalize = __decorate([
|
|
504
|
+
customElement('kompasid-metered-paywall-personalize')
|
|
505
|
+
], KompasMeteredPaywallPersonalize);
|
|
506
|
+
export { KompasMeteredPaywallPersonalize };
|
|
507
|
+
//# sourceMappingURL=KompasMeteredPaywallPersonalize.js.map
|