@kompasid/lit-web-components 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/.github/workflows/npm-publish.yml +2 -2
  2. package/assets/video.jpg +0 -0
  3. package/demo/index.html +28 -27
  4. package/dist/src/components/kompasid-footer/KompasFooter.d.ts +1 -2
  5. package/dist/src/components/kompasid-footer/KompasFooter.js +4 -9
  6. package/dist/src/components/kompasid-footer/KompasFooter.js.map +1 -1
  7. package/dist/src/components/kompasid-paywall/KompasPaywall.js +5 -8
  8. package/dist/src/components/kompasid-paywall/KompasPaywall.js.map +1 -1
  9. package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.d.ts +34 -8
  10. package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js +359 -262
  11. package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js.map +1 -1
  12. package/dist/src/components/kompasid-paywall-video/KompasPaywallVideo.d.ts +42 -5
  13. package/dist/src/components/kompasid-paywall-video/KompasPaywallVideo.js +182 -107
  14. package/dist/src/components/kompasid-paywall-video/KompasPaywallVideo.js.map +1 -1
  15. package/dist/src/utils/formatRupiah.d.ts +1 -0
  16. package/dist/src/utils/formatRupiah.js +7 -0
  17. package/dist/src/utils/formatRupiah.js.map +1 -0
  18. package/dist/src/utils/googleFont.d.ts +1 -0
  19. package/dist/src/utils/googleFont.js +17 -0
  20. package/dist/src/utils/googleFont.js.map +1 -0
  21. package/dist/tailwind/tailwind.js +123 -95
  22. package/dist/tailwind/tailwind.js.map +1 -1
  23. package/dist/tsconfig.tsbuildinfo +1 -1
  24. package/package.json +1 -1
  25. package/src/components/kompasid-footer/KompasFooter.ts +4 -11
  26. package/src/components/kompasid-paywall/KompasPaywall.ts +5 -8
  27. package/src/components/kompasid-paywall-body/KompasPaywallBody.ts +332 -210
  28. package/src/components/kompasid-paywall-video/KompasPaywallVideo.ts +178 -90
  29. package/src/components/kompasid-paywall-video/readme.md +1 -0
  30. package/src/utils/formatRupiah.ts +6 -0
  31. package/src/utils/googleFont.ts +19 -0
  32. package/tailwind/tailwind.css +120 -92
  33. package/tailwind/tailwind.ts +123 -95
  34. package/tailwind.config.js +3 -1
@@ -1,11 +1,13 @@
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';
10
+ import { addGoogleFonts } from '../../utils/googleFont.js';
9
11
  let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
10
12
  constructor() {
11
13
  super(...arguments);
@@ -65,6 +67,9 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
65
67
  this.tracker_metered_wall_balance = 0;
66
68
  this.tracker_epaper_edition = '';
67
69
  this.theme = '';
70
+ /**
71
+ * State
72
+ */
68
73
  this.isExtensionsOpened = false;
69
74
  this.kompasAkunHost = 'https://akun.kompas.id';
70
75
  this.kompasApigenHost = 'https://apigen.kompas.id';
@@ -75,133 +80,26 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
75
80
  this.swgPublisherId = 'kompas.id';
76
81
  this.swgProductId = 'kompas.id:kompas_digital_premium';
77
82
  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);
83
+ this.redirectToLogin = () => {
84
+ window.location.href = this.loginUrl;
193
85
  };
194
86
  }
195
- getRupiahFormat(value) {
196
- const roundedValue = Math.round(value);
197
- return `Rp ${roundedValue
198
- .toString()
199
- .replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1.')}`;
87
+ /**
88
+ * Getter
89
+ */
90
+ get loginUrl() {
91
+ return `${this.kompasLoginHost}?next=${encodeURIComponent(this.selfHost + window.location.pathname)}`;
92
+ }
93
+ get isDark() {
94
+ return this.theme === 'dark';
200
95
  }
96
+ /**
97
+ * Logic Function
98
+ */
201
99
  redirectToCheckout(url, name, id, price, position) {
202
100
  this.sendDataLayeronButtonBuyPackage(name, id, price, position);
203
101
  const originHost = encodeURIComponent(window.location.href);
204
- const source = this.type === 'epaper' ? 'epaper' : '';
102
+ const source = this.type === 'epaper' ? 'epaper' : 'article';
205
103
  const directUrlCheckout = `${url}${originHost}&source=${source}`;
206
104
  window.open(directUrlCheckout);
207
105
  }
@@ -213,7 +111,7 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
213
111
  window.open('https://www.kompas.id/berlangganan');
214
112
  }
