@lucida-analytics/browser 0.1.7 → 0.1.9

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 (90) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/README.md +43 -6
  3. package/dist/autocapture.d.ts +1 -1
  4. package/dist/{banner-7LEREYUH.js → banner-TXLAMTQM.js} +1 -1
  5. package/dist/{static/v0.1.7/chunk-FUE3SDQU.js → chunk-B722OERZ.js} +1 -1
  6. package/dist/chunk-IXDYCBAD.js +1 -0
  7. package/dist/{client-CjixZMny.d.ts → client-CeNuJRRB.d.ts} +2 -2
  8. package/dist/consent.d.ts +15 -8
  9. package/dist/consent.js +1 -1
  10. package/dist/core.d.ts +3 -3
  11. package/dist/core.js +3 -3
  12. package/dist/correlate.d.ts +2 -2
  13. package/dist/correlate.js +1 -1
  14. package/dist/early-access.d.ts +1 -1
  15. package/dist/experiments.d.ts +1 -1
  16. package/dist/flags.d.ts +1 -1
  17. package/dist/forms.d.ts +1 -1
  18. package/dist/guides.d.ts +1 -1
  19. package/dist/guides.js +1 -1
  20. package/dist/heatmaps.d.ts +1 -1
  21. package/dist/host-headers.d.ts +1 -1
  22. package/dist/index.d.ts +3 -3
  23. package/dist/index.js +2 -2
  24. package/dist/inspector.d.ts +1 -1
  25. package/dist/lucida.js +2 -2
  26. package/dist/{persistent-SLVINN5A.js → persistent-G2OR2L2N.js} +1 -1
  27. package/dist/recommendations.d.ts +1 -1
  28. package/dist/{recorder-4WIMQCLR.js → recorder-62UP73RT.js} +4 -4
  29. package/dist/replay.d.ts +2 -2
  30. package/dist/replay.js +1 -1
  31. package/dist/static/v0/{banner-7LEREYUH.js → banner-TXLAMTQM.js} +1 -1
  32. package/dist/static/v0/{chunk-FUE3SDQU.js → chunk-B722OERZ.js} +1 -1
  33. package/dist/static/v0/chunk-IXDYCBAD.js +1 -0
  34. package/dist/static/v0/consent.js +1 -1
  35. package/dist/static/v0/core.js +3 -3
  36. package/dist/static/v0/correlate.js +1 -1
  37. package/dist/static/v0/guides.js +1 -1
  38. package/dist/static/v0/index.js +2 -2
  39. package/dist/static/v0/lucida.js +2 -2
  40. package/dist/static/v0/manifest.json +13 -13
  41. package/dist/static/v0/{persistent-SLVINN5A.js → persistent-G2OR2L2N.js} +1 -1
  42. package/dist/static/{v0.1.7/recorder-4WIMQCLR.js → v0/recorder-62UP73RT.js} +4 -4
  43. package/dist/static/v0/replay.js +1 -1
  44. package/dist/static/v0/toolbar.js +4 -4
  45. package/dist/static/v0/{validation-HGJXZ553.js → validation-S6TYVWAI.js} +1 -1
  46. package/dist/static/{v0.1.7/banner-7LEREYUH.js → v0.1.9/banner-TXLAMTQM.js} +1 -1
  47. package/dist/{chunk-FUE3SDQU.js → static/v0.1.9/chunk-B722OERZ.js} +1 -1
  48. package/dist/static/v0.1.9/chunk-IXDYCBAD.js +1 -0
  49. package/dist/static/v0.1.9/consent.js +1 -0
  50. package/dist/static/v0.1.9/core.js +3 -0
  51. package/dist/static/v0.1.9/correlate.js +1 -0
  52. package/dist/static/{v0.1.7 → v0.1.9}/guides.js +1 -1
  53. package/dist/static/v0.1.9/index.js +3 -0
  54. package/dist/static/v0.1.9/lucida.js +3 -0
  55. package/dist/static/v0.1.9/manifest.json +28 -0
  56. package/dist/static/{v0.1.7/persistent-SLVINN5A.js → v0.1.9/persistent-G2OR2L2N.js} +1 -1
  57. package/dist/static/{v0/recorder-4WIMQCLR.js → v0.1.9/recorder-62UP73RT.js} +4 -4
  58. package/dist/static/{v0.1.7 → v0.1.9}/replay.js +1 -1
  59. package/dist/static/{v0.1.7 → v0.1.9}/toolbar.js +4 -4
  60. package/dist/static/{v0.1.7/validation-HGJXZ553.js → v0.1.9/validation-S6TYVWAI.js} +1 -1
  61. package/dist/toolbar.d.ts +1 -1
  62. package/dist/toolbar.js +4 -4
  63. package/dist/{types-vmPeWA7a.d.ts → types-B_CVJeLI.d.ts} +17 -5
  64. package/dist/{validation-HGJXZ553.js → validation-S6TYVWAI.js} +1 -1
  65. package/dist/webmcp.d.ts +1 -1
  66. package/package.json +4 -3
  67. package/storage.json +5 -2
  68. package/dist/chunk-536QABLP.js +0 -1
  69. package/dist/static/v0/chunk-536QABLP.js +0 -1
  70. package/dist/static/v0.1.7/chunk-536QABLP.js +0 -1
  71. package/dist/static/v0.1.7/consent.js +0 -1
  72. package/dist/static/v0.1.7/core.js +0 -3
  73. package/dist/static/v0.1.7/correlate.js +0 -1
  74. package/dist/static/v0.1.7/index.js +0 -3
  75. package/dist/static/v0.1.7/lucida.js +0 -3
  76. package/dist/static/v0.1.7/manifest.json +0 -28
  77. /package/dist/static/{v0.1.7 → v0.1.9}/autocapture.js +0 -0
  78. /package/dist/static/{v0.1.7 → v0.1.9}/chunk-AWIQCFGN.js +0 -0
  79. /package/dist/static/{v0.1.7 → v0.1.9}/chunk-EFNCQJI3.js +0 -0
  80. /package/dist/static/{v0.1.7 → v0.1.9}/chunk-UPPUYIIH.js +0 -0
  81. /package/dist/static/{v0.1.7 → v0.1.9}/early-access.js +0 -0
  82. /package/dist/static/{v0.1.7 → v0.1.9}/experiments.js +0 -0
  83. /package/dist/static/{v0.1.7 → v0.1.9}/flags.js +0 -0
  84. /package/dist/static/{v0.1.7 → v0.1.9}/forms.js +0 -0
  85. /package/dist/static/{v0.1.7 → v0.1.9}/heatmaps.js +0 -0
  86. /package/dist/static/{v0.1.7 → v0.1.9}/host-headers.js +0 -0
  87. /package/dist/static/{v0.1.7 → v0.1.9}/inspector.js +0 -0
  88. /package/dist/static/{v0.1.7 → v0.1.9}/modules-FANMZRDJ.js +0 -0
  89. /package/dist/static/{v0.1.7 → v0.1.9}/recommendations.js +0 -0
  90. /package/dist/static/{v0.1.7 → v0.1.9}/webmcp.js +0 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,66 @@
