@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
|
+
# kompas-paywall-body
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
<!-- Auto Generated Below -->
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Properties
|
|
9
|
+
|
|
10
|
+
| Property | Attribute | Description | Type | Default |
|
|
11
|
+
| ------------------------------ | ------------------------------ | ----------- | ----------------------- | ----------- |
|
|
12
|
+
| `countdownArticle` | `countdown-article` | | `number` | `0` |
|
|
13
|
+
| `isLogin` | `is-login` | | `boolean` | `false` |
|
|
14
|
+
| `paywallData` | -- | | `PaywallProduct` | `undefined` |
|
|
15
|
+
| `paywall_location` | `paywall_location` | | `string` | `''` |
|
|
16
|
+
| `paywall_position` | `paywall_position` | | `number` | `0` |
|
|
17
|
+
| `paywall_subscription_id` | `paywall_subscription_id` | | `number` | `0` |
|
|
18
|
+
| `paywall_subscription_package` | `paywall_subscription_package` | | `string` | `''` |
|
|
19
|
+
| `paywall_subscription_price` | `paywall_subscription_price` | | `number` | `0` |
|
|
20
|
+
| `slug` | `slug` | | `string` | `""` |
|
|
21
|
+
| `subscriptionStatus` | `subscription-status` | | `string` | `''` |
|
|
22
|
+
| `swgEnable` | `swg-enable` | | `boolean` | `false` |
|
|
23
|
+
| `theme` | `theme` | | `string` | `''` |
|
|
24
|
+
| `tracker_content_categories` | `tracker_content_categories` | | `string` | `''` |
|
|
25
|
+
| `tracker_content_id` | `tracker_content_id` | | `string` | `''` |
|
|
26
|
+
| `tracker_content_title` | `tracker_content_title` | | `string` | `''` |
|
|
27
|
+
| `tracker_content_type` | `tracker_content_type` | | `string` | `''` |
|
|
28
|
+
| `tracker_epaper_edition` | `tracker_epaper_edition` | | `string` | `''` |
|
|
29
|
+
| `tracker_metered_wall_balance` | `tracker_metered_wall_balance` | | `number` | `0` |
|
|
30
|
+
| `tracker_metered_wall_type` | `tracker_metered_wall_type` | | `string` | `''` |
|
|
31
|
+
| `tracker_page_domain` | `tracker_page_domain` | | `string` | `''` |
|
|
32
|
+
| `tracker_page_type` | `tracker_page_type` | | `string` | `''` |
|
|
33
|
+
| `tracker_subscription_status` | `tracker_subscription_status` | | `string` | `''` |
|
|
34
|
+
| `tracker_user_type` | `tracker_user_type` | | `string` | `''` |
|
|
35
|
+
| `type` | `type` | | `"epaper" \| "reguler"` | `'reguler'` |
|
|
36
|
+
| `userGuid` | `user-guid` | | `string` | `''` |
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## Dependencies
|
|
40
|
+
|
|
41
|
+
### Used by
|
|
42
|
+
|
|
43
|
+
- [kompas-paywall](../kompas-paywall)
|
|
44
|
+
|
|
45
|
+
### Graph
|
|
46
|
+
```mermaid
|
|
47
|
+
graph TD;
|
|
48
|
+
kompas-paywall --> kompas-paywall-body
|
|
49
|
+
style kompas-paywall-body fill:#f9f,stroke:#333,stroke-width:4px
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
----------------------------------------------
|
|
53
|
+
|
|
54
|
+
*Terbikin oleh tim front-end kompas.id*
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* eslint-disable class-methods-use-this */
|
|
2
|
+
import { html, css, LitElement } from 'lit'
|
|
3
|
+
import { property, customElement } from 'lit/decorators.js'
|
|
4
|
+
import { TWStyles } from '../../../tailwind/tailwind.js'
|
|
5
|
+
|
|
6
|
+
@customElement('kompas-paywall-information-header')
|
|
7
|
+
export class KompasPaywallInformationHeader extends LitElement {
|
|
8
|
+
static styles = [css``, TWStyles]
|
|
9
|
+
|
|
10
|
+
@property({ type: String }) text = ''
|
|
11
|
+
@property({ type: String }) theme = ''
|
|
12
|
+
|
|
13
|
+
get isDark() {
|
|
14
|
+
return this.theme === 'dark'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
render() {
|
|
18
|
+
return html`
|
|
19
|
+
<div class="my-4 md:my-8">
|
|
20
|
+
<h5
|
|
21
|
+
class="text-base text-center md:text-xl ${this.theme === 'dark' &&
|
|
22
|
+
'text-white'} font-bold font-serif"
|
|
23
|
+
>
|
|
24
|
+
${this.text}
|
|
25
|
+
</h5>
|
|
26
|
+
</div>
|
|
27
|
+
`
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# kompas-paywall-information-header
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
<!-- Auto Generated Below -->
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Properties
|
|
9
|
+
|
|
10
|
+
| Property | Attribute | Description | Type | Default |
|
|
11
|
+
| -------- | --------- | ----------- | -------- | ------- |
|
|
12
|
+
| `text` | `text` | | `string` | `''` |
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## Dependencies
|
|
16
|
+
|
|
17
|
+
### Used by
|
|
18
|
+
|
|
19
|
+
- [kompas-paywall](../kompas-paywall)
|
|
20
|
+
|
|
21
|
+
### Graph
|
|
22
|
+
```mermaid
|
|
23
|
+
graph TD;
|
|
24
|
+
kompas-paywall --> kompas-paywall-information-header
|
|
25
|
+
style kompas-paywall-information-header fill:#f9f,stroke:#333,stroke-width:4px
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
----------------------------------------------
|
|
29
|
+
|
|
30
|
+
*Terbikin oleh tim front-end kompas.id*
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/* eslint-disable class-methods-use-this */
|
|
2
|
+
import { html, css, LitElement } from 'lit'
|
|
3
|
+
import { property, customElement, state } from 'lit/decorators.js'
|
|
4
|
+
import { TWStyles } from '../../../tailwind/tailwind.js'
|
|
5
|
+
import { deviceType } from '../../utils/deviceType.js'
|
|
6
|
+
|
|
7
|
+
@customElement('kompas-paywall-video')
|
|
8
|
+
export class KompasPaywallVideo extends LitElement {
|
|
9
|
+
static styles = [css``, TWStyles]
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Props
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* prop isLogin untuk menghandle apakah user sudah login atau belum
|
|
16
|
+
* prop paywall_location = The location where user encounter the paywall
|
|
17
|
+
* prop paywall_subscription_package = The name of the subscription package viewed by user
|
|
18
|
+
* prop paywall_subscription_id = The ID of the subscription package viewed by user
|
|
19
|
+
* prop paywall_subscription_price = The price of the subscriprtion package viewed by user
|
|
20
|
+
* prop paywall_position = The position of the subscription package viewed by user
|
|
21
|
+
* prop page_type = Type of the page
|
|
22
|
+
* prop content_id = ID of article (slug)
|
|
23
|
+
* prop content_type = Whether it's free article or paid article
|
|
24
|
+
* prop content_title = The title of article
|
|
25
|
+
* prop tracker_content_categories = The category of the content
|
|
26
|
+
* prop user_type = Type of user based on their subscription
|
|
27
|
+
* prop subscription_status = Status of their subscription
|
|
28
|
+
* prop page_domain = Page Domain
|
|
29
|
+
* prop metered_wall_type = The type of Metered Wall
|
|
30
|
+
* prop metered_wall_balance = The balance of their metered wall
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
@state() private loginUrl: string = 'https://account.kompas.id/login'
|
|
34
|
+
@state() private subscriptionUrl: string =
|
|
35
|
+
'https://www.kompas.id/berlangganan'
|
|
36
|
+
@state() private registerUrl: string = 'https://account.kompas.id/register'
|
|
37
|
+
|
|
38
|
+
@property({ type: Boolean }) isLogin = false
|
|
39
|
+
@property({ type: String }) paywall_location = ''
|
|
40
|
+
@property({ type: String }) paywall_subscription_package = ''
|
|
41
|
+
@property({ type: String }) paywall_subscription_id = ''
|
|
42
|
+
@property({ type: Number }) paywall_subscription_price = 0
|
|
43
|
+
@property({ type: Number }) paywall_position = 0
|
|
44
|
+
@property({ type: String }) tracker_page_type = ''
|
|
45
|
+
@property({ type: String }) tracker_content_id = ''
|
|
46
|
+
@property({ type: String }) tracker_content_title = ''
|
|
47
|
+
@property({ type: String }) tracker_content_categories = ''
|
|
48
|
+
@property({ type: String }) tracker_content_type = ''
|
|
49
|
+
@property({ type: String }) tracker_user_type = ''
|
|
50
|
+
@property({ type: String }) tracker_subscription_status = ''
|
|
51
|
+
@property({ type: String }) tracker_page_domain = ''
|
|
52
|
+
@property({ type: String }) tracker_metered_wall_type = ''
|
|
53
|
+
@property({ type: Number }) tracker_metered_wall_balance = 0
|
|
54
|
+
|
|
55
|
+
private isLoginComponent() {
|
|
56
|
+
return html`
|
|
57
|
+
<div>
|
|
58
|
+
${this.sendDataLayeronBerlangganan()}
|
|
59
|
+
<h5
|
|
60
|
+
class="leading-6 text-white text-center text-base md:text-xl max-w-2xl"
|
|
61
|
+
>
|
|
62
|
+
Akses konten premium Anda bulan ini sudah habis. Aktifkan langganan
|
|
63
|
+
untuk akses tanpa batas, mulai dari
|
|
64
|
+
<span class="font-bold">Rp50.000/bulan.</span>
|
|
65
|
+
</h5>
|
|
66
|
+
<div class="flex justify-between mt-4">
|
|
67
|
+
<button
|
|
68
|
+
@click=${() => this.redirectToBerlangganan()}
|
|
69
|
+
class="bg-green-500 rounded px-4 py-1.5 text-sm text-white font-bold"
|
|
70
|
+
>
|
|
71
|
+
Berlangganan
|
|
72
|
+
</button>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
`
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private defaultComponent() {
|
|
79
|
+
return html`
|
|
80
|
+
<div>
|
|
81
|
+
${this.sendDataLayeronNonLogin()} ${this.sendDataLayeronBerlangganan()}
|
|
82
|
+
<h5
|
|
83
|
+
class="leading-6 text-white text-center text-base md:text-xl max-w-xl"
|
|
84
|
+
>
|
|
85
|
+
Langganan untuk akses ke seluruh konten premium, mulai dari
|
|
86
|
+
<span class="font-bold">Rp50.000/bulan.</span>
|
|
87
|
+
</h5>
|
|
88
|
+
<div class="flex justify-center mt-4 space-x-3">
|
|
89
|
+
<button
|
|
90
|
+
@click=${() => this.redirectToLogin('Masuk')}
|
|
91
|
+
class="rounded text-sm text-white px-4 py-1.5 ring-1 ring-grey-100"
|
|
92
|
+
>
|
|
93
|
+
Masuk
|
|
94
|
+
</button>
|
|
95
|
+
<button
|
|
96
|
+
@click=${() => this.redirectToBerlangganan()}
|
|
97
|
+
class="bg-green-500 rounded px-4 py-1.5 text-sm text-white font-bold"
|
|
98
|
+
>
|
|
99
|
+
Berlangganan
|
|
100
|
+
</button>
|
|
101
|
+
</div>
|
|
102
|
+
<p
|
|
103
|
+
class="text-center text-sm leading-4 text-white mt-6 max-w-xs md:max-w-none"
|
|
104
|
+
>
|
|
105
|
+
Dapatkan 5 konten premium gratis tiap bulan!
|
|
106
|
+
<button
|
|
107
|
+
@click=${() => this.redirectToLogin('Coba Sekarang')}
|
|
108
|
+
target="_blank"
|
|
109
|
+
class="text-blue-300 font-bold cursor-pointer"
|
|
110
|
+
>
|
|
111
|
+
Coba Sekarang
|
|
112
|
+
</button>
|
|
113
|
+
</p>
|
|
114
|
+
</div>
|
|
115
|
+
`
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
private sendDataLayeronNonLogin = (): void => {
|
|
119
|
+
window.dataLayer.push({
|
|
120
|
+
event: 'registrationOfferimppression',
|
|
121
|
+
interface: deviceType(),
|
|
122
|
+
})
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
private sendDataLayeronBerlangganan = (): void => {
|
|
126
|
+
window.dataLayer.push({
|
|
127
|
+
event: 'paywall_viewed',
|
|
128
|
+
paywall_location: this.paywall_location,
|
|
129
|
+
paywall_subscription_package: this.paywall_subscription_package,
|
|
130
|
+
paywall_subscription_id: this.paywall_subscription_id,
|
|
131
|
+
paywall_subscription_price: this.paywall_subscription_price,
|
|
132
|
+
paywall_position: this.paywall_position,
|
|
133
|
+
page_type: this.tracker_page_type,
|
|
134
|
+
content_id: this.tracker_content_id,
|
|
135
|
+
content_title: this.tracker_content_title,
|
|
136
|
+
content_categories: this.tracker_content_categories,
|
|
137
|
+
content_type: this.tracker_content_type,
|
|
138
|
+
user_type: this.tracker_user_type,
|
|
139
|
+
subscription_status: this.tracker_subscription_status,
|
|
140
|
+
page_domain: this.tracker_page_domain || 'Kompas.id',
|
|
141
|
+
metered_wall_type: this.tracker_metered_wall_type || 'HP',
|
|
142
|
+
metered_wall_balance: this.tracker_metered_wall_balance,
|
|
143
|
+
})
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
private sendDataLayeronButtonLogin = (triggerClick: string): void => {
|
|
147
|
+
window.dataLayer.push({
|
|
148
|
+
event: 'registrationOfferClick',
|
|
149
|
+
interface: deviceType(),
|
|
150
|
+
buttonClicked: triggerClick,
|
|
151
|
+
})
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
private sendDataLayeronButtonBerlangganan = (): void => {
|
|
155
|
+
window.dataLayer.push({
|
|
156
|
+
event: 'subscribe_button_clicked',
|
|
157
|
+
paywall_location: this.paywall_location,
|
|
158
|
+
paywall_subscription_package: this.paywall_subscription_package,
|
|
159
|
+
paywall_subscription_id: this.paywall_subscription_id,
|
|
160
|
+
paywall_subscription_price: this.paywall_subscription_price,
|
|
161
|
+
paywall_position: this.paywall_position,
|
|
162
|
+
page_type: this.tracker_page_type,
|
|
163
|
+
content_id: this.tracker_content_id,
|
|
164
|
+
content_title: this.tracker_content_title,
|
|
165
|
+
content_categories: this.tracker_content_categories,
|
|
166
|
+
content_type: this.tracker_content_type,
|
|
167
|
+
user_type: this.tracker_user_type,
|
|
168
|
+
subscription_status: this.tracker_subscription_status,
|
|
169
|
+
page_domain: this.tracker_page_domain || 'Kompas.id',
|
|
170
|
+
metered_wall_type: this.tracker_metered_wall_type || 'HP',
|
|
171
|
+
metered_wall_balance: this.tracker_metered_wall_balance,
|
|
172
|
+
})
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
private redirectToLogin(triggerClick: string): void {
|
|
176
|
+
this.sendDataLayeronButtonLogin(triggerClick)
|
|
177
|
+
window.open(this.loginUrl, '_blank')
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
private redirectToBerlangganan(): void {
|
|
181
|
+
this.sendDataLayeronButtonBerlangganan()
|
|
182
|
+
window.open(this.subscriptionUrl, '_blank')
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
render() {
|
|
186
|
+
return html`
|
|
187
|
+
<div
|
|
188
|
+
class="radius absolute z-20 bg-black bg-opacity-50 p-4 top-0 bottom-0 left-0 flex flex-col w-full h-full justify-center items-center"
|
|
189
|
+
>
|
|
190
|
+
${this.isLogin ? this.isLoginComponent() : this.defaultComponent()}
|
|
191
|
+
</div>
|
|
192
|
+
`
|
|
193
|
+
}
|
|
194
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# kompas-paywall-video
|
|
2
|
+
|
|
3
|
+
### Standar
|
|
4
|
+
Anda perlu meletakkan _tag_ komponen `<kompas-paywall-video />` pada child component (komponen ini memiliki style `position: absolute` sehingga parent componentnya harus menggunakan style `position:relative`).
|
|
5
|
+
|
|
6
|
+
### Elemen
|
|
7
|
+
```javascript
|
|
8
|
+
<div style="position:relative">
|
|
9
|
+
<your-content-component/>
|
|
10
|
+
<kompas-paywall-video />
|
|
11
|
+
</div>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Contoh Penerapan:
|
|
15
|
+
|
|
16
|
+
<img width="500" src="https://user-images.githubusercontent.com/43400392/198214862-16f0f0b1-d179-48b8-9e30-a7667ede1a95.jpg">
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
<!-- Auto Generated Below -->
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## Properties
|
|
23
|
+
|
|
24
|
+
| Property | Attribute | Description | Type | Default |
|
|
25
|
+
| ------------------------------ | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ------- |
|
|
26
|
+
| `isLogin` | `is-login` | prop isLogin untuk menghandle apakah user sudah login atau belum 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 the subscription package viewed by user prop page_type = Type of the page prop content_id = ID of article (slug) prop content_type = Whether it's free article or paid article prop content_title = The title of article prop tracker_content_categories = The category of the content prop user_type = Type of user based on their subscription prop subscription_status = Status of their subscription prop page_domain = Page Domain prop metered_wall_type = The type of Metered Wall prop metered_wall_balance = The balance of their metered wall | `boolean` | `false` |
|
|
27
|
+
| `paywall_location` | `paywall_location` | | `string` | `''` |
|
|
28
|
+
| `paywall_position` | `paywall_position` | | `number` | `0` |
|
|
29
|
+
| `paywall_subscription_id` | `paywall_subscription_id` | | `string` | `''` |
|
|
30
|
+
| `paywall_subscription_package` | `paywall_subscription_package` | | `string` | `''` |
|
|
31
|
+
| `paywall_subscription_price` | `paywall_subscription_price` | | `number` | `0` |
|
|
32
|
+
| `tracker_content_categories` | `tracker_content_categories` | | `string` | `''` |
|
|
33
|
+
| `tracker_content_id` | `tracker_content_id` | | `string` | `''` |
|
|
34
|
+
| `tracker_content_title` | `tracker_content_title` | | `string` | `''` |
|
|
35
|
+
| `tracker_content_type` | `tracker_content_type` | | `string` | `''` |
|
|
36
|
+
| `tracker_metered_wall_balance` | `tracker_metered_wall_balance` | | `number` | `0` |
|
|
37
|
+
| `tracker_metered_wall_type` | `tracker_metered_wall_type` | | `string` | `''` |
|
|
38
|
+
| `tracker_page_domain` | `tracker_page_domain` | | `string` | `''` |
|
|
39
|
+
| `tracker_page_type` | `tracker_page_type` | | `string` | `''` |
|
|
40
|
+
| `tracker_subscription_status` | `tracker_subscription_status` | | `string` | `''` |
|
|
41
|
+
| `tracker_user_type` | `tracker_user_type` | | `string` | `''` |
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
----------------------------------------------
|
|
45
|
+
|
|
46
|
+
*Terbikin oleh tim front-end kompas.id*
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { KompasPaywall } from './components/kompas-paywall/KompasPaywall.js'
|
|
2
|
+
export { KompasFooter } from './components/kompas-footer/KompasFooter.js'
|
|
3
|
+
export { KompasPaywallVideo } from './components/kompas-paywall-video/KompasPaywallVideo.js'
|
|
4
|
+
export { KompasMeteredPaywall } from './components/kompas-metered-paywall/KompasMeteredPaywall.js'
|
|
5
|
+
|
|
6
|
+
declare global {
|
|
7
|
+
interface Window {
|
|
8
|
+
gtag: (...args: any[]) => void
|
|
9
|
+
dataLayer: Record<string, any>
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
library,
|
|
3
|
+
config,
|
|
4
|
+
icon,
|
|
5
|
+
IconName,
|
|
6
|
+
IconPrefix,
|
|
7
|
+
} from '@fortawesome/fontawesome-svg-core'
|
|
8
|
+
import { fas } from '@fortawesome/free-solid-svg-icons'
|
|
9
|
+
import { far } from '@fortawesome/free-regular-svg-icons'
|
|
10
|
+
import { fab } from '@fortawesome/free-brands-svg-icons'
|
|
11
|
+
|
|
12
|
+
config.autoAddCss = false
|
|
13
|
+
library.add(fas, far, fab)
|
|
14
|
+
|
|
15
|
+
export function getFontAwesomeIcon(
|
|
16
|
+
prefix: string,
|
|
17
|
+
iconName: string,
|
|
18
|
+
width: number = 16,
|
|
19
|
+
height: number = 16
|
|
20
|
+
): string {
|
|
21
|
+
const iconObject = icon({
|
|
22
|
+
prefix: prefix as IconPrefix,
|
|
23
|
+
iconName: iconName as IconName,
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
if (iconObject) {
|
|
27
|
+
const htmlString = iconObject.html.join('')
|
|
28
|
+
const parser = new DOMParser()
|
|
29
|
+
const doc = parser.parseFromString(htmlString, 'image/svg+xml')
|
|
30
|
+
const svgElement = doc.querySelector('svg')
|
|
31
|
+
|
|
32
|
+
if (svgElement) {
|
|
33
|
+
svgElement.setAttribute('width', width.toString())
|
|
34
|
+
svgElement.setAttribute('height', height.toString())
|
|
35
|
+
return svgElement.outerHTML
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return ''
|
|
40
|
+
}
|