@kompasid/lit-web-components 0.9.36 → 0.9.38

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/header.html CHANGED
@@ -62,7 +62,7 @@
62
62
  },
63
63
  moreThan3Days: {
64
64
  "userName": "Clara Wijaya",
65
- "expired": formated(addDays(new Date(), 10)),
65
+ "expired": formated(addDays(new Date(), 4)),
66
66
  "isMembership": true,
67
67
  "totalGracePeriod": 0,
68
68
  "isGracePeriod": false
@@ -74,6 +74,13 @@
74
74
  "totalGracePeriod": 0,
75
75
  "isGracePeriod": false
76
76
  },
77
+ last3Days: {
78
+ "userName": "Clara Wijaya",
79
+ "expired": formated(new Date()).replace(' ', 'T'),
80
+ "isMembership": true,
81
+ "totalGracePeriod": 0,
82
+ "isGracePeriod": false
83
+ },
77
84
  tidakBerlangganan: {
78
85
  "userName": "Clara Wijaya",
79
86
  "expired": "",
@@ -203,6 +210,7 @@
203
210
  <button @click=${() => handleTemplateClick('gracePeriod')}>grace period</button>
204
211
  <button @click=${() => handleTemplateClick('moreThan3Days')}>moreThan3Days</button>
205
212
  <button @click=${() => handleTemplateClick('lessThan3Days')}>lessThan3Days</button>
213
+ <button @click=${() => handleTemplateClick('last3Days')}>last3Days</button>
206
214
  <button @click=${() => handleTemplateClick('tidakBerlangganan')}>Tidak berlangganan</button>
207
215
  </div>
208
216
  <textarea @input=${handleInput} .value=${JSON.stringify(userData, null, 2)} style="width: 100%; height: 200px; font-family: monospace;"></textarea>
package/demo/paywall.html CHANGED
@@ -14,6 +14,24 @@
14
14
  font-family: sans-serif;
15
15
  }
16
16
  </style>
17
+ <script>
18
+ ;(function initGTM(w, d, s, l, i) {
19
+ const _w = w
20
+ _w[l] = _w[l] || []
21
+ _w[l].push({
22
+ 'gtm.start': new Date().getTime(),
23
+ event: 'gtm.js',
24
+ })
25
+
26
+ const f = d.getElementsByTagName(s)[0]
27
+ const j = d.createElement(s)
28
+ const dl = l !== 'dataLayer' ? `&l=${l}` : ''
29
+
30
+ j.async = true
31
+ j.src = `https://www.googletagmanager.com/gtm.js?id=${i}${dl}`
32
+ f.parentNode.insertBefore(j, f)
33
+ })(window, document, 'script', 'dataLayer')
34
+ </script>
17
35
  </head>
18
36
 
19
37
  <body>
@@ -21,7 +39,7 @@
21
39
  import { html, render } from 'lit'
22
40
  import '../dist/src/components/kompasid-paywall/KompasPaywall.js'
23
41
 
24
- const type = 'proMiningOutlook'
42
+ const type = 'reguler'
25
43
  const theme = ''
26
44
  const paywallLocation = 'paywall_location'
27
45
  const paywallSubscriptionId = 'testId'
@@ -33,6 +51,9 @@
33
51
  const trackerContentTitle = 'content_title'
34
52
  const trackerContentCategories = 'content_categories'
35
53
  const trackerUserType = 'user_type'
54
+ const trackerContentTags = 'ekonomi|polhuk'
55
+ const trackerContentPublishedDate = '2026-02-27 08:00:12'
56
+ const trackerContentVariant = 'testa'
36
57
  const trackerContentPublisher = 'publisher'
37
58
  const subscriptionStatus = 'subscription_status'
38
59
  const trackerPageDomain = 'page_domain'
@@ -60,6 +81,9 @@
60
81
  .tracker_content_type=${trackerContentType}
61
82
  .tracker_content_title=${trackerContentTitle}
62
83
  .tracker_content_categories=${trackerContentCategories}
84
+ .tracker_content_tags=${trackerContentTags}
85
+ .tracker_content_published_date=${trackerContentPublishedDate}
86
+ .tracker_content_variant=${trackerContentVariant}
63
87
  .tracker_user_type=${trackerUserType}
64
88
  .subscriptionStatus=${subscriptionStatus}
65
89
  .tracker_page_domain=${trackerPageDomain}
@@ -113,7 +113,7 @@ let KompasHeaderAccountProfile = class KompasHeaderAccountProfile extends LitEle
113
113
  const nowDate = new Date();
114
114
  const isoDateString = expired.replace(' ', 'T');
115
115
  const expiredDate = new Date(isoDateString);
