@kompasid/lit-web-components 0.7.0 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/demo/index.html +3 -0
- package/dist/src/components/kompasid-grace-period/KompasGracePeriod.d.ts +29 -0
- package/dist/src/components/kompasid-grace-period/KompasGracePeriod.js +146 -0
- package/dist/src/components/kompasid-grace-period/KompasGracePeriod.js.map +1 -0
- package/dist/src/components/kompasid-metered-wall-register/KompasMeteredWallRegister.d.ts +4 -0
- package/dist/src/components/kompasid-metered-wall-register/KompasMeteredWallRegister.js +54 -16
- package/dist/src/components/kompasid-metered-wall-register/KompasMeteredWallRegister.js.map +1 -1
- package/dist/src/components/kompasid-metered-wall-register/types.d.ts +2 -0
- package/dist/src/components/kompasid-metered-wall-register/types.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/tailwind/tailwind.js +46 -8
- package/dist/tailwind/tailwind.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/kompasid-grace-period/KompasGracePeriod.ts +133 -0
- package/src/components/kompasid-grace-period/readme.md +17 -0
- package/src/components/kompasid-metered-wall-register/KompasMeteredWallRegister.ts +63 -18
- package/src/components/kompasid-metered-wall-register/types.ts +2 -0
- package/src/index.ts +1 -0
- package/tailwind/tailwind.css +46 -8
- package/tailwind/tailwind.ts +46 -8
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# kompasid-grace-period
|
|
2
|
+
|
|
3
|
+
Ini adalah redesign komponen _grace period_ yang digunakan pada [kompas.id](https://kompas.id).
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
| Property | Attribute | Description | Type | Default |
|
|
8
|
+
| ------------------------------ | ------------------------------ | ----------- | ------------------------------------------- | ----------- |
|
|
9
|
+
| `totalGracePeriod` | `total-grace-period` | how many days are left in grace period | `number` | `0` |
|
|
10
|
+
| `isColumn` | `is-column` | changes how the component looks on different screen sizes | `boolean` | `false` |
|
|
11
|
+
| `isShowButton` | `is-show-button` | shows or hides a subscription button | `boolean` | `false` |
|
|
12
|
+
| `subscriptionId` | `subscription-id` | used for renewal subs | `string` | `false` |
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
----------------------------------------------
|
|
16
|
+
|
|
17
|
+
*Terbikin oleh tim front-end kompas.id*
|
|
@@ -66,6 +66,8 @@ export class KompasMeteredWallRegister extends LitElement {
|
|
|
66
66
|
description: '',
|
|
67
67
|
lastArticle: { title: '', description: '' },
|
|
68
68
|
},
|
|
69
|
+
ctaUrl: '',
|
|
70
|
+
ctaText: '',
|
|
69
71
|
}
|
|
70
72
|
/**
|
|
71
73
|
* Props
|
|
@@ -90,7 +92,6 @@ export class KompasMeteredWallRegister extends LitElement {
|
|
|
90
92
|
* prop tracker_page_domain untuk Page Domain
|
|
91
93
|
* prop next_param untuk page Domain
|
|
92
94
|
*/
|
|
93
|
-
|
|
94
95
|
@property({ type: Number }) countdownArticle = 0
|
|
95
96
|
@property({ type: Boolean }) defaultExpandBanner = false
|
|
96
97
|
@property({ type: Boolean }) isDesktop = false
|
|
@@ -119,19 +120,32 @@ export class KompasMeteredWallRegister extends LitElement {
|
|
|
119
120
|
prop: string,
|
|
120
121
|
mode: keyof meteredRegisterContent = 'default'
|
|
121
122
|
): string {
|
|
122
|
-
|
|
123
|
+
interface LastArticle {
|
|
124
|
+
[key: string]: string
|
|
125
|
+
}
|
|
126
|
+
interface DynamicMode {
|
|
127
|
+
lastArticle?: LastArticle
|
|
128
|
+
[key: string]: string | LastArticle | undefined
|
|
129
|
+
}
|
|
130
|
+
const dynamicMode = this.textTemplate[mode] as DynamicMode | string
|
|
123
131
|
|
|
124
|
-
|
|
125
|
-
const dynamicMode = this.textTemplate[mode]
|
|
132
|
+
let template: string = ''
|
|
126
133
|
|
|
127
|
-
if ('
|
|
128
|
-
|
|
129
|
-
|
|
134
|
+
if (typeof dynamicMode === 'object' && dynamicMode !== null) {
|
|
135
|
+
// Check if dynamicMode has a lastArticle object and if the prop exists within it
|
|
136
|
+
if (dynamicMode.lastArticle && prop in dynamicMode.lastArticle) {
|
|
137
|
+
const value = dynamicMode.lastArticle[prop]
|
|
138
|
+
if (typeof value === 'string') {
|
|
139
|
+
template = value
|
|
140
|
+
}
|
|
141
|
+
} else if (prop in dynamicMode) {
|
|
142
|
+
const value = dynamicMode[prop]
|
|
143
|
+
if (typeof value === 'string') {
|
|
144
|
+
template = value
|
|
145
|
+
}
|
|
130
146
|
}
|
|
131
|
-
template = lastArticleMode.lastArticle[prop] || ''
|
|
132
|
-
} else {
|
|
133
|
-
template = dynamicMode[prop] || ''
|
|
134
147
|
}
|
|
148
|
+
|
|
135
149
|
return template
|
|
136
150
|
}
|
|
137
151
|
|
|
@@ -216,11 +230,12 @@ export class KompasMeteredWallRegister extends LitElement {
|
|
|
216
230
|
${this.registerButtonTemplate()}
|
|
217
231
|
</div>
|
|
218
232
|
</div>
|
|
219
|
-
<div
|
|
233
|
+
<div
|
|
234
|
+
class="flex justify-center md:max-w-[200px] md:max-h-[220px] md:my-auto"
|
|
235
|
+
>
|
|
220
236
|
<img
|
|
221
237
|
alt="metered-wall-register"
|
|
222
238
|
src="https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/paywall_ilustrasi3-03_1.png"
|
|
223
|
-
class="h-40 w-40 md:w-full md:h-full"
|
|
224
239
|
/>
|
|
225
240
|
</div>
|
|
226
241
|
<button
|
|
@@ -246,15 +261,45 @@ export class KompasMeteredWallRegister extends LitElement {
|
|
|
246
261
|
*/
|
|
247
262
|
private registerButtonTemplate() {
|
|
248
263
|
return html`
|
|
249
|
-
<
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
264
|
+
<div>
|
|
265
|
+
${!this.textTemplate.ctaUrl
|
|
266
|
+
? html`<button
|
|
267
|
+
@click=${this.redirectToRegister}
|
|
268
|
+
class="bg-green-500 p-1.5 w-full rounded-md font-bold text-grey-100 text-sm md:text-base"
|
|
269
|
+
>
|
|
270
|
+
Daftar Akun
|
|
271
|
+
</button>`
|
|
272
|
+
: html`<button
|
|
273
|
+
@click=${this.redirectToCTAUrl}
|
|
274
|
+
class="bg-green-500 p-1.5 w-full rounded-md font-bold text-grey-100 px-5 text-sm md:text-base md:w-[165px]"
|
|
275
|
+
>
|
|
276
|
+
${this.textTemplate.ctaText}
|
|
277
|
+
</button>`}
|
|
278
|
+
</div>
|
|
255
279
|
`
|
|
256
280
|
}
|
|
257
281
|
|
|
282
|
+
/**
|
|
283
|
+
* mengarahkan ke page checkout promo
|
|
284
|
+
*/
|
|
285
|
+
private redirectToCTAUrl = (): void => {
|
|
286
|
+
const params = new URLSearchParams(window.location.href)
|
|
287
|
+
const newUrl = new URL(this.textTemplate.ctaUrl)
|
|
288
|
+
const referrer = new URLSearchParams(this.textTemplate.ctaUrl).get(
|
|
289
|
+
'referrer'
|
|
290
|
+
)
|
|
291
|
+
this.pushToDataLayer('mrw_clicked')
|
|
292
|
+
if (!referrer) {
|
|
293
|
+
newUrl.searchParams.append('referrer', params.toString())
|
|
294
|
+
window.location.href = newUrl.toString()
|
|
295
|
+
} else {
|
|
296
|
+
const currentReferrerValue = newUrl.searchParams.get('referrer')
|
|
297
|
+
const updatedReferrerValue = `${params.toString()},${currentReferrerValue}`
|
|
298
|
+
newUrl.searchParams.set('referrer', updatedReferrerValue)
|
|
299
|
+
window.location.href = newUrl.toString()
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
258
303
|
/**
|
|
259
304
|
* mengarahkan ke page register
|
|
260
305
|
*/
|
package/src/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { KompasMeteredPaywall } from './components/kompasid-metered-paywall/Komp
|
|
|
7
7
|
export { KompasFreewall } from './components/kompasid-freewall/KompasFreewall.js'
|
|
8
8
|
export { KompasMeteredWallRegister } from './components/kompasid-metered-wall-register/KompasMeteredWallRegister.js'
|
|
9
9
|
export { KompasHeaderAccount } from './components/kompasid-header-account/KompasHeaderAccount.js'
|
|
10
|
+
export { KompasGracePeriod } from './components/kompasid-grace-period/KompasGracePeriod.js'
|
|
10
11
|
|
|
11
12
|
declare global {
|
|
12
13
|
interface Window {
|
package/tailwind/tailwind.css
CHANGED
|
@@ -825,10 +825,6 @@ video {
|
|
|
825
825
|
height: 1rem;
|
|
826
826
|
}
|
|
827
827
|
|
|
828
|
-
.h-40 {
|
|
829
|
-
height: 10rem;
|
|
830
|
-
}
|
|
831
|
-
|
|
832
828
|
.h-5 {
|
|
833
829
|
height: 1.25rem;
|
|
834
830
|
}
|
|
@@ -1462,6 +1458,11 @@ video {
|
|
|
1462
1458
|
padding-right: 1rem;
|
|
1463
1459
|
}
|
|
1464
1460
|
|
|
1461
|
+
.px-5 {
|
|
1462
|
+
padding-left: 1.25rem;
|
|
1463
|
+
padding-right: 1.25rem;
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1465
1466
|
.px-8 {
|
|
1466
1467
|
padding-left: 2rem;
|
|
1467
1468
|
padding-right: 2rem;
|
|
@@ -1893,6 +1894,11 @@ video {
|
|
|
1893
1894
|
margin-bottom: 2rem;
|
|
1894
1895
|
}
|
|
1895
1896
|
|
|
1897
|
+
.md\:my-auto {
|
|
1898
|
+
margin-top: auto;
|
|
1899
|
+
margin-bottom: auto;
|
|
1900
|
+
}
|
|
1901
|
+
|
|
1896
1902
|
.md\:mb-0 {
|
|
1897
1903
|
margin-bottom: 0px;
|
|
1898
1904
|
}
|
|
@@ -1953,15 +1959,15 @@ video {
|
|
|
1953
1959
|
height: 68px;
|
|
1954
1960
|
}
|
|
1955
1961
|
|
|
1956
|
-
.md\:h-full {
|
|
1957
|
-
height: 100%;
|
|
1958
|
-
}
|
|
1959
|
-
|
|
1960
1962
|
.md\:h-max {
|
|
1961
1963
|
height: -moz-max-content;
|
|
1962
1964
|
height: max-content;
|
|
1963
1965
|
}
|
|
1964
1966
|
|
|
1967
|
+
.md\:max-h-\[220px\] {
|
|
1968
|
+
max-height: 220px;
|
|
1969
|
+
}
|
|
1970
|
+
|
|
1965
1971
|
.md\:min-h-\[244px\] {
|
|
1966
1972
|
min-height: 244px;
|
|
1967
1973
|
}
|
|
@@ -1986,6 +1992,10 @@ video {
|
|
|
1986
1992
|
width: 13rem;
|
|
1987
1993
|
}
|
|
1988
1994
|
|
|
1995
|
+
.md\:w-\[165px\] {
|
|
1996
|
+
width: 165px;
|
|
1997
|
+
}
|
|
1998
|
+
|
|
1989
1999
|
.md\:w-\[350px\] {
|
|
1990
2000
|
width: 350px;
|
|
1991
2001
|
}
|
|
@@ -2010,10 +2020,18 @@ video {
|
|
|
2010
2020
|
width: 100%;
|
|
2011
2021
|
}
|
|
2012
2022
|
|
|
2023
|
+
.md\:w-auto {
|
|
2024
|
+
width: auto;
|
|
2025
|
+
}
|
|
2026
|
+
|
|
2013
2027
|
.md\:max-w-\[137px\] {
|
|
2014
2028
|
max-width: 137px;
|
|
2015
2029
|
}
|
|
2016
2030
|
|
|
2031
|
+
.md\:max-w-\[200px\] {
|
|
2032
|
+
max-width: 200px;
|
|
2033
|
+
}
|
|
2034
|
+
|
|
2017
2035
|
.md\:max-w-full {
|
|
2018
2036
|
max-width: 100%;
|
|
2019
2037
|
}
|
|
@@ -2070,6 +2088,12 @@ video {
|
|
|
2070
2088
|
margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse)));
|
|
2071
2089
|
}
|
|
2072
2090
|
|
|
2091
|
+
.md\:space-x-4 > :not([hidden]) ~ :not([hidden]) {
|
|
2092
|
+
--tw-space-x-reverse: 0;
|
|
2093
|
+
margin-right: calc(1rem * var(--tw-space-x-reverse));
|
|
2094
|
+
margin-left: calc(1rem * calc(1 - var(--tw-space-x-reverse)));
|
|
2095
|
+
}
|
|
2096
|
+
|
|
2073
2097
|
.md\:space-x-5 > :not([hidden]) ~ :not([hidden]) {
|
|
2074
2098
|
--tw-space-x-reverse: 0;
|
|
2075
2099
|
margin-right: calc(1.25rem * var(--tw-space-x-reverse));
|
|
@@ -2170,6 +2194,10 @@ video {
|
|
|
2170
2194
|
padding-bottom: 1.75rem;
|
|
2171
2195
|
}
|
|
2172
2196
|
|
|
2197
|
+
.md\:pt-0 {
|
|
2198
|
+
padding-top: 0px;
|
|
2199
|
+
}
|
|
2200
|
+
|
|
2173
2201
|
.md\:pt-3 {
|
|
2174
2202
|
padding-top: 0.75rem;
|
|
2175
2203
|
}
|
|
@@ -2333,6 +2361,11 @@ video {
|
|
|
2333
2361
|
padding-right: 0px;
|
|
2334
2362
|
}
|
|
2335
2363
|
|
|
2364
|
+
.lg\:px-20 {
|
|
2365
|
+
padding-left: 5rem;
|
|
2366
|
+
padding-right: 5rem;
|
|
2367
|
+
}
|
|
2368
|
+
|
|
2336
2369
|
.lg\:px-24 {
|
|
2337
2370
|
padding-left: 6rem;
|
|
2338
2371
|
padding-right: 6rem;
|
|
@@ -2343,6 +2376,11 @@ video {
|
|
|
2343
2376
|
padding-bottom: 2.5rem;
|
|
2344
2377
|
}
|
|
2345
2378
|
|
|
2379
|
+
.lg\:px-8 {
|
|
2380
|
+
padding-left: 2rem;
|
|
2381
|
+
padding-right: 2rem;
|
|
2382
|
+
}
|
|
2383
|
+
|
|
2346
2384
|
.lg\:pb-0 {
|
|
2347
2385
|
padding-bottom: 0px;
|
|
2348
2386
|
}
|
package/tailwind/tailwind.ts
CHANGED
|
@@ -835,10 +835,6 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
|
|
|
835
835
|
height: 1rem;
|
|
836
836
|
}
|
|
837
837
|
|
|
838
|
-
.h-40 {
|
|
839
|
-
height: 10rem;
|
|
840
|
-
}
|
|
841
|
-
|
|
842
838
|
.h-5 {
|
|
843
839
|
height: 1.25rem;
|
|
844
840
|
}
|
|
@@ -1476,6 +1472,11 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
|
|
|
1476
1472
|
padding-right: 1rem;
|
|
1477
1473
|
}
|
|
1478
1474
|
|
|
1475
|
+
.px-5 {
|
|
1476
|
+
padding-left: 1.25rem;
|
|
1477
|
+
padding-right: 1.25rem;
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1479
1480
|
.px-8 {
|
|
1480
1481
|
padding-left: 2rem;
|
|
1481
1482
|
padding-right: 2rem;
|
|
@@ -1920,6 +1921,11 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
|
|
|
1920
1921
|
margin-bottom: 2rem;
|
|
1921
1922
|
}
|
|
1922
1923
|
|
|
1924
|
+
.md\\:my-auto {
|
|
1925
|
+
margin-top: auto;
|
|
1926
|
+
margin-bottom: auto;
|
|
1927
|
+
}
|
|
1928
|
+
|
|
1923
1929
|
.md\\:mb-0 {
|
|
1924
1930
|
margin-bottom: 0px;
|
|
1925
1931
|
}
|
|
@@ -1980,15 +1986,15 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
|
|
|
1980
1986
|
height: 68px;
|
|
1981
1987
|
}
|
|
1982
1988
|
|
|
1983
|
-
.md\\:h-full {
|
|
1984
|
-
height: 100%;
|
|
1985
|
-
}
|
|
1986
|
-
|
|
1987
1989
|
.md\\:h-max {
|
|
1988
1990
|
height: -moz-max-content;
|
|
1989
1991
|
height: max-content;
|
|
1990
1992
|
}
|
|
1991
1993
|
|
|
1994
|
+
.md\\:max-h-\\[220px\\] {
|
|
1995
|
+
max-height: 220px;
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1992
1998
|
.md\\:min-h-\\[244px\\] {
|
|
1993
1999
|
min-height: 244px;
|
|
1994
2000
|
}
|
|
@@ -2013,6 +2019,10 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
|
|
|
2013
2019
|
width: 13rem;
|
|
2014
2020
|
}
|
|
2015
2021
|
|
|
2022
|
+
.md\\:w-\\[165px\\] {
|
|
2023
|
+
width: 165px;
|
|
2024
|
+
}
|
|
2025
|
+
|
|
2016
2026
|
.md\\:w-\\[350px\\] {
|
|
2017
2027
|
width: 350px;
|
|
2018
2028
|
}
|
|
@@ -2037,10 +2047,18 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
|
|
|
2037
2047
|
width: 100%;
|
|
2038
2048
|
}
|
|
2039
2049
|
|
|
2050
|
+
.md\\:w-auto {
|
|
2051
|
+
width: auto;
|
|
2052
|
+
}
|
|
2053
|
+
|
|
2040
2054
|
.md\\:max-w-\\[137px\\] {
|
|
2041
2055
|
max-width: 137px;
|
|
2042
2056
|
}
|
|
2043
2057
|
|
|
2058
|
+
.md\\:max-w-\\[200px\\] {
|
|
2059
|
+
max-width: 200px;
|
|
2060
|
+
}
|
|
2061
|
+
|
|
2044
2062
|
.md\\:max-w-full {
|
|
2045
2063
|
max-width: 100%;
|
|
2046
2064
|
}
|
|
@@ -2097,6 +2115,12 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
|
|
|
2097
2115
|
margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse)));
|
|
2098
2116
|
}
|
|
2099
2117
|
|
|
2118
|
+
.md\\:space-x-4 > :not([hidden]) ~ :not([hidden]) {
|
|
2119
|
+
--tw-space-x-reverse: 0;
|
|
2120
|
+
margin-right: calc(1rem * var(--tw-space-x-reverse));
|
|
2121
|
+
margin-left: calc(1rem * calc(1 - var(--tw-space-x-reverse)));
|
|
2122
|
+
}
|
|
2123
|
+
|
|
2100
2124
|
.md\\:space-x-5 > :not([hidden]) ~ :not([hidden]) {
|
|
2101
2125
|
--tw-space-x-reverse: 0;
|
|
2102
2126
|
margin-right: calc(1.25rem * var(--tw-space-x-reverse));
|
|
@@ -2197,6 +2221,10 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
|
|
|
2197
2221
|
padding-bottom: 1.75rem;
|
|
2198
2222
|
}
|
|
2199
2223
|
|
|
2224
|
+
.md\\:pt-0 {
|
|
2225
|
+
padding-top: 0px;
|
|
2226
|
+
}
|
|
2227
|
+
|
|
2200
2228
|
.md\\:pt-3 {
|
|
2201
2229
|
padding-top: 0.75rem;
|
|
2202
2230
|
}
|
|
@@ -2360,6 +2388,11 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
|
|
|
2360
2388
|
padding-right: 0px;
|
|
2361
2389
|
}
|
|
2362
2390
|
|
|
2391
|
+
.lg\\:px-20 {
|
|
2392
|
+
padding-left: 5rem;
|
|
2393
|
+
padding-right: 5rem;
|
|
2394
|
+
}
|
|
2395
|
+
|
|
2363
2396
|
.lg\\:px-24 {
|
|
2364
2397
|
padding-left: 6rem;
|
|
2365
2398
|
padding-right: 6rem;
|
|
@@ -2370,6 +2403,11 @@ Constrain images and videos to the parent width and preserve their intrinsic asp
|
|
|
2370
2403
|
padding-bottom: 2.5rem;
|
|
2371
2404
|
}
|
|
2372
2405
|
|
|
2406
|
+
.lg\\:px-8 {
|
|
2407
|
+
padding-left: 2rem;
|
|
2408
|
+
padding-right: 2rem;
|
|
2409
|
+
}
|
|
2410
|
+
|
|
2373
2411
|
.lg\\:pb-0 {
|
|
2374
2412
|
padding-bottom: 0px;
|
|
2375
2413
|
}
|