@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.
@@ -1,11 +1,12 @@
1
1
  /* eslint-disable no-return-assign */
2
2
  import { __decorate } from "tslib";
3
- import { html, css, LitElement } from 'lit';
3
+ import { html, css, LitElement, nothing } from 'lit';
4
4
  import { property, state, customElement } from 'lit/decorators.js';
5
5
  import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
6
6
  import { TWStyles } from '../../../tailwind/tailwind.js';
7
7
  import { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js';
8
8
  import { deviceType } from '../../utils/deviceType.js';
9
+ import { formatRupiah } from '../../utils/formatRupiah.js';
9
10
  let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
10
11
  constructor() {
11
12
  super(...arguments);
@@ -65,6 +66,9 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
65
66
  this.tracker_metered_wall_balance = 0;
66
67
  this.tracker_epaper_edition = '';
67
68
  this.theme = '';
69
+ /**
70
+ * State
71
+ */
68
72
  this.isExtensionsOpened = false;
69
73
  this.kompasAkunHost = 'https://akun.kompas.id';
70
74
  this.kompasApigenHost = 'https://apigen.kompas.id';
@@ -75,133 +79,26 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
75
79
  this.swgPublisherId = 'kompas.id';
76
80
  this.swgProductId = 'kompas.id:kompas_digital_premium';
77
81
  this.errorFlag = 0;
78
- this.subscribeWithGoogleButton = () => {
79
- // @ts-ignore
80
- // eslint-disable-next-line no-restricted-globals
81
- ;
82
- (self.SWG = self.SWG || []).push((subscriptions) => {
83
- // set entitlement
84
- subscriptions.setOnEntitlementsResponse(() => {
85
- // subscriptions attach button
86
- subscriptions.attachButton(this.buttonElement, { theme: 'light', lang: 'en' }, () => {
87
- subscriptions.showOffers({ isClosable: true });
88
- subscriptions.setOnLoginRequest(() => {
89
- window.location.href = this.redirectToLogin;
90
- });
91
- subscriptions.setOnPaymentResponse(async (paymentResponse) => {
92
- const response = await paymentResponse;
93
- const raw = JSON.parse(response.purchaseData.raw);
94
- const { productId, purchaseToken, packageName } = raw;
95
- const { email } = response.userData.data;
96
- const payload = {
97
- subscription_token: purchaseToken,
98
- products: productId,
99
- detail: 'test',
100
- };
101
- const userToken = await this.getUserToken('google', payload);
102
- if (userToken) {
103
- // login and update membership
104
- const accessToken = await this.getSubscriptionToken('google', {
105
- token: userToken,
106
- });
107
- if (accessToken) {
108
- const payloadSWG = {
109
- email,
110
- package_name: packageName,
111
- product_id: productId,
112
- purchase_token: purchaseToken,
113
- };
114
- await this.createSwG(payloadSWG, accessToken);
115
- }
116
- }
117
- else {
118
- // register and login the unknown user
119
- const payloadRegisterToken = {
120
- subscription_token: purchaseToken,
121
- products: productId,
122
- detail: 'test',
123
- };
124
- const token = await this.getRegisterToken('google', payloadRegisterToken);
125
- if (token) {
126
- const accessToken = await this.getSubscriptionToken('google', { token });
127
- const payloadSWRUknown = {
128
- email,
129
- package_name: packageName,
130
- product_id: productId,
131
- purchase_token: purchaseToken,
132
- };
133
- await this.createSwG(payloadSWRUknown, accessToken);
134
- }
135
- }
136
- response.complete().then(() => {
137
- window.location.href = this.redirectToLogin;
138
- });
139
- });
140
- });
141
- });
142
- });
143
- };
144
- this.sendDataLayeronPaywallBody = () => {
145
- const gtmParams = {
146
- event: 'paywall_viewed',
147
- impressions: [
148
- {
149
- paywall_location: this.paywall_location || '',
150
- paywall_subscription_package: 'Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 12',
151
- paywall_subscription_id: '9802032',
152
- paywall_subscription_price: 360000,
153
- paywall_position: 1,
154
- user_type: this.tracker_user_type,
155
- subscription_status: this.tracker_subscription_status,
156
- page_domain: this.tracker_page_domain || 'Kompas.id',
157
- metered_wall_type: this.tracker_metered_wall_type || 'HP',
158
- metered_wall_balance: this.tracker_metered_wall_balance,
159
- },
160
- {
161
- paywall_location: this.paywall_location || '',
162
- paywall_subscription_package: 'Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 1',
163
- paywall_subscription_id: '9802035',
164
- paywall_subscription_price: 50000,
165
- paywall_position: 2,
166
- user_type: this.tracker_user_type,
167
- subscription_status: this.tracker_subscription_status,
168
- page_domain: this.tracker_page_domain || 'Kompas.id',
169
- metered_wall_type: this.tracker_metered_wall_type || 'HP',
170
- metered_wall_balance: this.tracker_metered_wall_balance,
171
- },
172
- ],
173
- };
174
- if (this.type === 'epaper') {
175
- gtmParams.impressions[0].epaper_edition = this.tracker_epaper_edition;
176
- gtmParams.impressions[1].epaper_edition = this.tracker_epaper_edition;
177
- }
178
- else {
179
- gtmParams.impressions[0].page_type = this.tracker_page_type;
180
- gtmParams.impressions[0].content_id = this.tracker_content_id;
181
- gtmParams.impressions[0].content_title = this.tracker_content_title;
182
- gtmParams.impressions[0].content_categories =
183
- this.tracker_content_categories;
184
- gtmParams.impressions[0].content_type = this.tracker_content_type;
185
- gtmParams.impressions[1].page_type = this.tracker_page_type;
186
- gtmParams.impressions[1].content_id = this.tracker_content_id;
187
- gtmParams.impressions[1].content_title = this.tracker_content_title;
188
- gtmParams.impressions[1].content_categories =
189
- this.tracker_content_categories;
190
- gtmParams.impressions[1].content_type = this.tracker_content_type;
191
- }
192
- window.dataLayer.push(gtmParams);
82
+ this.redirectToLogin = () => {
83
+ window.location.href = this.loginUrl;
193
84
  };
194
85
  }
195
- getRupiahFormat(value) {
196
- const roundedValue = Math.round(value);
197
- return `Rp ${roundedValue
198
- .toString()
199
- .replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1.')}`;
86
+ /**
87
+ * Getter
88
+ */
89
+ get loginUrl() {
90
+ return `${this.kompasLoginHost}?next=${encodeURIComponent(this.selfHost + window.location.pathname)}`;
91
+ }
92
+ get isDark() {
93
+ return this.theme === 'dark';
200
94
  }
95
+ /**
96
+ * Logic Function
97
+ */
201
98
  redirectToCheckout(url, name, id, price, position) {
202
99
  this.sendDataLayeronButtonBuyPackage(name, id, price, position);
203
100
  const originHost = encodeURIComponent(window.location.href);
204
- const source = this.type === 'epaper' ? 'epaper' : '';
101
+ const source = this.type === 'epaper' ? 'epaper' : 'article';
205
102
  const directUrlCheckout = `${url}${originHost}&source=${source}`;
206
103
  window.open(directUrlCheckout);
207
104
  }
@@ -213,7 +110,7 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
213
110
  window.open('https://www.kompas.id/berlangganan');
214
111
  }
215
112
  redirectToRegister() {
216
- const loginHost = 'https://account.kompas.id/login';
113
+ const loginHost = 'https://account.kompas.id/register';
217
114
  const nextParams = encodeURIComponent(window.location.href);
218
115
  const directUrlRegister = `${loginHost}?next=${nextParams}?status=sukses_login&status_login=login`;
219
116
  window.location.href = directUrlRegister;
@@ -222,14 +119,12 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
222
119
  this.sendDataLayeronHelpDesk();
223
120
  window.open('https://api.whatsapp.com/send/?phone=6281290050800&text=Halo,%20saya%20perlu%20informasi%20mengenai%20kompas.id');
224
121
  }
225
- paymentExtensionHandler() {
226
- this.isExtensionsOpened = !this.isExtensionsOpened;
227
- }
228
- get isDark() {
229
- return this.theme === 'dark';
230
- }
231
- get redirectToLogin() {
232
- return `${this.kompasLoginHost}?next=${encodeURIComponent(this.selfHost + window.location.pathname)}`;
122
+ parsePrice(price) {
123
+ const lowerCasePrice = price.toLowerCase();
124
+ if (lowerCasePrice.startsWith('rp')) {
125
+ return parseFloat(price.replace(/[^0-9,]/g, ''));
126
+ }
127
+ return parseFloat(price.replace(/[^0-9.]/g, ''));
233
128
  }
234
129
  async getRegisterToken(path, payload) {
235
130
  return fetch(`${this.kompasApigenHost}/v1/user/register/token/${path}`, {
@@ -301,6 +196,83 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
301
196
  throw error;
302
197
  });
303
198
  }
199
+ subscribeWithGoogleButton() {
200
+ // @ts-ignore
201
+ // eslint-disable-next-line no-restricted-globals
202
+ ;
203
+ (self.SWG = self.SWG || []).push((subscriptions) => {
204
+ // set entitlement
205
+ subscriptions.setOnEntitlementsResponse(() => {
206
+ // subscriptions attach button
207
+ subscriptions.attachButton(this.buttonElement, { theme: 'light', lang: 'en' }, async () => {
208
+ subscriptions.showOffers({ isClosable: true });
209
+ subscriptions.setOnLoginRequest(() => {
210
+ window.location.href = this.loginUrl;
211
+ });
212
+ const offers = await subscriptions.getOffers();
213
+ subscriptions.setOnFlowStarted((callback) => {
214
+ if (callback.flow === 'showOffers') {
215
+ window.dataLayer.push(this.swgPackageViewedDataLayer(offers));
216
+ }
217
+ else if (callback.flow === 'subscribe') {
218
+ const selectedOfferSkuId = callback.data.skuId;
219
+ const selectedOffer = offers.find((offer) => offer.skuId === selectedOfferSkuId);
220
+ window.dataLayer.push(this.swgSubscribeButtonClicked(selectedOffer, offers.indexOf(selectedOffer)));
221
+ }
222
+ });
223
+ subscriptions.setOnPaymentResponse(async (paymentResponse) => {
224
+ const response = await paymentResponse;
225
+ const raw = JSON.parse(response.purchaseData.raw);
226
+ const { productId, purchaseToken, packageName } = raw;
227
+ const { email } = response.userData.data;
228
+ const payload = {
229
+ subscription_token: purchaseToken,
230
+ products: productId,
231
+ detail: 'test',
232
+ };
233
+ const userToken = await this.getUserToken('google', payload);
234
+ if (userToken) {
235
+ // login and update membership
236
+ const accessToken = await this.getSubscriptionToken('google', {
237
+ token: userToken,
238
+ });
239
+ if (accessToken) {
240
+ const payloadSWG = {
241
+ email,
242
+ package_name: packageName,
243
+ product_id: productId,
244
+ purchase_token: purchaseToken,
245
+ };
246
+ await this.createSwG(payloadSWG, accessToken);
247
+ }
248
+ }
249
+ else {
250
+ // register and login the unknown user
251
+ const payloadRegisterToken = {
252
+ subscription_token: purchaseToken,
253
+ products: productId,
254
+ detail: 'test',
255
+ };
256
+ const token = await this.getRegisterToken('google', payloadRegisterToken);
257
+ if (token) {
258
+ const accessToken = await this.getSubscriptionToken('google', { token });
259
+ const payloadSWRUknown = {
260
+ email,
261
+ package_name: packageName,
262
+ product_id: productId,
263
+ purchase_token: purchaseToken,
264
+ };
265
+ await this.createSwG(payloadSWRUknown, accessToken);
266
+ }
267
+ }
268
+ response.complete().then(() => {
269
+ window.location.href = this.loginUrl;
270
+ });
271
+ });
272
+ });
273
+ });
274
+ });
275
+ }
304
276
  jsonScript() {
305
277
  const jsonData = {
306
278
  '@context': 'https://schema.org',
@@ -348,6 +320,78 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
348
320
  };
349
321
  setTimeout(appendSWGButton, 500);
350
322
  }
323
+ this.addStylesheetToHead();
324
+ }
325
+ addStylesheetToHead() {
326
+ const loraCssUrl = 'https://fonts.googleapis.com/css2?family=Lora:wght@700&display=swap';
327
+ const ptSansCssUrl = 'https://fonts.googleapis.com/css2?family=PT+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap';
328
+ let loraElement = document.querySelector(`link[href="${loraCssUrl}"]`);
329
+ if (!loraElement) {
330
+ loraElement = document.createElement('link');
331
+ loraElement.setAttribute('rel', 'stylesheet');
332
+ loraElement.setAttribute('href', loraCssUrl);
333
+ document.head.appendChild(loraElement);
334
+ }
335
+ let ptSansElement = document.querySelector(`link[href="${ptSansCssUrl}"]`);
336
+ if (!ptSansElement) {
337
+ ptSansElement = document.createElement('link');
338
+ ptSansElement.setAttribute('rel', 'stylesheet');
339
+ ptSansElement.setAttribute('href', ptSansCssUrl);
340
+ document.head.appendChild(ptSansElement);
341
+ }
342
+ }
343
+ otherPackagesClicked() {
344
+ this.sendDataLayerOtherPackagesClicked();
345
+ this.redirectToSubscriber();
346
+ }
347
+ customerServiceClicked() {
348
+ this.sendDataLayerCustomerServiceClicked();
349
+ this.redirectToHelpdesk();
350
+ }
351
+ /**
352
+ * Data Layer
353
+ */
354
+ buildGtmParams(event, impressions, index = 0) {
355
+ const gtmParams = {
356
+ event,
357
+ impressions: impressions.map((impression, i) => ({
358
+ paywall_location: this.paywall_location || '',
359
+ paywall_subscription_package: impression.package,
360
+ paywall_subscription_id: impression.subscription_id,
361
+ paywall_subscription_price: this.parsePrice(impression.price),
362
+ paywall_position: index + i + 1,
363
+ user_type: this.tracker_user_type,
364
+ subscription_status: this.tracker_subscription_status,
365
+ page_domain: this.tracker_page_domain || 'Kompas.id',
366
+ metered_wall_type: this.tracker_metered_wall_type || 'HP',
367
+ metered_wall_balance: this.tracker_metered_wall_balance,
368
+ ...(this.type === 'epaper'
369
+ ? { epaper_edition: this.tracker_epaper_edition }
370
+ : {
371
+ page_type: this.tracker_page_type,
372
+ content_id: this.tracker_content_id,
373
+ content_title: this.tracker_content_title,
374
+ content_categories: this.tracker_content_categories,
375
+ content_type: this.tracker_content_type,
376
+ }),
377
+ })),
378
+ };
379
+ return gtmParams;
380
+ }
381
+ generalPaywallDataLayer(event) {
382
+ const impressions = [
383
+ {
384
+ package: 'Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 12',
385
+ subscription_id: '9802032',
386
+ price: '360000',
387
+ },
388
+ {
389
+ package: 'Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 1',
390
+ subscription_id: '9802035',
391
+ price: '50000',
392
+ },
393
+ ];
394
+ return this.buildGtmParams(event, impressions);
351
395
  }
352
396
  sendDataLayer() {
353
397
  window.dataLayer.push({
@@ -391,23 +435,81 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
391
435
  }
392
436
  window.dataLayer.push(gtmParams);
393
437
  }
438
+ sendDataLayeronPaywallBody() {
439
+ const gtmParams = this.generalPaywallDataLayer('paywall_viewed');
440
+ window.dataLayer.push(gtmParams);
441
+ }
442
+ sendDataLayerOtherPackagesClicked() {
443
+ const gtmParams = this.generalPaywallDataLayer('other_packages_clicked');
444
+ window.dataLayer.push(gtmParams);
445
+ }
446
+ sendDataLayerCustomerServiceClicked() {
447
+ const gtmParams = this.generalPaywallDataLayer('customer_service_clicked');
448
+ window.dataLayer.push(gtmParams);
449
+ }
450
+ swgPackageViewedDataLayer(data) {
451
+ const impressions = data.map((item) => ({
452
+ package: item.title,
453
+ subscription_id: item.skuId,
454
+ price: item.introductoryPrice || item.price,
455
+ }));
456
+ return this.buildGtmParams('subscription_package_viewed', impressions);
457
+ }
458
+ swgSubscribeButtonClicked(item, index) {
459
+ const gtmParams = {
460
+ event: 'subscribe_button_clicked',
461
+ paywall_location: this.paywall_location || '',
462
+ paywall_subscription_package: item.title,
463
+ paywall_subscription_id: item.skuId,
464
+ paywall_subscription_price: this.parsePrice(item.introductoryPrice || item.price),
465
+ paywall_position: index + 1,
466
+ user_type: this.tracker_user_type,
467
+ subscription_status: this.tracker_subscription_status,
468
+ page_domain: this.tracker_page_domain || 'Kompas.id',
469
+ metered_wall_type: this.tracker_metered_wall_type || 'HP',
470
+ metered_wall_balance: this.tracker_metered_wall_balance,
471
+ };
472
+ if (this.type === 'epaper') {
473
+ gtmParams.epaper_edition = this.tracker_epaper_edition;
474
+ }
475
+ else {
476
+ gtmParams.page_type = this.tracker_page_type;
477
+ gtmParams.content_id = this.tracker_content_id;
478
+ gtmParams.content_title = this.tracker_content_title;
479
+ gtmParams.content_categories = this.tracker_content_categories;
480
+ gtmParams.content_type = this.tracker_content_type;
481
+ }
482
+ return gtmParams;
483
+ }
484
+ /**
485
+ * Component
486
+ */
394
487
  headerSection(type) {
488
+ const headerSectionText = type === 'epaper'
489
+ ? 'Akses ePaper Ini dengan Berlangganan'
490
+ : 'Lanjut Baca Artikel Ini dengan Berlangganan';
395
491
  return html `
396
- <div class="flex w-full items-center">
492
+ <div class="flex w-full items-center justify-center">
397
493
  ${type === 'epaper'
398
494
  ? html `<button
399
- @click=${() => this.redirectToPrevUrl()}
495
+ @click=${this.redirectToPrevUrl}
400
496
  class="hidden lg:block w-8 h-8 text-blue-600 pl-4"
401
497
  >
402
498
  ${unsafeSVG(getFontAwesomeIcon('fas', 'arrow-left'))}
403
499
  </button>`
404
- : ''}
500
+ : nothing}
405
501
  <h4
406
- class="text-base md:text-xl ${this.isDark &&
407
- 'text-white'} text-center font-bold font-serif tracking-wide md:tracking-normal w-full"
502
+ class="text-base flex justify-center self-center md:block md:text-xl ${this
503
+ .isDark
504
+ ? 'text-white'
505
+ : 'text-grey-600'}
506
+ text-center font-lora font-bold tracking-wide md:tracking-normal w-4/5 md:w-full"
408
507
  >
409
- Langganan untuk Lanjut Membaca
508
+ ${headerSectionText}
410
509
  </h4>
510
+ ${type === 'epaper'
511
+ ? html `<div class="w-10 hidden lg:flex"></div>`
512
+ : nothing}
411
513
  </div>
412
514
  `;
413
515
  }
@@ -416,12 +518,13 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
416
518
  <div class="flex flex-col space-y-2 mt-2.5 md:mt-3">
417
519
  ${data.map(item => html `
418
520
  <div class="flex items-center">
419
- <div class="text-green-500">
521
+ <div class=${this.isDark ? 'text-green-400' : 'text-green-500'}>
420
522
  ${unsafeSVG(getFontAwesomeIcon('fas', 'check', 12, 12))}
421
523
  </div>
422
524
  <h6
423
- class="text-xs md:text-base ${this.isDark &&
424
- 'text-white'} ml-0.5 md:ml-1"
525
+ class="text-xs md:text-base ${this.isDark
526
+ ? 'text-white'
527
+ : 'text-grey-600'} ml-0.5 md:ml-1"
425
528
  >
426
529
  ${item}
427
530
  </h6>
@@ -433,7 +536,7 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
433
536
  informationPackages() {
434
537
  return html ` <div class="mt-4 flex justify-center">
435
538
  <button
436
- @click=${() => this.redirectToSubscriber()}
539
+ @click=${this.otherPackagesClicked}
437
540
  class="text-sm md:text-base font-bold ${this.isDark
438
541
  ? 'text-blue-300'
439
542
  : 'text-blue-600'} underline"
@@ -445,54 +548,69 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
445
548
  separatorLine() {
446
549
  return html `
447
550
  <div class="flex flex-row w-full justify-center">
448
- <div
449
- class="border-b-2 ${this.isDark
450
- ? 'border-dark-2'
451
- : 'border-blue-200'} w-1/4 my-4 flex justify-center"
452
- ></div>
453
- <p class="px-4 pt-1 ${this.isDark && 'text-dark-1'}">atau</p>
454
- <div
455
- class="border-b-2 ${this.isDark
456
- ? 'border-dark-2'
457
- : 'border-blue-200'} w-1/4 my-4 flex justify-center"
458
- ></div>
551
+ <p class="px-4 pt-1 ${this.isDark ? 'text-dark-1' : 'text-grey-500'}">
552
+ atau
553
+ </p>
459
554
  </div>
460
555
  `;
461
556
  }
462
- paymentDesktopSection(data) {
557
+ epaperRegistrationSection() {
463
558
  return html `
464
- <div
465
- class="hidden md:flex w-full md:max-w-sm items-center justify-center flex-wrap"
466
- >
467
- ${data.map(item => html `<img
468
- class="object-cover ${this.isDark ? 'h-9' : 'h-10'}"
469
- src=${item.link}
470
- alt="${item.name}-logo-payment"
471
- />`)}
559
+ <div>
560
+ <button
561
+ @click=${this.redirectToLogin}
562
+ class="text-sm md:text-base font-bold ${this.isDark
563
+ ? 'text-blue-300'
564
+ : 'text-blue-600'} underline"
565
+ >
566
+ Masuk
567
+ </button>
568
+ <span class=${this.isDark && 'text-white'}>
569
+ jika sudah berlangganan.</span
570
+ >
472
571
  </div>
473
572
  `;
474
573
  }
475
- paymentMobileSection(data) {
574
+ regulerRegistrationSection() {
476
575
  return html `
477
- <div
478
- class="grid md:hidden items-center grid-flow-col grid-cols-auto grid-rows-1 mt-4 mx-4"
479
- >
480
- ${data.map(item => html `<img
481
- class="w-16"
482
- src=${item.link}
483
- alt="${item.name}-logo-payment"
484
- />`)}
485
- <button
486
- @click=${() => this.paymentExtensionHandler()}
487
- class="text-xs md:text-sm ${this.isDark
576
+ <div class="flex flex-col items-center justify-center">
577
+ <div>
578
+ <button
579
+ @click=${this.redirectToRegister}
580
+ class="text-sm md:text-base font-bold ${this.isDark
488
581
  ? 'text-blue-300'
489
- : 'text-blue-600'} font-bold"
490
- >
491
- +9 lainnya
492
- </button>
582
+ : 'text-blue-600'} underline"
583
+ >
584
+ Daftar
585
+ </button>
586
+ <span class=${this.isDark ? 'text-white' : 'text-grey-600'}>
587
+ untuk kuota artikel gratis</span
588
+ >
589
+ </div>
590
+ <div>
591
+ <span class=${this.isDark ? 'text-white' : 'text-grey-600'}
592
+ >atau
593
+ </span>
594
+ <button
595
+ @click=${this.redirectToLogin}
596
+ class="text-sm md:text-base font-bold ${this.isDark
597
+ ? 'text-blue-300'
598
+ : 'text-blue-600'} underline"
599
+ >
600
+ Masuk
601
+ </button>
602
+ <span class=${this.isDark ? 'text-white' : 'text-grey-600'}>
603
+ jika sudah punya akun.</span
604
+ >
605
+ </div>
493
606
  </div>
494
607
  `;
495
608
  }
609
+ registrationSection(type) {
610
+ return type === 'epaper'
611
+ ? this.epaperRegistrationSection()
612
+ : this.regulerRegistrationSection();
613
+ }
496
614
  paymentMobileExtension(data) {
497
615
  return html `
498
616
  <div
@@ -533,22 +651,23 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
533
651
  <div
534
652
  class="flex flex-wrap justify-between items-center ${this.isDark
535
653
  ? 'bg-grey-600'
536
- : 'bg-white'} rounded md:mx-0 w-full max-w-xs md:max-w-sm md:w-3/5 mt-2.5 md:mt-4 border border-yellow-400 relative"
654
+ : 'bg-white'} rounded-lg md:mx-0 w-full max-w-xs md:max-w-sm md:w-3/5 mt-2.5 md:mt-4 border border-yellow-400 relative"
537
655
  >
538
656
  <div class="flex flex-col py-3 px-4">
539
657
  <div class="flex flex-none items-center">
540
658
  <h5 class="text-base md:text-lg font-bold text-orange-400">
541
- ${this.getRupiahFormat(product.price)}
659
+ ${formatRupiah(product.price)}
542
660
  </h5>
543
661
  <h6
544
- class="text-xs md:text-base ${this.isDark &&
545
- 'text-white'} font-bold pl-1"
662
+ class="text-xs md:text-base ${this.isDark
663
+ ? 'text-dark-7'
664
+ : 'text-grey-600'} font-bold pl-1"
546
665
  >
547
666
  / ${product.periode}
548
667
  </h6>
549
668
  </div>
550
669
  <div class="flex items-center">
551
- <p class="text-xs ${this.isDark && 'text-white'}">
670
+ <p class="text-xs ${this.isDark ? 'text-dark-7' : 'text-grey-600'}">
552
671
  hanya <span class="text-orange-400">Rp 30.000</span> / bulan
553
672
  </p>
554
673
  </div>
@@ -569,7 +688,7 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
569
688
  </button>
570
689
  <div class="absolute -top-2 left-4">
571
690
  <div class="rounded bg-yellow-300 px-2 py-0.5 text-xs">
572
- <b>Harga Terbaik</b>
691
+ <b class="text-grey-600">Harga Terbaik</b>
573
692
  </div>
574
693
  </div>
575
694
  </div>
@@ -580,15 +699,16 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
580
699
  <div
581
700
  class="flex flex-wrap justify-between ${this.isDark
582
701
  ? 'bg-grey-600'
583
- : 'bg-white'} py-3 px-4 rounded md:mx-0 w-full max-w-xs md:max-w-sm md:w-3/5 mt-3 md:mt-4"
702
+ : 'bg-white'} py-3 px-4 rounded-lg md:mx-0 w-full max-w-xs md:max-w-sm md:w-3/5 mt-3 md:mt-4"
584
703
  >
585
704
  <div class="flex items-center">
586
705
  <h5 class="text-base md:text-lg font-bold text-orange-400">
587
- ${this.getRupiahFormat(product.price)}
706
+ ${formatRupiah(product.price)}
588
707
  </h5>
589
708
  <h6
590
- class="text-xs md:text-base ${this.isDark &&
591
- 'text-white'} font-bold pl-1"
709
+ class="text-xs md:text-base ${this.isDark
710
+ ? 'text-dark-7'
711
+ : 'text-grey-600'} font-bold pl-1"
592
712
  >
593
713
  / ${product.periode}
594
714
  </h6>
@@ -611,12 +731,7 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
611
731
  }
612
732
  packagesSection(data) {
613
733
  return html `
614
- <div class="flex flex-col w-full items-center mt-8 lg:mt-2 px-2 ">
615
- <h6
616
- class="text-sm md:text-base ${this.isDark && 'text-white'} font-bold"
617
- >
618
- ${data.title}
619
- </h6>
734
+ <div class="flex flex-col w-full items-center mt-8 lg:mt-2 px-4">
620
735
  ${data.memberships.map(item => item.isHighlight
621
736
  ? this.primaryPackages(item)
622
737
  : this.secondaryPackages(item))}
@@ -627,7 +742,7 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
627
742
  return html `
628
743
  <div class="flex lg:hidden items-center w-full pb-4 ">
629
744
  <button
630
- @click=${() => this.redirectToPrevUrl()}
745
+ @click=${this.redirectToPrevUrl}
631
746
  class="text-xs md:text-lg text-white flex flex-row"
632
747
  >
633
748
  <div class="icon-lg icon-white w-4 h-4 mr-3.5 md:mr-5 pt-0.5">
@@ -640,94 +755,92 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
640
755
  }
641
756
  helpDesk() {
642
757
  return html `
643
- <div class="py-2.5 text-white self-center text-xs md:text-sm">
644
- Mengalami masalah? Hubungi
645
- <button
646
- @click=${() => this.redirectToHelpdesk()}
647
- class="font-bold ${this.isDark && 'text-blue-300'} underline"
648
- >
649
- Layanan Pelanggan.
650
- </button>
651
- </div>
652
- `;
653
- }
654
- authRegister() {
655
- return html `
656
758
  <div
657
- class="flex flex-row text-white px-2 py-2.5 space-x-4 md:space-x-8 self-center"
759
+ class="${this.isDark
760
+ ? 'text-dark-7'
761
+ : 'text-white'} self-center text-xs md:text-sm"
658
762
  >
659
- <div class="flex flex-col text-left text-xs md:text-sm text-white">
660
- <b>Sudah berlangganan Kompas.id?</b>
661
- <p>Masuk untuk lanjut membaca.</p>
662
- </div>
763
+ Butuh bantuan? Hubungi
663
764
  <button
664
- @click=${() => this.redirectToRegister()}
665
- class="h-auto ${this.isDark
666
- ? 'bg-blue-300'
667
- : 'bg-grey-100'} rounded mr-3"
765
+ @click=${this.customerServiceClicked}
766
+ class="font-bold underline"
668
767
  >
669
- <p
670
- class="text-xs md:text-sm ${this.isDark
671
- ? 'text-black'
672
- : 'text-blue-600'} font-bold py-2 px-4"
673
- >
674
- Masuk / Daftar
675
- </p>
768
+ Layanan Pelanggan.
676
769
  </button>
677
770
  </div>
678
771
  `;
679
772
  }
680
- userAction(isLogin, type) {
773
+ userAction() {
681
774
  return html `
682
775
  <div
683
- class="flex h-20 ${this.isDark
776
+ class="flex py-5 px-8 md:py-6 ${this.isDark
684
777
  ? 'bg-dark-4'
685
- : 'bg-blue-600'} w-full justify-evenly rounded-b mt-6 md:mt-8 relative"
778
+ : 'bg-blue-600'} w-full justify-evenly rounded-b-xl mt-6 md:mt-8 relative"
686
779
  >
687
- ${isLogin || type !== 'epaper' ? this.helpDesk() : this.authRegister()}
780
+ ${this.helpDesk()}
688
781
  </div>
689
782
  `;
690
783
  }
784
+ /**
785
+ * Render Statement
786
+ */
691
787
  render() {
692
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
788
+ var _a, _b, _c, _d, _e, _f, _g, _h;
693
789
  return html `
694
790
  <div
695
791
  class="${this.type === 'epaper'
696
- ? 'bg-transparent wrapper-body'
792
+ ? 'bg-transparent wrapper-body mx-2'
697
793
  : 'wrapper-body'}"
698
794
  >
699
795
  <div
700
- class="flex flex-col justify-center items-center w-full max-w-screen-sm px-4 md:px-0 my-5 relative"
796
+ class="flex flex-col justify-center items-center w-full max-w-screen-sm my-5 relative"
701
797
  >
702
- ${this.type === 'epaper' ? this.topNavigator() : ''}
798
+ ${this.type === 'epaper' ? this.topNavigator() : nothing}
703
799
  <div
704
800
  class="flex w-full flex-col items-center justify-center ${this
705
801
  .isDark
706
802
  ? 'bg-dark-3'
707
- : 'bg-blue-100'} rounded pt-6 md:pt-8 relative"
803
+ : 'bg-blue-100'} rounded-xl pt-6 md:pt-8 relative"
708
804
  >
