@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.
Files changed (76) hide show
  1. package/.editorconfig +29 -0
  2. package/.github/workflows/npm-publish.yml +35 -0
  3. package/LICENSE +21 -0
  4. package/README.md +62 -0
  5. package/assets/font-awesome.ts +21 -0
  6. package/components.d.ts +4 -0
  7. package/demo/index.html +137 -0
  8. package/dist/assets/font-awesome.d.ts +2 -0
  9. package/dist/assets/font-awesome.js +20 -0
  10. package/dist/assets/font-awesome.js.map +1 -0
  11. package/dist/src/components/kompas-footer/KompasFooter.d.ts +13 -0
  12. package/dist/src/components/kompas-footer/KompasFooter.js +304 -0
  13. package/dist/src/components/kompas-footer/KompasFooter.js.map +1 -0
  14. package/dist/src/components/kompas-footer/types.d.ts +47 -0
  15. package/dist/src/components/kompas-footer/types.js +2 -0
  16. package/dist/src/components/kompas-footer/types.js.map +1 -0
  17. package/dist/src/components/kompas-metered-paywall/KompasMeteredPaywall.d.ts +50 -0
  18. package/dist/src/components/kompas-metered-paywall/KompasMeteredPaywall.js +225 -0
  19. package/dist/src/components/kompas-metered-paywall/KompasMeteredPaywall.js.map +1 -0
  20. package/dist/src/components/kompas-paywall/KompasPaywall.d.ts +73 -0
  21. package/dist/src/components/kompas-paywall/KompasPaywall.js +470 -0
  22. package/dist/src/components/kompas-paywall/KompasPaywall.js.map +1 -0
  23. package/dist/src/components/kompas-paywall/types.d.ts +53 -0
  24. package/dist/src/components/kompas-paywall/types.js +2 -0
  25. package/dist/src/components/kompas-paywall/types.js.map +1 -0
  26. package/dist/src/components/kompas-paywall-banner-registration/KompasPaywallBannerRegistration.d.ts +11 -0
  27. package/dist/src/components/kompas-paywall-banner-registration/KompasPaywallBannerRegistration.js +100 -0
  28. package/dist/src/components/kompas-paywall-banner-registration/KompasPaywallBannerRegistration.js.map +1 -0
  29. package/dist/src/components/kompas-paywall-body/KompasPaywallBody.d.ts +107 -0
  30. package/dist/src/components/kompas-paywall-body/KompasPaywallBody.js +843 -0
  31. package/dist/src/components/kompas-paywall-body/KompasPaywallBody.js.map +1 -0
  32. package/dist/src/components/kompas-paywall-information-header/KompasPaywallInformationHeader.d.ts +8 -0
  33. package/dist/src/components/kompas-paywall-information-header/KompasPaywallInformationHeader.js +39 -0
  34. package/dist/src/components/kompas-paywall-information-header/KompasPaywallInformationHeader.js.map +1 -0
  35. package/dist/src/components/kompas-paywall-video/KompasPaywallVideo.d.ts +53 -0
  36. package/dist/src/components/kompas-paywall-video/KompasPaywallVideo.js +245 -0
  37. package/dist/src/components/kompas-paywall-video/KompasPaywallVideo.js.map +1 -0
  38. package/dist/src/index.d.ts +10 -0
  39. package/dist/src/index.js +5 -0
  40. package/dist/src/index.js.map +1 -0
  41. package/dist/src/utils/deviceType.d.ts +2 -0
  42. package/dist/src/utils/deviceType.js +11 -0
  43. package/dist/src/utils/deviceType.js.map +1 -0
  44. package/dist/src/utils/fontawesome-setup.d.ts +1 -0
  45. package/dist/src/utils/fontawesome-setup.js +25 -0
  46. package/dist/src/utils/fontawesome-setup.js.map +1 -0
  47. package/dist/tailwind/tailwind.d.ts +1 -0
  48. package/dist/tailwind/tailwind.js +1654 -0
  49. package/dist/tailwind/tailwind.js.map +1 -0
  50. package/dist/tsconfig.tsbuildinfo +1 -0
  51. package/package.json +94 -0
  52. package/src/components/kompas-footer/KompasFooter.ts +331 -0
  53. package/src/components/kompas-footer/types.ts +54 -0
  54. package/src/components/kompas-metered-paywall/KompasMeteredPaywall.ts +174 -0
  55. package/src/components/kompas-metered-paywall/readme.md +32 -0
  56. package/src/components/kompas-paywall/KompasPaywall.ts +398 -0
  57. package/src/components/kompas-paywall/readme.md +166 -0
  58. package/src/components/kompas-paywall/types.ts +53 -0
  59. package/src/components/kompas-paywall-banner-registration/KompasPaywallBannerRegistration.ts +92 -0
  60. package/src/components/kompas-paywall-banner-registration/readme.md +31 -0
  61. package/src/components/kompas-paywall-body/KompasPaywallBody.ts +844 -0
  62. package/src/components/kompas-paywall-body/readme.md +54 -0
  63. package/src/components/kompas-paywall-information-header/KompasPaywallInformationHeader.ts +29 -0
  64. package/src/components/kompas-paywall-information-header/readme.md +30 -0
  65. package/src/components/kompas-paywall-video/KompasPaywallVideo.ts +194 -0
  66. package/src/components/kompas-paywall-video/readme.md +46 -0
  67. package/src/index.ts +11 -0
  68. package/src/utils/deviceType.ts +11 -0
  69. package/src/utils/fontawesome-setup.ts +40 -0
  70. package/tailwind/tailwind.css +1635 -0
  71. package/tailwind/tailwind.ts +1654 -0
  72. package/tailwind/tailwindlib.css +3 -0
  73. package/tailwind.config.js +96 -0
  74. package/tsconfig.json +21 -0
  75. package/web-dev-server.config.mjs +27 -0
  76. package/web-test-runner.config.mjs +41 -0
