@kompasid/lit-web-components 0.5.0 → 0.5.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.
package/demo/index.html CHANGED
@@ -79,8 +79,8 @@
79
79
  const swgEnable = true
80
80
  const videoPaywallType = 'homepage'
81
81
  const freewallType = 'landing_page'
82
- const headCopyExpand = 'copy expand'
83
- const headCopyCollapse = 'copy collapse'
82
+ const headCopyExpand = ''
83
+ const headCopyCollapse = ''
84
84
  const expand = false
85
85
 
86
86
  render(
@@ -72,6 +72,7 @@ export declare class KompasFreewall extends LitElement {
72
72
  /**
73
73
  * Data Layer
74
74
  */
75
+ private prepareImpressionsData;
75
76
  private sendDataLayer;
76
77
  private sendDataLayerPaywallViewed;
77
78
  private sendDataLayerSubscribeButtonClicked;
@@ -80,9 +80,8 @@ let KompasFreewall = class KompasFreewall extends LitElement {
80
80
  /**
81
81
  * Data Layer
82
82
  */
83
- sendDataLayer(event) {
83
+ prepareImpressionsData() {
84
84
  const baseData = {
85
- event,
86
85
  paywall_location: this.paywall_location,
87
86
  paywall_subscription_package: this.paywall_subscription_package || this.packageData.title,
88
87
  paywall_subscription_id: this.paywall_subscription_id || this.packageData.id,
@@ -95,23 +94,30 @@ let KompasFreewall = class KompasFreewall extends LitElement {
95
94
  metered_wall_type: this.tracker_metered_wall_type || 'FP',
96
95
  metered_wall_balance: this.tracker_metered_wall_balance,
97
96
  };
98
- const data = this.isArticle
99
- ? {
97
+ if (this.isArticle) {
98
+ return {
100
99
  ...baseData,
101
100
  content_id: this.tracker_content_id,
102
101
  content_title: this.tracker_content_title,
103
102
  content_categories: this.tracker_content_categories,
104
103
  content_type: this.tracker_content_type,
105
- }
106
- : {
107
- ...baseData,
108
- page_title: this.tracker_page_title,
109
104
  };
105
+ }
106
+ return {
107
+ ...baseData,
108
+ page_title: this.tracker_page_title,
109
+ };
110
+ }
111
+ sendDataLayer(event, includeImpressions = false) {
112
+ const impressionsData = this.prepareImpressionsData();
113
+ const data = includeImpressions
114
+ ? { event, impressions: [impressionsData] }
115
+ : { event, ...impressionsData };
110
116
  window.dataLayer.push(data);
111
117
  }
112
118
  sendDataLayerPaywallViewed() {
113
119
  if (this.isExpand)
114
- this.sendDataLayer('paywall_viewed');
120
+ this.sendDataLayer('paywall_viewed', true);
115
121
  }
116
122
  sendDataLayerSubscribeButtonClicked() {
117
123
  this.sendDataLayer('subscribe_button_clicked');
@@ -146,9 +152,10 @@ let KompasFreewall = class KompasFreewall extends LitElement {
146
152
  */
147
153
  render() {
148
154
  return html `
149
- <div class="sticky bottom-0 w-full h-full z-20">
155
+ <div class="sticky bottom-0 w-full h-full z-20 top-shadow">
150
156
  <div
151
- class="flex flex-col w-full bg-blue-100 py-4 justify-center md:px-12 lg:px-24"
157
+ class="flex flex-col w-full bg-blue-100 justify-center ${this
158
+ .isExpand && 'pb-6 md:pb-7'} md:px-4 lg:px-24"
152
159
  >
153
160
  <kompasid-freewall-head
154
161
  .expand=${this.isExpand}
@@ -177,6 +184,10 @@ KompasFreewall.styles = [
177
184
  :host {
178
185
  font-family: 'PT Sans', sans-serif;
179
186
  }
187
+
188
+ .top-shadow {
189
+ box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.16);
190
+ }
180
191
  `,
181
192
  TWStyles,
182
193
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"KompasFreewall.js","sourceRoot":"","sources":["../../../../src/components/kompasid-freewall/KompasFreewall.ts"],"names":[],"mappings":";AAAA,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;AAExD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,iDAAiD,CAAA;AACxD,OAAO,iDAAiD,CAAA;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;kEAAgC;AAC/B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAA0B;AACzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yDAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mEAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iEAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oEAAiC;AAiBnD;IAAR,KAAK,EAAE;gDAAiC;AAChC;IAAR,KAAK,EAAE;mDAAqD;AA3ElD,cAAc;IAD1B,aAAa,CAAC,mBAAmB,CAAC;GACtB,cAAc,CAmM1B;SAnMY,cAAc","sourcesContent":["import { html, css, LitElement, nothing } from 'lit'\nimport { property, customElement, state } from 'lit/decorators.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { PackageData } from './types.js'\nimport { redirectToCheckout } from '../../utils/cta.js'\nimport '../kompasid-freewall-head/KompasFreewallHead.js'\nimport '../kompasid-freewall-body/KompasFreewallBody.js'\n\n@customElement('kompasid-freewall')\nexport class KompasFreewall 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 * property isLogin untuk menghandle apakah user sudah login atau belum\n * property type untuk menghandle tipe freewall\n * property head_copy_expand to update copy header when expand\n * property head_copy_collapse to update copy header when collapse\n * property expand to handle expand/collapse\n * property paywall_location is the location where user encounter the paywall\n * property paywall_subscription_package is the name of the subscription package viewed by user\n * property paywall_subscription_id is the ID of the subscription package viewed by user\n * property paywall_subscription_price is the price of the subscription package viewed by user\n * property paywall_position is the position of the subscription package viewed by user\n * property tracker_page_type is the type of the page\n * property tracker_page_title is the title of the page\n * property tracker_content_id is the ID of article (slug)\n * property content_title is the title of article\n * property tracker_content_categories is the category of the content\n * property tracker_content_type is to decide whether it's free article or paid article\n * property tracker_user_type is the type of user based on their subscription\n * property tracker_subscription_status is the status of their subscription\n * property tracker_page_domain is the page domain\n * property tracker_metered_wall_type is the type of metered wall\n * property tracker_metered_wall_balance is the balance of their metered wall\n */\n\n @property({ type: Boolean }) isLogin = false\n @property({ type: String }) type: 'article' | 'landing_page' = 'article'\n @property({ type: String }) head_copy_expand = ''\n @property({ type: String }) head_copy_collapse = ''\n @property({ type: Boolean }) expand = true\n @property({ type: String }) paywall_location = ''\n @property({ type: String }) paywall_subscription_package = ''\n @property({ type: Number }) paywall_subscription_id = 0\n @property({ type: Number }) paywall_subscription_price = 0\n @property({ type: Number }) paywall_position = 1\n @property({ type: String }) tracker_page_type = ''\n @property({ type: String }) tracker_page_title = ''\n @property({ type: String }) tracker_content_id = ''\n @property({ type: String }) tracker_content_title = ''\n @property({ type: String }) tracker_content_categories = ''\n @property({ type: String }) tracker_content_type = ''\n @property({ type: String }) tracker_user_type = ''\n @property({ type: String }) tracker_subscription_status = ''\n @property({ type: String }) tracker_page_domain = ''\n @property({ type: String }) tracker_metered_wall_type = ''\n @property({ type: Number }) tracker_metered_wall_balance = 0\n\n 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 isExpand: boolean = true\n @state() private packageData: PackageData = {} as PackageData\n\n /**\n * Getter\n */\n\n get isArticle() {\n return this.type === 'article'\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 page_type: this.tracker_page_type,\n metered_wall_type: this.tracker_metered_wall_type || 'FP',\n metered_wall_balance: this.tracker_metered_wall_balance,\n }\n\n const data = this.isArticle\n ? {\n ...baseData,\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 : {\n ...baseData,\n page_title: this.tracker_page_title,\n }\n\n window.dataLayer.push(data)\n }\n\n private sendDataLayerPaywallViewed(): void {\n if (this.isExpand) this.sendDataLayer('paywall_viewed')\n }\n\n private sendDataLayerSubscribeButtonClicked(): void {\n this.sendDataLayer('subscribe_button_clicked')\n }\n\n /**\n * Logic Function\n */\n\n private toggleExpand() {\n this.isExpand = !this.isExpand\n this.sendDataLayerPaywallViewed()\n }\n\n private onSubscriptionClick() {\n this.sendDataLayerSubscribeButtonClicked()\n redirectToCheckout({\n link: `${this.packageData.link}${this.packageData.referrer}`,\n source: this.type,\n })\n }\n\n /**\n * Lifecycle\n */\n\n override async connectedCallback() {\n super.connectedCallback()\n await this.updateComplete\n this.isExpand = this.expand\n\n const originHost: string = encodeURIComponent(window.location.href)\n this.packageData = { ...this.showPackage, referrer: originHost }\n\n this.sendDataLayerPaywallViewed()\n }\n\n /**\n * Render Statement\n */\n\n render() {\n return html`\n <div class=\"sticky bottom-0 w-full h-full z-20\">\n <div\n class=\"flex flex-col w-full bg-blue-100 py-4 justify-center md:px-12 lg:px-24\"\n >\n <kompasid-freewall-head\n .expand=${this.isExpand}\n .type=${this.type}\n .head_copy_expand=${this.head_copy_expand}\n .head_copy_collapse=${this.head_copy_collapse}\n .toggleExpand=${() => this.toggleExpand()}\n .onSubscriptionClick=${() => this.onSubscriptionClick()}\n .packageData=${this.packageData}\n ></kompasid-freewall-head>\n ${this.isExpand\n ? html`<kompasid-freewall-body\n .type=${this.type}\n .onSubscriptionClick=${() => this.onSubscriptionClick()}\n .packageData=${this.packageData}\n ?isLogin=${this.isLogin}\n ></kompasid-freewall-body>`\n : nothing}\n </div>\n </div>\n `\n }\n}\n"]}
1
+ {"version":3,"file":"KompasFreewall.js","sourceRoot":"","sources":["../../../../src/components/kompasid-freewall/KompasFreewall.ts"],"names":[],"mappings":";AAAA,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;AAExD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,iDAAiD,CAAA;AACxD,OAAO,iDAAiD,CAAA;AAGjD,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,UAAU;IAAvC;;QAcL;;WAEG;QACH;;;;;;;;;;;;;;;;;;;;;;WAsBG;QAE0B,YAAO,GAAG,KAAK,CAAA;QAChB,SAAI,GAA+B,SAAS,CAAA;QAC5C,qBAAgB,GAAG,EAAE,CAAA;QACrB,uBAAkB,GAAG,EAAE,CAAA;QACtB,WAAM,GAAG,IAAI,CAAA;QACd,qBAAgB,GAAG,EAAE,CAAA;QACrB,iCAA4B,GAAG,EAAE,CAAA;QACjC,4BAAuB,GAAG,CAAC,CAAA;QAC3B,+BAA0B,GAAG,CAAC,CAAA;QAC9B,qBAAgB,GAAG,CAAC,CAAA;QACpB,sBAAiB,GAAG,EAAE,CAAA;QACtB,uBAAkB,GAAG,EAAE,CAAA;QACvB,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,gCAA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A+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oEAAiC;AAiBnD;IAAR,KAAK,EAAE;gDAAiC;AAChC;IAAR,KAAK,EAAE;mDAAqD;AA/ElD,cAAc;IAD1B,aAAa,CAAC,mBAAmB,CAAC;GACtB,cAAc,CAoN1B;SApNY,cAAc","sourcesContent":["import { html, css, LitElement, nothing } from 'lit'\nimport { property, customElement, state } from 'lit/decorators.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { PackageData } from './types.js'\nimport { redirectToCheckout } from '../../utils/cta.js'\nimport '../kompasid-freewall-head/KompasFreewallHead.js'\nimport '../kompasid-freewall-body/KompasFreewallBody.js'\n\n@customElement('kompasid-freewall')\nexport class KompasFreewall extends LitElement {\n static styles = [\n css`\n :host {\n font-family: 'PT Sans', sans-serif;\n }\n\n .top-shadow {\n box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.16);\n }\n `,\n TWStyles,\n ]\n\n /**\n * Props\n */\n /**\n * property isLogin untuk menghandle apakah user sudah login atau belum\n * property type untuk menghandle tipe freewall\n * property head_copy_expand to update copy header when expand\n * property head_copy_collapse to update copy header when collapse\n * property expand to handle expand/collapse\n * property paywall_location is the location where user encounter the paywall\n * property paywall_subscription_package is the name of the subscription package viewed by user\n * property paywall_subscription_id is the ID of the subscription package viewed by user\n * property paywall_subscription_price is the price of the subscription package viewed by user\n * property paywall_position is the position of the subscription package viewed by user\n * property tracker_page_type is the type of the page\n * property tracker_page_title is the title of the page\n * property tracker_content_id is the ID of article (slug)\n * property content_title is the title of article\n * property tracker_content_categories is the category of the content\n * property tracker_content_type is to decide whether it's free article or paid article\n * property tracker_user_type is the type of user based on their subscription\n * property tracker_subscription_status is the status of their subscription\n * property tracker_page_domain is the page domain\n * property tracker_metered_wall_type is the type of metered wall\n * property tracker_metered_wall_balance is the balance of their metered wall\n */\n\n @property({ type: Boolean }) isLogin = false\n @property({ type: String }) type: 'article' | 'landing_page' = 'article'\n @property({ type: String }) head_copy_expand = ''\n @property({ type: String }) head_copy_collapse = ''\n @property({ type: Boolean }) expand = true\n @property({ type: String }) paywall_location = ''\n @property({ type: String }) paywall_subscription_package = ''\n @property({ type: Number }) paywall_subscription_id = 0\n @property({ type: Number }) paywall_subscription_price = 0\n @property({ type: Number }) paywall_position = 1\n @property({ type: String }) tracker_page_type = ''\n @property({ type: String }) tracker_page_title = ''\n @property({ type: String }) tracker_content_id = ''\n @property({ type: String }) tracker_content_title = ''\n @property({ type: String }) tracker_content_categories = ''\n @property({ type: String }) tracker_content_type = ''\n @property({ type: String }) tracker_user_type = ''\n @property({ type: String }) tracker_subscription_status = ''\n @property({ type: String }) tracker_page_domain = ''\n @property({ type: String }) tracker_metered_wall_type = ''\n @property({ type: Number }) tracker_metered_wall_balance = 0\n\n 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 isExpand: boolean = true\n @state() private packageData: PackageData = {} as PackageData\n\n /**\n * Getter\n */\n\n get isArticle() {\n return this.type === 'article'\n }\n\n /**\n * Data Layer\n */\n\n private prepareImpressionsData(): Record<string, any> {\n const baseData = {\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 page_type: this.tracker_page_type,\n metered_wall_type: this.tracker_metered_wall_type || 'FP',\n metered_wall_balance: this.tracker_metered_wall_balance,\n }\n\n if (this.isArticle) {\n return {\n ...baseData,\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 }\n return {\n ...baseData,\n page_title: this.tracker_page_title,\n }\n }\n\n private sendDataLayer(\n event: string,\n includeImpressions: boolean = false\n ): void {\n const impressionsData = this.prepareImpressionsData()\n\n const data = includeImpressions\n ? { event, impressions: [impressionsData] }\n : { event, ...impressionsData }\n\n window.dataLayer.push(data)\n }\n\n private sendDataLayerPaywallViewed(): void {\n if (this.isExpand) this.sendDataLayer('paywall_viewed', true)\n }\n\n private sendDataLayerSubscribeButtonClicked(): void {\n this.sendDataLayer('subscribe_button_clicked')\n }\n\n /**\n * Logic Function\n */\n\n private toggleExpand() {\n this.isExpand = !this.isExpand\n this.sendDataLayerPaywallViewed()\n }\n\n private onSubscriptionClick() {\n this.sendDataLayerSubscribeButtonClicked()\n redirectToCheckout({\n link: `${this.packageData.link}${this.packageData.referrer}`,\n source: this.type,\n })\n }\n\n /**\n * Lifecycle\n */\n\n override async connectedCallback() {\n super.connectedCallback()\n await this.updateComplete\n\n this.isExpand = this.expand\n\n const originHost: string = encodeURIComponent(window.location.href)\n this.packageData = { ...this.showPackage, referrer: originHost }\n\n this.sendDataLayerPaywallViewed()\n }\n\n /**\n * Render Statement\n */\n\n render() {\n return html`\n <div class=\"sticky bottom-0 w-full h-full z-20 top-shadow\">\n <div\n class=\"flex flex-col w-full bg-blue-100 justify-center ${this\n .isExpand && 'pb-6 md:pb-7'} md:px-4 lg:px-24\"\n >\n <kompasid-freewall-head\n .expand=${this.isExpand}\n .type=${this.type}\n .head_copy_expand=${this.head_copy_expand}\n .head_copy_collapse=${this.head_copy_collapse}\n .toggleExpand=${() => this.toggleExpand()}\n .onSubscriptionClick=${() => this.onSubscriptionClick()}\n .packageData=${this.packageData}\n ></kompasid-freewall-head>\n ${this.isExpand\n ? html`<kompasid-freewall-body\n .type=${this.type}\n .onSubscriptionClick=${() => this.onSubscriptionClick()}\n .packageData=${this.packageData}\n ?isLogin=${this.isLogin}\n ></kompasid-freewall-body>`\n : nothing}\n </div>\n </div>\n `\n }\n}\n"]}
@@ -47,8 +47,8 @@ let KompasFreewallBody = class KompasFreewallBody extends LitElement {
47
47
  id="subscription-card"
48
48
  class="flex justify-between items-center relative z-10 flex-col w-[328px] ${this
49
49
  .isLogin
50
- ? 'h-[277px] md:w-[580px] md:h-[240px]'
51
- : 'h-[223px] md:w-[350px] lg:w-[410px] md:h-[210px]'} py-3 px-[10px] md:p-5 md:pt-3 rounded-[10px] border-2 border-yellow-400 bg-white"
50
+ ? 'md:w-[580px]'
51
+ : 'md:w-[350px] lg:w-[410px]'} py-3 px-[10px] md:p-5 md:pt-3 rounded-[10px] border-2 border-yellow-400 bg-white"
52
52
  >
53
53
  <div
54
54
  class="flex w-full flex-col ${this.isLogin
@@ -77,7 +77,7 @@ let KompasFreewallBody = class KompasFreewallBody extends LitElement {
77
77
  </div>
78
78
  <div id="ribbon-container">
79
79
  <div
80
- class="text-[11px] font-medium font-roboto-condensed flex justify-center items-center"
80
+ class="text-[11px] font-medium text-grey-600 font-roboto-condensed flex justify-center items-center"
81
81
  >
82
82
  <span class="-ml-2">Penawaran Terbaik</span>
83
83
  </div>
@@ -88,7 +88,7 @@ let KompasFreewallBody = class KompasFreewallBody extends LitElement {
88
88
  registerCardComponent() {
89
89
  return html `
90
90
  <div
91
- class="flex flex-col justify-between w-[328px] h-[159px] md:w-[350px] lg:w-[410px] md:h-[210px] py-3 px-[10px] md:p-5 md:pt-3 rounded-[10px] bg-white"
91
+ class="flex flex-col justify-between md:min-h-[244px] lg:min-h-[220px] w-[328px] md:w-[350px] lg:w-[410px] py-3 px-[10px] md:p-5 md:pt-3 rounded-[10px] bg-white"
92
92
  >
93
93
  <div>
94
94
  <h5
@@ -96,7 +96,9 @@ let KompasFreewallBody = class KompasFreewallBody extends LitElement {
96
96
  >
97
97
  Daftar Akun Gratis
98
98
  </h5>
99
- <div class="flex items-start lg:items-center mt-1 md:mt-3">
99
+ <div
100
+ class="flex items-start lg:items-center mt-3 mb-4 md:mt-4 md:mb-5"
101
+ >
100
102
  <div class="mt-1 lg:mt-0">${faCheck()}</div>
101
103
  <h6 class="text-base text-grey-600 ml-1">
102
104
  Akses ke 3 artikel berbayar gratis tiap bulan
@@ -105,7 +107,7 @@ let KompasFreewallBody = class KompasFreewallBody extends LitElement {
105
107
  </div>
106
108
  <button
107
109
  @click=${() => redirectToRegister('freewall')}
108
- class="bg-white border border-blue-600 whitespace-nowrap rounded md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-blue-600 font-bold leading-[18px]"
110
+ class="bg-white border border-brand-1 whitespace-nowrap rounded md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-brand-1 font-bold leading-[18px]"
109
111
  >
110
112
  Daftar Gratis
111
113
  </button>
@@ -113,7 +115,7 @@ let KompasFreewallBody = class KompasFreewallBody extends LitElement {
113
115
  `;
114
116
  }
115
117
  descriptionSection() {
116
- return html `<div class="flex flex-col space-y-1 mt-1 lg:mt-3">
118
+ return html `<div class="flex flex-col space-y-1 mt-3 mb-4 md:mt-4 md:mb-5">
117
119
  ${this.description.map(item => html `
118
120
  <div class="flex items-start lg:items-center">
119
121
  <div class="mt-1 lg:mt-0">${faCheck()}</div>
@@ -128,7 +130,7 @@ let KompasFreewallBody = class KompasFreewallBody extends LitElement {
128
130
  render() {
129
131
  return html `
130
132
  <div
131
- class="w-full h-full flex flex-col md:flex-row pt-6 md:pt-3 relative px-4 md:px-0 py-3 space-y-4 md:space-x-5 md:space-y-0 justify-center items-center"
133
+ class="w-full h-full flex flex-col md:flex-row pt-[5px] relative space-y-4 md:space-x-5 md:space-y-0 justify-center items-center"
132
134
  >
133
135
  ${this.subscriptionCardComponent()}
134
136
  ${!this.isLogin ? this.registerCardComponent() : nothing}
@@ -1 +1 @@
1
- {"version":3,"file":"KompasFreewallBody.js","sourceRoot":"","sources":["../../../../src/components/kompasid-freewall-body/KompasFreewallBody.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE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AA6C;AAnF7D,kBAAkB;IAD9B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,kBAAkB,CA+M9B;SA/MY,kBAAkB","sourcesContent":["import { html, css, LitElement, nothing } from 'lit'\nimport { property, customElement } from 'lit/decorators.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { addGoogleFonts } from '../../utils/googleFont.js'\nimport { formatRupiah } from '../../utils/formatRupiah.js'\nimport { generateCopyDuration } from '../../utils/generateCopyDuration.js'\nimport { PackageData } from '../kompasid-freewall/types.js'\nimport { faCheck } from '../../../assets/font-awesome.js'\nimport { redirectToRegister } from '../../utils/cta.js'\n\n@customElement('kompasid-freewall-body')\nexport class KompasFreewallBody extends LitElement {\n static styles = [\n css`\n .font-lora {\n font-family: 'Lora', 'Georgia', 'serif';\n }\n\n .font-roboto-condensed {\n font-family: 'Roboto Condensed', sans-serif;\n }\n\n /* ----- Ribbon Container ---------------------------------------*/\n #ribbon-container {\n background: transparent;\n height: 130px;\n width: 200px;\n position: absolute;\n top: -5px;\n right: -5px;\n overflow: hidden;\n }\n\n /* ----- Top Curl ---------------------------------------*/\n #ribbon-container:before {\n content: '';\n display: block;\n -webkit-border-radius: 10px 10px 0px 0px;\n border-radius: 10px 10px 0px 0px;\n width: 35px;\n height: 10px;\n position: absolute;\n right: 60px;\n background: #b78b00;\n z-index: 1;\n }\n\n /* ----- Right Curl ---------------------------------------*/\n #ribbon-container:after {\n content: '';\n display: block;\n -webkit-border-radius: 0px 10px 10px 0px;\n border-radius: 0px 10px 10px 0px;\n width: 10px;\n height: 35px;\n position: absolute;\n right: 0px;\n top: 60px;\n background: #b78b00;\n }\n\n /* ----- Ribbon ---------------------------------------*/\n #ribbon-container > div {\n width: 140px;\n height: 28px;\n position: relative;\n top: 24px;\n right: -100px;\n z-index: 11;\n overflow: hidden;\n transform: rotate(45deg);\n -ms-transform: rotate(45deg); /* IE 9 */\n -moz-transform: rotate(45deg); /* Firefox */\n -webkit-transform: rotate(45deg); /* Safari and Chrome */\n -o-transform: rotate(45deg); /* Opera */\n background: #ffcc00;\n }\n `,\n TWStyles,\n ]\n\n /**\n * Props\n */\n /**\n * property isLogin untuk menghandle apakah user sudah login atau belum\n * property type untuk menghandle tipe freewall\n * property onSubscriptionClick to handle cta when subscription button is clicked\n * packageData sebagai data package yang diambil dari kompasid-freewall\n */\n\n @property({ type: Boolean }) isLogin = false\n @property({ type: String }) type: 'article' | 'landing_page' = 'article'\n @property() onSubscriptionClick = () => {}\n @property({ type: Object }) packageData: PackageData = {} as PackageData\n\n description = [\n 'Akses seluruh konten Kompas.id di web & aplikasi',\n 'ePaper hingga 30 edisi terakhir',\n 'Buku digital tiap bulannya di aplikasi ',\n ]\n\n /**\n * Lifecycle\n */\n\n override async connectedCallback() {\n super.connectedCallback()\n await this.updateComplete\n addGoogleFonts(['pt-sans', 'lora', 'roboto-condensed'])\n }\n\n /**\n * Component\n */\n\n private subscriptionCardComponent() {\n return html`\n <div class=\"relative\">\n <div\n id=\"subscription-card\"\n class=\"flex justify-between items-center relative z-10 flex-col w-[328px] ${this\n .isLogin\n ? 'h-[277px] md:w-[580px] md:h-[240px]'\n : 'h-[223px] md:w-[350px] lg:w-[410px] md:h-[210px]'} py-3 px-[10px] md:p-5 md:pt-3 rounded-[10px] border-2 border-yellow-400 bg-white\"\n >\n <div\n class=\"flex w-full flex-col ${this.isLogin\n ? 'items-center md:w-[374px] text-center'\n : 'items-start text-start'}\"\n >\n <h5\n class=\"font-lora text-lg md:text-xl font-bold leading-[30px] ${this\n .isLogin && 'w-60 md:w-full'} text-grey-600\"\n >\n ${this.isLogin\n ? 'Dukung Jurnalisme Mencerahkan dengan Berlangganan'\n : 'Mulai Berlangganan'}\n </h5>\n ${this.descriptionSection()}\n </div>\n <button\n @click=${this.onSubscriptionClick}\n class=\"bg-green-500 whitespace-nowrap w-full rounded ${this\n .isLogin &&\n 'md:w-[370px]'} md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-white font-bold leading-[18px]\"\n >\n Langganan ${formatRupiah(this.packageData.price)}\n /${generateCopyDuration(this.packageData.durationType)}\n </button>\n </div>\n <div id=\"ribbon-container\">\n <div\n class=\"text-[11px] font-medium font-roboto-condensed flex justify-center items-center\"\n >\n <span class=\"-ml-2\">Penawaran Terbaik</span>\n </div>\n </div>\n </div>\n `\n }\n\n private registerCardComponent() {\n return html`\n <div\n class=\"flex flex-col justify-between w-[328px] h-[159px] md:w-[350px] lg:w-[410px] md:h-[210px] py-3 px-[10px] md:p-5 md:pt-3 rounded-[10px] bg-white\"\n >\n <div>\n <h5\n class=\"font-lora text-lg md:text-xl font-bold leading-[30px] text-grey-600\"\n >\n Daftar Akun Gratis\n </h5>\n <div class=\"flex items-start lg:items-center mt-1 md:mt-3\">\n <div class=\"mt-1 lg:mt-0\">${faCheck()}</div>\n <h6 class=\"text-base text-grey-600 ml-1\">\n Akses ke 3 artikel berbayar gratis tiap bulan\n </h6>\n </div>\n </div>\n <button\n @click=${() => redirectToRegister('freewall')}\n class=\"bg-white border border-blue-600 whitespace-nowrap rounded md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-blue-600 font-bold leading-[18px]\"\n >\n Daftar Gratis\n </button>\n </div>\n `\n }\n\n private descriptionSection() {\n return html`<div class=\"flex flex-col space-y-1 mt-1 lg:mt-3\">\n ${this.description.map(\n item =>\n html`\n <div class=\"flex items-start lg:items-center\">\n <div class=\"mt-1 lg:mt-0\">${faCheck()}</div>\n <h6 class=\"text-base text-grey-600 ml-1 text-start\">${item}</h6>\n </div>\n `\n )}\n </div>`\n }\n\n /**\n * Render Statement\n */\n\n render() {\n return html`\n <div\n class=\"w-full h-full flex flex-col md:flex-row pt-6 md:pt-3 relative px-4 md:px-0 py-3 space-y-4 md:space-x-5 md:space-y-0 justify-center items-center\"\n >\n ${this.subscriptionCardComponent()}\n ${!this.isLogin ? this.registerCardComponent() : nothing}\n </div>\n `\n }\n}\n"]}
1
+ {"version":3,"file":"KompasFreewallBody.js","sourceRoot":"","sources":["../../../../src/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C;gDAA6C;AAC5D;IAAX,QAAQ,EAAE;+DAA+B;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAA6C;AAnF7D,kBAAkB;IAD9B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,kBAAkB,CAiN9B;SAjNY,kBAAkB","sourcesContent":["import { html, css, LitElement, nothing } from 'lit'\nimport { property, customElement } from 'lit/decorators.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { addGoogleFonts } from '../../utils/googleFont.js'\nimport { formatRupiah } from '../../utils/formatRupiah.js'\nimport { generateCopyDuration } from '../../utils/generateCopyDuration.js'\nimport { PackageData } from '../kompasid-freewall/types.js'\nimport { faCheck } from '../../../assets/font-awesome.js'\nimport { redirectToRegister } from '../../utils/cta.js'\n\n@customElement('kompasid-freewall-body')\nexport class KompasFreewallBody extends LitElement {\n static styles = [\n css`\n .font-lora {\n font-family: 'Lora', 'Georgia', 'serif';\n }\n\n .font-roboto-condensed {\n font-family: 'Roboto Condensed', sans-serif;\n }\n\n /* ----- Ribbon Container ---------------------------------------*/\n #ribbon-container {\n background: transparent;\n height: 130px;\n width: 200px;\n position: absolute;\n top: -5px;\n right: -5px;\n overflow: hidden;\n }\n\n /* ----- Top Curl ---------------------------------------*/\n #ribbon-container:before {\n content: '';\n display: block;\n -webkit-border-radius: 10px 10px 0px 0px;\n border-radius: 10px 10px 0px 0px;\n width: 35px;\n height: 10px;\n position: absolute;\n right: 60px;\n background: #b78b00;\n z-index: 1;\n }\n\n /* ----- Right Curl ---------------------------------------*/\n #ribbon-container:after {\n content: '';\n display: block;\n -webkit-border-radius: 0px 10px 10px 0px;\n border-radius: 0px 10px 10px 0px;\n width: 10px;\n height: 35px;\n position: absolute;\n right: 0px;\n top: 60px;\n background: #b78b00;\n }\n\n /* ----- Ribbon ---------------------------------------*/\n #ribbon-container > div {\n width: 140px;\n height: 28px;\n position: relative;\n top: 24px;\n right: -100px;\n z-index: 11;\n overflow: hidden;\n transform: rotate(45deg);\n -ms-transform: rotate(45deg); /* IE 9 */\n -moz-transform: rotate(45deg); /* Firefox */\n -webkit-transform: rotate(45deg); /* Safari and Chrome */\n -o-transform: rotate(45deg); /* Opera */\n background: #ffcc00;\n }\n `,\n TWStyles,\n ]\n\n /**\n * Props\n */\n /**\n * property isLogin untuk menghandle apakah user sudah login atau belum\n * property type untuk menghandle tipe freewall\n * property onSubscriptionClick to handle cta when subscription button is clicked\n * packageData sebagai data package yang diambil dari kompasid-freewall\n */\n\n @property({ type: Boolean }) isLogin = false\n @property({ type: String }) type: 'article' | 'landing_page' = 'article'\n @property() onSubscriptionClick = () => {}\n @property({ type: Object }) packageData: PackageData = {} as PackageData\n\n description = [\n 'Akses seluruh konten Kompas.id di web & aplikasi',\n 'ePaper hingga 30 edisi terakhir',\n 'Buku digital tiap bulannya di aplikasi ',\n ]\n\n /**\n * Lifecycle\n */\n\n override async connectedCallback() {\n super.connectedCallback()\n await this.updateComplete\n addGoogleFonts(['pt-sans', 'lora', 'roboto-condensed'])\n }\n\n /**\n * Component\n */\n\n private subscriptionCardComponent() {\n return html`\n <div class=\"relative\">\n <div\n id=\"subscription-card\"\n class=\"flex justify-between items-center relative z-10 flex-col w-[328px] ${this\n .isLogin\n ? 'md:w-[580px]'\n : 'md:w-[350px] lg:w-[410px]'} py-3 px-[10px] md:p-5 md:pt-3 rounded-[10px] border-2 border-yellow-400 bg-white\"\n >\n <div\n class=\"flex w-full flex-col ${this.isLogin\n ? 'items-center md:w-[374px] text-center'\n : 'items-start text-start'}\"\n >\n <h5\n class=\"font-lora text-lg md:text-xl font-bold leading-[30px] ${this\n .isLogin && 'w-60 md:w-full'} text-grey-600\"\n >\n ${this.isLogin\n ? 'Dukung Jurnalisme Mencerahkan dengan Berlangganan'\n : 'Mulai Berlangganan'}\n </h5>\n ${this.descriptionSection()}\n </div>\n <button\n @click=${this.onSubscriptionClick}\n class=\"bg-green-500 whitespace-nowrap w-full rounded ${this\n .isLogin &&\n 'md:w-[370px]'} md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-white font-bold leading-[18px]\"\n >\n Langganan ${formatRupiah(this.packageData.price)}\n /${generateCopyDuration(this.packageData.durationType)}\n </button>\n </div>\n <div id=\"ribbon-container\">\n <div\n class=\"text-[11px] font-medium text-grey-600 font-roboto-condensed flex justify-center items-center\"\n >\n <span class=\"-ml-2\">Penawaran Terbaik</span>\n </div>\n </div>\n </div>\n `\n }\n\n private registerCardComponent() {\n return html`\n <div\n class=\"flex flex-col justify-between md:min-h-[244px] lg:min-h-[220px] w-[328px] md:w-[350px] lg:w-[410px] py-3 px-[10px] md:p-5 md:pt-3 rounded-[10px] bg-white\"\n >\n <div>\n <h5\n class=\"font-lora text-lg md:text-xl font-bold leading-[30px] text-grey-600\"\n >\n Daftar Akun Gratis\n </h5>\n <div\n class=\"flex items-start lg:items-center mt-3 mb-4 md:mt-4 md:mb-5\"\n >\n <div class=\"mt-1 lg:mt-0\">${faCheck()}</div>\n <h6 class=\"text-base text-grey-600 ml-1\">\n Akses ke 3 artikel berbayar gratis tiap bulan\n </h6>\n </div>\n </div>\n <button\n @click=${() => redirectToRegister('freewall')}\n class=\"bg-white border border-brand-1 whitespace-nowrap rounded md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-brand-1 font-bold leading-[18px]\"\n >\n Daftar Gratis\n </button>\n </div>\n `\n }\n\n private descriptionSection() {\n return html`<div class=\"flex flex-col space-y-1 mt-3 mb-4 md:mt-4 md:mb-5\">\n ${this.description.map(\n item =>\n html`\n <div class=\"flex items-start lg:items-center\">\n <div class=\"mt-1 lg:mt-0\">${faCheck()}</div>\n <h6 class=\"text-base text-grey-600 ml-1 text-start\">${item}</h6>\n </div>\n `\n )}\n </div>`\n }\n\n /**\n * Render Statement\n */\n\n render() {\n return html`\n <div\n class=\"w-full h-full flex flex-col md:flex-row pt-[5px] relative space-y-4 md:space-x-5 md:space-y-0 justify-center items-center\"\n >\n ${this.subscriptionCardComponent()}\n ${!this.isLogin ? this.registerCardComponent() : nothing}\n </div>\n `\n }\n}\n"]}
@@ -51,11 +51,15 @@ let KompasFreewallHead = class KompasFreewallHead extends LitElement {
51
51
  */
52
52
  render() {
53
53
  return html `
54
- <div class="flex flex-col px-4 md:px-0 space-y-4">
54
+ <div class="flex flex-col px-4 md:px-0 space-y-4 pt-4 pb-5 md:py-2">
55
55
  <div class="flex justify-between items-center h-full space-x-3">
56
- <div class="hidden md:block"></div>
56
+ <div
57
+ class="hidden ${this.expand ? 'md:block' : 'lg:block'} w-9 h-9"
58
+ ></div>
57
59
  <div class="flex items-center md:justify-start space-x-3">
58
- <p class="w-[280px] md:w-full">${this.headCopy}</p>
60
+ <p class="max-w-[280px] md:max-w-full text-grey-600">
61
+ ${this.headCopy}
62
+ </p>
59
63
  ${!this.expand
60
64
  ? html `<button
61
65
  @click=${this.onSubscriptionClick}
@@ -69,6 +73,7 @@ let KompasFreewallHead = class KompasFreewallHead extends LitElement {
69
73
  <div>
70
74
  <button
71
75
  @click=${this.toggleExpand}
76
+ aria-label="Toggle Expand"
72
77
  class="h-9 w-9 flex items-center justify-center text-blue-500 rounded bg-blue-200"
73
78
  >
74
79
  <div class="${!this.expand && 'rotate-180'}">
@@ -1 +1 @@
1
- {"version":3,"file":"KompasFreewallHead.js","sourceRoot":"","sources":["../../../../src/components/kompasid-freewall-head/KompasFreewallHead.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AACrE,OAAO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IAAI,CAAC,MAAM,IAAI,YAAY;kBACtC,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;;;;;UAK5D,CAAC,IAAI,CAAC,MAAM;YACZ,CAAC,CAAC,IAAI,CAAA;uBACO,IAAI,CAAC,mBAAmB;;;0BAGrB,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;iBAC7C,oBAAoB,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC;sBAC9C;YACZ,CAAC,CAAC,OAAO;;KAEd,CAAA;IACH,CAAC;;AAxFM,yBAAM,GAAG,CAAC,GAAG,CAAA,EAAE,EAAE,QAAQ,CAAC,CAAA;AAeJ;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDAAgB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAA6C;AAC5C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAAsB;AACrB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8DAAwB;AACtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDAAc;AAC9B;IAAX,QAAQ,EAAE;wDAAwB;AACvB;IAAX,QAAQ,EAAE;+DAA+B;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAA6C;AAvB7D,kBAAkB;IAD9B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,kBAAkB,CA0F9B;SA1FY,kBAAkB","sourcesContent":["import { html, css, LitElement, nothing } from 'lit'\nimport { property, customElement } from 'lit/decorators.js'\nimport { unsafeSVG } from 'lit/directives/unsafe-svg.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { addGoogleFonts } from '../../utils/googleFont.js'\nimport { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js'\nimport { formatRupiah } from '../../utils/formatRupiah.js'\nimport { generateCopyDuration } from '../../utils/generateCopyDuration.js'\nimport { PackageData } from '../kompasid-freewall/types.js'\n\n@customElement('kompasid-freewall-head')\nexport class KompasFreewallHead extends LitElement {\n static styles = [css``, TWStyles]\n\n /**\n * Props\n */\n /**\n * property isLogin untuk menghandle apakah user sudah login atau belum\n * property type untuk menghandle tipe freewall\n * property head_copy_expand to update copy header when expand\n * property head_copy_collapse to update copy header when collapse\n * property expand to handle expand/collapse\n * property toggleExpand to handle toggle expand/collapse\n * property onSubscriptionClick to handle cta when subscription button is clicked\n */\n\n @property({ type: Boolean }) isLogin = false\n @property({ type: String }) type: 'article' | 'landing_page' = 'article'\n @property({ type: String }) head_copy_expand = ''\n @property({ type: String }) head_copy_collapse = ''\n @property({ type: Boolean }) expand = true\n @property() toggleExpand = () => {}\n @property() onSubscriptionClick = () => {}\n @property({ type: Object }) packageData: PackageData = {} as PackageData\n\n /**\n * Getter\n */\n\n get headCopy() {\n return (\n (this.expand ? this.head_copy_expand : this.head_copy_collapse) ||\n 'Akses seluruh konten dan fitur Kompas.id dengan berlangganan.'\n )\n }\n\n /**\n * Lifecycle\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 class=\"flex flex-col px-4 md:px-0 space-y-4\">\n <div class=\"flex justify-between items-center h-full space-x-3\">\n <div class=\"hidden md:block\"></div>\n <div class=\"flex items-center md:justify-start space-x-3\">\n <p class=\"w-[280px] md:w-full\">${this.headCopy}</p>\n ${!this.expand\n ? html`<button\n @click=${this.onSubscriptionClick}\n class=\"bg-green-500 hidden md:block whitespace-nowrap rounded md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-white font-bold leading-[18px]\"\n >\n Langganan ${formatRupiah(this.packageData.price)}\n /${generateCopyDuration(this.packageData.durationType)}\n </button>`\n : nothing}\n </div>\n <div>\n <button\n @click=${this.toggleExpand}\n class=\"h-9 w-9 flex items-center justify-center text-blue-500 rounded bg-blue-200\"\n >\n <div class=\"${!this.expand && 'rotate-180'}\">\n ${unsafeSVG(getFontAwesomeIcon('fas', 'chevron-down'))}\n </div>\n </button>\n </div>\n </div>\n ${!this.expand\n ? html`<button\n @click=${this.onSubscriptionClick}\n class=\"bg-green-500 block md:hidden whitespace-nowrap rounded md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-white font-bold leading-[18px]\"\n >\n Langganan ${formatRupiah(this.packageData.price)}\n /${generateCopyDuration(this.packageData.durationType)}\n </button>`\n : nothing}\n </div>\n `\n }\n}\n"]}
1
+ {"version":3,"file":"KompasFreewallHead.js","sourceRoot":"","sources":["../../../../src/components/kompasid-freewall-head/KompasFreewallHead.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAInE,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,UAAU;IAA3C;;QAGL;;WAEG;QACH;;;;;;;;WAQG;QAE0B,YAAO,GAAG,KAAK,CAAA;QAChB,SAAI,GAA+B,SAAS,CAAA;QAC5C,qBAAgB,GAAG,EAAE,CAAA;QACrB,uBAAkB,GAAG,EAAE,CAAA;QACtB,WAAM,GAAG,IAAI,CAAA;QAC9B,iBAAY,GAAG,GA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AY,CAAC;sBAC9C;YACZ,CAAC,CAAC,OAAO;;KAEd,CAAA;IACH,CAAC;;AA7FM,yBAAM,GAAG,CAAC,GAAG,CAAA,EAAE,EAAE,QAAQ,CAAC,CAAA;AAeJ;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDAAgB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAA6C;AAC5C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAAsB;AACrB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8DAAwB;AACtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDAAc;AAC9B;IAAX,QAAQ,EAAE;wDAAwB;AACvB;IAAX,QAAQ,EAAE;+DAA+B;AACd;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAA6C;AAvB7D,kBAAkB;IAD9B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,kBAAkB,CA+F9B;SA/FY,kBAAkB","sourcesContent":["import { html, css, LitElement, nothing } from 'lit'\nimport { property, customElement } from 'lit/decorators.js'\nimport { unsafeSVG } from 'lit/directives/unsafe-svg.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { addGoogleFonts } from '../../utils/googleFont.js'\nimport { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js'\nimport { formatRupiah } from '../../utils/formatRupiah.js'\nimport { generateCopyDuration } from '../../utils/generateCopyDuration.js'\nimport { PackageData } from '../kompasid-freewall/types.js'\n\n@customElement('kompasid-freewall-head')\nexport class KompasFreewallHead extends LitElement {\n static styles = [css``, TWStyles]\n\n /**\n * Props\n */\n /**\n * property isLogin untuk menghandle apakah user sudah login atau belum\n * property type untuk menghandle tipe freewall\n * property head_copy_expand to update copy header when expand\n * property head_copy_collapse to update copy header when collapse\n * property expand to handle expand/collapse\n * property toggleExpand to handle toggle expand/collapse\n * property onSubscriptionClick to handle cta when subscription button is clicked\n */\n\n @property({ type: Boolean }) isLogin = false\n @property({ type: String }) type: 'article' | 'landing_page' = 'article'\n @property({ type: String }) head_copy_expand = ''\n @property({ type: String }) head_copy_collapse = ''\n @property({ type: Boolean }) expand = true\n @property() toggleExpand = () => {}\n @property() onSubscriptionClick = () => {}\n @property({ type: Object }) packageData: PackageData = {} as PackageData\n\n /**\n * Getter\n */\n\n get headCopy() {\n return (\n (this.expand ? this.head_copy_expand : this.head_copy_collapse) ||\n 'Akses seluruh konten dan fitur Kompas.id dengan berlangganan.'\n )\n }\n\n /**\n * Lifecycle\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 class=\"flex flex-col px-4 md:px-0 space-y-4 pt-4 pb-5 md:py-2\">\n <div class=\"flex justify-between items-center h-full space-x-3\">\n <div\n class=\"hidden ${this.expand ? 'md:block' : 'lg:block'} w-9 h-9\"\n ></div>\n <div class=\"flex items-center md:justify-start space-x-3\">\n <p class=\"max-w-[280px] md:max-w-full text-grey-600\">\n ${this.headCopy}\n </p>\n ${!this.expand\n ? html`<button\n @click=${this.onSubscriptionClick}\n class=\"bg-green-500 hidden md:block whitespace-nowrap rounded md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-white font-bold leading-[18px]\"\n >\n Langganan ${formatRupiah(this.packageData.price)}\n /${generateCopyDuration(this.packageData.durationType)}\n </button>`\n : nothing}\n </div>\n <div>\n <button\n @click=${this.toggleExpand}\n aria-label=\"Toggle Expand\"\n class=\"h-9 w-9 flex items-center justify-center text-blue-500 rounded bg-blue-200\"\n >\n <div class=\"${!this.expand && 'rotate-180'}\">\n ${unsafeSVG(getFontAwesomeIcon('fas', 'chevron-down'))}\n </div>\n </button>\n </div>\n </div>\n ${!this.expand\n ? html`<button\n @click=${this.onSubscriptionClick}\n class=\"bg-green-500 block md:hidden whitespace-nowrap rounded md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-white font-bold leading-[18px]\"\n >\n Langganan ${formatRupiah(this.packageData.price)}\n /${generateCopyDuration(this.packageData.durationType)}\n </button>`\n : nothing}\n </div>\n `\n }\n}\n"]}
@@ -63,6 +63,7 @@ export declare class KompasPaywallVideo extends LitElement {
63
63
  /**
64
64
  * Data Layer
65
65
  */
66
+ private prepareImpressionsData;
66
67
  private sendDataLayer;
67
68
  private sendDataLayerPaywallViewed;
68
69
  private sendDataLayerSubscribeButtonClicked;
@@ -98,7 +98,6 @@ let KompasPaywallVideo = class KompasPaywallVideo extends LitElement {
98
98
  defaultComponent() {
99
99
  return html `
100
100
  <div class="flex flex-col items-center space-y-2 md:space-y-4">
101
- ${this.sendDataLayeronNonLogin()} ${this.sendDataLayerPaywallViewed()}
102
101
  <h5
103
102
  class="leading-5 md:leading-6 w-[296px] md:w-[400px] text-white text-center text-base mb-2 md:mb-0 ${!this
104
103
  .isLogin &&
@@ -132,9 +131,8 @@ let KompasPaywallVideo = class KompasPaywallVideo extends LitElement {
132
131
  /**
133
132
  * Data Layer
134
133
  */
135
- sendDataLayer(event) {
134
+ prepareImpressionsData() {
136
135
  const baseData = {
137
- event,
138
136
  paywall_location: this.paywall_location,
139
137
  paywall_subscription_package: this.paywall_subscription_package || this.packageData.title,
140
138
  paywall_subscription_id: this.paywall_subscription_id || this.packageData.id,
@@ -146,20 +144,27 @@ let KompasPaywallVideo = class KompasPaywallVideo extends LitElement {
146
144
  metered_wall_type: this.tracker_metered_wall_type || 'HP',
147
145
  metered_wall_balance: this.tracker_metered_wall_balance,
148
146
  };
149
- const data = this.isArticle
150
- ? {
147
+ if (this.isArticle) {
148
+ return {
151
149
  ...baseData,
152
150
  page_type: this.tracker_page_type,
153
151
  content_id: this.tracker_content_id,
154
152
  content_title: this.tracker_content_title,
155
153
  content_categories: this.tracker_content_categories,
156
154
  content_type: this.tracker_content_type,
157
- }
158
- : baseData;
155
+ };
156
+ }
157
+ return baseData;
158
+ }
159
+ sendDataLayer(event, includeImpressions = false) {
160
+ const impressionsData = this.prepareImpressionsData();
161
+ const data = includeImpressions
162
+ ? { event, impressions: [impressionsData] }
163
+ : { event, ...impressionsData };
159
164
  window.dataLayer.push(data);
160
165
  }
161
166
  sendDataLayerPaywallViewed() {
162
- this.sendDataLayer('paywall_viewed');
167
+ this.sendDataLayer('paywall_viewed', true);
163
168
  }
164
169
  sendDataLayerSubscribeButtonClicked() {
165
170
  this.sendDataLayer('subscribe_button_clicked');
@@ -210,6 +215,8 @@ let KompasPaywallVideo = class KompasPaywallVideo extends LitElement {
210
215
  addGoogleFonts(['pt-sans']);
211
216
  const originHost = encodeURIComponent(window.location.href);
212
217
  this.packageData = { ...this.showPackage, referrer: originHost };
218
+ this.sendDataLayeronNonLogin();
219
+ this.sendDataLayerPaywallViewed();
213
220
  }
214
221
  /**
215
222
  * Render Statement
@@ -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,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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EAAE,MAAM,EAAE,CAAC;sEAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAAqB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6DAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8DAAwB;AACvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iEAA2B;AAC1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sEAAgC;AAC/B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gEAA0B;AACzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6DAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uEAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+DAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qEAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wEAAiC;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"]}
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,CA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AM,EAAE,CAAC;sEAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAAqB;AACpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6DAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8DAAwB;AACvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iEAA2B;AAC1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sEAAgC;AAC/B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gEAA0B;AACzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6DAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uEAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+DAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qEAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wEAAiC;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,CAwQ9B;SAxQY,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 <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 prepareImpressionsData(): Record<string, any> {\n const baseData = {\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 if (this.isArticle) {\n return {\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 }\n return baseData\n }\n\n private sendDataLayer(\n event: string,\n includeImpressions: boolean = false\n ): void {\n const impressionsData = this.prepareImpressionsData()\n\n const data = includeImpressions\n ? { event, impressions: [impressionsData] }\n : { event, ...impressionsData }\n\n window.dataLayer.push(data)\n }\n\n private sendDataLayerPaywallViewed(): void {\n this.sendDataLayer('paywall_viewed', true)\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 this.sendDataLayeronNonLogin()\n this.sendDataLayerPaywallViewed()\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"]}