215
113
  redirectToRegister() {
216
- const loginHost = 'https://account.kompas.id/login';
114
+ const loginHost = 'https://account.kompas.id/register';
217
115
  const nextParams = encodeURIComponent(window.location.href);
218
116
  const directUrlRegister = `${loginHost}?next=${nextParams}?status=sukses_login&status_login=login`;
219
117
  window.location.href = directUrlRegister;
@@ -222,14 +120,12 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
222
120
  this.sendDataLayeronHelpDesk();
223
121
  window.open('https://api.whatsapp.com/send/?phone=6281290050800&text=Halo,%20saya%20perlu%20informasi%20mengenai%20kompas.id');
224
122
  }
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)}`;
123
+ parsePrice(price) {
124
+ const lowerCasePrice = price.toLowerCase();
125
+ if (lowerCasePrice.startsWith('rp')) {
126
+ return parseFloat(price.replace(/[^0-9,]/g, ''));
127
+ }
128
+ return parseFloat(price.replace(/[^0-9.]/g, ''));
233
129
  }
234
130
  async getRegisterToken(path, payload) {
235
131
  return fetch(`${this.kompasApigenHost}/v1/user/register/token/${path}`, {
@@ -301,6 +197,83 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
301
197
  throw error;
302
198
  });
303
199
  }
200
+ subscribeWithGoogleButton() {
201
+ // @ts-ignore
202
+ // eslint-disable-next-line no-restricted-globals
203
+ ;
204
+ (self.SWG = self.SWG || []).push((subscriptions) => {
205
+ // set entitlement
206
+ subscriptions.setOnEntitlementsResponse(() => {
207
+ // subscriptions attach button
208
+ subscriptions.attachButton(this.buttonElement, { theme: 'light', lang: 'en' }, async () => {
209
+ subscriptions.showOffers({ isClosable: true });
210
+ subscriptions.setOnLoginRequest(() => {
211
+ window.location.href = this.loginUrl;
212
+ });
213
+ const offers = await subscriptions.getOffers();
214
+ subscriptions.setOnFlowStarted((callback) => {
215
+ if (callback.flow === 'showOffers') {
216
+ window.dataLayer.push(this.swgPackageViewedDataLayer(offers));
217
+ }
218
+ else if (callback.flow === 'subscribe') {
219
+ const selectedOfferSkuId = callback.data.skuId;
220
+ const selectedOffer = offers.find((offer) => offer.skuId === selectedOfferSkuId);
221
+ window.dataLayer.push(this.swgSubscribeButtonClicked(selectedOffer, offers.indexOf(selectedOffer)));
222
+ }
223
+ });
224
+ subscriptions.setOnPaymentResponse(async (paymentResponse) => {
225
+ const response = await paymentResponse;
226
+ const raw = JSON.parse(response.purchaseData.raw);
227
+ const { productId, purchaseToken, packageName } = raw;
228
+ const { email } = response.userData.data;
229
+ const payload = {
230
+ subscription_token: purchaseToken,
231
+ products: productId,
232
+ detail: 'test',
233
+ };
234
+ const userToken = await this.getUserToken('google', payload);
235
+ if (userToken) {
236
+ // login and update membership
237
+ const accessToken = await this.getSubscriptionToken('google', {
238
+ token: userToken,
239
+ });
240
+ if (accessToken) {
241
+ const payloadSWG = {
242
+ email,
243
+ package_name: packageName,
244
+ product_id: productId,
245
+ purchase_token: purchaseToken,
246
+ };
247
+ await this.createSwG(payloadSWG, accessToken);
248
+ }
249
+ }
250
+ else {
251
+ // register and login the unknown user
252
+ const payloadRegisterToken = {
253
+ subscription_token: purchaseToken,
254
+ products: productId,
255
+ detail: 'test',
256
+ };
257
+ const token = await this.getRegisterToken('google', payloadRegisterToken);
258
+ if (token) {
259
+ const accessToken = await this.getSubscriptionToken('google', { token });
260
+ const payloadSWRUknown = {
261
+ email,
262
+ package_name: packageName,
263
+ product_id: productId,
264
+ purchase_token: purchaseToken,
265
+ };
266
+ await this.createSwG(payloadSWRUknown, accessToken);
267
+ }
268
+ }
269
+ response.complete().then(() => {
270
+ window.location.href = this.loginUrl;
271
+ });
272
+ });
273
+ });
274
+ });
275
+ });
276
+ }
304
277
  jsonScript() {
305
278
  const jsonData = {
306
279
  '@context': 'https://schema.org',
@@ -327,27 +300,78 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
327
300
  jsonHead.appendChild(jsonScript);
328
301
  }
329
302
  }
330
- connectedCallback() {
331
- // eslint-disable-next-line wc/guard-super-call
303
+ async connectedCallback() {
304
+ var _a;
332
305
  super.connectedCallback();
306
+ await this.updateComplete;
333
307
  if (this.swgEnable) {
334
308
  this.jsonScript();
335
- const appendSWGButton = () => {
336
- var _a;
337
- this.buttonElement = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('subscribe-with-google');
338
- if (this.buttonElement) {
339
- const head = document.querySelector('head');
340
- const script = document.createElement('script');
341
- script.src = 'https://news.google.com/swg/js/v1/swg.js';
342
- script.defer = true;
343
- script.onload = this.subscribeWithGoogleButton();
344
- if (head) {
345
- head.appendChild(script);
346
- }
309
+ this.buttonElement = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.getElementById('subscribe-with-google');
310
+ if (this.buttonElement) {
311
+ const head = document.querySelector('head');
312
+ const script = document.createElement('script');
313
+ script.src = 'https://news.google.com/swg/js/v1/swg.js';
314
+ script.defer = true;
315
+ script.onload = this.subscribeWithGoogleButton();
316
+ if (head) {
317
+ head.appendChild(script);
347
318
  }
348
- };
349
- setTimeout(appendSWGButton, 500);
319
+ }
350
320
  }
321
+ addGoogleFonts(['pt-sans', 'lora']);
322
+ }
323
+ otherPackagesClicked() {
324
+ this.sendDataLayerOtherPackagesClicked();
325
+ this.redirectToSubscriber();
326
+ }
327
+ customerServiceClicked() {
328
+ this.sendDataLayerCustomerServiceClicked();
329
+ this.redirectToHelpdesk();
330
+ }
331
+ /**
332
+ * Data Layer
333
+ */
334
+ buildGtmParams(event, impressions, index = 0) {
335
+ const gtmParams = {
336
+ event,
337
+ impressions: impressions.map((impression, i) => ({
338
+ paywall_location: this.paywall_location || '',
339
+ paywall_subscription_package: impression.package,
340
+ paywall_subscription_id: impression.subscription_id,
341
+ paywall_subscription_price: this.parsePrice(impression.price),
342
+ paywall_position: index + i + 1,
343
+ user_type: this.tracker_user_type,
344
+ subscription_status: this.tracker_subscription_status,
345
+ page_domain: this.tracker_page_domain || 'Kompas.id',
346
+ metered_wall_type: this.tracker_metered_wall_type || 'HP',
347
+ metered_wall_balance: this.tracker_metered_wall_balance,
348
+ ...(this.type === 'epaper'
349
+ ? { epaper_edition: this.tracker_epaper_edition }
350
+ : {
351
+ page_type: this.tracker_page_type,
352
+ content_id: this.tracker_content_id,
353
+ content_title: this.tracker_content_title,
354
+ content_categories: this.tracker_content_categories,
355
+ content_type: this.tracker_content_type,
356
+ }),
357
+ })),
358
+ };
359
+ return gtmParams;
360
+ }
361
+ generalPaywallDataLayer(event) {
362
+ const impressions = [
363
+ {
364
+ package: 'Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 12',
365
+ subscription_id: '9802032',
366
+ price: '360000',
367
+ },
368
+ {
369
+ package: 'Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 1',
370
+ subscription_id: '9802035',
371
+ price: '50000',
372
+ },
373
+ ];
374
+ return this.buildGtmParams(event, impressions);
351
375
  }
352
376
  sendDataLayer() {
353
377
  window.dataLayer.push({
@@ -391,23 +415,81 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
391
415
  }
392
416
  window.dataLayer.push(gtmParams);
393
417
  }
418
+ sendDataLayeronPaywallBody() {
419
+ const gtmParams = this.generalPaywallDataLayer('paywall_viewed');
420
+ window.dataLayer.push(gtmParams);
421
+ }
422
+ sendDataLayerOtherPackagesClicked() {
423
+ const gtmParams = this.generalPaywallDataLayer('other_packages_clicked');
424
+ window.dataLayer.push(gtmParams);
425
+ }
426
+ sendDataLayerCustomerServiceClicked() {
427
+ const gtmParams = this.generalPaywallDataLayer('customer_service_clicked');
428
+ window.dataLayer.push(gtmParams);
429
+ }
430
+ swgPackageViewedDataLayer(data) {
431
+ const impressions = data.map((item) => ({
432
+ package: item.title,
433
+ subscription_id: item.skuId,
434
+ price: item.introductoryPrice || item.price,
435
+ }));
436
+ return this.buildGtmParams('subscription_package_viewed', impressions);
437
+ }
438
+ swgSubscribeButtonClicked(item, index) {
439
+ const gtmParams = {
440
+ event: 'subscribe_button_clicked',
441
+ paywall_location: this.paywall_location || '',
442
+ paywall_subscription_package: item.title,
443
+ paywall_subscription_id: item.skuId,
444
+ paywall_subscription_price: this.parsePrice(item.introductoryPrice || item.price),
445
+ paywall_position: index + 1,
446
+ user_type: this.tracker_user_type,
447
+ subscription_status: this.tracker_subscription_status,
448
+ page_domain: this.tracker_page_domain || 'Kompas.id',
449
+ metered_wall_type: this.tracker_metered_wall_type || 'HP',
450
+ metered_wall_balance: this.tracker_metered_wall_balance,
451
+ };
452
+ if (this.type === 'epaper') {
453
+ gtmParams.epaper_edition = this.tracker_epaper_edition;
454
+ }
455
+ else {
456
+ gtmParams.page_type = this.tracker_page_type;
457
+ gtmParams.content_id = this.tracker_content_id;
458
+ gtmParams.content_title = this.tracker_content_title;
459
+ gtmParams.content_categories = this.tracker_content_categories;
460
+ gtmParams.content_type = this.tracker_content_type;
461
+ }
462
+ return gtmParams;
463
+ }
464
+ /**
465
+ * Component
466
+ */
394
467
  headerSection(type) {
468
+ const headerSectionText = type === 'epaper'
469
+ ? 'Akses ePaper Ini dengan Berlangganan'
470
+ : 'Lanjut Baca Artikel Ini dengan Berlangganan';
395
471
  return html `