@@ -0,0 +1,398 @@
1
+ import { html, css, LitElement } from 'lit'
2
+ import { property, state, customElement } from 'lit/decorators.js'
3
+ import { TWStyles } from '../../../tailwind/tailwind.js'
4
+ import { PaywallProduct } from './types.js'
5
+ import '../kompas-paywall-body/KompasPaywallBody.js'
6
+ import '../kompas-paywall-banner-registration/KompasPaywallBannerRegistration.js'
7
+ import '../kompas-paywall-information-header/KompasPaywallInformationHeader.js'
8
+
9
+ @customElement('kompas-paywall')
10
+ export class KompasPaywall extends LitElement {
11
+ static styles = [
12
+ css`
13
+ :host {
14
+ font-family: 'PT Sans', sans-serif;
15
+ }
16
+ `,
17
+ TWStyles,
18
+ ]
19
+
20
+ /**
21
+ * Props
22
+ */
23
+ /**
24
+ * property isLogin untuk menghandle apakah user sudah login atau belum
25
+ * property countdownArticle untuk menghandle count artikel
26
+ * property type untuk menghandle tipe epaper
27
+ * property isWithHeader untuk menghandle paywall information header
28
+ * property textHeader digunakan sebagai text pada paywall information header
29
+ * property paywallData untuk menghandle data paywall
30
+ * property userGuid untuk menghandle user Guid
31
+ * property subscriptionStatus untuk menghandle status subscription user
32
+ * property swgEnable untuk menghandle swg apakah di aktifkan atau tidak
33
+ * property paywall_location = The location where user encounter the paywall
34
+ * property paywall_subscription_package = The name of the subscription package viewed by user
35
+ * property paywall_subscription_id = The ID of the subscription package viewed by user
36
+ * property paywall_subscription_price = The price of the subscriprtion package viewed by user
37
+ * property paywall_position = The position of the subscription package viewed by user
38
+ * property page_type = Type of the page
39
+ * property content_id = ID of article (slug)
40
+ * property content_type = Whether it's free article or paid article
41
+ * property content_title = The title of article
42
+ * property tracker_content_categories = The category of the content
43
+ * property user_type = Type of user based on their subscription
44
+ * property subscription_status = Status of their subscription
45
+ * property page_domain = Page Domain
46
+ * property metered_wall_type = The type of Metered Wall
47
+ * property metered_wall_balance = The balance of their metered wall
48
+ * property epaper_edition = The edition of epaper viewed by user
49
+ * property theme = The theme of the paywall component
50
+ */
51
+
52
+ @state() private paywallData: PaywallProduct = {} as PaywallProduct
53
+
54
+ @property({ type: Boolean }) isLogin = false
55
+ @property({ type: Number }) countdownArticle = 0
56
+ @property({ type: String }) type: 'epaper' | 'reguler' = 'reguler'
57
+ @property({ type: Boolean }) isWithHeader = false
58
+ @property({ type: String }) textHeader = ''
59
+ @property({ type: String }) userGuid = ''
60
+ @property({ type: String }) subscriptionStatus = ''
61
+ @property({ type: Boolean }) swgEnable = false
62
+ @property({ type: String }) paywall_location = ''
63
+ @property({ type: String }) paywall_subscription_package = ''
64
+ @property({ type: Number }) paywall_subscription_id = 0
65
+ @property({ type: Number }) paywall_subscription_price = 0
66
+ @property({ type: Number }) paywall_position = 0
67
+ @property({ type: String }) tracker_page_type = ''
68
+ @property({ type: String }) tracker_content_id = ''
69
+ @property({ type: String }) tracker_content_title = ''
70
+ @property({ type: String }) tracker_content_categories = ''
71
+ @property({ type: String }) tracker_content_type = ''
72
+ @property({ type: String }) tracker_user_type = ''
73
+ @property({ type: String }) tracker_subscription_status = ''
74
+ @property({ type: String }) tracker_page_domain = ''
75
+ @property({ type: String }) tracker_metered_wall_type = ''
76
+ @property({ type: Number }) tracker_metered_wall_balance = 0
77
+ @property({ type: String }) tracker_epaper_edition = ''
78
+ @property({ type: String }) theme = ''
79
+
80
+ mockResult: PaywallProduct = {
81
+ informations: {
82
+ title: 'Langganan untuk Lanjut Membaca',
83
+ description: [
84
+ 'Akses tak terbatas Kompas.id (web & app)',
85
+ 'Berita digital tanpa iklan pop-up',
86
+ '30 arsip terbaru ePaper Kompas',
87
+ 'Artikel Opini eksklusif',
88
+ ],
89
+ register: {
90
+ img: 'https://www.kompas.id/img/backgrounds/ilustrasi-banner-registration.png',
91
+ title: 'Ingin Membaca Artikel Ini Secara Utuh?',
92
+ subtitle: 'Daftar akun untuk membaca 5 artikel premium secara gratis ',
93
+ label: 'Daftar Sekarang ',
94
+ },
95
+ meterred: {
96
+ maxQuota: 5,
97
+ label: 'Langganan',
98
+ maxQuotaMessage: 'Akses artikel gratis Anda bulan ini sudah habis.',
99
+ url: 'https://kompas.id/berlangganan',
100
+ },
101
+ },
102
+ packages: {
103
+ title: 'Sekali bayar, tanpa perpanjang otomatis',
104
+ memberships: [
105
+ {
106
+ title: 'Kompas Digital Premium 12 Bulan (Hemat 40%)',
107
+ percentage: 40,
108
+ price: 360000,
109
+ discountPrice: 600000,
110
+ periode: '1 Tahun',
111
+ isHighlight: true,
112
+ url: 'https://checkoutv2.kompas.id/kdp?productId=9802032&referrer=',
113
+ },
114
+ {
115
+ title: 'Kompas Digital Premium 1 Bulan',
116
+ percentage: 0,
117
+ discountPrice: 0,
118
+ price: 50000,
119
+ periode: '1 Bulan',
120
+ isHighlight: false,
121
+ url: 'https://checkoutv2.kompas.id/kdp?productId=9802035&referrer=',
122
+ },
123
+ ],
124
+ },
125
+ payment: {
126
+ desktop: [
127
+ {
128
+ name: 'gopay',
129
+ link: `https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/gopay${this.darkUrl}.svg`,
130
+ },
131
+ {
132
+ name: 'ovo',
133
+ link: `https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/ovo${this.darkUrl}.svg`,
134
+ },
135
+ {
136
+ name: 'mastercard',
137
+ link: `https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/mastercard${this.darkUrl}.svg`,
138
+ },
139
+ {
140
+ name: 'bri',
141
+ link: `https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/bri${this.darkUrl}.svg`,
142
+ },
143
+ {
144
+ name: 'bcaklikpay',
145
+ link: `https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/bca-klik-pay${this.darkUrl}.svg`,
146
+ },
147
+ {
148
+ name: 'indomaret',
149
+ link: `https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/indomaret${this.darkUrl}.svg`,
150
+ },
151
+ {
152
+ name: 'jcb',
153
+ link: `https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/jcb${this.darkUrl}.svg`,
154
+ },
155
+ {
156
+ name: 'dana',
157
+ link: `https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/dana${this.darkUrl}.svg`,
158
+ },
159
+ {
160
+ name: 'visa',
161
+ link: `https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/visa${this.darkUrl}.svg`,
162
+ },
163
+ {
164
+ name: 'mandiri',
165
+ link: `https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/mandiri${this.darkUrl}.svg`,
166
+ },
167
+ {
168
+ name: 'bca',
169
+ link: `https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/bca${this.darkUrl}.svg`,
170
+ },
171
+ {
172
+ name: 'bni',
173
+ link: `https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/bni${this.darkUrl}.svg`,
174
+ },
175
+ {
176
+ name: 'akulaku',
177
+ link: `https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/akulaku${this.darkUrl}.svg`,
178
+ },
179
+ ],
180
+ mobile: [
181
+ {
182
+ name: 'gopay',
183
+ link: `https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/gopay${this.darkUrl}.svg`,
184
+ },
185
+ {
186
+ name: 'ovo',
187
+ link: `https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/ovo${this.darkUrl}.svg`,
188
+ },
189
+ {
190
+ name: 'visa',
191
+ link: `https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/visa${this.darkUrl}.svg`,
192
+ },
193
+ {
194
+ name: 'mastercard',
195
+ link: `https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/mastercard${this.darkUrl}.svg`,
196
+ },
197
+ ],
198
+ ekstension: [
199
+ {
200
+ name: 'dana',
201
+ link: `https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/dana${this.darkUrl}.svg`,
202
+ },
203
+ {
204
+ name: 'mandiri',
205
+ link: `https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/mandiri${this.darkUrl}.svg`,
206
+ },
207
+ {
208
+ name: 'bri',
209
+ link: `https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/bri${this.darkUrl}.svg`,
210
+ },
211
+ {
212
+ name: 'bcaklikpay',
213
+ link: `https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/bca-klik-pay${this.darkUrl}.svg`,
214
+ },
215
+ {
216
+ name: 'akulaku',
217
+ link: `https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/akulaku${this.darkUrl}.svg`,
218
+ },
219
+ {
220
+ name: 'bni',
221
+ link: `https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/bni${this.darkUrl}.svg`,
222
+ },
223
+ {
224
+ name: 'indomaret',
225
+ link: `https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/indomaret${this.darkUrl}.svg`,
226
+ },
227
+ {
228
+ name: 'bca',
229
+ link: `https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/bca${this.darkUrl}.svg`,
230
+ },
231
+ {
232
+ name: 'jcb',
233
+ link: `https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/jcb${this.darkUrl}.svg`,
234
+ },
235
+ ],
236
+ },
237
+ }
238
+
239
+ get darkUrl() {
240
+ return this.theme === 'dark' ? '-dark' : ''
241
+ }
242
+
243
+ override connectedCallback() {
244
+ super.connectedCallback()
245
+ this.paywallData = this.mockResult
246
+ }
247
+
248
+ private transitionBox() {
249
+ return html`
250
+ <div
251
+ class="h-20 ${this.theme === 'dark'
252
+ ? 'transparent-linear-dark'
253
+ : 'transparent-linear'} -mt-24 z-0 w-full"
254
+ ></div>
255
+ `
256
+ }
257
+
258
+ private renderEpaperPaywallSection() {
259
+ return html`<kompas-paywall-body
260
+ paywall_location=${this.paywall_location}
261
+ paywall_subscription_package=${this.paywall_subscription_package}
262
+ paywall_subscription_id=${this.paywall_subscription_id}
263
+ paywall_subscription_price=${this.paywall_subscription_price}
264
+ paywall_position=${this.paywall_position}
265
+ tracker_page_type=${this.tracker_page_type}
266
+ tracker_content_id=${this.tracker_content_id}
267
+ tracker_content_title=${this.tracker_content_title}
268
+ tracker_content_categories=${this.tracker_content_categories}
269
+ tracker_user_type=${this.tracker_user_type}
270
+ tracker_subscription_status=${this.tracker_subscription_status}
271
+ tracker_page_domain=${this.tracker_page_domain}
272
+ tracker_metered_wall_type=${this.tracker_metered_wall_type}
273
+ tracker_epaper_edition=${this.tracker_epaper_edition}
274
+ tracker_metered_wall_balance=${this.tracker_metered_wall_balance}
275
+ ?swgEnable=${this.swgEnable}
276
+ tracker_content_type=${this.tracker_content_type}
277
+ ?isLogin=${this.isLogin}
278
+ type=${this.type}
279
+ countdownArticle=${this.countdownArticle}
280
+ .paywallData=${this.paywallData}
281
+ subscriptionStatus=${this.subscriptionStatus}
282
+ userGuid=${this.userGuid}
283
+ theme=${this.theme}
284
+ ></kompas-paywall-body>`
285
+ }
286
+
287
+ private renderRegularPaywallSection() {
288
+ const defaultHeaderText: string =
289
+ this.paywallData.informations.meterred.maxQuotaMessage
290
+ if (this.isWithHeader) {
291
+ return html`
292
+ <div>
293
+ ${this.transitionBox()}
294
+ <div
295
+ class="flex flex-col ${this.theme === 'dark'
296
+ ? 'bg-dark-5'
297
+ : 'bg-white'} items-center justify-center mx-4 md:mx-0"
298
+ >
299
+ <div class="flex flex-col w-full max-w-screen-md my-5">
300
+ <kompas-paywall-information-header
301
+ text=${this.textHeader || defaultHeaderText}
302
+ theme=${this.theme}
303
+ ></kompas-paywall-information-header>
304
+ <kompas-paywall-body
305
+ paywall_location=${this.paywall_location}
306
+ paywall_subscription_package=${this
307
+ .paywall_subscription_package}
308
+ paywall_subscription_id=${this.paywall_subscription_id}
309
+ paywall_subscription_price=${this.paywall_subscription_price}
310
+ paywall_position=${this.paywall_position}
311
+ tracker_page_type=${this.tracker_page_type}
312
+ tracker_content_id=${this.tracker_content_id}
313
+ tracker_content_title=${this.tracker_content_title}
314
+ tracker_content_categories=${this.tracker_content_categories}
315
+ tracker_user_type=${this.tracker_user_type}
316
+ tracker_subscription_status=${this.tracker_subscription_status}
317
+ tracker_page_domain=${this.tracker_page_domain}
318
+ tracker_metered_wall_type=${this.tracker_metered_wall_type}
319
+ tracker_epaper_edition=${this.tracker_epaper_edition}
320
+ tracker_metered_wall_balance=${this
321
+ .tracker_metered_wall_balance}
322
+ tracker_content_type=${this.tracker_content_type}
323
+ ?swgEnable=${this.swgEnable}
324
+ ?isLogin=${this.isLogin}
325
+ type=${this.type}
326
+ countdownArticle=${this.countdownArticle}
327
+ .paywallData=${this.paywallData}
328
+ subscriptionStatus=${this.subscriptionStatus}
329
+ userGuid=${this.userGuid}
330
+ theme=${this.theme}
331
+ ></kompas-paywall-body>
332
+ </div>
333
+ </div>
334
+ </div>
335
+ `
336
+ }
337
+ return html`
338
+ <div>
339
+ ${this.transitionBox()}
340
+ <div
341
+ class="flex flex-col ${this.theme === 'dark'
342
+ ? 'bg-dark-5'
343
+ : 'bg-white'} items-center justify-center mx-4 md:mx-0"
344
+ >
345
+ <div class="flex flex-col w-full max-w-screen-md my-5">
346
+ <kompas-paywall-banner-registration
347
+ .bannerData=${this.paywallData.informations.register}
348
+ theme=${this.theme}
349
+ ></kompas-paywall-banner-registration>
350
+ <kompas-paywall-body
351
+ tracker_content_type=${this.tracker_content_type}
352
+ paywall_location=${this.paywall_location}
353
+ paywall_subscription_package=${this.paywall_subscription_package}
354
+ paywall_subscription_id=${this.paywall_subscription_id}
355
+ paywall_subscription_price=${this.paywall_subscription_price}
356
+ paywall_position=${this.paywall_position}
357
+ tracker_page_type=${this.tracker_page_type}
358
+ tracker_content_id=${this.tracker_content_id}
359
+ tracker_content_title=${this.tracker_content_title}
360
+ tracker_content_categories=${this.tracker_content_categories}
361
+ tracker_user_type=${this.tracker_user_type}
362
+ tracker_subscription_status=${this.tracker_subscription_status}
363
+ tracker_epaper_edition=${this.tracker_epaper_edition}
364
+ tracker_page_domain=${this.tracker_page_domain}
365
+ tracker_metered_wall_type=${this.tracker_metered_wall_type}
366
+ tracker_metered_wall_balance=${this.tracker_metered_wall_balance}
367
+ ?swgEnable=${this.swgEnable}
368
+ ?isLogin=${this.isLogin}
369
+ type=${this.type}
370
+ countdownArticle=${this.countdownArticle}
371
+ .paywallData=${this.paywallData}
372
+ subscriptionStatus=${this.subscriptionStatus}
373
+ userGuid=${this.userGuid}
374
+ theme=${this.theme}
375
+ ></kompas-paywall-body>
376
+ </div>
377
+ </div>
378
+ </div>
379
+ `
380
+ }
381
+
382
+ private selectorTypePaywall = (type: 'epaper' | 'reguler') => {
383
+ switch (type) {
384
+ case 'epaper':
385
+ return this.renderEpaperPaywallSection()
386
+ case 'reguler':
387
+ return this.renderRegularPaywallSection()
388
+ default:
389
+ return this.renderRegularPaywallSection()
390
+ }
391
+ }
392
+
393
+ render() {
394
+ return html`
395
+ <div class="relative w-full">${this.selectorTypePaywall(this.type)}</div>
396
+ `
397
+ }
398
+ }
@@ -0,0 +1,166 @@
1
+ # kompas-paywall
2
+
3
+ Ini adalah redesign komponen _paywall_ yang digunakan pada [epaper.kompas.id](https://epaper.kompas.id) dan [kompas.id](https://kompas.id). Penggunaan komponen ini dapat dibedakan berdasarkan type productnya ( epaper atau reguler(kompas.id)).
4
+
5
+ ## Pemasangan
6
+
7
+ ### - CDN
8
+
9
+ Selalu menggunakan versi terbaru:
10
+ ```html
11
+ <script src="https://unpkg.com/@kompasid/web-components@latest" type="module" async defer></script>
12
+ ```
13
+ atau menggunakan versi tertentu, saat ini belum disarankan:
14
+ ```html
15
+ <script src="https://unpkg.com/@kompasid/web-components@0.0.1-alpha-5" type="module" async defer></script>
16
+ ```
17
+
18
+ ### - NPM
19
+ ```bash
20
+ npm i -D @kompasid/web-components
21
+ ```
22
+
23
+ ### - Yarn
24
+ ```bash
25
+ yarn add -D @kompasid/web-components
26
+ ```
27
+
28
+ ## Penggunaan
29
+
30
+ ### - Vue.js
31
+ Apabila menggunakan Vue.js sebagai kerangka kerja Javascript, Anda perlu menambahkan konfigurasi berikut di `./src/main.js`:
32
+
33
+ ```javascript
34
+ import Vue from "vue";
35
+ import App from "./App.vue";
36
+
37
+ import {
38
+ applyPolyfills,
39
+ defineCustomElements,
40
+ } from "@kompasid/web-components/loader";
41
+
42
+ Vue.config.productionTip = false;
43
+
44
+ // Perintahkan Vue untuk mengabaikan komponen dengan prefiks 'kompas-'
45
+ Vue.config.ignoredElements = [/kompas-\w*/];
46
+
47
+ // Bebat komponen kustom ke obyek window
48
+ applyPolyfills().then(() => {
49
+ defineCustomElements();
50
+ });
51
+
52
+ new Vue({
53
+ render: (h) => h(App),
54
+ }).$mount("#app");
55
+ ```
56
+
57
+ ### - NuxtJS
58
+ Apabila menggunakan NuxtJS, Anda bisa menggunakan pustaka [Gomah/nuxt-stencil](https://github.com/Gomah/nuxt-stencil). Tugas selanjutnya adalah menambahkan konfigurasi berikut di `nuxt.config.js`:
59
+
60
+ ```javascript
61
+ export default {
62
+ modules: [
63
+ 'nuxt-stencil'
64
+ ],
65
+ stencil: {
66
+ lib: '@kompasid/web-components',
67
+ prefix: 'kompas-',
68
+ renderOptions: {},
69
+ hydratePath: '@kompasid/web-components/hydrate',
70
+ loaderPath: '@kompasid/web-components/loader',
71
+ ignoredElements: null
72
+ },
73
+ }
74
+ ```
75
+
76
+ ### Standar
77
+ Anda perlu meletakkan _tag_ komponen `<kompas-paywall />` pada halaman anda.
78
+
79
+ Contoh:
80
+
81
+ <img width="500" alt="" src="https://i.ibb.co/BwdhYsJ/Screenshot-2022-04-07-151048.png">
82
+
83
+
84
+ ### Elemen
85
+ ```javascript
86
+ <kompas-paywall
87
+ type="reguler"
88
+ is-with-header="true"
89
+ header-text="this is defult text message"
90
+ />
91
+ ```
92
+
93
+ ### Catatan
94
+
95
+ Kompas Paywall ini terdiri dari beberapa sub-komponen sebagai berikut :
96
+
97
+ 1. kompas-paywall-body <br>
98
+ sub-komponen ini merupakan bagian paywall body yang memiliki dua tipe yaitu _epaper_ dan _reguler_
99
+ <br>
100
+ * epaper <br>
101
+ <img width="300" src="https://user-images.githubusercontent.com/43400392/162157850-b82cd11a-a15e-4a44-9f7e-b5b9bab62ee9.png">
102
+ * reguler <br>
103
+ <img width="300" src="https://user-images.githubusercontent.com/43400392/162159351-9dbef0ce-0113-4cbb-a8a6-9709fbaf1974.png">
104
+
105
+ 2. kompas-paywall-banner-registration <br>
106
+ sub-komponen ini merupakan komponen banner registration user <br>
107
+ <img width="300" src="https://user-images.githubusercontent.com/43400392/162159659-3bbc12ca-78bb-4985-baf6-0df35a5e89a2.png">
108
+
109
+ 3. kompas-paywall-information-header <br>
110
+ sub-komponen ini merupakan komponen yang digunakan pada mettered paywall ketika mencapai kuota maksimal <br>
111
+ <img width="300" src="https://user-images.githubusercontent.com/43400392/162159671-39462ffd-8dd8-4cf5-93ed-fb3bd8751d89.png">
112
+
113
+ <!-- Auto Generated Below -->
114
+
115
+
116
+ ## Properties
117
+
118
+ | Property | Attribute | Description | Type | Default |
119
+ | ------------------------------ | ------------------------------ | ----------- | ----------------------- | ----------- |
120
+ | `countdownArticle` | `countdown-article` | | `number` | `0` |
121
+ | `isLogin` | `is-login` | | `boolean` | `false` |
122
+ | `isWithHeader` | `is-with-header` | | `boolean` | `false` |
123
+ | `paywall_location` | `paywall_location` | | `string` | `''` |
124
+ | `paywall_position` | `paywall_position` | | `number` | `0` |
125
+ | `paywall_subscription_id` | `paywall_subscription_id` | | `number` | `0` |
126
+ | `paywall_subscription_package` | `paywall_subscription_package` | | `string` | `''` |
127
+ | `paywall_subscription_price` | `paywall_subscription_price` | | `number` | `0` |
128
+ | `subscriptionStatus` | `subscription-status` | | `string` | `''` |
129
+ | `swgEnable` | `swg-enable` | | `boolean` | `false` |
130
+ | `textHeader` | `text-header` | | `string` | `''` |
131
+ | `theme` | `theme` | | `string` | `''` |
132
+ | `tracker_content_categories` | `tracker_content_categories` | | `string` | `''` |
133
+ | `tracker_content_id` | `tracker_content_id` | | `string` | `''` |
134
+ | `tracker_content_title` | `tracker_content_title` | | `string` | `''` |
135
+ | `tracker_content_type` | `tracker_content_type` | | `string` | `''` |
136
+ | `tracker_epaper_edition` | `tracker_epaper_edition` | | `string` | `''` |
137
+ | `tracker_metered_wall_balance` | `tracker_metered_wall_balance` | | `number` | `0` |
138
+ | `tracker_metered_wall_type` | `tracker_metered_wall_type` | | `string` | `''` |
139
+ | `tracker_page_domain` | `tracker_page_domain` | | `string` | `''` |
140
+ | `tracker_page_type` | `tracker_page_type` | | `string` | `''` |
141
+ | `tracker_subscription_status` | `tracker_subscription_status` | | `string` | `''` |
142
+ | `tracker_user_type` | `tracker_user_type` | | `string` | `''` |
143
+ | `type` | `type` | | `"epaper" \| "reguler"` | `'reguler'` |
144
+ | `userGuid` | `user-guid` | | `string` | `''` |
145
+
146
+
147
+ ## Dependencies
148
+
149
+ ### Depends on
150
+
151
+ - [kompas-paywall-body](../kompas-paywall-body)
152
+ - [kompas-paywall-information-header](../kompas-paywall-information-header)
153
+ - [kompas-paywall-banner-registration](../kompas-paywall-banner-registration)
154
+
155
+ ### Graph
156
+ ```mermaid
157
+ graph TD;
158
+ kompas-paywall --> kompas-paywall-body
159
+ kompas-paywall --> kompas-paywall-information-header
160
+ kompas-paywall --> kompas-paywall-banner-registration
161
+ style kompas-paywall fill:#f9f,stroke:#333,stroke-width:4px
162
+ ```
163
+
164
+ ----------------------------------------------
165
+
166
+ *Terbikin oleh tim front-end kompas.id*
@@ -0,0 +1,53 @@
1
+ export interface Product {
2
+ title: string
3
+ percentage: number
4
+ price: number
5
+ discountPrice: number
6
+ periode: string
7
+ isHighlight: boolean
8
+ url: string
9
+ }
10
+ export interface Metered {
11
+ maxQuota: number
12
+ label: string
13
+ maxQuotaMessage: string
14
+ url: string
15
+ }
16
+ export interface PaymentImage {
17
+ name: string
18
+ link: string
19
+ }
20
+ export interface Registration {
21
+ img: string
22
+ title: string
23
+ subtitle: string
24
+ label: string
25
+ }
26
+ export interface Informations {
27
+ title: string
28
+ description: Array<string>
29
+ register: {
30
+ img: string
31
+ title: string
32
+ subtitle: string
33
+ label: string
34
+ }
35
+ }
36
+ export interface Packages {
37
+ title: string
38
+ memberships: Array<Product>
39
+ }
40
+ export interface PaywallProduct {
41
+ informations: {
42
+ title: string
43
+ description: Array<string>
44
+ register: Registration
45
+ meterred: Metered
46
+ }
47
+ packages: Packages
48
+ payment: {
49
+ desktop: Array<PaymentImage>
50
+ mobile: Array<PaymentImage>
51
+ ekstension: Array<PaymentImage>
52
+ }
53
+ }