@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
@@ -1,7 +1,7 @@
1
1
  import { html, css, LitElement, nothing } from 'lit'
2
2
  import { property, customElement, state } from 'lit/decorators.js'
3
3
  import { TWStyles } from '../../../tailwind/tailwind.js'
4
- import { PackageData } from './types.js'
4
+ import { JsonPackageData, PackageData } from './types.js'
5
5
  import { redirectToCheckout } from '../../utils/cta.js'
6
6
  import '../kompasid-freewall-head/KompasFreewallHead.js'
7
7
  import '../kompasid-freewall-body/KompasFreewallBody.js'
@@ -85,8 +85,10 @@ export class KompasFreewall extends LitElement {
85
85
  * State
86
86
  */
87
87
 
88
+ @state() private isLoading: Boolean = true
88
89
  @state() private isExpand: boolean = true
89
90
  @state() private packageData: PackageData = {} as PackageData
91
+ @state() private jsonPackageData: JsonPackageData = {} as JsonPackageData
90
92
 
91
93
  /**
92
94
  * Getter
@@ -166,7 +168,7 @@ export class KompasFreewall extends LitElement {
166
168
  private onSubscriptionClick() {
167
169
  this.sendDataLayerSubscribeButtonClicked()
168
170
  redirectToCheckout({
169
- link: `${this.packageData.link}${this.packageData.referrer}`,
171
+ link: `${this.jsonPackageData.subscriptionUrl}&referrer=${this.packageData.referrer}`,
170
172
  source: this.type,
171
173
  })
172
174
  }
@@ -183,40 +185,70 @@ export class KompasFreewall extends LitElement {
183
185
 
184
186
  const originHost: string = encodeURIComponent(window.location.href)
185
187
  this.packageData = { ...this.showPackage, referrer: originHost }
188
+ this.getFreewallData()
186
189
 
187
190
  this.sendDataLayerPaywallViewed()
188
191
  }
189
192
 
193
+ async getFreewallData() {
194
+ try {
195
+ const response = await fetch(
196
+ 'https://cdn-www.kompas.id/web-component/freewall.json'
197
+ )
198
+ const json = await response.json()
199
+ this.jsonPackageData = {
200
+ headCopyCollapse: json.headCopyCollapse,
201
+ headCopyExpand: json.headCopyExpand,
202
+ subscriptionUrl: json.subscriptionUrl,
203
+ subscriptionTitle: json.subscriptionTitle,
204
+ subscriptionTitleGuest: json.subscriptionTitleGuest,
205
+ subscriptionDescription: json.subscriptionDescription,
206
+ subscriptionButtonText: json.subscriptionButtonText,
207
+ registerTitle: json.registerTitle,
208
+ registerDescription: json.registerDescription,
209
+ registerButtonText: json.registerButtonText,
210
+ }
211
+ } catch (error) {
212
+ throw Error('Failed to get metered paywall data')
213
+ } finally {
214
+ this.isLoading = false
215
+ }
216
+ }
217
+
190
218
  /**
191
219
  * Render Statement
192
220
  */
193
221
 
194
222
  render() {
195
- return html`
196
- <div class="sticky bottom-0 w-full h-full z-20 top-shadow">
197
- <div
198
- class="flex flex-col w-full bg-blue-100 justify-center ${this
199
- .isExpand && 'pb-6 md:pb-7'} md:px-4 lg:px-24"
200
- >
201
- <kompasid-freewall-head
202
- .expand=${this.isExpand}
203
- .type=${this.type}
204
- .head_copy_expand=${this.head_copy_expand}
205
- .head_copy_collapse=${this.head_copy_collapse}
206
- .toggleExpand=${() => this.toggleExpand()}
207
- .onSubscriptionClick=${() => this.onSubscriptionClick()}
208
- .packageData=${this.packageData}
209
- ></kompasid-freewall-head>
210
- ${this.isExpand
211
- ? html`<kompasid-freewall-body
223
+ return !this.isLoading
224
+ ? html`
225
+ <div class="sticky bottom-0 w-full h-full z-20 top-shadow">
226
+ <div
227
+ class="flex flex-col w-full bg-blue-100 justify-center ${this
228
+ .isExpand && 'pb-6 md:pb-7'} md:px-4 lg:px-24"
229
+ >
230
+ <kompasid-freewall-head
231
+ .expand=${this.isExpand}
212
232
  .type=${this.type}
233
+ .head_copy_expand=${this.jsonPackageData.headCopyExpand}
234
+ .head_copy_collapse=${this.jsonPackageData.headCopyCollapse}
235
+ .toggleExpand=${() => this.toggleExpand()}
213
236
  .onSubscriptionClick=${() => this.onSubscriptionClick()}
214
237
  .packageData=${this.packageData}
215
- ?isLogin=${this.isLogin}
216
- ></kompasid-freewall-body>`
217
- : nothing}
218
- </div>
219
- </div>
220
- `
238
+ .jsonPackageData=${this.jsonPackageData}
239
+ ></kompasid-freewall-head>
240
+ ${this.isExpand
241
+ ? html`<kompasid-freewall-body
242
+ .type=${this.type}
243
+ .onSubscriptionClick=${() => this.onSubscriptionClick()}
244
+ .packageData=${this.packageData}
245
+ .jsonPackageData=${this.jsonPackageData}
246
+ ?isLogin=${this.isLogin}
247
+ ></kompasid-freewall-body>`
248
+ : nothing}
249
+ </div>
250
+ </div>
251
+ `
252
+ : nothing
221
253
  }