396
- <div class="flex w-full items-center">
472
+ <div class="flex w-full items-center justify-center">
397
473
  ${type === 'epaper'
398
474
  ? html `<button
399
- @click=${() => this.redirectToPrevUrl()}
475
+ @click=${this.redirectToPrevUrl}
400
476
  class="hidden lg:block w-8 h-8 text-blue-600 pl-4"
401
477
  >
402
478
  ${unsafeSVG(getFontAwesomeIcon('fas', 'arrow-left'))}
403
479
  </button>`
404
- : ''}
480
+ : nothing}
405
481
  <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"
482
+ class="text-base flex justify-center self-center md:block md:text-xl ${this
483
+ .isDark
484
+ ? 'text-white'
485
+ : 'text-grey-600'}
486
+ text-center font-lora font-bold tracking-wide md:tracking-normal w-4/5 md:w-full"
408
487
  >
409
- Langganan untuk Lanjut Membaca
488
+ ${headerSectionText}
410
489
  </h4>
490
+ ${type === 'epaper'
491
+ ? html `<div class="w-10 hidden lg:flex"></div>`
492
+ : nothing}
411
493
  </div>
412
494
  `;
413
495
  }
@@ -416,12 +498,13 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
416
498
  <div class="flex flex-col space-y-2 mt-2.5 md:mt-3">
417
499
  ${data.map(item => html `
