New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@fremtind/jkl-cookie-consent-react

Package Overview
Dependencies
Maintainers
0
Versions
252
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fremtind/jkl-cookie-consent-react - npm Package Compare versions

Comparing version 10.2.40 to 10.2.41

16

build/cjs/consents/CustomConsents.js

@@ -6,4 +6,18 @@ "use strict";

var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __export = (target, all) => {

@@ -59,3 +73,3 @@ for (var name in all)

);
return /* @__PURE__ */ import_react.default.createElement(import_jkl_modal_react.Modal, { component: "form", ...modalConfig.modal, ...{ onSubmit } }, /* @__PURE__ */ import_react.default.createElement(import_jkl_modal_react.ModalHeader, null, /* @__PURE__ */ import_react.default.createElement(import_jkl_modal_react.ModalTitle, { ...modalConfig.title }, "Informasjonskapsler")), /* @__PURE__ */ import_react.default.createElement(import_jkl_modal_react.ModalBody, null, /* @__PURE__ */ import_react.default.createElement(import_jkl_list_react.UnorderedList, { className: "jkl-cookie-consent-modal__checklist" }, /* @__PURE__ */ import_react.default.createElement(import_jkl_list_react.CheckListItem, null, "Nettsidene skal fungere teknisk")), /* @__PURE__ */ import_react.default.createElement("p", { className: "jkl-cookie-consent-modal__info-text" }, "For at nettsidene skal fungere, m\xE5 vi bruke tekniske informasjonskapsler. Denne kan derfor ikke sl\xE5s av."), requirement.functional && /* @__PURE__ */ import_react.default.createElement(
return /* @__PURE__ */ import_react.default.createElement(import_jkl_modal_react.Modal, __spreadValues(__spreadValues({ component: "form" }, modalConfig.modal), { onSubmit }), /* @__PURE__ */ import_react.default.createElement(import_jkl_modal_react.ModalHeader, null, /* @__PURE__ */ import_react.default.createElement(import_jkl_modal_react.ModalTitle, __spreadValues({}, modalConfig.title), "Informasjonskapsler")), /* @__PURE__ */ import_react.default.createElement(import_jkl_modal_react.ModalBody, null, /* @__PURE__ */ import_react.default.createElement(import_jkl_list_react.UnorderedList, { className: "jkl-cookie-consent-modal__checklist" }, /* @__PURE__ */ import_react.default.createElement(import_jkl_list_react.CheckListItem, null, "Nettsidene skal fungere teknisk")), /* @__PURE__ */ import_react.default.createElement("p", { className: "jkl-cookie-consent-modal__info-text" }, "For at nettsidene skal fungere, m\xE5 vi bruke tekniske informasjonskapsler. Denne kan derfor ikke sl\xE5s av."), requirement.functional && /* @__PURE__ */ import_react.default.createElement(
import_RequirementCheckbox.RequirementCheckbox,

@@ -62,0 +76,0 @@ {

"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __export = (target, all) => {

@@ -48,9 +65,9 @@ for (var name in all)

);
return /* @__PURE__ */ import_react.default.createElement(import_jkl_modal_react.Modal, { component: "form", ...modalConfig.modal, ...{ onSubmit } }, /* @__PURE__ */ import_react.default.createElement(import_jkl_modal_react.ModalHeader, null, /* @__PURE__ */ import_react.default.createElement(import_jkl_modal_react.ModalTitle, { ...modalConfig.title }, "Vi bruker informasjonskapsler slik at:")), /* @__PURE__ */ import_react.default.createElement(import_jkl_modal_react.ModalBody, null, /* @__PURE__ */ import_react.default.createElement(import_jkl_list_react.UnorderedList, { className: "jkl-cookie-consent-modal__checklist" }, /* @__PURE__ */ import_react.default.createElement(import_jkl_list_react.CheckListItem, null, "Nettsidene skal fungere teknisk"), requirement.functional && /* @__PURE__ */ import_react.default.createElement(import_jkl_list_react.CheckListItem, null, "Nettsidene skal tilpasses din bruk, dine valg og dine innstillinger."), requirement.statistics && /* @__PURE__ */ import_react.default.createElement(import_jkl_list_react.CheckListItem, null, "Vi kan samle statistikk p\xE5 hvordan nettsidene brukes og dermed kunne forbedre tjenestene v\xE5re."), requirement.marketing && /* @__PURE__ */ import_react.default.createElement(import_jkl_list_react.CheckListItem, null, "Vi kan gi deg personlig tilpasset innhold og relevante annonser, ogs\xE5 gjennom v\xE5re samarbeidspartnere, p\xE5 for eksempel nettsider og i sosiale medier."))), /* @__PURE__ */ import_react.default.createElement(import_jkl_modal_react.ModalActions, null, /* @__PURE__ */ import_react.default.createElement(
return /* @__PURE__ */ import_react.default.createElement(import_jkl_modal_react.Modal, __spreadValues(__spreadValues({ component: "form" }, modalConfig.modal), { onSubmit }), /* @__PURE__ */ import_react.default.createElement(import_jkl_modal_react.ModalHeader, null, /* @__PURE__ */ import_react.default.createElement(import_jkl_modal_react.ModalTitle, __spreadValues({}, modalConfig.title), "Vi bruker informasjonskapsler slik at:")), /* @__PURE__ */ import_react.default.createElement(import_jkl_modal_react.ModalBody, null, /* @__PURE__ */ import_react.default.createElement(import_jkl_list_react.UnorderedList, { className: "jkl-cookie-consent-modal__checklist" }, /* @__PURE__ */ import_react.default.createElement(import_jkl_list_react.CheckListItem, null, "Nettsidene skal fungere teknisk"), requirement.functional && /* @__PURE__ */ import_react.default.createElement(import_jkl_list_react.CheckListItem, null, "Nettsidene skal tilpasses din bruk, dine valg og dine innstillinger."), requirement.statistics && /* @__PURE__ */ import_react.default.createElement(import_jkl_list_react.CheckListItem, null, "Vi kan samle statistikk p\xE5 hvordan nettsidene brukes og dermed kunne forbedre tjenestene v\xE5re."), requirement.marketing && /* @__PURE__ */ import_react.default.createElement(import_jkl_list_react.CheckListItem, null, "Vi kan gi deg personlig tilpasset innhold og relevante annonser, ogs\xE5 gjennom v\xE5re samarbeidspartnere, p\xE5 for eksempel nettsider og i sosiale medier."))), /* @__PURE__ */ import_react.default.createElement(import_jkl_modal_react.ModalActions, null, /* @__PURE__ */ import_react.default.createElement(
import_jkl_button_react.PrimaryButton,
{
"data-testid": "jkl-cookie-consent-godta",
...modalConfig.closeButton,
__spreadProps(__spreadValues({
"data-testid": "jkl-cookie-consent-godta"
}, modalConfig.closeButton), {
type: "submit"
},
}),
"Godta"

@@ -57,0 +74,0 @@ ), /* @__PURE__ */ import_react.default.createElement(

49

build/cjs/CookieConsent.js
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
var __export = (target, all) => {

@@ -39,7 +68,10 @@ for (var name in all)

var import_cookieConsentUtils = require("./cookieConsentUtils");
const CookieConsent = ({
blocking,
onAccept,
...rest
}) => {
const CookieConsent = (_a) => {
var _b = _a, {
blocking,
onAccept
} = _b, rest = __objRest(_b, [
"blocking",
"onAccept"
]);
const { dispatch, consent, cookieName, cookieDomain } = (0, import_CookieConsentContext.useCookieConsentState)();

@@ -68,6 +100,3 @@ const prevConsent = (0, import_jkl_react_hooks.usePreviousValue)(consent);

);
const updatedConsent = {
...consent,
...newConsentWithoutNullValues
};
const updatedConsent = __spreadValues(__spreadValues({}, consent), newConsentWithoutNullValues);
dispatch({ type: "UPDATE_CONSENT", payload: updatedConsent });

@@ -82,3 +111,3 @@ dispatch({ type: "SET_SHOW_CONSENT", payload: false });

if (blocking) {
return /* @__PURE__ */ import_react.default.createElement(import_CookieConsentModal.CookieConsentModal, { ...rest, onAccept: handleAccept });
return /* @__PURE__ */ import_react.default.createElement(import_CookieConsentModal.CookieConsentModal, __spreadProps(__spreadValues({}, rest), { onAccept: handleAccept }));
}

@@ -85,0 +114,0 @@ return null;

"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __export = (target, all) => {

@@ -44,24 +61,15 @@ for (var name in all)

case "SET_SHOW_CONSENT":
return { ...state, isOpen: action.payload };
return __spreadProps(__spreadValues({}, state), { isOpen: action.payload });
case "SET_SHOW_SETTINGS":
return {
...state,
return __spreadProps(__spreadValues({}, state), {
showSettings: action.payload
};
});
case "UPDATE_CONSENT":
return {
...state,
consent: {
...state.consent,
...action.payload
}
};
return __spreadProps(__spreadValues({}, state), {
consent: __spreadValues(__spreadValues({}, state.consent), action.payload)
});
case "UPDATE_REQUIREMENTS":
return {
...state,
requirement: {
...state.requirement,
...action.payload
}
};
return __spreadProps(__spreadValues({}, state), {
requirement: __spreadValues(__spreadValues({}, state.requirement), action.payload)
});
default: {

@@ -116,8 +124,7 @@ throw new Error("Unhandled action type: ".concat(action.type));

}
return {
return __spreadValues({
dispatch: context.dispatch,
cookieName: context.cookieName,
cookieDomain: context.cookieDomain,
...context.state
};
cookieDomain: context.cookieDomain
}, context.state);
};

@@ -124,0 +131,0 @@ const useCookieConsent = () => {

"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
var __export = (target, all) => {

@@ -42,6 +71,8 @@ for (var name in all)

var import_cookieConsentUtils = require("./cookieConsentUtils");
const CookieConsentModal = ({
onAccept,
...rest
}) => {
const CookieConsentModal = (_a) => {
var _b = _a, {
onAccept
} = _b, rest = __objRest(_b, [
"onAccept"
]);
const { isOpen, requirement, showSettings } = (0, import_CookieConsentContext.useCookieConsentState)();

@@ -86,8 +117,6 @@ const handleAccept = (0, import_react.useCallback)(

import_jkl_modal_react.ModalContainer,
{
...rest,
...modalConfig.container,
__spreadProps(__spreadValues(__spreadValues({}, rest), modalConfig.container), {
"data-testautoid": "jkl-cookie-consent-modal"
},
/* @__PURE__ */ import_react.default.createElement(import_jkl_modal_react.ModalOverlay, { ...modalConfig.overlay }),
}),
/* @__PURE__ */ import_react.default.createElement(import_jkl_modal_react.ModalOverlay, __spreadValues({}, modalConfig.overlay)),
showSettings ? /* @__PURE__ */ import_react.default.createElement(

@@ -94,0 +123,0 @@ import_CustomConsents.CustomConsents,

@@ -5,3 +5,17 @@ "use strict";

var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __export = (target, all) => {

@@ -105,3 +119,3 @@ for (var name in all)

const consentEntries = Object.entries(
{ ...defaultConsent, ...consent }
__spreadValues(__spreadValues({}, defaultConsent), consent)
).map(([consentName, value]) => [

@@ -128,3 +142,3 @@ consentName,

};
const consentEntries = Object.entries({ ...defaultObject, ...consent }).map(
const consentEntries = Object.entries(__spreadValues(__spreadValues({}, defaultObject), consent)).map(
([consentName, value]) => [

@@ -142,8 +156,4 @@ consentName,

}) => {
return {
...marketing && { marketing },
...functional && { functional },
...statistics && { statistics }
};
return __spreadValues(__spreadValues(__spreadValues({}, marketing && { marketing }), functional && { functional }), statistics && { statistics });
};
//# sourceMappingURL=cookieConsentUtils.js.map

@@ -1,2 +0,1 @@

/// <reference types="react" />
import { AcceptConsentCallback } from "./types";

@@ -3,0 +2,0 @@ export interface CookieConsentProps {

import type { Consent, ConsentRequirement, ConsentState } from "./types";
export declare const getConsentCookie: ({ adapter, name, }: {
adapter?: (() => Consent | undefined) | undefined;
adapter?: () => Consent | undefined;
name: string;

@@ -8,5 +8,5 @@ }) => Consent | undefined;

consent: Consent;
maxAge?: number | undefined;
maxAge?: number;
name: string;
domain?: string | undefined;
domain?: string;
}) => void;

@@ -13,0 +13,0 @@ export declare const shouldShowConsentDialog: (requirement: ConsentRequirement, consent: Consent | undefined) => boolean;

@@ -0,1 +1,17 @@

var __defProp = Object.defineProperty;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
import { PrimaryButton } from "@fremtind/jkl-button-react";

@@ -31,3 +47,3 @@ import { CheckListItem, UnorderedList } from "@fremtind/jkl-list-react";

);
return /* @__PURE__ */ React.createElement(Modal, { component: "form", ...modalConfig.modal, ...{ onSubmit } }, /* @__PURE__ */ React.createElement(ModalHeader, null, /* @__PURE__ */ React.createElement(ModalTitle, { ...modalConfig.title }, "Informasjonskapsler")), /* @__PURE__ */ React.createElement(ModalBody, null, /* @__PURE__ */ React.createElement(UnorderedList, { className: "jkl-cookie-consent-modal__checklist" }, /* @__PURE__ */ React.createElement(CheckListItem, null, "Nettsidene skal fungere teknisk")), /* @__PURE__ */ React.createElement("p", { className: "jkl-cookie-consent-modal__info-text" }, "For at nettsidene skal fungere, m\xE5 vi bruke tekniske informasjonskapsler. Denne kan derfor ikke sl\xE5s av."), requirement.functional && /* @__PURE__ */ React.createElement(
return /* @__PURE__ */ React.createElement(Modal, __spreadValues(__spreadValues({ component: "form" }, modalConfig.modal), { onSubmit }), /* @__PURE__ */ React.createElement(ModalHeader, null, /* @__PURE__ */ React.createElement(ModalTitle, __spreadValues({}, modalConfig.title), "Informasjonskapsler")), /* @__PURE__ */ React.createElement(ModalBody, null, /* @__PURE__ */ React.createElement(UnorderedList, { className: "jkl-cookie-consent-modal__checklist" }, /* @__PURE__ */ React.createElement(CheckListItem, null, "Nettsidene skal fungere teknisk")), /* @__PURE__ */ React.createElement("p", { className: "jkl-cookie-consent-modal__info-text" }, "For at nettsidene skal fungere, m\xE5 vi bruke tekniske informasjonskapsler. Denne kan derfor ikke sl\xE5s av."), requirement.functional && /* @__PURE__ */ React.createElement(
RequirementCheckbox,

@@ -34,0 +50,0 @@ {

@@ -0,1 +1,20 @@

var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
import { PrimaryButton, TertiaryButton } from "@fremtind/jkl-button-react";

@@ -21,9 +40,9 @@ import { CheckListItem, UnorderedList } from "@fremtind/jkl-list-react";

);
return /* @__PURE__ */ React.createElement(Modal, { component: "form", ...modalConfig.modal, ...{ onSubmit } }, /* @__PURE__ */ React.createElement(ModalHeader, null, /* @__PURE__ */ React.createElement(ModalTitle, { ...modalConfig.title }, "Vi bruker informasjonskapsler slik at:")), /* @__PURE__ */ React.createElement(ModalBody, null, /* @__PURE__ */ React.createElement(UnorderedList, { className: "jkl-cookie-consent-modal__checklist" }, /* @__PURE__ */ React.createElement(CheckListItem, null, "Nettsidene skal fungere teknisk"), requirement.functional && /* @__PURE__ */ React.createElement(CheckListItem, null, "Nettsidene skal tilpasses din bruk, dine valg og dine innstillinger."), requirement.statistics && /* @__PURE__ */ React.createElement(CheckListItem, null, "Vi kan samle statistikk p\xE5 hvordan nettsidene brukes og dermed kunne forbedre tjenestene v\xE5re."), requirement.marketing && /* @__PURE__ */ React.createElement(CheckListItem, null, "Vi kan gi deg personlig tilpasset innhold og relevante annonser, ogs\xE5 gjennom v\xE5re samarbeidspartnere, p\xE5 for eksempel nettsider og i sosiale medier."))), /* @__PURE__ */ React.createElement(ModalActions, null, /* @__PURE__ */ React.createElement(
return /* @__PURE__ */ React.createElement(Modal, __spreadValues(__spreadValues({ component: "form" }, modalConfig.modal), { onSubmit }), /* @__PURE__ */ React.createElement(ModalHeader, null, /* @__PURE__ */ React.createElement(ModalTitle, __spreadValues({}, modalConfig.title), "Vi bruker informasjonskapsler slik at:")), /* @__PURE__ */ React.createElement(ModalBody, null, /* @__PURE__ */ React.createElement(UnorderedList, { className: "jkl-cookie-consent-modal__checklist" }, /* @__PURE__ */ React.createElement(CheckListItem, null, "Nettsidene skal fungere teknisk"), requirement.functional && /* @__PURE__ */ React.createElement(CheckListItem, null, "Nettsidene skal tilpasses din bruk, dine valg og dine innstillinger."), requirement.statistics && /* @__PURE__ */ React.createElement(CheckListItem, null, "Vi kan samle statistikk p\xE5 hvordan nettsidene brukes og dermed kunne forbedre tjenestene v\xE5re."), requirement.marketing && /* @__PURE__ */ React.createElement(CheckListItem, null, "Vi kan gi deg personlig tilpasset innhold og relevante annonser, ogs\xE5 gjennom v\xE5re samarbeidspartnere, p\xE5 for eksempel nettsider og i sosiale medier."))), /* @__PURE__ */ React.createElement(ModalActions, null, /* @__PURE__ */ React.createElement(
PrimaryButton,
{
"data-testid": "jkl-cookie-consent-godta",
...modalConfig.closeButton,
__spreadProps(__spreadValues({
"data-testid": "jkl-cookie-consent-godta"
}, modalConfig.closeButton), {
type: "submit"
},
}),
"Godta"

@@ -30,0 +49,0 @@ ), /* @__PURE__ */ React.createElement(

@@ -0,1 +1,32 @@

var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
import { usePreviousValue } from "@fremtind/jkl-react-hooks";

@@ -6,7 +37,10 @@ import React, { useEffect } from "react";

import { setConsentCookie } from "./cookieConsentUtils";
const CookieConsent = ({
blocking,
onAccept,
...rest
}) => {
const CookieConsent = (_a) => {
var _b = _a, {
blocking,
onAccept
} = _b, rest = __objRest(_b, [
"blocking",
"onAccept"
]);
const { dispatch, consent, cookieName, cookieDomain } = useCookieConsentState();

@@ -35,6 +69,3 @@ const prevConsent = usePreviousValue(consent);

);
const updatedConsent = {
...consent,
...newConsentWithoutNullValues
};
const updatedConsent = __spreadValues(__spreadValues({}, consent), newConsentWithoutNullValues);
dispatch({ type: "UPDATE_CONSENT", payload: updatedConsent });

@@ -49,3 +80,3 @@ dispatch({ type: "SET_SHOW_CONSENT", payload: false });

if (blocking) {
return /* @__PURE__ */ React.createElement(CookieConsentModal, { ...rest, onAccept: handleAccept });
return /* @__PURE__ */ React.createElement(CookieConsentModal, __spreadProps(__spreadValues({}, rest), { onAccept: handleAccept }));
}

@@ -52,0 +83,0 @@ return null;

@@ -0,1 +1,20 @@

var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
import React, { useEffect, useMemo } from "react";

@@ -12,24 +31,15 @@ import {

case "SET_SHOW_CONSENT":
return { ...state, isOpen: action.payload };
return __spreadProps(__spreadValues({}, state), { isOpen: action.payload });
case "SET_SHOW_SETTINGS":
return {
...state,
return __spreadProps(__spreadValues({}, state), {
showSettings: action.payload
};
});
case "UPDATE_CONSENT":
return {
...state,
consent: {
...state.consent,
...action.payload
}
};
return __spreadProps(__spreadValues({}, state), {
consent: __spreadValues(__spreadValues({}, state.consent), action.payload)
});
case "UPDATE_REQUIREMENTS":
return {
...state,
requirement: {
...state.requirement,
...action.payload
}
};
return __spreadProps(__spreadValues({}, state), {
requirement: __spreadValues(__spreadValues({}, state.requirement), action.payload)
});
default: {

@@ -84,8 +94,7 @@ throw new Error("Unhandled action type: ".concat(action.type));

}
return {
return __spreadValues({
dispatch: context.dispatch,
cookieName: context.cookieName,
cookieDomain: context.cookieDomain,
...context.state
};
cookieDomain: context.cookieDomain
}, context.state);
};

@@ -92,0 +101,0 @@ const useCookieConsent = () => {

@@ -0,1 +1,32 @@

var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __objRest = (source, exclude) => {
var target = {};
for (var prop in source)
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
target[prop] = source[prop];
if (source != null && __getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(source)) {
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
target[prop] = source[prop];
}
return target;
};
import {

@@ -13,6 +44,8 @@ ModalContainer,

import { convertBooleanConsentObjectToConsentObject } from "./cookieConsentUtils";
const CookieConsentModal = ({
onAccept,
...rest
}) => {
const CookieConsentModal = (_a) => {
var _b = _a, {
onAccept
} = _b, rest = __objRest(_b, [
"onAccept"
]);
const { isOpen, requirement, showSettings } = useCookieConsentState();

@@ -57,8 +90,6 @@ const handleAccept = useCallback(

ModalContainer,
{
...rest,
...modalConfig.container,
__spreadProps(__spreadValues(__spreadValues({}, rest), modalConfig.container), {
"data-testautoid": "jkl-cookie-consent-modal"
},
/* @__PURE__ */ React.createElement(ModalOverlay, { ...modalConfig.overlay }),
}),
/* @__PURE__ */ React.createElement(ModalOverlay, __spreadValues({}, modalConfig.overlay)),
showSettings ? /* @__PURE__ */ React.createElement(

@@ -65,0 +96,0 @@ CustomConsents,

@@ -0,1 +1,17 @@

var __defProp = Object.defineProperty;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
const getCookie = (name) => {

@@ -74,3 +90,3 @@ if (typeof document === "undefined") {

const consentEntries = Object.entries(
{ ...defaultConsent, ...consent }
__spreadValues(__spreadValues({}, defaultConsent), consent)
).map(([consentName, value]) => [

@@ -97,3 +113,3 @@ consentName,

};
const consentEntries = Object.entries({ ...defaultObject, ...consent }).map(
const consentEntries = Object.entries(__spreadValues(__spreadValues({}, defaultObject), consent)).map(
([consentName, value]) => [

@@ -111,7 +127,3 @@ consentName,

}) => {
return {
...marketing && { marketing },
...functional && { functional },
...statistics && { statistics }
};
return __spreadValues(__spreadValues(__spreadValues({}, marketing && { marketing }), functional && { functional }), statistics && { statistics });
};

@@ -118,0 +130,0 @@ export {

{
"name": "@fremtind/jkl-cookie-consent-react",
"version": "10.2.40",
"version": "10.2.41",
"publishConfig": {

@@ -40,9 +40,9 @@ "access": "public"

"dependencies": {
"@fremtind/jkl-button-react": "^15.2.19",
"@fremtind/jkl-checkbox-react": "^12.0.4",
"@fremtind/jkl-cookie-consent": "^11.0.32",
"@fremtind/jkl-core": "^14.8.8",
"@fremtind/jkl-list-react": "^10.2.25",
"@fremtind/jkl-modal-react": "^2.1.63",
"@fremtind/jkl-react-hooks": "^12.2.12"
"@fremtind/jkl-button-react": "^15.2.20",
"@fremtind/jkl-checkbox-react": "^12.0.5",
"@fremtind/jkl-cookie-consent": "^11.0.33",
"@fremtind/jkl-core": "^14.8.9",
"@fremtind/jkl-list-react": "^10.2.26",
"@fremtind/jkl-modal-react": "^2.1.64",
"@fremtind/jkl-react-hooks": "^12.2.13"
},

@@ -62,3 +62,3 @@ "peerDependencies": {

},
"gitHead": "6ccee5218b9cdfd6ccc542d6b9dd9f630422b2ff"
"gitHead": "76fbf2eee70a9b2c2eaa952a65398a70a25688c9"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc