@sentientui/core 0.39.1 → 0.40.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.
Files changed (40) hide show
  1. package/dist/chunk-7RF3JRZO.mjs +2 -0
  2. package/dist/chunk-7RF3JRZO.mjs.map +1 -0
  3. package/dist/chunk-B4A22OMG.mjs +2 -0
  4. package/dist/chunk-B4A22OMG.mjs.map +1 -0
  5. package/dist/chunk-IUT3UXTD.mjs +2 -0
  6. package/dist/chunk-IUT3UXTD.mjs.map +1 -0
  7. package/dist/{index-BAfi7_FG.d.cts → index-CN9VJxiW.d.cts} +45 -2
  8. package/dist/{index-DyKtujwf.d.ts → index-CROWjwsJ.d.ts} +45 -2
  9. package/dist/index-consent.js +1 -1
  10. package/dist/index-consent.js.map +1 -1
  11. package/dist/index-consent.mjs +1 -1
  12. package/dist/index-engagement.js.map +1 -1
  13. package/dist/index-engagement.mjs +1 -1
  14. package/dist/index-graph.d.cts +4 -4
  15. package/dist/index-graph.d.ts +4 -4
  16. package/dist/index-graph.js +1 -1
  17. package/dist/index-graph.js.map +1 -1
  18. package/dist/index-graph.mjs +1 -1
  19. package/dist/index-local.d.cts +2 -2
  20. package/dist/index-local.d.ts +2 -2
  21. package/dist/index-server.d.cts +27 -4
  22. package/dist/index-server.d.ts +27 -4
  23. package/dist/index-server.js +1 -1
  24. package/dist/index-server.js.map +1 -1
  25. package/dist/index-server.mjs +1 -1
  26. package/dist/index-server.mjs.map +1 -1
  27. package/dist/index.d.cts +2 -2
  28. package/dist/index.d.ts +2 -2
  29. package/dist/index.js +1 -1
  30. package/dist/index.js.map +1 -1
  31. package/dist/index.mjs +1 -1
  32. package/dist/{session-meta-qx4kIL5y.d.cts → session-meta-BG8w53d7.d.cts} +1 -1
  33. package/dist/{session-meta-BtRtwsHI.d.ts → session-meta-D9Wx2PtC.d.ts} +1 -1
  34. package/package.json +1 -1
  35. package/dist/chunk-MKM7TD3L.mjs +0 -2
  36. package/dist/chunk-MKM7TD3L.mjs.map +0 -1
  37. package/dist/chunk-QEIHHO3T.mjs +0 -2
  38. package/dist/chunk-QEIHHO3T.mjs.map +0 -1
  39. package/dist/chunk-XZRKD2GS.mjs +0 -2
  40. package/dist/chunk-XZRKD2GS.mjs.map +0 -1
@@ -1,10 +1,29 @@
1
1
  import { $ as SitePalette, a4 as StyleVocabulary } from './style-vocabulary-Ba_g6_DD.cjs';
2
- import { d as SlotConfigEntry, e as SlotDeclInput, b as CompoundLocator } from './session-meta-qx4kIL5y.cjs';
2
+ import { d as SlotConfigEntry, e as SlotDeclInput, b as CompoundLocator } from './session-meta-BG8w53d7.cjs';
3
3
  import { c as RenderCaps, R as RegionSkeleton } from './region-skeleton-BRIVB-qf.cjs';
4
4
  import './index-consent.cjs';
5
5
  import { SlotResult } from '@sentientui/policy';
6
6
 
7
+ /**
8
+ * Candidate domains for the shared visitor cookie. The visitor id lives on the
9
+ * site's registrable domain (`ruttl.com` for `app.ruttl.com`), so a marketing
10
+ * site and its app subdomain see ONE visitor: host-only cookies gave each host
11
+ * its own id, and a journey that started on the landing page and converted in
12
+ * the app (or the app's backend) could never be joined to the decisions that
13
+ * earned it.
14
+ *
15
+ * Detection (session.ts `detectCookieDomain`) works the way analytics.js and
16
+ * GA's `cookieDomain: 'auto'` do: try the shortest parent first and keep the
17
+ * first one the browser accepts. The browser refuses public suffixes
18
+ * (`co.uk`, `vercel.app`, `herokuapp.com`), so no suffix list ships in the
19
+ * bundle — those fall through to the next candidate, and a host with no
20
+ * acceptable parent stays host-only.
21
+ */
22
+ /** `false` = host-only (the pre-sharing behaviour); a string = that domain. */
23
+ type CookieDomainOption = string | false | undefined;
24
+
7
25
  /** Manages anonymous session identity with cookie + localStorage layers. */
