@sentientui/core 0.41.2 → 0.42.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/README.md +31 -2
- package/dist/chunk-BGZLWZUG.mjs +2 -0
- package/dist/chunk-BGZLWZUG.mjs.map +1 -0
- package/dist/chunk-JNQY3XNF.mjs +2 -0
- package/dist/chunk-JNQY3XNF.mjs.map +1 -0
- package/dist/chunk-LCYGZNFI.mjs +2 -0
- package/dist/chunk-LCYGZNFI.mjs.map +1 -0
- package/dist/chunk-QPJ6TL6L.mjs +2 -0
- package/dist/chunk-QPJ6TL6L.mjs.map +1 -0
- package/dist/chunk-WUFFNQHQ.mjs +2 -0
- package/dist/{chunk-J5EL7HKC.mjs.map → chunk-WUFFNQHQ.mjs.map} +1 -1
- package/dist/{index-DlJDNOWu.d.cts → index-Bz4QCRmF.d.cts} +26 -5
- package/dist/{index-C--aVpoo.d.ts → index-C36TXfry.d.ts} +26 -5
- package/dist/index-consent.js +1 -1
- package/dist/index-consent.js.map +1 -1
- package/dist/index-consent.mjs +1 -1
- package/dist/index-consent.mjs.map +1 -1
- package/dist/index-engagement.js +1 -1
- package/dist/index-engagement.js.map +1 -1
- package/dist/index-engagement.mjs +1 -1
- package/dist/index-engagement.mjs.map +1 -1
- package/dist/index-graph.d.cts +2 -2
- package/dist/index-graph.d.ts +2 -2
- package/dist/index-graph.js +1 -1
- package/dist/index-graph.js.map +1 -1
- package/dist/index-graph.mjs +1 -1
- package/dist/index-graph.mjs.map +1 -1
- package/dist/index-internal-traffic.d.cts +37 -0
- package/dist/index-internal-traffic.d.ts +37 -0
- package/dist/index-internal-traffic.js +2 -0
- package/dist/index-internal-traffic.js.map +1 -0
- package/dist/index-internal-traffic.mjs +2 -0
- package/dist/index-internal-traffic.mjs.map +1 -0
- package/dist/index-local.d.cts +1 -1
- package/dist/index-local.d.ts +1 -1
- package/dist/index-region.mjs +1 -1
- package/dist/index-server.d.cts +25 -1
- package/dist/index-server.d.ts +25 -1
- package/dist/index-server.js +1 -1
- package/dist/index-server.js.map +1 -1
- package/dist/index-server.mjs +1 -1
- package/dist/index-server.mjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/llms.txt +2 -1
- package/package.json +6 -1
- package/dist/chunk-FPOHOWJP.mjs +0 -2
- package/dist/chunk-FPOHOWJP.mjs.map +0 -1
- package/dist/chunk-J5EL7HKC.mjs +0 -2
- package/dist/chunk-KXA3X6T3.mjs +0 -2
- package/dist/chunk-KXA3X6T3.mjs.map +0 -1
|
@@ -375,10 +375,20 @@ type SentientConfig = {
|
|
|
375
375
|
*/
|
|
376
376
|
respectDoNotTrack?: boolean;
|
|
377
377
|
userId?: string;
|
|
378
|
+
/**
|
|
379
|
+
* Marks this visit as your own team's or a test site's, so it is left out of
|
|
380
|
+
* every report and out of learning (it is still served versions, so QA keeps
|
|
381
|
+
* working). Typically `user.email.endsWith('@example.com')` evaluated in
|
|
382
|
+
* your code: the email itself never leaves the site, only `internal: true`.
|
|
383
|
+
* A function is called once, at init. Sticky server-side: `false` never
|
|
384
|
+
* un-marks a visit. Needs a SentientUI API that knows internal traffic;
|
|
385
|
+
* older ones ignore it.
|
|
386
|
+
*/
|
|
387
|
+
internal?: boolean | (() => boolean);
|
|
378
388
|
/**
|
|
379
389
|
* Declared persona — the role your app already knows for this visitor
|
|
380
390
|
* (e.g. 'admin', 'evaluator'). Must be a key in the project's persona
|
|
381
|
-
* vocabulary (dashboard →
|
|
391
|
+
* vocabulary (dashboard → Matrix → Audiences); unrecognized values are
|
|
382
392
|
* ignored server-side and surfaced in the dashboard so you can add them.
|
|
383
393
|
* Declared personas are served at full confidence, overriding the inferred
|
|
384
394
|
* one. Keep it a low-cardinality role label — never a user id or email.
|
|
@@ -584,6 +594,19 @@ type ComponentGoalOptions = GoalOptions & {
|
|
|
584
594
|
/** Reward credited to the served variant (0–1). Defaults to 1. */
|
|
585
595
|
reward?: number;
|
|
586
596
|
};
|
|
597
|
+
/** identify()'s options. */
|
|
598
|
+
type IdentifyOptions = {
|
|
599
|
+
/** `signUserId(userId, secretKey)` from your server — a VERIFIED identify. */
|
|
600
|
+
userHash?: string;
|
|
601
|
+
/**
|
|
602
|
+
* The user's email, for the project's "team emails & domains" rules. It is
|
|
603
|
+
* normalized (trimmed, lowercased) and SHA-256 hashed on the device; only
|
|
604
|
+
* the hash and the domain (`example.com`) are sent, never the address. On a
|
|
605
|
+
* non-secure (http:) page, where the browser offers no hashing, only the
|
|
606
|
+
* domain is sent.
|
|
607
|
+
*/
|
|
608
|
+
email?: string;
|
|
609
|
+
};
|
|
587
610
|
type SentientClient = {
|
|
588
611
|
track(event: Omit<SentientEvent, 'id' | 'sessionId' | 'timestamp' | 'timeInSession'>): void;
|
|
589
612
|
goal(name: string, options?: GoalOptions): void;
|
|
@@ -604,9 +627,7 @@ type SentientClient = {
|
|
|
604
627
|
* project signs its identifies, only verified links receive server goals by
|
|
605
628
|
* `userId` and carry the user's profile across devices.
|
|
606
629
|
*/
|
|
607
|
-
identify(userId: string, opts?:
|
|
608
|
-
userHash?: string;
|
|
609
|
-
}): void;
|
|
630
|
+
identify(userId: string, opts?: IdentifyOptions): void;
|
|
610
631
|
/**
|
|
611
632
|
* The visitor id (session id) for carrying a conversion to your server
|
|
612
633
|
* later: store it with the order/sign-up, then pass it to `trackServerGoal`.
|
|
@@ -784,4 +805,4 @@ declare function routeKey(): string;
|
|
|
784
805
|
*/
|
|
785
806
|
declare function init(config: SentientConfig): SentientClient;
|
|
786
807
|
|
|
787
|
-
export {
|
|
808
|
+
export { setCspNonce as $, type AssignOptions as A, cspNonce as B, type ComponentGoalOptions as C, type DecideInput as D, type EventQueue as E, exposedStage as F, type GoalDefinition as G, forgetGeneration as H, type IdentifyOptions as I, grantConsent as J, init as K, LEGACY_SESSION_COOKIE_NAME as L, type MicroSignalEmitter as M, isDoNotTrackEnabled as N, normalizeUrlPattern as O, PAGE_SCOPE_RE as P, type QueueConfig as Q, REVEAL_MS as R, STAGE_ATTRIBUTE as S, pageScopeMatches as T, resetRevealStyles as U, reveal as V, type WeightEntry as W, routeKey as X, sanitizePageUrl as Y, sessionCookieName as Z, _registerConsentUpgradeInit as _, type AssignResult as a, setStageAttribute as a0, urlMatches as a1, type Assignment as b, type AssignmentCache as c, type AuthoredArmReport as d, type ComponentWeightEntry as e, type DecideOutcome as f, type EventType as g, type GoalOptions as h, type GraphClient as i, type GraphConfig as j, type GraphSnapshot as k, LOCAL_MODE_BANNER as l, type MicroSignalType as m, PROD_KEYLESS_ERROR as n, type PageNode as o, type RevealOptions as p, type SectionMapEntry as q, type SentientClient as r, type SentientConfig as s, type SentientEvent as t, type SessionConfig as u, type SessionManager as v, type SkeletonReport as w, type StageAttributes as x, applyNonce as y, attachMicroSignalDetectors as z };
|
|
@@ -375,10 +375,20 @@ type SentientConfig = {
|
|
|
375
375
|
*/
|
|
376
376
|
respectDoNotTrack?: boolean;
|
|
377
377
|
userId?: string;
|
|
378
|
+
/**
|
|
379
|
+
* Marks this visit as your own team's or a test site's, so it is left out of
|
|
380
|
+
* every report and out of learning (it is still served versions, so QA keeps
|
|
381
|
+
* working). Typically `user.email.endsWith('@example.com')` evaluated in
|
|
382
|
+
* your code: the email itself never leaves the site, only `internal: true`.
|
|
383
|
+
* A function is called once, at init. Sticky server-side: `false` never
|
|
384
|
+
* un-marks a visit. Needs a SentientUI API that knows internal traffic;
|
|
385
|
+
* older ones ignore it.
|
|
386
|
+
*/
|
|
387
|
+
internal?: boolean | (() => boolean);
|
|
378
388
|
/**
|
|
379
389
|
* Declared persona — the role your app already knows for this visitor
|
|
380
390
|
* (e.g. 'admin', 'evaluator'). Must be a key in the project's persona
|
|
381
|
-
* vocabulary (dashboard →
|
|
391
|
+
* vocabulary (dashboard → Matrix → Audiences); unrecognized values are
|
|
382
392
|
* ignored server-side and surfaced in the dashboard so you can add them.
|
|
383
393
|
* Declared personas are served at full confidence, overriding the inferred
|
|
384
394
|
* one. Keep it a low-cardinality role label — never a user id or email.
|
|
@@ -584,6 +594,19 @@ type ComponentGoalOptions = GoalOptions & {
|
|
|
584
594
|
/** Reward credited to the served variant (0–1). Defaults to 1. */
|
|
585
595
|
reward?: number;
|
|
586
596
|
};
|
|
597
|
+
/** identify()'s options. */
|
|
598
|
+
type IdentifyOptions = {
|
|
599
|
+
/** `signUserId(userId, secretKey)` from your server — a VERIFIED identify. */
|
|
600
|
+
userHash?: string;
|
|
601
|
+
/**
|
|
602
|
+
* The user's email, for the project's "team emails & domains" rules. It is
|
|
603
|
+
* normalized (trimmed, lowercased) and SHA-256 hashed on the device; only
|
|
604
|
+
* the hash and the domain (`example.com`) are sent, never the address. On a
|
|
605
|
+
* non-secure (http:) page, where the browser offers no hashing, only the
|
|
606
|
+
* domain is sent.
|
|
607
|
+
*/
|
|
608
|
+
email?: string;
|
|
609
|
+
};
|
|
587
610
|
type SentientClient = {
|
|
588
611
|
track(event: Omit<SentientEvent, 'id' | 'sessionId' | 'timestamp' | 'timeInSession'>): void;
|
|
589
612
|
goal(name: string, options?: GoalOptions): void;
|
|
@@ -604,9 +627,7 @@ type SentientClient = {
|
|
|
604
627
|
* project signs its identifies, only verified links receive server goals by
|
|
605
628
|
* `userId` and carry the user's profile across devices.
|
|
606
629
|
*/
|
|
607
|
-
identify(userId: string, opts?:
|
|
608
|
-
userHash?: string;
|
|
609
|
-
}): void;
|
|
630
|
+
identify(userId: string, opts?: IdentifyOptions): void;
|
|
610
631
|
/**
|
|
611
632
|
* The visitor id (session id) for carrying a conversion to your server
|
|
612
633
|
* later: store it with the order/sign-up, then pass it to `trackServerGoal`.
|
|
@@ -784,4 +805,4 @@ declare function routeKey(): string;
|
|
|
784
805
|
*/
|
|
785
806
|
declare function init(config: SentientConfig): SentientClient;
|
|
786
807
|
|
|
787
|
-
export {
|
|
808
|
+
export { setCspNonce as $, type AssignOptions as A, cspNonce as B, type ComponentGoalOptions as C, type DecideInput as D, type EventQueue as E, exposedStage as F, type GoalDefinition as G, forgetGeneration as H, type IdentifyOptions as I, grantConsent as J, init as K, LEGACY_SESSION_COOKIE_NAME as L, type MicroSignalEmitter as M, isDoNotTrackEnabled as N, normalizeUrlPattern as O, PAGE_SCOPE_RE as P, type QueueConfig as Q, REVEAL_MS as R, STAGE_ATTRIBUTE as S, pageScopeMatches as T, resetRevealStyles as U, reveal as V, type WeightEntry as W, routeKey as X, sanitizePageUrl as Y, sessionCookieName as Z, _registerConsentUpgradeInit as _, type AssignResult as a, setStageAttribute as a0, urlMatches as a1, type Assignment as b, type AssignmentCache as c, type AuthoredArmReport as d, type ComponentWeightEntry as e, type DecideOutcome as f, type EventType as g, type GoalOptions as h, type GraphClient as i, type GraphConfig as j, type GraphSnapshot as k, LOCAL_MODE_BANNER as l, type MicroSignalType as m, PROD_KEYLESS_ERROR as n, type PageNode as o, type RevealOptions as p, type SectionMapEntry as q, type SentientClient as r, type SentientConfig as s, type SentientEvent as t, type SessionConfig as u, type SessionManager as v, type SkeletonReport as w, type StageAttributes as x, applyNonce as y, attachMicroSignalDetectors as z };
|
package/dist/index-consent.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var T=Object.defineProperty,ae=Object.defineProperties,ue=Object.getOwnPropertyDescriptor,ce=Object.getOwnPropertyDescriptors,le=Object.getOwnPropertyNames,Q=Object.getOwnPropertySymbols;var z=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable;var j=(n,t,e)=>t in n?T(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,D=(n,t)=>{for(var e in t||(t={}))z.call(t,e)&&j(n,e,t[e]);if(Q)for(var e of Q(t))de.call(t,e)&&j(n,e,t[e]);return n},N=(n,t)=>ae(n,ce(t));var fe=(n,t)=>{for(var e in t)T(n,e,{get:t[e],enumerable:!0})},pe=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of le(t))!z.call(n,s)&&s!==e&&T(n,s,{get:()=>t[s],enumerable:!(o=ue(t,s))||o.enumerable});return n};var ge=n=>pe(T({},"__esModule",{value:!0}),n);var ve={};fe(ve,{TCF_DEFAULT_PURPOSES:()=>B,consentFromCookies:()=>H,consentModeGranted:()=>J,consentWatcher:()=>Z,cookiebotCookieGrants:()=>O,cookieyesCookieGrants:()=>M,forgetVisitor:()=>ie,onetrustCookieGrants:()=>G,tcStringConsents:()=>L,tcStringPurposes:()=>K});module.exports=ge(ve);var B=[1,5,6,8],P=n=>{try{return decodeURIComponent(n)}catch(t){return n}};function k(n,t){if(n)for(let e of n.cookie.split(";")){let o=e.indexOf("=");if(o>0&&e.slice(0,o).trim()===t)return e.slice(o+1).trim()}}function I(n,t,e){let o=[n,...n.document?[n.document]:[]];for(let s of o)for(let r of t)s.addEventListener(r,e);return()=>{for(let s of o)for(let r of t)s.removeEventListener(r,e)}}function O(n,t="statistics"){if(n==null||n==="")return null;let e=P(n).trim();if(e==="-1")return!0;if(e==="0")return!1;let o=new RegExp(`[{,]\\s*${t}\\s*:\\s*(true|false)`).exec(e);return o?o[1]==="true":null}function G(n,t="C0002"){if(n==null||n==="")return null;let e;for(let o of n.split("&"))o.startsWith("groups=")&&(e=P(o.slice(7)));if(e==null)return null;for(let o of e.split(",")){let[s,r]=o.split(":");if(s===t)return r==="1"}return null}function M(n,t="analytics"){if(n==null||n==="")return null;let e=new RegExp(`(?:^|,)${t}:(yes|no)(?:,|$)`).exec(P(n));return e?e[1]==="yes":null}var me="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",W=n=>{let t="";for(let e of n)t+=me.indexOf(e).toString(2).padStart(6,"0");return t};function L(n){if(!n)return null;let t=n.split("."),e=t[0];if(!/^[A-Za-z0-9_-]+$/.test(e))return null;let o=W(e);if(o.length<200||parseInt(o.slice(0,6),2)!==2)return null;let s=(d,p)=>d+p<=o.length?parseInt(o.slice(d,d+p),2):null,r=new Set,i=new Set;for(let d=1;d<=24;d++)o[151+d]==="1"&&r.add(d),o[175+d]==="1"&&i.add(d);let a=null,u=s(213,16),l=s(229,1);if(u!==null&&l===0){if(230+u<=o.length){a=new Set;for(let d=1;d<=u;d++)o[229+d]==="1"&&a.add(d)}}else if(u!==null&&l===1){let d=s(230,12),p=242,y=new Set,c=d!==null;for(let g=0;c&&g<(d!=null?d:0);g++){let w=s(p,1),h=s(p+1,16);if(w===null||h===null)c=!1;else if(w===1){let b=s(p+17,16);if(b===null||b<h||b-h>65535)c=!1;else for(let S=h;S<=b;S++)y.add(S);p+=33}else y.add(h),p+=17}c&&(a=y)}let f=new Set,m=new Set;for(let d of t.slice(1)){if(!/^[A-Za-z0-9_-]+$/.test(d))continue;let p=W(d);if(!(p.length<51||parseInt(p.slice(0,3),2)!==3))for(let y=1;y<=24;y++)p[2+y]==="1"&&f.add(y),p[26+y]==="1"&&m.add(y)}return{purposes:r,legitimateInterests:i,vendors:a,publisherPurposes:f,publisherLegitimateInterests:m,purposeOneTreatment:o[200]==="1"}}function K(n){var t,e;return(e=(t=L(n))==null?void 0:t.purposes)!=null?e:null}var ye=new Set([1,3,4,5,6]);function Y(n,t,e,o){return n.purposes.every(r=>t(r)||!ye.has(r)&&e(r))?n.vendorId===void 0?!0:o(n.vendorId):!1}function V(n){var e,o,s,r,i,a,u;let t=typeof n=="string"?{cmp:n}:n;switch(t.cmp){case"cookiebot":return{cmp:"cookiebot",category:(e=t.category)!=null?e:"statistics"};case"onetrust":return{cmp:"onetrust",group:(o=t.group)!=null?o:"C0002"};case"cookieyes":return{cmp:"cookieyes",category:(s=t.category)!=null?s:"analytics"};case"tcf":return{cmp:"tcf",purposes:t.purposes&&t.purposes.length>0?t.purposes:B,vendorId:typeof t.vendorId=="number"&&t.vendorId>0?t.vendorId:void 0};case"google-consent-mode":return{cmp:"google-consent-mode",type:(r=t.type)!=null?r:"analytics_storage",dataLayer:(i=t.dataLayer)!=null?i:"dataLayer",region:typeof t.region=="string"&&t.region.trim()!==""?t.region.trim().toUpperCase():void 0};case"shopify":return{cmp:"shopify",category:(a=t.category)!=null?a:"analytics"};default:return{cmp:"custom",cookie:t.cookie,value:(u=t.value)!=null?u:"accepted",check:t.check,event:t.event,refused:t.refused}}}function H(n,t){let e=V(n);switch(e.cmp){case"cookiebot":return O(t("CookieConsent"),e.category);case"onetrust":return G(t("OptanonConsent"),e.group);case"cookieyes":return M(t("cookieyes-consent"),e.category);case"tcf":{let o=L(t("euconsent-v2"));return o?Y(o.purposeOneTreatment?N(D({},e),{purposes:e.purposes.filter(s=>s!==1)}):e,s=>o.purposes.has(s)||o.publisherPurposes.has(s),s=>o.legitimateInterests.has(s)||o.publisherLegitimateInterests.has(s),s=>o.vendors?o.vendors.has(s):null):null}case"google-consent-mode":return null;case"shopify":return null;case"custom":return!e.cookie||e.check?null:t(e.cookie)===e.value}}var U=()=>({update:null,global:null,regions:new Map});function X(n,t,e){let o=t&&typeof t=="object"&&"length"in t?Array.prototype.slice.call(t):null;if(!o||o[0]!=="consent"||o[1]!=="default"&&o[1]!=="update")return;let s=o[2],r=s==null?void 0:s[e],i=r==="granted"?!0:r==="denied"?!1:null;if(i===null)return;if(o[1]==="update"){n.update=i;return}let a=s==null?void 0:s.region,l=(Array.isArray(a)?a:typeof a=="string"?[a]:[]).filter(f=>typeof f=="string"&&f.trim()!=="").map(f=>f.trim().toUpperCase());if(l.length===0)n.global=i;else for(let f of l)n.regions.set(f,i)}function he(n){return n.update===!1}function q(n,t){if(n.update!==null)return n.update;if(t){let e=n.regions.get(t);if(e!==void 0)return e;let o=t.split("-")[0],s=n.regions.get(o);if(s!==void 0)return s;if(t===o){for(let[r,i]of n.regions)if(i===!1&&r.startsWith(`${o}-`))return!1}return n.global}for(let e of n.regions.values())if(e===!1)return!1;return n.global!==null?n.global:n.regions.size>0?!1:null}function J(n,t="analytics_storage",e){if(!Array.isArray(n))return null;let o=U();for(let s of n)X(o,s,t);return q(o,(e==null?void 0:e.trim().toUpperCase())||void 0)}function Z(n,t=window){let e=V(n),o=t,s=t.document;switch(e.cmp){case"cookiebot":return{read:()=>{let r=o.Cookiebot,i=O(k(s,"CookieConsent"),e.category);return r!=null&&r.consent&&typeof r.consent[e.category]=="boolean"&&(r.hasResponse===!0||i===null)?r.consent[e.category]===!0:i},subscribe:r=>I(t,["CookiebotOnAccept","CookiebotOnDecline","CookiebotOnConsentReady","CookiebotOnLoad"],r),refused(){let r=o.Cookiebot;return((r==null?void 0:r.hasResponse)===!0||k(s,"CookieConsent")!==void 0)&&this.read()===!1}};case"onetrust":return{read:()=>{let r=o.OnetrustActiveGroups;return typeof r=="string"?`,${r},`.includes(`,${e.group},`):G(k(s,"OptanonConsent"),e.group)},subscribe:r=>I(t,["OneTrustGroupsUpdated"],r),refused(){return k(s,"OptanonAlertBoxClosed")!==void 0&&this.read()===!1}};case"cookieyes":return{read:()=>{var i;let r=o.getCkyConsent;if(typeof r=="function")try{let a=(i=r())==null?void 0:i.categories;if(a&&typeof a[e.category]=="boolean")return a[e.category]===!0}catch(a){}return M(k(s,"cookieyes-consent"),e.category)},subscribe:r=>I(t,["cookieyes_consent_update","cookieyes_banner_load","cookieyes_banner_loaded"],r),refused(){var a,u;let r=/(?:^|,)action:yes(?:,|$)/.test(P((a=k(s,"cookieyes-consent"))!=null?a:"")),i=o.getCkyConsent;if(!r&&typeof i=="function")try{r=((u=i())==null?void 0:u.isUserActionCompleted)===!0}catch(l){}return r&&this.read()===!1}};case"tcf":{let r=null,i=!1,a=!1;return{read:()=>r,refused:()=>r===!1&&!i&&a,subscribe:u=>{let l,f=!1,m=!1,d=(c,g)=>{var h,b,S,R;if(!g||f)return;typeof c.listenerId=="number"&&(l=c.listenerId),i=c.eventStatus==="cmpuishown",a=(c.eventStatus==="tcloaded"||c.eventStatus==="useractioncomplete")&&c.purposeOneTreatment!==!0&&c.gdprApplies!==!1&&((b=(h=c.purpose)==null?void 0:h.consents)==null?void 0:b[1])!==!0&&((R=(S=c.publisher)==null?void 0:S.consents)==null?void 0:R[1])!==!0;let w=c.eventStatus==="tcloaded"||c.eventStatus==="useractioncomplete";w&&(m=!0),i?r=!1:!w&&c.gdprApplies!==!1?m||(r=null):r=c.gdprApplies===!1||Y(c.purposeOneTreatment===!0?N(D({},e),{purposes:e.purposes.filter(v=>v!==1)}):e,v=>{var C,_,A,x;return((_=(C=c.purpose)==null?void 0:C.consents)==null?void 0:_[v])===!0||((x=(A=c.publisher)==null?void 0:A.consents)==null?void 0:x[v])===!0},v=>{var C,_,A,x;return((_=(C=c.purpose)==null?void 0:C.legitimateInterests)==null?void 0:_[v])===!0||((x=(A=c.publisher)==null?void 0:A.legitimateInterests)==null?void 0:x[v])===!0},v=>{var C,_;return((_=(C=c.vendor)==null?void 0:C.consents)==null?void 0:_[v])===!0})===!0,u()},p=0,y=()=>{if(f)return;let c=o.__tcfapi;typeof c=="function"?c("addEventListener",2,d):p++<40&&window.setTimeout(y,250)};return y(),()=>{f=!0;let c=o.__tcfapi;typeof c=="function"&&l!==void 0&&c("removeEventListener",2,()=>{},l)}}}}case"google-consent-mode":{let r=null,i=0,a=U(),u=()=>{let l=o[e.dataLayer];if(!Array.isArray(l))return null;for((l!==r||l.length<i)&&(r=l,i=0,a=U());i<l.length;i++)X(a,l[i],e.type);return q(a,e.region)};return{read:u,refused:()=>u()===!1&&he(a),subscribe:l=>{let f=new WeakSet,m=!1,d=[],p=-1,y=()=>{var w,h;let g=(h=o[w=e.dataLayer])!=null?h:o[w]=[];if(!f.has(g)){f.add(g);let b=g.push,S=function(...R){let v=b.apply(g,R);return p=g.length,m||l(),v};g.push=S,d.push(()=>{g.push===S&&(g.push=b)})}g.length!==p&&(p=g.length,l())};y();let c=window.setInterval(y,1e3);return()=>{m=!0,window.clearInterval(c);for(let g of d)g()}}}}case"shopify":{let r=e.category==="marketing"?"marketingAllowed":e.category==="preferences"?"preferencesProcessingAllowed":"analyticsProcessingAllowed";return{read:()=>{var a,u;let i=(u=(a=o.Shopify)==null?void 0:a.customerPrivacy)==null?void 0:u[r];if(typeof i!="function")return null;try{let l=i();return typeof l=="boolean"?l:null}catch(l){return null}},refused(){var a,u;let i=(a=o.Shopify)==null?void 0:a.customerPrivacy;if(typeof(i==null?void 0:i.currentVisitorConsent)!="function")return!1;try{return((u=i.currentVisitorConsent())==null?void 0:u[e.category])==="no"}catch(l){return!1}},subscribe:i=>{let a=I(t,["visitorConsentCollected"],i),u=!1,l=0,f=()=>{if(u)return;let m=o.Shopify;if(m!=null&&m.customerPrivacy){i();return}if(typeof(m==null?void 0:m.loadFeatures)=="function"){try{m.loadFeatures([{name:"consent-tracking-api",version:"0.1"}],d=>{!u&&!d&&i()})}catch(d){}return}l++<40&&window.setTimeout(f,250)};return f(),()=>{u=!0,a()}}}}case"custom":return{read:()=>{if(e.check)try{return e.check()===!0}catch(i){return!1}if(!e.cookie)return null;let r=k(s,e.cookie);return r===void 0?null:r===e.value},refused:()=>{var r;if(e.check)try{return((r=e.refused)==null?void 0:r.call(e))===!0}catch(i){return!1}return!!e.cookie&&k(s,e.cookie)!==void 0&&k(s,e.cookie)!==e.value},subscribe:r=>e.event?I(t,[e.event],r):()=>{}}}}function F(n){return n?`_${n.slice(0,12)}`:""}var E="_snt_uid";function ee(n){return`${E}${F(n)}`}var $="__sntForgetGen";function te(n){var t,e;try{let o=window,s=(t=o[$])!=null?t:o[$]={};s[n]=((e=s[n])!=null?e:0)+1}catch(o){}}var ne="_snt_snap:";var _e=56*1024;function oe(n){return`_snt_retry_${n.slice(0,12)}`}function re(n){return`_snt_goal_retry_${n.slice(0,12)}`}function se(n){let t=(n||"").toLowerCase();if(!t.includes(".")||/^[\d.]+$|:/.test(t))return[];let e=t.split("."),o=[];for(let s=e.length-2;s>=0;s--)o.push(e.slice(s).join("."));return o}function ie(n){if(typeof window=="undefined"||!n)return!1;te(n);let t=!1,e=ee(n);try{if(new RegExp(`(?:^|; )${e}=`).test(document.cookie)){let i=location.protocol==="https:"?"; Secure":"";for(let a of["",...se(location.hostname)])document.cookie=`${e}=; max-age=0; SameSite=lax; path=/${a?`; domain=${a}`:""}${i}`;t=!0}}catch(i){}let o=F(n),s=[e,"_snt_graph_edges",ne+n,oe(n),re(n),`_snt_graph_nodes${o}`],r=[`_snt_asgn${o}_`];for(let i of["localStorage","sessionStorage"])try{let a=window[i];for(let u of s)a.getItem(u)!==null&&(a.removeItem(u),t=!0);for(let u=a.length-1;u>=0;u--){let l=a.key(u);l&&r.some(f=>l.startsWith(f))&&(a.removeItem(l),t=!0)}}catch(a){}try{(new RegExp(`(?:^|; )${E}=[^;]`).test(document.cookie)||localStorage.getItem(E)!==null||sessionStorage.getItem(E)!==null)&&localStorage.setItem(`${E}_tomb${o}`,"1")}catch(i){}return t}0&&(module.exports={TCF_DEFAULT_PURPOSES,consentFromCookies,consentModeGranted,consentWatcher,cookiebotCookieGrants,cookieyesCookieGrants,forgetVisitor,onetrustCookieGrants,tcStringConsents,tcStringPurposes});
|
|
1
|
+
"use strict";var T=Object.defineProperty,ae=Object.defineProperties,ue=Object.getOwnPropertyDescriptor,ce=Object.getOwnPropertyDescriptors,le=Object.getOwnPropertyNames,Q=Object.getOwnPropertySymbols;var z=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable;var j=(n,t,e)=>t in n?T(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,D=(n,t)=>{for(var e in t||(t={}))z.call(t,e)&&j(n,e,t[e]);if(Q)for(var e of Q(t))de.call(t,e)&&j(n,e,t[e]);return n},N=(n,t)=>ae(n,ce(t));var fe=(n,t)=>{for(var e in t)T(n,e,{get:t[e],enumerable:!0})},pe=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of le(t))!z.call(n,s)&&s!==e&&T(n,s,{get:()=>t[s],enumerable:!(o=ue(t,s))||o.enumerable});return n};var ge=n=>pe(T({},"__esModule",{value:!0}),n);var ve={};fe(ve,{TCF_DEFAULT_PURPOSES:()=>B,consentFromCookies:()=>H,consentModeGranted:()=>J,consentWatcher:()=>Z,cookiebotCookieGrants:()=>O,cookieyesCookieGrants:()=>L,forgetVisitor:()=>ie,onetrustCookieGrants:()=>G,tcStringConsents:()=>M,tcStringPurposes:()=>K});module.exports=ge(ve);var B=[1,5,6,8],P=n=>{try{return decodeURIComponent(n)}catch(t){return n}};function k(n,t){if(n)for(let e of n.cookie.split(";")){let o=e.indexOf("=");if(o>0&&e.slice(0,o).trim()===t)return e.slice(o+1).trim()}}function I(n,t,e){let o=[n,...n.document?[n.document]:[]];for(let s of o)for(let r of t)s.addEventListener(r,e);return()=>{for(let s of o)for(let r of t)s.removeEventListener(r,e)}}function O(n,t="statistics"){if(n==null||n==="")return null;let e=P(n).trim();if(e==="-1")return!0;if(e==="0")return!1;let o=new RegExp(`[{,]\\s*${t}\\s*:\\s*(true|false)`).exec(e);return o?o[1]==="true":null}function G(n,t="C0002"){if(n==null||n==="")return null;let e;for(let o of n.split("&"))o.startsWith("groups=")&&(e=P(o.slice(7)));if(e==null)return null;for(let o of e.split(",")){let[s,r]=o.split(":");if(s===t)return r==="1"}return null}function L(n,t="analytics"){if(n==null||n==="")return null;let e=new RegExp(`(?:^|,)${t}:(yes|no)(?:,|$)`).exec(P(n));return e?e[1]==="yes":null}var me="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",W=n=>{let t="";for(let e of n)t+=me.indexOf(e).toString(2).padStart(6,"0");return t};function M(n){if(!n)return null;let t=n.split("."),e=t[0];if(!/^[A-Za-z0-9_-]+$/.test(e))return null;let o=W(e);if(o.length<200||parseInt(o.slice(0,6),2)!==2)return null;let s=(d,p)=>d+p<=o.length?parseInt(o.slice(d,d+p),2):null,r=new Set,i=new Set;for(let d=1;d<=24;d++)o[151+d]==="1"&&r.add(d),o[175+d]==="1"&&i.add(d);let a=null,u=s(213,16),l=s(229,1);if(u!==null&&l===0){if(230+u<=o.length){a=new Set;for(let d=1;d<=u;d++)o[229+d]==="1"&&a.add(d)}}else if(u!==null&&l===1){let d=s(230,12),p=242,y=new Set,c=d!==null;for(let g=0;c&&g<(d!=null?d:0);g++){let w=s(p,1),h=s(p+1,16);if(w===null||h===null)c=!1;else if(w===1){let b=s(p+17,16);if(b===null||b<h||b-h>65535)c=!1;else for(let S=h;S<=b;S++)y.add(S);p+=33}else y.add(h),p+=17}c&&(a=y)}let f=new Set,m=new Set;for(let d of t.slice(1)){if(!/^[A-Za-z0-9_-]+$/.test(d))continue;let p=W(d);if(!(p.length<51||parseInt(p.slice(0,3),2)!==3))for(let y=1;y<=24;y++)p[2+y]==="1"&&f.add(y),p[26+y]==="1"&&m.add(y)}return{purposes:r,legitimateInterests:i,vendors:a,publisherPurposes:f,publisherLegitimateInterests:m,purposeOneTreatment:o[200]==="1"}}function K(n){var t,e;return(e=(t=M(n))==null?void 0:t.purposes)!=null?e:null}var ye=new Set([1,3,4,5,6]);function Y(n,t,e,o){return n.purposes.every(r=>t(r)||!ye.has(r)&&e(r))?n.vendorId===void 0?!0:o(n.vendorId):!1}function V(n){var e,o,s,r,i,a,u;let t=typeof n=="string"?{cmp:n}:n;switch(t.cmp){case"cookiebot":return{cmp:"cookiebot",category:(e=t.category)!=null?e:"statistics"};case"onetrust":return{cmp:"onetrust",group:(o=t.group)!=null?o:"C0002"};case"cookieyes":return{cmp:"cookieyes",category:(s=t.category)!=null?s:"analytics"};case"tcf":return{cmp:"tcf",purposes:t.purposes&&t.purposes.length>0?t.purposes:B,vendorId:typeof t.vendorId=="number"&&t.vendorId>0?t.vendorId:void 0};case"google-consent-mode":return{cmp:"google-consent-mode",type:(r=t.type)!=null?r:"analytics_storage",dataLayer:(i=t.dataLayer)!=null?i:"dataLayer",region:typeof t.region=="string"&&t.region.trim()!==""?t.region.trim().toUpperCase():void 0};case"shopify":return{cmp:"shopify",category:(a=t.category)!=null?a:"analytics"};default:return{cmp:"custom",cookie:t.cookie,value:(u=t.value)!=null?u:"accepted",check:t.check,event:t.event,refused:t.refused}}}function H(n,t){let e=V(n);switch(e.cmp){case"cookiebot":return O(t("CookieConsent"),e.category);case"onetrust":return G(t("OptanonConsent"),e.group);case"cookieyes":return L(t("cookieyes-consent"),e.category);case"tcf":{let o=M(t("euconsent-v2"));return o?Y(o.purposeOneTreatment?N(D({},e),{purposes:e.purposes.filter(s=>s!==1)}):e,s=>o.purposes.has(s)||o.publisherPurposes.has(s),s=>o.legitimateInterests.has(s)||o.publisherLegitimateInterests.has(s),s=>o.vendors?o.vendors.has(s):null):null}case"google-consent-mode":return null;case"shopify":return null;case"custom":return!e.cookie||e.check?null:t(e.cookie)===e.value}}var U=()=>({update:null,global:null,regions:new Map});function X(n,t,e){let o=t&&typeof t=="object"&&"length"in t?Array.prototype.slice.call(t):null;if(!o||o[0]!=="consent"||o[1]!=="default"&&o[1]!=="update")return;let s=o[2],r=s==null?void 0:s[e],i=r==="granted"?!0:r==="denied"?!1:null;if(i===null)return;if(o[1]==="update"){n.update=i;return}let a=s==null?void 0:s.region,l=(Array.isArray(a)?a:typeof a=="string"?[a]:[]).filter(f=>typeof f=="string"&&f.trim()!=="").map(f=>f.trim().toUpperCase());if(l.length===0)n.global=i;else for(let f of l)n.regions.set(f,i)}function he(n){return n.update===!1}function q(n,t){if(n.update!==null)return n.update;if(t){let e=n.regions.get(t);if(e!==void 0)return e;let o=t.split("-")[0],s=n.regions.get(o);if(s!==void 0)return s;if(t===o){for(let[r,i]of n.regions)if(i===!1&&r.startsWith(`${o}-`))return!1}return n.global}for(let e of n.regions.values())if(e===!1)return!1;return n.global!==null?n.global:n.regions.size>0?!1:null}function J(n,t="analytics_storage",e){if(!Array.isArray(n))return null;let o=U();for(let s of n)X(o,s,t);return q(o,(e==null?void 0:e.trim().toUpperCase())||void 0)}function Z(n,t=window){let e=V(n),o=t,s=t.document;switch(e.cmp){case"cookiebot":return{read:()=>{let r=o.Cookiebot,i=O(k(s,"CookieConsent"),e.category);return r!=null&&r.consent&&typeof r.consent[e.category]=="boolean"&&(r.hasResponse===!0||i===null)?r.consent[e.category]===!0:i},subscribe:r=>I(t,["CookiebotOnAccept","CookiebotOnDecline","CookiebotOnConsentReady","CookiebotOnLoad"],r),refused(){let r=o.Cookiebot;return((r==null?void 0:r.hasResponse)===!0||k(s,"CookieConsent")!==void 0)&&this.read()===!1}};case"onetrust":return{read:()=>{let r=o.OnetrustActiveGroups;return typeof r=="string"?`,${r},`.includes(`,${e.group},`):G(k(s,"OptanonConsent"),e.group)},subscribe:r=>I(t,["OneTrustGroupsUpdated"],r),refused(){return k(s,"OptanonAlertBoxClosed")!==void 0&&this.read()===!1}};case"cookieyes":return{read:()=>{var i;let r=o.getCkyConsent;if(typeof r=="function")try{let a=(i=r())==null?void 0:i.categories;if(a&&typeof a[e.category]=="boolean")return a[e.category]===!0}catch(a){}return L(k(s,"cookieyes-consent"),e.category)},subscribe:r=>I(t,["cookieyes_consent_update","cookieyes_banner_load","cookieyes_banner_loaded"],r),refused(){var a,u;let r=/(?:^|,)action:yes(?:,|$)/.test(P((a=k(s,"cookieyes-consent"))!=null?a:"")),i=o.getCkyConsent;if(!r&&typeof i=="function")try{r=((u=i())==null?void 0:u.isUserActionCompleted)===!0}catch(l){}return r&&this.read()===!1}};case"tcf":{let r=null,i=!1,a=!1;return{read:()=>r,refused:()=>r===!1&&!i&&a,subscribe:u=>{let l,f=!1,m=!1,d=(c,g)=>{var h,b,S,R;if(!g||f)return;typeof c.listenerId=="number"&&(l=c.listenerId),i=c.eventStatus==="cmpuishown",a=(c.eventStatus==="tcloaded"||c.eventStatus==="useractioncomplete")&&c.purposeOneTreatment!==!0&&c.gdprApplies!==!1&&((b=(h=c.purpose)==null?void 0:h.consents)==null?void 0:b[1])!==!0&&((R=(S=c.publisher)==null?void 0:S.consents)==null?void 0:R[1])!==!0;let w=c.eventStatus==="tcloaded"||c.eventStatus==="useractioncomplete";w&&(m=!0),i?r=!1:!w&&c.gdprApplies!==!1?m||(r=null):r=c.gdprApplies===!1||Y(c.purposeOneTreatment===!0?N(D({},e),{purposes:e.purposes.filter(v=>v!==1)}):e,v=>{var C,_,A,x;return((_=(C=c.purpose)==null?void 0:C.consents)==null?void 0:_[v])===!0||((x=(A=c.publisher)==null?void 0:A.consents)==null?void 0:x[v])===!0},v=>{var C,_,A,x;return((_=(C=c.purpose)==null?void 0:C.legitimateInterests)==null?void 0:_[v])===!0||((x=(A=c.publisher)==null?void 0:A.legitimateInterests)==null?void 0:x[v])===!0},v=>{var C,_;return((_=(C=c.vendor)==null?void 0:C.consents)==null?void 0:_[v])===!0})===!0,u()},p=0,y=()=>{if(f)return;let c=o.__tcfapi;typeof c=="function"?c("addEventListener",2,d):p++<40&&window.setTimeout(y,250)};return y(),()=>{f=!0;let c=o.__tcfapi;typeof c=="function"&&l!==void 0&&c("removeEventListener",2,()=>{},l)}}}}case"google-consent-mode":{let r=null,i=0,a=U(),u=()=>{let l=o[e.dataLayer];if(!Array.isArray(l))return null;for((l!==r||l.length<i)&&(r=l,i=0,a=U());i<l.length;i++)X(a,l[i],e.type);return q(a,e.region)};return{read:u,refused:()=>u()===!1&&he(a),subscribe:l=>{let f=new WeakSet,m=!1,d=[],p=-1,y=()=>{var w,h;let g=(h=o[w=e.dataLayer])!=null?h:o[w]=[];if(!f.has(g)){f.add(g);let b=g.push,S=function(...R){let v=b.apply(g,R);return p=g.length,m||l(),v};g.push=S,d.push(()=>{g.push===S&&(g.push=b)})}g.length!==p&&(p=g.length,l())};y();let c=window.setInterval(y,1e3);return()=>{m=!0,window.clearInterval(c);for(let g of d)g()}}}}case"shopify":{let r=e.category==="marketing"?"marketingAllowed":e.category==="preferences"?"preferencesProcessingAllowed":"analyticsProcessingAllowed";return{read:()=>{var a,u;let i=(u=(a=o.Shopify)==null?void 0:a.customerPrivacy)==null?void 0:u[r];if(typeof i!="function")return null;try{let l=i();return typeof l=="boolean"?l:null}catch(l){return null}},refused(){var a,u;let i=(a=o.Shopify)==null?void 0:a.customerPrivacy;if(typeof(i==null?void 0:i.currentVisitorConsent)!="function")return!1;try{return((u=i.currentVisitorConsent())==null?void 0:u[e.category])==="no"}catch(l){return!1}},subscribe:i=>{let a=I(t,["visitorConsentCollected"],i),u=!1,l=0,f=()=>{if(u)return;let m=o.Shopify;if(m!=null&&m.customerPrivacy){i();return}if(typeof(m==null?void 0:m.loadFeatures)=="function"){try{m.loadFeatures([{name:"consent-tracking-api",version:"0.1"}],d=>{!u&&!d&&i()})}catch(d){}return}l++<40&&window.setTimeout(f,250)};return f(),()=>{u=!0,a()}}}}case"custom":return{read:()=>{if(e.check)try{return e.check()===!0}catch(i){return!1}if(!e.cookie)return null;let r=k(s,e.cookie);return r===void 0?null:r===e.value},refused:()=>{var r;if(e.check)try{return((r=e.refused)==null?void 0:r.call(e))===!0}catch(i){return!1}return!!e.cookie&&k(s,e.cookie)!==void 0&&k(s,e.cookie)!==e.value},subscribe:r=>e.event?I(t,[e.event],r):()=>{}}}}function F(n){return n?`_${n.slice(0,12)}`:""}var E="_snt_uid";function ee(n){return`${E}${F(n)}`}var $="__sntForgetGen";function te(n){var t,e;try{let o=window,s=(t=o[$])!=null?t:o[$]={};s[n]=((e=s[n])!=null?e:0)+1}catch(o){}}var ne="_snt_snap:";var _e=56*1024;function oe(n){return`_snt_retry_${n.slice(0,12)}`}function re(n){return`_snt_goal_retry_${n.slice(0,12)}`}function se(n){let t=(n||"").toLowerCase();if(!t.includes(".")||/^[\d.]+$|:/.test(t))return[];let e=t.split("."),o=[];for(let s=e.length-2;s>=0;s--)o.push(e.slice(s).join("."));return o}function ie(n){if(typeof window=="undefined"||!n)return!1;te(n);let t=!1,e=ee(n);try{if(new RegExp(`(?:^|; )${e}=`).test(document.cookie)){let i=location.protocol==="https:"?"; Secure":"";for(let a of["",...se(location.hostname)])document.cookie=`${e}=; max-age=0; SameSite=lax; path=/${a?`; domain=${a}`:""}${i}`;t=!0}}catch(i){}let o=F(n),s=[e,"_snt_graph_edges",ne+n,oe(n),re(n),`_snt_graph_nodes${o}`],r=[`_snt_asgn${o}_`];for(let i of["localStorage","sessionStorage"])try{let a=window[i];for(let u of s)a.getItem(u)!==null&&(a.removeItem(u),t=!0);for(let u=a.length-1;u>=0;u--){let l=a.key(u);l&&r.some(f=>l.startsWith(f))&&(a.removeItem(l),t=!0)}}catch(a){}try{(new RegExp(`(?:^|; )${E}=[^;]`).test(document.cookie)||localStorage.getItem(E)!==null||sessionStorage.getItem(E)!==null)&&localStorage.setItem(`${E}_tomb${o}`,"1")}catch(i){}return t}0&&(module.exports={TCF_DEFAULT_PURPOSES,consentFromCookies,consentModeGranted,consentWatcher,cookiebotCookieGrants,cookieyesCookieGrants,forgetVisitor,onetrustCookieGrants,tcStringConsents,tcStringPurposes});
|
|
2
2
|
//# sourceMappingURL=index-consent.js.map
|