1
+ # Changelog: @lucida-analytics/browser
2
+
3
+ Built from the git history of `sdks/browser` and its version bumps. Dates are the bump commit dates.
4
+
5
+ ## 0.1.9 (2026-11-11)
6
+
7
+ BEHAVIOUR CHANGE: `referralParams` is now OFF by default. In 0.1.8 it was on (`ref`, `referral`, `via`, `aff`) and recorded `$referral_code` / `initial_referral_code` under Lucida's analytics consent, which is not the consent category referral platforms use. If you relied on it, set `referralParams: ["ref"]` (or `{ params: [...] }`) explicitly.
8
+
9
+ Added:
10
+ - `referralParams: { params?: string[], category?: string }`: with `category: "referrals"` the code is recorded only once that consent-manager category is granted. The Cookie Munch and Cookiebot bridges now pass every named category of a decision through (`host.categoryGrants`). The string array form still works and follows analytics consent.
11
+ - One console hint (once per page) when Watchtower's SDK is on the page (`globalThis.watchtower` or `watchtower:ready`) while `exposeGlobal` is off: Watchtower cannot find Lucida without it.
12
+ - `lucida-embed.json`, a Cookie Munch embed-v1 manifest generated from `storage.json` (`node scripts/gen-embed-manifest.mjs`), served at `https://lucidace.com/.well-known/lucida-embed.json` for the Cookie Munch `lucida` preset. `storage.json` gains `updated`.
13
+
14
+ Compliance note, cookie and storage names (unchanged by this release, now published in the manifest): `lc_consent` (necessary; the unsuffixed first-party cookie written by consent-manager bridges, and `lc_consent_<suffix>` in the SDK's persistence), `lc_distinct_id` (statistics cookie, written by a bridge only after analytics is granted), plus every `lc_*_<suffix>` statistics key listed in `storage.json`.
15
+
16
+ ## 0.1.8 (2026-11-11)
17
+
18
+ Added:
19
+ - `referralParams` (default `["ref", "referral", "via", "aff"]`): first `$pageview` of a session sets `$referral_code` and the person property `initial_referral_code`.
20
+ - CMP bridges write the first-party cookie `lc_consent=granted|denied` on every decision (never before one), and on a grant the anonymous id as `lc_distinct_id`; a denial removes it. `@lucida-analytics/next` reads them.
21
+ - `$consent_updated` carries `consent_receipt_id` when Cookie Munch exposes a receipt or ledger id.
22
+ - `cookieMunchBridge({ replayCategory })`: a custom Cookie Munch category that gates replay separately from `statistics`.
23
+ - Published typings no longer carry internal notes (`scripts/check-dist-notes.mjs` guards the release).
24
+
25
+ ## 0.1.7 (2026-11-10)
26
+
27
+ Added in 0.1.7:
28
+ - Watchtower error and vital hooks: `$exception_seen` and `$web_vitals` events from a Watchtower client that has `on("error")` / `on("vital")`, after analytics consent.
29
+ - `autocapture_inputs` project setting; SRI manifest keys equal the served paths; the SDK fetches its config when Watchtower owns replay.
30
+
31
+ ## 0.1.6 (2026-11-10)
32
+
33
+ Added in 0.1.6:
34
+ - `exposeGlobal: true | "name"` (`globalThis.lucida`, `lucida:ready`).
35
+ - A no-op client on the server (no `window`) with the same shape.
36
+ - `hasOptedIn()`, `onConsent(cb)`, `consentStatus()`; Watchtower session stamp (`lucida.session_id`).
37
+
38
+ ## 0.1.5 (2026-11-10)
39
+
40
+ Added in 0.1.5:
41
+ - Consent precedence: stored decision, then the project's `consent_mode` and geo default, then the page's `consent.mode`, then `opt_out`; the project can only be stricter.
42
+ - Cache headers and an SRI manifest for the static files, a storage manifest (`storage.json`), an HTML snippet.
43
+
44
+ ## 0.1.4 (2026-11-09)
45
+
46
+ Added in 0.1.4 (fixes): `optIn()` never grants marketing; peer ranges; replay URL patterns and an owner warning; a single shared types chunk; rrweb and fflate moved to dev-only dependencies.
47
+
48
+ ## 0.1.3 (2026-11-09)
49
+
50
+ Added in 0.1.3: replay console and network capture.
51
+
52
+ ## 0.1.2 (2026-11-07)
53
+
54
+ Added in 0.1.2: `package.json` exported from the package.
55
+
56
+ ## 0.1.1 (2026-11-06)
57
+
58
+ Added in 0.1.1:
59
+ - `cookieMunchConsent` bridge, Cookie Munch-aware consent purge on deny.
60
+ - `urlPrivacy` and default masking of sensitive URL query parameters; fixed-length input masking.
61
+ - Default hosts moved to `lucidace.com`, a 404 warning; script-origin `assetHost` / `uiHost`.
62
+ - Wider bot user-agent list with `blockedUserAgents`; replay chunk `Retry-After`; cookie storage falls back to memory when cookies are blocked; `pageview` path/search/hash selection, `scrollRoot`, more click ids; flag reload coalescing; `beforeSend` that throws drops the event; replay `data-lc-fixed`, immediate re-mask on route change; guides in nested iframes; device class from UA and client hints.
63
+
64
+ ## 0.1.0 (2026-11-01)
65
+
66
+ First release under the `@lucida-analytics` scope. Added in 0.1.0: core client and `init` / `createClient`, autocapture (clicks, outbound links, downloads, site search, rage and dead clicks), flags and experiments, replay, heatmaps, forms, guides, early access, recommendations, WebMCP, the consent banner and the TCF, Consent Mode, OneTrust, Cookiebot, Osano and Usercentrics bridges, storage modes, `beforeSend`, `personProfiles`, cross-domain linking, Watchtower correlation (`watchtower.correlate`), CSP `nonce`, `assetHost`.
package/README.md CHANGED
@@ -120,11 +120,28 @@ inside `[data-lc-unmask]` or the unmask list (a mask selector inside still wins)
120
120
  - **DNT / GPC**: `respectDnt` (default false) and `respectGpc` (default false). When set and the browser sends the signal,
121
121
  an `opt_out` project starts with consent denied, so nothing is stored or sent until `setConsent`. An explicit stored
122
122
  decision still wins. (`consent.respectDnt` is kept and enables both.)
123
- - **Cookie Munch**: `import { cookieMunchConsent } from "@lucida-analytics/browser/consent"` and pass it as a module; it follows
124
- `CookieMunch.consent` after the visitor's decision (`statistics` -> analytics + replay, `marketing` -> marketing). See `docs/guides/cookie-munch.md`.
125
- - **Consent state**: `client.getConsent()` returns the current decision per category; `client.getConsentStatus(category?)`
126
- is `pending` until the visitor chose (stored or `setConsent`), then `granted` or `denied`, so a banner can show only
127
- while pending. `consent.storageKey` (default `lc_consent`) names the stored decision; `cookie: { domain: ".example.com" }`
123
+ - **Cookie Munch** (since 0.1.1): `import { cookieMunchConsent } from "@lucida-analytics/browser/consent"` and pass it as a module (third
124
+ argument of `init`, or `modules` on the React and Next providers); it follows `CookieMunch.consent` after the visitor's decision
125
+ (`statistics` -> analytics + replay, `marketing` -> marketing). For a separate replay category use
126
+ `cookieMunchBridge({ replayCategory: "session_replay" })` (that Cookie Munch category then drives replay, `statistics` only analytics).
127
+ When Cookie Munch exposes a receipt / ledger id (`receiptId`, `consentReceiptId`, `consentId` or `ledgerId`, on the event detail or the
128
+ `CookieMunch` object) it is added to `$consent_updated` as `consent_receipt_id`. See the Cookie Munch help page.
129
+ - **Decision cookies for server code**: every CMP bridge (Cookie Munch, Cookiebot, OneTrust, Osano, TCF, Consent Mode, Usercentrics) writes the
130
+ first-party cookie `lc_consent=granted|denied` on each decision (never before one; `Path=/`, one year, `SameSite=Lax`), and on a grant the anonymous
131
+ id as `lc_distinct_id`; a denial removes `lc_distinct_id`. `@lucida-analytics/next` reads them (`@lucida-analytics/next` 0.1.5 and later).
132
+ - **Consent state**: `client.getConsent()` returns the current decision per category. `getConsentStatus(category?)` and
133
+ `consentStatus()` return `pending` until the visitor chose (stored or `setConsent`), then `granted` or `denied`, so a banner can show only
134
+ while pending. `consentStatus()` is the analytics decision and equals `getConsentStatus()` / `getConsentStatus("analytics")`; prefer
135
+ `getConsentStatus(category)` when you gate a feature on `replay` or `marketing`.
136
+
137
+ | State | `getConsentStatus()` / `consentStatus()` | `getConsentStatus("replay")` | `getConsentStatus("marketing")` |
138
+ |---|---|---|---|
139
+ | Before a decision | `pending` | `pending` | `pending` |
140
+ | After a full grant (all categories) | `granted` | `granted` | `granted` |
141
+ | After a partial grant (analytics + replay, no marketing) | `granted` | `granted` | `denied` |
142
+ | After a deny | `denied` | `denied` | `denied` |
143
+
144
+ `consent.storageKey` (default `lc_consent`) names the stored decision; `cookie: { domain: ".example.com" }`
128
145
  (or `crossSubdomain: true`) shares identity, session and the decision across subdomains. While `pending` no `lc_*` cookie or
129
146
  storage item is written; on a denial the SDK removes the `lc_*` items stored earlier **except the decision itself** (`lc_consent_<suffix>`).
130
147
  - **Cross-domain**: `crossDomains: ["shop.example.com"]` (exact host or subdomains; list the other site on both sides). While
@@ -193,7 +210,12 @@ inside `[data-lc-unmask]` or the unmask list (a mask selector inside still wins)
193
210
  are reported as one `$$client_ingestion_warning {$dropped_count}` per minute. `onCapture` listeners (inspector, replay
194
211
  triggers) only see events that passed `beforeSend`, sampling and the limit;
195
212
  `session: {idleMs, maxMs}` changes the 30 min idle / 24 h rotation; `customCampaignParams: ["ref_code"]` adds
196
- `$ref_code` (and `$initial_ref_code`) on pageviews.
213
+ `$ref_code` (and `$initial_ref_code`) on pageviews. `referralParams` (**off by default** since 0.1.9; `["ref"]` or
214
+ `{ params?: string[], category?: string }`, `params` defaulting to `["ref", "referral", "via", "aff"]`):
215
+ on the first `$pageview` of a session the first of these URL params that is present becomes `$referral_code` on the event and
216
+ `initial_referral_code` (set once) on the person. Without `category` it is sent under analytics consent; with
217
+ `category: "referrals"` (Cookie Munch's referral category) only once that category is granted, as reported by the Cookie Munch or
218
+ Cookiebot bridge.
197
219
  - **Transport**: `disableBeacon`, `requestHeaders` (adds a CORS preflight to the ingest host), `onRequestError({url, status})`,
198
220
  `rewritePath: (path) => path` (renames every request path on `apiHost` / `flagsApiHost`, for proxies). Every event carries
199
221
  `$lib_custom_api_host` when `apiHost` is not the Lucida default, so proxy coverage is measurable.
@@ -225,6 +247,21 @@ inside `[data-lc-unmask]` or the unmask list (a mask selector inside still wins)
225
247
  disableRemote}`. `keys` scopes both the request (`flag_keys`) and what the client exposes; `disableRemote` leaves values to
226
248
  bootstrap, `localFlags` and `updateFlags`.
227
249
 
250
+ ## Since which version
251
+
252
+ Derived from `git log -S` on `sdks/browser/src` and the version bump commits (see `CHANGELOG.md`). Anything documented above and not listed here is in 0.1.0.
253
+
254
+ | Option / API | Since |
255
+ |---|---|
256
+ | `cookieMunchConsent` | 0.1.1 |
257
+ | `urlPrivacy`, default sensitive-param masking | 0.1.1 |
258
+ | consent precedence (project `consent_mode`, geo default) | 0.1.5 |
259
+ | `exposeGlobal`, server no-op client, `hasOptedIn()`, `onConsent()`, Watchtower session stamp | 0.1.6 |
260
+ | Watchtower error and vital hooks (`$exception_seen`, `$web_vitals`) | 0.1.7 |
261
+ | `referralParams`, `cookieMunchBridge({ replayCategory })`, `consent_receipt_id`, `lc_consent` / `lc_distinct_id` decision cookies | 0.1.8 |
262
+ | `referralParams` off by default and `{ params, category }`, `exposeGlobal` hint for Watchtower, `lucida-embed.json` | 0.1.9 |
263
+ | `outboundLinks`, `fileDownloads`, `siteSearch`, `respectGpc`, `replayOwner`, `getConsentStatus`, `consentStatus`, `consent.storageKey`, `crossDomains`, `crossSubdomain`, `beforeSend`, `propertyDenylist`, `personProfiles`, `reuseAnonymousId`, `tracingHeaders`, `rateLimit`, `customCampaignParams`, `disableBeacon`, `rewritePath`, `persistence` modes, `persistedProperties`, `storageWriteDelayMs`, `flagPersistence`, `consentPersistence`, `cookieless`, `assetHost`, `nonce`, `capturePageleave`, autocapture options, `flagsApiHost`, `flagOptions`, `setConfig`, `bootstrap`, `watchtower`, `replay.mask_all_text` | 0.1.0 |
264
+
228
265
  ## Agent analytics
229
266
 
230
267
  ```ts
@@ -1,4 +1,4 @@
1
- import { e as Client, M as Module } from './types-vmPeWA7a.js';
1
+ import { e as Client, M as Module } from './types-B_CVJeLI.js';
2
2
  import { Props } from '@lucida-analytics/sdk-core';
3
3
 
4
4
  interface ElementInfo {
@@ -1 +1 @@
1
- import{b as A}from"./chunk-536QABLP.js";import"./chunk-EFNCQJI3.js";var C={title:"Your privacy",body:"We use cookies and similar technologies to measure and improve this site. Choose what you allow.",acceptAll:"Accept all",rejectAll:"Reject all",save:"Save choices",categories:{analytics:"Analytics",replay:"Session replay",marketing:"Marketing"}},j=["analytics","replay","marketing"],O="button, input, [href], [tabindex]:not([tabindex='-1'])",w={bottom:{left:"0",right:"0",bottom:"0"},top:{left:"0",right:"0",top:"0"},center:{top:"50%",left:"50%",transform:"translate(-50%,-50%)","max-width":"28rem"},"bottom-left":{left:"1rem",bottom:"1rem","max-width":"24rem"},"bottom-right":{right:"1rem",bottom:"1rem","max-width":"24rem"}},l=(e,t={},...s)=>{let c=Object.assign(document.createElement(e),t);return c.append(...s),c},h;function P(){h?.close()}function S(e){if(!e)return{};let t=(e.categories??[]).filter(a=>!a.required&&j.includes(a.id)),s=Object.fromEntries(t.map(a=>[a.id,a.label])),c={title:e.title,body:e.body,acceptAll:e.accept_label,rejectAll:e.decline_label,save:e.customize_label,categories:s},d=e.position?.replace("_","-");return{texts:Object.fromEntries(Object.entries(c).filter(([,a])=>a!==void 0)),...t.length?{categories:t.map(a=>a.id)}:{},...d&&d in w?{position:d}:{}}}async function H(e){try{let t=await e.fetch(`${e.config.apiHost}/v1/config?api_key=${encodeURIComponent(e.apiKey)}`,{credentials:"omit"});return t.ok?S((await t.json()).consent_banner):{}}catch{return{}}}async function _(e,t={}){if(!t.remote)return B(e,t);let s=await H(e);return B(e,{...s,...t,texts:{...s.texts,...t.texts,categories:{...s.texts?.categories,...t.texts?.categories}}})}function B(e,t){P();let s={...C,...t.texts,categories:{...C.categories,...t.texts?.categories}},c=t.categories??j,d=e.core.getConsent(),a=t.position??"bottom",m=`lc-consent-${Math.random().toString(36).slice(2,8)}`,L=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,M=document.activeElement,v=c.map(o=>{let i=l("input",{type:"checkbox",id:`${m}-${o}`,checked:d[o]});return{c:o,input:i,row:l("label",{htmlFor:i.id},i,document.createTextNode(` ${s.categories[o]}`))}}),p=(o,i)=>{let u=l("button",{type:"button",textContent:o});return u.style.cssText=`padding:.5rem 1rem;margin:.25rem .5rem .25rem 0;border:1px solid #1f2937;border-radius:.375rem;cursor:pointer;font:inherit;background:${i?"#1f2937":"#fff"};color:${i?"#fff":"#1f2937"}`,u},g=p(s.acceptAll,!0),k=p(s.rejectAll,!0),T=p(s.save,!1),n=l("div",{role:"dialog",id:m},l("h2",{id:`${m}-t`,textContent:s.title}),l("p",{id:`${m}-d`,textContent:s.body}),...c.length>1?v.map(o=>o.row):[],l("div",{},g,k,...c.length>1?[T]:[]));n.setAttribute("aria-modal","true"),n.setAttribute("aria-labelledby",`${m}-t`),n.setAttribute("aria-describedby",`${m}-d`),n.setAttribute("data-lc-ignore",""),n.style.cssText="position:fixed;z-index:2147483000;box-sizing:border-box;padding:1rem 1.25rem;background:#fff;color:#111827;font:14px/1.4 system-ui,sans-serif;box-shadow:0 0 .75rem rgba(0,0,0,.3);display:block";for(let[o,i]of Object.entries(w[a]))n.style.setProperty(o,i);for(let o of n.querySelectorAll("h2"))o.style.cssText="margin:0 0 .5rem;font-size:1.1rem";for(let o of n.querySelectorAll("label"))o.style.cssText="display:block;margin:.25rem 0";return L||(n.style.opacity="0",n.style.transition="opacity .2s",requestAnimationFrame(()=>n.style.opacity="1")),new Promise(o=>{let i=r=>{document.removeEventListener("keydown",E,!0),n.remove(),h=void 0,M?.focus?.(),r&&A(e,r,"banner",t.version?{version:t.version}:{}),o(r?e.core.getConsent():null)},u=r=>Object.fromEntries(c.map(f=>[f,r])),E=r=>{if(r.key==="Escape")return void i(null);if(r.key!=="Tab")return;let f=[...n.querySelectorAll(O)],y=f[0],b=f[f.length-1],x=document.activeElement;if(!n.contains(x))(r.shiftKey?b:y).focus();else if(r.shiftKey&&x===y)b.focus();else if(!r.shiftKey&&x===b)y.focus();else return;r.preventDefault()};g.onclick=()=>i(u(!0)),k.onclick=()=>i(u(!1)),T.onclick=()=>i(Object.fromEntries(v.map(r=>[r.c,r.input.checked]))),document.addEventListener("keydown",E,!0),document.body.append(n),h={root:n,close:()=>i(null)},g.focus()})}export{S as fromRemote,P as hideBanner,_ as showBanner};
1
+ import{b as A}from"./chunk-IXDYCBAD.js";import"./chunk-EFNCQJI3.js";var C={title:"Your privacy",body:"We use cookies and similar technologies to measure and improve this site. Choose what you allow.",acceptAll:"Accept all",rejectAll:"Reject all",save:"Save choices",categories:{analytics:"Analytics",replay:"Session replay",marketing:"Marketing"}},j=["analytics","replay","marketing"],O="button, input, [href], [tabindex]:not([tabindex='-1'])",w={bottom:{left:"0",right:"0",bottom:"0"},top:{left:"0",right:"0",top:"0"},center:{top:"50%",left:"50%",transform:"translate(-50%,-50%)","max-width":"28rem"},"bottom-left":{left:"1rem",bottom:"1rem","max-width":"24rem"},"bottom-right":{right:"1rem",bottom:"1rem","max-width":"24rem"}},l=(e,t={},...s)=>{let c=Object.assign(document.createElement(e),t);return c.append(...s),c},h;function P(){h?.close()}function S(e){if(!e)return{};let t=(e.categories??[]).filter(a=>!a.required&&j.includes(a.id)),s=Object.fromEntries(t.map(a=>[a.id,a.label])),c={title:e.title,body:e.body,acceptAll:e.accept_label,rejectAll:e.decline_label,save:e.customize_label,categories:s},d=e.position?.replace("_","-");return{texts:Object.fromEntries(Object.entries(c).filter(([,a])=>a!==void 0)),...t.length?{categories:t.map(a=>a.id)}:{},...d&&d in w?{position:d}:{}}}async function H(e){try{let t=await e.fetch(`${e.config.apiHost}/v1/config?api_key=${encodeURIComponent(e.apiKey)}`,{credentials:"omit"});return t.ok?S((await t.json()).consent_banner):{}}catch{return{}}}async function _(e,t={}){if(!t.remote)return B(e,t);let s=await H(e);return B(e,{...s,...t,texts:{...s.texts,...t.texts,categories:{...s.texts?.categories,...t.texts?.categories}}})}function B(e,t){P();let s={...C,...t.texts,categories:{...C.categories,...t.texts?.categories}},c=t.categories??j,d=e.core.getConsent(),a=t.position??"bottom",m=`lc-consent-${Math.random().toString(36).slice(2,8)}`,L=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,M=document.activeElement,v=c.map(o=>{let i=l("input",{type:"checkbox",id:`${m}-${o}`,checked:d[o]});return{c:o,input:i,row:l("label",{htmlFor:i.id},i,document.createTextNode(` ${s.categories[o]}`))}}),p=(o,i)=>{let u=l("button",{type:"button",textContent:o});return u.style.cssText=`padding:.5rem 1rem;margin:.25rem .5rem .25rem 0;border:1px solid #1f2937;border-radius:.375rem;cursor:pointer;font:inherit;background:${i?"#1f2937":"#fff"};color:${i?"#fff":"#1f2937"}`,u},g=p(s.acceptAll,!0),k=p(s.rejectAll,!0),T=p(s.save,!1),n=l("div",{role:"dialog",id:m},l("h2",{id:`${m}-t`,textContent:s.title}),l("p",{id:`${m}-d`,textContent:s.body}),...c.length>1?v.map(o=>o.row):[],l("div",{},g,k,...c.length>1?[T]:[]));n.setAttribute("aria-modal","true"),n.setAttribute("aria-labelledby",`${m}-t`),n.setAttribute("aria-describedby",`${m}-d`),n.setAttribute("data-lc-ignore",""),n.style.cssText="position:fixed;z-index:2147483000;box-sizing:border-box;padding:1rem 1.25rem;background:#fff;color:#111827;font:14px/1.4 system-ui,sans-serif;box-shadow:0 0 .75rem rgba(0,0,0,.3);display:block";for(let[o,i]of Object.entries(w[a]))n.style.setProperty(o,i);for(let o of n.querySelectorAll("h2"))o.style.cssText="margin:0 0 .5rem;font-size:1.1rem";for(let o of n.querySelectorAll("label"))o.style.cssText="display:block;margin:.25rem 0";return L||(n.style.opacity="0",n.style.transition="opacity .2s",requestAnimationFrame(()=>n.style.opacity="1")),new Promise(o=>{let i=r=>{document.removeEventListener("keydown",E,!0),n.remove(),h=void 0,M?.focus?.(),r&&A(e,r,"banner",t.version?{version:t.version}:{}),o(r?e.core.getConsent():null)},u=r=>Object.fromEntries(c.map(f=>[f,r])),E=r=>{if(r.key==="Escape")return void i(null);if(r.key!=="Tab")return;let f=[...n.querySelectorAll(O)],y=f[0],b=f[f.length-1],x=document.activeElement;if(!n.contains(x))(r.shiftKey?b:y).focus();else if(r.shiftKey&&x===y)b.focus();else if(!r.shiftKey&&x===b)y.focus();else return;r.preventDefault()};g.onclick=()=>i(u(!0)),k.onclick=()=>i(u(!1)),T.onclick=()=>i(Object.fromEntries(v.map(r=>[r.c,r.input.checked]))),document.addEventListener("keydown",E,!0),document.body.append(n),h={root:n,close:()=>i(null)},g.focus()})}export{S as fromRemote,P as hideBanner,_ as showBanner};
@@ -1 +1 @@
1
- function oe(e,t){if(!e.url)return!0;if(e.url_match==="exact")return t===e.url;if(e.url_match==="regex")try{return new RegExp(e.url).test(t)}catch{return!1}return t.includes(e.url)}function S(e,t){let n=t?.[e.key];if(e.op==="exists")return n!=null;if(n==null)return e.op==="neq";let[o,s]=[String(n),String(e.value??"")];return e.op==="eq"?o===s:e.op==="neq"?o!==s:o.includes(s)}var ie=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function re(e,t){try{let n=new Intl.DateTimeFormat("en-US",{timeZone:t,weekday:"short",hour:"numeric",hourCycle:"h23"}).formatToParts(e),o=s=>n.find(u=>u.type===s)?.value??"";return{day:ie.indexOf(o("weekday")),h:Number(o("hour"))%24}}catch{return{day:new Date(e).getDay(),h:new Date(e).getHours()}}}function se(e,t){if(e.start&&t<Date.parse(e.start)||e.end&&t>=Date.parse(e.end))return!1;let{day:n,h:o}=e.timezone?re(t,e.timezone):{day:new Date(t).getDay(),h:new Date(t).getHours()};return e.days?.length&&!e.days.includes(n)?!1:!e.hours||o>=(e.hours.from??0)&&o<(e.hours.to??24)}function ae(e,t,n){let o=e.per_days?n-e.per_days*864e5:0;return t.filter(s=>s>=o).length<(e.max_views??1)}function le(e,t){let n=e.split("*").map(o=>o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*");return new RegExp("^"+n+"$").test(t)}function ce(e,t){if(!e||!t?.length)return!1;let n=e;try{n=new URL(e).pathname||e}catch{}return t.some(o=>typeof o=="string"&&o!==""&&le(o,o.startsWith("/")?n:e))}function Se(e,t){let n=e.conditions;return!(ce(t.url,n.exclude_url_patterns)||!oe(n,t.url)||n.flag_key&&!t.flags(n.flag_key)||n.flag_key&&n.flag_variant&&String(t.flagValue?.(n.flag_key))!==n.flag_variant||n.wait_days&&t.lastShownMs!==void 0&&t.nowMs-t.lastShownMs<n.wait_days*864e5||n.devices?.length&&t.device&&!n.devices.includes(t.device)||n.person_filters?.some(o=>!S(o,t.person))||n.group_filters?.some(o=>!S(o,t.groups?.[o.group_type??""]))||n.seen_guides?.some(o=>!t.seen?.(o))||n.not_seen_guides?.some(o=>t.seen?.(o))||n.schedule&&!se(n.schedule,t.nowMs)||n.frequency&&!ae(n.frequency,t.views??[],t.nowMs)||n.sample_pct!==void 0&&n.sample_pct>0&&n.sample_pct<100&&t.random()*100>=n.sample_pct)}function j(e,t){let n=document.createElement("style");return t&&n.setAttribute("nonce",t),n.textContent=e,n}var ue=e=>{if(typeof e!="string"||!e)return!1;try{return!!document.querySelector(e)}catch{return!1}};function F(e,t){let n=()=>typeof e.value=="string"&&t.present?t.present(e.value):ue(e.value);if(e.op==="element_present")return n();if(e.op==="element_absent")return!n();if(e.op==="flag_on"||e.op==="flag_off"){let o=typeof e.value=="string"&&!!t.flag?.(e.value);return e.op==="flag_on"?o:!o}return S({key:e.key,op:e.op,value:e.value},t.person)}function de(e){return e.matches("input[type=password],[data-lc-mask],.lc-mask,[autocomplete^=cc-]")?!0:!!e.closest("[data-lc-mask],.lc-mask")}var pe="input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]),textarea";function U(e,t=document){if(!e.selector||e.selector.length>500)return"invalid";let n;try{n=t.querySelector(e.selector)}catch{return"invalid"}if(!n)return"missing";if(de(n))return"refused";if(e.action==="click")n.click();else if(e.action==="focus")n.focus();else if(e.action==="fill"){if(typeof e.value!="string"||e.value.length>200||!n.matches(pe))return"refused";let o=n instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,s=Object.getOwnPropertyDescriptor(o,"value")?.set;s?s.call(n,e.value):n.value=e.value,n.dispatchEvent(new Event("input",{bubbles:!0})),n.dispatchEvent(new Event("change",{bubbles:!0}))}else return"invalid";return"done"}var fe=()=>{try{return matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}};function K(e=["#e5484d","#30a46c","#0090ff","#f5d90a","#8e4ec6"]){if(typeof document>"u"||fe())return;let t=document.createElement("canvas");t.setAttribute("data-lc-ignore",""),t.setAttribute("aria-hidden","true"),t.width=innerWidth,t.height=innerHeight,t.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:2147483001";let n=t.getContext("2d");if(!n)return;document.body.append(t);let o=Array.from({length:120},(a,r)=>({x:innerWidth/2,y:innerHeight/3,vx:(Math.random()-.5)*12,vy:Math.random()*-10-2,color:e[r%e.length]})),s=Date.now()+1500,u=()=>{n.clearRect(0,0,t.width,t.height);for(let a of o)a.x+=a.vx,a.y+=a.vy,a.vy+=.35,n.fillStyle=a.color,n.fillRect(a.x,a.y,6,4);Date.now()<s?requestAnimationFrame(u):t.remove()};requestAnimationFrame(u)}var me=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i,be=/^[\w\s,'"-]{1,100}$/,W={none:"none",sm:"0 1px 4px rgba(0,0,0,.15)",lg:"0 8px 32px rgba(0,0,0,.3)"};function ve(e,t=ye()){if(!e?.dark?.tokens)return!1;let n=e.theme_mode??"auto";return n==="dark"||n==="auto"&&t}function ye(){try{return typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches}catch{return!1}}function V(e,t){let n={...e?.font_family?{font:e.font_family}:{},...e?.tokens};return ve(e,t)?{...n,...e?.dark?.tokens}:n}function X(e,t){let n=o=>typeof o=="string"&&me.test(o);n(t?.background)&&(e.style.background=t.background),n(t?.text)&&(e.style.color=t.text),n(t?.accent)&&(e.style.setProperty("--a",t.accent),e.style.setProperty("--at","#fff")),typeof t?.radius=="number"&&t.radius>=0&&t.radius<=32&&(e.style.borderRadius=`${t.radius}px`),typeof t?.font=="string"&&be.test(t.font)&&(e.style.fontFamily=t.font),t?.shadow&&t.shadow in W&&(e.style.boxShadow=W[t.shadow]),typeof t?.button_radius=="number"&&t.button_radius>=0&&t.button_radius<=32&&e.style.setProperty("--br",`${t.button_radius}px`),n(t?.secondary)&&e.style.setProperty("--s",t.secondary),n(t?.secondary_text)&&e.style.setProperty("--st",t.secondary_text)}var Y=".cd{display:flex;gap:6px;justify-content:center;margin:8px 0}.cd button{width:10px;height:10px;min-width:0;padding:0;margin:0;border-radius:50%;background:#ccc;border:0}.cd button[aria-current=true]{background:var(--a,#111)}.cn{display:flex;justify-content:space-between}",A=(e,t,n)=>{let o=document.createElement("button");return o.type="button",o.textContent=e,n&&o.setAttribute("aria-label",n),o.onclick=t,o};function J(e){let t=document.createElement("div"),n=document.createElement("div");n.className="cd",n.setAttribute("role","tablist");for(let u=0;u<e.count;u++){let a=A("",()=>e.to(u),`Slide ${u+1} of ${e.count}`);a.setAttribute("role","tab"),a.setAttribute("aria-current",String(u===e.index)),n.append(a)}let o=document.createElement("div");o.className="cn";let s=e.index===e.count-1;return o.append(e.index>0?A("Back",()=>e.to(e.index-1)):A("Skip",e.dismiss),A(s?"Done":"Next",()=>s?e.complete():e.to(e.index+1))),t.append(n,o),t}function Q(e,t){let n,o=a=>{n=a.clientX},s=a=>{if(n===void 0)return;let r=a.clientX-n;n=void 0;let y=t();r<-40&&y.index<y.count-1?y.to(y.index+1):r>40&&y.index>0&&y.to(y.index-1)},u=a=>{let r=t();a.key==="ArrowRight"&&r.index<r.count-1?r.to(r.index+1):a.key==="ArrowLeft"&&r.index>0&&r.to(r.index-1)};return e.addEventListener("pointerdown",o),e.addEventListener("pointerup",s),e.addEventListener("keydown",u),()=>{e.removeEventListener("pointerdown",o),e.removeEventListener("pointerup",s),e.removeEventListener("keydown",u)}}function ge(e,t,n=!0,o=!1){if(e==="banner")return[{label:"Dismiss",action:"dismiss"}];let s=n?[]:[{label:"Back",action:"back"}];return o||s.push({label:t?"Done":"Next",action:"next"}),[...s,{label:"Dismiss",action:"dismiss"}]}function he(e){for(let t of[e.selector,...e.fallback_selectors??[]])if(t)try{let n=document.querySelector(t);if(n)return n}catch{}return null}var ke=".g{position:fixed;z-index:2147483000;background:#fff;color:#111;border:1px solid #ccc;border-radius:8px;padding:14px;font:14px system-ui;max-width:320px;box-shadow:0 4px 16px rgba(0,0,0,.2)}.m{top:50%;left:50%;transform:translate(-50%,-50%)}.bn{top:0;left:0;right:0;max-width:none;border-radius:0}.bb{top:auto;bottom:0}.p{right:16px;bottom:16px}.o{position:fixed;inset:0;z-index:2146999999;background:rgba(0,0,0,.4)}button{margin:2px;padding:4px 10px;cursor:pointer;background:var(--a,buttonface);color:var(--at,buttontext);border:1px solid #bbb;border-radius:var(--br,4px)}button+button{background:var(--s,buttonface);color:var(--st,buttontext)}h2{margin:0 0 6px;font-size:16px}p{margin:0 0 8px}li{margin:4px 0}.so{top:0;bottom:0;right:0;max-width:360px;border-radius:0;overflow:auto;animation:s .2s}.so.sl{right:auto;left:0}@keyframes s{from{transform:translateX(30px);opacity:0}}@media (prefers-reduced-motion:reduce){.so{animation:none}}.in{position:static;box-shadow:none;max-width:none;margin:8px 0}img,video,iframe{display:block;width:100%;max-width:100%;border:0;margin:0 0 8px;border-radius:4px}iframe{aspect-ratio:16/9}",xe=ke+Y,we=["www.youtube-nocookie.com","www.youtube.com","player.vimeo.com","www.loom.com","fast.wistia.net"],_e="button,[href],input,textarea,select,[tabindex]:not([tabindex='-1'])";function v(e,t,n){let o=document.createElement(e);return t!==void 0&&(o.textContent=t),n&&(o.className=n),o}function Ee(e){let t;try{t=new URL(e.url)}catch{return null}if(t.protocol!=="https:")return null;if(e.type==="image")return Object.assign(v("img"),{src:t.href,alt:e.alt??"",loading:"lazy"});if(e.type==="video")return Object.assign(v("video"),{src:t.href,controls:!0,preload:"metadata"});if(e.type!=="embed"||!we.includes(t.host))return null;let n=Object.assign(v("iframe"),{src:t.href,title:e.alt??"Video",allowFullscreen:!0,referrerPolicy:"no-referrer"});return n.setAttribute("sandbox","allow-scripts allow-same-origin allow-presentation"),n}function Me(e,t,n){e.addEventListener("keydown",o=>{if(o.key==="Escape")return n();if(o.key!=="Tab")return;let s=[...e.querySelectorAll(_e)];if(!s.length)return;let u=s[0],a=s[s.length-1],r=t.activeElement;o.shiftKey&&r===u?(o.preventDefault(),a.focus()):!o.shiftKey&&r===a&&(o.preventDefault(),u.focus())})}function Te(e,t,n="bottom"){let o=t.getBoundingClientRect(),s=e.offsetWidth||280,u=e.offsetHeight||120,a=o.left,r=o.bottom+8;n==="top"?r=o.top-u-8:n==="left"?(a=o.left-s-8,r=o.top):n==="right"&&(a=o.right+8,r=o.top);let y=(x,w)=>Math.max(8,Math.min(x,w-8));e.style.left=`${y(a,window.innerWidth-s)}px`,e.style.top=`${y(r,window.innerHeight-u)}px`}function Ne(e,t,n,o={}){let s=document.createElement("div");s.setAttribute("data-lc-ignore","");let u=s.attachShadow({mode:"open"});u.append(j(xe,o.nonce));let a=document.activeElement,r=Math.min(Math.max(o.start??0,0),e.steps.length-1),y=!1,x,w=[],h=[],H=()=>{for(let i of h)i();h=[]},D=()=>{},d=v("div",void 0,"g"),_=()=>{y||(y=!0,H(),D(),s.remove(),a?.focus?.(),n())},L=i=>{t.dismissed(r,e.steps[r]?.id??"",i),_()},k=()=>L(),M=()=>{t.completed(),_(),e.steps.at(-1)?.confetti&&K()},R=i=>(o.resolveTarget??he)(i),$=i=>{let l=i?.goto?void 0:e.steps[r]?.branch?.find(m=>F(m,{...o.person?{person:o.person}:{},...o.flag?{flag:o.flag}:{},...o.present?{present:o.present}:{}})),p=i?.goto??l?.goto,c=p==="end"?e.steps.length:p?e.steps.findIndex(m=>m.id===p):-1;w.push(r),r=c>r?c:r+1,C()},C=()=>{let i=e.steps[r];if(!i)return M();if(t.progress?.(i.id),i.url&&!location.href.includes(i.url))return _();I()},O=i=>{i<0||i>=e.steps.length||i===r||(r=i,C())},Z=()=>{let i=w.pop();i!==void 0&&(r=i,C())},P=i=>{if(i.action==="next"||i.action==="start_tour")$(i);else if(i.action==="back")Z();else if(i.action==="dismiss")k();else if(i.action==="snooze"){let l=Math.min(Math.max(Math.round(i.snooze_hours??24),1),720);t.snoozed?.(e.steps[r]?.id??"",l),L("snooze")}else i.action==="link"&&i.url&&/^https?:\/\//i.test(i.url)?window.open(i.url,"_blank","noopener,noreferrer"):i.action==="event"&&i.event&&t.event(i.event)},ee=(i,l)=>{let p=v("div"),c=i.buttons?.length?i.buttons:ge(e.kind,l,w.length===0,i.advance==="click"||i.advance==="input");for(let m of c){let g=v("button",m.label);g.type="button",g.onclick=()=>P(m),p.append(g)}return p},te=i=>[...i.title?[v("h2",i.title)]:[],...i.body?[v("p",i.body)]:[],...(i.media??[]).flatMap(l=>Ee(l)??[])],T=new Set(o.checked),N=new Map;function G(i,l,p){let c=N.get(l.id);c&&!c.hasAttribute("data-done")&&(c.setAttribute("data-done",""),c.setAttribute("aria-pressed","true"),c.textContent=`\u2713 ${l.title??l.id}`),!(!p||T.has(l.id)&&c?.hasAttribute("data-reported"))&&(c?.setAttribute("data-reported",""),T.add(l.id),t.step(i,l.id),T.size>=e.steps.length&&M())}let ne=()=>{let i=v("ul");for(let[p,c]of e.steps.entries()){let m=v("li"),g=v("button",`${c.title??c.id}`);if(g.type="button",g.setAttribute("aria-pressed","false"),N.set(c.id,g),T.has(c.id)&&(G(p,c,!1),g.setAttribute("data-reported","")),g.onclick=()=>{if(e.kind==="checklist")G(p,c,!0);else if(e.kind==="resource_center"){t.step(p,c.id);let f=c.buttons?.find(b=>b.action==="link");f&&P(f)}},c.module){let f={library:o.library??[],launch:b=>(_(),o.launch?.(b)),opened:()=>t.step(p,c.id),...o.assist?{assist:o.assist}:{}};import("./modules-FANMZRDJ.js").then(b=>m.append(b.renderModule(c,f))),i.append(m);continue}m.append(g),c.body&&m.append(v("p",c.body)),i.append(m)}d.append(v("h2",e.name),i);let l=v("button",e.kind==="resource_center"?"Close":"Dismiss");l.type="button",l.onclick=k,d.append(l)};function I(){H(),d.replaceChildren(),d.style.visibility="";let i=e.steps[r];if(!i)return;let l=e.kind==="carousel";if(e.kind==="checklist"||e.kind==="resource_center")ne();else{let f={index:r,count:e.steps.length,to:O,complete:M,dismiss:k};d.append(...te(i),l?J(f):ee(i,r===e.steps.length-1)),t.step(r,i.id)}d.setAttribute("role",e.kind==="banner"||e.kind==="inline"?"region":"dialog"),d.setAttribute("aria-label",i?.title??e.name),l&&d.setAttribute("aria-roledescription","carousel");let p={modal:"m",carousel:"m",banner:`bn${i.placement==="bottom"?" bb":""}`,slideout:`so${e.appearance?.side==="left"?" sl":""}`,inline:"in"};if(d.className=`g ${p[e.kind]??"p"}`,X(d,V(e.appearance)),(e.kind==="modal"||l)&&d.setAttribute("aria-modal","true"),l&&h.push(Q(d,()=>({index:r,count:e.steps.length,to:O,complete:M,dismiss:k}))),i.auto_close_s&&i.auto_close_s>0){let f=setTimeout(()=>L("auto_close"),Math.min(i.auto_close_s,600)*1e3);h.push(()=>clearTimeout(f))}if(i.automation&&o.automate!==!1){let f=i.automation,b=setTimeout(()=>t.automated?.(i.id,U(f)));h.push(()=>clearTimeout(b))}let c=(e.kind==="tooltip"||e.kind==="tour")&&!!(i.selector||i.fallback_selectors?.length),m=f=>{d.style.visibility="",d.classList.remove("p"),Te(d,f,i.placement);let b=i.advance==="click"?"click":i.advance==="input"?"change":null;if(!b)return;let E=()=>$();f.addEventListener(b,E,{once:!0}),h.push(()=>f.removeEventListener(b,E))},g=c?R(i):null;if(g)m(g);else if(c){d.style.visibility="hidden";let f=Date.now()+Math.min(Math.max(i.wait_ms??3e3,0),15e3),b=setInterval(()=>{let E=R(i);E?(clearInterval(b),m(E)):Date.now()>=f&&(clearInterval(b),d.style.visibility="",t.targetMissing?.(i.id,i.selector??i.fallback_selectors?.[0]??""))},150);h.push(()=>clearInterval(b))}e.kind!=="inline"&&d.querySelector("button")?.focus()}Me(d,u,k);let B=e.kind==="modal"||e.kind==="carousel",q=e.appearance?.dismiss_on_outside_click??B;if(e.appearance?.overlay??B)x=v("div",void 0,"o"),q&&(x.onclick=k),u.append(x);else if(q&&e.kind!=="inline"){let i=p=>{p.composedPath().includes(s)||k()},l=setTimeout(()=>document.addEventListener("click",i,!0));D=()=>(clearTimeout(l),document.removeEventListener("click",i,!0))}u.append(d);let z=e.kind==="inline"&&e.steps[0]?.selector?document.querySelector(e.steps[0].selector):null;return z?z.after(s):document.body.append(s),t.shown(),I(),Object.assign(_,{markDone(i){let l=e.steps.findIndex(p=>p.id===i);e.kind==="checklist"&&l>=0&&!y&&G(l,e.steps[l],!0)}})}export{Se as a,j as b,F as c,de as d,U as e,V as f,X as g,ge as h,he as i,Te as j,Ne as k};
1
+ function oe(e,t){if(!e.url)return!0;if(e.url_match==="exact")return t===e.url;if(e.url_match==="regex")try{return new RegExp(e.url).test(t)}catch{return!1}return t.includes(e.url)}function S(e,t){let n=t?.[e.key];if(e.op==="exists")return n!=null;if(n==null)return e.op==="neq";let[o,s]=[String(n),String(e.value??"")];return e.op==="eq"?o===s:e.op==="neq"?o!==s:o.includes(s)}var ie=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function re(e,t){try{let n=new Intl.DateTimeFormat("en-US",{timeZone:t,weekday:"short",hour:"numeric",hourCycle:"h23"}).formatToParts(e),o=s=>n.find(u=>u.type===s)?.value??"";return{day:ie.indexOf(o("weekday")),h:Number(o("hour"))%24}}catch{return{day:new Date(e).getDay(),h:new Date(e).getHours()}}}function se(e,t){if(e.start&&t<Date.parse(e.start)||e.end&&t>=Date.parse(e.end))return!1;let{day:n,h:o}=e.timezone?re(t,e.timezone):{day:new Date(t).getDay(),h:new Date(t).getHours()};return e.days?.length&&!e.days.includes(n)?!1:!e.hours||o>=(e.hours.from??0)&&o<(e.hours.to??24)}function ae(e,t,n){let o=e.per_days?n-e.per_days*864e5:0;return t.filter(s=>s>=o).length<(e.max_views??1)}function le(e,t){let n=e.split("*").map(o=>o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*");return new RegExp("^"+n+"$").test(t)}function ce(e,t){if(!e||!t?.length)return!1;let n=e;try{n=new URL(e).pathname||e}catch{}return t.some(o=>typeof o=="string"&&o!==""&&le(o,o.startsWith("/")?n:e))}function Se(e,t){let n=e.conditions;return!(ce(t.url,n.exclude_url_patterns)||!oe(n,t.url)||n.flag_key&&!t.flags(n.flag_key)||n.flag_key&&n.flag_variant&&String(t.flagValue?.(n.flag_key))!==n.flag_variant||n.wait_days&&t.lastShownMs!==void 0&&t.nowMs-t.lastShownMs<n.wait_days*864e5||n.devices?.length&&t.device&&!n.devices.includes(t.device)||n.person_filters?.some(o=>!S(o,t.person))||n.group_filters?.some(o=>!S(o,t.groups?.[o.group_type??""]))||n.seen_guides?.some(o=>!t.seen?.(o))||n.not_seen_guides?.some(o=>t.seen?.(o))||n.schedule&&!se(n.schedule,t.nowMs)||n.frequency&&!ae(n.frequency,t.views??[],t.nowMs)||n.sample_pct!==void 0&&n.sample_pct>0&&n.sample_pct<100&&t.random()*100>=n.sample_pct)}function j(e,t){let n=document.createElement("style");return t&&n.setAttribute("nonce",t),n.textContent=e,n}var ue=e=>{if(typeof e!="string"||!e)return!1;try{return!!document.querySelector(e)}catch{return!1}};function F(e,t){let n=()=>typeof e.value=="string"&&t.present?t.present(e.value):ue(e.value);if(e.op==="element_present")return n();if(e.op==="element_absent")return!n();if(e.op==="flag_on"||e.op==="flag_off"){let o=typeof e.value=="string"&&!!t.flag?.(e.value);return e.op==="flag_on"?o:!o}return S({key:e.key,op:e.op,value:e.value},t.person)}function de(e){return e.matches("input[type=password],[data-lc-mask],.lc-mask,[autocomplete^=cc-]")?!0:!!e.closest("[data-lc-mask],.lc-mask")}var pe="input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]),textarea";function U(e,t=document){if(!e.selector||e.selector.length>500)return"invalid";let n;try{n=t.querySelector(e.selector)}catch{return"invalid"}if(!n)return"missing";if(de(n))return"refused";if(e.action==="click")n.click();else if(e.action==="focus")n.focus();else if(e.action==="fill"){if(typeof e.value!="string"||e.value.length>200||!n.matches(pe))return"refused";let o=n instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,s=Object.getOwnPropertyDescriptor(o,"value")?.set;s?s.call(n,e.value):n.value=e.value,n.dispatchEvent(new Event("input",{bubbles:!0})),n.dispatchEvent(new Event("change",{bubbles:!0}))}else return"invalid";return"done"}var fe=()=>{try{return matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}};function K(e=["#e5484d","#30a46c","#0090ff","#f5d90a","#8e4ec6"]){if(typeof document>"u"||fe())return;let t=document.createElement("canvas");t.setAttribute("data-lc-ignore",""),t.setAttribute("aria-hidden","true"),t.width=innerWidth,t.height=innerHeight,t.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:2147483001";let n=t.getContext("2d");if(!n)return;document.body.append(t);let o=Array.from({length:120},(a,r)=>({x:innerWidth/2,y:innerHeight/3,vx:(Math.random()-.5)*12,vy:Math.random()*-10-2,color:e[r%e.length]})),s=Date.now()+1500,u=()=>{n.clearRect(0,0,t.width,t.height);for(let a of o)a.x+=a.vx,a.y+=a.vy,a.vy+=.35,n.fillStyle=a.color,n.fillRect(a.x,a.y,6,4);Date.now()<s?requestAnimationFrame(u):t.remove()};requestAnimationFrame(u)}var me=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i,be=/^[\w\s,'"-]{1,100}$/,W={none:"none",sm:"0 1px 4px rgba(0,0,0,.15)",lg:"0 8px 32px rgba(0,0,0,.3)"};function ye(e,t=ve()){if(!e?.dark?.tokens)return!1;let n=e.theme_mode??"auto";return n==="dark"||n==="auto"&&t}function ve(){try{return typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches}catch{return!1}}function V(e,t){let n={...e?.font_family?{font:e.font_family}:{},...e?.tokens};return ye(e,t)?{...n,...e?.dark?.tokens}:n}function X(e,t){let n=o=>typeof o=="string"&&me.test(o);n(t?.background)&&(e.style.background=t.background),n(t?.text)&&(e.style.color=t.text),n(t?.accent)&&(e.style.setProperty("--a",t.accent),e.style.setProperty("--at","#fff")),typeof t?.radius=="number"&&t.radius>=0&&t.radius<=32&&(e.style.borderRadius=`${t.radius}px`),typeof t?.font=="string"&&be.test(t.font)&&(e.style.fontFamily=t.font),t?.shadow&&t.shadow in W&&(e.style.boxShadow=W[t.shadow]),typeof t?.button_radius=="number"&&t.button_radius>=0&&t.button_radius<=32&&e.style.setProperty("--br",`${t.button_radius}px`),n(t?.secondary)&&e.style.setProperty("--s",t.secondary),n(t?.secondary_text)&&e.style.setProperty("--st",t.secondary_text)}var Y=".cd{display:flex;gap:6px;justify-content:center;margin:8px 0}.cd button{width:10px;height:10px;min-width:0;padding:0;margin:0;border-radius:50%;background:#ccc;border:0}.cd button[aria-current=true]{background:var(--a,#111)}.cn{display:flex;justify-content:space-between}",A=(e,t,n)=>{let o=document.createElement("button");return o.type="button",o.textContent=e,n&&o.setAttribute("aria-label",n),o.onclick=t,o};function J(e){let t=document.createElement("div"),n=document.createElement("div");n.className="cd",n.setAttribute("role","tablist");for(let u=0;u<e.count;u++){let a=A("",()=>e.to(u),`Slide ${u+1} of ${e.count}`);a.setAttribute("role","tab"),a.setAttribute("aria-current",String(u===e.index)),n.append(a)}let o=document.createElement("div");o.className="cn";let s=e.index===e.count-1;return o.append(e.index>0?A("Back",()=>e.to(e.index-1)):A("Skip",e.dismiss),A(s?"Done":"Next",()=>s?e.complete():e.to(e.index+1))),t.append(n,o),t}function Q(e,t){let n,o=a=>{n=a.clientX},s=a=>{if(n===void 0)return;let r=a.clientX-n;n=void 0;let v=t();r<-40&&v.index<v.count-1?v.to(v.index+1):r>40&&v.index>0&&v.to(v.index-1)},u=a=>{let r=t();a.key==="ArrowRight"&&r.index<r.count-1?r.to(r.index+1):a.key==="ArrowLeft"&&r.index>0&&r.to(r.index-1)};return e.addEventListener("pointerdown",o),e.addEventListener("pointerup",s),e.addEventListener("keydown",u),()=>{e.removeEventListener("pointerdown",o),e.removeEventListener("pointerup",s),e.removeEventListener("keydown",u)}}function ge(e,t,n=!0,o=!1){if(e==="banner")return[{label:"Dismiss",action:"dismiss"}];let s=n?[]:[{label:"Back",action:"back"}];return o||s.push({label:t?"Done":"Next",action:"next"}),[...s,{label:"Dismiss",action:"dismiss"}]}function he(e){for(let t of[e.selector,...e.fallback_selectors??[]])if(t)try{let n=document.querySelector(t);if(n)return n}catch{}return null}var ke=".g{position:fixed;z-index:2147483000;background:#fff;color:#111;border:1px solid #ccc;border-radius:8px;padding:14px;font:14px system-ui;max-width:320px;box-shadow:0 4px 16px rgba(0,0,0,.2)}.m{top:50%;left:50%;transform:translate(-50%,-50%)}.bn{top:0;left:0;right:0;max-width:none;border-radius:0}.bb{top:auto;bottom:0}.p{right:16px;bottom:16px}.o{position:fixed;inset:0;z-index:2146999999;background:rgba(0,0,0,.4)}button{margin:2px;padding:4px 10px;cursor:pointer;background:var(--a,buttonface);color:var(--at,buttontext);border:1px solid #bbb;border-radius:var(--br,4px)}button+button{background:var(--s,buttonface);color:var(--st,buttontext)}h2{margin:0 0 6px;font-size:16px}p{margin:0 0 8px}li{margin:4px 0}.so{top:0;bottom:0;right:0;max-width:360px;border-radius:0;overflow:auto;animation:s .2s}.so.sl{right:auto;left:0}@keyframes s{from{transform:translateX(30px);opacity:0}}@media (prefers-reduced-motion:reduce){.so{animation:none}}.in{position:static;box-shadow:none;max-width:none;margin:8px 0}img,video,iframe{display:block;width:100%;max-width:100%;border:0;margin:0 0 8px;border-radius:4px}iframe{aspect-ratio:16/9}",xe=ke+Y,we=["www.youtube-nocookie.com","www.youtube.com","player.vimeo.com","www.loom.com","fast.wistia.net"],_e="button,[href],input,textarea,select,[tabindex]:not([tabindex='-1'])";function y(e,t,n){let o=document.createElement(e);return t!==void 0&&(o.textContent=t),n&&(o.className=n),o}function Ee(e){let t;try{t=new URL(e.url)}catch{return null}if(t.protocol!=="https:")return null;if(e.type==="image")return Object.assign(y("img"),{src:t.href,alt:e.alt??"",loading:"lazy"});if(e.type==="video")return Object.assign(y("video"),{src:t.href,controls:!0,preload:"metadata"});if(e.type!=="embed"||!we.includes(t.host))return null;let n=Object.assign(y("iframe"),{src:t.href,title:e.alt??"Video",allowFullscreen:!0,referrerPolicy:"no-referrer"});return n.setAttribute("sandbox","allow-scripts allow-same-origin allow-presentation"),n}function Me(e,t,n){e.addEventListener("keydown",o=>{if(o.key==="Escape")return n();if(o.key!=="Tab")return;let s=[...e.querySelectorAll(_e)];if(!s.length)return;let u=s[0],a=s[s.length-1],r=t.activeElement;o.shiftKey&&r===u?(o.preventDefault(),a.focus()):!o.shiftKey&&r===a&&(o.preventDefault(),u.focus())})}function Te(e,t,n="bottom"){let o=t.getBoundingClientRect(),s=e.offsetWidth||280,u=e.offsetHeight||120,a=o.left,r=o.bottom+8;n==="top"?r=o.top-u-8:n==="left"?(a=o.left-s-8,r=o.top):n==="right"&&(a=o.right+8,r=o.top);let v=(x,w)=>Math.max(8,Math.min(x,w-8));e.style.left=`${v(a,window.innerWidth-s)}px`,e.style.top=`${v(r,window.innerHeight-u)}px`}function Ne(e,t,n,o={}){let s=document.createElement("div");s.setAttribute("data-lc-ignore","");let u=s.attachShadow({mode:"open"});u.append(j(xe,o.nonce));let a=document.activeElement,r=Math.min(Math.max(o.start??0,0),e.steps.length-1),v=!1,x,w=[],h=[],H=()=>{for(let i of h)i();h=[]},D=()=>{},d=y("div",void 0,"g"),_=()=>{v||(v=!0,H(),D(),s.remove(),a?.focus?.(),n())},L=i=>{t.dismissed(r,e.steps[r]?.id??"",i),_()},k=()=>L(),M=()=>{t.completed(),_(),e.steps.at(-1)?.confetti&&K()},R=i=>(o.resolveTarget??he)(i),$=i=>{let l=i?.goto?void 0:e.steps[r]?.branch?.find(m=>F(m,{...o.person?{person:o.person}:{},...o.flag?{flag:o.flag}:{},...o.present?{present:o.present}:{}})),p=i?.goto??l?.goto,c=p==="end"?e.steps.length:p?e.steps.findIndex(m=>m.id===p):-1;w.push(r),r=c>r?c:r+1,C()},C=()=>{let i=e.steps[r];if(!i)return M();if(t.progress?.(i.id),i.url&&!location.href.includes(i.url))return _();I()},O=i=>{i<0||i>=e.steps.length||i===r||(r=i,C())},Z=()=>{let i=w.pop();i!==void 0&&(r=i,C())},P=i=>{if(i.action==="next"||i.action==="start_tour")$(i);else if(i.action==="back")Z();else if(i.action==="dismiss")k();else if(i.action==="snooze"){let l=Math.min(Math.max(Math.round(i.snooze_hours??24),1),720);t.snoozed?.(e.steps[r]?.id??"",l),L("snooze")}else i.action==="link"&&i.url&&/^https?:\/\//i.test(i.url)?window.open(i.url,"_blank","noopener,noreferrer"):i.action==="event"&&i.event&&t.event(i.event)},ee=(i,l)=>{let p=y("div"),c=i.buttons?.length?i.buttons:ge(e.kind,l,w.length===0,i.advance==="click"||i.advance==="input");for(let m of c){let g=y("button",m.label);g.type="button",g.onclick=()=>P(m),p.append(g)}return p},te=i=>[...i.title?[y("h2",i.title)]:[],...i.body?[y("p",i.body)]:[],...(i.media??[]).flatMap(l=>Ee(l)??[])],T=new Set(o.checked),N=new Map;function G(i,l,p){let c=N.get(l.id);c&&!c.hasAttribute("data-done")&&(c.setAttribute("data-done",""),c.setAttribute("aria-pressed","true"),c.textContent=`\u2713 ${l.title??l.id}`),!(!p||T.has(l.id)&&c?.hasAttribute("data-reported"))&&(c?.setAttribute("data-reported",""),T.add(l.id),t.step(i,l.id),T.size>=e.steps.length&&M())}let ne=()=>{let i=y("ul");for(let[p,c]of e.steps.entries()){let m=y("li"),g=y("button",`${c.title??c.id}`);if(g.type="button",g.setAttribute("aria-pressed","false"),N.set(c.id,g),T.has(c.id)&&(G(p,c,!1),g.setAttribute("data-reported","")),g.onclick=()=>{if(e.kind==="checklist")G(p,c,!0);else if(e.kind==="resource_center"){t.step(p,c.id);let f=c.buttons?.find(b=>b.action==="link");f&&P(f)}},c.module){let f={library:o.library??[],launch:b=>(_(),o.launch?.(b)),opened:()=>t.step(p,c.id),...o.assist?{assist:o.assist}:{}};import("./modules-FANMZRDJ.js").then(b=>m.append(b.renderModule(c,f))),i.append(m);continue}m.append(g),c.body&&m.append(y("p",c.body)),i.append(m)}d.append(y("h2",e.name),i);let l=y("button",e.kind==="resource_center"?"Close":"Dismiss");l.type="button",l.onclick=k,d.append(l)};function I(){H(),d.replaceChildren(),d.style.visibility="";let i=e.steps[r];if(!i)return;let l=e.kind==="carousel";if(e.kind==="checklist"||e.kind==="resource_center")ne();else{let f={index:r,count:e.steps.length,to:O,complete:M,dismiss:k};d.append(...te(i),l?J(f):ee(i,r===e.steps.length-1)),t.step(r,i.id)}d.setAttribute("role",e.kind==="banner"||e.kind==="inline"?"region":"dialog"),d.setAttribute("aria-label",i?.title??e.name),l&&d.setAttribute("aria-roledescription","carousel");let p={modal:"m",carousel:"m",banner:`bn${i.placement==="bottom"?" bb":""}`,slideout:`so${e.appearance?.side==="left"?" sl":""}`,inline:"in"};if(d.className=`g ${p[e.kind]??"p"}`,X(d,V(e.appearance)),(e.kind==="modal"||l)&&d.setAttribute("aria-modal","true"),l&&h.push(Q(d,()=>({index:r,count:e.steps.length,to:O,complete:M,dismiss:k}))),i.auto_close_s&&i.auto_close_s>0){let f=setTimeout(()=>L("auto_close"),Math.min(i.auto_close_s,600)*1e3);h.push(()=>clearTimeout(f))}if(i.automation&&o.automate!==!1){let f=i.automation,b=setTimeout(()=>t.automated?.(i.id,U(f)));h.push(()=>clearTimeout(b))}let c=(e.kind==="tooltip"||e.kind==="tour")&&!!(i.selector||i.fallback_selectors?.length),m=f=>{d.style.visibility="",d.classList.remove("p"),Te(d,f,i.placement);let b=i.advance==="click"?"click":i.advance==="input"?"change":null;if(!b)return;let E=()=>$();f.addEventListener(b,E,{once:!0}),h.push(()=>f.removeEventListener(b,E))},g=c?R(i):null;if(g)m(g);else if(c){d.style.visibility="hidden";let f=Date.now()+Math.min(Math.max(i.wait_ms??3e3,0),15e3),b=setInterval(()=>{let E=R(i);E?(clearInterval(b),m(E)):Date.now()>=f&&(clearInterval(b),d.style.visibility="",t.targetMissing?.(i.id,i.selector??i.fallback_selectors?.[0]??""))},150);h.push(()=>clearInterval(b))}e.kind!=="inline"&&d.querySelector("button")?.focus()}Me(d,u,k);let B=e.kind==="modal"||e.kind==="carousel",q=e.appearance?.dismiss_on_outside_click??B;if(e.appearance?.overlay??B)x=y("div",void 0,"o"),q&&(x.onclick=k),u.append(x);else if(q&&e.kind!=="inline"){let i=p=>{p.composedPath().includes(s)||k()},l=setTimeout(()=>document.addEventListener("click",i,!0));D=()=>(clearTimeout(l),document.removeEventListener("click",i,!0))}u.append(d);let z=e.kind==="inline"&&e.steps[0]?.selector?document.querySelector(e.steps[0].selector):null;return z?z.after(s):document.body.append(s),t.shown(),I(),Object.assign(_,{markDone(i){let l=e.steps.findIndex(p=>p.id===i);e.kind==="checklist"&&l>=0&&!v&&G(l,e.steps[l],!0)}})}export{Se as a,j as b,F as c,de as d,U as e,V as f,X as g,ge as h,he as i,Te as j,Ne as k};
@@ -0,0 +1 @@
1
+ import{a as r}from"./chunk-EFNCQJI3.js";var a="$consent_updated",l="lc_consent",s="lc_distinct_id";function f(e,o){try{let t=`; Path=/; SameSite=Lax${location.protocol==="https:"?"; Secure":""}`;document.cookie=`${l}=${e?"granted":"denied"}; Max-Age=31536000${t}`,e&&o?document.cookie=`${s}=${encodeURIComponent(o)}; Max-Age=31536000${t}`:e||(document.cookie=`${s}=; Max-Age=0${t}`)}catch{}}function u(e,o,t,n={}){let d=JSON.stringify(e.core.getConsent());e.client.setConsent(o);let i=e.core.getConsent();if(n.cookie&&f(i.analytics,e.core.identity.isIdentified?void 0:e.core.distinctId),n.onlyIfChanged&&JSON.stringify(i)===d)return;let c={categories:i,source:t,version:n.version??e.config.consent?.policyVersion??"1",...n.receiptId?{consent_receipt_id:n.receiptId}:{}};if(e.core.hasConsent("analytics"))e.client.capture(a,c);else if(e.config.consent?.logBeacon&&!e.config.disabled){let p=JSON.stringify({api_key:e.apiKey,batch:[{uuid:r(Date.now()),event:a,timestamp:new Date().toISOString(),properties:{...c,$lib:"lucida-browser"}}],sent_at:new Date().toISOString()});e.fetch(`${e.config.apiHost}/v1/batch`,{method:"POST",body:p,keepalive:!0,credentials:"omit",headers:{"Content-Type":"text/plain"}}).catch(()=>{})}}export{a,u as b};
@@ -1,6 +1,6 @@
1
- import { d as BrowserConfig, M as Module, e as Client } from './types-vmPeWA7a.js';
1
+ import { d as BrowserConfig, M as Module, e as Client } from './types-B_CVJeLI.js';
2
2
 
3
- declare const LIB_VERSION = "0.1.7";
3
+ declare const LIB_VERSION = "0.1.9";
4
4
  declare const DEFAULT_HOST = "https://capture.lucidace.com";
5
5
  /** Build a client from the shared core plus the given modules (pass none for the smallest bundle). */
6
6
  declare function createClient(apiKey: string, config?: BrowserConfig, modules?: Module[]): Client;
package/dist/consent.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as Module, H as Host, C as ConsentSource } from './types-vmPeWA7a.js';
2
- export { B as BannerOptions, a as BannerPosition, b as BannerTexts, c as ConsentUi } from './types-vmPeWA7a.js';
1
+ import { M as Module, H as Host, C as ConsentSource } from './types-B_CVJeLI.js';
2
+ export { B as BannerOptions, a as BannerPosition, b as BannerTexts, c as ConsentUi } from './types-B_CVJeLI.js';
3
3
  import { ConsentState } from '@lucida-analytics/sdk-core';
4
4
 
5
5
  type Update = {
@@ -34,11 +34,9 @@ declare function cookiebotToConsent(c: {
34
34
  statistics?: boolean;
35
35
  marketing?: boolean;
36
36
  }): Update;
37
- /** Cookie Munch snapshot (`CookieMunch.consent`): statistics = analytics + replay, marketing = marketing. `preferences` has no Lucida category (it gates the site's own storage, not Lucida's). */
38
- declare function cookieMunchToConsent(c: {
39
- statistics?: boolean;
40
- marketing?: boolean;
41
- }): Update;
37
+ type CmSnapshot = Record<string, boolean | undefined>;
38
+ /** Cookie Munch snapshot (`CookieMunch.consent`): statistics = analytics + replay (or analytics only, with `replayCategory` naming a separate Cookie Munch category for replay), marketing = marketing. `preferences` has no Lucida category (it gates the site's own storage, not Lucida's). */
39
+ declare function cookieMunchToConsent(c: CmSnapshot, replayCategory?: string): Update;
42
40
  /** Follow an IAB TCF v2.2 CMP (`window.__tcfapi`); waits up to 10 s for the CMP to appear. */
43
41
  declare const tcfConsent: Module;
44
42
  /** Follow Google Consent Mode v2: `gtag('consent', 'default'|'update', {...})` entries on dataLayer. */
@@ -69,6 +67,13 @@ declare function usercentricsToConsent(services: readonly UcService[], serviceNa
69
67
  declare function usercentricsBridge(serviceName?: string): Module;
70
68
  /** Usercentrics bridge for a service named "Lucida". */
71
69
  declare const usercentricsConsent: Module;
70
+ /**
71
+ * Cookie Munch bridge with options. `replayCategory`: name of a custom Cookie Munch category that gates session
72
+ * replay on its own (default: replay follows `statistics`).
73
+ */
74
+ declare function cookieMunchBridge(o?: {
75
+ replayCategory?: string;
76
+ }): Module;
72
77
  /**
73
78
  * Follow Cookie Munch (cookiemunch.net): `CookieMunch.consent` once the visitor has a decision (`hasResponse`; the
74
79
  * snapshot is all-false before that, which is never read as a decline), then its change events. Cookie Munch is
@@ -90,6 +95,8 @@ declare const CONSENT_EVENT = "$consent_updated";
90
95
  declare function applyConsent(host: Host, update: Partial<ConsentState>, source: ConsentSource, opts?: {
91
96
  version?: string;
92
97
  onlyIfChanged?: boolean;
98
+ cookie?: boolean;
99
+ receiptId?: string;
93
100
  }): void;
94
101
 
95
102
  /**
@@ -98,4 +105,4 @@ declare function applyConsent(host: Host, update: Partial<ConsentState>, source:
98
105
  */
99
106
  declare const consentModule: Module;
100
107
 
101
- export { CONSENT_EVENT, ConsentSource, type UcService, applyConsent, consentBanner, consentModule, cookieMunchConsent, cookieMunchToConsent, cookiebotConsent, cookiebotToConsent, gcmConsent, gcmToConsent, oneTrustConsent, oneTrustToConsent, osanoConsent, osanoToConsent, tcfConsent, tcfToConsent, usercentricsBridge, usercentricsConsent, usercentricsToConsent };
108
+ export { CONSENT_EVENT, ConsentSource, type UcService, applyConsent, consentBanner, consentModule, cookieMunchBridge, cookieMunchConsent, cookieMunchToConsent, cookiebotConsent, cookiebotToConsent, gcmConsent, gcmToConsent, oneTrustConsent, oneTrustToConsent, osanoConsent, osanoToConsent, tcfConsent, tcfToConsent, usercentricsBridge, usercentricsConsent, usercentricsToConsent };
package/dist/consent.js CHANGED
@@ -1 +1 @@
1
- import{a as T,b as a}from"./chunk-536QABLP.js";import"./chunk-EFNCQJI3.js";function C(e){if(e.gdprApplies===!1)return;let n=e.purpose?.consents??{},t=!!n[1]&&!!n[7];return{analytics:t,replay:t&&!!n[8],marketing:!!n[1]&&!!n[4]}}function m(e){let n=i=>i in e?e[i]==="granted":void 0,t={},r=n("analytics_storage");r!==void 0&&(t.analytics=t.replay=r);let o=n("ad_storage"),s=n("ad_user_data");return o!==void 0&&(t.marketing=o&&s!==!1),t}function g(e){let n=typeof e=="string"?e.split(","):e,t=n.includes("C0002");return{analytics:t,replay:t,marketing:n.includes("C0004")}}function y(e){return{analytics:!!e.statistics,replay:!!e.statistics,marketing:!!e.marketing}}function v(e){return{analytics:!!e.statistics,replay:!!e.statistics,marketing:!!e.marketing}}var E=e=>{let n,r=u(()=>{let o=window.__tcfapi;return typeof o!="function"?!1:(o("addEventListener",2,(s,i)=>{if(!i||s.eventStatus!=="tcloaded"&&s.eventStatus!=="useractioncomplete")return;n=s.listenerId;let c=C(s);c&&a(e,c,"tcf",{onlyIfChanged:!0})}),!0)});return()=>{r();let o=window.__tcfapi;n!==void 0&&typeof o=="function"&&o("removeEventListener",2,()=>{},n)}},O=e=>{let n=window,t=n.dataLayer??=[],r=s=>{let i=s;i&&typeof i=="object"&&i[0]==="consent"&&(i[1]==="default"||i[1]==="update")&&i[2]&&typeof i[2]=="object"&&a(e,m(i[2]),"gcm",{onlyIfChanged:!0})};t.forEach(r);let o=t.push;return t.push=function(...s){return s.forEach(r),o.apply(this,s)},()=>{t.push=o}},M=e=>{let n=o=>{(typeof o=="string"||Array.isArray(o))&&a(e,g(o),"onetrust",{onlyIfChanged:!0})},t=window,r=o=>n(o.detail??t.OnetrustActiveGroups);return window.addEventListener("OneTrustGroupsUpdated",r),n(t.OnetrustActiveGroups),()=>window.removeEventListener("OneTrustGroupsUpdated",r)},U=e=>{let n=window,t=()=>{let o=n.Cookiebot;o?.consent&&o.hasResponse!==!1&&a(e,y(o.consent),"cookiebot",{onlyIfChanged:!0})},r=["CookiebotOnConsentReady","CookiebotOnAccept","CookiebotOnDecline"];for(let o of r)window.addEventListener(o,t);return t(),()=>r.forEach(o=>window.removeEventListener(o,t))};function w(e){let n=e.ANALYTICS==="ACCEPT";return{analytics:n,replay:n,marketing:e.MARKETING==="ACCEPT"}}function u(e){if(e())return()=>{};let n=0,t=setInterval(()=>(e()||++n>40)&&clearInterval(t),250);return()=>clearInterval(t)}var p=["osano-cm-initialized","osano-cm-consent-saved","osano-cm-consent-changed"],I=e=>{let n,t=o=>{let s=o&&typeof o=="object"&&Object.keys(o).length?o:n?.getConsent?.();s&&Object.keys(s).length&&a(e,w(s),"osano",{onlyIfChanged:!0})},r=u(()=>{if(n=window.Osano?.cm,!n)return!1;for(let o of p)n.addEventListener?.(o,t);return t(n.getConsent?.()),!0});return()=>{r();for(let o of p)n?.removeEventListener?.(o,t)}};function k(e,n="Lucida"){let t=e.find(s=>s.name.toLowerCase()===n.toLowerCase());if(!t)return;let r=t.consent?.status===!0,o=e.filter(s=>s.categorySlug==="marketing");return{analytics:r,replay:r,marketing:o.length>0&&o.every(s=>s.consent?.status===!0)}}var f=["UC_UI_INITIALIZED","UC_UI_CMP_EVENT","ucEvent","UC_CONSENT"];function b(e="Lucida"){return n=>{let t=()=>{let i=window.UC_UI?.getServicesBaseInfo?.();if(!i)return!1;let c=k(i,e);return c?a(n,c,"usercentrics",{onlyIfChanged:!0}):n.log(`usercentrics: no service named "${e}"; consent left unchanged`),!0},r=()=>{t()};for(let s of f)window.addEventListener(s,r);let o=u(t);return()=>{o();for(let s of f)window.removeEventListener(s,r)}}}var x=b(),l=["CookieMunchOnConsentReady","CookieMunchOnChange"],d=e=>{let n=()=>{let t=window.CookieMunch;t?.consent&&t.hasResponse===!0&&a(e,v(t.consent),"cookiemunch",{onlyIfChanged:!0})};for(let t of l)window.addEventListener(t,n);return n(),()=>l.forEach(t=>window.removeEventListener(t,n))};var h=e=>{e.consentUi={showBanner:async n=>(await import("./banner-7LEREYUH.js")).showBanner(e,n),hideBanner:()=>{import("./banner-7LEREYUH.js").then(n=>n.hideBanner())}}};var N=e=>(h(e),d(e));export{T as CONSENT_EVENT,a as applyConsent,h as consentBanner,N as consentModule,d as cookieMunchConsent,v as cookieMunchToConsent,U as cookiebotConsent,y as cookiebotToConsent,O as gcmConsent,m as gcmToConsent,M as oneTrustConsent,g as oneTrustToConsent,I as osanoConsent,w as osanoToConsent,E as tcfConsent,C as tcfToConsent,b as usercentricsBridge,x as usercentricsConsent,k as usercentricsToConsent};
1
+ import{a as M,b as c}from"./chunk-IXDYCBAD.js";import"./chunk-EFNCQJI3.js";var a={onlyIfChanged:!0,cookie:!0};function g(n){if(n.gdprApplies===!1)return;let e=n.purpose?.consents??{},t=!!e[1]&&!!e[7];return{analytics:t,replay:t&&!!e[8],marketing:!!e[1]&&!!e[4]}}function m(n){let e=i=>i in n?n[i]==="granted":void 0,t={},s=e("analytics_storage");s!==void 0&&(t.analytics=t.replay=s);let o=e("ad_storage"),r=e("ad_user_data");return o!==void 0&&(t.marketing=o&&r!==!1),t}function v(n){let e=typeof n=="string"?n.split(","):n,t=e.includes("C0002");return{analytics:t,replay:t,marketing:e.includes("C0004")}}function y(n){return{analytics:!!n.statistics,replay:!!n.statistics,marketing:!!n.marketing}}function w(n,e){for(let[t,s]of Object.entries(e))typeof s=="boolean"&&n.categoryGrants.set(t,s)}function k(n,e){return{analytics:!!n.statistics,replay:e?!!n[e]:!!n.statistics,marketing:!!n.marketing}}var O=n=>{let e,s=u(()=>{let o=window.__tcfapi;return typeof o!="function"?!1:(o("addEventListener",2,(r,i)=>{if(!i||r.eventStatus!=="tcloaded"&&r.eventStatus!=="useractioncomplete")return;e=r.listenerId;let d=g(r);d&&c(n,d,"tcf",a)}),!0)});return()=>{s();let o=window.__tcfapi;e!==void 0&&typeof o=="function"&&o("removeEventListener",2,()=>{},e)}},U=n=>{let e=window,t=e.dataLayer??=[],s=r=>{let i=r;i&&typeof i=="object"&&i[0]==="consent"&&(i[1]==="default"||i[1]==="update")&&i[2]&&typeof i[2]=="object"&&c(n,m(i[2]),"gcm",a)};t.forEach(s);let o=t.push;return t.push=function(...r){return r.forEach(s),o.apply(this,r)},()=>{t.push=o}},x=n=>{let e=o=>{(typeof o=="string"||Array.isArray(o))&&c(n,v(o),"onetrust",a)},t=window,s=o=>e(o.detail??t.OnetrustActiveGroups);return window.addEventListener("OneTrustGroupsUpdated",s),e(t.OnetrustActiveGroups),()=>window.removeEventListener("OneTrustGroupsUpdated",s)},_=n=>{let e=window,t=()=>{let o=e.Cookiebot;!o?.consent||o.hasResponse===!1||(w(n,o.consent),c(n,y(o.consent),"cookiebot",a))},s=["CookiebotOnConsentReady","CookiebotOnAccept","CookiebotOnDecline"];for(let o of s)window.addEventListener(o,t);return t(),()=>s.forEach(o=>window.removeEventListener(o,t))};function b(n){let e=n.ANALYTICS==="ACCEPT";return{analytics:e,replay:e,marketing:n.MARKETING==="ACCEPT"}}function u(n){if(n())return()=>{};let e=0,t=setInterval(()=>(n()||++e>40)&&clearInterval(t),250);return()=>clearInterval(t)}var f=["osano-cm-initialized","osano-cm-consent-saved","osano-cm-consent-changed"],L=n=>{let e,t=o=>{let r=o&&typeof o=="object"&&Object.keys(o).length?o:e?.getConsent?.();r&&Object.keys(r).length&&c(n,b(r),"osano",a)},s=u(()=>{if(e=window.Osano?.cm,!e)return!1;for(let o of f)e.addEventListener?.(o,t);return t(e.getConsent?.()),!0});return()=>{s();for(let o of f)e?.removeEventListener?.(o,t)}};function E(n,e="Lucida"){let t=n.find(r=>r.name.toLowerCase()===e.toLowerCase());if(!t)return;let s=t.consent?.status===!0,o=n.filter(r=>r.categorySlug==="marketing");return{analytics:s,replay:s,marketing:o.length>0&&o.every(r=>r.consent?.status===!0)}}var l=["UC_UI_INITIALIZED","UC_UI_CMP_EVENT","ucEvent","UC_CONSENT"];function h(n="Lucida"){return e=>{let t=()=>{let i=window.UC_UI?.getServicesBaseInfo?.();if(!i)return!1;let d=E(i,n);return d?c(e,d,"usercentrics",a):e.log(`usercentrics: no service named "${n}"; consent left unchanged`),!0},s=()=>{t()};for(let r of l)window.addEventListener(r,s);let o=u(t);return()=>{o();for(let r of l)window.removeEventListener(r,s)}}}var S=h(),C=["CookieMunchOnConsentReady","CookieMunchOnChange"];function A(n,e){let t=e?.detail??{};for(let s of[t.receiptId,t.consentReceiptId,t.consentId,t.ledgerId,n.receiptId,n.consentReceiptId,n.consentId,n.ledgerId])if(typeof s=="string"&&s)return s.slice(0,128)}function T(n={}){return e=>{let t=s=>{let o=window.CookieMunch;if(!o?.consent||o.hasResponse!==!0)return;w(e,o.consent);let r=A(o,s);c(e,k(o.consent,n.replayCategory),"cookiemunch",{...a,...r?{receiptId:r}:{}})};for(let s of C)window.addEventListener(s,t);return t(),()=>C.forEach(s=>window.removeEventListener(s,t))}}var p=T();var I=n=>{n.consentUi={showBanner:async e=>(await import("./banner-TXLAMTQM.js")).showBanner(n,e),hideBanner:()=>{import("./banner-TXLAMTQM.js").then(e=>e.hideBanner())}}};var D=n=>(I(n),p(n));export{M as CONSENT_EVENT,c as applyConsent,I as consentBanner,D as consentModule,T as cookieMunchBridge,p as cookieMunchConsent,k as cookieMunchToConsent,_ as cookiebotConsent,y as cookiebotToConsent,U as gcmConsent,m as gcmToConsent,x as oneTrustConsent,v as oneTrustToConsent,L as osanoConsent,b as osanoToConsent,O as tcfConsent,g as tcfToConsent,h as usercentricsBridge,S as usercentricsConsent,E as usercentricsToConsent};
package/dist/core.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { d as BrowserConfig, e as Client } from './types-vmPeWA7a.js';
2
- export { F as FlagValue, H as Host, M as Module, P as Persistence } from './types-vmPeWA7a.js';
3
- export { c as createClient } from './client-CjixZMny.js';
1
+ import { d as BrowserConfig, e as Client } from './types-B_CVJeLI.js';
2
+ export { F as FlagValue, H as Host, M as Module, P as Persistence } from './types-B_CVJeLI.js';
3
+ export { c as createClient } from './client-CeNuJRRB.js';
4
4
  import '@lucida-analytics/sdk-core';
5
5
 
6
6
  /** Core-only client: capture, identity, sessions, consent, transport. No autocapture, no flags. */