@kompasid/lit-web-components 0.4.4 → 0.5.0

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 (53) hide show
  1. package/assets/font-awesome.ts +7 -4
  2. package/demo/index.html +147 -118
  3. package/dist/assets/font-awesome.d.ts +1 -1
  4. package/dist/assets/font-awesome.js +7 -4
  5. package/dist/assets/font-awesome.js.map +1 -1
  6. package/dist/src/components/kompasid-freewall/KompasFreewall.d.ts +91 -0
  7. package/dist/src/components/kompasid-freewall/KompasFreewall.js +256 -0
  8. package/dist/src/components/kompasid-freewall/KompasFreewall.js.map +1 -0
  9. package/dist/src/components/kompasid-freewall/types.d.ts +10 -0
  10. package/dist/src/components/kompasid-freewall/types.js +2 -0
  11. package/dist/src/components/kompasid-freewall/types.js.map +1 -0
  12. package/dist/src/components/kompasid-freewall-body/KompasFreewallBody.d.ts +33 -0
  13. package/dist/src/components/kompasid-freewall-body/KompasFreewallBody.js +223 -0
  14. package/dist/src/components/kompasid-freewall-body/KompasFreewallBody.js.map +1 -0
  15. package/dist/src/components/kompasid-freewall-head/KompasFreewallHead.d.ts +37 -0
  16. package/dist/src/components/kompasid-freewall-head/KompasFreewallHead.js +122 -0
  17. package/dist/src/components/kompasid-freewall-head/KompasFreewallHead.js.map +1 -0
  18. package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.d.ts +0 -1
  19. package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js +3 -8
  20. package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js.map +1 -1
  21. package/dist/src/components/kompasid-paywall-video/KompasPaywallVideo.d.ts +12 -13
  22. package/dist/src/components/kompasid-paywall-video/KompasPaywallVideo.js +30 -49
  23. package/dist/src/components/kompasid-paywall-video/KompasPaywallVideo.js.map +1 -1
  24. package/dist/src/index.d.ts +1 -0
  25. package/dist/src/index.js +1 -0
  26. package/dist/src/index.js.map +1 -1
  27. package/dist/src/utils/cta.d.ts +6 -0
  28. package/dist/src/utils/cta.js +18 -0
  29. package/dist/src/utils/cta.js.map +1 -0
  30. package/dist/src/utils/generateCopyDuration.d.ts +1 -0
  31. package/dist/src/utils/generateCopyDuration.js +15 -0
  32. package/dist/src/utils/generateCopyDuration.js.map +1 -0
  33. package/dist/src/utils/googleFont.js +1 -0
  34. package/dist/src/utils/googleFont.js.map +1 -1
  35. package/dist/tailwind/tailwind.js +215 -0
  36. package/dist/tailwind/tailwind.js.map +1 -1
  37. package/dist/tsconfig.tsbuildinfo +1 -1
  38. package/package.json +1 -1
  39. package/src/components/kompasid-freewall/KompasFreewall.ts +205 -0
  40. package/src/components/kompasid-freewall/readme.md +31 -0
  41. package/src/components/kompasid-freewall/types.ts +10 -0
  42. package/src/components/kompasid-freewall-body/KompasFreewallBody.ts +219 -0
  43. package/src/components/kompasid-freewall-body/readme.md +13 -0
  44. package/src/components/kompasid-freewall-head/KompasFreewallHead.ts +102 -0
  45. package/src/components/kompasid-freewall-head/readme.md +17 -0
  46. package/src/components/kompasid-paywall-body/KompasPaywallBody.ts +3 -9
  47. package/src/components/kompasid-paywall-video/KompasPaywallVideo.ts +36 -51
  48. package/src/index.ts +1 -0
  49. package/src/utils/cta.ts +25 -0
  50. package/src/utils/generateCopyDuration.ts +14 -0
  51. package/src/utils/googleFont.ts +2 -0
  52. package/tailwind/tailwind.css +215 -0
  53. package/tailwind/tailwind.ts +215 -0
@@ -6,6 +6,8 @@ import { TWStyles } from '../../../tailwind/tailwind.js';
6
6
  import { deviceType } from '../../utils/deviceType.js';
7
7
  import { formatRupiah } from '../../utils/formatRupiah.js';
8
8
  import { addGoogleFonts } from '../../utils/googleFont.js';