709
805
  ${this.headerSection(this.type)}
710
806
  ${this.descriptionSection((_c = (_b = (_a = this.paywallData) === null || _a === void 0 ? void 0 : _a.informations) === null || _b === void 0 ? void 0 : _b.description) !== null && _c !== void 0 ? _c : [])}
711
807
  ${this.packagesSection((_e = (_d = this.paywallData) === null || _d === void 0 ? void 0 : _d.packages) !== null && _e !== void 0 ? _e : {})}
712
808
  ${this.informationPackages()}
713
- ${this.swgEnable ? this.separatorLine() : null}
809
+ ${this.swgEnable ? this.separatorLine() : nothing}
714
810
  ${this.swgEnable
715
811
  ? html `<button
716
- class="border-2 bg-grey-100 border-grey-100 rounded-lg px-6 shadow-sm flex flex-row py-2 mt-1 mb-4"
717
- id="subscribe-with-google"
718
- >
719
- <p>Subscribe with</p>
720
- <img class="pl-2 object-scale-down w-20 pt-0.5" src="https://kompasid-production-www.s3.ap-southeast-1.amazonaws.com/paywall-asset/google.png" alt="subscribe with google"></img>
721
- </button>`
722
- : null}
723
- ${this.paymentDesktopSection((_h = (_g = (_f = this.paywallData) === null || _f === void 0 ? void 0 : _f.payment) === null || _g === void 0 ? void 0 : _g.desktop) !== null && _h !== void 0 ? _h : [])}
724
- ${this.paymentMobileSection((_l = (_k = (_j = this.paywallData) === null || _j === void 0 ? void 0 : _j.payment) === null || _k === void 0 ? void 0 : _k.mobile) !== null && _l !== void 0 ? _l : [])}
725
- ${this.userAction(this.isLogin, this.type)}
726
- ${this.sendDataLayeronPaywallBody()}
812
+ class="${this.isDark
813
+ ? 'bg-grey-600'
814
+ : 'border-2 bg-grey-100 border-grey-100'} rounded-lg px-6 shadow-sm flex flex-row py-2 mt-1 items-center"
815
+ id="subscribe-with-google"
816
+ >
817
+ <p class=${this.isDark ? 'text-dark-7' : 'text-grey-500'}>
818
+ Subscribe with
819
+ </p>
820
+ <img
821
+ class="pl-2 object-scale-down w-20 pt-0.5"
822
+ src=${this.isDark
823
+ ? 'https://kompasid-production-www.s3.ap-southeast-1.amazonaws.com/paywall-asset/google-white.png'
824
+ : 'https://kompasid-production-www.s3.ap-southeast-1.amazonaws.com/paywall-asset/google.png'}
825
+ alt="subscribe with google"
826
+ />
827
+ </button>`
828
+ : nothing}
829
+ ${!this.isLogin
830
+ ? html `
831
+ <div
832
+ class="border-b ${this.isDark
833
+ ? 'border-dark-8'
834
+ : 'border-blue-200'} w-1/5 my-4 flex justify-center"
835
+ ></div>
836
+ ${this.registrationSection(this.type)}
837
+ `
838
+ : nothing}
839
+ ${this.userAction()} ${this.sendDataLayeronPaywallBody()}
727
840
  </div>
728
841
  ${this.isExtensionsOpened
729
- ? this.paymentMobileExtension((_p = (_o = (_m = this.paywallData) === null || _m === void 0 ? void 0 : _m.payment) === null || _o === void 0 ? void 0 : _o.ekstension) !== null && _p !== void 0 ? _p : [])
730
- : ''}
842
+ ? this.paymentMobileExtension((_h = (_g = (_f = this.paywallData) === null || _f === void 0 ? void 0 : _f.payment) === null || _g === void 0 ? void 0 : _g.ekstension) !== null && _h !== void 0 ? _h : [])
843
+ : nothing}
731
844
  </div>
732
845
  </div>
733
846
  `;
@@ -741,6 +854,10 @@ KompasIdPaywallBody.styles = [
741
854
  justify-items: center;
742
855
  align-items: center;
743
856
  }
857
+
858
+ .font-lora {
859
+ font-family: 'Lora', 'Georgia', 'serif';
860
+ }
744
861
  `,
745
862
  TWStyles,
746
863
  ];