116
- const subsDaysLeft = differenceInDays(expiredDate, nowDate);
116
+ const subsDaysLeft = differenceInDays(expiredDate, nowDate) + 1; // differenceInDays + 1 jika tanggal bertepatan di hari yang sama
117
117
  const gracePeriodCard = () => {
118
118
  if (isGracePeriod) {
119
119
  const totalGraceSubs = this.maxGracePeriod - Math.max(totalGracePeriod, 0);
@@ -149,7 +149,7 @@ let KompasHeaderAccountProfile = class KompasHeaderAccountProfile extends LitEle
149
149
  if (isGracePeriod && totalGracePeriod > 0) {
150
150
  result = gracePeriodCard();
151
151
  }
152
- else if (subsDaysLeft > 0 && subsDaysLeft <= 3) {
152
+ else if (subsDaysLeft >= 0 && subsDaysLeft <= 3) {
153
153
  result = lessThan3daysCard();
154
154
  }
155
155
  else if (subsDaysLeft > 3) {
@@ -1 +1 @@
1
- {"version":3,"file":"KompasHeaderAccountProfile.js","sourceRoot":"","sources":["../../../../src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AAExD,OAAO,+CAA+C,CAAA;AAG/C,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,UAAU;IAAnD;;QAYL;;WAEG;QACyB,oBAAe,GAAG,EAAE,CAAA;QACpB,aAAQ,GAAG,EAAU,CAAA;QACrB,oBAAe,GAAG,EAAE,CAAA;QACpB,qBAAgB,GAAG,CAAC,CAAA;QACpB,aAAQ,GAAG,EAAE,CAAA;QACzC;;WAEG;QACyB,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,sB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C,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sEAAwB;AACvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yEAA2B;AAC1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8EAAgC;AAC/B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wEAA0B;AACzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qEAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+EAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uEAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6EAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gFAAiC;AAKnD;IAAR,KAAK,EAAE;kEAA2B;AA1CxB,0BAA0B;IADtC,aAAa,CAAC,iCAAiC,CAAC;GACpC,0BAA0B,CAuPtC;SAvPY,0BAA0B","sourcesContent":["import { LitElement, html, css } from 'lit'\nimport { format, addDays, differenceInDays } from 'date-fns'\nimport { id } from 'date-fns/locale/id'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { User } from '../kompasid-header-account/types.js'\nimport '../kompasid-grace-period/KompasGracePeriod.js'\n\n@customElement('kompasid-header-account-profile')\nexport class KompasHeaderAccountProfile extends LitElement {\n static styles = [\n css`\n .header-account--membership-icon {\n position: absolute;\n bottom: -2px;\n right: -2px;\n }\n `,\n TWStyles,\n ]\n\n /**\n * Props\n */\n @property({ type: String }) userInitialName = ''\n @property({ type: Object }) userData = {} as User\n @property({ type: String }) subscriptionUrl = ''\n @property({ type: Number }) totalGracePeriod = 0\n @property({ type: String }) openFrom = ''\n /**\n * Props For Grace Period Tracker\n */\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 = 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\n /**\n * State\n */\n @state() private maxGracePeriod = 7\n\n formatDate(date: Date | string) {\n return format(new Date(date), 'dd MMM yyyy', { locale: id })\n }\n\n private renderSkeletonLoading() {\n return html`\n <div>\n <div class=\"flex flex-row mb-5 items-center gap-4 leading-none\">\n <div\n class=\"bg-grey-300 py-5 rounded-full h-16 w-16 animate-pulse\"\n ></div>\n <div class=\"flex flex-col text-left w-40 gap-y-2\">\n <div class=\"h-3 rounded-sm w-full bg-grey-300 animate-pulse\"></div>\n <div class=\"h-3 rounded-sm w-full bg-grey-300 animate-pulse\"></div>\n <div class=\"h-3 rounded-sm w-full bg-grey-300 animate-pulse\"></div>\n </div>\n </div>\n <div>\n <div class=\"h-6 rounded-sm w-full bg-grey-300 animate-pulse\"></div>\n </div>\n </div>\n `\n }\n\n private renderProfileContent() {\n /**\n * Subs Button Element\n */\n const subscribeButton = () => {\n if (this.userData.isMembership) {\n return html``\n }\n const handleSubscribe = () => {\n const openFromValue = this.openFrom || 'Sidebar_Menu'\n window.location.href = `${this.subscriptionUrl}?open_from=${openFromValue}`\n }\n\n return html`\n <div class=\"w-full\">\n <button\n @click=${handleSubscribe}\n class=\"w-full rounded-lg px-4 py-3 mt-4 h-10 flex justify-center items-center bg-brand-1 text-grey-100 font-bold text-base focus:outline-none\"\n >\n Berlangganan Sekarang\n </button>\n </div>\n `\n }\n /**\n * membership icon element, show if isMebership has truthy value\n */\n const membershipIcon = () => {\n if (!this.userData?.isMembership) {\n return html``\n }\n\n return html`\n <div>\n <img\n class=\"header-account--membership-icon h-6 w-6\"\n src=\"https://cdn-www.kompas.id/global-header/crown-royal-blue-60.svg\"\n alt=\"membership-crown-icon\"\n />\n </div>\n `\n }\n\n /**\n * Active Info Element\n */\n\n const activeInfoTemplate = () => {\n const { isGracePeriod, totalGracePeriod, expired } = this.userData\n\n let result = html`Tidak Berlangganan` // default\n let endGracePeriodDate = ''\n\n const nowDate = new Date()\n const isoDateString = expired.replace(' ', 'T')\n const expiredDate = new Date(isoDateString)\n const subsDaysLeft: number = differenceInDays(expiredDate, nowDate)\n\n const gracePeriodCard = () => {\n if (isGracePeriod) {\n const totalGraceSubs =\n this.maxGracePeriod - Math.max(totalGracePeriod, 0)\n endGracePeriodDate = this.formatDate(\n addDays(\n new Date(),\n totalGracePeriod > this.maxGracePeriod ? 0 : totalGraceSubs\n )\n )\n }\n const label = 'Periode Masa Tenggang'\n return html`\n <div class=\"text-orange-500 gracePeriodCard\">\n <span>${label}</span>\n <p class=\"font-bold\">hingga ${endGracePeriodDate}</p>\n </div>\n `\n }\n\n const lessThan3daysCard = () => {\n const label = 'Aktif Berlangganan'\n return html`\n <div class=\"lessThan3daysCard\">\n <span> ${label} </span>\n <p class=\"font-bold\">Berakhir ${subsDaysLeft} hari lagi</p>\n </div>\n `\n }\n\n const moreThan3daysCard = () => {\n const formattedExpired = this.formatDate(expired)\n const label = 'Aktif Berlangganan'\n return html`\n <div class=\"moreThan3daysCard\">\n <span>${label}</span>\n <p class=\"font-bold\">hingga ${formattedExpired}</p>\n </div>\n `\n }\n\n if (isGracePeriod && totalGracePeriod > 0) {\n result = gracePeriodCard()\n } else if (subsDaysLeft > 0 && subsDaysLeft <= 3) {\n result = lessThan3daysCard()\n } else if (subsDaysLeft > 3) {\n result = moreThan3daysCard()\n }\n\n return html`<p class=\"text-sm text-grey-600 ${subsDaysLeft}-days-left\">\n ${result}\n </p>`\n }\n\n return html`\n <div\n class=\"active-info flex flex-col items-start leading-none text-left font-sans\"\n >\n <div class=\"flex flex-row items-center gap-4\">\n <div\n class=\"flex bg-brand-1 flex-shrink-0 p-5 rounded-full h-16 w-16 items-center justify-center relative\"\n >\n <span class=\"capitalize text-2xl text-grey-100 font-bold\">\n ${this.userInitialName}\n </span>\n ${membershipIcon()}\n </div>\n\n <div class=\"flex flex-col text-left\">\n <p class=\"capitalize font-bold text-base text-blue-600\">\n ${this.userData.userName}\n </p>\n ${activeInfoTemplate()}\n </div>\n </div>\n\n ${this.userData?.isGracePeriod\n ? html` <div class=\"mt-4 kompasid-grace-period\">\n <kompasid-grace-period\n totalGracePeriod=${this.userData.totalGracePeriod}\n isColumn=\"true\"\n isShowButton=\"true\"\n isBackgroundOnContentOnly=\"true\"\n paywall_location=${this.paywall_location}\n paywall_subscription_package=${this\n .paywall_subscription_package}\n paywall_subscription_id=${this.paywall_subscription_id}\n paywall_subscription_price=${this.paywall_subscription_price}\n paywall_position=${this.paywall_position}\n tracker_page_type=${this.tracker_page_type}\n tracker_content_id=${this.tracker_content_id}\n tracker_content_title=${this.tracker_content_title}\n tracker_content_categories=${this.tracker_content_categories}\n tracker_content_type=${this.tracker_content_type}\n tracker_user_type=${this.tracker_user_type}\n tracker_subscription_status=${this.tracker_subscription_status}\n tracker_page_domain=${this.tracker_page_domain}\n tracker_metered_wall_type=${this.tracker_metered_wall_type}\n tracker_metered_wall_balance=${this\n .tracker_metered_wall_balance}\n ></kompasid-grace-period>\n </div>`\n : subscribeButton()}\n </div>\n `\n }\n\n override async connectedCallback() {\n super.connectedCallback()\n }\n\n render() {\n return html`\n <div class=\"flex flex-shrink-0 flex-col p-4\">\n ${!this.userData\n ? this.renderSkeletonLoading()\n : this.renderProfileContent()}\n </div>\n <hr class=\"border-grey-300 mx-4\" />\n `\n }\n}\n"]}
1
+ {"version":3,"file":"KompasHeaderAccountProfile.js","sourceRoot":"","sources":["../../../../src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAC5D,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AAExD,OAAO,+CAA+C,CAAA;AAG/C,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,UAAU;IAAnD;;QAYL;;WAEG;QACyB,oBAAe,GAAG,EAAE,CAAA;QACpB,aAAQ,GAAG,EAAU,CAAA;QACrB,oBAAe,GAAG,EAAE,CAAA;QACpB,qBAAgB,GAAG,CAAC,CAAA;QACpB,aAAQ,GAAG,EAAE,CAAA;QACzC;;WAEG;QACyB,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,0BAAqB,GAAG,EAAE,CAAA;QAC1B,+BAA0B,GAAG,EAAE,CAAA;QAC/B,yBAAoB,GAAG,EAAE,CAAA;QACzB,sBAAiB,GAAG,EAAE,CAAA;QACtB,gCAA2B,GAAG,EAAE,CAAA;QAChC,wBAAmB,GAAG,EAAE,CAAA;QACxB,8BAAyB,GAAG,EAAE,CAAA;QAC9B,iCAA4B,GAAG,CAAC,CAAA;QAE5D;;WAEG;QACc,mBAAc,GAAG,CAAC,CAAA;IA6MrC,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QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+EAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uEAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6EAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gFAAiC;AAKnD;IAAR,KAAK,EAAE;kEAA2B;AA1CxB,0BAA0B;IADtC,aAAa,CAAC,iCAAiC,CAAC;GACpC,0BAA0B,CAuPtC;SAvPY,0BAA0B","sourcesContent":["import { LitElement, html, css } from 'lit'\nimport { format, addDays, differenceInDays } from 'date-fns'\nimport { id } from 'date-fns/locale/id'\nimport { customElement, property, state } from 'lit/decorators.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { User } from '../kompasid-header-account/types.js'\nimport '../kompasid-grace-period/KompasGracePeriod.js'\n\n@customElement('kompasid-header-account-profile')\nexport class KompasHeaderAccountProfile extends LitElement {\n static styles = [\n css`\n .header-account--membership-icon {\n position: absolute;\n bottom: -2px;\n right: -2px;\n }\n `,\n TWStyles,\n ]\n\n /**\n * Props\n */\n @property({ type: String }) userInitialName = ''\n @property({ type: Object }) userData = {} as User\n @property({ type: String }) subscriptionUrl = ''\n @property({ type: Number }) totalGracePeriod = 0\n @property({ type: String }) openFrom = ''\n /**\n * Props For Grace Period Tracker\n */\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 = 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\n /**\n * State\n */\n @state() private maxGracePeriod = 7\n\n formatDate(date: Date | string) {\n return format(new Date(date), 'dd MMM yyyy', { locale: id })\n }\n\n private renderSkeletonLoading() {\n return html`\n <div>\n <div class=\"flex flex-row mb-5 items-center gap-4 leading-none\">\n <div\n class=\"bg-grey-300 py-5 rounded-full h-16 w-16 animate-pulse\"\n ></div>\n <div class=\"flex flex-col text-left w-40 gap-y-2\">\n <div class=\"h-3 rounded-sm w-full bg-grey-300 animate-pulse\"></div>\n <div class=\"h-3 rounded-sm w-full bg-grey-300 animate-pulse\"></div>\n <div class=\"h-3 rounded-sm w-full bg-grey-300 animate-pulse\"></div>\n </div>\n </div>\n <div>\n <div class=\"h-6 rounded-sm w-full bg-grey-300 animate-pulse\"></div>\n </div>\n </div>\n `\n }\n\n private renderProfileContent() {\n /**\n * Subs Button Element\n */\n const subscribeButton = () => {\n if (this.userData.isMembership) {\n return html``\n }\n const handleSubscribe = () => {\n const openFromValue = this.openFrom || 'Sidebar_Menu'\n window.location.href = `${this.subscriptionUrl}?open_from=${openFromValue}`\n }\n\n return html`\n <div class=\"w-full\">\n <button\n @click=${handleSubscribe}\n class=\"w-full rounded-lg px-4 py-3 mt-4 h-10 flex justify-center items-center bg-brand-1 text-grey-100 font-bold text-base focus:outline-none\"\n >\n Berlangganan Sekarang\n </button>\n </div>\n `\n }\n /**\n * membership icon element, show if isMebership has truthy value\n */\n const membershipIcon = () => {\n if (!this.userData?.isMembership) {\n return html``\n }\n\n return html`\n <div>\n <img\n class=\"header-account--membership-icon h-6 w-6\"\n src=\"https://cdn-www.kompas.id/global-header/crown-royal-blue-60.svg\"\n alt=\"membership-crown-icon\"\n />\n </div>\n `\n }\n\n /**\n * Active Info Element\n */\n\n const activeInfoTemplate = () => {\n const { isGracePeriod, totalGracePeriod, expired } = this.userData\n\n let result = html`Tidak Berlangganan` // default\n let endGracePeriodDate = ''\n\n const nowDate = new Date()\n const isoDateString = expired.replace(' ', 'T')\n const expiredDate = new Date(isoDateString)\n const subsDaysLeft: number = differenceInDays(expiredDate, nowDate) + 1 // differenceInDays + 1 jika tanggal bertepatan di hari yang sama\n\n const gracePeriodCard = () => {\n if (isGracePeriod) {\n const totalGraceSubs =\n this.maxGracePeriod - Math.max(totalGracePeriod, 0)\n endGracePeriodDate = this.formatDate(\n addDays(\n new Date(),\n totalGracePeriod > this.maxGracePeriod ? 0 : totalGraceSubs\n )\n )\n }\n const label = 'Periode Masa Tenggang'\n return html`\n <div class=\"text-orange-500 gracePeriodCard\">\n <span>${label}</span>\n <p class=\"font-bold\">hingga ${endGracePeriodDate}</p>\n </div>\n `\n }\n\n const lessThan3daysCard = () => {\n const label = 'Aktif Berlangganan'\n return html`\n <div class=\"lessThan3daysCard\">\n <span> ${label} </span>\n <p class=\"font-bold\">Berakhir ${subsDaysLeft} hari lagi</p>\n </div>\n `\n }\n\n const moreThan3daysCard = () => {\n const formattedExpired = this.formatDate(expired)\n const label = 'Aktif Berlangganan'\n return html`\n <div class=\"moreThan3daysCard\">\n <span>${label}</span>\n <p class=\"font-bold\">hingga ${formattedExpired}</p>\n </div>\n `\n }\n\n if (isGracePeriod && totalGracePeriod > 0) {\n result = gracePeriodCard()\n } else if (subsDaysLeft >= 0 && subsDaysLeft <= 3) {\n result = lessThan3daysCard()\n } else if (subsDaysLeft > 3) {\n result = moreThan3daysCard()\n }\n\n return html`<p class=\"text-sm text-grey-600 ${subsDaysLeft}-days-left\">\n ${result}\n </p>`\n }\n\n return html`\n <div\n class=\"active-info flex flex-col items-start leading-none text-left font-sans\"\n >\n <div class=\"flex flex-row items-center gap-4\">\n <div\n class=\"flex bg-brand-1 flex-shrink-0 p-5 rounded-full h-16 w-16 items-center justify-center relative\"\n >\n <span class=\"capitalize text-2xl text-grey-100 font-bold\">\n ${this.userInitialName}\n </span>\n ${membershipIcon()}\n </div>\n\n <div class=\"flex flex-col text-left\">\n <p class=\"capitalize font-bold text-base text-blue-600\">\n ${this.userData.userName}\n </p>\n ${activeInfoTemplate()}\n </div>\n </div>\n\n ${this.userData?.isGracePeriod\n ? html` <div class=\"mt-4 kompasid-grace-period\">\n <kompasid-grace-period\n totalGracePeriod=${this.userData.totalGracePeriod}\n isColumn=\"true\"\n isShowButton=\"true\"\n isBackgroundOnContentOnly=\"true\"\n paywall_location=${this.paywall_location}\n paywall_subscription_package=${this\n .paywall_subscription_package}\n paywall_subscription_id=${this.paywall_subscription_id}\n paywall_subscription_price=${this.paywall_subscription_price}\n paywall_position=${this.paywall_position}\n tracker_page_type=${this.tracker_page_type}\n tracker_content_id=${this.tracker_content_id}\n tracker_content_title=${this.tracker_content_title}\n tracker_content_categories=${this.tracker_content_categories}\n tracker_content_type=${this.tracker_content_type}\n tracker_user_type=${this.tracker_user_type}\n tracker_subscription_status=${this.tracker_subscription_status}\n tracker_page_domain=${this.tracker_page_domain}\n tracker_metered_wall_type=${this.tracker_metered_wall_type}\n tracker_metered_wall_balance=${this\n .tracker_metered_wall_balance}\n ></kompasid-grace-period>\n </div>`\n : subscribeButton()}\n </div>\n `\n }\n\n override async connectedCallback() {\n super.connectedCallback()\n }\n\n render() {\n return html`\n <div class=\"flex flex-shrink-0 flex-col p-4\">\n ${!this.userData\n ? this.renderSkeletonLoading()\n : this.renderProfileContent()}\n </div>\n <hr class=\"border-grey-300 mx-4\" />\n `\n }\n}\n"]}
@@ -57,6 +57,9 @@ export declare class KompasPaywall extends LitElement {
57
57
  tracker_content_title: string;
58
58
  tracker_content_categories: string;
59
59
  tracker_content_type: string;
60
+ tracker_content_tags: string;
61
+ tracker_content_published_date: string;
62
+ tracker_content_variant: string;
60
63
  tracker_user_type: string;
61
64
  tracker_subscription_status: string;
62
65
  tracker_page_domain: string;
@@ -69,6 +72,22 @@ export declare class KompasPaywall extends LitElement {
69
72
  get darkUrl(): "" | "-dark";
70
73
  connectedCallback(): void;
71
74
  getPaywallData(): Promise<void>;
75
+ /**
76
+ * Checks if all strings in the given target tags and variant are found in the given string tag and variant.
77
+ * @param {Contextual} target - The contextual data to be checked.
78
+ * @param {string} stringTag - The string tag to search for.
79
+ * @param {string} stringVariant - The string variant to search for.
80
+ * @returns {boolean} - True if all strings are found, false otherwise.
81
+ */
82
+ private checkAllInString;
83
+ /**
84
+ * Check if the given contextual data is valid based on the following rules:
85
+ * - The published date must be within 90 days from now
86
+ * - The tracker tags and variant must be found in the contextual data
87
+ * @param {Contextual} jsonContextual - The contextual data to be checked
88
+ * @returns {boolean} - True if the contextual data is valid, false otherwise
89
+ */
90
+ private contextualScenario;
72
91
  private transitionBox;
73
92
  private renderEpaperPaywallSection;
74
93
  private renderRegularPaywallSection;
@@ -1,6 +1,7 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { html, css, LitElement, nothing } from 'lit';
3
3
  import { property, state, customElement } from 'lit/decorators.js';
4
+ import { differenceInDays } from 'date-fns';
4
5
  import { TWStyles } from '../../../tailwind/tailwind.js';
5
6
  import '../kompasid-paywall-body/KompasPaywallBody.js';
6
7
  import '../kompasid-paywall-banner-registration/KompasPaywallBannerRegistration.js';
@@ -60,6 +61,9 @@ let KompasPaywall = class KompasPaywall extends LitElement {
60
61
  this.tracker_content_title = '';
61
62
  this.tracker_content_categories = '';
62
63
  this.tracker_content_type = '';
64
+ this.tracker_content_tags = '';
65
+ this.tracker_content_published_date = '';
66
+ this.tracker_content_variant = '';
63
67
  this.tracker_user_type = '';
64
68
  this.tracker_subscription_status = '';
65
69
  this.tracker_page_domain = '';
@@ -249,8 +253,12 @@ let KompasPaywall = class KompasPaywall extends LitElement {
249
253
  }
250
254
  async getPaywallData() {
251
255
  try {
252
- const response = await fetch('https://cdn-www.kompas.id/web-component/paywall.json');
253
- const json = await response.json();
256
+ const [paywallResponse, contextualResponse] = await Promise.all([
257
+ fetch('https://cdn-www.kompas.id/web-component/paywall.json'),
258
+ fetch('https://cdn-www.kompas.id/web-component/contextual_paywall.json'),
259
+ ]);
260
+ const json = await paywallResponse.json();
261
+ const isContextual = this.contextualScenario(await contextualResponse.json());
254
262
  const listType = [
255
263
  'reguler',
256
264
  'audio',
@@ -261,17 +269,24 @@ let KompasPaywall = class KompasPaywall extends LitElement {
261
269
  ];
262
270
  const findTypeOnTheList = listType.includes(this.type);
263
271
  const defaultType = findTypeOnTheList ? this.type : 'reguler';
272
+ const typeContextual = isContextual ? 'typeB' : 'typeA';
264
273
  this.paywallData = {
265
274
  ...this.mockResult,
266
275
  informations: {
267
276
  ...this.mockResult.informations,
268
- title: json[defaultType].head,
269
- description: json[defaultType].content,
277
+ title: json[defaultType][typeContextual]
278
+ ? json[defaultType][typeContextual].head
279
+ : json[defaultType].head,
280
+ description: json[defaultType][typeContextual]
281
+ ? json[defaultType][typeContextual].content
282
+ : json[defaultType].content,
270
283
  cta: json[defaultType].cta,
271
284
  },
272
285
  packages: {
273
286
  ...this.mockResult.packages,
274
- memberships: json[defaultType].memberships,
287
+ memberships: json[defaultType][typeContextual]
288
+ ? json[defaultType][typeContextual].memberships
289
+ : json[defaultType].memberships,
275
290
  swgEnable: json[defaultType].swgEnable,
276
291
  freeTrial: json[defaultType].freeTrial,
277
292
  swgContent: json[defaultType].swgContent,
@@ -285,6 +300,49 @@ let KompasPaywall = class KompasPaywall extends LitElement {
285
300
  this.isLoading = false;
286
301
  }
287
302
  }
303
+ /**
304
+ * Checks if all strings in the given target tags and variant are found in the given string tag and variant.
305
+ * @param {Contextual} target - The contextual data to be checked.
306
+ * @param {string} stringTag - The string tag to search for.
307
+ * @param {string} stringVariant - The string variant to search for.
308
+ * @returns {boolean} - True if all strings are found, false otherwise.
309
+ */
310
+ checkAllInString(target, stringTag, stringVariant) {
311
+ const tagsTarget = target.tags;
312
+ const variantTarget = target.variant;
313
+ const checkVariant = variantTarget.toLowerCase() === stringVariant.toLowerCase();
314
+ const checkTags = () => {
315
+ for (const item of tagsTarget) {
316
+ if (!stringTag.toLowerCase().includes(item.toLowerCase())) {
317
+ return false;
318
+ }
319
+ }
320
+ return true;
321
+ };
322
+ return checkVariant && checkTags();
323
+ }
324
+ /**
325
+ * Check if the given contextual data is valid based on the following rules:
326
+ * - The published date must be within 90 days from now
327
+ * - The tracker tags and variant must be found in the contextual data
328
+ * @param {Contextual} jsonContextual - The contextual data to be checked
329
+ * @returns {boolean} - True if the contextual data is valid, false otherwise
330
+ */
331
+ contextualScenario(jsonContextual) {
332
+ if (!jsonContextual) {
333
+ return false;
334
+ }
335
+ const { tracker_content_published_date: publishedDate, tracker_content_tags: trackerTags, tracker_content_variant: trackerVariant, } = this;
336
+ if (!publishedDate || !trackerVariant || !trackerTags) {
337
+ return false;
338
+ }
339
+ const nowDate = new Date();
340
+ const isoDateString = publishedDate.replace(' ', 'T');
341
+ const publishedDateObj = new Date(isoDateString);
342
+ const isWithin90Days = differenceInDays(publishedDateObj, nowDate) <= -90; // differenceInDays jika tanggal telah melewati 90 hari
343
+ const hasMatchingTagsAndVariants = this.checkAllInString(jsonContextual, trackerTags, trackerVariant); // checkAllInString jika ada tag yang cocok
344
+ return isWithin90Days || hasMatchingTagsAndVariants;
345
+ }
288
346
  transitionBox() {
289
347
  return html `
290
348
  <div
@@ -305,6 +363,9 @@ let KompasPaywall = class KompasPaywall extends LitElement {
305
363
  tracker_content_id=${this.tracker_content_id}
306
364
  tracker_content_title=${this.tracker_content_title}
307
365
  tracker_content_categories=${this.tracker_content_categories}
366
+ tracker_content_tags=${this.tracker_content_tags}
367
+ tracker_content_published_date=${this.tracker_content_published_date}
368
+ tracker_content_variant=${this.tracker_content_variant}
308
369
  tracker_user_type=${this.tracker_user_type}
309
370
  tracker_subscription_status=${this.tracker_subscription_status}
310
371
  tracker_page_domain=${this.tracker_page_domain}
@@ -350,6 +411,10 @@ let KompasPaywall = class KompasPaywall extends LitElement {
350
411
  tracker_content_id=${this.tracker_content_id}
351
412
  tracker_content_title=${this.tracker_content_title}
352
413
  tracker_content_categories=${this.tracker_content_categories}
414
+ tracker_content_tags=${this.tracker_content_tags}
415
+ tracker_content_published_date=${this
416
+ .tracker_content_published_date}
417
+ tracker_content_variant=${this.tracker_content_variant}
353
418
  tracker_user_type=${this.tracker_user_type}
354
419
  tracker_subscription_status=${this.tracker_subscription_status}
355
420
  tracker_page_domain=${this.tracker_page_domain}
@@ -393,6 +458,10 @@ let KompasPaywall = class KompasPaywall extends LitElement {
393
458
  tracker_content_id=${this.tracker_content_id}
394
459
  tracker_content_title=${this.tracker_content_title}
395
460
  tracker_content_categories=${this.tracker_content_categories}
461
+ tracker_content_tags=${this.tracker_content_tags}
462
+ tracker_content_published_date=${this
463
+ .tracker_content_published_date}
464
+ tracker_content_variant=${this.tracker_content_variant}
396
465
  tracker_user_type=${this.tracker_user_type}
397
466
  tracker_subscription_status=${this.tracker_subscription_status}
398
467
  tracker_epaper_edition=${this.tracker_epaper_edition}
@@ -441,6 +510,10 @@ let KompasPaywall = class KompasPaywall extends LitElement {
441
510
  tracker_content_id=${this.tracker_content_id}
442
511
  tracker_content_title=${this.tracker_content_title}
443
512
  tracker_content_categories=${this.tracker_content_categories}
513
+ tracker_content_tags=${this.tracker_content_tags}
514
+ tracker_content_published_date=${this
515
+ .tracker_content_published_date}
516
+ tracker_content_variant=${this.tracker_content_variant}
444
517
  tracker_user_type=${this.tracker_user_type}
445
518
  tracker_subscription_status=${this.tracker_subscription_status}
446
519
  tracker_page_domain=${this.tracker_page_domain}
@@ -485,6 +558,10 @@ let KompasPaywall = class KompasPaywall extends LitElement {
485
558
  tracker_content_id=${this.tracker_content_id}
486
559
  tracker_content_title=${this.tracker_content_title}
487
560
  tracker_content_categories=${this.tracker_content_categories}
561
+ tracker_content_tags=${this.tracker_content_tags}
562
+ tracker_content_published_date=${this
563
+ .tracker_content_published_date}
564
+ tracker_content_variant=${this.tracker_content_variant}
488
565
  tracker_user_type=${this.tracker_user_type}
489
566
  tracker_subscription_status=${this.tracker_subscription_status}
490
567
  tracker_epaper_edition=${this.tracker_epaper_edition}
@@ -613,6 +690,15 @@ __decorate([
613
690
  __decorate([
614
691
  property({ type: String })
615
692
  ], KompasPaywall.prototype, "tracker_content_type", void 0);
693
+ __decorate([
694
+ property({ type: String })
695
+ ], KompasPaywall.prototype, "tracker_content_tags", void 0);
696
+ __decorate([
697
+ property({ type: String })
698
+ ], KompasPaywall.prototype, "tracker_content_published_date", void 0);
699
+ __decorate([
700
+ property({ type: String })
701
+ ], KompasPaywall.prototype, "tracker_content_variant", void 0);
616
702
  __decorate([
617
703
  property({ type: String })
618
704
  ], KompasPaywall.prototype, "tracker_user_type", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"KompasPaywall.js","sourceRoot":"","sources":["../../../../src/components/kompasid-paywall/KompasPaywall.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AAExD,OAAO,+CAA+C,CAAA;AACtD,OAAO,4EAA4E,CAAA;AACnF,OAAO,0EAA0E,CAAA;AAG1E,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IAAtC;;QAgCL;;WAEG;QACH;;;;;;;;;;;;;;;;;;;;;;;;;;;WA2BG;QAEc,gBAAW,GAAmB,EAAoB,CAAA;QAClD,WAAM,GAAY,IAAI,CAAA;QACtB,cAAS,GAAY,IAAI,CAAA;QAEb,YAAO,GAAG,KAAK,CAAA;QAChB,qBAAgB,GAAG,CAAC,CAAA;QACpB,SAAI,GAAgB,SAAS,CAAA;QAC5B,iBAAY,GAAG,KAAK,CAAA;QACrB,eAAU,GAAG,EAAE,CAAA;QACf,aAAQ,GAAG,EAAE,CAAA;QACb,uBAAkB,GAAG,EAAE,CAAA;QACtB,cAAS,GAAG,KAAK,CAAA;QAClB,qBAAgB,GAAG,EAAE,CAAA;QACr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Q,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAAuB;AACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kEAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0DAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gEAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mEAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6DAA4B;AAC3B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gEAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAW;AA7F3B,aAAa;IADzB,aAAa,CAAC,kBAAkB,CAAC;GACrB,aAAa,CA+iBzB;SA/iBY,aAAa","sourcesContent":["import { html, css, LitElement, nothing } from 'lit'\nimport { property, state, customElement } from 'lit/decorators.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { PaywallProduct, PaywallType } from './types.js'\nimport '../kompasid-paywall-body/KompasPaywallBody.js'\nimport '../kompasid-paywall-banner-registration/KompasPaywallBannerRegistration.js'\nimport '../kompasid-paywall-information-header/KompasPaywallInformationHeader.js'\n\n@customElement('kompasid-paywall')\nexport class KompasPaywall extends LitElement {\n static styles = [\n css`\n :host {\n font-family: 'PT Sans', sans-serif;\n }\n\n .transparent-linear {\n background-image: -webkit-gradient(\n linear,\n left top,\n left bottom,\n from(hsla(0, 0%, 100%, 0)),\n to(#fff)\n );\n background-image: linear-gradient(180deg, hsla(0, 0%, 100%, 0), #fff);\n }\n\n .transparent-linear-dark {\n background-image: -webkit-gradient(\n linear,\n left top,\n left bottom,\n from(hsla(0, 0%, 18%, 0)),\n to(#121212)\n );\n background-image: linear-gradient(180deg, hsla(0, 0%, 18%, 0), #121212);\n }\n `,\n TWStyles,\n ]\n\n /**\n * Props\n */\n /**\n * property isLogin untuk menghandle apakah user sudah login atau belum\n * property countdownArticle untuk menghandle count artikel\n * property type untuk menghandle tipe epaper\n * property isWithHeader untuk menghandle paywall information header\n * property textHeader digunakan sebagai text pada paywall information header\n * property paywallData untuk menghandle data paywall\n * property userGuid untuk menghandle user Guid\n * property subscriptionStatus untuk menghandle status subscription user\n * property swgEnable untuk menghandle swg apakah di aktifkan atau tidak\n * property paywall_location = The location where user encounter the paywall\n * property paywall_subscription_package = The name of the subscription package viewed by user\n * property paywall_subscription_id = The ID of the subscription package viewed by user\n * property paywall_subscription_price = The price of the subscriprtion package viewed by user\n * property paywall_position = The position of the subscription package viewed by user\n * property page_type = Type of the page\n * property content_id = ID of article (slug)\n * property content_type = Whether it's free article or paid article\n * property content_title = The title of article\n * property tracker_content_categories = The category of the content\n * property user_type = Type of user based on their subscription\n * property subscription_status = Status of their subscription\n * property page_domain = Page Domain\n * property metered_wall_type = The type of Metered Wall\n * property metered_wall_balance = The balance of their metered wall\n * property epaper_edition = The edition of epaper viewed by user\n * property theme = The theme of the paywall component\n */\n\n @state() private paywallData: PaywallProduct = {} as PaywallProduct\n @state() private isOpen: Boolean = true\n @state() private isLoading: Boolean = true\n\n @property({ type: Boolean }) isLogin = false\n @property({ type: Number }) countdownArticle = 0\n @property({ type: String }) type: PaywallType = 'reguler'\n @property({ type: Boolean }) isWithHeader = false\n @property({ type: String }) textHeader = ''\n @property({ type: String }) userGuid = ''\n @property({ type: String }) subscriptionStatus = ''\n @property({ type: Boolean }) swgEnable = false\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 = 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 }) tracker_epaper_edition = ''\n @property({ type: String }) tracker_content_publisher = ''\n @property({ type: String }) theme = ''\n\n mockResult: PaywallProduct = {\n informations: {\n title: '',\n description: [],\n register: {\n img: 'https://www.kompas.id/img/backgrounds/ilustrasi-banner-registration.png',\n title: 'Ingin Membaca Artikel Ini Secara Utuh?',\n subtitle: 'Daftar akun untuk membaca 5 artikel premium secara gratis ',\n label: 'Daftar Sekarang ',\n },\n meterred: {\n maxQuota: 5,\n label: 'Langganan',\n maxQuotaMessage: 'Akses artikel gratis Anda bulan ini sudah habis.',\n url: 'https://kompas.id/berlangganan',\n },\n cta: {\n show: true,\n text: 'Lihat Paket Lainnya',\n url: 'https://www.kompas.id/berlangganan/v2',\n },\n },\n packages: {\n title: 'Sekali bayar, tanpa perpanjang otomatis',\n memberships: [],\n swgEnable: false,\n freeTrial: {\n packageText: 'untuk 3 hari pertama',\n desktopText:\n 'Coba gratis 3 hari Kompas.id melalui aplikasi. Pindai kode QR dengan ponsel atau tablet untuk mengunduh aplikasi.',\n mobileText:\n 'Dapatkan akses gratis selama 3 hari ke konten dan fitur premium Kompas.id di aplikasi.',\n },\n swgContent: {\n introductory: {\n price: 'Rp. 10.000',\n description: 'untuk 1 bulan pertama',\n duration: '',\n },\n default: {\n price: '',\n description: 'Berlangganan lebih mudah dengan Google',\n duration: '',\n },\n },\n },\n payment: {\n desktop: [\n {\n name: 'gopay',\n link: `https://cdn-www.cloudfront.net/paywall-asset/gopay${this.darkUrl}.svg`,\n },\n {\n name: 'ovo',\n link: `https://cdn-www.cloudfront.net/paywall-asset/ovo${this.darkUrl}.svg`,\n },\n {\n name: 'mastercard',\n link: `https://cdn-www.cloudfront.net/paywall-asset/mastercard${this.darkUrl}.svg`,\n },\n {\n name: 'bri',\n link: `https://cdn-www.cloudfront.net/paywall-asset/bri${this.darkUrl}.svg`,\n },\n {\n name: 'bcaklikpay',\n link: `https://cdn-www.cloudfront.net/paywall-asset/bca-klik-pay${this.darkUrl}.svg`,\n },\n {\n name: 'indomaret',\n link: `https://cdn-www.cloudfront.net/paywall-asset/indomaret${this.darkUrl}.svg`,\n },\n {\n name: 'jcb',\n link: `https://cdn-www.cloudfront.net/paywall-asset/jcb${this.darkUrl}.svg`,\n },\n {\n name: 'dana',\n link: `https://cdn-www.cloudfront.net/paywall-asset/dana${this.darkUrl}.svg`,\n },\n {\n name: 'visa',\n link: `https://cdn-www.cloudfront.net/paywall-asset/visa${this.darkUrl}.svg`,\n },\n {\n name: 'mandiri',\n link: `https://cdn-www.cloudfront.net/paywall-asset/mandiri${this.darkUrl}.svg`,\n },\n {\n name: 'bca',\n link: `https://cdn-www.cloudfront.net/paywall-asset/bca${this.darkUrl}.svg`,\n },\n {\n name: 'bni',\n link: `https://cdn-www.cloudfront.net/paywall-asset/bni${this.darkUrl}.svg`,\n },\n {\n name: 'akulaku',\n link: `https://cdn-www.cloudfront.net/paywall-asset/akulaku${this.darkUrl}.svg`,\n },\n ],\n mobile: [\n {\n name: 'gopay',\n link: `https://cdn-www.cloudfront.net/paywall-asset/gopay${this.darkUrl}.svg`,\n },\n {\n name: 'ovo',\n link: `https://cdn-www.cloudfront.net/paywall-asset/ovo${this.darkUrl}.svg`,\n },\n {\n name: 'visa',\n link: `https://cdn-www.cloudfront.net/paywall-asset/visa${this.darkUrl}.svg`,\n },\n {\n name: 'mastercard',\n link: `https://cdn-www.cloudfront.net/paywall-asset/mastercard${this.darkUrl}.svg`,\n },\n ],\n ekstension: [\n {\n name: 'dana',\n link: `https://cdn-www.cloudfront.net/paywall-asset/dana${this.darkUrl}.svg`,\n },\n {\n name: 'mandiri',\n link: `https://cdn-www.cloudfront.net/paywall-asset/mandiri${this.darkUrl}.svg`,\n },\n {\n name: 'bri',\n link: `https://cdn-www.cloudfront.net/paywall-asset/bri${this.darkUrl}.svg`,\n },\n {\n name: 'bcaklikpay',\n link: `https://cdn-www.cloudfront.net/paywall-asset/bca-klik-pay${this.darkUrl}.svg`,\n },\n {\n name: 'akulaku',\n link: `https://cdn-www.cloudfront.net/paywall-asset/akulaku${this.darkUrl}.svg`,\n },\n {\n name: 'bni',\n link: `https://cdn-www.cloudfront.net/paywall-asset/bni${this.darkUrl}.svg`,\n },\n {\n name: 'indomaret',\n link: `https://cdn-www.cloudfront.net/paywall-asset/indomaret${this.darkUrl}.svg`,\n },\n {\n name: 'bca',\n link: `https://cdn-www.cloudfront.net/paywall-asset/bca${this.darkUrl}.svg`,\n },\n {\n name: 'jcb',\n link: `https://cdn-www.cloudfront.net/paywall-asset/jcb${this.darkUrl}.svg`,\n },\n ],\n },\n }\n\n get darkUrl() {\n return this.theme === 'dark' ? '-dark' : ''\n }\n\n override connectedCallback() {\n super.connectedCallback()\n this.getPaywallData()\n }\n\n async getPaywallData() {\n try {\n const response = await fetch(\n 'https://cdn-www.kompas.id/web-component/paywall.json'\n )\n const json = await response.json()\n const listType = [\n 'reguler',\n 'audio',\n 'proMiningOutlook',\n 'proMiningArticle',\n 'epaper',\n 'custom',\n ]\n const findTypeOnTheList = listType.includes(this.type)\n const defaultType = findTypeOnTheList ? this.type : 'reguler'\n this.paywallData = {\n ...this.mockResult,\n informations: {\n ...this.mockResult.informations,\n title: json[defaultType].head,\n description: json[defaultType].content,\n cta: json[defaultType].cta,\n },\n packages: {\n ...this.mockResult.packages,\n memberships: json[defaultType].memberships,\n swgEnable: json[defaultType].swgEnable,\n freeTrial: json[defaultType].freeTrial,\n swgContent: json[defaultType].swgContent,\n },\n }\n } catch (error) {\n throw Error('Failed to get paywall data')\n } finally {\n this.isLoading = false\n }\n }\n\n private transitionBox() {\n return html`\n <div\n class=\"h-20 ${this.theme === 'dark'\n ? 'transparent-linear-dark'\n : 'transparent-linear'} -mt-24 z-0 w-full\"\n ></div>\n `\n }\n\n private renderEpaperPaywallSection() {\n return html`<kompasid-paywall-body\n paywall_location=${this.paywall_location}\n paywall_subscription_package=${this.paywall_subscription_package}\n paywall_subscription_id=${this.paywall_subscription_id}\n paywall_subscription_price=${this.paywall_subscription_price}\n paywall_position=${this.paywall_position}\n tracker_page_type=${this.tracker_page_type}\n tracker_content_id=${this.tracker_content_id}\n tracker_content_title=${this.tracker_content_title}\n tracker_content_categories=${this.tracker_content_categories}\n tracker_user_type=${this.tracker_user_type}\n tracker_subscription_status=${this.tracker_subscription_status}\n tracker_page_domain=${this.tracker_page_domain}\n tracker_metered_wall_type=${this.tracker_metered_wall_type}\n tracker_epaper_edition=${this.tracker_epaper_edition}\n tracker_metered_wall_balance=${this.tracker_metered_wall_balance}\n tracker_content_publisher=${this.tracker_content_publisher}\n ?swgEnable=${this.swgEnable}\n tracker_content_type=${this.tracker_content_type}\n ?isLogin=${this.isLogin}\n type=${this.type}\n countdownArticle=${this.countdownArticle}\n .paywallData=${this.paywallData}\n subscriptionStatus=${this.subscriptionStatus}\n userGuid=${this.userGuid}\n theme=${this.theme}\n ></kompasid-paywall-body>`\n }\n\n private renderRegularPaywallSection() {\n const defaultHeaderText: string =\n this.paywallData.informations.meterred.maxQuotaMessage\n if (this.isWithHeader) {\n return html`\n <div>\n ${this.transitionBox()}\n <div\n class=\"flex flex-col ${this.theme === 'dark'\n ? 'bg-dark-5'\n : 'bg-white'} items-center justify-center mx-4 md:mx-0\"\n >\n <div class=\"flex flex-col w-full max-w-screen-md my-5\">\n <kompasid-paywall-information-header\n text=${this.textHeader || defaultHeaderText}\n theme=${this.theme}\n ></kompasid-paywall-information-header>\n <kompasid-paywall-body\n paywall_location=${this.paywall_location}\n paywall_subscription_package=${this\n .paywall_subscription_package}\n paywall_subscription_id=${this.paywall_subscription_id}\n paywall_subscription_price=${this.paywall_subscription_price}\n paywall_position=${this.paywall_position}\n tracker_page_type=${this.tracker_page_type}\n tracker_content_id=${this.tracker_content_id}\n tracker_content_title=${this.tracker_content_title}\n tracker_content_categories=${this.tracker_content_categories}\n tracker_user_type=${this.tracker_user_type}\n tracker_subscription_status=${this.tracker_subscription_status}\n tracker_page_domain=${this.tracker_page_domain}\n tracker_metered_wall_type=${this.tracker_metered_wall_type}\n tracker_epaper_edition=${this.tracker_epaper_edition}\n tracker_metered_wall_balance=${this\n .tracker_metered_wall_balance}\n tracker_content_type=${this.tracker_content_type}\n tracker_content_publisher=${this.tracker_content_publisher}\n ?swgEnable=${this.swgEnable}\n ?isLogin=${this.isLogin}\n type=${this.type}\n countdownArticle=${this.countdownArticle}\n .paywallData=${this.paywallData}\n subscriptionStatus=${this.subscriptionStatus}\n userGuid=${this.userGuid}\n theme=${this.theme}\n ></kompasid-paywall-body>\n </div>\n </div>\n </div>\n `\n }\n return html`\n <div>\n ${this.transitionBox()}\n <div\n class=\"flex flex-col ${this.theme === 'dark'\n ? 'bg-dark-5'\n : 'bg-white'} items-center justify-center mx-4 md:mx-0\"\n >\n <div class=\"flex flex-col w-full max-w-screen-md my-5\">\n <kompasid-paywall-body\n tracker_content_type=${this.tracker_content_type}\n paywall_location=${this.paywall_location}\n paywall_subscription_package=${this.paywall_subscription_package}\n paywall_subscription_id=${this.paywall_subscription_id}\n paywall_subscription_price=${this.paywall_subscription_price}\n paywall_position=${this.paywall_position}\n tracker_page_type=${this.tracker_page_type}\n tracker_content_id=${this.tracker_content_id}\n tracker_content_title=${this.tracker_content_title}\n tracker_content_categories=${this.tracker_content_categories}\n tracker_user_type=${this.tracker_user_type}\n tracker_subscription_status=${this.tracker_subscription_status}\n tracker_epaper_edition=${this.tracker_epaper_edition}\n tracker_page_domain=${this.tracker_page_domain}\n tracker_metered_wall_type=${this.tracker_metered_wall_type}\n tracker_metered_wall_balance=${this.tracker_metered_wall_balance}\n tracker_content_publisher=${this.tracker_content_publisher}\n ?swgEnable=${this.swgEnable}\n ?isLogin=${this.isLogin}\n type=${this.type}\n countdownArticle=${this.countdownArticle}\n .paywallData=${this.paywallData}\n subscriptionStatus=${this.subscriptionStatus}\n userGuid=${this.userGuid}\n theme=${this.theme}\n ></kompasid-paywall-body>\n </div>\n </div>\n </div>\n `\n }\n\n private renderAudioPaywallSection() {\n const defaultHeaderText: string =\n this.paywallData.informations.meterred.maxQuotaMessage\n if (this.isWithHeader) {\n return html`\n <div>\n ${this.transitionBox()}\n <div\n class=\"flex flex-col ${this.theme === 'dark'\n ? 'bg-dark-5'\n : 'bg-white'} items-center justify-center mx-4 md:mx-0\"\n >\n <div class=\"flex flex-col w-full max-w-screen-md my-5\">\n <kompasid-paywall-information-header\n text=${this.textHeader || defaultHeaderText}\n theme=${this.theme}\n ></kompasid-paywall-information-header>\n <kompasid-paywall-body\n paywall_location=${this.paywall_location}\n paywall_subscription_package=${this\n .paywall_subscription_package}\n paywall_subscription_id=${this.paywall_subscription_id}\n paywall_subscription_price=${this.paywall_subscription_price}\n paywall_position=${this.paywall_position}\n tracker_page_type=${this.tracker_page_type}\n tracker_content_id=${this.tracker_content_id}\n tracker_content_title=${this.tracker_content_title}\n tracker_content_categories=${this.tracker_content_categories}\n tracker_user_type=${this.tracker_user_type}\n tracker_subscription_status=${this.tracker_subscription_status}\n tracker_page_domain=${this.tracker_page_domain}\n tracker_metered_wall_type=${this.tracker_metered_wall_type}\n tracker_epaper_edition=${this.tracker_epaper_edition}\n tracker_metered_wall_balance=${this\n .tracker_metered_wall_balance}\n tracker_content_type=${this.tracker_content_type}\n tracker_content_publisher=${this.tracker_content_publisher}\n ?swgEnable=${this.swgEnable}\n ?isLogin=${this.isLogin}\n type=${this.type}\n countdownArticle=${this.countdownArticle}\n .paywallData=${this.paywallData}\n subscriptionStatus=${this.subscriptionStatus}\n userGuid=${this.userGuid}\n theme=${this.theme}\n .togglePaywall=${() => this.togglePaywall()}\n ></kompasid-paywall-body>\n </div>\n </div>\n </div>\n `\n }\n return html`\n <div>\n ${this.transitionBox()}\n <div\n class=\"flex flex-col ${this.theme === 'dark'\n ? 'bg-dark-5'\n : 'bg-white'} items-center justify-center mx-4 md:mx-0\"\n >\n <div class=\"flex flex-col w-full max-w-screen-md my-5\">\n <kompasid-paywall-body\n tracker_content_type=${this.tracker_content_type}\n paywall_location=${this.paywall_location}\n paywall_subscription_package=${this.paywall_subscription_package}\n paywall_subscription_id=${this.paywall_subscription_id}\n paywall_subscription_price=${this.paywall_subscription_price}\n paywall_position=${this.paywall_position}\n tracker_page_type=${this.tracker_page_type}\n tracker_content_id=${this.tracker_content_id}\n tracker_content_title=${this.tracker_content_title}\n tracker_content_categories=${this.tracker_content_categories}\n tracker_user_type=${this.tracker_user_type}\n tracker_subscription_status=${this.tracker_subscription_status}\n tracker_epaper_edition=${this.tracker_epaper_edition}\n tracker_page_domain=${this.tracker_page_domain}\n tracker_metered_wall_type=${this.tracker_metered_wall_type}\n tracker_metered_wall_balance=${this.tracker_metered_wall_balance}\n tracker_content_publisher=${this.tracker_content_publisher}\n ?swgEnable=${this.swgEnable}\n ?isLogin=${this.isLogin}\n type=${this.type}\n countdownArticle=${this.countdownArticle}\n .paywallData=${this.paywallData}\n subscriptionStatus=${this.subscriptionStatus}\n userGuid=${this.userGuid}\n theme=${this.theme}\n .togglePaywall=${() => this.togglePaywall()}\n ></kompasid-paywall-body>\n </div>\n </div>\n </div>\n `\n }\n\n private selectorTypePaywall = (type: PaywallType) => {\n switch (type) {\n case 'epaper':\n case 'proMiningOutlook':\n return this.renderEpaperPaywallSection()\n case 'audio':\n return this.renderAudioPaywallSection()\n case 'proMiningArticle':\n case 'reguler':\n return this.renderRegularPaywallSection()\n default:\n return this.renderRegularPaywallSection()\n }\n }\n\n private togglePaywall() {\n this.isOpen = !this.isOpen\n }\n\n render() {\n return !this.isLoading && this.isOpen\n ? html`\n <div class=\"relative w-full\">\n ${this.selectorTypePaywall(this.type)}\n </div>\n `\n : nothing\n }\n}\n"]}
1
+ {"version":3,"file":"KompasPaywall.js","sourceRoot":"","sources":["../../../../src/components/kompasid-paywall/KompasPa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EAAE,CAAC;kEAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0DAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gEAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mEAAiC;AAChC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6DAA4B;AAC3B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gEAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAW;AAhG3B,aAAa;IADzB,aAAa,CAAC,kBAAkB,CAAC;GACrB,aAAa,CAkpBzB;SAlpBY,aAAa","sourcesContent":["import { html, css, LitElement, nothing } from 'lit'\nimport { property, state, customElement } from 'lit/decorators.js'\nimport { differenceInDays } from 'date-fns'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { PaywallProduct, PaywallType, Contextual } from './types.js'\nimport '../kompasid-paywall-body/KompasPaywallBody.js'\nimport '../kompasid-paywall-banner-registration/KompasPaywallBannerRegistration.js'\nimport '../kompasid-paywall-information-header/KompasPaywallInformationHeader.js'\n\n@customElement('kompasid-paywall')\nexport class KompasPaywall extends LitElement {\n static styles = [\n css`\n :host {\n font-family: 'PT Sans', sans-serif;\n }\n\n .transparent-linear {\n background-image: -webkit-gradient(\n linear,\n left top,\n left bottom,\n from(hsla(0, 0%, 100%, 0)),\n to(#fff)\n );\n background-image: linear-gradient(180deg, hsla(0, 0%, 100%, 0), #fff);\n }\n\n .transparent-linear-dark {\n background-image: -webkit-gradient(\n linear,\n left top,\n left bottom,\n from(hsla(0, 0%, 18%, 0)),\n to(#121212)\n );\n background-image: linear-gradient(180deg, hsla(0, 0%, 18%, 0), #121212);\n }\n `,\n TWStyles,\n ]\n\n /**\n * Props\n */\n /**\n * property isLogin untuk menghandle apakah user sudah login atau belum\n * property countdownArticle untuk menghandle count artikel\n * property type untuk menghandle tipe epaper\n * property isWithHeader untuk menghandle paywall information header\n * property textHeader digunakan sebagai text pada paywall information header\n * property paywallData untuk menghandle data paywall\n * property userGuid untuk menghandle user Guid\n * property subscriptionStatus untuk menghandle status subscription user\n * property swgEnable untuk menghandle swg apakah di aktifkan atau tidak\n * property paywall_location = The location where user encounter the paywall\n * property paywall_subscription_package = The name of the subscription package viewed by user\n * property paywall_subscription_id = The ID of the subscription package viewed by user\n * property paywall_subscription_price = The price of the subscriprtion package viewed by user\n * property paywall_position = The position of the subscription package viewed by user\n * property page_type = Type of the page\n * property content_id = ID of article (slug)\n * property content_type = Whether it's free article or paid article\n * property content_title = The title of article\n * property tracker_content_categories = The category of the content\n * property user_type = Type of user based on their subscription\n * property subscription_status = Status of their subscription\n * property page_domain = Page Domain\n * property metered_wall_type = The type of Metered Wall\n * property metered_wall_balance = The balance of their metered wall\n * property epaper_edition = The edition of epaper viewed by user\n * property theme = The theme of the paywall component\n */\n\n @state() private paywallData: PaywallProduct = {} as PaywallProduct\n @state() private isOpen: Boolean = true\n @state() private isLoading: Boolean = true\n\n @property({ type: Boolean }) isLogin = false\n @property({ type: Number }) countdownArticle = 0\n @property({ type: String }) type: PaywallType = 'reguler'\n @property({ type: Boolean }) isWithHeader = false\n @property({ type: String }) textHeader = ''\n @property({ type: String }) userGuid = ''\n @property({ type: String }) subscriptionStatus = ''\n @property({ type: Boolean }) swgEnable = false\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 = 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_content_tags = ''\n @property({ type: String }) tracker_content_published_date = ''\n @property({ type: String }) tracker_content_variant = ''\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 }) tracker_epaper_edition = ''\n @property({ type: String }) tracker_content_publisher = ''\n @property({ type: String }) theme = ''\n\n mockResult: PaywallProduct = {\n informations: {\n title: '',\n description: [],\n register: {\n img: 'https://www.kompas.id/img/backgrounds/ilustrasi-banner-registration.png',\n title: 'Ingin Membaca Artikel Ini Secara Utuh?',\n subtitle: 'Daftar akun untuk membaca 5 artikel premium secara gratis ',\n label: 'Daftar Sekarang ',\n },\n meterred: {\n maxQuota: 5,\n label: 'Langganan',\n maxQuotaMessage: 'Akses artikel gratis Anda bulan ini sudah habis.',\n url: 'https://kompas.id/berlangganan',\n },\n cta: {\n show: true,\n text: 'Lihat Paket Lainnya',\n url: 'https://www.kompas.id/berlangganan/v2',\n },\n },\n packages: {\n title: 'Sekali bayar, tanpa perpanjang otomatis',\n memberships: [],\n swgEnable: false,\n freeTrial: {\n packageText: 'untuk 3 hari pertama',\n desktopText:\n 'Coba gratis 3 hari Kompas.id melalui aplikasi. Pindai kode QR dengan ponsel atau tablet untuk mengunduh aplikasi.',\n mobileText:\n 'Dapatkan akses gratis selama 3 hari ke konten dan fitur premium Kompas.id di aplikasi.',\n },\n swgContent: {\n introductory: {\n price: 'Rp. 10.000',\n description: 'untuk 1 bulan pertama',\n duration: '',\n },\n default: {\n price: '',\n description: 'Berlangganan lebih mudah dengan Google',\n duration: '',\n },\n },\n },\n payment: {\n desktop: [\n {\n name: 'gopay',\n link: `https://cdn-www.cloudfront.net/paywall-asset/gopay${this.darkUrl}.svg`,\n },\n {\n name: 'ovo',\n link: `https://cdn-www.cloudfront.net/paywall-asset/ovo${this.darkUrl}.svg`,\n },\n {\n name: 'mastercard',\n link: `https://cdn-www.cloudfront.net/paywall-asset/mastercard${this.darkUrl}.svg`,\n },\n {\n name: 'bri',\n link: `https://cdn-www.cloudfront.net/paywall-asset/bri${this.darkUrl}.svg`,\n },\n {\n name: 'bcaklikpay',\n link: `https://cdn-www.cloudfront.net/paywall-asset/bca-klik-pay${this.darkUrl}.svg`,\n },\n {\n name: 'indomaret',\n link: `https://cdn-www.cloudfront.net/paywall-asset/indomaret${this.darkUrl}.svg`,\n },\n {\n name: 'jcb',\n link: `https://cdn-www.cloudfront.net/paywall-asset/jcb${this.darkUrl}.svg`,\n },\n {\n name: 'dana',\n link: `https://cdn-www.cloudfront.net/paywall-asset/dana${this.darkUrl}.svg`,\n },\n {\n name: 'visa',\n link: `https://cdn-www.cloudfront.net/paywall-asset/visa${this.darkUrl}.svg`,\n },\n {\n name: 'mandiri',\n link: `https://cdn-www.cloudfront.net/paywall-asset/mandiri${this.darkUrl}.svg`,\n },\n {\n name: 'bca',\n link: `https://cdn-www.cloudfront.net/paywall-asset/bca${this.darkUrl}.svg`,\n },\n {\n name: 'bni',\n link: `https://cdn-www.cloudfront.net/paywall-asset/bni${this.darkUrl}.svg`,\n },\n {\n name: 'akulaku',\n link: `https://cdn-www.cloudfront.net/paywall-asset/akulaku${this.darkUrl}.svg`,\n },\n ],\n mobile: [\n {\n name: 'gopay',\n link: `https://cdn-www.cloudfront.net/paywall-asset/gopay${this.darkUrl}.svg`,\n },\n {\n name: 'ovo',\n link: `https://cdn-www.cloudfront.net/paywall-asset/ovo${this.darkUrl}.svg`,\n },\n {\n name: 'visa',\n link: `https://cdn-www.cloudfront.net/paywall-asset/visa${this.darkUrl}.svg`,\n },\n {\n name: 'mastercard',\n link: `https://cdn-www.cloudfront.net/paywall-asset/mastercard${this.darkUrl}.svg`,\n },\n ],\n ekstension: [\n {\n name: 'dana',\n link: `https://cdn-www.cloudfront.net/paywall-asset/dana${this.darkUrl}.svg`,\n },\n {\n name: 'mandiri',\n link: `https://cdn-www.cloudfront.net/paywall-asset/mandiri${this.darkUrl}.svg`,\n },\n {\n name: 'bri',\n link: `https://cdn-www.cloudfront.net/paywall-asset/bri${this.darkUrl}.svg`,\n },\n {\n name: 'bcaklikpay',\n link: `https://cdn-www.cloudfront.net/paywall-asset/bca-klik-pay${this.darkUrl}.svg`,\n },\n {\n name: 'akulaku',\n link: `https://cdn-www.cloudfront.net/paywall-asset/akulaku${this.darkUrl}.svg`,\n },\n {\n name: 'bni',\n link: `https://cdn-www.cloudfront.net/paywall-asset/bni${this.darkUrl}.svg`,\n },\n {\n name: 'indomaret',\n link: `https://cdn-www.cloudfront.net/paywall-asset/indomaret${this.darkUrl}.svg`,\n },\n {\n name: 'bca',\n link: `https://cdn-www.cloudfront.net/paywall-asset/bca${this.darkUrl}.svg`,\n },\n {\n name: 'jcb',\n link: `https://cdn-www.cloudfront.net/paywall-asset/jcb${this.darkUrl}.svg`,\n },\n ],\n },\n }\n\n get darkUrl() {\n return this.theme === 'dark' ? '-dark' : ''\n }\n\n override connectedCallback() {\n super.connectedCallback()\n this.getPaywallData()\n }\n\n async getPaywallData() {\n try {\n const [paywallResponse, contextualResponse] = await Promise.all([\n fetch('https://cdn-www.kompas.id/web-component/paywall.json'),\n fetch(\n 'https://cdn-www.kompas.id/web-component/contextual_paywall.json'\n ),\n ])\n const json = await paywallResponse.json()\n const isContextual = this.contextualScenario(\n await contextualResponse.json()\n )\n const listType = [\n 'reguler',\n 'audio',\n 'proMiningOutlook',\n 'proMiningArticle',\n 'epaper',\n 'custom',\n ]\n const findTypeOnTheList = listType.includes(this.type)\n const defaultType = findTypeOnTheList ? this.type : 'reguler'\n const typeContextual = isContextual ? 'typeB' : 'typeA'\n this.paywallData = {\n ...this.mockResult,\n informations: {\n ...this.mockResult.informations,\n title: json[defaultType][typeContextual]\n ? json[defaultType][typeContextual].head\n : json[defaultType].head,\n description: json[defaultType][typeContextual]\n ? json[defaultType][typeContextual].content\n : json[defaultType].content,\n cta: json[defaultType].cta,\n },\n packages: {\n ...this.mockResult.packages,\n memberships: json[defaultType][typeContextual]\n ? json[defaultType][typeContextual].memberships\n : json[defaultType].memberships,\n swgEnable: json[defaultType].swgEnable,\n freeTrial: json[defaultType].freeTrial,\n swgContent: json[defaultType].swgContent,\n },\n }\n } catch (error) {\n throw Error('Failed to get paywall data')\n } finally {\n this.isLoading = false\n }\n }\n\n /**\n * Checks if all strings in the given target tags and variant are found in the given string tag and variant.\n * @param {Contextual} target - The contextual data to be checked.\n * @param {string} stringTag - The string tag to search for.\n * @param {string} stringVariant - The string variant to search for.\n * @returns {boolean} - True if all strings are found, false otherwise.\n */\n private checkAllInString(\n target: Contextual,\n stringTag: string,\n stringVariant: string\n ) {\n const tagsTarget = target.tags\n const variantTarget = target.variant\n const checkVariant =\n variantTarget.toLowerCase() === stringVariant.toLowerCase()\n const checkTags = () => {\n for (const item of tagsTarget) {\n if (!stringTag.toLowerCase().includes(item.toLowerCase())) {\n return false\n }\n }\n return true\n }\n\n return checkVariant && checkTags()\n }\n\n /**\n * Check if the given contextual data is valid based on the following rules:\n * - The published date must be within 90 days from now\n * - The tracker tags and variant must be found in the contextual data\n * @param {Contextual} jsonContextual - The contextual data to be checked\n * @returns {boolean} - True if the contextual data is valid, false otherwise\n */\n private contextualScenario(jsonContextual: Contextual): boolean {\n if (!jsonContextual) {\n return false\n }\n\n const {\n tracker_content_published_date: publishedDate,\n tracker_content_tags: trackerTags,\n tracker_content_variant: trackerVariant,\n } = this\n\n if (!publishedDate || !trackerVariant || !trackerTags) {\n return false\n }\n\n const nowDate = new Date()\n const isoDateString = publishedDate.replace(' ', 'T')\n const publishedDateObj = new Date(isoDateString)\n\n const isWithin90Days = differenceInDays(publishedDateObj, nowDate) <= -90 // differenceInDays jika tanggal telah melewati 90 hari\n const hasMatchingTagsAndVariants = this.checkAllInString(\n jsonContextual,\n trackerTags,\n trackerVariant\n ) // checkAllInString jika ada tag yang cocok\n\n return isWithin90Days || hasMatchingTagsAndVariants\n }\n\n private transitionBox() {\n return html`\n <div\n class=\"h-20 ${this.theme === 'dark'\n ? 'transparent-linear-dark'\n : 'transparent-linear'} -mt-24 z-0 w-full\"\n ></div>\n `\n }\n\n private renderEpaperPaywallSection() {\n return html`<kompasid-paywall-body\n paywall_location=${this.paywall_location}\n paywall_subscription_package=${this.paywall_subscription_package}\n paywall_subscription_id=${this.paywall_subscription_id}\n paywall_subscription_price=${this.paywall_subscription_price}\n paywall_position=${this.paywall_position}\n tracker_page_type=${this.tracker_page_type}\n tracker_content_id=${this.tracker_content_id}\n tracker_content_title=${this.tracker_content_title}\n tracker_content_categories=${this.tracker_content_categories}\n tracker_content_tags=${this.tracker_content_tags}\n tracker_content_published_date=${this.tracker_content_published_date}\n tracker_content_variant=${this.tracker_content_variant}\n tracker_user_type=${this.tracker_user_type}\n tracker_subscription_status=${this.tracker_subscription_status}\n tracker_page_domain=${this.tracker_page_domain}\n tracker_metered_wall_type=${this.tracker_metered_wall_type}\n tracker_epaper_edition=${this.tracker_epaper_edition}\n tracker_metered_wall_balance=${this.tracker_metered_wall_balance}\n tracker_content_publisher=${this.tracker_content_publisher}\n ?swgEnable=${this.swgEnable}\n tracker_content_type=${this.tracker_content_type}\n ?isLogin=${this.isLogin}\n type=${this.type}\n countdownArticle=${this.countdownArticle}\n .paywallData=${this.paywallData}\n subscriptionStatus=${this.subscriptionStatus}\n userGuid=${this.userGuid}\n theme=${this.theme}\n ></kompasid-paywall-body>`\n }\n\n private renderRegularPaywallSection() {\n const defaultHeaderText: string =\n this.paywallData.informations.meterred.maxQuotaMessage\n if (this.isWithHeader) {\n return html`\n <div>\n ${this.transitionBox()}\n <div\n class=\"flex flex-col ${this.theme === 'dark'\n ? 'bg-dark-5'\n : 'bg-white'} items-center justify-center mx-4 md:mx-0\"\n >\n <div class=\"flex flex-col w-full max-w-screen-md my-5\">\n <kompasid-paywall-information-header\n text=${this.textHeader || defaultHeaderText}\n theme=${this.theme}\n ></kompasid-paywall-information-header>\n <kompasid-paywall-body\n paywall_location=${this.paywall_location}\n paywall_subscription_package=${this\n .paywall_subscription_package}\n paywall_subscription_id=${this.paywall_subscription_id}\n paywall_subscription_price=${this.paywall_subscription_price}\n paywall_position=${this.paywall_position}\n tracker_page_type=${this.tracker_page_type}\n tracker_content_id=${this.tracker_content_id}\n tracker_content_title=${this.tracker_content_title}\n tracker_content_categories=${this.tracker_content_categories}\n tracker_content_tags=${this.tracker_content_tags}\n tracker_content_published_date=${this\n .tracker_content_published_date}\n tracker_content_variant=${this.tracker_content_variant}\n tracker_user_type=${this.tracker_user_type}\n tracker_subscription_status=${this.tracker_subscription_status}\n tracker_page_domain=${this.tracker_page_domain}\n tracker_metered_wall_type=${this.tracker_metered_wall_type}\n tracker_epaper_edition=${this.tracker_epaper_edition}\n tracker_metered_wall_balance=${this\n .tracker_metered_wall_balance}\n tracker_content_type=${this.tracker_content_type}\n tracker_content_publisher=${this.tracker_content_publisher}\n ?swgEnable=${this.swgEnable}\n ?isLogin=${this.isLogin}\n type=${this.type}\n countdownArticle=${this.countdownArticle}\n .paywallData=${this.paywallData}\n subscriptionStatus=${this.subscriptionStatus}\n userGuid=${this.userGuid}\n theme=${this.theme}\n ></kompasid-paywall-body>\n </div>\n </div>\n </div>\n `\n }\n return html`\n <div>\n ${this.transitionBox()}\n <div\n class=\"flex flex-col ${this.theme === 'dark'\n ? 'bg-dark-5'\n : 'bg-white'} items-center justify-center mx-4 md:mx-0\"\n >\n <div class=\"flex flex-col w-full max-w-screen-md my-5\">\n <kompasid-paywall-body\n tracker_content_type=${this.tracker_content_type}\n paywall_location=${this.paywall_location}\n paywall_subscription_package=${this.paywall_subscription_package}\n paywall_subscription_id=${this.paywall_subscription_id}\n paywall_subscription_price=${this.paywall_subscription_price}\n paywall_position=${this.paywall_position}\n tracker_page_type=${this.tracker_page_type}\n tracker_content_id=${this.tracker_content_id}\n tracker_content_title=${this.tracker_content_title}\n tracker_content_categories=${this.tracker_content_categories}\n tracker_content_tags=${this.tracker_content_tags}\n tracker_content_published_date=${this\n .tracker_content_published_date}\n tracker_content_variant=${this.tracker_content_variant}\n tracker_user_type=${this.tracker_user_type}\n tracker_subscription_status=${this.tracker_subscription_status}\n tracker_epaper_edition=${this.tracker_epaper_edition}\n tracker_page_domain=${this.tracker_page_domain}\n tracker_metered_wall_type=${this.tracker_metered_wall_type}\n tracker_metered_wall_balance=${this.tracker_metered_wall_balance}\n tracker_content_publisher=${this.tracker_content_publisher}\n ?swgEnable=${this.swgEnable}\n ?isLogin=${this.isLogin}\n type=${this.type}\n countdownArticle=${this.countdownArticle}\n .paywallData=${this.paywallData}\n subscriptionStatus=${this.subscriptionStatus}\n userGuid=${this.userGuid}\n theme=${this.theme}\n ></kompasid-paywall-body>\n </div>\n </div>\n </div>\n `\n }\n\n private renderAudioPaywallSection() {\n const defaultHeaderText: string =\n this.paywallData.informations.meterred.maxQuotaMessage\n if (this.isWithHeader) {\n return html`\n <div>\n ${this.transitionBox()}\n <div\n class=\"flex flex-col ${this.theme === 'dark'\n ? 'bg-dark-5'\n : 'bg-white'} items-center justify-center mx-4 md:mx-0\"\n >\n <div class=\"flex flex-col w-full max-w-screen-md my-5\">\n <kompasid-paywall-information-header\n text=${this.textHeader || defaultHeaderText}\n theme=${this.theme}\n ></kompasid-paywall-information-header>\n <kompasid-paywall-body\n paywall_location=${this.paywall_location}\n paywall_subscription_package=${this\n .paywall_subscription_package}\n paywall_subscription_id=${this.paywall_subscription_id}\n paywall_subscription_price=${this.paywall_subscription_price}\n paywall_position=${this.paywall_position}\n tracker_page_type=${this.tracker_page_type}\n tracker_content_id=${this.tracker_content_id}\n tracker_content_title=${this.tracker_content_title}\n tracker_content_categories=${this.tracker_content_categories}\n tracker_content_tags=${this.tracker_content_tags}\n tracker_content_published_date=${this\n .tracker_content_published_date}\n tracker_content_variant=${this.tracker_content_variant}\n tracker_user_type=${this.tracker_user_type}\n tracker_subscription_status=${this.tracker_subscription_status}\n tracker_page_domain=${this.tracker_page_domain}\n tracker_metered_wall_type=${this.tracker_metered_wall_type}\n tracker_epaper_edition=${this.tracker_epaper_edition}\n tracker_metered_wall_balance=${this\n .tracker_metered_wall_balance}\n tracker_content_type=${this.tracker_content_type}\n tracker_content_publisher=${this.tracker_content_publisher}\n ?swgEnable=${this.swgEnable}\n ?isLogin=${this.isLogin}\n type=${this.type}\n countdownArticle=${this.countdownArticle}\n .paywallData=${this.paywallData}\n subscriptionStatus=${this.subscriptionStatus}\n userGuid=${this.userGuid}\n theme=${this.theme}\n .togglePaywall=${() => this.togglePaywall()}\n ></kompasid-paywall-body>\n </div>\n </div>\n </div>\n `\n }\n return html`\n <div>\n ${this.transitionBox()}\n <div\n class=\"flex flex-col ${this.theme === 'dark'\n ? 'bg-dark-5'\n : 'bg-white'} items-center justify-center mx-4 md:mx-0\"\n >\n <div class=\"flex flex-col w-full max-w-screen-md my-5\">\n <kompasid-paywall-body\n tracker_content_type=${this.tracker_content_type}\n paywall_location=${this.paywall_location}\n paywall_subscription_package=${this.paywall_subscription_package}\n paywall_subscription_id=${this.paywall_subscription_id}\n paywall_subscription_price=${this.paywall_subscription_price}\n paywall_position=${this.paywall_position}\n tracker_page_type=${this.tracker_page_type}\n tracker_content_id=${this.tracker_content_id}\n tracker_content_title=${this.tracker_content_title}\n tracker_content_categories=${this.tracker_content_categories}\n tracker_content_tags=${this.tracker_content_tags}\n tracker_content_published_date=${this\n .tracker_content_published_date}\n tracker_content_variant=${this.tracker_content_variant}\n tracker_user_type=${this.tracker_user_type}\n tracker_subscription_status=${this.tracker_subscription_status}\n tracker_epaper_edition=${this.tracker_epaper_edition}\n tracker_page_domain=${this.tracker_page_domain}\n tracker_metered_wall_type=${this.tracker_metered_wall_type}\n tracker_metered_wall_balance=${this.tracker_metered_wall_balance}\n tracker_content_publisher=${this.tracker_content_publisher}\n ?swgEnable=${this.swgEnable}\n ?isLogin=${this.isLogin}\n type=${this.type}\n countdownArticle=${this.countdownArticle}\n .paywallData=${this.paywallData}\n subscriptionStatus=${this.subscriptionStatus}\n userGuid=${this.userGuid}\n theme=${this.theme}\n .togglePaywall=${() => this.togglePaywall()}\n ></kompasid-paywall-body>\n </div>\n </div>\n </div>\n `\n }\n\n private selectorTypePaywall = (type: PaywallType) => {\n switch (type) {\n case 'epaper':\n case 'proMiningOutlook':\n return this.renderEpaperPaywallSection()\n case 'audio':\n return this.renderAudioPaywallSection()\n case 'proMiningArticle':\n case 'reguler':\n return this.renderRegularPaywallSection()\n default:\n return this.renderRegularPaywallSection()\n }\n }\n\n private togglePaywall() {\n this.isOpen = !this.isOpen\n }\n\n render() {\n return !this.isLoading && this.isOpen\n ? html`\n <div class=\"relative w-full\">\n ${this.selectorTypePaywall(this.type)}\n </div>\n `\n : nothing\n }\n}\n"]}
@@ -79,3 +79,7 @@ export interface PaywallProduct {
79
79
  };
80
80
  }
81
81
  export type PaywallType = 'proMiningArticle' | 'proMiningOutlook' | 'epaper' | 'reguler' | 'audio' | 'custom';
82
+ export interface Contextual {
83
+ variant: string;
84
+ tags: string[];
85
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/kompasid-paywall/types.ts"],"names":[],"mappings":"","sourcesContent":["export interface Product {\n title: string\n percentage: number\n price: number\n discountPrice: number\n savingPrice: number\n periode: string\n isHighlight: boolean\n url: string\n package: string\n subscriptionId: string\n position: number\n}\nexport interface Metered {\n maxQuota: number\n label: string\n maxQuotaMessage: string\n url: string\n}\nexport interface PaymentImage {\n name: string\n link: string\n}\nexport interface Registration {\n img: string\n title: string\n subtitle: string\n label: string\n}\nexport interface Informations {\n title: string\n description: Array<string>\n register: {\n img: string\n title: string\n subtitle: string\n label: string\n }\n}\nexport interface FreeTrial {\n packageText: string\n desktopText: string\n mobileText: string\n}\nexport interface SwgContentData {\n duration: string\n price: string\n description: string\n}\n\nexport interface SwgContent {\n introductory: SwgContentData\n default: SwgContentData\n}\n\nexport interface Packages {\n title: string\n memberships: Array<Product>\n swgEnable: boolean\n freeTrial: FreeTrial\n swgContent: SwgContent\n}\n\nexport interface ctaPaywall {\n show: boolean\n text: string\n url: string\n}\n\nexport interface PaywallProduct {\n informations: {\n title: string\n description: Array<string>\n register: Registration\n meterred: Metered\n cta: ctaPaywall\n }\n packages: Packages\n payment: {\n desktop: Array<PaymentImage>\n mobile: Array<PaymentImage>\n ekstension: Array<PaymentImage>\n }\n}\nexport type PaywallType =\n | 'proMiningArticle'\n | 'proMiningOutlook'\n | 'epaper'\n | 'reguler'\n | 'audio'\n | 'custom'\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/kompasid-paywall/types.ts"],"names":[],"mappings":"","sourcesContent":["export interface Product {\n title: string\n percentage: number\n price: number\n discountPrice: number\n savingPrice: number\n periode: string\n isHighlight: boolean\n url: string\n package: string\n subscriptionId: string\n position: number\n}\nexport interface Metered {\n maxQuota: number\n label: string\n maxQuotaMessage: string\n url: string\n}\nexport interface PaymentImage {\n name: string\n link: string\n}\nexport interface Registration {\n img: string\n title: string\n subtitle: string\n label: string\n}\nexport interface Informations {\n title: string\n description: Array<string>\n register: {\n img: string\n title: string\n subtitle: string\n label: string\n }\n}\nexport interface FreeTrial {\n packageText: string\n desktopText: string\n mobileText: string\n}\nexport interface SwgContentData {\n duration: string\n price: string\n description: string\n}\n\nexport interface SwgContent {\n introductory: SwgContentData\n default: SwgContentData\n}\n\nexport interface Packages {\n title: string\n memberships: Array<Product>\n swgEnable: boolean\n freeTrial: FreeTrial\n swgContent: SwgContent\n}\n\nexport interface ctaPaywall {\n show: boolean\n text: string\n url: string\n}\n\nexport interface PaywallProduct {\n informations: {\n title: string\n description: Array<string>\n register: Registration\n meterred: Metered\n cta: ctaPaywall\n }\n packages: Packages\n payment: {\n desktop: Array<PaymentImage>\n mobile: Array<PaymentImage>\n ekstension: Array<PaymentImage>\n }\n}\nexport type PaywallType =\n | 'proMiningArticle'\n | 'proMiningOutlook'\n | 'epaper'\n | 'reguler'\n | 'audio'\n | 'custom'\n\nexport interface Contextual {\n variant: string\n tags: string[]\n}\n"]}
@@ -50,6 +50,9 @@ export declare class KompasIdPaywallBody extends LitElement {
50
50
  tracker_content_title: string;
51
51
  tracker_content_categories: string;
52
52
  tracker_content_type: string;
53
+ tracker_content_tags: string;
54
+ tracker_content_published_date: string;
55
+ tracker_content_variant: string;
53
56
  tracker_user_type: string;
54
57
  tracker_subscription_status: string;
55
58
  tracker_page_domain: string;