9
+ import { generateCopyDuration } from '../../utils/generateCopyDuration.js';
10
+ import { redirectToCheckout, redirectToLogin, redirectToRegister, } from '../../utils/cta.js';
9
11
  let KompasPaywallVideo = class KompasPaywallVideo extends LitElement {
10
12
  constructor() {
11
13
  super(...arguments);
@@ -48,11 +50,21 @@ let KompasPaywallVideo = class KompasPaywallVideo extends LitElement {
48
50
  this.tracker_metered_wall_type = '';
49
51
  this.tracker_metered_wall_balance = 0;
50
52
  this.type = 'article';
53
+ this.showPackage = {
54
+ duration: 1,
55
+ durationType: 3,
56
+ id: '9802035',
57
+ link: 'kdp?productId=9802035&referrer=',
58
+ price: 50000,
59
+ position: 1,
60
+ title: 'Kompas Digital Premium 1 Bulan',
61
+ referrer: '',
62
+ };
51
63
  /**
52
64
  * State
53
65
  */
54
66
  this.subscriptionUrl = 'https://www.kompas.id/berlangganan';
55
- this.checkoutHost = 'https://checkoutv2.kompas.id';
67
+ this.packageData = {};
56
68
  }
57
69
  /**
58
70
  * Component
@@ -64,7 +76,7 @@ let KompasPaywallVideo = class KompasPaywallVideo extends LitElement {
64
76
  >
65
77
  <div>
66
78
  <button
67
- @click=${() => this.redirectToRegister('Daftar')}
79
+ @click=${() => this.onRegisterClick('Daftar')}
68
80
  class="text-blue-300 font-bold"
69
81
  >
70
82
  Daftar
@@ -74,7 +86,7 @@ let KompasPaywallVideo = class KompasPaywallVideo extends LitElement {
74
86
  <div>
75
87
  <span>Sudah punya akun? </span>
76
88
  <button
77
- @click=${this.redirectToLogin}
89
+ @click=${() => redirectToLogin('video_paywall')}
78
90
  class="text-blue-300 font-bold"
79
91
  >
80
92
  Masuk<span class="text-grey-300 font-normal">.</span>
@@ -101,8 +113,8 @@ let KompasPaywallVideo = class KompasPaywallVideo extends LitElement {
101
113
  @click=${this.redirectToSelectedPackage}
102
114
  class="bg-green-500 rounded md:rounded-lg h-8 md:h-12 px-4 md:px-6 text-sm md:text-lg text-white font-bold leading-[18px]"
103
115
  >
104
- Langganan ${formatRupiah(this.showPackage.price)}
105
- /${this.generateCopyDuration(this.showPackage.durationType)}
116
+ Langganan ${formatRupiah(this.packageData.price)}
117
+ /${generateCopyDuration(this.packageData.durationType)}
106
118
  </button>
107
119
  <button
108
120
  @click=${this.redirectToBerlangganan}
@@ -124,10 +136,10 @@ let KompasPaywallVideo = class KompasPaywallVideo extends LitElement {
124
136
  const baseData = {
125
137
  event,
126
138
  paywall_location: this.paywall_location,
127
- paywall_subscription_package: this.paywall_subscription_package || this.showPackage.title,
128
- paywall_subscription_id: this.paywall_subscription_id || this.showPackage.id,
129
- paywall_subscription_price: this.paywall_subscription_price || this.showPackage.price,
130
- paywall_position: this.paywall_position || this.showPackage.position,
139
+ paywall_subscription_package: this.paywall_subscription_package || this.packageData.title,
140
+ paywall_subscription_id: this.paywall_subscription_id || this.packageData.id,
141
+ paywall_subscription_price: this.paywall_subscription_price || this.packageData.price,
142
+ paywall_position: this.paywall_position || this.packageData.position,
131
143
  user_type: this.tracker_user_type,
132
144
  subscription_status: this.tracker_subscription_status,
133
145
  page_domain: this.tracker_page_domain || 'Kompas.id',
@@ -174,61 +186,30 @@ let KompasPaywallVideo = class KompasPaywallVideo extends LitElement {
174
186
  get isArticle() {
175
187
  return this.type === 'article';
176
188
  }
177
- // temporary mocking data package for component and dataLayer
178
- get showPackage() {
179
- return {
180
- duration: 1,
181
- durationType: 3,
182
- id: '9802035',
183
- link: 'kdp?productId=9802035&referrer=https%3A%2F%2Fwww.kompas.cloud%2Fberlangganan',
184
- price: 50000,
185
- position: 1,
186
- title: 'Kompas Digital Premium 1 Bulan',
187
- };
188
- }
189
189
  /**
190
190
  * Logic Function
191
191
  */
192
- redirectToRegister(triggerClick) {
192
+ onRegisterClick(triggerClick) {
193
193
  this.sendDataLayeronButtonLogin(triggerClick);
194
- const registerHost = 'https://account.kompas.id/register';
195
- const nextParams = encodeURIComponent(window.location.href);
196
- const directUrlRegister = `${registerHost}?next=${nextParams}?status=sukses_login&status_login=login&loc=video_paywall`;
197
- window.open(directUrlRegister, '_blank');
198
- }
199
- redirectToLogin() {
200
- const loginHost = 'https://account.kompas.id/login';
201
- const nextParams = encodeURIComponent(window.location.href);
202
- const directUrlLogin = `${loginHost}?next=${nextParams}&loc=video_paywall`;
203
- window.open(directUrlLogin, '_blank');
194
+ redirectToRegister('video_paywall');
204
195
  }
205
196
  redirectToSelectedPackage() {
206
- const url = `${this.checkoutHost}/${this.showPackage.link}&source=${this.type}`;
207
197
  this.sendDataLayerSubscribeButtonClicked();
208
- window.open(url, '_blank');
198
+ redirectToCheckout({
199
+ link: `${this.packageData.link}${this.packageData.referrer}`,
200
+ source: this.type,
201
+ });
209
202
  }
210
203
  redirectToBerlangganan() {
211
204
  this.sendDataLayerOtherPackagesClicked();
212
205
  window.open(this.subscriptionUrl, '_blank');
213
206
  }
214
- generateCopyDuration(type) {
215
- switch (type) {
216
- case 1:
217
- return 'hari';
218
- case 2:
219
- return 'minggu';
220
- case 3:
221
- return 'bulan';
222
- case 4:
223
- return 'tahun';
224
- default:
225
- return '';
226
- }
227
- }
228
207
  async connectedCallback() {
229
208
  super.connectedCallback();
230
209
  await this.updateComplete;
231
210
  addGoogleFonts(['pt-sans']);
211
+ const originHost = encodeURIComponent(window.location.href);
212
+ this.packageData = { ...this.showPackage, referrer: originHost };
232
213
  }
233
214
  /**
234
215
  * Render Statement
@@ -307,7 +288,7 @@ __decorate([
307
288
  ], KompasPaywallVideo.prototype, "subscriptionUrl", void 0);
308
289
  __decorate([
309
290
  state()
310
- ], KompasPaywallVideo.prototype, "checkoutHost", void 0);
291
+ ], KompasPaywallVideo.prototype, "packageData", void 0);
311
292
  KompasPaywallVideo = __decorate([
312
293
  customElement('kompasid-paywall-video')
313
294
  ], KompasPaywallVideo);
@@ -1 +1 @@
1
- {"version":3,"file":"KompasPaywallVideo.js","sourceRoot":"","sources":["../../../../src/components/kompasid-paywall-video/KompasPaywallVideo.ts"],"names":[],"mappings":";AAAA,2CAA2C;AAC3C,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AACxD,OAAO,EAAE,UAAU,EAA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E,MAAM,EAAE,CAAC;6DAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uEAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+DAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qEAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wEAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAyC;AAM3D;IAAR,KAAK,EAAE;2DAC8B;AAC7B;IAAR,KAAK,EAAE;wDAA8D;AAzD3D,kBAAkB;IAD9B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,kBAAkB,CAiR9B;SAjRY,kBAAkB","sourcesContent":["/* eslint-disable class-methods-use-this */\nimport { html, css, LitElement, nothing } from 'lit'\nimport { property, customElement, state } from 'lit/decorators.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { deviceType } from '../../utils/deviceType.js'\nimport { formatRupiah } from '../../utils/formatRupiah.js'\nimport { addGoogleFonts } from '../../utils/googleFont.js'\n\n@customElement('kompasid-paywall-video')\nexport class KompasPaywallVideo extends LitElement {\n static styles = [\n css`\n :host {\n font-family: 'PT Sans', sans-serif;\n }\n `,\n TWStyles,\n ]\n\n /**\n * Props\n */\n /**\n * prop isLogin untuk menghandle apakah user sudah login atau belum\n * prop paywall_location = The location where user encounter the paywall\n * prop paywall_subscription_package = The name of the subscription package viewed by user\n * prop paywall_subscription_id = The ID of the subscription package viewed by user\n * prop paywall_subscription_price = The price of the subscriprtion package viewed by user\n * prop paywall_position = The position of the subscription package viewed by user\n * prop page_type = Type of the page\n * prop content_id = ID of article (slug)\n * prop content_type = Whether it's free article or paid article\n * prop content_title = The title of article\n * prop tracker_content_categories = The category of the content\n * prop user_type = Type of user based on their subscription\n * prop subscription_status = Status of their subscription\n * prop page_domain = Page Domain\n * prop metered_wall_type = The type of Metered Wall\n * prop metered_wall_balance = The balance of their metered wall\n * prop type = The type of video paywall\n */\n\n @property({ type: Boolean }) isLogin = false\n @property({ type: String }) paywall_location = ''\n @property({ type: String }) paywall_subscription_package = ''\n @property({ type: String }) paywall_subscription_id = ''\n @property({ type: Number }) paywall_subscription_price = 0\n @property({ type: Number }) paywall_position = 0\n @property({ type: String }) tracker_page_type = ''\n @property({ type: String }) tracker_content_id = ''\n @property({ type: String }) tracker_content_title = ''\n @property({ type: String }) tracker_content_categories = ''\n @property({ type: String }) tracker_content_type = ''\n @property({ type: String }) tracker_user_type = ''\n @property({ type: String }) tracker_subscription_status = ''\n @property({ type: String }) tracker_page_domain = ''\n @property({ type: String }) tracker_metered_wall_type = ''\n @property({ type: Number }) tracker_metered_wall_balance = 0\n @property({ type: String }) type: 'article' | 'homepage' = 'article'\n\n /**\n * State\n */\n\n @state() private subscriptionUrl: string =\n 'https://www.kompas.id/berlangganan'\n @state() private checkoutHost: string = 'https://checkoutv2.kompas.id'\n\n /**\n * Component\n */\n\n private regulerRegistrationSection() {\n return html`\n <div\n class=\"flex flex-col text-grey-300 text-sm md:text-base items-center justify-center\"\n >\n <div>\n <button\n @click=${() => this.redirectToRegister('Daftar')}\n class=\"text-blue-300 font-bold\"\n >\n Daftar\n </button>\n <span> untuk akses konten gratis.</span>\n </div>\n <div>\n <span>Sudah punya akun? </span>\n <button\n @click=${this.redirectToLogin}\n class=\"text-blue-300 font-bold\"\n >\n Masuk<span class=\"text-grey-300 font-normal\">.</span>\n </button>\n </div>\n </div>\n `\n }\n\n private defaultComponent() {\n return html`\n <div class=\"flex flex-col items-center space-y-2 md:space-y-4\">\n ${this.sendDataLayeronNonLogin()} ${this.sendDataLayerPaywallViewed()}\n <h5\n class=\"leading-5 md:leading-6 w-[296px] md:w-[400px] text-white text-center text-base mb-2 md:mb-0 ${!this\n .isLogin &&\n !this.isArticle &&\n 'mb-0'} md:text-xl max-w-xl\"\n >\n ${this.isArticle\n ? 'Langganan untuk lanjut menonton video'\n : 'Langganan sekarang untuk akses seluruh konten Kompas.id'}\n </h5>\n <button\n @click=${this.redirectToSelectedPackage}\n class=\"bg-green-500 rounded md:rounded-lg h-8 md:h-12 px-4 md:px-6 text-sm md:text-lg text-white font-bold leading-[18px]\"\n >\n Langganan ${formatRupiah(this.showPackage.price)}\n /${this.generateCopyDuration(this.showPackage.durationType)}\n </button>\n <button\n @click=${this.redirectToBerlangganan}\n class=\"text-sm md:text-lg leading-[22px] text-white font-bold underline ${!this\n .isLogin && this.isArticle\n ? 'pb-3'\n : 'pb-2'} md:pb-4\"\n >\n Paket Lainnya\n </button>\n ${!this.isLogin ? this.regulerRegistrationSection() : nothing}\n </div>\n `\n }\n\n /**\n * Data Layer\n */\n\n private sendDataLayer(event: string): void {\n const baseData = {\n event,\n paywall_location: this.paywall_location,\n paywall_subscription_package:\n this.paywall_subscription_package || this.showPackage.title,\n paywall_subscription_id:\n this.paywall_subscription_id || this.showPackage.id,\n paywall_subscription_price:\n this.paywall_subscription_price || this.showPackage.price,\n paywall_position: this.paywall_position || this.showPackage.position,\n user_type: this.tracker_user_type,\n subscription_status: this.tracker_subscription_status,\n page_domain: this.tracker_page_domain || 'Kompas.id',\n metered_wall_type: this.tracker_metered_wall_type || 'HP',\n metered_wall_balance: this.tracker_metered_wall_balance,\n }\n\n const data = this.isArticle\n ? {\n ...baseData,\n page_type: this.tracker_page_type,\n content_id: this.tracker_content_id,\n content_title: this.tracker_content_title,\n content_categories: this.tracker_content_categories,\n content_type: this.tracker_content_type,\n }\n : baseData\n\n window.dataLayer.push(data)\n }\n\n private sendDataLayerPaywallViewed(): void {\n this.sendDataLayer('paywall_viewed')\n }\n\n private sendDataLayerSubscribeButtonClicked(): void {\n this.sendDataLayer('subscribe_button_clicked')\n }\n\n private sendDataLayerOtherPackagesClicked(): void {\n this.sendDataLayer('other_packages_clicked')\n }\n\n private sendDataLayeronButtonLogin(triggerClick: string): void {\n window.dataLayer.push({\n event: 'registrationOfferClick',\n interface: deviceType(),\n buttonClicked: triggerClick,\n })\n }\n\n private sendDataLayeronNonLogin(): void {\n window.dataLayer.push({\n event: 'registrationOfferimppression',\n interface: deviceType(),\n })\n }\n\n /**\n * Getter\n */\n\n get isArticle() {\n return this.type === 'article'\n }\n\n // temporary mocking data package for component and dataLayer\n get showPackage() {\n return {\n duration: 1,\n durationType: 3,\n id: '9802035',\n link: 'kdp?productId=9802035&referrer=https%3A%2F%2Fwww.kompas.cloud%2Fberlangganan',\n price: 50000,\n position: 1,\n title: 'Kompas Digital Premium 1 Bulan',\n }\n }\n\n /**\n * Logic Function\n */\n\n private redirectToRegister(triggerClick: string): void {\n this.sendDataLayeronButtonLogin(triggerClick)\n const registerHost: string = 'https://account.kompas.id/register'\n const nextParams: string = encodeURIComponent(window.location.href)\n const directUrlRegister: string = `${registerHost}?next=${nextParams}?status=sukses_login&status_login=login&loc=video_paywall`\n window.open(directUrlRegister, '_blank')\n }\n\n private redirectToLogin(): void {\n const loginHost: string = 'https://account.kompas.id/login'\n const nextParams: string = encodeURIComponent(window.location.href)\n const directUrlLogin: string = `${loginHost}?next=${nextParams}&loc=video_paywall`\n window.open(directUrlLogin, '_blank')\n }\n\n private redirectToSelectedPackage(): void {\n const url = `${this.checkoutHost}/${this.showPackage.link}&source=${this.type}`\n this.sendDataLayerSubscribeButtonClicked()\n window.open(url, '_blank')\n }\n\n private redirectToBerlangganan(): void {\n this.sendDataLayerOtherPackagesClicked()\n window.open(this.subscriptionUrl, '_blank')\n }\n\n private generateCopyDuration(type: number): string {\n switch (type) {\n case 1:\n return 'hari'\n case 2:\n return 'minggu'\n case 3:\n return 'bulan'\n case 4:\n return 'tahun'\n default:\n return ''\n }\n }\n\n override async connectedCallback() {\n super.connectedCallback()\n await this.updateComplete\n addGoogleFonts(['pt-sans'])\n }\n\n /**\n * Render Statement\n */\n\n render() {\n return html`\n <div\n class=\"radius absolute z-20 bg-black bg-opacity-75 p-4 top-0 bottom-0 left-0 flex flex-col w-full h-full justify-center items-center\"\n >\n ${this.defaultComponent()}\n </div>\n `\n }\n}\n"]}
1
+ {"version":3,"file":"KompasPaywallVideo.js","sourceRoot":"","sources":["../../../../src/components/kompasid-paywall-video/KompasPaywallVideo.ts"],"names":[],"mappings":";AAAA,2CAA2C;AAC3C,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAE1E,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,kBAAkB,GACnB,MAAM,oBAAoB,CAAA;AAGpB,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,UAAU;IAA3C;;QAUL;;WAEG;QACH;;;;;;;;;;;;;;;;;;WAkBG;QAE0B,YAAO,GAAG,KAAK,CAAA;QAChB,qBAAgB,GAAG,EAAE,CAAA;QACrB,iCAA4B,GAAG,EAAE,CAAA;QACjC,4BAAuB,GAAG,EAAE,CAAA;QAC5B,+BAA0B,GAAG,CAAC,CAAA;QAC9B,qBAAgB,GAAG,CAAC,CAAA;QACpB,sBAAiB,GAAG,EAAE,CAAA;QACtB,uBAAkB,GAAG,EAAE,CAAA;QACvB,0BAAqB,GAAG,EAAE,CAAA;QAC1B,+BAA0B,GAAG,EAAE,CAAA;QAC/B,yBAAoB,GAAG,EAAE,CAAA;QACzB,sBAAiB,GAAG,EAAE,CAAA;QACtB,gCAA2B,GAAG,EA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AE,CAAC;6DAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uEAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+DAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qEAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wEAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAyC;AAiB3D;IAAR,KAAK,EAAE;2DAC8B;AAC7B;IAAR,KAAK,EAAE;uDAAqD;AApElD,kBAAkB;IAD9B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,kBAAkB,CA2P9B;SA3PY,kBAAkB","sourcesContent":["/* eslint-disable class-methods-use-this */\nimport { html, css, LitElement, nothing } from 'lit'\nimport { property, customElement, state } from 'lit/decorators.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { deviceType } from '../../utils/deviceType.js'\nimport { formatRupiah } from '../../utils/formatRupiah.js'\nimport { addGoogleFonts } from '../../utils/googleFont.js'\nimport { generateCopyDuration } from '../../utils/generateCopyDuration.js'\nimport { PackageData } from '../kompasid-freewall/types.js'\nimport {\n redirectToCheckout,\n redirectToLogin,\n redirectToRegister,\n} from '../../utils/cta.js'\n\n@customElement('kompasid-paywall-video')\nexport class KompasPaywallVideo extends LitElement {\n static styles = [\n css`\n :host {\n font-family: 'PT Sans', sans-serif;\n }\n `,\n TWStyles,\n ]\n\n /**\n * Props\n */\n /**\n * prop isLogin untuk menghandle apakah user sudah login atau belum\n * prop paywall_location = The location where user encounter the paywall\n * prop paywall_subscription_package = The name of the subscription package viewed by user\n * prop paywall_subscription_id = The ID of the subscription package viewed by user\n * prop paywall_subscription_price = The price of the subscriprtion package viewed by user\n * prop paywall_position = The position of the subscription package viewed by user\n * prop page_type = Type of the page\n * prop content_id = ID of article (slug)\n * prop content_type = Whether it's free article or paid article\n * prop content_title = The title of article\n * prop tracker_content_categories = The category of the content\n * prop user_type = Type of user based on their subscription\n * prop subscription_status = Status of their subscription\n * prop page_domain = Page Domain\n * prop metered_wall_type = The type of Metered Wall\n * prop metered_wall_balance = The balance of their metered wall\n * prop type = The type of video paywall\n */\n\n @property({ type: Boolean }) isLogin = false\n @property({ type: String }) paywall_location = ''\n @property({ type: String }) paywall_subscription_package = ''\n @property({ type: String }) paywall_subscription_id = ''\n @property({ type: Number }) paywall_subscription_price = 0\n @property({ type: Number }) paywall_position = 0\n @property({ type: String }) tracker_page_type = ''\n @property({ type: String }) tracker_content_id = ''\n @property({ type: String }) tracker_content_title = ''\n @property({ type: String }) tracker_content_categories = ''\n @property({ type: String }) tracker_content_type = ''\n @property({ type: String }) tracker_user_type = ''\n @property({ type: String }) tracker_subscription_status = ''\n @property({ type: String }) tracker_page_domain = ''\n @property({ type: String }) tracker_metered_wall_type = ''\n @property({ type: Number }) tracker_metered_wall_balance = 0\n @property({ type: String }) type: 'article' | 'homepage' = 'article'\n\n showPackage = {\n duration: 1,\n durationType: 3,\n id: '9802035',\n link: 'kdp?productId=9802035&referrer=',\n price: 50000,\n position: 1,\n title: 'Kompas Digital Premium 1 Bulan',\n referrer: '',\n }\n\n /**\n * State\n */\n\n @state() private subscriptionUrl: string =\n 'https://www.kompas.id/berlangganan'\n @state() private packageData: PackageData = {} as PackageData\n\n /**\n * Component\n */\n\n private regulerRegistrationSection() {\n return html`\n <div\n class=\"flex flex-col text-grey-300 text-sm md:text-base items-center justify-center\"\n >\n <div>\n <button\n @click=${() => this.onRegisterClick('Daftar')}\n class=\"text-blue-300 font-bold\"\n >\n Daftar\n </button>\n <span> untuk akses konten gratis.</span>\n </div>\n <div>\n <span>Sudah punya akun? </span>\n <button\n @click=${() => redirectToLogin('video_paywall')}\n class=\"text-blue-300 font-bold\"\n >\n Masuk<span class=\"text-grey-300 font-normal\">.</span>\n </button>\n </div>\n </div>\n `\n }\n\n private defaultComponent() {\n return html`\n <div class=\"flex flex-col items-center space-y-2 md:space-y-4\">\n ${this.sendDataLayeronNonLogin()} ${this.sendDataLayerPaywallViewed()}\n <h5\n class=\"leading-5 md:leading-6 w-[296px] md:w-[400px] text-white text-center text-base mb-2 md:mb-0 ${!this\n .isLogin &&\n !this.isArticle &&\n 'mb-0'} md:text-xl max-w-xl\"\n >\n ${this.isArticle\n ? 'Langganan untuk lanjut menonton video'\n : 'Langganan sekarang untuk akses seluruh konten Kompas.id'}\n </h5>\n <button\n @click=${this.redirectToSelectedPackage}\n class=\"bg-green-500 rounded md:rounded-lg h-8 md:h-12 px-4 md:px-6 text-sm md:text-lg text-white font-bold leading-[18px]\"\n >\n Langganan ${formatRupiah(this.packageData.price)}\n /${generateCopyDuration(this.packageData.durationType)}\n </button>\n <button\n @click=${this.redirectToBerlangganan}\n class=\"text-sm md:text-lg leading-[22px] text-white font-bold underline ${!this\n .isLogin && this.isArticle\n ? 'pb-3'\n : 'pb-2'} md:pb-4\"\n >\n Paket Lainnya\n </button>\n ${!this.isLogin ? this.regulerRegistrationSection() : nothing}\n </div>\n `\n }\n\n /**\n * Data Layer\n */\n\n private sendDataLayer(event: string): void {\n const baseData = {\n event,\n paywall_location: this.paywall_location,\n paywall_subscription_package:\n this.paywall_subscription_package || this.packageData.title,\n paywall_subscription_id:\n this.paywall_subscription_id || this.packageData.id,\n paywall_subscription_price:\n this.paywall_subscription_price || this.packageData.price,\n paywall_position: this.paywall_position || this.packageData.position,\n user_type: this.tracker_user_type,\n subscription_status: this.tracker_subscription_status,\n page_domain: this.tracker_page_domain || 'Kompas.id',\n metered_wall_type: this.tracker_metered_wall_type || 'HP',\n metered_wall_balance: this.tracker_metered_wall_balance,\n }\n\n const data = this.isArticle\n ? {\n ...baseData,\n page_type: this.tracker_page_type,\n content_id: this.tracker_content_id,\n content_title: this.tracker_content_title,\n content_categories: this.tracker_content_categories,\n content_type: this.tracker_content_type,\n }\n : baseData\n\n window.dataLayer.push(data)\n }\n\n private sendDataLayerPaywallViewed(): void {\n this.sendDataLayer('paywall_viewed')\n }\n\n private sendDataLayerSubscribeButtonClicked(): void {\n this.sendDataLayer('subscribe_button_clicked')\n }\n\n private sendDataLayerOtherPackagesClicked(): void {\n this.sendDataLayer('other_packages_clicked')\n }\n\n private sendDataLayeronButtonLogin(triggerClick: string): void {\n window.dataLayer.push({\n event: 'registrationOfferClick',\n interface: deviceType(),\n buttonClicked: triggerClick,\n })\n }\n\n private sendDataLayeronNonLogin(): void {\n window.dataLayer.push({\n event: 'registrationOfferimppression',\n interface: deviceType(),\n })\n }\n\n /**\n * Getter\n */\n\n get isArticle() {\n return this.type === 'article'\n }\n\n /**\n * Logic Function\n */\n\n private onRegisterClick(triggerClick: string): void {\n this.sendDataLayeronButtonLogin(triggerClick)\n redirectToRegister('video_paywall')\n }\n\n private redirectToSelectedPackage(): void {\n this.sendDataLayerSubscribeButtonClicked()\n redirectToCheckout({\n link: `${this.packageData.link}${this.packageData.referrer}`,\n source: this.type,\n })\n }\n\n private redirectToBerlangganan(): void {\n this.sendDataLayerOtherPackagesClicked()\n window.open(this.subscriptionUrl, '_blank')\n }\n\n override async connectedCallback() {\n super.connectedCallback()\n await this.updateComplete\n addGoogleFonts(['pt-sans'])\n\n const originHost: string = encodeURIComponent(window.location.href)\n this.packageData = { ...this.showPackage, referrer: originHost }\n }\n\n /**\n * Render Statement\n */\n\n render() {\n return html`\n <div\n class=\"radius absolute z-20 bg-black bg-opacity-75 p-4 top-0 bottom-0 left-0 flex flex-col w-full h-full justify-center items-center\"\n >\n ${this.defaultComponent()}\n </div>\n `\n }\n}\n"]}
@@ -2,6 +2,7 @@ export { KompasPaywall } from './components/kompasid-paywall/KompasPaywall.js';
2
2
  export { KompasFooter } from './components/kompasid-footer/KompasFooter.js';
3
3
  export { KompasPaywallVideo } from './components/kompasid-paywall-video/KompasPaywallVideo.js';
4
4
  export { KompasMeteredPaywall } from './components/kompasid-metered-paywall/KompasMeteredPaywall.js';
5
+ export { KompasFreewall } from './components/kompasid-freewall/KompasFreewall.js';
5
6
  declare global {
6
7
  interface Window {
7
8
  gtag: (...args: any[]) => void;
package/dist/src/index.js CHANGED
@@ -2,4 +2,5 @@ export { KompasPaywall } from './components/kompasid-paywall/KompasPaywall.js';
2
2
  export { KompasFooter } from './components/kompasid-footer/KompasFooter.js';
3
3
  export { KompasPaywallVideo } from './components/kompasid-paywall-video/KompasPaywallVideo.js';
4
4
  export { KompasMeteredPaywall } from './components/kompasid-metered-paywall/KompasMeteredPaywall.js';
5
+ export { KompasFreewall } from './components/kompasid-freewall/KompasFreewall.js';
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAA;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,8CAA8C,CAAA;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,2DAA2D,CAAA;AAC9F,OAAO,EAAE,oBAAoB,EAAE,MAAM,+DAA+D,CAAA","sourcesContent":["export { KompasPaywall } from './components/kompasid-paywall/KompasPaywall.js'\nexport { KompasFooter } from './components/kompasid-footer/KompasFooter.js'\nexport { KompasPaywallVideo } from './components/kompasid-paywall-video/KompasPaywallVideo.js'\nexport { KompasMeteredPaywall } from './components/kompasid-metered-paywall/KompasMeteredPaywall.js'\n\ndeclare global {\n interface Window {\n gtag: (...args: any[]) => void\n dataLayer: Record<string, any>\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAA;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,8CAA8C,CAAA;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,2DAA2D,CAAA;AAC9F,OAAO,EAAE,oBAAoB,EAAE,MAAM,+DAA+D,CAAA;AACpG,OAAO,EAAE,cAAc,EAAE,MAAM,kDAAkD,CAAA","sourcesContent":["export { KompasPaywall } from './components/kompasid-paywall/KompasPaywall.js'\nexport { KompasFooter } from './components/kompasid-footer/KompasFooter.js'\nexport { KompasPaywallVideo } from './components/kompasid-paywall-video/KompasPaywallVideo.js'\nexport { KompasMeteredPaywall } from './components/kompasid-metered-paywall/KompasMeteredPaywall.js'\nexport { KompasFreewall } from './components/kompasid-freewall/KompasFreewall.js'\n\ndeclare global {\n interface Window {\n gtag: (...args: any[]) => void\n dataLayer: Record<string, any>\n }\n}\n"]}
@@ -0,0 +1,6 @@
1
+ export declare function redirectToRegister(loc: string): void;
2
+ export declare function redirectToLogin(loc: string): void;
3
+ export declare function redirectToCheckout({ link, source, }: {
4
+ link: string;
5
+ source: string;
6
+ }): void;
@@ -0,0 +1,18 @@
1
+ export function redirectToRegister(loc) {
2
+ const loginHost = 'https://account.kompas.id/register';
3
+ const nextParams = encodeURIComponent(window.location.href);
4
+ const directUrlRegister = `${loginHost}?next=${nextParams}?status=sukses_login&status_login=login&loc=${loc}`;
5
+ window.location.href = directUrlRegister;
6
+ }
7
+ export function redirectToLogin(loc) {
8
+ const loginHost = 'https://account.kompas.id/login';
9
+ const nextParams = encodeURIComponent(window.location.href);
10
+ const directUrlLogin = `${loginHost}?next=${nextParams}&loc=${loc}`;
11
+ window.open(directUrlLogin, '_blank');
12
+ }
13
+ export function redirectToCheckout({ link, source, }) {
14
+ const checkoutHost = 'https://checkoutv2.kompas.id';
15
+ const url = `${checkoutHost}/${link}&source=${source}`;
16
+ window.open(url, '_blank');
17
+ }
18
+ //# sourceMappingURL=cta.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cta.js","sourceRoot":"","sources":["../../../src/utils/cta.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,kBAAkB,CAAC,GAAW;IAC5C,MAAM,SAAS,GAAW,oCAAoC,CAAA;IAC9D,MAAM,UAAU,GAAW,kBAAkB,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IACnE,MAAM,iBAAiB,GAAW,GAAG,SAAS,SAAS,UAAU,+CAA+C,GAAG,EAAE,CAAA;IACrH,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,iBAAiB,CAAA;AAC1C,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,GAAW;IACzC,MAAM,SAAS,GAAW,iCAAiC,CAAA;IAC3D,MAAM,UAAU,GAAW,kBAAkB,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IACnE,MAAM,cAAc,GAAW,GAAG,SAAS,SAAS,UAAU,QAAQ,GAAG,EAAE,CAAA;IAC3E,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAA;AACvC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,EACjC,IAAI,EACJ,MAAM,GAIP;IACC,MAAM,YAAY,GAAG,8BAA8B,CAAA;IACnD,MAAM,GAAG,GAAG,GAAG,YAAY,IAAI,IAAI,WAAW,MAAM,EAAE,CAAA;IACtD,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;AAC5B,CAAC","sourcesContent":["export function redirectToRegister(loc: string): void {\n const loginHost: string = 'https://account.kompas.id/register'\n const nextParams: string = encodeURIComponent(window.location.href)\n const directUrlRegister: string = `${loginHost}?next=${nextParams}?status=sukses_login&status_login=login&loc=${loc}`\n window.location.href = directUrlRegister\n}\n\nexport function redirectToLogin(loc: string): void {\n const loginHost: string = 'https://account.kompas.id/login'\n const nextParams: string = encodeURIComponent(window.location.href)\n const directUrlLogin: string = `${loginHost}?next=${nextParams}&loc=${loc}`\n window.open(directUrlLogin, '_blank')\n}\n\nexport function redirectToCheckout({\n link,\n source,\n}: {\n link: string\n source: string\n}): void {\n const checkoutHost = 'https://checkoutv2.kompas.id'\n const url = `${checkoutHost}/${link}&source=${source}`\n window.open(url, '_blank')\n}\n"]}
@@ -0,0 +1 @@
1
+ export declare const generateCopyDuration: (type: number) => string;
@@ -0,0 +1,15 @@
1
+ export const generateCopyDuration = (type) => {
2
+ switch (type) {
3
+ case 1:
4
+ return 'hari';
5
+ case 2:
6
+ return 'minggu';
7
+ case 3:
8
+ return 'bulan';
9
+ case 4:
10
+ return 'tahun';
11
+ default:
12
+ return '';
13
+ }
14
+ };
15
+ //# sourceMappingURL=generateCopyDuration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateCopyDuration.js","sourceRoot":"","sources":["../../../src/utils/generateCopyDuration.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAU,EAAE;IAC3D,QAAQ,IAAI,EAAE;QACZ,KAAK,CAAC;YACJ,OAAO,MAAM,CAAA;QACf,KAAK,CAAC;YACJ,OAAO,QAAQ,CAAA;QACjB,KAAK,CAAC;YACJ,OAAO,OAAO,CAAA;QAChB,KAAK,CAAC;YACJ,OAAO,OAAO,CAAA;QAChB;YACE,OAAO,EAAE,CAAA;KACZ;AACH,CAAC,CAAA","sourcesContent":["export const generateCopyDuration = (type: number): string => {\n switch (type) {\n case 1:\n return 'hari'\n case 2:\n return 'minggu'\n case 3:\n return 'bulan'\n case 4:\n return 'tahun'\n default:\n return ''\n }\n}\n"]}
@@ -2,6 +2,7 @@ export const addGoogleFonts = (fonts) => {
2
2
  const fontMap = {
3
3
  lora: 'https://fonts.googleapis.com/css2?family=Lora:wght@700&display=swap',
4
4
  'pt-sans': 'https://fonts.googleapis.com/css2?family=PT+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap',
5
+ 'roboto-condensed': 'https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@500&display=swap',
5
6
  };
6
7
  fonts.forEach(font => {
7
8
  const fontCssUrl = fontMap[font];
@@ -1 +1 @@
1
- {"version":3,"file":"googleFont.js","sourceRoot":"","sources":["../../../src/utils/googleFont.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAe,EAAE,EAAE;IAChD,MAAM,OAAO,GAA8B;QACzC,IAAI,EAAE,qEAAqE;QAC3E,SAAS,EACP,iGAAiG;KACpG,CAAA;IAED,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACnB,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;QAChC,MAAM,eAAe,GAAG,QAAQ,CAAC,aAAa,CAAC,cAAc,UAAU,IAAI,CAAC,CAAA;QAE5E,IAAI,CAAC,eAAe,IAAI,UAAU,EAAE;YAClC,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;YACjD,UAAU,CAAC,YAAY,CAAC,KAAK,EAAE,YAAY,CAAC,CAAA;YAC5C,UAAU,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;YAC3C,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAA;SACtC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["export const addGoogleFonts = (fonts: string[]) => {\n const fontMap: { [key: string]: string } = {\n lora: 'https://fonts.googleapis.com/css2?family=Lora:wght@700&display=swap',\n 'pt-sans':\n 'https://fonts.googleapis.com/css2?family=PT+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap',\n }\n\n fonts.forEach(font => {\n const fontCssUrl = fontMap[font]\n const existingElement = document.querySelector(`link[href=\"${fontCssUrl}\"]`)\n\n if (!existingElement && fontCssUrl) {\n const newElement = document.createElement('link')\n newElement.setAttribute('rel', 'stylesheet')\n newElement.setAttribute('href', fontCssUrl)\n document.head.appendChild(newElement)\n }\n })\n}\n"]}
1
+ {"version":3,"file":"googleFont.js","sourceRoot":"","sources":["../../../src/utils/googleFont.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAe,EAAE,EAAE;IAChD,MAAM,OAAO,GAA8B;QACzC,IAAI,EAAE,qEAAqE;QAC3E,SAAS,EACP,iGAAiG;QACnG,kBAAkB,EAChB,iFAAiF;KACpF,CAAA;IAED,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACnB,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;QAChC,MAAM,eAAe,GAAG,QAAQ,CAAC,aAAa,CAAC,cAAc,UAAU,IAAI,CAAC,CAAA;QAE5E,IAAI,CAAC,eAAe,IAAI,UAAU,EAAE;YAClC,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;YACjD,UAAU,CAAC,YAAY,CAAC,KAAK,EAAE,YAAY,CAAC,CAAA;YAC5C,UAAU,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;YAC3C,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAA;SACtC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["export const addGoogleFonts = (fonts: string[]) => {\n const fontMap: { [key: string]: string } = {\n lora: 'https://fonts.googleapis.com/css2?family=Lora:wght@700&display=swap',\n 'pt-sans':\n 'https://fonts.googleapis.com/css2?family=PT+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap',\n 'roboto-condensed':\n 'https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@500&display=swap',\n }\n\n fonts.forEach(font => {\n const fontCssUrl = fontMap[font]\n const existingElement = document.querySelector(`link[href=\"${fontCssUrl}\"]`)\n\n if (!existingElement && fontCssUrl) {\n const newElement = document.createElement('link')\n newElement.setAttribute('rel', 'stylesheet')\n newElement.setAttribute('href', fontCssUrl)\n document.head.appendChild(newElement)\n }\n })\n}\n"]}