@kompasid/lit-web-components 0.7.6 → 0.7.8

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 (51) hide show
  1. package/dist/src/components/kompasid-footer/KompasFooter.js +4 -4
  2. package/dist/src/components/kompasid-footer/KompasFooter.js.map +1 -1
  3. package/dist/src/components/kompasid-freewall/KompasFreewall.d.ts +5 -2
  4. package/dist/src/components/kompasid-freewall/KompasFreewall.js +61 -24
  5. package/dist/src/components/kompasid-freewall/KompasFreewall.js.map +1 -1
  6. package/dist/src/components/kompasid-freewall/types.d.ts +12 -0
  7. package/dist/src/components/kompasid-freewall/types.js.map +1 -1
  8. package/dist/src/components/kompasid-freewall-body/KompasFreewallBody.d.ts +2 -1
  9. package/dist/src/components/kompasid-freewall-body/KompasFreewallBody.js +19 -16
  10. package/dist/src/components/kompasid-freewall-body/KompasFreewallBody.js.map +1 -1
  11. package/dist/src/components/kompasid-freewall-head/KompasFreewallHead.d.ts +2 -1
  12. package/dist/src/components/kompasid-freewall-head/KompasFreewallHead.js +6 -6
  13. package/dist/src/components/kompasid-freewall-head/KompasFreewallHead.js.map +1 -1
  14. package/dist/src/components/kompasid-header-account/KompasHeaderAccount.js +1 -1
  15. package/dist/src/components/kompasid-header-account/KompasHeaderAccount.js.map +1 -1
  16. package/dist/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.js +1 -1
  17. package/dist/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.js.map +1 -1
  18. package/dist/src/components/kompasid-metered-paywall/KompasMeteredPaywall.d.ts +6 -4
  19. package/dist/src/components/kompasid-metered-paywall/KompasMeteredPaywall.js +54 -24
  20. package/dist/src/components/kompasid-metered-paywall/KompasMeteredPaywall.js.map +1 -1
  21. package/dist/src/components/kompasid-metered-paywall/types.d.ts +5 -0
  22. package/dist/src/components/kompasid-metered-paywall/types.js +2 -0
  23. package/dist/src/components/kompasid-metered-paywall/types.js.map +1 -0
  24. package/dist/src/components/kompasid-metered-wall-register/KompasMeteredWallRegister.js +2 -2
  25. package/dist/src/components/kompasid-metered-wall-register/KompasMeteredWallRegister.js.map +1 -1
  26. package/dist/src/components/kompasid-paywall/KompasPaywall.js +9 -3
  27. package/dist/src/components/kompasid-paywall/KompasPaywall.js.map +1 -1
  28. package/dist/src/components/kompasid-paywall/types.d.ts +7 -1
  29. package/dist/src/components/kompasid-paywall/types.js.map +1 -1
  30. package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.d.ts +3 -1
  31. package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js +24 -20
  32. package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js.map +1 -1
  33. package/dist/tsconfig.tsbuildinfo +1 -1
  34. package/package.json +1 -1
  35. package/src/components/kompasid-footer/KompasFooter.ts +4 -4
  36. package/src/components/kompasid-freewall/KompasFreewall.ts +57 -25
  37. package/src/components/kompasid-freewall/readme.md +25 -0
  38. package/src/components/kompasid-freewall/types.ts +13 -0
  39. package/src/components/kompasid-freewall-body/KompasFreewallBody.ts +20 -17
  40. package/src/components/kompasid-freewall-head/KompasFreewallHead.ts +5 -7
  41. package/src/components/kompasid-header-account/KompasHeaderAccount.ts +1 -1
  42. package/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.ts +1 -1
  43. package/src/components/kompasid-metered-paywall/KompasMeteredPaywall.ts +54 -26
  44. package/src/components/kompasid-metered-paywall/readme.md +11 -0
  45. package/src/components/kompasid-metered-paywall/types.ts +5 -0
  46. package/src/components/kompasid-metered-wall-register/KompasMeteredWallRegister.ts +2 -2
  47. package/src/components/kompasid-metered-wall-register/readme.md +1 -1
  48. package/src/components/kompasid-paywall/KompasPaywall.ts +11 -3
  49. package/src/components/kompasid-paywall/readme.md +161 -0
  50. package/src/components/kompasid-paywall/types.ts +7 -2
  51. package/src/components/kompasid-paywall-body/KompasPaywallBody.ts +24 -20