418
500
  <div class="flex items-center">
419
- <div class="text-green-500">
501
+ <div class=${this.isDark ? 'text-green-400' : 'text-green-500'}>
420
502
  ${unsafeSVG(getFontAwesomeIcon('fas', 'check', 12, 12))}
421
503
  </div>
422
504
  <h6
423
- class="text-xs md:text-base ${this.isDark &&
424
- 'text-white'} ml-0.5 md:ml-1"
505
+ class="text-xs md:text-base ${this.isDark
506
+ ? 'text-white'
507
+ : 'text-grey-600'} ml-0.5 md:ml-1"
425
508
  >
426
509
  ${item}
427
510
  </h6>
@@ -433,7 +516,7 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
433
516
  informationPackages() {
434
517
  return html ` <div class="mt-4 flex justify-center">
435
518
  <button
436
- @click=${() => this.redirectToSubscriber()}
519
+ @click=${this.otherPackagesClicked}
437
520
  class="text-sm md:text-base font-bold ${this.isDark
438
521
  ? 'text-blue-300'
439
522
  : 'text-blue-600'} underline"
@@ -445,54 +528,69 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
445
528
  separatorLine() {
446
529
  return html `
447
530
  <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>
531
+ <p class="px-4 pt-1 ${this.isDark ? 'text-dark-1' : 'text-grey-500'}">
532
+ atau
533
+ </p>
459
534
  </div>
460
535
  `;
461
536
  }
462
- paymentDesktopSection(data) {
537
+ epaperRegistrationSection() {
463
538
  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
- />`)}
539
+ <div>
540
+ <button
541
+ @click=${this.redirectToLogin}
542
+ class="text-sm md:text-base font-bold ${this.isDark
543
+ ? 'text-blue-300'
544
+ : 'text-blue-600'} underline"
545
+ >
546
+ Masuk
547
+ </button>
548
+ <span class=${this.isDark && 'text-white'}>
549
+ jika sudah berlangganan.</span
550
+ >
472
551
  </div>
