@cookieyes/core 0.6.0 → 0.8.0
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/dist/{categories-D1vlERV6.d.ts → categories-BRwmnMyp.d.ts} +9 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/integrations.d.ts +1 -1
- package/dist/network-blocker.d.ts +1 -1
- package/package.json +1 -1
|
@@ -260,6 +260,8 @@ type TranslationMap = {
|
|
|
260
260
|
ccpaDescription: string;
|
|
261
261
|
accept: string;
|
|
262
262
|
poweredBy: string;
|
|
263
|
+
/** Appended to the branding link's accessible name; that link opens a new tab. */
|
|
264
|
+
opensInNewTab: string;
|
|
263
265
|
preferencesTitle: string;
|
|
264
266
|
preferencesIntro: string;
|
|
265
267
|
/** Shown in place of a toggle on a category marked `required: true`. */
|
|
@@ -465,6 +467,13 @@ type ConsentManager = ConsentSnapshot & {
|
|
|
465
467
|
showPreferences: () => void;
|
|
466
468
|
hidePreferences: () => void;
|
|
467
469
|
isPreferencesOpen: boolean;
|
|
470
|
+
/** True after {@link ConsentManager.dismissBanner}, until the next page load or reset. */
|
|
471
|
+
isBannerDismissed: boolean;
|
|
472
|
+
/**
|
|
473
|
+
* Hide the banner without a decision: no consent is saved and nothing is
|
|
474
|
+
* granted or denied. The banner comes back on the next page load.
|
|
475
|
+
*/
|
|
476
|
+
dismissBanner: () => void;
|
|
468
477
|
subscribe: (listener: (state: ConsentSnapshot) => void) => () => void;
|
|
469
478
|
registerScript: (entry: ScriptEntry) => void;
|
|
470
479
|
/** Current reload-notice state (see {@link ReloadNoticeState}). */
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("./integrations.cjs"),t=require("./network-blocker--Z2J__Xr.cjs");const o="cookieyes-consent",n=new Set(["consentid","consent","action","tax","lastRenewedDate"]);function r(e){const t={categories:{}};for(const o of e.split(",")){const e=o.indexOf(":");if(-1===e)continue;const r=o.slice(0,e).trim(),s=o.slice(e+1).trim();n.has(r)?t[r]=s:r.length>0&&(t.categories[r]=s)}return t}function s(e){const t=[`consentid:${e.consentId}`,"consent:"+(e.hasActed?"yes":"no"),"action:"+(e.hasActed?"yes":"no")];e.taxonomyHash&&t.push(`tax:${e.taxonomyHash}`);for(const[o,n]of Object.entries(e.categories))t.push(`${o}:${n?"yes":"no"}`);return t.push(`lastRenewedDate:${e.lastRenewed??Date.now()}`),t.join(",")}function i(e){for(const t of e.split(";")){const e=t.trim(),n=e.indexOf("=");if(-1===n)continue;if(e.slice(0,n).trim()!==o)continue;const s=e.slice(n+1).trim();try{return r(decodeURIComponent(s))}catch{return null}}return null}function a(e){if("undefined"==typeof document)return;const t=encodeURIComponent(s(e));document.cookie=`${o}=${t}; max-age=31536000; path=/; SameSite=Lax`}function c(){"undefined"!=typeof document&&(document.cookie=`${o}=; max-age=0; path=/`)}function l(){const e=new Uint8Array(32);if("undefined"!=typeof crypto&&crypto.getRandomValues)crypto.getRandomValues(e);else for(let t=0;t<e.length;t++)e[t]=Math.floor(256*Math.random());return btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"").slice(0,44)}function d(e,t,o){const n={};for(const t of o.ids)n[t]=!!o.requiredIds.has(t)||"yes"===e.categories[t];return{consentId:e.consentid??l(),hasActed:"yes"===e.action,categories:n,regulation:t,lastRenewed:e.lastRenewedDate?Number(e.lastRenewedDate):void 0,taxonomyHash:e.tax}}function u(e,t,o){const n="CCPA"===t,r={};for(const e of o.ids)r[e]=!!o.requiredIds.has(e)||n;return{consentId:e,hasActed:!1,categories:r,regulation:t,taxonomyHash:o.taxonomyHash}}const g=[{id:"necessary",required:!0},{id:"functional",gcm:["functionality_storage","personalization_storage"]},{id:"analytics",gcm:["analytics_storage"]},{id:"performance"},{id:"advertisement",gcm:["ad_storage","ad_user_data","ad_personalization"]}];function f(e){let t=2166136261;for(let o=0;o<e.length;o++)t^=e.charCodeAt(o),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function p(e,t){const o=e.map(e=>e.id),n=new Set(e.filter(e=>e.required).map(e=>e.id)),r=e.map(e=>`${e.id}:${e.required?1:0}:${(e.gcm??[]).join("+")}`).join("|");return{list:e,ids:o,requiredIds:n,taxonomyHash:f(r),isDefault:t}}function h(e){if(!e||0===e.length)return p(g,!0);const t=function(e){const t=e.map(e=>e.id);return t.some(e=>"string"!=typeof e||0===e.length)?"every category needs a non-empty string id":t.some(e=>e.includes(",")||e.includes(":"))?"category ids must not contain ',' or ':'":new Set(t).size!==t.length?"category ids must be unique":t.some(e=>n.has(e))?`category ids must not be one of the reserved keys: ${[...n].join(", ")}`:e.some(e=>!0===e.required)?null:"at least one category must be marked { required: true }"}(e);return t?("undefined"!=typeof console&&console.warn(`[cookieyes] Invalid categories config (${t}). Falling back to the default five (necessary, functional, analytics, performance, advertisement).`),p(g,!0)):p(e,!1)}function y(e){"undefined"!=typeof console&&console.warn(e)}function m(e){const t={mode:e.mode},o=e.overrides?.regulation;return void 0!==e.regulation?(t.regulation=e.regulation,void 0!==o&&y("[CookieYes] Received both `regulation` and the deprecated `overrides.regulation`. Using the top-level `regulation` and ignoring `overrides`. Drop the `overrides` object — it is deprecated and will be removed after three release cycles.")):void 0!==o&&(t.regulation=o),void 0!==e.region&&(t.region=e.region),void 0!==e.colorScheme&&(t.colorScheme=e.colorScheme),void 0!==e.theme&&(t.theme=e.theme),void 0!==e.i18n&&(t.i18n=e.i18n),void 0!==e.categories&&(t.categories=e.categories),void 0!==e.networkBlocker&&(t.networkBlocker=e.networkBlocker),void 0!==e.reloadOnRevoke&&(t.reloadOnRevoke=e.reloadOnRevoke),void 0!==e.googleConsentMatch&&(t.googleConsentMatch=e.googleConsentMatch),void 0!==e.integrations&&(t.integrations=e.integrations),void 0!==e.builtInIntegrations&&(t.builtInIntegrations=e.builtInIntegrations),void 0!==e.customStopHandlers&&(t.customStopHandlers=e.customStopHandlers),void 0!==e.onConsentReady&&(t.onConsentReady=e.onConsentReady),void 0!==e.onConsentUpdate&&(t.onConsentUpdate=e.onConsentUpdate),"self-hosted"===e.mode&&(void 0!==e.apiKey&&(t.apiKey=e.apiKey),void 0!==e.backend&&(t.backend=e.backend),void 0!==e.apiUrl?(t.apiUrl=e.apiUrl,void 0!==e.backendURL&&y("[CookieYes] Received both `apiUrl` and the deprecated `backendURL`. Using `apiUrl` and ignoring `backendURL`. Rename `backendURL` to `apiUrl` — the alias is deprecated and will be removed after three release cycles.")):void 0!==e.backendURL&&(t.apiUrl=e.backendURL)),t}let k=!1;function w(){"production"!==process.env.NODE_ENV&&(k||(k=!0,"undefined"!=typeof console&&console.warn('[cookieyes] mode: "offline" has been renamed to "cookie-only". Both do exactly the same thing, but "offline" is deprecated and will be removed after three release cycles. See https://github.com/cookieyes/cookieyes/blob/main/apps/web/content/docs/migration.mdx for the full migration guide. Update to .mode("cookie-only") (or { mode: "cookie-only" }).')))}let v=!1;function b(){"production"!==process.env.NODE_ENV&&(v||(v=!0,"undefined"!=typeof console&&console.warn("[cookieyes] `builtInIntegrations` (formerly the `integrations` field) is deprecated and will be removed after three release cycles. Use the `integrations` field with a preset from `@cookieyes/scripts` instead. See https://github.com/cookieyes/cookieyes/blob/main/apps/web/content/docs/migration.mdx for the full migration guide.")))}function C(e){const t={save:new Set,change:new Set};let o={...e()};function n(e,t,o){try{e.listener(o)}catch(e){"undefined"!=typeof console&&console.error(`[cookieyes] a consent "${t}" listener threw; others are unaffected:`,e)}}function r(e,o){for(const r of[...t[e]])r.category&&!o.changedCategories.includes(r.category)||n(r,e,o)}return{on(o,r,s){const i=s?.category?{listener:r,category:s.category}:{listener:r};return t[o].add(i),n(i,o,{categories:{...e()},changedCategories:[],isInitial:!0}),()=>{t[o].delete(i)}},push(e){const t={...e},n=[];for(const e of Object.keys(t))o[e]!==t[e]&&n.push(e);o=t,r("save",{categories:t,changedCategories:n,isInitial:!1}),n.length>0&&r("change",{categories:t,changedCategories:n,isInitial:!1})}}}function x(e){"undefined"!=typeof console&&console.warn(`[cookieyes] ${e}`)}const R=["ad_storage","ad_user_data","ad_personalization","analytics_storage","functionality_storage","personalization_storage","security_storage"];function I(e,t,o="any"){const n={};for(const r of R){if("security_storage"===r){n[r]="granted";continue}const s=e.list.filter(e=>e.gcm?.includes(r));if(0===s.length){n[r]="denied";continue}const i="all"===o?s.every(e=>!0===t[e.id]):s.some(e=>!0===t[e.id]);n[r]=i?"granted":"denied"}return n}function S(e,t,o="any"){if("undefined"==typeof window||!Array.isArray(window.dataLayer))return;const n=I(e,t,o),r=window.dataLayer;if(!r)return;!function(){r.push(arguments)}("consent","update",n)}const A={bannerTitle:"We value your privacy",bannerDescription:"We use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking “Accept All”, you consent to our use of cookies.",acceptAll:"Accept All",rejectAll:"Reject All",managePreferences:"Customise",savePreferences:"Save My Preferences",doNotSell:"Do Not Sell or Share My Personal Information",ccpaDescription:"This website or its third-party tools process personal data. You can opt out of the sale of your personal information by clicking on the “Do Not Sell or Share My Personal Information” link.",accept:"Accept",poweredBy:"Powered by CookieYes",preferencesTitle:"Customise Consent Preferences",preferencesIntro:"We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.",alwaysActive:"Always Active",preferencesDialogLabel:"Cookie preferences",optOutDialogLabel:"Opt-out preferences",recallButtonLabel:"Consent Preferences",categories:{necessary:{label:"Necessary",description:"Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data."},functional:{label:"Functional",description:"Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features."},analytics:{label:"Analytics",description:"Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc."},performance:{label:"Performance",description:"Performance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors."},advertisement:{label:"Advertisement",description:"Advertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns."}},optOut:{title:"Opt-out Preferences",description:'We use third-party cookies that help us analyse how you use this website, store your preferences, and provide the content and advertisements that are relevant to you. However, you can opt out of these cookies by checking "Do Not Sell or Share My Personal Information" and clicking the "Save My Preferences" button. Once you opt out, you can opt in again at any time by unchecking "Do Not Sell or Share My Personal Information" and clicking the "Save My Preferences" button.',cancel:"Cancel",successText:"Your opt-out preference has been honored.",successCountdown:"Banner closes automatically in {seconds} s..."},bannerCloseLabel:"Close",preferencesCloseLabel:"Close preferences",optOutCloseLabel:"Close",gatedFrame:{placeholder:"This content requires {category} cookies to be enabled.",action:"Manage Preferences"},reloadNotice:{message:"Some tracking on this page can only be fully stopped by reloading. Reload to apply your change, or dismiss to keep browsing.",reloadButton:"Reload page",dismissButton:"Dismiss"}},O=new Set(["ar","he","fa","ur","ps","sd","yi","dv"]);function _(e){return e.split("-")[0]?.toLowerCase()??""}function U(e){return O.has(_(e))?"rtl":"ltr"}function N(e,t){if(!t)return e;const o={...e};for(const[n,r]of Object.entries(t)){if(null==r)continue;const t=e[n],s="object"==typeof r&&!Array.isArray(r)&&"object"==typeof t&&null!=t;o[n]=s?N(t,r):r}return o}function B(e){const t=e?.messages??{},o=[];e?.locale&&o.push(e.locale),(e?.detectBrowserLanguage??1)&&"undefined"!=typeof navigator&&navigator.language&&o.push(navigator.language);for(const e of o){if(t[e])return e;const o=_(e);if(o&&t[o])return o}return"en"}async function L(){const e=await Promise.resolve().then(function(){return require("./integrations.cjs")});return{runIntegrations:e.runIntegrations,warnOverlappingVendors:e.warnOverlappingVendors,warnUnknownCategories:e.warnUnknownCategories}}function P(e,t){const o={...e?.messages},n=e?.loadLanguage,r=new Set;let s=B(e),i=d(s),a=u();function c(e){return o[e]??o[_(e)]}function l(e){return"en"===_(e)||void 0!==c(e)}function d(e){return N(A,c(e))}function u(){return{language:s,direction:U(s),languages:Array.from(new Set(["en",...Object.keys(o)]))}}function g(e){s=e,i=d(e),a=u(),t()}function f(e,t){r.has(e)||"undefined"==typeof console||(r.add(e),console.warn(`[cookieyes] no translations for language "${e}"; staying on "${s}". Add it to i18n.messages or provide i18n.loadLanguage.`,t??""))}function p(e){return l(e)?(g(e),Promise.resolve()):n?Promise.resolve().then(()=>n(e)).then(t=>{o[e]=t,g(e)}).catch(t=>f(e,t)):(f(e),Promise.resolve())}return n&&e?.locale&&!l(e.locale)&&"undefined"!=typeof window&&p(e.locale),{getTranslations:()=>i,getLanguageInfo:()=>a,setLanguage:p,getCategoryText:function(e){return c(s)?.categories?.[e]}}}const D=new Map,H=new Map;function M(e,t){if(document.getElementById(e))return;const o=document.createElement("script");o.id=e,o.src=t.src,o.async=!0,t.onLoad&&o.addEventListener("load",t.onLoad,{once:!0}),document.head.appendChild(o),H.set(e,o)}function T(e){return"needsReload"in e&&!0===e.needsReload}function j(e){switch(e.vendor){case"meta":return{id:"meta",category:e.category??"advertisement",stop:()=>window.fbq?.("consent","revoke"),resume:()=>window.fbq?.("consent","grant")};case"tiktok":return{id:"tiktok",category:e.category??"advertisement",needsReload:!0};case"linkedin":return{id:"linkedin",category:e.category??"advertisement",needsReload:!0};case"hotjar":return{id:"hotjar",category:e.category??"analytics",needsReload:!0};case"segment":return{id:"segment",category:e.category??"analytics",needsReload:!0}}}const $=new Map,q=new Set,E=new Set;function V(e){$.set(e.id,e)}function F(e){const t=[];for(const o of $.values()){const n=!0!==e[o.category];if(T(o))n?E.has(o.id)&&(t.push(o.id),E.delete(o.id)):E.add(o.id);else if(n){if(!q.has(o.id))try{o.stop(),q.add(o.id)}catch{t.push(o.id)}}else if(q.has(o.id)){q.delete(o.id);try{o.resume?.()}catch{}}}return{reloadRequiredBy:t}}function z(e,t){const o={consentId:e.consentId,categories:e.categories,regulation:e.regulation,domain:"undefined"!=typeof window?window.location.hostname:"unknown"};return t&&(o.region=t),o}function G(e){const t=new Set,o=h(e.categories),n=e.googleConsentMatch??"any";let r;void 0===e.googleConsentMatch&&function(e){const t=new Map;for(const o of e.list)for(const e of o.gcm??[]){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(o.id)}for(const[e,o]of t)o.size<=1||x(`categories ${[...o].map(e=>JSON.stringify(e)).join(", ")} all map to the Google signal "${e}", which is a single on/off — this mapping is lossy. Set \`googleConsentMatch: "all"\` to grant it only when all are granted, or "any" (default) to grant it when any is.`)}(o);let s,g,f=!1;function p(e){const t={};for(const n of o.ids)t[n]=!!o.requiredIds.has(n)||e(n);return t}let y=[],m=!1;for(const t of e.integrations??[])V(j(t));for(const t of e.customStopHandlers??[])V(t);const k="undefined"==typeof document?null:i(document.cookie),w=e.regulation??"DEFAULT",v=k?.tax,b=v===o.taxonomyHash,C=null!=k&&(b||void 0===v&&o.isDefault);if(null!=k&&C)r=d(k,w,o);else{const e=k?.consentid??l();r=u(e,w,o),null!=k&&c(),"CCPA"===r.regulation&&a(r)}function R(){const e={consentId:r.consentId,hasActed:r.hasActed,categories:{...r.categories},regulation:r.regulation,lastRenewed:r.lastRenewed,taxonomyHash:r.taxonomyHash};for(const o of t)o(e)}function I(){!function(e){if("undefined"!=typeof document)for(const[t,o]of D)!0===e[o.category]&&(H.has(t)||M(t,o))}(g)}function A(){r={...r,hasActed:!0,lastRenewed:Date.now()},a(r);let t=!1;for(const e of o.ids)if(s[e]&&!r.categories[e]){t=!0;break}if(s={...r.categories},g={...r.categories},R(),e.onConsentUpdate?.(r),e.backend)try{Promise.resolve(e.backend.persist(z(r,e.region))).catch(()=>{})}catch{}else e.apiUrl&&async function(e,t,o,n){const r=z(o,n),s={"Content-Type":"application/json"};t&&(s.Authorization=`Bearer ${t}`);try{await fetch(e,{method:"POST",headers:s,body:JSON.stringify(r),keepalive:!0})}catch{}}(e.apiUrl,e.apiKey,r,e.region);try{I()}catch{}let i=!1;try{const{reloadRequiredBy:e}=F(g);i=function(e){const t=e.length!==y.length||e.some((e,t)=>e!==y[t]);return t&&(y=e,m=!1),t}(e)}catch{}try{S(o,g,n)}catch{}i&&R(),t&&e.reloadOnRevoke&&"undefined"!=typeof window&&window.location.reload()}r={...r,taxonomyHash:o.taxonomyHash},e.gpcOptOut&&!r.hasActed&&(r={...r,categories:p(()=>!1)},a(r)),s={...r.categories},g={...r.categories},Promise.resolve().then(()=>e.onConsentReady?.(r));const O={get consentId(){return r.consentId},get hasActed(){return r.hasActed},get categories(){return{...r.categories}},get committedCategories(){return{...g}},get regulation(){return r.regulation},get lastRenewed(){return r.lastRenewed},get taxonomyHash(){return r.taxonomyHash},get isPreferencesOpen(){return f},acceptAll(){r={...r,categories:p(()=>!0)},f=!1,A()},rejectAll(){r={...r,categories:p(()=>!1)},f=!1,A()},acceptSelected(e){r={...r,categories:p(t=>e.includes(t))},f=!1,A()},updateCategory(e,t){o.requiredIds.has(e)||o.ids.includes(e)&&(r={...r,categories:{...r.categories,[e]:t}},R())},savePreferences(){f=!1,A()},resetConsent(){c();const e=l();r=u(e,r.regulation,o),g={...r.categories},s={...r.categories},f=!1,F(g),S(o,g,n),y=[],m=!1,R()},showPreferences(){f=!0,R()},hidePreferences(){f=!1,R()},subscribe:e=>(t.add(e),()=>t.delete(e)),registerScript(e){!function(e){D.set(e.id,e)}(e),I()},get reloadNotice(){return{required:y.length>0&&!m,reasons:[...y]}},dismissReloadNotice(){m||(m=!0,R())}};I();try{!function(e){for(const t of $.values()){const o=!0!==e[t.category];if(T(t))o?E.delete(t.id):E.add(t.id);else try{o?(t.stop(),q.add(t.id)):(q.delete(t.id),t.resume?.())}catch{}}}(r.categories)}catch{}try{S(o,r.categories,n)}catch{}return O}const K=[{country:"x-vercel-ip-country",region:"x-vercel-ip-country-region"},{country:"cf-ipcountry"}];function Y(){return"undefined"!=typeof navigator&&!0===navigator.globalPrivacyControl}function W(e,t){const o=e.strictest??"GDPR";if(t)return e.detect&&"undefined"!=typeof console&&console.warn("[cookieyes] `regulation` is set manually, so region detection is ignored. Remove one of them to clear the conflict."),{region:void 0,regulation:t,source:"manual",confidence:"high"};const n=e.detect?.(),r=n?function(e,t){if(e)return e[t]??e[t.split("-")[0]??""]}(e.map,n):void 0;return{region:n,regulation:r??o,source:r?"detected":"strictest",confidence:r?"high":"low"}}function J(e,t){"undefined"!=typeof console&&console.info("[cookieyes] region detection",{region:e.region,regulation:e.regulation,source:e.source,confidence:e.confidence,gpcOptOut:t})}let Q=null,X=null,Z=0;function ee(e){if(Q)return Q;"offline"===e.mode&&w();const o=m(e),n=new Set,r=o.onConsentUpdate;let s;const i=o.region?W(o.region,o.regulation):{region:void 0,regulation:o.regulation??"DEFAULT",source:"manual",confidence:"high"},a={};"self-hosted"===o.mode&&(o.backend?a.backend=o.backend:o.apiUrl&&(a.apiUrl=o.apiUrl)),o.apiKey&&(a.apiKey=o.apiKey),a.regulation=i.regulation,i.region&&(a.region=i.region);const c=(l=i.regulation,d=o.region,"CCPA"===l&&(d?.honorGpc??!0)&&Y());var l,d;c&&(a.gpcOptOut=!0),o.region?.debug&&J(i,c),o.colorScheme&&(a.colorScheme=o.colorScheme),o.theme&&(a.theme=o.theme),o.reloadOnRevoke&&(a.reloadOnRevoke=o.reloadOnRevoke),o.googleConsentMatch&&(a.googleConsentMatch=o.googleConsentMatch),o.builtInIntegrations&&o.builtInIntegrations.length>0&&(b(),a.integrations=o.builtInIntegrations),o.customStopHandlers&&(a.customStopHandlers=o.customStopHandlers),o.categories&&(a.categories=o.categories),o.onConsentReady&&(a.onConsentReady=o.onConsentReady),a.onConsentUpdate=e=>{r?.(e),s.push(e.categories);const t=function(e){const t=[],o=[];for(const n of Object.keys(e))e[n]?t.push(n):o.push(n);return{allowedCategories:t,deniedCategories:o}}(e.categories);for(const e of n)e(t)};const u=G(a);s=C(()=>u.committedCategories);const g=h(o.categories),f=new Set;function p(){const e=k();for(const t of f)t(e)}u.subscribe(p);const y=P(o.i18n,p);function k(){const e=u.categories;return{consentId:u.consentId,hasActed:u.hasActed,categories:e,consents:e,committedConsents:u.committedCategories,regulation:u.regulation,lastRenewed:u.lastRenewed,taxonomyHash:u.taxonomyHash,activeUI:u.isPreferencesOpen?"dialog":u.hasActed?null:"banner",has:e=>!0===u.committedCategories[e],saveConsents:async e=>{"all"===e?u.acceptAll():"necessary"===e?u.rejectAll():u.acceptSelected(e)},setConsent:(e,t)=>u.updateCategory(e,t),subscribeToConsentChanges:e=>(n.add(e),()=>{n.delete(e)})}}const v={subscribe:e=>(f.add(e),()=>{f.delete(e)}),getState:k,on:(e,t,o)=>s.on(e,t,o),get translations(){return y.getTranslations()},getLanguageInfo:y.getLanguageInfo,setLanguage:y.setLanguage,getCategoryText:y.getCategoryText,categories:g,getRegion:()=>i};o.networkBlocker&&o.networkBlocker.rules.length>0&&t._installRegisteredNetworkBlocker(o.networkBlocker,e=>!0===u.committedCategories[e]);let x=Promise.resolve();if(o.integrations&&o.integrations.length>0){const e=o.integrations,t=o.builtInIntegrations??[],n=++Z;x=L().then(o=>{n===Z&&(o.warnOverlappingVendors(e.map(e=>e.id),t.map(e=>e.vendor)),o.warnUnknownCategories(e,g.ids),X=o.runIntegrations(e,{granted:e=>!0===u.committedCategories[e],subscribe:e=>u.subscribe(()=>e()),region:i}))})}return Q={consentManager:u,consentStore:v,getIntegrations:()=>X?.list()??[],integrationsReady:x},Q}exports.INTEGRATION_FORMAT_VERSION=e.INTEGRATION_FORMAT_VERSION,exports.runIntegrations=e.runIntegrations,exports.warnOverlappingVendors=e.warnOverlappingVendors,exports.warnUnknownCategories=e.warnUnknownCategories,exports._clearNetworkBlockerInstaller=t._clearNetworkBlockerInstaller,exports._hasNetworkBlockerInstaller=t._hasNetworkBlockerInstaller,exports._installRegisteredNetworkBlocker=t._installRegisteredNetworkBlocker,exports._uninstallRegisteredNetworkBlocker=t._uninstallRegisteredNetworkBlocker,exports.installNetworkBlocker=t.installNetworkBlocker,exports.registerNetworkBlocker=t.registerNetworkBlocker,exports.uninstallNetworkBlocker=t.uninstallNetworkBlocker,exports.CORE_VERSION="0.6.0",exports.DEFAULT_CATEGORIES=g,exports._clearScriptRegistry=function(){if("undefined"!=typeof document)for(const e of H.values())e.remove();D.clear(),H.clear()},exports._clearStopHandlers=function(){$.clear(),q.clear(),E.clear()},exports._loadIntegrations=L,exports._logRegionDecision=J,exports._normalizeConfig=m,exports._resetBuiltInIntegrationsWarning=function(){v=!1},exports._resetOfflineModeWarning=function(){k=!1},exports._warnBuiltInIntegrationsDeprecated=b,exports._warnOfflineModeDeprecated=w,exports.broadcastGoogleConsent=S,exports.computeGoogleConsent=I,exports.createConsentEmitter=C,exports.createConsentManager=G,exports.createLanguageController=P,exports.defaultTranslations=A,exports.generateConsentId=l,exports.getOrCreateConsentRuntime=ee,exports.getTextDirection=U,exports.initCookieYes=function(e){return ee(e)},exports.mergeTranslations=N,exports.parseCookie=r,exports.parseCookieHeader=i,exports.pickLanguage=B,exports.primaryOf=_,exports.readGpc=Y,exports.readServerConsent=function(e,t={}){if("string"!=typeof e||0===e.length)return null;const o=i(e);if(null==o)return null;const n=h(t.categories),r=o.tax;if(!(r===n.taxonomyHash||void 0===r&&n.isDefault))return null;const s=d(o,t.regulation??"DEFAULT",n);return s.hasActed?{...s,taxonomyHash:n.taxonomyHash}:null},exports.regionFromHeaders=function(e,t){if(t?.header)return e.get(t.header)||void 0;for(const{country:t,region:o}of K){const n=e.get(t);if(!n)continue;const r=o?e.get(o):void 0;return r?`${n}-${r}`:n}},exports.registerStopHandler=V,exports.resetConsentRuntime=function(){t._uninstallRegisteredNetworkBlocker(),Z++,X?.stop(),X=null,Q=null},exports.resolveBuiltInIntegration=j,exports.resolveCategories=h,exports.resolveRegion=W,exports.resolveTranslations=function(e){const t=e?.messages??{},o=B(e);return N(A,t[o]??t[_(o)])},exports.serializeCookie=s;
|
|
1
|
+
"use strict";var e=require("./integrations.cjs"),t=require("./network-blocker--Z2J__Xr.cjs");const o="cookieyes-consent",n=new Set(["consentid","consent","action","tax","lastRenewedDate"]);function r(e){const t={categories:{}};for(const o of e.split(",")){const e=o.indexOf(":");if(-1===e)continue;const r=o.slice(0,e).trim(),s=o.slice(e+1).trim();n.has(r)?t[r]=s:r.length>0&&(t.categories[r]=s)}return t}function s(e){const t=[`consentid:${e.consentId}`,"consent:"+(e.hasActed?"yes":"no"),"action:"+(e.hasActed?"yes":"no")];e.taxonomyHash&&t.push(`tax:${e.taxonomyHash}`);for(const[o,n]of Object.entries(e.categories))t.push(`${o}:${n?"yes":"no"}`);return t.push(`lastRenewedDate:${e.lastRenewed??Date.now()}`),t.join(",")}function i(e){for(const t of e.split(";")){const e=t.trim(),n=e.indexOf("=");if(-1===n)continue;if(e.slice(0,n).trim()!==o)continue;const s=e.slice(n+1).trim();try{return r(decodeURIComponent(s))}catch{return null}}return null}function a(e){if("undefined"==typeof document)return;const t=encodeURIComponent(s(e));document.cookie=`${o}=${t}; max-age=31536000; path=/; SameSite=Lax`}function c(){"undefined"!=typeof document&&(document.cookie=`${o}=; max-age=0; path=/`)}function l(){const e=new Uint8Array(32);if("undefined"!=typeof crypto&&crypto.getRandomValues)crypto.getRandomValues(e);else for(let t=0;t<e.length;t++)e[t]=Math.floor(256*Math.random());return btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"").slice(0,44)}function d(e,t,o){const n={};for(const t of o.ids)n[t]=!!o.requiredIds.has(t)||"yes"===e.categories[t];return{consentId:e.consentid??l(),hasActed:"yes"===e.action,categories:n,regulation:t,lastRenewed:e.lastRenewedDate?Number(e.lastRenewedDate):void 0,taxonomyHash:e.tax}}function u(e,t,o){const n="CCPA"===t,r={};for(const e of o.ids)r[e]=!!o.requiredIds.has(e)||n;return{consentId:e,hasActed:!1,categories:r,regulation:t,taxonomyHash:o.taxonomyHash}}const g=[{id:"necessary",required:!0},{id:"functional",gcm:["functionality_storage","personalization_storage"]},{id:"analytics",gcm:["analytics_storage"]},{id:"performance"},{id:"advertisement",gcm:["ad_storage","ad_user_data","ad_personalization"]}];function f(e){let t=2166136261;for(let o=0;o<e.length;o++)t^=e.charCodeAt(o),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function p(e,t){const o=e.map(e=>e.id),n=new Set(e.filter(e=>e.required).map(e=>e.id)),r=e.map(e=>`${e.id}:${e.required?1:0}:${(e.gcm??[]).join("+")}`).join("|");return{list:e,ids:o,requiredIds:n,taxonomyHash:f(r),isDefault:t}}function h(e){if(!e||0===e.length)return p(g,!0);const t=function(e){const t=e.map(e=>e.id);return t.some(e=>"string"!=typeof e||0===e.length)?"every category needs a non-empty string id":t.some(e=>e.includes(",")||e.includes(":"))?"category ids must not contain ',' or ':'":new Set(t).size!==t.length?"category ids must be unique":t.some(e=>n.has(e))?`category ids must not be one of the reserved keys: ${[...n].join(", ")}`:e.some(e=>!0===e.required)?null:"at least one category must be marked { required: true }"}(e);return t?("undefined"!=typeof console&&console.warn(`[cookieyes] Invalid categories config (${t}). Falling back to the default five (necessary, functional, analytics, performance, advertisement).`),p(g,!0)):p(e,!1)}function y(e){"undefined"!=typeof console&&console.warn(e)}function m(e){const t={mode:e.mode},o=e.overrides?.regulation;return void 0!==e.regulation?(t.regulation=e.regulation,void 0!==o&&y("[CookieYes] Received both `regulation` and the deprecated `overrides.regulation`. Using the top-level `regulation` and ignoring `overrides`. Drop the `overrides` object — it is deprecated and will be removed after three release cycles.")):void 0!==o&&(t.regulation=o),void 0!==e.region&&(t.region=e.region),void 0!==e.colorScheme&&(t.colorScheme=e.colorScheme),void 0!==e.theme&&(t.theme=e.theme),void 0!==e.i18n&&(t.i18n=e.i18n),void 0!==e.categories&&(t.categories=e.categories),void 0!==e.networkBlocker&&(t.networkBlocker=e.networkBlocker),void 0!==e.reloadOnRevoke&&(t.reloadOnRevoke=e.reloadOnRevoke),void 0!==e.googleConsentMatch&&(t.googleConsentMatch=e.googleConsentMatch),void 0!==e.integrations&&(t.integrations=e.integrations),void 0!==e.builtInIntegrations&&(t.builtInIntegrations=e.builtInIntegrations),void 0!==e.customStopHandlers&&(t.customStopHandlers=e.customStopHandlers),void 0!==e.onConsentReady&&(t.onConsentReady=e.onConsentReady),void 0!==e.onConsentUpdate&&(t.onConsentUpdate=e.onConsentUpdate),"self-hosted"===e.mode&&(void 0!==e.apiKey&&(t.apiKey=e.apiKey),void 0!==e.backend&&(t.backend=e.backend),void 0!==e.apiUrl?(t.apiUrl=e.apiUrl,void 0!==e.backendURL&&y("[CookieYes] Received both `apiUrl` and the deprecated `backendURL`. Using `apiUrl` and ignoring `backendURL`. Rename `backendURL` to `apiUrl` — the alias is deprecated and will be removed after three release cycles.")):void 0!==e.backendURL&&(t.apiUrl=e.backendURL)),t}let w=!1;function k(){"production"!==process.env.NODE_ENV&&(w||(w=!0,"undefined"!=typeof console&&console.warn('[cookieyes] mode: "offline" has been renamed to "cookie-only". Both do exactly the same thing, but "offline" is deprecated and will be removed after three release cycles. See https://github.com/cookieyes/cookieyes/blob/main/apps/web/content/docs/migration.mdx for the full migration guide. Update to .mode("cookie-only") (or { mode: "cookie-only" }).')))}let v=!1;function b(){"production"!==process.env.NODE_ENV&&(v||(v=!0,"undefined"!=typeof console&&console.warn("[cookieyes] `builtInIntegrations` (formerly the `integrations` field) is deprecated and will be removed after three release cycles. Use the `integrations` field with a preset from `@cookieyes/scripts` instead. See https://github.com/cookieyes/cookieyes/blob/main/apps/web/content/docs/migration.mdx for the full migration guide.")))}function C(e){const t={save:new Set,change:new Set};let o={...e()};function n(e,t,o){try{e.listener(o)}catch(e){"undefined"!=typeof console&&console.error(`[cookieyes] a consent "${t}" listener threw; others are unaffected:`,e)}}function r(e,o){for(const r of[...t[e]])r.category&&!o.changedCategories.includes(r.category)||n(r,e,o)}return{on(o,r,s){const i=s?.category?{listener:r,category:s.category}:{listener:r};return t[o].add(i),n(i,o,{categories:{...e()},changedCategories:[],isInitial:!0}),()=>{t[o].delete(i)}},push(e){const t={...e},n=[];for(const e of Object.keys(t))o[e]!==t[e]&&n.push(e);o=t,r("save",{categories:t,changedCategories:n,isInitial:!1}),n.length>0&&r("change",{categories:t,changedCategories:n,isInitial:!1})}}}function x(e){"undefined"!=typeof console&&console.warn(`[cookieyes] ${e}`)}const R=["ad_storage","ad_user_data","ad_personalization","analytics_storage","functionality_storage","personalization_storage","security_storage"];function I(e,t,o="any"){const n={};for(const r of R){if("security_storage"===r){n[r]="granted";continue}const s=e.list.filter(e=>e.gcm?.includes(r));if(0===s.length){n[r]="denied";continue}const i="all"===o?s.every(e=>!0===t[e.id]):s.some(e=>!0===t[e.id]);n[r]=i?"granted":"denied"}return n}function S(e,t,o="any"){if("undefined"==typeof window||!Array.isArray(window.dataLayer))return;const n=I(e,t,o),r=window.dataLayer;if(!r)return;!function(){r.push(arguments)}("consent","update",n)}const A={bannerTitle:"We value your privacy",bannerDescription:"We use cookies to enhance your browsing experience, serve personalised ads or content, and analyse our traffic. By clicking “Accept All”, you consent to our use of cookies.",acceptAll:"Accept All",rejectAll:"Reject All",managePreferences:"Customise",savePreferences:"Save My Preferences",doNotSell:"Do Not Sell or Share My Personal Information",ccpaDescription:"This website or its third-party tools process personal data. You can opt out of the sale of your personal information by clicking on the “Do Not Sell or Share My Personal Information” button.",accept:"Accept",poweredBy:"Powered by CookieYes",opensInNewTab:"opens in new tab",preferencesTitle:"Customise Consent Preferences",preferencesIntro:"We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.",alwaysActive:"Always Active",preferencesDialogLabel:"Cookie preferences",optOutDialogLabel:"Opt-out preferences",recallButtonLabel:"Consent Preferences",categories:{necessary:{label:"Necessary",description:"Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data."},functional:{label:"Functional",description:"Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features."},analytics:{label:"Analytics",description:"Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc."},performance:{label:"Performance",description:"Performance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors."},advertisement:{label:"Advertisement",description:"Advertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns."}},optOut:{title:"Opt-out Preferences",description:'We use third-party cookies that help us analyse how you use this website, store your preferences, and provide the content and advertisements that are relevant to you. However, you can opt out of these cookies by checking "Do Not Sell or Share My Personal Information" and clicking the "Save My Preferences" button. Once you opt out, you can opt in again at any time by unchecking "Do Not Sell or Share My Personal Information" and clicking the "Save My Preferences" button.',cancel:"Cancel",successText:"Your opt-out preference has been honored.",successCountdown:"Banner closes automatically in {seconds} seconds..."},bannerCloseLabel:"Close",preferencesCloseLabel:"Close preferences",optOutCloseLabel:"Close",gatedFrame:{placeholder:"This content requires {category} cookies to be enabled.",action:"Manage Preferences"},reloadNotice:{message:"Some tracking on this page can only be fully stopped by reloading. Reload to apply your change, or dismiss to keep browsing.",reloadButton:"Reload page",dismissButton:"Dismiss"}},O=new Set(["ar","he","fa","ur","ps","sd","yi","dv"]);function _(e){return e.split("-")[0]?.toLowerCase()??""}function N(e){return O.has(_(e))?"rtl":"ltr"}function U(e,t){if(!t)return e;const o={...e};for(const[n,r]of Object.entries(t)){if(null==r)continue;const t=e[n],s="object"==typeof r&&!Array.isArray(r)&&"object"==typeof t&&null!=t;o[n]=s?U(t,r):r}return o}function B(e){const t=e?.messages??{},o=[];e?.locale&&o.push(e.locale),(e?.detectBrowserLanguage??1)&&"undefined"!=typeof navigator&&navigator.language&&o.push(navigator.language);for(const e of o){if(t[e])return e;const o=_(e);if(o&&t[o])return o}return"en"}async function L(){const e=await Promise.resolve().then(function(){return require("./integrations.cjs")});return{runIntegrations:e.runIntegrations,warnOverlappingVendors:e.warnOverlappingVendors,warnUnknownCategories:e.warnUnknownCategories}}function P(e,t){const o={...e?.messages},n=e?.loadLanguage,r=new Set;let s=B(e),i=d(s),a=u();function c(e){return o[e]??o[_(e)]}function l(e){return"en"===_(e)||void 0!==c(e)}function d(e){return U(A,c(e))}function u(){return{language:s,direction:N(s),languages:Array.from(new Set(["en",...Object.keys(o)]))}}function g(e){s=e,i=d(e),a=u(),t()}function f(e,t){r.has(e)||"undefined"==typeof console||(r.add(e),console.warn(`[cookieyes] no translations for language "${e}"; staying on "${s}". Add it to i18n.messages or provide i18n.loadLanguage.`,t??""))}function p(e){return l(e)?(g(e),Promise.resolve()):n?Promise.resolve().then(()=>n(e)).then(t=>{o[e]=t,g(e)}).catch(t=>f(e,t)):(f(e),Promise.resolve())}return n&&e?.locale&&!l(e.locale)&&"undefined"!=typeof window&&p(e.locale),{getTranslations:()=>i,getLanguageInfo:()=>a,setLanguage:p,getCategoryText:function(e){return c(s)?.categories?.[e]}}}const D=new Map,T=new Map;function H(e,t){if(document.getElementById(e))return;const o=document.createElement("script");o.id=e,o.src=t.src,o.async=!0,t.onLoad&&o.addEventListener("load",t.onLoad,{once:!0}),document.head.appendChild(o),T.set(e,o)}function M(e){return"needsReload"in e&&!0===e.needsReload}function j(e){switch(e.vendor){case"meta":return{id:"meta",category:e.category??"advertisement",stop:()=>window.fbq?.("consent","revoke"),resume:()=>window.fbq?.("consent","grant")};case"tiktok":return{id:"tiktok",category:e.category??"advertisement",needsReload:!0};case"linkedin":return{id:"linkedin",category:e.category??"advertisement",needsReload:!0};case"hotjar":return{id:"hotjar",category:e.category??"analytics",needsReload:!0};case"segment":return{id:"segment",category:e.category??"analytics",needsReload:!0}}}const $=new Map,q=new Set,E=new Set;function V(e){$.set(e.id,e)}function F(e){const t=[];for(const o of $.values()){const n=!0!==e[o.category];if(M(o))n?E.has(o.id)&&(t.push(o.id),E.delete(o.id)):E.add(o.id);else if(n){if(!q.has(o.id))try{o.stop(),q.add(o.id)}catch{t.push(o.id)}}else if(q.has(o.id)){q.delete(o.id);try{o.resume?.()}catch{}}}return{reloadRequiredBy:t}}function z(e,t){const o={consentId:e.consentId,categories:e.categories,regulation:e.regulation,domain:"undefined"!=typeof window?window.location.hostname:"unknown"};return t&&(o.region=t),o}function G(e){const t=new Set,o=h(e.categories),n=e.googleConsentMatch??"any";let r;void 0===e.googleConsentMatch&&function(e){const t=new Map;for(const o of e.list)for(const e of o.gcm??[]){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(o.id)}for(const[e,o]of t)o.size<=1||x(`categories ${[...o].map(e=>JSON.stringify(e)).join(", ")} all map to the Google signal "${e}", which is a single on/off — this mapping is lossy. Set \`googleConsentMatch: "all"\` to grant it only when all are granted, or "any" (default) to grant it when any is.`)}(o);let s,g,f=!1,p=!1;function y(e){const t={};for(const n of o.ids)t[n]=!!o.requiredIds.has(n)||e(n);return t}let m=[],w=!1;for(const t of e.integrations??[])V(j(t));for(const t of e.customStopHandlers??[])V(t);const k="undefined"==typeof document?null:i(document.cookie),v=e.regulation??"DEFAULT",b=k?.tax,C=b===o.taxonomyHash,R=null!=k&&(C||void 0===b&&o.isDefault);if(null!=k&&R)r=d(k,v,o);else{const e=k?.consentid??l();r=u(e,v,o),null!=k&&c(),"CCPA"===r.regulation&&a(r)}function I(){const e={consentId:r.consentId,hasActed:r.hasActed,categories:{...r.categories},regulation:r.regulation,lastRenewed:r.lastRenewed,taxonomyHash:r.taxonomyHash};for(const o of t)o(e)}function A(){!function(e){if("undefined"!=typeof document)for(const[t,o]of D)!0===e[o.category]&&(T.has(t)||H(t,o))}(g)}function O(){r={...r,hasActed:!0,lastRenewed:Date.now()},a(r);let t=!1;for(const e of o.ids)if(s[e]&&!r.categories[e]){t=!0;break}if(s={...r.categories},g={...r.categories},I(),e.onConsentUpdate?.(r),e.backend)try{Promise.resolve(e.backend.persist(z(r,e.region))).catch(()=>{})}catch{}else e.apiUrl&&async function(e,t,o,n){const r=z(o,n),s={"Content-Type":"application/json"};t&&(s.Authorization=`Bearer ${t}`);try{await fetch(e,{method:"POST",headers:s,body:JSON.stringify(r),keepalive:!0})}catch{}}(e.apiUrl,e.apiKey,r,e.region);try{A()}catch{}let i=!1;try{const{reloadRequiredBy:e}=F(g);i=function(e){const t=e.length!==m.length||e.some((e,t)=>e!==m[t]);return t&&(m=e,w=!1),t}(e)}catch{}try{S(o,g,n)}catch{}i&&I(),t&&e.reloadOnRevoke&&"undefined"!=typeof window&&window.location.reload()}r={...r,taxonomyHash:o.taxonomyHash},e.gpcOptOut&&!r.hasActed&&(r={...r,categories:y(()=>!1)},a(r)),s={...r.categories},g={...r.categories},Promise.resolve().then(()=>e.onConsentReady?.(r));const _={get consentId(){return r.consentId},get hasActed(){return r.hasActed},get categories(){return{...r.categories}},get committedCategories(){return{...g}},get regulation(){return r.regulation},get lastRenewed(){return r.lastRenewed},get taxonomyHash(){return r.taxonomyHash},get isPreferencesOpen(){return f},get isBannerDismissed(){return p},acceptAll(){r={...r,categories:y(()=>!0)},f=!1,O()},rejectAll(){r={...r,categories:y(()=>!1)},f=!1,O()},acceptSelected(e){r={...r,categories:y(t=>e.includes(t))},f=!1,O()},updateCategory(e,t){o.requiredIds.has(e)||o.ids.includes(e)&&(r={...r,categories:{...r.categories,[e]:t}},I())},savePreferences(){f=!1,O()},resetConsent(){c();const e=l();r=u(e,r.regulation,o),g={...r.categories},s={...r.categories},f=!1,p=!1,F(g),S(o,g,n),m=[],w=!1,I()},showPreferences(){f=!0,I()},hidePreferences(){f=!1,I()},dismissBanner(){p||(p=!0,I())},subscribe:e=>(t.add(e),()=>t.delete(e)),registerScript(e){!function(e){D.set(e.id,e)}(e),A()},get reloadNotice(){return{required:m.length>0&&!w,reasons:[...m]}},dismissReloadNotice(){w||(w=!0,I())}};A();try{!function(e){for(const t of $.values()){const o=!0!==e[t.category];if(M(t))o?E.delete(t.id):E.add(t.id);else try{o?(t.stop(),q.add(t.id)):(q.delete(t.id),t.resume?.())}catch{}}}(r.categories)}catch{}try{S(o,r.categories,n)}catch{}return _}const K=[{country:"x-vercel-ip-country",region:"x-vercel-ip-country-region"},{country:"cf-ipcountry"}];function Y(){return"undefined"!=typeof navigator&&!0===navigator.globalPrivacyControl}function W(e,t){const o=e.strictest??"GDPR";if(t)return e.detect&&"undefined"!=typeof console&&console.warn("[cookieyes] `regulation` is set manually, so region detection is ignored. Remove one of them to clear the conflict."),{region:void 0,regulation:t,source:"manual",confidence:"high"};const n=e.detect?.(),r=n?function(e,t){if(e)return e[t]??e[t.split("-")[0]??""]}(e.map,n):void 0;return{region:n,regulation:r??o,source:r?"detected":"strictest",confidence:r?"high":"low"}}function J(e,t){"undefined"!=typeof console&&console.info("[cookieyes] region detection",{region:e.region,regulation:e.regulation,source:e.source,confidence:e.confidence,gpcOptOut:t})}let Q=null,X=null,Z=0;function ee(e){if(Q)return Q;"offline"===e.mode&&k();const o=m(e),n=new Set,r=o.onConsentUpdate;let s;const i=o.region?W(o.region,o.regulation):{region:void 0,regulation:o.regulation??"DEFAULT",source:"manual",confidence:"high"},a={};"self-hosted"===o.mode&&(o.backend?a.backend=o.backend:o.apiUrl&&(a.apiUrl=o.apiUrl)),o.apiKey&&(a.apiKey=o.apiKey),a.regulation=i.regulation,i.region&&(a.region=i.region);const c=(l=i.regulation,d=o.region,"CCPA"===l&&(d?.honorGpc??!0)&&Y());var l,d;c&&(a.gpcOptOut=!0),o.region?.debug&&J(i,c),o.colorScheme&&(a.colorScheme=o.colorScheme),o.theme&&(a.theme=o.theme),o.reloadOnRevoke&&(a.reloadOnRevoke=o.reloadOnRevoke),o.googleConsentMatch&&(a.googleConsentMatch=o.googleConsentMatch),o.builtInIntegrations&&o.builtInIntegrations.length>0&&(b(),a.integrations=o.builtInIntegrations),o.customStopHandlers&&(a.customStopHandlers=o.customStopHandlers),o.categories&&(a.categories=o.categories),o.onConsentReady&&(a.onConsentReady=o.onConsentReady),a.onConsentUpdate=e=>{r?.(e),s.push(e.categories);const t=function(e){const t=[],o=[];for(const n of Object.keys(e))e[n]?t.push(n):o.push(n);return{allowedCategories:t,deniedCategories:o}}(e.categories);for(const e of n)e(t)};const u=G(a);s=C(()=>u.committedCategories);const g=h(o.categories),f=new Set;function p(){const e=w();for(const t of f)t(e)}u.subscribe(p);const y=P(o.i18n,p);function w(){const e=u.categories;return{consentId:u.consentId,hasActed:u.hasActed,categories:e,consents:e,committedConsents:u.committedCategories,regulation:u.regulation,lastRenewed:u.lastRenewed,taxonomyHash:u.taxonomyHash,activeUI:u.isPreferencesOpen?"dialog":u.hasActed||u.isBannerDismissed?null:"banner",has:e=>!0===u.committedCategories[e],saveConsents:async e=>{"all"===e?u.acceptAll():"necessary"===e?u.rejectAll():u.acceptSelected(e)},setConsent:(e,t)=>u.updateCategory(e,t),subscribeToConsentChanges:e=>(n.add(e),()=>{n.delete(e)})}}const v={subscribe:e=>(f.add(e),()=>{f.delete(e)}),getState:w,on:(e,t,o)=>s.on(e,t,o),get translations(){return y.getTranslations()},getLanguageInfo:y.getLanguageInfo,setLanguage:y.setLanguage,getCategoryText:y.getCategoryText,categories:g,getRegion:()=>i};o.networkBlocker&&o.networkBlocker.rules.length>0&&t._installRegisteredNetworkBlocker(o.networkBlocker,e=>!0===u.committedCategories[e]);let x=Promise.resolve();if(o.integrations&&o.integrations.length>0){const e=o.integrations,t=o.builtInIntegrations??[],n=++Z;x=L().then(o=>{n===Z&&(o.warnOverlappingVendors(e.map(e=>e.id),t.map(e=>e.vendor)),o.warnUnknownCategories(e,g.ids),X=o.runIntegrations(e,{granted:e=>!0===u.committedCategories[e],subscribe:e=>u.subscribe(()=>e()),region:i}))})}return Q={consentManager:u,consentStore:v,getIntegrations:()=>X?.list()??[],integrationsReady:x},Q}exports.INTEGRATION_FORMAT_VERSION=e.INTEGRATION_FORMAT_VERSION,exports.runIntegrations=e.runIntegrations,exports.warnOverlappingVendors=e.warnOverlappingVendors,exports.warnUnknownCategories=e.warnUnknownCategories,exports._clearNetworkBlockerInstaller=t._clearNetworkBlockerInstaller,exports._hasNetworkBlockerInstaller=t._hasNetworkBlockerInstaller,exports._installRegisteredNetworkBlocker=t._installRegisteredNetworkBlocker,exports._uninstallRegisteredNetworkBlocker=t._uninstallRegisteredNetworkBlocker,exports.installNetworkBlocker=t.installNetworkBlocker,exports.registerNetworkBlocker=t.registerNetworkBlocker,exports.uninstallNetworkBlocker=t.uninstallNetworkBlocker,exports.CORE_VERSION="0.8.0",exports.DEFAULT_CATEGORIES=g,exports._clearScriptRegistry=function(){if("undefined"!=typeof document)for(const e of T.values())e.remove();D.clear(),T.clear()},exports._clearStopHandlers=function(){$.clear(),q.clear(),E.clear()},exports._loadIntegrations=L,exports._logRegionDecision=J,exports._normalizeConfig=m,exports._resetBuiltInIntegrationsWarning=function(){v=!1},exports._resetOfflineModeWarning=function(){w=!1},exports._warnBuiltInIntegrationsDeprecated=b,exports._warnOfflineModeDeprecated=k,exports.broadcastGoogleConsent=S,exports.computeGoogleConsent=I,exports.createConsentEmitter=C,exports.createConsentManager=G,exports.createLanguageController=P,exports.defaultTranslations=A,exports.generateConsentId=l,exports.getOrCreateConsentRuntime=ee,exports.getTextDirection=N,exports.initCookieYes=function(e){return ee(e)},exports.mergeTranslations=U,exports.parseCookie=r,exports.parseCookieHeader=i,exports.pickLanguage=B,exports.primaryOf=_,exports.readGpc=Y,exports.readServerConsent=function(e,t={}){if("string"!=typeof e||0===e.length)return null;const o=i(e);if(null==o)return null;const n=h(t.categories),r=o.tax;if(!(r===n.taxonomyHash||void 0===r&&n.isDefault))return null;const s=d(o,t.regulation??"DEFAULT",n);return s.hasActed?{...s,taxonomyHash:n.taxonomyHash}:null},exports.regionFromHeaders=function(e,t){if(t?.header)return e.get(t.header)||void 0;for(const{country:t,region:o}of K){const n=e.get(t);if(!n)continue;const r=o?e.get(o):void 0;return r?`${n}-${r}`:n}},exports.registerStopHandler=V,exports.resetConsentRuntime=function(){t._uninstallRegisteredNetworkBlocker(),Z++,X?.stop(),X=null,Q=null},exports.resolveBuiltInIntegration=j,exports.resolveCategories=h,exports.resolveRegion=W,exports.resolveTranslations=function(e){const t=e?.messages??{},o=B(e);return U(A,t[o]??t[_(o)])},exports.serializeCookie=s;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|