26
+
8
27
  type SessionConfig = {
9
28
  cookieName?: string;
10
29
  cookieTTLDays?: number;
@@ -21,11 +40,20 @@ type SessionConfig = {
21
40
  * on first visit rather than generating a new, orphaned ID.
22
41
  */
23
42
  ssrSessionId?: string;
43
+ /**
44
+ * Where the visitor cookie lives. Default (undefined): the site's
45
+ * registrable domain, auto-detected, so `example.com` and `app.example.com`
46
+ * share one visitor. `false`: this host only. A string: that domain.
47
+ */
48
+ cookieDomain?: CookieDomainOption;
24
49
  };
25
50
  type SessionManager = {
26
51
  getSessionId(): string | null;
27
52
  /** True when neither cookie nor localStorage could be written — id is in-memory only. */
28
53
  isEphemeral(): boolean;
54
+ /** The domain the visitor cookie is shared on (null = this host only) —
55
+ * also the site's extent for referrer classification. */
56
+ domain: string | null;
29
57
  destroy(): void;
30
58
  };
31
59
 
@@ -362,6 +390,13 @@ type SentientConfig = {
362
390
  * ensuring events and goals are attributed to the same session the server used for assignment.
363
391
  */
364
392
  ssrSessionId?: string;
393
+ /**
394
+ * Where the visitor cookie lives. By default it is shared on the site's
395
+ * registrable domain (auto-detected), so `example.com` and
396
+ * `app.example.com` — with the same project key — count one visitor and one
397
+ * journey. `false` keeps it on this host only; a string names the domain.
398
+ */
399
+ cookieDomain?: string | false;
365
400
  /**
366
401
  * ISO 3166-1 alpha-2 country code for the visitor. When provided (e.g. from
367
402
  * the `CF-IPCountry` header in a Next.js server component), it is included in
@@ -563,7 +598,15 @@ type SentientClient = {
563
598
  * variant experiments; `goal()` is session-level only (no component attribution).
564
599
  */
565
600
  componentGoal(componentId: string, goalType: string, opts?: ComponentGoalOptions): void;
566
- identify(userId: string): void;
601
+ /**
602
+ * Links this visitor to your user id. Pass `userHash` — `signUserId(userId,
603
+ * secretKey)` computed on your server — to make the link VERIFIED: once a
604
+ * project signs its identifies, only verified links receive server goals by
605
+ * `userId` and carry the user's profile across devices.
606
+ */
607
+ identify(userId: string, opts?: {
608
+ userHash?: string;
609
+ }): void;
567
610
  /**
568
611
  * The visitor id (session id) for carrying a conversion to your server
569
612
  * later: store it with the order/sign-up, then pass it to `trackServerGoal`.
@@ -1,10 +1,29 @@
1
1
  import { $ as SitePalette, a4 as StyleVocabulary } from './style-vocabulary-Ba_g6_DD.js';
2
- import { d as SlotConfigEntry, e as SlotDeclInput, b as CompoundLocator } from './session-meta-BtRtwsHI.js';
2
+ import { d as SlotConfigEntry, e as SlotDeclInput, b as CompoundLocator } from './session-meta-D9Wx2PtC.js';
3
3
  import { c as RenderCaps, R as RegionSkeleton } from './region-skeleton-BRIVB-qf.js';
4
4
  import './index-consent.js';
5
5
  import { SlotResult } from '@sentientui/policy';
6
6
 
7
+ /**
8
+ * Candidate domains for the shared visitor cookie. The visitor id lives on the
9
+ * site's registrable domain (`ruttl.com` for `app.ruttl.com`), so a marketing
10
+ * site and its app subdomain see ONE visitor: host-only cookies gave each host
11
+ * its own id, and a journey that started on the landing page and converted in
12
+ * the app (or the app's backend) could never be joined to the decisions that
13
+ * earned it.
14
+ *
15
+ * Detection (session.ts `detectCookieDomain`) works the way analytics.js and
16
+ * GA's `cookieDomain: 'auto'` do: try the shortest parent first and keep the
17
+ * first one the browser accepts. The browser refuses public suffixes
18
+ * (`co.uk`, `vercel.app`, `herokuapp.com`), so no suffix list ships in the
19
+ * bundle — those fall through to the next candidate, and a host with no
20
+ * acceptable parent stays host-only.
21
+ */
22
+ /** `false` = host-only (the pre-sharing behaviour); a string = that domain. */
23
+ type CookieDomainOption = string | false | undefined;
24
+
7
25
  /** Manages anonymous session identity with cookie + localStorage layers. */
26
+
8
27
  type SessionConfig = {
9
28
  cookieName?: string;
10
29
  cookieTTLDays?: number;
@@ -21,11 +40,20 @@ type SessionConfig = {
21
40
  * on first visit rather than generating a new, orphaned ID.
22
41
  */
23
42
  ssrSessionId?: string;
43
+ /**
44
+ * Where the visitor cookie lives. Default (undefined): the site's
45
+ * registrable domain, auto-detected, so `example.com` and `app.example.com`
46
+ * share one visitor. `false`: this host only. A string: that domain.
47
+ */
48
+ cookieDomain?: CookieDomainOption;
24
49
  };
25
50
  type SessionManager = {
26
51
  getSessionId(): string | null;
27
52
  /** True when neither cookie nor localStorage could be written — id is in-memory only. */
28
53
  isEphemeral(): boolean;
54
+ /** The domain the visitor cookie is shared on (null = this host only) —
55
+ * also the site's extent for referrer classification. */
56
+ domain: string | null;
29
57
  destroy(): void;
30
58
  };
31
59
 
@@ -362,6 +390,13 @@ type SentientConfig = {
362
390
  * ensuring events and goals are attributed to the same session the server used for assignment.
363
391
  */
364
392
  ssrSessionId?: string;
393
+ /**
394
+ * Where the visitor cookie lives. By default it is shared on the site's
395
+ * registrable domain (auto-detected), so `example.com` and
396
+ * `app.example.com` — with the same project key — count one visitor and one
397
+ * journey. `false` keeps it on this host only; a string names the domain.
398
+ */
399
+ cookieDomain?: string | false;
365
400
  /**
366
401
  * ISO 3166-1 alpha-2 country code for the visitor. When provided (e.g. from
367
402
  * the `CF-IPCountry` header in a Next.js server component), it is included in
@@ -563,7 +598,15 @@ type SentientClient = {
563
598
  * variant experiments; `goal()` is session-level only (no component attribution).
564
599
  */
565
600
  componentGoal(componentId: string, goalType: string, opts?: ComponentGoalOptions): void;
566
- identify(userId: string): void;
601
+ /**
602
+ * Links this visitor to your user id. Pass `userHash` — `signUserId(userId,
603
+ * secretKey)` computed on your server — to make the link VERIFIED: once a
604
+ * project signs its identifies, only verified links receive server goals by
605
+ * `userId` and carry the user's profile across devices.
606
+ */
607
+ identify(userId: string, opts?: {
608
+ userHash?: string;
609
+ }): void;
567
610
  /**
568
611
  * The visitor id (session id) for carrying a conversion to your server
569
612
  * later: store it with the order/sign-up, then pass it to `trackServerGoal`.
@@ -1,2 +1,2 @@
1
- "use strict";var T=Object.defineProperty,ie=Object.defineProperties,ae=Object.getOwnPropertyDescriptor,ue=Object.getOwnPropertyDescriptors,ce=Object.getOwnPropertyNames,Q=Object.getOwnPropertySymbols;var W=Object.prototype.hasOwnProperty,le=Object.prototype.propertyIsEnumerable;var z=(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={}))W.call(t,e)&&z(n,e,t[e]);if(Q)for(var e of Q(t))le.call(t,e)&&z(n,e,t[e]);return n},N=(n,t)=>ie(n,ue(t));var de=(n,t)=>{for(var e in t)T(n,e,{get:t[e],enumerable:!0})},fe=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ce(t))!W.call(n,s)&&s!==e&&T(n,s,{get:()=>t[s],enumerable:!(o=ae(t,s))||o.enumerable});return n};var pe=n=>fe(T({},"__esModule",{value:!0}),n);var he={};de(he,{TCF_DEFAULT_PURPOSES:()=>B,consentFromCookies:()=>H,consentModeGranted:()=>J,consentWatcher:()=>Z,cookiebotCookieGrants:()=>O,cookieyesCookieGrants:()=>M,forgetVisitor:()=>se,onetrustCookieGrants:()=>G,tcStringConsents:()=>L,tcStringPurposes:()=>K});module.exports=pe(he);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 ge="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",j=n=>{let t="";for(let e of n)t+=ge.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=j(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,m=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++)m.add(S);p+=33}else m.add(h),p+=17}c&&(a=m)}let f=new Set,y=new Set;for(let d of t.slice(1)){if(!/^[A-Za-z0-9_-]+$/.test(d))continue;let p=j(d);if(!(p.length<51||parseInt(p.slice(0,3),2)!==3))for(let m=1;m<=24;m++)p[2+m]==="1"&&f.add(m),p[26+m]==="1"&&y.add(m)}return{purposes:r,legitimateInterests:i,vendors:a,publisherPurposes:f,publisherLegitimateInterests:y,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 me(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,y=!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&&(y=!0),i?r=!1:!w&&c.gdprApplies!==!1?y||(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,m=()=>{if(f)return;let c=o.__tcfapi;typeof c=="function"?c("addEventListener",2,d):p++<40&&window.setTimeout(m,250)};return m(),()=>{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&&me(a),subscribe:l=>{let f=new WeakSet,y=!1,d=[],p=-1,m=()=>{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,y||l(),v};g.push=S,d.push(()=>{g.push===S&&(g.push=b)})}g.length!==p&&(p=g.length,l())};m();let c=window.setInterval(m,1e3);return()=>{y=!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 y=o.Shopify;if(y!=null&&y.customerPrivacy){i();return}if(typeof(y==null?void 0:y.loadFeatures)=="function"){try{y.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 $(n){return n?`_${n.slice(0,12)}`:""}var E="_snt_uid";function ee(n){return`${E}${$(n)}`}var F="__sntForgetGen";function te(n){var t,e;try{let o=window,s=(t=o[F])!=null?t:o[F]={};s[n]=((e=s[n])!=null?e:0)+1}catch(o){}}var ne="_snt_snap:";var Ce=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){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":"";document.cookie=`${e}=; max-age=0; SameSite=lax; path=/${i}`,t=!0}}catch(i){}let o=$(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:()=>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});
2
2
  //# sourceMappingURL=index-consent.js.map