473
552
  `;
474
553
  }
475
- paymentMobileSection(data) {
554
+ regulerRegistrationSection() {
476
555
  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
556
+ <div class="flex flex-col items-center justify-center">
557
+ <div>
558
+ <button
559
+ @click=${this.redirectToRegister}
560
+ class="text-sm md:text-base font-bold ${this.isDark
488
561
  ? 'text-blue-300'
489
- : 'text-blue-600'} font-bold"
490
- >
491
- +9 lainnya
492
- </button>
562
+ : 'text-blue-600'} underline"
563
+ >
564
+ Daftar
565
+ </button>
566
+ <span class=${this.isDark ? 'text-white' : 'text-grey-600'}>
567
+ untuk kuota artikel gratis</span
568
+ >
569
+ </div>
570
+ <div>
571
+ <span class=${this.isDark ? 'text-white' : 'text-grey-600'}
572
+ >atau
573
+ </span>
574
+ <button
575
+ @click=${this.redirectToLogin}
576
+ class="text-sm md:text-base font-bold ${this.isDark
577
+ ? 'text-blue-300'
578
+ : 'text-blue-600'} underline"
579
+ >
580
+ Masuk
581
+ </button>
582
+ <span class=${this.isDark ? 'text-white' : 'text-grey-600'}>
583
+ jika sudah punya akun.</span
584
+ >
585
+ </div>
493
586
  </div>
494
587
  `;
495
588
  }
