@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,92 @@
1
+ import { html, css, LitElement } from 'lit'
2
+ import { property, customElement } from 'lit/decorators.js'
3
+ import { TWStyles } from '../../../tailwind/tailwind.js'
4
+ import { Registration } from '../kompas-paywall/types.js'
5
+ import { deviceType } from '../../utils/deviceType.js'
6
+
7
+ @customElement('kompas-paywall-banner-registration')
8
+ export class KompasPaywallBannerRegistration extends LitElement {
9
+ static styles = [css``, TWStyles]
10
+
11
+ @property({ type: String }) theme = ''
12
+ @property({ type: Object }) bannerData: Registration | undefined = undefined
13
+
14
+ get isDark() {
15
+ return this.theme === 'dark'
16
+ }
17
+
18
+ private redirectToRegister(): void {
19
+ this.sendDataLayer('registrationOfferClick')
20
+ const loginHost: string = 'https://account.kompas.id/login'
21
+ const nextParams: string = encodeURIComponent(window.location.href)
22
+ const directUrlRegister: string = `${loginHost}?next=${nextParams}`
23
+ window.location.href = directUrlRegister
24
+ }
25
+
26
+ private sendDataLayer(value: string): void {
27
+ window.dataLayer.push({
28
+ event: value,
29
+ interface: deviceType(),
30
+ })
31
+ }
32
+
33
+ render() {
34
+ this.sendDataLayer('registrationOfferimppression')
35
+ return html`
36
+ <div class="flex flex-col items-center my-5">
37
+ <div
38
+ class="flex flex-col md:flex-row justify-between items-center w-full"
39
+ >
40
+ <div class="flex flex-col md:flex-row items-center w-full">
41
+ <img
42
+ class="object-cover w-20 h-20"
43
+ src=${this.bannerData?.img ?? ''}
44
+ alt="information-register-img"
45
+ />
46
+ <div
47
+ class="flex flex-col justify-start ${this.isDark &&
48
+ 'text-white'} md:ml-6 my-4"
49
+ >
50
+ <h5
51
+ class="text-center md:text-left text-base md:text-xl font-serif font-bold"
52
+ >
53
+ ${this.bannerData?.title}
54
+ </h5>
55
+ <h6 class="text-center md:text-left">
56
+ ${this.bannerData?.subtitle}
57
+ </h6>
58
+ </div>
59
+ </div>
60
+ <button
61
+ @click=${() => this.redirectToRegister()}
62
+ class="w-40 md:w-52 h-auto ${this.isDark
63
+ ? 'bg-green-300'
64
+ : 'bg-brand-1'} rounded"
65
+ >
66
+ <h6
67
+ class="text-base ${this.isDark
68
+ ? 'text-black'
69
+ : 'text-white'} font-bold py-2 px-4"
70
+ >
71
+ ${this.bannerData?.label}
72
+ </h6>
73
+ </button>
74
+ </div>
75
+ <div class="border-b-2 border-grey-200 w-32 md:w-40 my-6"></div>
76
+ <div>
77
+ <h6 class="${this.isDark && 'text-white'}">
78
+ Sudah punya akun?
79
+ <button
80
+ @click=${() => this.redirectToRegister()}
81
+ class="font-bold ${this.isDark
82
+ ? 'text-blue-300'
83
+ : 'text-blue-600'} underline"
84
+ >
85
+ Silakan Masuk
86
+ </button>
87
+ </h6>
88
+ </div>
89
+ </div>
90
+ `
91
+ }
92
+ }
@@ -0,0 +1,31 @@
1
+ # kompas-paywall-banner-registration
2
+
3
+
4
+
5
+ <!-- Auto Generated Below -->
6
+
7
+
8
+ ## Properties
9
+
10
+ | Property | Attribute | Description | Type | Default |
11
+ | ------------ | --------- | ----------- | -------------- | ----------- |
12
+ | `bannerData` | -- | | `Registration` | `undefined` |
13
+ | `theme` | `theme` | | `string` | `''` |
14
+
15
+
16
+ ## Dependencies
17
+
18
+ ### Used by
19
+
20
+ - [kompas-paywall](../kompas-paywall)
21
+
22
+ ### Graph
23
+ ```mermaid
24
+ graph TD;
25
+ kompas-paywall --> kompas-paywall-banner-registration
26
+ style kompas-paywall-banner-registration fill:#f9f,stroke:#333,stroke-width:4px
27
+ ```
28
+
29
+ ----------------------------------------------
30
+
31
+ *Terbikin oleh tim front-end kompas.id*