@@ -33,6 +33,167 @@ Ini adalah redesign komponen _paywall_ yang digunakan pada [epaper.kompas.id](ht
33
33
  | `userGuid` | `user-guid` | | `string` | `''` |
34
34
 
35
35
 
36
+ ## JSON ([https://cdn-www.kompas.id/web-component/paywall.json](https://cdn-www.kompas.id/web-component/paywall.json))
37
+ Example:
38
+
39
+ ```json
40
+ {
41
+ "epaper": {
42
+ "head": "Akses ePaper Ini dengan Berlangganan",
43
+ "content": [
44
+ "10+ buku digital dan 5+ Political Insight eksklusif di aplikasi",
45
+ "Akses ePaper hingga 30 edisi terakhir",
46
+ "Undangan prioritas webinar eksklusif bersama redaksi",
47
+ "Klaim voucer digital Hotel Santika dan mitra Kompas.id lainnya"
48
+ ],
49
+ "memberships": [
50
+ {
51
+ "title": "Kompas Digital Premium 12 Bulan (Hemat 40%)",
52
+ "percentage": 40,
53
+ "price": 360000,
54
+ "discountPrice": 600000,
55
+ "savingPrice": 30000,
56
+ "periode": "Tahun",
57
+ "isHighlight": true,
58
+ "url": "https://checkoutv2.kompas.id/kdp?productId=9802032&referrer=",
59
+ "package": "Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 12",
60
+ "subscriptionId": "9802032",
61
+ "position": 1
62
+ },
63
+ {
64
+ "title": "Kompas Digital Premium 1 Bulan",
65
+ "percentage": 0,
66
+ "discountPrice": 0,
67
+ "price": 50000,
68
+ "periode": "Bulan",
69
+ "isHighlight": false,
70
+ "url": "https://checkoutv2.kompas.id/kdp?productId=9802035&referrer=",
71
+ "package": "Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 1",
72
+ "subscriptionId": "9802035",
73
+ "position": 2
74
+ }
75
+ ],
76
+ "swgEnable": true
77
+ },
78
+ "reguler": {
79
+ "head": "Baca Lengkap Seluruh Artikel dengan Berlangganan",
80
+ "content": [
81
+ "10+ buku digital dan 5+ Political Insight eksklusif di aplikasi",
82
+ "Akses ePaper hingga 30 edisi terakhir",
83
+ "Undangan prioritas webinar eksklusif bersama redaksi",
84
+ "Klaim voucer digital Hotel Santika dan mitra Kompas.id lainnya"
85
+ ],
86
+ "memberships": [
87
+ {
88
+ "title": "Kompas Digital Premium 12 Bulan (Hemat 40%)",
89
+ "percentage": 40,
90
+ "price": 360000,
91
+ "discountPrice": 600000,
92
+ "savingPrice": 30000,
93
+ "periode": "Tahun",
94
+ "isHighlight": true,
95
+ "url": "https://checkoutv2.kompas.id/kdp?productId=9802032&referrer=",
96
+ "package": "Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 12",
97
+ "subscriptionId": "9802032",
98
+ "position": 1
99
+ },
100
+ {
101
+ "title": "Kompas Digital Premium 1 Bulan",
102
+ "percentage": 0,
103
+ "discountPrice": 0,
104
+ "price": 50000,
105
+ "periode": "Bulan",
106
+ "isHighlight": false,
107
+ "url": "https://checkoutv2.kompas.id/kdp?productId=9802035&referrer=",
108
+ "package": "Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 1",
109
+ "subscriptionId": "9802035",
110
+ "position": 2
111
+ }
112
+ ],
113
+ "swgEnable": true
114
+ },
115
+ "audio": {
116
+ "head": "Akses Audio Berita dan Keuntungan Lainnya dengan Berlangganan",
117
+ "content": [
118
+ "10+ buku digital dan 5+ Political Insight eksklusif di aplikasi",
119
+ "Akses ePaper hingga 30 edisi terakhir",
120
+ "Undangan prioritas webinar eksklusif bersama redaksi",
121
+ "Klaim voucer digital Hotel Santika dan mitra Kompas.id lainnya"
122
+ ],
123
+ "memberships": [
124
+ {
125
+ "title": "Kompas Digital Premium 12 Bulan (Hemat 40%)",
126
+ "percentage": 40,
127
+ "price": 360000,
128
+ "discountPrice": 600000,
129
+ "savingPrice": 30000,
130
+ "periode": "Tahun",
131
+ "isHighlight": true,
132
+ "url": "https://checkoutv2.kompas.id/kdp?productId=9802032&referrer=",
133
+ "package": "Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 12",
134
+ "subscriptionId": "9802032",
135
+ "position": 1
136
+ },
137
+ {
138
+ "title": "Kompas Digital Premium 1 Bulan",
139
+ "percentage": 0,
140
+ "discountPrice": 0,
141
+ "price": 50000,
142
+ "periode": "Bulan",
143
+ "isHighlight": false,
144
+ "url": "https://checkoutv2.kompas.id/kdp?productId=9802035&referrer=",
145
+ "package": "Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 1",
146
+ "subscriptionId": "9802035",
147
+ "position": 2
148
+ }
149
+ ],
150
+ "swgEnable": false
151
+ },
152
+ "custom": {
153
+ "head": "ini title custom",
154
+ "content": [
155
+ "Akses seluruh konten Kompas.id web dan aplikasi",
156
+ "ePaper hingga 30 edisi terakhir",
157
+ "Artikel Riset dan Opini eksklusif dari para ahli",
158
+ "Buku digital tiap bulannya di aplikasi"
159
+ ],
160
+ "memberships": [
161
+ {
162
+ "title": "Kompas Digital Premium 12 Bulan (Hemat 40%)",
163
+ "percentage": 40,
164
+ "price": 360000,
165
+ "discountPrice": 600000,
166
+ "savingPrice": 30000,
167
+ "periode": "Tahun",
168
+ "isHighlight": true,
169
+ "url": "https://checkoutv2.kompas.id/kdp?productId=9802032&referrer=",
170
+ "package": "Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 12",
171
+ "subscriptionId": "9802032",
172
+ "position": 1
173
+ },
174
+ {
175
+ "title": "Kompas Digital Premium 1 Bulan",
176
+ "percentage": 0,
177
+ "discountPrice": 0,
178
+ "price": 50000,
179
+ "periode": "Bulan",
180
+ "isHighlight": false,
181
+ "url": "https://checkoutv2.kompas.id/kdp?productId=9802035&referrer=",
182
+ "package": "Cash-B2C-Halaman Berlangganan-Reguler_Digital-KDP 1",
183
+ "subscriptionId": "9802035",
184
+ "position": 2
185
+ }
186
+ ],
187
+ "swgEnable": true,
188
+ "freeTrial": {
189
+ "packageText": "untuk 3 hari pertama",
190
+ "desktopText": "Coba gratis 3 hari Kompas.id melalui aplikasi. Pindai kode QR dengan ponsel atau tablet untuk mengunduh aplikasi.",
191
+ "mobileText": "Dapatkan akses gratis selama 3 hari ke konten dan fitur premium Kompas.id di aplikasi."
192
+ }
193
+ }
194
+ }
195
+ ```
196
+
36
197
  ## Dependencies
37
198
 
38
199
  ### Depends on
@@ -37,10 +37,16 @@ export interface Informations {
37
37
  label: string
38
38
  }
39
39
  }