589
+ registrationSection(type) {
590
+ return type === 'epaper'
591
+ ? this.epaperRegistrationSection()
592
+ : this.regulerRegistrationSection();
593
+ }
496
594
  paymentMobileExtension(data) {
497
595
  return html `
498
596
  <div
@@ -533,22 +631,23 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
533
631
  <div
534
632
  class="flex flex-wrap justify-between items-center ${this.isDark
535
633
  ? '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"
634
+ : '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
635
  >
538
636
  <div class="flex flex-col py-3 px-4">
539
637
  <div class="flex flex-none items-center">
540
638
  <h5 class="text-base md:text-lg font-bold text-orange-400">
541
- ${this.getRupiahFormat(product.price)}
639
+ ${formatRupiah(product.price)}
542
640
  </h5>
543
641
  <h6
544
- class="text-xs md:text-base ${this.isDark &&
545
- 'text-white'} font-bold pl-1"
642
+ class="text-xs md:text-base ${this.isDark
643
+ ? 'text-dark-7'
644
+ : 'text-grey-600'} font-bold pl-1"
546
645
  >
547
646
  / ${product.periode}
548
647
  </h6>
549
648
  </div>
550
649
  <div class="flex items-center">
551
- <p class="text-xs ${this.isDark && 'text-white'}">
650
+ <p class="text-xs ${this.isDark ? 'text-dark-7' : 'text-grey-600'}">
552
651
  hanya <span class="text-orange-400">Rp 30.000</span> / bulan
553
652
  </p>
554
653
  </div>
@@ -569,7 +668,7 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
569
668
  </button>
570
669
  <div class="absolute -top-2 left-4">
571
670
  <div class="rounded bg-yellow-300 px-2 py-0.5 text-xs">
572
- <b>Harga Terbaik</b>
671
+ <b class="text-grey-600">Harga Terbaik</b>
573
672
  </div>
574
673
  </div>
575
674
  </div>
@@ -580,15 +679,16 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
580
679
  <div
581
680
  class="flex flex-wrap justify-between ${this.isDark
582
681
  ? '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"
682
+ : '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
683
  >
585
684
  <div class="flex items-center">
586
685
  <h5 class="text-base md:text-lg font-bold text-orange-400">
587
- ${this.getRupiahFormat(product.price)}
686
+ ${formatRupiah(product.price)}
588
687
  </h5>
589
688
  <h6
590
- class="text-xs md:text-base ${this.isDark &&
591
- 'text-white'} font-bold pl-1"
689
+ class="text-xs md:text-base ${this.isDark
690
+ ? 'text-dark-7'
691
+ : 'text-grey-600'} font-bold pl-1"
592
692
  >
593
693
  / ${product.periode}
594
694
  </h6>
@@ -611,12 +711,7 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
611
711
  }
612
712
  packagesSection(data) {
613
713
  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>
714
+ <div class="flex flex-col w-full items-center mt-8 lg:mt-2 px-4">
620
715
  ${data.memberships.map(item => item.isHighlight
621
716
  ? this.primaryPackages(item)
622
717
  : this.secondaryPackages(item))}
@@ -627,7 +722,7 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
627
722
  return html `
628
723
  <div class="flex lg:hidden items-center w-full pb-4 ">
629
724
  <button
630
- @click=${() => this.redirectToPrevUrl()}
725
+ @click=${this.redirectToPrevUrl}
631
726
  class="text-xs md:text-lg text-white flex flex-row"
632
727
  >
633
728
  <div class="icon-lg icon-white w-4 h-4 mr-3.5 md:mr-5 pt-0.5">
@@ -640,94 +735,92 @@ let KompasIdPaywallBody = class KompasIdPaywallBody extends LitElement {
640
735
  }
641
736
  helpDesk() {
642
737
  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
738
  <div
657
- class="flex flex-row text-white px-2 py-2.5 space-x-4 md:space-x-8 self-center"
739
+ class="${this.isDark
740
+ ? 'text-dark-7'
741
+ : 'text-white'} self-center text-xs md:text-sm"
658
742
  >
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>
743
+ Butuh bantuan? Hubungi
663
744
  <button
664
- @click=${() => this.redirectToRegister()}
665
- class="h-auto ${this.isDark
666
- ? 'bg-blue-300'
667
- : 'bg-grey-100'} rounded mr-3"
745
+ @click=${this.customerServiceClicked}
746
+ class="font-bold underline"
668
747
  >
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>
748
+ Layanan Pelanggan.
676
749
  </button>
677
750
  </div>
678
751
  `;
679
752
  }
680
- userAction(isLogin, type) {
753
+ userAction() {
681
754
  return html `
682
755
  <div
