@oslokommune/punkt-elements 12.37.5 → 12.37.6
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.
- package/CHANGELOG.md +17 -0
- package/dist/{consent-CJ2e2TSV.js → consent-BPZ8QV7q.js} +32 -23
- package/dist/{consent-D9VqpDkR.cjs → consent-CSspmVST.cjs} +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/pkt-consent.cjs +1 -1
- package/dist/pkt-consent.js +1 -1
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +1 -1
- package/package.json +2 -2
- package/src/components/consent/consent.ts +12 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,23 @@ og skriver commits ca etter [Conventional Commits](https://conventionalcommits.o
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [12.37.6](https://github.com/oslokommune/punkt/compare/12.37.5...12.37.6) (2025-05-13)
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
Ingen
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
Ingen
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
Ingen
|
|
18
|
+
|
|
19
|
+
### Chores
|
|
20
|
+
Ingen
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
|
|
8
25
|
## [12.37.5](https://github.com/oslokommune/punkt/compare/12.37.4...12.37.5) (2025-05-12)
|
|
9
26
|
|
|
10
27
|
### ⚠ BREAKING CHANGES
|
|
@@ -55,28 +55,28 @@ const h = {
|
|
|
55
55
|
}
|
|
56
56
|
}, g = globalThis, p = g.__cookieEvents || {
|
|
57
57
|
events: {},
|
|
58
|
-
on(e,
|
|
59
|
-
this.events[e] || (this.events[e] = []), this.events[e].push(
|
|
58
|
+
on(e, t) {
|
|
59
|
+
this.events[e] || (this.events[e] = []), this.events[e].push(t);
|
|
60
60
|
},
|
|
61
|
-
off(e,
|
|
62
|
-
this.events[e] && (this.events[e] = this.events[e].filter((
|
|
61
|
+
off(e, t) {
|
|
62
|
+
this.events[e] && (this.events[e] = this.events[e].filter((n) => n !== t));
|
|
63
63
|
},
|
|
64
|
-
once(e,
|
|
65
|
-
const
|
|
66
|
-
this.off(e,
|
|
64
|
+
once(e, t) {
|
|
65
|
+
const n = (s) => {
|
|
66
|
+
this.off(e, n), t(s);
|
|
67
67
|
};
|
|
68
|
-
this.on(e,
|
|
68
|
+
this.on(e, n);
|
|
69
69
|
},
|
|
70
|
-
emit(e,
|
|
71
|
-
this.events[e] && this.events[e].forEach((
|
|
70
|
+
emit(e, t) {
|
|
71
|
+
this.events[e] && this.events[e].forEach((n) => n(t));
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
74
|
g.__cookieEvents = p;
|
|
75
75
|
const m = p;
|
|
76
|
-
var f = Object.defineProperty, v = Object.getOwnPropertyDescriptor, r = (e,
|
|
77
|
-
for (var o = s > 1 ? void 0 : s ? v(
|
|
78
|
-
(d = e[c]) && (o = (s ? d(
|
|
79
|
-
return s && o && f(
|
|
76
|
+
var f = Object.defineProperty, v = Object.getOwnPropertyDescriptor, r = (e, t, n, s) => {
|
|
77
|
+
for (var o = s > 1 ? void 0 : s ? v(t, n) : t, c = e.length - 1, d; c >= 0; c--)
|
|
78
|
+
(d = e[c]) && (o = (s ? d(t, n, o) : d(o)) || o);
|
|
79
|
+
return s && o && f(t, n, o), o;
|
|
80
80
|
};
|
|
81
81
|
let i = class extends k {
|
|
82
82
|
constructor() {
|
|
@@ -87,11 +87,20 @@ let i = class extends k {
|
|
|
87
87
|
this.emitCookieConsents(e);
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
|
+
returnJsonOrObject(e) {
|
|
91
|
+
let t;
|
|
92
|
+
try {
|
|
93
|
+
t = JSON.parse(e);
|
|
94
|
+
} catch {
|
|
95
|
+
t = e;
|
|
96
|
+
}
|
|
97
|
+
return t;
|
|
98
|
+
}
|
|
90
99
|
emitCookieConsents(e) {
|
|
91
|
-
const
|
|
100
|
+
const n = this.returnJsonOrObject(e.value).items.reduce((s, o) => (s[o.name] = o.consent, s), {});
|
|
92
101
|
this.dispatchEvent(
|
|
93
102
|
new CustomEvent("toggle-consent", {
|
|
94
|
-
detail:
|
|
103
|
+
detail: n,
|
|
95
104
|
bubbles: !0,
|
|
96
105
|
composed: !0
|
|
97
106
|
})
|
|
@@ -100,12 +109,12 @@ let i = class extends k {
|
|
|
100
109
|
firstUpdated(e) {
|
|
101
110
|
if (!document.querySelector("#oslo-consent-script") && window.location.hostname.toLowerCase().includes("oslo.kommune.no")) {
|
|
102
111
|
window.googleAnalyticsId = this.googleAnalyticsId, window.hotjarId = this.hotjarId;
|
|
103
|
-
const
|
|
104
|
-
|
|
112
|
+
const t = document.createElement("script");
|
|
113
|
+
t.src = "https://cdn.web.oslo.kommune.no/cb/cb-v1.0.0.js", t.id = "oslo-consent-script", t.onload = () => {
|
|
105
114
|
this.triggerInit();
|
|
106
|
-
}, document.head.appendChild(
|
|
107
|
-
const
|
|
108
|
-
|
|
115
|
+
}, document.head.appendChild(t);
|
|
116
|
+
const n = document.createElement("link");
|
|
117
|
+
n.href = "https://cdn.web.oslo.kommune.no/cb/cb-v1.0.0.css", n.type = "text/css", n.rel = "stylesheet", n.id = "oslo-consent-styles", document.head.appendChild(n);
|
|
109
118
|
}
|
|
110
119
|
}
|
|
111
120
|
triggerInit() {
|
|
@@ -116,8 +125,8 @@ let i = class extends k {
|
|
|
116
125
|
})
|
|
117
126
|
), window.cookieBanner.cookieConsent.validateConsentCookie().then((e) => {
|
|
118
127
|
if (e) {
|
|
119
|
-
const
|
|
120
|
-
this.emitCookieConsents(
|
|
128
|
+
const n = { value: window.cookieBanner.cookieConsent.getConsentCookie() };
|
|
129
|
+
this.emitCookieConsents(n);
|
|
121
130
|
}
|
|
122
131
|
});
|
|
123
132
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const s=require("./element-BSypUpzA.cjs");require("./button-ZkEpUrbJ.cjs");require("./icon-BnKGwYjj.cjs");const g={i18n:{nb:{contentPresentation:{title:"Oslo kommune bruker informasjonskapsler",description:["For at nettstedet skal fungere og være trygt, bruker Oslo kommune informasjonskapsler. Noen er teknisk nødvendige, mens andre sikrer ulik funksjonalitet.","Godtar du alle informasjonskapsler, tillater du også at vi samler inn data om statistikk og brukeradferd. Da hjelper du oss med å lage et bedre nettsted uten at du trenger å dele noe personlig informasjon med oss."],buttons:{accept:"Godta alle",reject:"Kun nødvendige",settings:"Innstillinger for informasjonskapsler"}},contentSettings:{title:"Innstillinger for informasjonskapsler",description:["Her kan du velge hvilke typer informasjonskapsler du vil tillate. Tillatelsen gjelder i 90 dager. Husk at nødvendige informasjonskapsler ikke kan velges bort.","Du kan når som helst endre innstillingene og finne mer informasjon nederst på nettstedet under «Innstillinger for informasjonskapsler» og «Personvern og informasjonskapsler»."],buttons:{back:"Tilbake",save:"Lagre innstillinger"}}},en:{contentPresentation:{title:"Before you visit Oslo kommune ...",description:["This website uses cookies to make improvements. In this context, we need your consent to measure the traffic on the website in relation to statistics and feedback.","To read more about what we use cookies for, go to our privacy declaration which you will find at the bottom of our websites."],buttons:{accept:"Yes, I accept",reject:"Only necessary",settings:"Go to settings"}},contentSettings:{title:"Her kan du aktivt velge mellom ulike informasjonskapsler",description:["For å lese mer om hva vi bruker informasjonskapsler til gå til vår personvernserklering som du finner på våre nettsider"],buttons:{back:"Back",save:"Save settings"}}}}},c=globalThis,d=c.__cookieEvents||{events:{},on(
|
|
1
|
+
"use strict";const s=require("./element-BSypUpzA.cjs");require("./button-ZkEpUrbJ.cjs");require("./icon-BnKGwYjj.cjs");const g={i18n:{nb:{contentPresentation:{title:"Oslo kommune bruker informasjonskapsler",description:["For at nettstedet skal fungere og være trygt, bruker Oslo kommune informasjonskapsler. Noen er teknisk nødvendige, mens andre sikrer ulik funksjonalitet.","Godtar du alle informasjonskapsler, tillater du også at vi samler inn data om statistikk og brukeradferd. Da hjelper du oss med å lage et bedre nettsted uten at du trenger å dele noe personlig informasjon med oss."],buttons:{accept:"Godta alle",reject:"Kun nødvendige",settings:"Innstillinger for informasjonskapsler"}},contentSettings:{title:"Innstillinger for informasjonskapsler",description:["Her kan du velge hvilke typer informasjonskapsler du vil tillate. Tillatelsen gjelder i 90 dager. Husk at nødvendige informasjonskapsler ikke kan velges bort.","Du kan når som helst endre innstillingene og finne mer informasjon nederst på nettstedet under «Innstillinger for informasjonskapsler» og «Personvern og informasjonskapsler»."],buttons:{back:"Tilbake",save:"Lagre innstillinger"}}},en:{contentPresentation:{title:"Before you visit Oslo kommune ...",description:["This website uses cookies to make improvements. In this context, we need your consent to measure the traffic on the website in relation to statistics and feedback.","To read more about what we use cookies for, go to our privacy declaration which you will find at the bottom of our websites."],buttons:{accept:"Yes, I accept",reject:"Only necessary",settings:"Go to settings"}},contentSettings:{title:"Her kan du aktivt velge mellom ulike informasjonskapsler",description:["For å lese mer om hva vi bruker informasjonskapsler til gå til vår personvernserklering som du finner på våre nettsider"],buttons:{back:"Back",save:"Save settings"}}}}},c=globalThis,d=c.__cookieEvents||{events:{},on(n,e){this.events[n]||(this.events[n]=[]),this.events[n].push(e)},off(n,e){this.events[n]&&(this.events[n]=this.events[n].filter(t=>t!==e))},once(n,e){const t=o=>{this.off(n,t),e(o)};this.on(n,t)},emit(n,e){this.events[n]&&this.events[n].forEach(t=>t(e))}};c.__cookieEvents=d;const k=d;var u=Object.defineProperty,p=Object.getOwnPropertyDescriptor,a=(n,e,t,o)=>{for(var i=o>1?void 0:o?p(e,t):e,r=n.length-1,l;r>=0;r--)(l=n[r])&&(i=(o?l(e,t,i):l(i))||i);return o&&i&&u(e,t,i),i};exports.PktConsent=class extends s.PktElement{constructor(){super(),this.hotjarId=null,this.googleAnalyticsId=null,this.triggerType="button",this.triggerText=null,this.i18nLanguage="nb"}connectedCallback(){super.connectedCallback(),this.triggerText=this.triggerText||g.i18n[this.i18nLanguage].contentPresentation.buttons.settings,this.googleAnalyticsId&&(window.googleAnalyticsId=this.googleAnalyticsId),this.hotjarId&&(window.hotjarId=this.hotjarId),k.on("CookieManager.setCookie",e=>{this.emitCookieConsents(e)})}returnJsonOrObject(e){let t;try{t=JSON.parse(e)}catch{t=e}return t}emitCookieConsents(e){const o=this.returnJsonOrObject(e.value).items.reduce((i,r)=>(i[r.name]=r.consent,i),{});this.dispatchEvent(new CustomEvent("toggle-consent",{detail:o,bubbles:!0,composed:!0}))}firstUpdated(e){if(!document.querySelector("#oslo-consent-script")&&window.location.hostname.toLowerCase().includes("oslo.kommune.no")){window.googleAnalyticsId=this.googleAnalyticsId,window.hotjarId=this.hotjarId;const t=document.createElement("script");t.src="https://cdn.web.oslo.kommune.no/cb/cb-v1.0.0.js",t.id="oslo-consent-script",t.onload=()=>{this.triggerInit()},document.head.appendChild(t);const o=document.createElement("link");o.href="https://cdn.web.oslo.kommune.no/cb/cb-v1.0.0.css",o.type="text/css",o.rel="stylesheet",o.id="oslo-consent-styles",document.head.appendChild(o)}}triggerInit(){window.document.dispatchEvent(new Event("DOMContentLoaded",{bubbles:!0,cancelable:!0})),window.cookieBanner.cookieConsent.validateConsentCookie().then(e=>{if(e){const o={value:window.cookieBanner.cookieConsent.getConsentCookie()};this.emitCookieConsents(o)}})}openModal(e){e.preventDefault(),window.cookieBanner.cookieConsent||this.triggerInit(),setTimeout(()=>window.cookieBanner.openCookieModal())}render(){return this.triggerType==="link"?s.x`<a href="#" class="pkt-link" @click=${this.openModal}>${this.triggerText}</a>`:this.triggerType==="footerlink"?s.x`<a href="#" class="pkt-footer__link" @click=${this.openModal}>
|
|
2
2
|
<pkt-icon name="chevron-right" class="pkt-footer__link-icon"></pkt-icon>
|
|
3
3
|
${this.triggerText}
|
|
4
4
|
</a>`:this.triggerType==="icon"?s.x`<pkt-button
|
package/dist/index.d.ts
CHANGED
|
@@ -571,6 +571,7 @@ export declare class PktConsent extends PktElement<IPktConsent> implements IPktC
|
|
|
571
571
|
i18nLanguage: string;
|
|
572
572
|
constructor();
|
|
573
573
|
connectedCallback(): void;
|
|
574
|
+
returnJsonOrObject(obj: any): any;
|
|
574
575
|
emitCookieConsents(consent: any): void;
|
|
575
576
|
protected firstUpdated(_changedProperties: PropertyValues): void;
|
|
576
577
|
triggerInit(): void;
|
package/dist/pkt-consent.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./consent-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./consent-CSspmVST.cjs"),t=e.PktConsent;Object.defineProperty(exports,"PktConsent",{enumerable:!0,get:()=>e.PktConsent});exports.default=t;
|
package/dist/pkt-consent.js
CHANGED
package/dist/pkt-index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("./alert-C2EPmB0W.cjs"),l=require("./accordionitem-RFwXQC_0.cjs"),d=require("./backlink-HHM21crL.cjs"),b=require("./button-ZkEpUrbJ.cjs"),k=require("./calendar-CYY42kN4.cjs"),m=require("./card-DH-3qNgp.cjs"),g=require("./combobox-BokBs9Jo.cjs"),h=require("./consent-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("./alert-C2EPmB0W.cjs"),l=require("./accordionitem-RFwXQC_0.cjs"),d=require("./backlink-HHM21crL.cjs"),b=require("./button-ZkEpUrbJ.cjs"),k=require("./calendar-CYY42kN4.cjs"),m=require("./card-DH-3qNgp.cjs"),g=require("./combobox-BokBs9Jo.cjs"),h=require("./consent-CSspmVST.cjs"),f=require("./checkbox-B7ObRUbU.cjs"),t=require("./element-BSypUpzA.cjs"),y=require("./pkt-slot-controller-Da-RgXfS.cjs"),s=require("./ref-BvbyvXRH.cjs"),O=require("./class-map-DCyaICmy.cjs"),j=require("./datepicker-B767w-e9.cjs"),q=require("./helptext-bMgnhZ1R.cjs"),x=require("./heading-BnJhJDMD.cjs"),C=require("./icon-BnKGwYjj.cjs"),v=require("./input-wrapper-B-f_SotM.cjs"),S=require("./link-BrDbM3GT.cjs"),$=require("./linkcard-s9yoOq90.cjs"),L=require("./loader-Bk4XPiOY.cjs"),_=require("./messagebox-B0kgftoP.cjs"),A=require("./modal-DZY4gZCQ.cjs"),B=require("./progressbar-DiRfScnB.cjs"),p=require("./radiobutton-DP6RsaQc.cjs"),T=require("./tag-B9kFYxHg.cjs"),I=require("./textarea-DIZf7CVg.cjs"),M=require("./textinput-DMPRHokX.cjs"),R=require("./select-CQs_BAKs.cjs");var H=Object.defineProperty,w=Object.getOwnPropertyDescriptor,o=(a,e,r,i)=>{for(var n=i>1?void 0:i?w(e,r):e,u=a.length-1,c;u>=0;u--)(c=a[u])&&(n=(i?c(e,r,n):c(n))||n);return i&&n&&H(e,r,n),n};exports.PktComponent=class extends t.PktElement{constructor(){super(),this.string="",this.strings=[],this.darkmode=!1,this._list=[],this.defaultSlot=s.e(),this.namedSlot=s.e(),this.slotController=new y.PktSlotController(this,this.defaultSlot,this.namedSlot)}connectedCallback(){this.strings.length&&this.strings.forEach(e=>{this._list.push(e.toUpperCase())}),super.connectedCallback()}render(){const e={"pkt-component":!0,"pkt-component--has-list":this.strings.length>0,"pkt-darkmode":this.darkmode};return t.x`
|
|
2
2
|
<div class="${O.e(e)}">
|
|
3
3
|
<h1 class="pkt-txt-28">${this.string}</h1>
|
|
4
4
|
|
package/dist/pkt-index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { c as f } from "./calendar-KDcOWD6V.js";
|
|
|
6
6
|
import { P as D } from "./calendar-KDcOWD6V.js";
|
|
7
7
|
import { P as G } from "./card-Cyww1yKr.js";
|
|
8
8
|
import { P as K } from "./combobox-CnnTPWcA.js";
|
|
9
|
-
import { P as U } from "./consent-
|
|
9
|
+
import { P as U } from "./consent-BPZ8QV7q.js";
|
|
10
10
|
import { P as q } from "./checkbox-DCjl4VM0.js";
|
|
11
11
|
import { P as k, t as h, x as P, n, a as c } from "./element-DjjF_tEh.js";
|
|
12
12
|
import { P as x } from "./pkt-slot-controller-DtDaD9q_.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oslokommune/punkt-elements",
|
|
3
|
-
"version": "12.37.
|
|
3
|
+
"version": "12.37.6",
|
|
4
4
|
"description": "Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo",
|
|
5
5
|
"homepage": "https://punkt.oslo.kommune.no",
|
|
6
6
|
"author": "Team Designsystem, Oslo Origo",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"url": "https://github.com/oslokommune/punkt/issues"
|
|
60
60
|
},
|
|
61
61
|
"license": "MIT",
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "424c529acc9bd6f1ce9063cd79e7e39bcdac27a2"
|
|
63
63
|
}
|
|
@@ -54,8 +54,18 @@ export class PktConsent extends PktElement<IPktConsent> implements IPktConsent {
|
|
|
54
54
|
})
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
returnJsonOrObject(obj: any) {
|
|
58
|
+
let returnObj
|
|
59
|
+
try {
|
|
60
|
+
returnObj = JSON.parse(obj)
|
|
61
|
+
} catch (e) {
|
|
62
|
+
returnObj = obj
|
|
63
|
+
}
|
|
64
|
+
return returnObj
|
|
65
|
+
}
|
|
66
|
+
|
|
57
67
|
emitCookieConsents(consent: any) {
|
|
58
|
-
const consents =
|
|
68
|
+
const consents = this.returnJsonOrObject(consent.value)
|
|
59
69
|
|
|
60
70
|
const consentDetails = consents.items.reduce((acc: any, item: any) => {
|
|
61
71
|
acc[item.name] = item.consent
|
|
@@ -107,7 +117,7 @@ export class PktConsent extends PktElement<IPktConsent> implements IPktConsent {
|
|
|
107
117
|
window.cookieBanner.cookieConsent.validateConsentCookie().then((response: boolean) => {
|
|
108
118
|
if (response) {
|
|
109
119
|
const cookie = window.cookieBanner.cookieConsent.getConsentCookie()
|
|
110
|
-
const consents = { value: cookie
|
|
120
|
+
const consents = { value: cookie }
|
|
111
121
|
this.emitCookieConsents(consents)
|
|
112
122
|
}
|
|
113
123
|
})
|