40
+ export interface FreeTrial {
41
+ packageText: string
42
+ desktopText: string
43
+ mobileText: string
44
+ }
40
45
  export interface Packages {
41
46
  title: string
42
47
  memberships: Array<Product>
43
- freeTrial: string
48
+ swgEnable: boolean
49
+ freeTrial: FreeTrial
44
50
  }
45
51
  export interface PaywallProduct {
46
52
  informations: {
@@ -56,5 +62,4 @@ export interface PaywallProduct {
56
62
  ekstension: Array<PaymentImage>
57
63
  }
58
64
  }
59
-
60
65
  export type PaywallType = 'epaper' | 'reguler' | 'audio' | 'custom'
@@ -113,6 +113,7 @@ export class KompasIdPaywallBody extends LitElement {
113
113
  @state() private swgProductId = 'kompas.id:kompas_digital_premium'
114
114
  @state() private errorFlag = 0
115
115
 
116
+ _packages!: Packages
116
117
  buttonElement!: HTMLButtonElement
117
118
  targetElement!: HTMLElement
118
119
 
@@ -134,6 +135,10 @@ export class KompasIdPaywallBody extends LitElement {
134
135
  return !this.isLogin || this.tracker_subscription_status === 'IA'
135
136
  }
136
137
 
138
+ get packages(): Packages {
139
+ return this._packages
140
+ }
141
+
137
142
  /**
138
143
  * Logic Function
139
144
  */
@@ -181,11 +186,11 @@ export class KompasIdPaywallBody extends LitElement {
181
186
  }
182
187
 
183
188
  private handleClickOutside() {
184
- if (this.targetElement.classList.contains('wrapper-body')) {
189
+ if (this.targetElement?.classList.contains('wrapper-body')) {
185
190
  this.togglePaywall()
186
191
  }
187
192
 
188
- if (this.targetElement.id === 'freeTrialPopup') {
193
+ if (this.targetElement?.id === 'freeTrialPopup') {
189
194
  this.closeFreeTrialPopup()
190
195
  }
191
196
  }
@@ -411,9 +416,12 @@ export class KompasIdPaywallBody extends LitElement {
411
416
  }
412
417
 
413
418
  override async connectedCallback() {
419
+ this._packages = this.paywallData?.packages ?? ({} as Packages)
420
+
414
421
  super.connectedCallback()
415
422
  await this.updateComplete
416
- if (this.swgEnable) {
423
+
424
+ if (this.packages.swgEnable) {
417
425
  this.jsonScript()
418
426
  const appendSWGButton = () => {
419
427
  this.buttonElement = this.shadowRoot?.getElementById(
@@ -928,7 +936,7 @@ export class KompasIdPaywallBody extends LitElement {
928
936
  : this.secondaryPackages(item)
929
937
  )}
930
938
  ${this.freeTrialPackageSection()} ${this.freeTrialPopUp()}
931
- ${this.swgEnable ? this.swgPackageSection() : nothing}
939
+ ${this.packages.swgEnable ? this.swgPackageSection() : nothing}
932
940
  </div>
933
941
  `
934
942
  }
@@ -1026,8 +1034,8 @@ export class KompasIdPaywallBody extends LitElement {
1026
1034
  const textColorClass = isDark ? 'text-dark-7' : 'text-grey-500'
1027
1035
 
1028
1036
  const googleImageSrc = isDark
1029
- ? 'https://kompasid-production-www.s3.ap-southeast-1.amazonaws.com/paywall-asset/google-white.png'
1030
- : 'https://kompasid-production-www.s3.ap-southeast-1.amazonaws.com/paywall-asset/google.png'
1037
+ ? 'https://cdn-www.kompas.id/paywall-asset/google-white.png'
1038
+ : 'https://cdn-www.kompas.id/paywall-asset/google.png'
1031
1039
 
1032
1040
  return html`
1033
1041
  <div class="${containerClass}">
@@ -1066,12 +1074,12 @@ export class KompasIdPaywallBody extends LitElement {
1066
1074
  const { isDark } = this
1067
1075
 
1068
1076
  const googlePlayBadgeSrc = isDark
1069
- ? 'https://kompasid-production-www.s3.ap-southeast-1.amazonaws.com/web-component/Button_Download%20Google%20Play_Dark%20Mode.svg'
1070
- : 'https://kompasid-production-www.s3.ap-southeast-1.amazonaws.com/web-component/Button_Download%20Google%20Play_Light%20Mode.svg'
1077
+ ? 'https://cdn-www.kompas.id/web-component/Button_Download%20Google%20Play_Dark%20Mode.svg'
1078
+ : 'https://cdn-www.kompas.id/web-component/Button_Download%20Google%20Play_Light%20Mode.svg'
1071
1079
 
1072
1080
  const appStoreBadgeSrc = isDark
1073
- ? 'https://kompasid-production-www.s3.ap-southeast-1.amazonaws.com/web-component/Button_Download%20App%20Store_Dark%20Mode.svg'
1074
- : 'https://kompasid-production-www.s3.ap-southeast-1.amazonaws.com/web-component/Button_Download%20App%20Store_Light%20Mode.svg'
1081
+ ? 'https://cdn-www.kompas.id/web-component/Button_Download%20App%20Store_Dark%20Mode.svg'
1082
+ : 'https://cdn-www.kompas.id/web-component/Button_Download%20App%20Store_Light%20Mode.svg'
1075
1083
 
1076
1084
  return html`
1077
1085
  <div
@@ -1094,7 +1102,7 @@ export class KompasIdPaywallBody extends LitElement {
1094
1102
  <div class="w-full flex justify-center">
1095
1103
  <div class="w-3/4 lg:w-1/2">
1096
1104
  <img
1097
- src="https://kompasid-production-www.s3.ap-southeast-1.amazonaws.com/web-component/kompas-free-trial.png"
1105
+ src="https://cdn-www.kompas.id/web-component/kompas-free-trial.png"
1098
1106
  alt="Free Trial"
1099
1107
  />
1100
1108
  </div>
@@ -1113,7 +1121,7 @@ export class KompasIdPaywallBody extends LitElement {
1113
1121
  >
1114
1122
  <div class="w-1/3 flex mr-6">
1115
1123
  <img
1116
- src="https://kompasid-production-www.s3.ap-southeast-1.amazonaws.com/web-component/free-trial-qr-code.png"
1124
+ src="https://cdn-www.kompas.id/web-component/free-trial-qr-code.png"
1117
1125
  alt="QR Code Deep Link"
1118
1126
  />
1119
1127
  </div>
@@ -1122,8 +1130,7 @@ export class KompasIdPaywallBody extends LitElement {
1122
1130
  ? 'text-dark-7'
1123
1131
  : 'text-grey-600'}"
1124
1132
  >
1125
- Coba gratis 3 hari Kompas.id melalui aplikasi. Pindai kode QR
1126
- dengan ponsel atau tablet untuk mengunduh aplikasi.
1133
+ ${this.packages.freeTrial?.desktopText}
1127
1134
  </div>
1128
1135
  </div>
1129
1136
  <div
@@ -1131,8 +1138,7 @@ export class KompasIdPaywallBody extends LitElement {
1131
1138
  ? 'text-dark-7'
1132
1139
  : 'text-grey-600'}"
1133
1140
  >
1134
- Dapatkan akses gratis selama 3 hari ke konten dan fitur premium
1135
- Kompas.id di aplikasi.
1141
+ ${this.packages.freeTrial?.mobileText}
1136
1142
  </div>
1137
1143
  <div class="lg:flex flex justify-center mt-4 hidden lg:block gap-4">
1138
1144
  <a
@@ -1162,9 +1168,7 @@ export class KompasIdPaywallBody extends LitElement {
1162
1168
  }
1163
1169
 
1164
1170
  private freeTrialPackageSection() {
1165
- const packages = this.paywallData?.packages ?? ({} as Packages)
1166
-
1167
- if (packages.freeTrial) {
1171
+ if (this.packages.freeTrial) {
1168
1172
  return html`
1169
1173
  <div
1170
1174
  class="flex flex-wrap items-center justify-between py-3 px-4 rounded-lg md:mx-0 w-full h-[68px] max-w-xs md:max-w-sm md:w-3/5 mt-3 md:mt-4 ${this
@@ -1182,7 +1186,7 @@ export class KompasIdPaywallBody extends LitElement {
1182
1186
  <p
1183
1187
  class="text-xs ${this.isDark ? 'text-dark-7' : 'text-grey-600'}"
1184
1188
  >
1185
- ${packages.freeTrial}
1189
+ ${this.packages.freeTrial?.packageText}
1186
1190
  </p>
1187
1191
  </div>
1188
1192
  </div>