@kompasid/lit-web-components 0.8.22 → 0.8.24

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 (23) hide show
  1. package/demo/index.html +15 -8
  2. package/dist/src/components/kompasid-grace-period/KompasGracePeriod.js +4 -2
  3. package/dist/src/components/kompasid-grace-period/KompasGracePeriod.js.map +1 -1
  4. package/dist/src/components/kompasid-header-account/KompasHeaderAccount.d.ts +2 -1
  5. package/dist/src/components/kompasid-header-account/KompasHeaderAccount.js +11 -3
  6. package/dist/src/components/kompasid-header-account/KompasHeaderAccount.js.map +1 -1
  7. package/dist/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.js +12 -6
  8. package/dist/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.js.map +1 -1
  9. package/dist/src/components/kompasid-header-notification/KompasHeaderNotification.d.ts +2 -1
  10. package/dist/src/components/kompasid-header-notification/KompasHeaderNotification.js +10 -2
  11. package/dist/src/components/kompasid-header-notification/KompasHeaderNotification.js.map +1 -1
  12. package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js +2 -1
  13. package/dist/src/components/kompasid-paywall-body/KompasPaywallBody.js.map +1 -1
  14. package/dist/src/utils/api/getHeaderTheme.js +1 -4
  15. package/dist/src/utils/api/getHeaderTheme.js.map +1 -1
  16. package/dist/tsconfig.tsbuildinfo +1 -1
  17. package/package.json +1 -1
  18. package/src/components/kompasid-grace-period/KompasGracePeriod.ts +4 -2
  19. package/src/components/kompasid-header-account/KompasHeaderAccount.ts +11 -3
  20. package/src/components/kompasid-header-account-profile/KompasHeaderAccountProfile.ts +19 -14
  21. package/src/components/kompasid-header-notification/KompasHeaderNotification.ts +10 -3
  22. package/src/components/kompasid-paywall-body/KompasPaywallBody.ts +2 -1
  23. package/src/utils/api/getHeaderTheme.ts +2 -5
@@ -1,5 +1,6 @@
1
1
  import { LitElement, html, css } from 'lit'
2
2
  import { format, isToday, formatDistanceStrict, subDays } from 'date-fns'
3
+ import { cva } from 'class-variance-authority'
3
4
  import { id } from 'date-fns/locale/id'
4
5
  import { customElement, property, state } from 'lit/decorators.js'
5
6
  import { unsafeSVG } from 'lit/directives/unsafe-svg.js'
@@ -142,8 +143,7 @@ export class KompasHeaderNotification extends LitElement {
142
143
  @state() notificationInfoData: UserNotification = {} as UserNotification
143
144
  @state() notificationContentData: any[] = []
144
145
  @state() isDataLoaded: boolean = false
145
- @state() setTheme: any
146
-
146
+ @state() themeList: any = null
147
147
  /*
148
148
  * property accessToken is the access token of the user
149
149
  * property refreshToken is the refresh token of the user
@@ -190,7 +190,7 @@ export class KompasHeaderNotification extends LitElement {
190
190
  override async connectedCallback() {
191
191
  super.connectedCallback()
192
192
  this.isShowDropdown = false
193
- this.setTheme = await getHeaderTheme()
193
+ this.themeList = await getHeaderTheme()
194
194
 
195
195
  if ((this.accessToken || this.refreshToken) && this.domain)
196
196
  await this.loadData()
@@ -202,6 +202,13 @@ export class KompasHeaderNotification extends LitElement {
202
202
  document.removeEventListener('click', this.handleClickOutside)
203
203
  }
204
204
 
205
+ private setTheme(param: any): String {
206
+ if (!this.themeList) return 'text-grey-100'
207
+ const cvaFn = cva('', { variants: this.themeList })
208
+
209
+ return cvaFn(param)
210
+ }
211
+
205
212
  private async apiFetch(url: string, options: any) {
206
213
  const response = await customFetch(
207
214
  url,
@@ -400,6 +400,7 @@ export class KompasIdPaywallBody extends LitElement {
400
400
  this._packages = this.paywallData?.packages ?? ({} as Packages)
401
401
 
402
402
  super.connectedCallback()
403
+ this.sendDataLayeronPaywallBody()
403
404
  await this.updateComplete
404
405
  this.accessToken = getCookie('kompas._token')
405
406
  this.refreshToken = getCookie('kompas._token_refresh')
@@ -1262,7 +1263,7 @@ export class KompasIdPaywallBody extends LitElement {
1262
1263
  ${this.registrationSection(this.type)}
1263
1264
  `
1264
1265
  : nothing}
1265
- ${this.userAction()} ${this.sendDataLayeronPaywallBody()}
1266
+ ${this.userAction()}
1266
1267
  </div>
1267
1268
  ${this.isExtensionsOpened
1268
1269
  ? this.paymentMobileExtension(
@@ -1,5 +1,3 @@
1
- import { cva } from 'class-variance-authority'
2
-
3
1
  let cachedHeaderTheme: any = null
4
2
  let fetchPromise: Promise<any> | null = null
5
3
 
@@ -16,9 +14,8 @@ export const getHeaderTheme = async () => {
16
14
  .then(response => response.json())
17
15
  .then(data => {
18
16
  // Process the fetched data using `cva` and cache it
19
- cachedHeaderTheme = cva('', {
20
- variants: data.header,
21
- })
17
+ cachedHeaderTheme = data.header
18
+
22
19
  fetchPromise = null // Reset the fetchPromise
23
20
  return cachedHeaderTheme
24
21
  })