@kompasid/lit-web-components 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +29 -0
- package/.github/workflows/npm-publish.yml +35 -0
- package/LICENSE +21 -0
- package/README.md +62 -0
- package/assets/font-awesome.ts +21 -0
- package/components.d.ts +4 -0
- package/demo/index.html +137 -0
- package/dist/assets/font-awesome.d.ts +2 -0
- package/dist/assets/font-awesome.js +20 -0
- package/dist/assets/font-awesome.js.map +1 -0
- package/dist/src/components/kompas-footer/KompasFooter.d.ts +13 -0
- package/dist/src/components/kompas-footer/KompasFooter.js +304 -0
- package/dist/src/components/kompas-footer/KompasFooter.js.map +1 -0
- package/dist/src/components/kompas-footer/types.d.ts +47 -0
- package/dist/src/components/kompas-footer/types.js +2 -0
- package/dist/src/components/kompas-footer/types.js.map +1 -0
- package/dist/src/components/kompas-metered-paywall/KompasMeteredPaywall.d.ts +50 -0
- package/dist/src/components/kompas-metered-paywall/KompasMeteredPaywall.js +225 -0
- package/dist/src/components/kompas-metered-paywall/KompasMeteredPaywall.js.map +1 -0
- package/dist/src/components/kompas-paywall/KompasPaywall.d.ts +73 -0
- package/dist/src/components/kompas-paywall/KompasPaywall.js +470 -0
- package/dist/src/components/kompas-paywall/KompasPaywall.js.map +1 -0
- package/dist/src/components/kompas-paywall/types.d.ts +53 -0
- package/dist/src/components/kompas-paywall/types.js +2 -0
- package/dist/src/components/kompas-paywall/types.js.map +1 -0
- package/dist/src/components/kompas-paywall-banner-registration/KompasPaywallBannerRegistration.d.ts +11 -0
- package/dist/src/components/kompas-paywall-banner-registration/KompasPaywallBannerRegistration.js +100 -0
- package/dist/src/components/kompas-paywall-banner-registration/KompasPaywallBannerRegistration.js.map +1 -0
- package/dist/src/components/kompas-paywall-body/KompasPaywallBody.d.ts +107 -0
- package/dist/src/components/kompas-paywall-body/KompasPaywallBody.js +843 -0
- package/dist/src/components/kompas-paywall-body/KompasPaywallBody.js.map +1 -0
- package/dist/src/components/kompas-paywall-information-header/KompasPaywallInformationHeader.d.ts +8 -0
- package/dist/src/components/kompas-paywall-information-header/KompasPaywallInformationHeader.js +39 -0
- package/dist/src/components/kompas-paywall-information-header/KompasPaywallInformationHeader.js.map +1 -0
- package/dist/src/components/kompas-paywall-video/KompasPaywallVideo.d.ts +53 -0
- package/dist/src/components/kompas-paywall-video/KompasPaywallVideo.js +245 -0
- package/dist/src/components/kompas-paywall-video/KompasPaywallVideo.js.map +1 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/index.js +5 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/utils/deviceType.d.ts +2 -0
- package/dist/src/utils/deviceType.js +11 -0
- package/dist/src/utils/deviceType.js.map +1 -0
- package/dist/src/utils/fontawesome-setup.d.ts +1 -0
- package/dist/src/utils/fontawesome-setup.js +25 -0
- package/dist/src/utils/fontawesome-setup.js.map +1 -0
- package/dist/tailwind/tailwind.d.ts +1 -0
- package/dist/tailwind/tailwind.js +1654 -0
- package/dist/tailwind/tailwind.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +94 -0
- package/src/components/kompas-footer/KompasFooter.ts +331 -0
- package/src/components/kompas-footer/types.ts +54 -0
- package/src/components/kompas-metered-paywall/KompasMeteredPaywall.ts +174 -0
- package/src/components/kompas-metered-paywall/readme.md +32 -0
- package/src/components/kompas-paywall/KompasPaywall.ts +398 -0
- package/src/components/kompas-paywall/readme.md +166 -0
- package/src/components/kompas-paywall/types.ts +53 -0
- package/src/components/kompas-paywall-banner-registration/KompasPaywallBannerRegistration.ts +92 -0
- package/src/components/kompas-paywall-banner-registration/readme.md +31 -0
- package/src/components/kompas-paywall-body/KompasPaywallBody.ts +844 -0
- package/src/components/kompas-paywall-body/readme.md +54 -0
- package/src/components/kompas-paywall-information-header/KompasPaywallInformationHeader.ts +29 -0
- package/src/components/kompas-paywall-information-header/readme.md +30 -0
- package/src/components/kompas-paywall-video/KompasPaywallVideo.ts +194 -0
- package/src/components/kompas-paywall-video/readme.md +46 -0
- package/src/index.ts +11 -0
- package/src/utils/deviceType.ts +11 -0
- package/src/utils/fontawesome-setup.ts +40 -0
- package/tailwind/tailwind.css +1635 -0
- package/tailwind/tailwind.ts +1654 -0
- package/tailwind/tailwindlib.css +3 -0
- package/tailwind.config.js +96 -0
- package/tsconfig.json +21 -0
- package/web-dev-server.config.mjs +27 -0
- package/web-test-runner.config.mjs +41 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KompasFooter.js","sourceRoot":"","sources":["../../../../src/components/kompas-footer/KompasFooter.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AAExD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AAG9D,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,UAAU;IAArC;;QAqDuB,WAAM,GAAkB,IAAI,CAAA;QAE3B,WAAM,GAAG,KAAK,CAAA;IA2Q7C,CAAC;IAzQC,iBAAiB;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAA;QAEzB,IAAI,CAAC,mBAAmB,EAAE,CAAA;QAC1B,IAAI,CAAC,gBAAgB,EAAE,CAAA;IACzB,CAAC;IAEO,mBAAmB;QACzB,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;QAC3C,IAAI,CAAC,GAAG,GAAG,YAAY,CAAA;QACvB,IAAI,CAAC,IAAI;YACP,iGAAiG,CAAA;QACnG,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;IACjC,CAAC;IAEO,gBAAgB;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AC;;AAhUM,mBAAM,GAAG;IACd,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+CF;IACD,QAAQ;CACT,AAlDY,CAkDZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAA6B;AAE3B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CAAe;AAvDhC,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CAkUxB","sourcesContent":["import { html, css, LitElement } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\nimport { unsafeSVG } from 'lit/directives/unsafe-svg.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\nimport { Footer } from './types.js'\nimport { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js'\n\n@customElement('kompas-footer')\nexport class KompasFooter extends LitElement {\n static styles = [\n css`\n :host {\n font-family: 'PT Sans', sans-serif;\n }\n\n .bg-instagram {\n background-image: linear-gradient(90deg, #ffc107, #f44336, #9c27b0);\n }\n\n .bg-sosmed-facebook {\n background-color: #3d5b9b;\n }\n\n .bg-sosmed-twitter {\n background-color: #2daae4;\n }\n\n .bg-sosmed-youtube {\n background-color: #f44336;\n }\n\n .text-brand-1 {\n color: #00559a;\n }\n\n .text-grey-50 {\n color: #666;\n color: rgb(102 102 102/1);\n }\n\n .text-grey-60 {\n color: #333;\n color: rgb(51 51 51/1);\n }\n\n .border-grey-30 {\n --tw-border-opacity: 1;\n border-color: rgb(221 221 221 / var(--tw-border-opacity));\n }\n\n .hover-bg-blue-10:hover {\n background-color: #e1f0ff;\n }\n\n .hover-border-blue-20:hover {\n border-color: #93c8fd;\n }\n `,\n TWStyles,\n ]\n\n @property({ type: Object }) footer: Footer | null = null\n\n @property({ type: Boolean }) isDark = false\n\n connectedCallback() {\n super.connectedCallback()\n\n this.addStylesheetToHead()\n this.initializeFooter()\n }\n\n private addStylesheetToHead() {\n const link = document.createElement('link')\n link.rel = 'stylesheet'\n link.href =\n 'https://fonts.googleapis.com/css2?family=PT+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap'\n document.head.appendChild(link)\n }\n\n private initializeFooter() {\n if (this.footer === undefined || this.footer === null) {\n this.fetchFooter()\n }\n }\n\n async fetchFooter() {\n const response = await fetch(\n 'https://d3w4qaq4xm1ncv.cloudfront.net/assets/json/footer/ApiFooterDefault.json'\n )\n const jsonResponse = await response.json()\n this.footer = jsonResponse\n }\n\n getYear() {\n return new Date().getFullYear()\n }\n\n render() {\n if (this.footer) {\n const { isDark } = this\n const bgClass = isDark ? 'bg-[#2C2C2C]' : 'bg-transparent'\n const primaryTextColor = isDark ? 'text-[#FFFFFF]' : ''\n const secondaryTextColor = isDark ? 'text-[#FFFFFF]' : 'text-grey-60'\n const itemTextColor = isDark ? 'text-[#FFFFFF]' : 'text-[#00559a]'\n\n return html`\n <div\n class=\"border-t border-grey-30 mx-auto w-full md:px-20 px-4 ${bgClass} ${primaryTextColor}\"\n >\n <div class=\"max-w-7xl mx-auto\">\n <div class=\"md:px-0 pb-6 lg:pb-0 mx-auto w-full\">\n <div\n class=\"grid grid-cols-4 lg:grid-cols-12 gap-6 lg:gap-8 lg:justify-between pt-10 pb-8 lg:py-10\"\n >\n ${Object.values(this.footer.brands.itemsLeft).map(\n brand => html`\n <a\n class=\"col-span-4 lg:col-span-2 flex gap-4 cursor-pointer\"\n title=\"Kompas.id\"\n href=\"${brand.permalink}\"\n >\n <img\n src=\"https://d3w4qaq4xm1ncv.cloudfront.net/assets/img/logos/kompas-logo-footer.svg\"\n height=\"${brand.image.height}\"\n width=\"${brand.image.width}\"\n alt=\"${brand.image.alt}\"\n class=\"w-auto h-10 lg:mx-auto\"\n />\n </a>\n `\n )}\n <div\n class=\"col-span-4 lg:col-start-10 lg:col-span-3 gap-4 flex lg:justify-end mx-auto w-full\"\n >\n <a\n class=\"cursor-pointer\"\n href=\"${this.footer.brands.itemsRight[0].permalink}\"\n target=\"_blank\"\n >\n <img\n src=\"https://d3w4qaq4xm1ncv.cloudfront.net/halaman-unduh/image/ios-badge.png\"\n class=\"h-10 w-[120px]\"\n alt=\"Logo iOS\"\n /></a>\n <a\n class=\"cursor-pointer\"\n href=\"${this.footer.brands.itemsRight[1].permalink}\"\n target=\"_blank\"\n >\n <img\n src=\"https://d3w4qaq4xm1ncv.cloudfront.net/halaman-unduh/image/google-play-badge.png\"\n class=\"h-10 w-[138px]\"\n alt=\"Logo Android\"\n /></a>\n </div>\n </div>\n </div>\n <div class=\"grid grid-cols-4 lg:grid-cols-12 gap-8 pb-2\">\n <div\n class=\"col-span-4 lg:col-span-3 flex flex-row lg:flex-col gap-8 lg:gap-0\"\n >\n ${Object.values(this.footer.address.items).map(\n address => html` <div class=\"lg:pb-6\">\n <div\n class=\"font-bold leading-none pb-3 text-sm ${itemTextColor}\"\n >\n ${address.title}\n </div>\n <div class=\"leading-normal pb-3 text-sm ${secondaryTextColor}\">\n ${address.text}\n </div>\n <div class=\"flex flex-row\">\n <div\n class=\"font-bold leading-none pb-3 pr-2 text-sm ${itemTextColor} hidden lg:block\"\n >\n Tlp.\n </div>\n <div\n class=\"grid lg:gap-x-6 lg:grid-cols-2 md:grid-cols-1 grid-cols-1\"\n >\n ${Object.values(address.phones).map(\n num => html`\n <div\n class=\"leading-normal pb-2 text-sm ${secondaryTextColor}\"\n >\n ${num.number}\n </div>\n `\n )}\n </div>\n </div>\n </div>`\n )}\n </div>\n <div class=\"col-span-4 lg:col-span-5 gap-4\">\n <div class=\"grid grid-cols-2 sm:grid-cols-4 gap-6 shrink-0\">\n ${Object.values(this.footer.products.items).map(\n product => html`\n <div>\n <div\n class=\"font-bold leading-none pb-4 text-sm ${itemTextColor}\"\n >\n ${product.title}\n </div>\n ${Object.values(product.sites).map(\n prod => html`\n <a\n class=\"leading-normal text-sm ${secondaryTextColor}\"\n href=\"${prod.permalink}\"\n >\n <div class=\"flex flex-col pb-4 cursor-pointer\">\n ${prod.text}\n </div>\n </a>\n `\n )}\n </div>\n `\n )}\n </div>\n </div>\n <div class=\"col-span-2 flex flex-col\">\n <div\n class=\"font-bold leading-none pb-4 text-sm ${itemTextColor}\"\n >\n ${this.footer.contacts.title}\n </div>\n ${Object.values(this.footer.contacts.items).map(\n contact => html` <div class=\"flex flex-row pb-4\">\n <div\n class=\"flex items-center mr-3 text-base ${itemTextColor}\"\n >\n ${unsafeSVG(\n getFontAwesomeIcon(contact.icon[0], contact.icon[1])\n )}\n </div>\n <div class=\"flex flex-col\">\n <div class=\"pb-1 text-sm w-full ${secondaryTextColor}\">\n ${contact.label}\n </div>\n <a\n class=\"font-bold text-sm w-full cursor-pointer\"\n href=\"${contact.action}\"\n >\n <span class=\"text-gray-500\"> ${contact.text} </span>\n </a>\n </div>\n </div>`\n )}\n </div>\n <div class=\"col-span-2 flex flex-col\">\n <div\n class=\"font-bold leading-none pb-4 text-sm ${itemTextColor}\"\n >\n ${this.footer.sosmed.title}\n </div>\n ${Object.values(this.footer.sosmed.items).map(\n sosmed => html`\n <a\n class=\"border border-grey-30 hover-border-blue-20 hover-bg-blue-10 p-2 mb-2 flex flex-row md:self-end rounded w-full cursor-pointer\"\n href=\"${sosmed.url}\"\n >\n <div\n class=\"h-5 flex justify-center items-center rounded text-white w-5 ${sosmed.color}\"\n >\n <div class=\"h-3 text-xs\">\n ${unsafeSVG(\n getFontAwesomeIcon(\n sosmed.icon[0],\n sosmed.icon[1],\n 12,\n 12\n )\n )}\n </div>\n </div>\n <div class=\"leading-normal pl-2 text-sm ${secondaryTextColor}\">\n ${sosmed.name}\n </div>\n </a>\n `\n )}\n </div>\n </div>\n </div>\n </div>\n <div class=\"flex flex-col pb-32 pt-6 px-4 text-xs bg-black\">\n <div class=\"flex flex-col lg:flex-row max-w-7xl mx-auto w-full\">\n <div class=\"flex flex-wrap mb-2 lg:mb-0 w-full\">\n <div\n class=\"flex flex-col lg:flex-row flex-grow lg:justify-between\"\n >\n <div class=\"flex flex-wrap\">\n <div class=\"flex text-white\">\n © ${this.getYear()} PT Kompas Media Nusantara\n <span class=\"mx-2 text-grey-50\">·</span>\n </div>\n ${Object.values(this.footer.universal.itemsLeft).map(\n universal => html` <a\n class=\"flex justify-center items-center\"\n href=\"${universal.url}\"\n >\n <div class=\"pb-2 lg:pb-0 text-white cursor-pointer\">\n ${universal.name}\n <span class=\"mx-2 text-grey-50\">·</span>\n </div>\n </a>`\n )}\n </div>\n <div class=\"flex flex-wrap shrink-0\">\n ${Object.values(this.footer.universal.itemsRight).map(\n universal => html`\n <a class=\"flex cursor-pointer\" href=\"${universal.url}\">\n <div class=\"text-white flex items-center\">\n ${universal.name}\n <span class=\"mx-2 text-grey-50\">·</span>\n </div>\n </a>\n `\n )}\n </div>\n </div>\n </div>\n </div>\n </div>\n `\n }\n return html``\n }\n}\n"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export interface Image {
|
|
2
|
+
alt: string;
|
|
3
|
+
height: number;
|
|
4
|
+
url: string;
|
|
5
|
+
width: number;
|
|
6
|
+
}
|
|
7
|
+
export interface Item {
|
|
8
|
+
image: Image;
|
|
9
|
+
permalink: string;
|
|
10
|
+
name: string;
|
|
11
|
+
url: string;
|
|
12
|
+
}
|
|
13
|
+
export interface Section<T> {
|
|
14
|
+
items: T[];
|
|
15
|
+
title?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface Phones {
|
|
18
|
+
number: number;
|
|
19
|
+
}
|
|
20
|
+
export interface Sites {
|
|
21
|
+
text: string;
|
|
22
|
+
permalink: string;
|
|
23
|
+
}
|
|
24
|
+
export interface Items {
|
|
25
|
+
phones: Phones;
|
|
26
|
+
title: string;
|
|
27
|
+
text: string;
|
|
28
|
+
sites: Sites;
|
|
29
|
+
action: string;
|
|
30
|
+
icon: string[];
|
|
31
|
+
label: string;
|
|
32
|
+
color: string;
|
|
33
|
+
name: string;
|
|
34
|
+
url: string;
|
|
35
|
+
}
|
|
36
|
+
export interface Universal {
|
|
37
|
+
itemsLeft: Item[];
|
|
38
|
+
itemsRight: Item[];
|
|
39
|
+
}
|
|
40
|
+
export interface Footer {
|
|
41
|
+
brands: Universal;
|
|
42
|
+
address: Section<Items>;
|
|
43
|
+
products: Section<Items>;
|
|
44
|
+
contacts: Section<Items>;
|
|
45
|
+
sosmed: Section<Items>;
|
|
46
|
+
universal: Universal;
|
|
47
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/kompas-footer/types.ts"],"names":[],"mappings":"","sourcesContent":["export interface Image {\n alt: string\n height: number\n url: string\n width: number\n}\n\nexport interface Item {\n image: Image\n permalink: string\n name: string\n url: string\n}\n\nexport interface Section<T> {\n items: T[]\n title?: string\n}\n\nexport interface Phones {\n number: number\n}\n\nexport interface Sites {\n text: string\n permalink: string\n}\n\nexport interface Items {\n phones: Phones\n title: string\n text: string\n sites: Sites\n action: string\n icon: string[]\n label: string\n color: string\n name: string\n url: string\n}\n\nexport interface Universal {\n itemsLeft: Item[]\n itemsRight: Item[]\n}\n\nexport interface Footer {\n brands: Universal\n address: Section<Items>\n products: Section<Items>\n contacts: Section<Items>\n sosmed: Section<Items>\n universal: Universal\n}\n"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class KompasMeteredPaywall extends LitElement {
|
|
3
|
+
static styles: import("lit").CSSResult[];
|
|
4
|
+
maxQuota: number;
|
|
5
|
+
subscriptionUrl: string;
|
|
6
|
+
/**
|
|
7
|
+
* Props
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* prop countdownArticle untuk menghandle sudah berapa artikel gratis yang user baca.
|
|
11
|
+
* prop paywall_location = The location where user encounter the paywall
|
|
12
|
+
* prop paywall_subscription_package = The name of the subscription package viewed by user
|
|
13
|
+
* prop paywall_subscription_id = The ID of the subscription package viewed by user
|
|
14
|
+
* prop paywall_subscription_price = The price of the subscriprtion package viewed by user
|
|
15
|
+
* prop paywall_position = The position of ther subscription package viewed by user
|
|
16
|
+
* prop tracker_page_type = Type of the page
|
|
17
|
+
* prop tracker_content_id = ID of article (slug)
|
|
18
|
+
* prop tracker_content_type = Whether it's free article or paid article
|
|
19
|
+
* prop tracker_content_title = The title of article
|
|
20
|
+
* prop tracker_content_categories = The category of the content
|
|
21
|
+
* prop tracker_user_type = Type of user based on their subscription
|
|
22
|
+
* prop tracker_subscription_status = Status of their subscription
|
|
23
|
+
* prop tracker_page_domain = Page Domain
|
|
24
|
+
* prop tracker_metered_wall_type = The type of Metered Wall
|
|
25
|
+
* prop tracker_epaper_edition = The edition of epaper viewed by user
|
|
26
|
+
* prop tracker_metered_wall_balance = The balance of their metered wall
|
|
27
|
+
*/
|
|
28
|
+
countdownArticle: number;
|
|
29
|
+
paywall_location: string;
|
|
30
|
+
paywall_subscription_package: string;
|
|
31
|
+
paywall_subscription_id: string;
|
|
32
|
+
paywall_subscription_price: number;
|
|
33
|
+
paywall_position: number;
|
|
34
|
+
tracker_page_type: string;
|
|
35
|
+
tracker_content_id: string;
|
|
36
|
+
tracker_content_title: string;
|
|
37
|
+
tracker_content_categories: string;
|
|
38
|
+
tracker_content_type: string;
|
|
39
|
+
tracker_user_type: string;
|
|
40
|
+
tracker_subscription_status: string;
|
|
41
|
+
tracker_page_domain: string;
|
|
42
|
+
tracker_metered_wall_type: string;
|
|
43
|
+
tracker_metered_wall_balance: number;
|
|
44
|
+
private getCountdownArticle;
|
|
45
|
+
connectedCallback(): void;
|
|
46
|
+
private redirectToBerlangganan;
|
|
47
|
+
private dataLayeronLanggananButton;
|
|
48
|
+
private dataLayeronMeteredPaywall;
|
|
49
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
50
|
+
}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { html, css, LitElement } from 'lit';
|
|
3
|
+
import { customElement, state, property } from 'lit/decorators.js';
|
|
4
|
+
import { TWStyles } from '../../../tailwind/tailwind.js';
|
|
5
|
+
let KompasMeteredPaywall = class KompasMeteredPaywall extends LitElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.maxQuota = 5;
|
|
9
|
+
this.subscriptionUrl = 'https://www.kompas.id/berlangganan';
|
|
10
|
+
/**
|
|
11
|
+
* Props
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* prop countdownArticle untuk menghandle sudah berapa artikel gratis yang user baca.
|
|
15
|
+
* prop paywall_location = The location where user encounter the paywall
|
|
16
|
+
* prop paywall_subscription_package = The name of the subscription package viewed by user
|
|
17
|
+
* prop paywall_subscription_id = The ID of the subscription package viewed by user
|
|
18
|
+
* prop paywall_subscription_price = The price of the subscriprtion package viewed by user
|
|
19
|
+
* prop paywall_position = The position of ther subscription package viewed by user
|
|
20
|
+
* prop tracker_page_type = Type of the page
|
|
21
|
+
* prop tracker_content_id = ID of article (slug)
|
|
22
|
+
* prop tracker_content_type = Whether it's free article or paid article
|
|
23
|
+
* prop tracker_content_title = The title of article
|
|
24
|
+
* prop tracker_content_categories = The category of the content
|
|
25
|
+
* prop tracker_user_type = Type of user based on their subscription
|
|
26
|
+
* prop tracker_subscription_status = Status of their subscription
|
|
27
|
+
* prop tracker_page_domain = Page Domain
|
|
28
|
+
* prop tracker_metered_wall_type = The type of Metered Wall
|
|
29
|
+
* prop tracker_epaper_edition = The edition of epaper viewed by user
|
|
30
|
+
* prop tracker_metered_wall_balance = The balance of their metered wall
|
|
31
|
+
*/
|
|
32
|
+
this.countdownArticle = 0;
|
|
33
|
+
this.paywall_location = '';
|
|
34
|
+
this.paywall_subscription_package = '';
|
|
35
|
+
this.paywall_subscription_id = '';
|
|
36
|
+
this.paywall_subscription_price = 0;
|
|
37
|
+
this.paywall_position = 0;
|
|
38
|
+
this.tracker_page_type = '';
|
|
39
|
+
this.tracker_content_id = '';
|
|
40
|
+
this.tracker_content_title = '';
|
|
41
|
+
this.tracker_content_categories = '';
|
|
42
|
+
this.tracker_content_type = '';
|
|
43
|
+
this.tracker_user_type = '';
|
|
44
|
+
this.tracker_subscription_status = '';
|
|
45
|
+
this.tracker_page_domain = '';
|
|
46
|
+
this.tracker_metered_wall_type = '';
|
|
47
|
+
this.tracker_metered_wall_balance = 0;
|
|
48
|
+
}
|
|
49
|
+
getCountdownArticle() {
|
|
50
|
+
const getCountdown = this.countdownArticle;
|
|
51
|
+
const { maxQuota } = this;
|
|
52
|
+
if (getCountdown > 0 && getCountdown < maxQuota) {
|
|
53
|
+
return html `
|
|
54
|
+
<p>
|
|
55
|
+
Anda memiliki sisa
|
|
56
|
+
<b>${maxQuota - getCountdown} dari ${maxQuota}</b> artikel premium
|
|
57
|
+
gratis bulan ini. Langganan untuk akses tanpa batas
|
|
58
|
+
</p>
|
|
59
|
+
`;
|
|
60
|
+
}
|
|
61
|
+
return html `
|
|
62
|
+
<p>
|
|
63
|
+
Anda sedang membaca <b>artikel gratis terakhir bulan ini.</b> Langganan
|
|
64
|
+
untuk akses tanpa batas
|
|
65
|
+
</p>
|
|
66
|
+
`;
|
|
67
|
+
}
|
|
68
|
+
connectedCallback() {
|
|
69
|
+
super.connectedCallback();
|
|
70
|
+
this.dataLayeronMeteredPaywall();
|
|
71
|
+
}
|
|
72
|
+
redirectToBerlangganan() {
|
|
73
|
+
this.dataLayeronLanggananButton();
|
|
74
|
+
window.location.href = this.subscriptionUrl;
|
|
75
|
+
}
|
|
76
|
+
dataLayeronLanggananButton() {
|
|
77
|
+
window.dataLayer.push({
|
|
78
|
+
event: 'subscribe_button_clicked',
|
|
79
|
+
paywall_location: this.paywall_location || '',
|
|
80
|
+
paywall_subscription_package: this.paywall_subscription_package || '',
|
|
81
|
+
paywall_subscription_id: this.paywall_subscription_id || '',
|
|
82
|
+
paywall_subscription_price: this.paywall_subscription_price || 0,
|
|
83
|
+
paywall_position: this.paywall_position || 0,
|
|
84
|
+
page_type: this.tracker_page_type,
|
|
85
|
+
content_id: this.tracker_content_id,
|
|
86
|
+
content_title: this.tracker_content_title,
|
|
87
|
+
content_categories: this.tracker_content_categories,
|
|
88
|
+
content_type: this.tracker_content_type,
|
|
89
|
+
user_type: this.tracker_user_type || 'R',
|
|
90
|
+
subscription_status: this.tracker_subscription_status,
|
|
91
|
+
page_domain: this.tracker_page_domain || 'Kompas.id',
|
|
92
|
+
metered_wall_type: this.tracker_metered_wall_type || 'MP',
|
|
93
|
+
metered_wall_balance: (this.maxQuota - this.countdownArticle) + 1
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
dataLayeronMeteredPaywall() {
|
|
97
|
+
window.dataLayer.push({
|
|
98
|
+
event: 'paywall_viewed',
|
|
99
|
+
paywall_location: this.paywall_location || '',
|
|
100
|
+
paywall_subscription_package: this.paywall_subscription_package || '',
|
|
101
|
+
paywall_subscription_id: this.paywall_subscription_id || '',
|
|
102
|
+
paywall_subscription_price: this.paywall_subscription_price || 0,
|
|
103
|
+
paywall_position: this.paywall_position || 0,
|
|
104
|
+
page_type: this.tracker_page_type,
|
|
105
|
+
content_id: this.tracker_content_id,
|
|
106
|
+
content_title: this.tracker_content_title,
|
|
107
|
+
content_categories: this.tracker_content_categories,
|
|
108
|
+
content_type: this.tracker_content_type,
|
|
109
|
+
user_type: this.tracker_user_type || 'R',
|
|
110
|
+
subscription_status: this.tracker_subscription_status,
|
|
111
|
+
page_domain: this.tracker_page_domain || 'Kompas.id',
|
|
112
|
+
metered_wall_type: this.tracker_metered_wall_type || 'MP',
|
|
113
|
+
metered_wall_balance: (this.maxQuota - this.countdownArticle) + 1
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
render() {
|
|
117
|
+
return html `
|
|
118
|
+
<div class="sticky bottom-0 w-full h-full">
|
|
119
|
+
<div
|
|
120
|
+
class="flex flex-row w-full bg-blue-100 py-4 justify-center space-x-4 px-4 lg:px-0 bottom-0"
|
|
121
|
+
>
|
|
122
|
+
<div class="text-grey-600 text-sm md:text-lg self-center text-left">
|
|
123
|
+
${this.getCountdownArticle()}
|
|
124
|
+
</div>
|
|
125
|
+
<div class="self-center">
|
|
126
|
+
<button
|
|
127
|
+
@click="${this.redirectToBerlangganan}"
|
|
128
|
+
class="bg-green-400 p-2 rounded-md font-bold text-grey-100 text-sm md:text-xl"
|
|
129
|
+
>
|
|
130
|
+
Langganan
|
|
131
|
+
</button>
|
|
132
|
+
</div>
|
|
133
|
+
</div>
|
|
134
|
+
</div>
|
|
135
|
+
`;
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
KompasMeteredPaywall.styles = [
|
|
139
|
+
css `
|
|
140
|
+
.text-transition {
|
|
141
|
+
width: 100%;
|
|
142
|
+
height: 5rem;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.body {
|
|
146
|
+
position: sticky;
|
|
147
|
+
top: 0;
|
|
148
|
+
height: 100%;
|
|
149
|
+
width: 100%;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.icon {
|
|
153
|
+
height: 1rem;
|
|
154
|
+
color: #48bb78;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.icon.lg {
|
|
158
|
+
height: 1.5rem;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.icon.lg svg {
|
|
162
|
+
height: 1.5rem;
|
|
163
|
+
}
|
|
164
|
+
`,
|
|
165
|
+
TWStyles,
|
|
166
|
+
];
|
|
167
|
+
__decorate([
|
|
168
|
+
state()
|
|
169
|
+
], KompasMeteredPaywall.prototype, "maxQuota", void 0);
|
|
170
|
+
__decorate([
|
|
171
|
+
state()
|
|
172
|
+
], KompasMeteredPaywall.prototype, "subscriptionUrl", void 0);
|
|
173
|
+
__decorate([
|
|
174
|
+
property({ type: Number })
|
|
175
|
+
], KompasMeteredPaywall.prototype, "countdownArticle", void 0);
|
|
176
|
+
__decorate([
|
|
177
|
+
property({ type: String })
|
|
178
|
+
], KompasMeteredPaywall.prototype, "paywall_location", void 0);
|
|
179
|
+
__decorate([
|
|
180
|
+
property({ type: String })
|
|
181
|
+
], KompasMeteredPaywall.prototype, "paywall_subscription_package", void 0);
|
|
182
|
+
__decorate([
|
|
183
|
+
property({ type: String })
|
|
184
|
+
], KompasMeteredPaywall.prototype, "paywall_subscription_id", void 0);
|
|
185
|
+
__decorate([
|
|
186
|
+
property({ type: Number })
|
|
187
|
+
], KompasMeteredPaywall.prototype, "paywall_subscription_price", void 0);
|
|
188
|
+
__decorate([
|
|
189
|
+
property({ type: Number })
|
|
190
|
+
], KompasMeteredPaywall.prototype, "paywall_position", void 0);
|
|
191
|
+
__decorate([
|
|
192
|
+
property({ type: String })
|
|
193
|
+
], KompasMeteredPaywall.prototype, "tracker_page_type", void 0);
|
|
194
|
+
__decorate([
|
|
195
|
+
property({ type: String })
|
|
196
|
+
], KompasMeteredPaywall.prototype, "tracker_content_id", void 0);
|
|
197
|
+
__decorate([
|
|
198
|
+
property({ type: String })
|
|
199
|
+
], KompasMeteredPaywall.prototype, "tracker_content_title", void 0);
|
|
200
|
+
__decorate([
|
|
201
|
+
property({ type: String })
|
|
202
|
+
], KompasMeteredPaywall.prototype, "tracker_content_categories", void 0);
|
|
203
|
+
__decorate([
|
|
204
|
+
property({ type: String })
|
|
205
|
+
], KompasMeteredPaywall.prototype, "tracker_content_type", void 0);
|
|
206
|
+
__decorate([
|
|
207
|
+
property({ type: String })
|
|
208
|
+
], KompasMeteredPaywall.prototype, "tracker_user_type", void 0);
|
|
209
|
+
__decorate([
|
|
210
|
+
property({ type: String })
|
|
211
|
+
], KompasMeteredPaywall.prototype, "tracker_subscription_status", void 0);
|
|
212
|
+
__decorate([
|
|
213
|
+
property({ type: String })
|
|
214
|
+
], KompasMeteredPaywall.prototype, "tracker_page_domain", void 0);
|
|
215
|
+
__decorate([
|
|
216
|
+
property({ type: String })
|
|
217
|
+
], KompasMeteredPaywall.prototype, "tracker_metered_wall_type", void 0);
|
|
218
|
+
__decorate([
|
|
219
|
+
property({ type: Number })
|
|
220
|
+
], KompasMeteredPaywall.prototype, "tracker_metered_wall_balance", void 0);
|
|
221
|
+
KompasMeteredPaywall = __decorate([
|
|
222
|
+
customElement('kompas-metered-paywall')
|
|
223
|
+
], KompasMeteredPaywall);
|
|
224
|
+
export { KompasMeteredPaywall };
|
|
225
|
+
//# sourceMappingURL=KompasMeteredPaywall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KompasMeteredPaywall.js","sourceRoot":"","sources":["../../../../src/components/kompas-metered-paywall/KompasMeteredPaywall.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAA;AAGjD,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,UAAU;IAA7C;;QA+BI,aAAQ,GAAW,CAAC,CAAA;QAEpB,oBAAe,GAAW,oCAAoC,CAAA;QACvE;;WAEG;QACH;;;;;;;;;;;;;;;;;;WAkBG;QACyB,qBAAgB,GAAG,CAAC,CAAA;QACpB,qBAAgB,GAAG,EAAE,CAAA;QACrB,iCAA4B,GAAG,EAAE,CAAA;QACjC,4BAAuB,GAAG,EAAE,CAAA;QAC5B,+BAA0B,GAAG,CAAC,CAAA;QAC9B,qBAAgB,GAAG,CAAC,CAAA;QACpB,sBAAiB,GAAG,EAAE,CAAA;QACtB,uBAAkB,GAAG,EAAE,CAAA;QACvB,0BAAqB,GAAG,EAAE,CAAA;QAC1B,+BAA0B,GAAG,EAAE,CAAA;QAC/B,yBAAoB,GAAG,EAAE,CAAA;QACzB,sBAAiB,GAAG,EAAE,CAAA;QACtB,gCAA2B,GAAG,EAAE,CAAA;QAChC,wBAAmB,GAAG,EAAE,CAAA;QACxB,8BAAyB,GAAG,EAAE,CAAA;QAC9B,iCAA4B,GAAG,CAAC,CAAA;IAiG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AAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0EAAiC;AAvEjD,oBAAoB;IADhC,aAAa,CAAC,wBAAwB,CAAC;GAC3B,oBAAoB,CAwKhC","sourcesContent":["import { html, css, LitElement } from 'lit'\nimport { customElement, state, property } from 'lit/decorators.js'\nimport { TWStyles } from '../../../tailwind/tailwind.js'\n\n@customElement('kompas-metered-paywall')\nexport class KompasMeteredPaywall extends LitElement {\n static styles = [\n css`\n .text-transition {\n width: 100%;\n height: 5rem;\n }\n\n .body {\n position: sticky;\n top: 0;\n height: 100%;\n width: 100%;\n }\n\n .icon {\n height: 1rem;\n color: #48bb78;\n }\n\n .icon.lg {\n height: 1.5rem;\n }\n\n .icon.lg svg {\n height: 1.5rem;\n }\n `,\n TWStyles,\n ]\n\n @state() maxQuota: number = 5\n\n @state() subscriptionUrl: string = 'https://www.kompas.id/berlangganan'\n /**\n * Props\n */\n /**\n * prop countdownArticle untuk menghandle sudah berapa artikel gratis yang user baca.\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 ther subscription package viewed by user\n * prop tracker_page_type = Type of the page\n * prop tracker_content_id = ID of article (slug)\n * prop tracker_content_type = Whether it's free article or paid article\n * prop tracker_content_title = The title of article\n * prop tracker_content_categories = The category of the content\n * prop tracker_user_type = Type of user based on their subscription\n * prop tracker_subscription_status = Status of their subscription\n * prop tracker_page_domain = Page Domain\n * prop tracker_metered_wall_type = The type of Metered Wall\n * prop tracker_epaper_edition = The edition of epaper viewed by user\n * prop tracker_metered_wall_balance = The balance of their metered wall\n */\n @property({ type: Number }) countdownArticle = 0\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\n private getCountdownArticle() {\n const getCountdown = this.countdownArticle\n const { maxQuota } = this\n\n if (getCountdown > 0 && getCountdown < maxQuota) {\n return html`\n <p>\n Anda memiliki sisa\n <b>${maxQuota - getCountdown} dari ${maxQuota}</b> artikel premium\n gratis bulan ini. Langganan untuk akses tanpa batas\n </p>\n `\n }\n return html`\n <p>\n Anda sedang membaca <b>artikel gratis terakhir bulan ini.</b> Langganan\n untuk akses tanpa batas\n </p>\n `\n }\n\n connectedCallback() {\n super.connectedCallback()\n\n this.dataLayeronMeteredPaywall()\n }\n\n private redirectToBerlangganan() {\n this.dataLayeronLanggananButton()\n window.location.href = this.subscriptionUrl\n }\n\n private dataLayeronLanggananButton() {\n window.dataLayer.push({\n event: 'subscribe_button_clicked',\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 || 0,\n paywall_position: this.paywall_position || 0,\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 user_type: this.tracker_user_type || 'R',\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 || 'MP',\n metered_wall_balance: (this.maxQuota - this.countdownArticle) + 1\n })\n }\n\n private dataLayeronMeteredPaywall() {\n window.dataLayer.push({\n event: 'paywall_viewed',\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 || 0,\n paywall_position: this.paywall_position || 0,\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 user_type: this.tracker_user_type || 'R',\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 || 'MP',\n metered_wall_balance: (this.maxQuota - this.countdownArticle) + 1\n })\n }\n\n render() {\n return html`\n <div class=\"sticky bottom-0 w-full h-full\">\n <div\n class=\"flex flex-row w-full bg-blue-100 py-4 justify-center space-x-4 px-4 lg:px-0 bottom-0\"\n >\n <div class=\"text-grey-600 text-sm md:text-lg self-center text-left\">\n ${this.getCountdownArticle()}\n </div>\n <div class=\"self-center\">\n <button\n @click=\"${this.redirectToBerlangganan}\"\n class=\"bg-green-400 p-2 rounded-md font-bold text-grey-100 text-sm md:text-xl\"\n >\n Langganan\n </button>\n </div>\n </div>\n </div>\n `\n }\n}\n"]}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { PaywallProduct } from './types.js';
|
|
3
|
+
import '../kompas-paywall-body/KompasPaywallBody.js';
|
|
4
|
+
import '../kompas-paywall-banner-registration/KompasPaywallBannerRegistration.js';
|
|
5
|
+
import '../kompas-paywall-information-header/KompasPaywallInformationHeader.js';
|
|
6
|
+
export declare class KompasPaywall extends LitElement {
|
|
7
|
+
static styles: import("lit").CSSResult[];
|
|
8
|
+
/**
|
|
9
|
+
* Props
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* property isLogin untuk menghandle apakah user sudah login atau belum
|
|
13
|
+
* property countdownArticle untuk menghandle count artikel
|
|
14
|
+
* property type untuk menghandle tipe epaper
|
|
15
|
+
* property isWithHeader untuk menghandle paywall information header
|
|
16
|
+
* property textHeader digunakan sebagai text pada paywall information header
|
|
17
|
+
* property paywallData untuk menghandle data paywall
|
|
18
|
+
* property userGuid untuk menghandle user Guid
|
|
19
|
+
* property subscriptionStatus untuk menghandle status subscription user
|
|
20
|
+
* property swgEnable untuk menghandle swg apakah di aktifkan atau tidak
|
|
21
|
+
* property paywall_location = The location where user encounter the paywall
|
|
22
|
+
* property paywall_subscription_package = The name of the subscription package viewed by user
|
|
23
|
+
* property paywall_subscription_id = The ID of the subscription package viewed by user
|
|
24
|
+
* property paywall_subscription_price = The price of the subscriprtion package viewed by user
|
|
25
|
+
* property paywall_position = The position of the subscription package viewed by user
|
|
26
|
+
* property page_type = Type of the page
|
|
27
|
+
* property content_id = ID of article (slug)
|
|
28
|
+
* property content_type = Whether it's free article or paid article
|
|
29
|
+
* property content_title = The title of article
|
|
30
|
+
* property tracker_content_categories = The category of the content
|
|
31
|
+
* property user_type = Type of user based on their subscription
|
|
32
|
+
* property subscription_status = Status of their subscription
|
|
33
|
+
* property page_domain = Page Domain
|
|
34
|
+
* property metered_wall_type = The type of Metered Wall
|
|
35
|
+
* property metered_wall_balance = The balance of their metered wall
|
|
36
|
+
* property epaper_edition = The edition of epaper viewed by user
|
|
37
|
+
* property theme = The theme of the paywall component
|
|
38
|
+
*/
|
|
39
|
+
private paywallData;
|
|
40
|
+
isLogin: boolean;
|
|
41
|
+
countdownArticle: number;
|
|
42
|
+
type: 'epaper' | 'reguler';
|
|
43
|
+
isWithHeader: boolean;
|
|
44
|
+
textHeader: string;
|
|
45
|
+
userGuid: string;
|
|
46
|
+
subscriptionStatus: string;
|
|
47
|
+
swgEnable: boolean;
|
|
48
|
+
paywall_location: string;
|
|
49
|
+
paywall_subscription_package: string;
|
|
50
|
+
paywall_subscription_id: number;
|
|
51
|
+
paywall_subscription_price: number;
|
|
52
|
+
paywall_position: number;
|
|
53
|
+
tracker_page_type: string;
|
|
54
|
+
tracker_content_id: string;
|
|
55
|
+
tracker_content_title: string;
|
|
56
|
+
tracker_content_categories: string;
|
|
57
|
+
tracker_content_type: string;
|
|
58
|
+
tracker_user_type: string;
|
|
59
|
+
tracker_subscription_status: string;
|
|
60
|
+
tracker_page_domain: string;
|
|
61
|
+
tracker_metered_wall_type: string;
|
|
62
|
+
tracker_metered_wall_balance: number;
|
|
63
|
+
tracker_epaper_edition: string;
|
|
64
|
+
theme: string;
|
|
65
|
+
mockResult: PaywallProduct;
|
|
66
|
+
get darkUrl(): "" | "-dark";
|
|
67
|
+
connectedCallback(): void;
|
|
68
|
+
private transitionBox;
|
|
69
|
+
private renderEpaperPaywallSection;
|
|
70
|
+
private renderRegularPaywallSection;
|
|
71
|
+
private selectorTypePaywall;
|
|
72
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
73
|
+
}
|