222
254
  }
@@ -45,6 +45,31 @@
45
45
  | `paywall_subscription_price` | `paywall_subscription_price` | property paywall_subscription_price is the price of the subscription package viewed by user | `number` | `0` |
46
46
  | `paywall_position` | `paywall_position` | property paywall_position is the position of the subscription package viewed by user | `number` | `1` |
47
47
 
48
+
49
+ ## JSON ([https://cdn-www.kompas.id/web-component/freewall.json](https://cdn-www.kompas.id/web-component/freewall.json))
50
+ Example:
51
+
52
+ ```json
53
+ {
54
+ "headCopyCollapse": "Akses seluruh konten dan fitur Kompas.id dengan berlangganan.",
55
+ "headCopyExpand": "Akses seluruh konten dan fitur Kompas.id dengan berlangganan.",
56
+ "subscriptionUrl": "kdp?productId=9802035",
57
+ "subscriptionTitle": "Dukung Jurnalisme Mencerahkan dengan Berlangganan",
58
+ "subscriptionTitleGuest": "Mulai Berlangganan",
59
+ "subscriptionDescription": [
60
+ "Akses seluruh konten Kompas.id di web & aplikasi",
61
+ "ePaper hingga 30 edisi terakhir",
62
+ "Buku digital tiap bulannya di aplikasi"
63
+ ],
64
+ "subscriptionButtonText": "Langganan Rp 50.000 / bulan",
65
+ "registerTitle": "Daftar Akun Gratis",
66
+ "registerDescription": [
67
+ "Akses ke 3 artikel berbayar gratis tiap bulan"
68
+ ],
69
+ "registerButtonText": "Daftar Gratis"
70
+ }
71
+ ```
72
+
48
73
  ## Dependencies
49
74
 
50
75
  ### Depends on
@@ -8,3 +8,16 @@ export interface PackageData {
8
8
  title: string
9
9
  referrer: string
10
10
  }
11
+
12
+ export interface JsonPackageData {
13
+ headCopyCollapse: string
14
+ headCopyExpand: string
15
+ subscriptionUrl: string
16
+ subscriptionTitle: string
17
+ subscriptionTitleGuest: string
18
+ subscriptionDescription: string[]
19
+ subscriptionButtonText: string
20
+ registerTitle: string
21
+ registerDescription: string[]
22
+ registerButtonText: string
23
+ }
@@ -2,9 +2,7 @@ import { html, css, LitElement, nothing } from 'lit'
2
2
  import { property, customElement } from 'lit/decorators.js'
3
3
  import { TWStyles } from '../../../tailwind/tailwind.js'
4
4
  import { addGoogleFonts } from '../../utils/googleFont.js'