683
- class="flex h-20 ${this.isDark
756
+ class="flex py-5 px-8 md:py-6 ${this.isDark
684
757
  ? 'bg-dark-4'
685
- : 'bg-blue-600'} w-full justify-evenly rounded-b mt-6 md:mt-8 relative"
758
+ : 'bg-blue-600'} w-full justify-evenly rounded-b-xl mt-6 md:mt-8 relative"
686
759
  >
687
- ${isLogin || type !== 'epaper' ? this.helpDesk() : this.authRegister()}
760
+ ${this.helpDesk()}
688
761
  </div>
689
762
  `;
690
763
  }
764
+ /**
765
+ * Render Statement
766
+ */
691
767
  render() {
692
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
768
+ var _a, _b, _c, _d, _e, _f, _g, _h;
693
769
  return html `
694
770
  <div
695
771
  class="${this.type === 'epaper'
696
- ? 'bg-transparent wrapper-body'
772
+ ? 'bg-transparent wrapper-body mx-2'
697
773
  : 'wrapper-body'}"
698
774
  >
699
775
  <div
700
- class="flex flex-col justify-center items-center w-full max-w-screen-sm px-4 md:px-0 my-5 relative"
776
+ class="flex flex-col justify-center items-center w-full max-w-screen-sm my-5 relative"
701
777
  >
702
- ${this.type === 'epaper' ? this.topNavigator() : ''}
778
+ ${this.type === 'epaper' ? this.topNavigator() : nothing}
703
779
  <div
704
780
  class="flex w-full flex-col items-center justify-center ${this
705
781
  .isDark
706
782
  ? 'bg-dark-3'
707
- : 'bg-blue-100'} rounded pt-6 md:pt-8 relative"
783
+ : 'bg-blue-100'} rounded-xl pt-6 md:pt-8 relative"
708
784
  >
709
785
  ${this.headerSection(this.type)}
710
786
  ${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
787
  ${this.packagesSection((_e = (_d = this.paywallData) === null || _d === void 0 ? void 0 : _d.packages) !== null && _e !== void 0 ? _e : {})}
712
788
  ${this.informationPackages()}
713
- ${this.swgEnable ? this.separatorLine() : null}
789
+ ${this.swgEnable ? this.separatorLine() : nothing}
714
790
  ${this.swgEnable
715
791
  ? 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()}
792
+ class="${this.isDark
793
+ ? 'bg-grey-600'
794
+ : 'border-2 bg-grey-100 border-grey-100'} rounded-lg px-6 shadow-sm flex flex-row py-2 mt-1 items-center"
795
+ id="subscribe-with-google"
796
+ >
797
+ <p class=${this.isDark ? 'text-dark-7' : 'text-grey-500'}>
798
+ Subscribe with
799
+ </p>
800
+ <img
801
+ class="pl-2 object-scale-down w-20 pt-0.5"
802
+ src=${this.isDark
803
+ ? 'https://kompasid-production-www.s3.ap-southeast-1.amazonaws.com/paywall-asset/google-white.png'
804
+ : 'https://kompasid-production-www.s3.ap-southeast-1.amazonaws.com/paywall-asset/google.png'}
805
+ alt="subscribe with google"
806
+ />
807
+ </button>`
808
+ : nothing}
809
+ ${!this.isLogin
810
+ ? html `
811
+ <div
812
+ class="border-b ${this.isDark
813
+ ? 'border-dark-8'
814
+ : 'border-blue-200'} w-1/5 my-4 flex justify-center"
815
+ ></div>
816
+ ${this.registrationSection(this.type)}
817
+ `
818
+ : nothing}
819
+ ${this.userAction()} ${this.sendDataLayeronPaywallBody()}
727
820
  </div>
728
821
  ${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
- : ''}
822
+ ? 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 : [])
823
+ : nothing}
731
824
  </div>
732
825
  </div>
733
826
  `;
@@ -741,6 +834,10 @@ KompasIdPaywallBody.styles = [
741
834
  justify-items: center;
742
835
  align-items: center;
743
836
  }
837
+
838
+ .font-lora {
839
+ font-family: 'Lora', 'Georgia', 'serif';
840
+ }
744
841
  `,
745
842
  TWStyles,
746
843
  ];