@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,54 @@
|
|
|
1
|
+
export interface Image {
|
|
2
|
+
alt: string
|
|
3
|
+
height: number
|
|
4
|
+
url: string
|
|
5
|
+
width: number
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface Item {
|
|
9
|
+
image: Image
|
|
10
|
+
permalink: string
|
|
11
|
+
name: string
|
|
12
|
+
url: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface Section<T> {
|
|
16
|
+
items: T[]
|
|
17
|
+
title?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface Phones {
|
|
21
|
+
number: number
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface Sites {
|
|
25
|
+
text: string
|
|
26
|
+
permalink: string
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface Items {
|
|
30
|
+
phones: Phones
|
|
31
|
+
title: string
|
|
32
|
+
text: string
|
|
33
|
+
sites: Sites
|
|
34
|
+
action: string
|
|
35
|
+
icon: string[]
|
|
36
|
+
label: string
|
|
37
|
+
color: string
|
|
38
|
+
name: string
|
|
39
|
+
url: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface Universal {
|
|
43
|
+
itemsLeft: Item[]
|
|
44
|
+
itemsRight: Item[]
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface Footer {
|
|
48
|
+
brands: Universal
|
|
49
|
+
address: Section<Items>
|
|
50
|
+
products: Section<Items>
|
|
51
|
+
contacts: Section<Items>
|
|
52
|
+
sosmed: Section<Items>
|
|
53
|
+
universal: Universal
|
|
54
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { html, css, LitElement } from 'lit'
|
|
2
|
+
import { customElement, state, property } from 'lit/decorators.js'
|
|
3
|
+
import { TWStyles } from '../../../tailwind/tailwind.js'
|
|
4
|
+
|
|
5
|
+
@customElement('kompas-metered-paywall')
|
|
6
|
+
export class KompasMeteredPaywall extends LitElement {
|
|
7
|
+
static styles = [
|
|
8
|
+
css`
|
|
9
|
+
.text-transition {
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 5rem;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.body {
|
|
15
|
+
position: sticky;
|
|
16
|
+
top: 0;
|
|
17
|
+
height: 100%;
|
|
18
|
+
width: 100%;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.icon {
|
|
22
|
+
height: 1rem;
|
|
23
|
+
color: #48bb78;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.icon.lg {
|
|
27
|
+
height: 1.5rem;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.icon.lg svg {
|
|
31
|
+
height: 1.5rem;
|
|
32
|
+
}
|
|
33
|
+
`,
|
|
34
|
+
TWStyles,
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
@state() maxQuota: number = 5
|
|
38
|
+
|
|
39
|
+
@state() subscriptionUrl: string = 'https://www.kompas.id/berlangganan'
|
|
40
|
+
/**
|
|
41
|
+
* Props
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* prop countdownArticle untuk menghandle sudah berapa artikel gratis yang user baca.
|
|
45
|
+
* prop paywall_location = The location where user encounter the paywall
|
|
46
|
+
* prop paywall_subscription_package = The name of the subscription package viewed by user
|
|
47
|
+
* prop paywall_subscription_id = The ID of the subscription package viewed by user
|
|
48
|
+
* prop paywall_subscription_price = The price of the subscriprtion package viewed by user
|
|
49
|
+
* prop paywall_position = The position of ther subscription package viewed by user
|
|
50
|
+
* prop tracker_page_type = Type of the page
|
|
51
|
+
* prop tracker_content_id = ID of article (slug)
|
|
52
|
+
* prop tracker_content_type = Whether it's free article or paid article
|
|
53
|
+
* prop tracker_content_title = The title of article
|
|
54
|
+
* prop tracker_content_categories = The category of the content
|
|
55
|
+
* prop tracker_user_type = Type of user based on their subscription
|
|
56
|
+
* prop tracker_subscription_status = Status of their subscription
|
|
57
|
+
* prop tracker_page_domain = Page Domain
|
|
58
|
+
* prop tracker_metered_wall_type = The type of Metered Wall
|
|
59
|
+
* prop tracker_epaper_edition = The edition of epaper viewed by user
|
|
60
|
+
* prop tracker_metered_wall_balance = The balance of their metered wall
|
|
61
|
+
*/
|
|
62
|
+
@property({ type: Number }) countdownArticle = 0
|
|
63
|
+
@property({ type: String }) paywall_location = ''
|
|
64
|
+
@property({ type: String }) paywall_subscription_package = ''
|
|
65
|
+
@property({ type: String }) paywall_subscription_id = ''
|
|
66
|
+
@property({ type: Number }) paywall_subscription_price = 0
|
|
67
|
+
@property({ type: Number }) paywall_position = 0
|
|
68
|
+
@property({ type: String }) tracker_page_type = ''
|
|
69
|
+
@property({ type: String }) tracker_content_id = ''
|
|
70
|
+
@property({ type: String }) tracker_content_title = ''
|
|
71
|
+
@property({ type: String }) tracker_content_categories = ''
|
|
72
|
+
@property({ type: String }) tracker_content_type = ''
|
|
73
|
+
@property({ type: String }) tracker_user_type = ''
|
|
74
|
+
@property({ type: String }) tracker_subscription_status = ''
|
|
75
|
+
@property({ type: String }) tracker_page_domain = ''
|
|
76
|
+
@property({ type: String }) tracker_metered_wall_type = ''
|
|
77
|
+
@property({ type: Number }) tracker_metered_wall_balance = 0
|
|
78
|
+
|
|
79
|
+
private getCountdownArticle() {
|
|
80
|
+
const getCountdown = this.countdownArticle
|
|
81
|
+
const { maxQuota } = this
|
|
82
|
+
|
|
83
|
+
if (getCountdown > 0 && getCountdown < maxQuota) {
|
|
84
|
+
return html`
|
|
85
|
+
<p>
|
|
86
|
+
Anda memiliki sisa
|
|
87
|
+
<b>${maxQuota - getCountdown} dari ${maxQuota}</b> artikel premium
|
|
88
|
+
gratis bulan ini. Langganan untuk akses tanpa batas
|
|
89
|
+
</p>
|
|
90
|
+
`
|
|
91
|
+
}
|
|
92
|
+
return html`
|
|
93
|
+
<p>
|
|
94
|
+
Anda sedang membaca <b>artikel gratis terakhir bulan ini.</b> Langganan
|
|
95
|
+
untuk akses tanpa batas
|
|
96
|
+
</p>
|
|
97
|
+
`
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
connectedCallback() {
|
|
101
|
+
super.connectedCallback()
|
|
102
|
+
|
|
103
|
+
this.dataLayeronMeteredPaywall()
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
private redirectToBerlangganan() {
|
|
107
|
+
this.dataLayeronLanggananButton()
|
|
108
|
+
window.location.href = this.subscriptionUrl
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
private dataLayeronLanggananButton() {
|
|
112
|
+
window.dataLayer.push({
|
|
113
|
+
event: 'subscribe_button_clicked',
|
|
114
|
+
paywall_location: this.paywall_location || '',
|
|
115
|
+
paywall_subscription_package: this.paywall_subscription_package || '',
|
|
116
|
+
paywall_subscription_id: this.paywall_subscription_id || '',
|
|
117
|
+
paywall_subscription_price: this.paywall_subscription_price || 0,
|
|
118
|
+
paywall_position: this.paywall_position || 0,
|
|
119
|
+
page_type: this.tracker_page_type,
|
|
120
|
+
content_id: this.tracker_content_id,
|
|
121
|
+
content_title: this.tracker_content_title,
|
|
122
|
+
content_categories: this.tracker_content_categories,
|
|
123
|
+
content_type: this.tracker_content_type,
|
|
124
|
+
user_type: this.tracker_user_type || 'R',
|
|
125
|
+
subscription_status: this.tracker_subscription_status,
|
|
126
|
+
page_domain: this.tracker_page_domain || 'Kompas.id',
|
|
127
|
+
metered_wall_type: this.tracker_metered_wall_type || 'MP',
|
|
128
|
+
metered_wall_balance: (this.maxQuota - this.countdownArticle) + 1
|
|
129
|
+
})
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
private dataLayeronMeteredPaywall() {
|
|
133
|
+
window.dataLayer.push({
|
|
134
|
+
event: 'paywall_viewed',
|
|
135
|
+
paywall_location: this.paywall_location || '',
|
|
136
|
+
paywall_subscription_package: this.paywall_subscription_package || '',
|
|
137
|
+
paywall_subscription_id: this.paywall_subscription_id || '',
|
|
138
|
+
paywall_subscription_price: this.paywall_subscription_price || 0,
|
|
139
|
+
paywall_position: this.paywall_position || 0,
|
|
140
|
+
page_type: this.tracker_page_type,
|
|
141
|
+
content_id: this.tracker_content_id,
|
|
142
|
+
content_title: this.tracker_content_title,
|
|
143
|
+
content_categories: this.tracker_content_categories,
|
|
144
|
+
content_type: this.tracker_content_type,
|
|
145
|
+
user_type: this.tracker_user_type || 'R',
|
|
146
|
+
subscription_status: this.tracker_subscription_status,
|
|
147
|
+
page_domain: this.tracker_page_domain || 'Kompas.id',
|
|
148
|
+
metered_wall_type: this.tracker_metered_wall_type || 'MP',
|
|
149
|
+
metered_wall_balance: (this.maxQuota - this.countdownArticle) + 1
|
|
150
|
+
})
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
render() {
|
|
154
|
+
return html`
|
|
155
|
+
<div class="sticky bottom-0 w-full h-full">
|
|
156
|
+
<div
|
|
157
|
+
class="flex flex-row w-full bg-blue-100 py-4 justify-center space-x-4 px-4 lg:px-0 bottom-0"
|
|
158
|
+
>
|
|
159
|
+
<div class="text-grey-600 text-sm md:text-lg self-center text-left">
|
|
160
|
+
${this.getCountdownArticle()}
|
|
161
|
+
</div>
|
|
162
|
+
<div class="self-center">
|
|
163
|
+
<button
|
|
164
|
+
@click="${this.redirectToBerlangganan}"
|
|
165
|
+
class="bg-green-400 p-2 rounded-md font-bold text-grey-100 text-sm md:text-xl"
|
|
166
|
+
>
|
|
167
|
+
Langganan
|
|
168
|
+
</button>
|
|
169
|
+
</div>
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
`
|
|
173
|
+
}
|
|
174
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# kompas-paywall-meter
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
<!-- Auto Generated Below -->
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Properties
|
|
9
|
+
|
|
10
|
+
| Property | Attribute | Description | Type | Default |
|
|
11
|
+
| ------------------------------ | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------- |
|
|
12
|
+
| `countdownArticle` | `countdown-article` | prop countdownArticle untuk menghandle sudah berapa artikel gratis yang user baca. prop paywall_location = The location where user encounter the paywall prop paywall_subscription_package = The name of the subscription package viewed by user prop paywall_subscription_id = The ID of the subscription package viewed by user prop paywall_subscription_price = The price of the subscriprtion package viewed by user prop paywall_position = The position of ther subscription package viewed by user prop tracker_page_type = Type of the page prop tracker_content_id = ID of article (slug) prop tracker_content_type = Whether it's free article or paid article prop tracker_content_title = The title of article prop tracker_content_categories = The category of the content prop tracker_user_type = Type of user based on their subscription prop tracker_subscription_status = Status of their subscription prop tracker_page_domain = Page Domain prop tracker_metered_wall_type = The type of Metered Wall prop tracker_epaper_edition = The edition of epaper viewed by user prop tracker_metered_wall_balance = The balance of their metered wall | `number` | `0` |
|
|
13
|
+
| `paywall_location` | `paywall_location` | | `string` | `''` |
|
|
14
|
+
| `paywall_position` | `paywall_position` | | `number` | `0` |
|
|
15
|
+
| `paywall_subscription_id` | `paywall_subscription_id` | | `string` | `''` |
|
|
16
|
+
| `paywall_subscription_package` | `paywall_subscription_package` | | `string` | `''` |
|
|
17
|
+
| `paywall_subscription_price` | `paywall_subscription_price` | | `number` | `0` |
|
|
18
|
+
| `tracker_content_categories` | `tracker_content_categories` | | `string` | `''` |
|
|
19
|
+
| `tracker_content_id` | `tracker_content_id` | | `string` | `''` |
|
|
20
|
+
| `tracker_content_title` | `tracker_content_title` | | `string` | `''` |
|
|
21
|
+
| `tracker_content_type` | `tracker_content_type` | | `string` | `''` |
|
|
22
|
+
| `tracker_metered_wall_balance` | `tracker_metered_wall_balance` | | `number` | `0` |
|
|
23
|
+
| `tracker_metered_wall_type` | `tracker_metered_wall_type` | | `string` | `''` |
|
|
24
|
+
| `tracker_page_domain` | `tracker_page_domain` | | `string` | `''` |
|
|
25
|
+
| `tracker_page_type` | `tracker_page_type` | | `string` | `''` |
|
|
26
|
+
| `tracker_subscription_status` | `tracker_subscription_status` | | `string` | `''` |
|
|
27
|
+
| `tracker_user_type` | `tracker_user_type` | | `string` | `''` |
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
----------------------------------------------
|
|
31
|
+
|
|
32
|
+
*Terbikin oleh tim front-end kompas.id*
|