5
- import { formatRupiah } from '../../utils/formatRupiah.js'
6
- import { generateCopyDuration } from '../../utils/generateCopyDuration.js'
7
- import { PackageData } from '../kompasid-freewall/types.js'
5
+ import { JsonPackageData, PackageData } from '../kompasid-freewall/types.js'
8
6
  import { faCheck } from '../../../assets/font-awesome.js'
9
7
  import { redirectToRegister } from '../../utils/cta.js'
10
8
 
@@ -93,6 +91,8 @@ export class KompasFreewallBody extends LitElement {
93
91
  @property({ type: String }) type: 'article' | 'landing_page' = 'article'
94
92
  @property() onSubscriptionClick = () => {}
95
93
  @property({ type: Object }) packageData: PackageData = {} as PackageData
94
+ @property({ type: Object }) jsonPackageData: JsonPackageData =
95
+ {} as JsonPackageData
96
96
 
97
97
  description = [
98
98
  'Akses seluruh konten Kompas.id di web & aplikasi',
@@ -134,8 +134,8 @@ export class KompasFreewallBody extends LitElement {
134
134
  .isLogin && 'w-60 md:w-full'} text-grey-600"
135
135
  >
136
136
  ${this.isLogin
137
- ? 'Dukung Jurnalisme Mencerahkan dengan Berlangganan'
138
- : 'Mulai Berlangganan'}
137
+ ? this.jsonPackageData.subscriptionTitle
138
+ : this.jsonPackageData.subscriptionTitleGuest}
139
139
  </h5>
140
140
  ${this.descriptionSection()}
141
141
  </div>
@@ -145,8 +145,7 @@ export class KompasFreewallBody extends LitElement {
145
145
  .isLogin &&
146
146
  'md:w-[370px]'} md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-white font-bold leading-[18px]"
147
147
  >
148
- Langganan ${formatRupiah(this.packageData.price)}
149
- /${generateCopyDuration(this.packageData.durationType)}
148
+ ${this.jsonPackageData.subscriptionButtonText}
150
149
  </button>
151
150
  </div>
152
151
  <div id="ribbon-container">
@@ -169,22 +168,26 @@ export class KompasFreewallBody extends LitElement {
169
168
  <h5
170
169
  class="font-lora text-lg md:text-xl font-bold leading-[30px] text-grey-600"
171
170
  >
172
- Daftar Akun Gratis
171
+ ${this.jsonPackageData.registerTitle}
173
172
  </h5>
174
- <div
175
- class="flex items-start lg:items-center mt-3 mb-4 md:mt-4 md:mb-5"
176
- >
177
- <div class="mt-1 lg:mt-0">${faCheck()}</div>
178
- <h6 class="text-base text-grey-600 ml-1">
179
- Akses ke 3 artikel berbayar gratis tiap bulan
180
- </h6>
173
+ <div class="flex flex-col space-y-1 mt-3 mb-4 md:mt-4 md:mb-5">
174
+ ${this.jsonPackageData.registerDescription.map(
175
+ item => html`
176
+ <div class="flex items-start lg:items-center">
177
+ <div class="mt-1 lg:mt-0">${faCheck()}</div>
178
+ <h6 class="text-base text-grey-600 ml-1 text-start">
179
+ ${item}
180
+ </h6>
181
+ </div>
182
+ `
183
+ )}
181
184
  </div>
182
185
  </div>
183
186
  <button
184
187
  @click=${() => redirectToRegister('freewall')}
185
188
  class="bg-white border border-brand-1 whitespace-nowrap rounded md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-brand-1 font-bold leading-[18px]"
186
189
  >
187
- Daftar Gratis
190
+ ${this.jsonPackageData.registerButtonText}
188
191
  </button>
189
192
  </div>
190
193
  `
@@ -192,7 +195,7 @@ export class KompasFreewallBody extends LitElement {
192
195
 
193
196
  private descriptionSection() {
194
197
  return html`<div class="flex flex-col space-y-1 mt-3 mb-4 md:mt-4 md:mb-5">
195
- ${this.description.map(
198
+ ${this.jsonPackageData.subscriptionDescription.map(
196
199
  item =>
197
200
  html`
198
201
  <div class="flex items-start lg:items-center">
@@ -4,9 +4,7 @@ import { unsafeSVG } from 'lit/directives/unsafe-svg.js'
4
4
  import { TWStyles } from '../../../tailwind/tailwind.js'
5
5
  import { addGoogleFonts } from '../../utils/googleFont.js'
6
6
  import { getFontAwesomeIcon } from '../../utils/fontawesome-setup.js'
7
- import { formatRupiah } from '../../utils/formatRupiah.js'
8
- import { generateCopyDuration } from '../../utils/generateCopyDuration.js'
9
- import { PackageData } from '../kompasid-freewall/types.js'
7
+ import { JsonPackageData, PackageData } from '../kompasid-freewall/types.js'
10
8
 
11
9
  @customElement('kompasid-freewall-head')
12
10
  export class KompasFreewallHead extends LitElement {
@@ -33,6 +31,8 @@ export class KompasFreewallHead extends LitElement {
33
31
  @property() toggleExpand = () => {}
34
32
  @property() onSubscriptionClick = () => {}
35
33
  @property({ type: Object }) packageData: PackageData = {} as PackageData
34
+ @property({ type: Object }) jsonPackageData: JsonPackageData =
35
+ {} as JsonPackageData
36
36
 
37
37
  /**
38
38
  * Getter
@@ -73,8 +73,7 @@ export class KompasFreewallHead extends LitElement {
73
73
  @click=${this.onSubscriptionClick}
74
74
  class="bg-green-500 hidden md:block ml-3 whitespace-nowrap rounded md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-white font-bold leading-[18px]"
75
75
  >
76
- Langganan ${formatRupiah(this.packageData.price)}
77
- /${generateCopyDuration(this.packageData.durationType)}
76
+ ${this.jsonPackageData.subscriptionButtonText}
78
77
  </button>`
79
78
  : nothing}
80
79
  </div>
@@ -95,8 +94,7 @@ export class KompasFreewallHead extends LitElement {
95
94
  @click=${this.onSubscriptionClick}
96
95
  class="bg-green-500 block md:hidden whitespace-nowrap rounded md:rounded h-10 px-4 md:px-5 text-sm md:text-base text-white font-bold leading-[18px]"
97
96
  >
98
- Langganan ${formatRupiah(this.packageData.price)}
99
- /${generateCopyDuration(this.packageData.durationType)}
97
+ ${this.jsonPackageData.subscriptionButtonText}
100
98
  </button>`
101
99
  : nothing}
102
100
  </div>
@@ -130,7 +130,7 @@ export class KompasHeaderAccount extends LitElement {
130
130
  <div>
131
131
  <img
132
132
  class="header-account--membership-icon h-2.5 w-2.5"
133
- src="https://d3w4qaq4xm1ncv.cloudfront.net/global-header/crown-royal-blue-60.svg"
133
+ src="https://cdn-www.kompas.id/global-header/crown-royal-blue-60.svg"
134
134
  alt="membership-crown-icon"
135
135
  />
136
136
  </div>
@@ -90,7 +90,7 @@ export class KompasHeaderAccountProfile extends LitElement {
90
90
  <div>
91
91
  <img
92
92
  class="header-account--membership-icon"
93
- src="https://d3w4qaq4xm1ncv.cloudfront.net/global-header/crown-blue-10.svg"
93
+ src="https://cdn-www.kompas.id/global-header/crown-blue-10.svg"
94
94
  alt="membership-crown-icon"
95
95
  />
96
96
  </div>
@@ -1,6 +1,7 @@
1
- import { html, css, LitElement } from 'lit'
1
+ import { html, css, LitElement, nothing } from 'lit'
2
2
  import { customElement, state, property } from 'lit/decorators.js'
3
3
  import { TWStyles } from '../../../tailwind/tailwind.js'
4
+ import { PackageData } from './types.js'
4
5
 
5
6
  @customElement('kompasid-metered-paywall')
6
7
  export class KompasMeteredPaywall extends LitElement {
@@ -34,9 +35,14 @@ export class KompasMeteredPaywall extends LitElement {
34
35
  TWStyles,
35
36
  ]
36
37
 
37
- @state() maxQuota: number = 3
38
+ @state() private isLoading: Boolean = true
39
+ @state() private maxQuota: number = 3
40
+ @state() private packageData: PackageData = {
41
+ subscriptionText: 'Langganan untuk akses tanpa batas',
42
+ buttonText: 'Langganan',
43
+ subscriptionUrl: 'https://www.kompas.id/berlangganan',
44
+ }
38
45
 
39
- @state() subscriptionUrl: string = 'https://www.kompas.id/berlangganan'
40
46
  /**
41
47
  * Props
42
48
  */
@@ -85,27 +91,45 @@ export class KompasMeteredPaywall extends LitElement {
85
91
  <p>
86
92
  Anda memiliki sisa
87
93
  <b>${maxQuota - getCountdown} dari ${maxQuota}</b> artikel premium
88
- gratis bulan ini. Langganan untuk akses tanpa batas
94
+ gratis bulan ini. ${this.packageData.subscriptionText}
89
95
  </p>
90
96
  `
91
97
  }
92
98
  return html`
93
99
  <p>
94
- Anda sedang membaca <b>artikel gratis terakhir bulan ini.</b> Langganan
95
- untuk akses tanpa batas
100
+ Anda sedang membaca <b>artikel gratis terakhir bulan ini.</b> ${this
101
+ .packageData.subscriptionText}
96
102
  </p>
97
103
  `
98
104
  }
99
105
 
100
- connectedCallback() {
106
+ override connectedCallback() {
101
107
  super.connectedCallback()
102
-
108
+ this.getMeteredPaywallData()
103
109
  this.dataLayeronMeteredPaywall()
104
110
  }
105
111
 
112
+ async getMeteredPaywallData() {
113
+ try {
114
+ const response = await fetch(
115
+ 'https://cdn-www.kompas.id/web-component/metered-paywall.json'
116
+ )
117
+ const json = await response.json()
118
+ this.packageData = {
119
+ subscriptionText: json.subscriptionText,
120
+ buttonText: json.buttonText,
121
+ subscriptionUrl: json.subscriptionUrl,
122
+ }
123
+ } catch (error) {
124
+ throw Error('Failed to get metered paywall data')
125
+ } finally {
126
+ this.isLoading = false
127
+ }
128
+ }
129
+
106
130
  private redirectToBerlangganan() {
107
131
  this.dataLayeronLanggananButton()
108
- window.location.href = this.subscriptionUrl
132
+ window.location.href = this.packageData.subscriptionUrl
109
133
  }
110
134
 
111
135
  private dataLayeronLanggananButton() {
@@ -151,24 +175,28 @@ export class KompasMeteredPaywall extends LitElement {
151
175
  }
152
176
 
153
177
  render() {
154
- return html`
155
- <div class="sticky bottom-0 w-full h-full">
156
- <div
157
- class="flex flex-row w-full bg-blue-100 py-4 justify-center space-x-4 px-4 lg:px-0 bottom-0"
158
- >
159
- <div class="text-grey-600 text-sm md:text-lg self-center text-left">
160
- ${this.getCountdownArticle()}
161
- </div>
162
- <div class="self-center">
163
- <button
164
- @click="${this.redirectToBerlangganan}"
165
- class="bg-green-400 p-2 rounded-md font-bold text-grey-100 text-sm md:text-xl"
178
+ return !this.isLoading
179
+ ? html`
180
+ <div class="sticky bottom-0 w-full h-full">
181
+ <div
182
+ class="flex flex-row w-full bg-blue-100 py-4 justify-center space-x-4 px-4 lg:px-0 bottom-0"
166
183
  >
167
- Langganan
168
- </button>
184
+ <div
185
+ class="text-grey-600 text-sm md:text-lg self-center text-left"
186
+ >
187
+ ${this.getCountdownArticle()}
188
+ </div>
189
+ <div class="self-center">
190
+ <button
191
+ @click="${this.redirectToBerlangganan}"
192
+ class="bg-green-400 p-2 rounded-md font-bold text-grey-100 text-sm md:text-xl"
193
+ >
194
+ ${this.packageData.buttonText}
195
+ </button>
196
+ </div>
197
+ </div>
169
198
  </div>
170
- </div>
171
- </div>
172
- `
199
+ `
200
+ : nothing
173
201
  }
174
202
  }
@@ -23,4 +23,15 @@
23
23
 
24
24
  ----------------------------------------------
25
25
 
26
+ ## JSON ([https://cdn-www.kompas.id/web-component/metered-paywall.json](https://cdn-www.kompas.id/web-component/metered-paywall.json))
27
+ Example:
28
+
29
+ ```json
30
+ {
31
+ "subscriptionText": "Langganan untuk akses tanpa batas",
32
+ "buttonText": "Langganan",
33
+ "subscriptionUrl": "https://www.kompas.id/berlangganan"
34
+ }
35
+ ```
36
+
26
37
  *Terbikin oleh tim front-end kompas.id*
@@ -0,0 +1,5 @@
1
+ export interface PackageData {
2
+ subscriptionText: string
3
+ buttonText: string
4
+ subscriptionUrl: string
5
+ }
@@ -235,7 +235,7 @@ export class KompasMeteredWallRegister extends LitElement {
235
235
  >
236
236
  <img
237
237
  alt="metered-wall-register"
238
- src="https://d3w4qaq4xm1ncv.cloudfront.net/paywall-asset/paywall_ilustrasi3-03_1.png"
238
+ src="https://cdn-www.kompas.id/paywall-asset/paywall_ilustrasi3-03_1.png"
239
239
  />
240
240
  </div>
241
241
  <button
@@ -356,7 +356,7 @@ export class KompasMeteredWallRegister extends LitElement {
356
356
 
357
357
  private async loadData() {
358
358
  const req = await fetch(
359
- `https://d3w4qaq4xm1ncv.cloudfront.net/assets/register_wall.json`
359
+ `https://cdn-www.kompas.id/assets/register_wall.json`
360
360
  )
361
361
 
362
362
  if (req.status !== 200) {
@@ -22,7 +22,7 @@ Anda perlu meletakkan _tag_ komponen `<kompas-metered-wall-register />` pada hal
22
22
 
23
23
  ### Catatan
24
24
 
25
- Text pada komponen ini dapat di update dengan mengubah value dari url https://d3w4qaq4xm1ncv.cloudfront.net/assets/register_wall.json
25
+ Text pada komponen ini dapat di update dengan mengubah value dari url https://cdn-www.kompas.id/assets/register_wall.json
26
26
 
27
27
  Dengan format dibawah ini:
28
28
 
@@ -121,7 +121,14 @@ export class KompasPaywall extends LitElement {
121
121
  packages: {
122
122
  title: 'Sekali bayar, tanpa perpanjang otomatis',
123
123
  memberships: [],
124
- freeTrial: 'untuk 3 hari pertama',
124
+ swgEnable: false,
125
+ freeTrial: {
126
+ packageText: 'untuk 3 hari pertama',
127
+ desktopText:
128
+ 'Coba gratis 3 hari Kompas.id melalui aplikasi. Pindai kode QR dengan ponsel atau tablet untuk mengunduh aplikasi.',
129
+ mobileText:
130
+ 'Dapatkan akses gratis selama 3 hari ke konten dan fitur premium Kompas.id di aplikasi.',
131
+ },
125
132
  },
126
133
  payment: {
127
134
  desktop: [
@@ -249,7 +256,7 @@ export class KompasPaywall extends LitElement {
249
256
  async getPaywallData() {
250
257
  try {
251
258
  const response = await fetch(
252
- 'https://kompasid-production-www.s3.ap-southeast-1.amazonaws.com/web-component/paywall.json'
259
+ 'https://cdn-www.kompas.id/web-component/paywall.json'
253
260
  )
254
261
  const json = await response.json()
255
262
  this.paywallData = {
@@ -262,11 +269,12 @@ export class KompasPaywall extends LitElement {
262
269
  packages: {
263
270
  ...this.mockResult.packages,
264
271
  memberships: json[this.type].memberships,
272
+ swgEnable: json[this.type].swgEnable,
265
273
  freeTrial: json[this.type].freeTrial,
266
274
  },
267
275
  }
268
276
  } catch (error) {
269
- throw Error('failed to get paywall data')
277
+ throw Error('Failed to get paywall data')
270
278
  } finally {
271
279
  this.isLoading = false
272
280
  }