@thg-agentic/hyper-personalisation-web 3.22.2 → 3.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +166 -2
- package/dist/hp.min.js +3 -3
- package/dist/onsite-answers.min.js +1 -0
- package/dist/onsite-render.min.js +182 -0
- package/dist/onsite-wheel.min.js +1 -0
- package/dist/onsite.min.js +1 -0
- package/dist/snippet.min.js +1 -1
- package/package.json +19 -3
- package/src/bootstrap.js +33 -2
- package/src/context.js +20 -7
- package/src/ga4.js +3 -4
- package/src/hp.js +2 -0
- package/src/index.js +100 -5
- package/src/onsite/answers-loader.js +6 -0
- package/src/onsite/answers.js +177 -0
- package/src/onsite/api.js +93 -0
- package/src/onsite/counters.js +144 -0
- package/src/onsite/index.js +525 -0
- package/src/onsite/pow.js +127 -0
- package/src/onsite/preview.js +97 -0
- package/src/onsite/render-loader.js +5 -0
- package/src/onsite/render.js +1507 -0
- package/src/onsite/rich-text.js +73 -0
- package/src/onsite/rules.js +250 -0
- package/src/onsite/styles.js +212 -0
- package/src/onsite/triggers.js +165 -0
- package/src/onsite/wheel-loader.js +5 -0
- package/src/onsite/wheel.js +196 -0
- package/src/onsite-facade.js +123 -0
- package/src/onsite-loader.js +5 -0
- package/src/settings.js +18 -0
- package/src/spec-version.js +1 -1
- package/src/storage-scope.js +5 -0
- package/src/version.js +1 -1
- package/types/bootstrap.d.ts +15 -1
- package/types/events.d.ts +68 -5
- package/types/hp.d.ts +4 -1
- package/types/index.d.ts +10 -0
- package/types/onsite-preview.d.ts +58 -0
- package/types/onsite-wheel.d.ts +11 -0
- package/types/onsite.d.ts +203 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
(()=>{async function Re(n,o,a){let l=m=>Array.from(new Uint8Array(m),v=>v.toString(16).padStart(2,"0")).join(""),u=new TextEncoder,x=n.maxnumber??1e6;for(let m=0;m<=x;m+=256){let v=[];for(let T=m;T<m+256&&T<=x;T++)v.push(crypto.subtle.digest("SHA-256",u.encode(n.salt+T)));let h=(await Promise.all(v)).findIndex(T=>l(T)===n.challenge);if(h>=0)return m+h;if(o&&await o(),a?.aborted)return null}return null}var kt=()=>globalThis.scheduler?.postTask?.(()=>{},{priority:"user-visible"})??new Promise(n=>setTimeout(n,0)),De=(n,o)=>Re(n,kt,o);function At(n,o){let a=`onmessage=async(e)=>postMessage(await(${Re})(e.data))`,l=URL.createObjectURL(new Blob([a],{type:"text/javascript"}));return new Promise((u,x)=>{let m;try{m=new Worker(l)}catch(h){URL.revokeObjectURL(l),x(h);return}let v=(h,T)=>{m.terminate(),URL.revokeObjectURL(l),h(T)};o.addEventListener("abort",()=>v(u,null),{once:!0}),m.onmessage=h=>v(u,h.data),m.onerror=h=>{h.preventDefault?.(),v(x,h)},m.postMessage({challenge:n.challenge,salt:n.salt,maxnumber:n.maxnumber})})}var St=n=>n&&n.algorithm==="SHA-256"&&typeof n.challenge=="string"&&typeof n.salt=="string"&&typeof n.signature=="string";async function Ue(n){if(!St(n)||typeof crypto?.subtle?.digest!="function")return null;let o=Date.now(),a=new AbortController,l,u=new Promise(v=>{l=setTimeout(()=>v(null),2e4)}),x=typeof Worker=="function"&&typeof Blob=="function"?At(n,a.signal).catch(()=>De(n,a.signal)):De(n,a.signal),m=await Promise.race([x,u]);return clearTimeout(l),a.abort(),typeof m!="number"?null:btoa(JSON.stringify({algorithm:n.algorithm,challenge:n.challenge,number:m,salt:n.salt,signature:n.signature,took:Date.now()-o}))}function B(n){if(typeof n!="string")return null;try{let o=new URL(n);return o.protocol==="https:"?o.href:null}catch{return null}}function G(n){if(typeof n!="string")return null;try{let o=new URL(n);return o.protocol==="https:"||o.protocol==="http:"&&o.hostname==="localhost"?o.href:null}catch{return null}}function pe(n,o,a,l){if(typeof o=="string"){n.append(a.createTextNode(o));return}if(l>6||o===null)return;if(Array.isArray(o)){for(let v of o)pe(n,v,a,l+1);return}if(typeof o!="object")return;let u="b"in o?"b":"i"in o?"i":"a"in o?"a":null;if(!u)return;let x=u==="a"?B(o.href):null,m=u==="a"&&!x?n:a.createElement(u);x&&(m.setAttribute("href",x),m.setAttribute("rel","noopener")),pe(m,o[u],a,l+1),m!==n&&n.append(m)}function We(n,o=document){let a=o.createDocumentFragment();return pe(a,n,o,0),a}var Et=n=>n!==null&&typeof n=="object"&&!Array.isArray(n);function V(n,o,a){if(typeof a=="string"&&a)return a;let l=Et(n?.next?.answers)?n.next.answers:{};for(let[u,x]of Object.entries(l)){let m=u.indexOf("="),v=o[u.slice(0,m)];if(m>0&&v?.includes(u.slice(m+1)))return x}return typeof n?.next?.default=="string"?n.next.default:null}var ue={AT:"43",AU:"61",BE:"32",CA:"1",CH:"41",DE:"49",DK:"45",ES:"34",FI:"358",FR:"33",GB:"44",IE:"353",IT:"39",NL:"31",NO:"47",NZ:"64",PL:"48",PT:"351",SE:"46",US:"1"};function Fe(n,o){let a=String(n??"").replace(/[\s.()-]/g,"");a.startsWith("00")&&(a=`+${a.slice(2)}`);let l=ue[String(o??"").toUpperCase()];return!a.startsWith("+")&&l&&(a=`+${l}${a.replace(/^0/,"")}`),/^\+[1-9]\d{7,14}$/.test(a)?a:null}var Ye=n=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n);function fe(n,o,a,l,u){let x=n("select","i");x.setAttribute("aria-label",o);for(let[m,v]of[["",a],...l]){let h=n("option","",v);h.value=m,h.selected=m===u,x.append(h)}return x}var he={system:"system-ui,sans-serif","neo-grotesque":'Inter,Roboto,"Helvetica Neue",Arial,sans-serif',humanist:'Seravek,"Gill Sans Nova",Ubuntu,Calibri,sans-serif',"geometric-humanist":"Avenir,Montserrat,Corbel,sans-serif","rounded-sans":'ui-rounded,Quicksand,Comfortaa,"Arial Rounded MT Bold",sans-serif',industrial:'Bahnschrift,"DIN Alternate","Franklin Gothic Medium",sans-serif',transitional:'Charter,"Sitka Text",Cambria,serif',"old-style":'"Iowan Old Style","Palatino Linotype",P052,serif',didone:'Didot,"Bodoni MT","Noto Serif Display",serif',"slab-serif":'Rockwell,"Roboto Slab","DejaVu Serif",serif'},me="cubic-bezier(.16,1,.3,1)",be=`
|
|
2
|
+
:host{all:initial}
|
|
3
|
+
:host([preview]){display:block;position:relative;width:100%;height:100%;overflow:hidden;contain:layout paint}
|
|
4
|
+
.s{--a:var(--hp-accent,#111);--b:var(--hp-bg,#fff);--t:var(--hp-text,#111);--r:var(--hp-radius,16px);--oa:var(--hp-on-accent,#fff);--ot:var(--hp-on-accent-text,var(--oa));--fl:var(--hp-field,color-mix(in srgb,var(--t) 5%,var(--b)));--ft:var(--hp-field-text,var(--t));--mu:color-mix(in srgb,var(--t) 74%,var(--b));--ln:color-mix(in srgb,var(--t) 18%,var(--b));--br:min(12px,var(--r));--ir:min(var(--r),8px);font:16px/1.5 var(--hp-font,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif);color:var(--t);-webkit-font-smoothing:antialiased;box-sizing:border-box;margin:0;padding:0;border:0;background:none;max-width:none;max-height:none;overflow:visible}
|
|
5
|
+
.s *,.s ::before,.s ::after{box-sizing:border-box}
|
|
6
|
+
dialog.s:not([open]){display:none}
|
|
7
|
+
dialog::backdrop{background:none}
|
|
8
|
+
[hidden]{display:none!important}
|
|
9
|
+
.b-pill{--br:999px}
|
|
10
|
+
.b-square{--br:0px;--ir:0px}
|
|
11
|
+
.popup,.fullscreen{position:fixed;inset:0;width:100%;height:100%;display:grid;place-items:center;padding:24px;z-index:2147483646}
|
|
12
|
+
.fullscreen{padding:0}
|
|
13
|
+
.mob.popup{padding:12px}
|
|
14
|
+
.ov{display:none;position:absolute;inset:0;background:var(--hp-ov,rgb(10 10 14/.6));animation:hp-fade .3s ease both}
|
|
15
|
+
.popup>.ov,.fullscreen>.ov{display:block}
|
|
16
|
+
.w{position:relative;display:flex;flex-direction:column;width:min(100%,480px);max-height:100%;min-height:0;overflow:auto;overscroll-behavior:contain;background:var(--b);color:var(--t);border-radius:var(--r);box-shadow:0 24px 48px -24px rgb(0 0 0/.35),0 0 0 1px rgb(0 0 0/.05);animation:hp-pop .44s ${me} both}
|
|
17
|
+
.z-sm{width:min(100%,380px)}
|
|
18
|
+
.z-lg{width:min(100%,880px)}
|
|
19
|
+
.z-full,.fullscreen .w{width:100%;height:100%;max-height:none;border-radius:0;box-shadow:none}
|
|
20
|
+
.m{position:relative;flex:none;overflow:hidden;background:color-mix(in srgb,var(--t) 7%,var(--b))}
|
|
21
|
+
.m img,.m video{display:block;width:100%;height:100%;object-fit:cover}
|
|
22
|
+
.t-stack .m{aspect-ratio:var(--ar,16/9);max-height:280px}
|
|
23
|
+
.t-split{flex-direction:row;min-height:min(500px,100%)}
|
|
24
|
+
.t-split.right{flex-direction:row-reverse}
|
|
25
|
+
.t-split .m{flex:0 0 46%}
|
|
26
|
+
.t-split .m>*{position:absolute;inset:0}
|
|
27
|
+
.mob .t-split,.sheet .t-split{flex-direction:column;min-height:0}
|
|
28
|
+
.mob .t-split .m,.sheet .t-split .m{flex:none;height:190px}
|
|
29
|
+
.t-overlay{justify-content:center;min-height:min(520px,100%)}
|
|
30
|
+
.mob .t-overlay{min-height:min(460px,100%)}
|
|
31
|
+
.t-overlay .m{position:absolute;inset:0}
|
|
32
|
+
.t-overlay .m::after{content:"";position:absolute;inset:0;background:linear-gradient(to top,var(--b),color-mix(in srgb,var(--b) 50%,transparent));opacity:var(--sc,.45)}
|
|
33
|
+
.t-overlay .f{position:relative;z-index:1;flex:none;width:min(100%,560px);margin-inline:auto}
|
|
34
|
+
.t-image-only .m{background:none}
|
|
35
|
+
.t-image-only .m img{height:auto;aspect-ratio:var(--ar,auto)}
|
|
36
|
+
.io{display:block;width:100%;padding:0;border:0;background:none;cursor:pointer;color:inherit}
|
|
37
|
+
.f{display:flex;flex-direction:column;gap:14px;padding:44px 40px 36px;flex:1 0 auto;min-width:0}
|
|
38
|
+
.t-split .f{flex:1 1 0;justify-content:center}
|
|
39
|
+
.lk{min-width:var(--lw);min-height:var(--lh)}
|
|
40
|
+
.lk>.f{justify-content:center}
|
|
41
|
+
.an{align-self:start;margin-top:var(--tp,0px);max-height:calc(100% - var(--tp,0px))}
|
|
42
|
+
.z-full .f,.fullscreen .f{justify-content:center;width:min(100%,560px);margin:auto}
|
|
43
|
+
.pd-none{padding:0}
|
|
44
|
+
.pd-sm{padding:24px}
|
|
45
|
+
.pd-lg{padding:60px 56px 52px}
|
|
46
|
+
.mob .pd-md{padding:34px 24px 24px}
|
|
47
|
+
.ta-center .f{text-align:center}
|
|
48
|
+
.a-left{text-align:left}.a-center{text-align:center}.a-right{text-align:right}
|
|
49
|
+
h2{margin:0;font-weight:700;letter-spacing:-.02em;text-wrap:balance}
|
|
50
|
+
h2:focus{outline:none}
|
|
51
|
+
.nm .f>h2:first-child,.t-split:not(.right) .f>h2:first-child{padding-inline-end:36px}
|
|
52
|
+
.nm.ta-center .f>h2:first-child,.nm .f>h2.a-center:first-child{padding-inline:36px}
|
|
53
|
+
p{margin:0;text-wrap:pretty}
|
|
54
|
+
.f>p{color:var(--mu)}
|
|
55
|
+
h2+p{margin-top:-4px}
|
|
56
|
+
.x-xs{font-size:12px;line-height:1.45}
|
|
57
|
+
.x-sm{font-size:14px;line-height:1.5}
|
|
58
|
+
.x-md{font-size:16px;line-height:1.55}
|
|
59
|
+
.x-lg{font-size:20px;line-height:1.35}
|
|
60
|
+
.x-xl{font-size:32px;line-height:1.1}
|
|
61
|
+
.x-display{font-size:54px;line-height:1;letter-spacing:-.035em;font-weight:800}
|
|
62
|
+
.mob .x-xl{font-size:27px}
|
|
63
|
+
.mob .x-display{font-size:40px}
|
|
64
|
+
a{color:inherit;text-underline-offset:3px}
|
|
65
|
+
.l{display:flex;flex-direction:column;gap:6px;font-size:13px;font-weight:600;letter-spacing:.01em;text-align:left}
|
|
66
|
+
.i{font:inherit;font-size:16px;font-weight:400;letter-spacing:0;width:100%;height:52px;padding:0 18px;border:1.5px solid var(--ln);border-radius:var(--ir);background:var(--fl);color:var(--ft);caret-color:var(--a);outline:none}
|
|
67
|
+
.ph{display:flex;gap:8px}.ph .cc{flex:0 0 auto;width:auto;padding:0 10px}
|
|
68
|
+
.i::placeholder{color:color-mix(in srgb,var(--ft) 72%,var(--fl))}
|
|
69
|
+
::selection{background:color-mix(in srgb,var(--a) 30%,var(--b))}
|
|
70
|
+
.i:focus{border-color:var(--a);box-shadow:0 0 0 4px color-mix(in srgb,var(--a) 22%,transparent)}
|
|
71
|
+
.i[aria-invalid=true]{border-color:#d93025;box-shadow:0 0 0 4px rgb(217 48 37/.16)}
|
|
72
|
+
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;font:inherit;font-size:18.67px;font-weight:700;letter-spacing:.01em;line-height:1.2;min-height:52px;padding:14px 24px;border:1.5px solid var(--a);border-radius:var(--br);background:var(--a);color:var(--oa);cursor:pointer;text-decoration:none;-webkit-tap-highlight-color:transparent;transition:transform .15s,filter .2s}
|
|
73
|
+
.btn:hover{filter:brightness(1.08)}
|
|
74
|
+
.btn:active{transform:scale(.98)}
|
|
75
|
+
.bo .btn{background:transparent;color:var(--a)}
|
|
76
|
+
.btn[disabled]{opacity:.55;cursor:progress;filter:none;transform:none}
|
|
77
|
+
.btn.no{align-self:center;min-height:44px;padding:6px 10px;border:0;background:none;color:var(--mu);font-size:14px;font-weight:500;text-decoration:underline;text-decoration-color:color-mix(in srgb,var(--t) 30%,transparent);text-underline-offset:4px;filter:none}
|
|
78
|
+
.btn.no:hover{color:var(--t)}
|
|
79
|
+
:focus-visible,.ch input:focus-visible+span{outline:2px solid var(--a);outline-offset:3px}
|
|
80
|
+
.x{position:absolute;top:12px;right:12px;z-index:2;display:grid;place-items:center;width:44px;height:44px;padding:0;border:0;border-radius:50%;background:var(--b);box-shadow:0 0 0 1px var(--ln);color:var(--t);cursor:pointer}
|
|
81
|
+
.x::before,.x::after{content:"";grid-area:1/1;width:16px;height:2px;border-radius:2px;background:currentColor;transform:rotate(45deg)}
|
|
82
|
+
.x::after{transform:rotate(-45deg)}
|
|
83
|
+
.c{display:flex;gap:10px;align-items:flex-start;font-size:13px;line-height:1.45;color:var(--mu);text-align:left;cursor:pointer}
|
|
84
|
+
.c input{appearance:none;flex:none;display:grid;place-content:center;width:20px;height:20px;margin:0;border:1.5px solid color-mix(in srgb,var(--t) 50%,var(--b));border-radius:min(var(--r),5px);background:var(--b);cursor:pointer}
|
|
85
|
+
.c input:checked{background:var(--a);border-color:var(--a)}
|
|
86
|
+
.c input:checked::after{content:"";width:10px;height:5px;border:solid var(--ot);border-width:0 0 2px 2px;transform:translateY(-1px) rotate(-45deg)}
|
|
87
|
+
.sm{font-size:12px;line-height:1.5;color:var(--mu)}
|
|
88
|
+
fieldset{display:flex;flex-wrap:wrap;gap:8px;min-width:0;margin:0;padding:0;border:0}
|
|
89
|
+
legend{padding:0;margin-bottom:8px;font-size:13px;font-weight:600}
|
|
90
|
+
.ta-center fieldset{justify-content:center}
|
|
91
|
+
.ch{position:relative;display:inline-flex}
|
|
92
|
+
.ch input{position:absolute;inset:0;margin:0;opacity:0}
|
|
93
|
+
.ch span{display:inline-flex;align-items:center;min-height:44px;padding:10px 18px;border:1.5px solid var(--ln);border-radius:999px;font-size:15px}
|
|
94
|
+
.ch input:checked+span{background:var(--a);border-color:var(--a);color:var(--ot)}
|
|
95
|
+
.ls{flex-direction:column}.ls .c{font-size:15px;color:var(--t)}.ls [type=radio]{border-radius:50%}
|
|
96
|
+
.ph .u{align-self:center;color:var(--mu)}
|
|
97
|
+
.bd{flex-wrap:wrap}.bd .i{min-width:0;padding:0 12px}.bd [name=hp_d]{flex:0 0 5.5em}.bd [name=hp_m]{flex:1 1 8.5em}.bd [name=hp_y]{flex:1 1 8em}
|
|
98
|
+
.e.won{color:var(--t);font-size:18px;font-weight:700;text-align:center}
|
|
99
|
+
.e{color:#d93025;font-size:13px;font-weight:500}
|
|
100
|
+
.e:empty{display:none}
|
|
101
|
+
.k{display:flex;flex-direction:column;align-items:stretch;gap:10px}
|
|
102
|
+
.k:empty{display:none}
|
|
103
|
+
.k output{display:block;padding:16px;border:1.5px dashed var(--a);border-radius:min(var(--r),16px);background:color-mix(in srgb,var(--a) 8%,var(--b));font:700 22px/1.2 Menlo,monospace;letter-spacing:.12em;text-align:center}
|
|
104
|
+
.btn.cp,.btn.b2{background:transparent;border-color:var(--ln);color:var(--t)}
|
|
105
|
+
.pg{display:flex;flex-direction:column;gap:8px}
|
|
106
|
+
.pg p{font-weight:600}
|
|
107
|
+
.tr{height:6px;border-radius:99px;background:color-mix(in srgb,var(--t) 18%,var(--b));overflow:hidden}
|
|
108
|
+
.tr i{display:block;height:100%;border-radius:inherit;background:var(--a);transform:scaleX(0);transform-origin:left;transition:transform .6s ${me}}
|
|
109
|
+
.tm{font-size:40px;line-height:1;font-weight:800;letter-spacing:.02em;font-variant-numeric:tabular-nums;text-align:center}
|
|
110
|
+
.bi{display:block;width:100%;height:auto}
|
|
111
|
+
.bl{display:block;border-radius:var(--br)}
|
|
112
|
+
hr{width:100%;margin:4px 0;border:0;border-top:1px solid var(--ln)}
|
|
113
|
+
.wh{width:min(100%,320px);aspect-ratio:1;align-self:center}
|
|
114
|
+
.wh svg{display:block;width:100%;height:auto;filter:drop-shadow(0 16px 24px rgb(0 0 0/.2))}
|
|
115
|
+
.hd{display:none}
|
|
116
|
+
.uc h2{text-transform:uppercase;font-weight:800;letter-spacing:-.01em;line-height:1.02}
|
|
117
|
+
.uc .btn:not(.no),.uc .tb{text-transform:uppercase;letter-spacing:.06em}
|
|
118
|
+
.sheet,.bar,.teaser{position:fixed;inset:auto;z-index:2147483646;display:flex;flex-direction:column}
|
|
119
|
+
.sheet{right:24px;bottom:24px;width:min(400px,calc(100% - 32px));max-height:calc(100% - 48px)}
|
|
120
|
+
.sheet.p-bottom-left{right:auto;left:24px}
|
|
121
|
+
.sheet.p-bottom{right:auto;left:50%;translate:-50% 0}
|
|
122
|
+
.sheet .w,.bar .w{width:100%}
|
|
123
|
+
.mob.sheet{left:0;right:0;bottom:0;translate:none;width:100%;max-height:92%}
|
|
124
|
+
.mob.sheet .w{border-radius:var(--r) var(--r) 0 0;box-shadow:0 -16px 48px -16px rgb(0 0 0/.35);animation-name:hp-up}
|
|
125
|
+
.mob.sheet .hd{display:block;position:absolute;top:0;left:50%;translate:-50% 0;z-index:3;width:96px;height:28px;cursor:grab;touch-action:none}
|
|
126
|
+
.mob.sheet .hd::before{content:"";display:block;width:40px;height:5px;margin:10px auto 0;border-radius:3px;background:color-mix(in srgb,var(--t) 25%,var(--b))}
|
|
127
|
+
.bar{left:0;right:0;bottom:0;width:100%}
|
|
128
|
+
.bar.p-top{bottom:auto;top:0}
|
|
129
|
+
.bar .w{flex-direction:row;border-radius:0;box-shadow:0 -10px 30px -14px rgb(0 0 0/.3);animation-name:hp-up}
|
|
130
|
+
.bar.p-top .w{animation-name:hp-down}
|
|
131
|
+
.bar .m{display:none}
|
|
132
|
+
.bar .f{flex-direction:row;flex-wrap:wrap;align-items:center;justify-content:center;gap:10px 16px;width:min(100%,1200px);margin:auto;padding:14px 68px 14px 24px}
|
|
133
|
+
.bar h2{font-size:18px;padding:0!important}
|
|
134
|
+
.bar .f>p{font-size:15px}
|
|
135
|
+
.bar .l{flex:0 1 300px}
|
|
136
|
+
.bar .lt{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
|
|
137
|
+
.bar .i,.bar .btn{height:46px;min-height:46px}
|
|
138
|
+
.bar .btn{padding:10px 22px}
|
|
139
|
+
.bar .c,.bar .sm,.bar .e{flex-basis:100%;justify-content:center;text-align:center}
|
|
140
|
+
.bar .pg{flex:0 1 520px;text-align:center}
|
|
141
|
+
.bar .k{flex-direction:row;align-items:center}
|
|
142
|
+
.bar .k output{padding:9px 16px;font-size:16px;border-radius:999px}
|
|
143
|
+
.bar .k .btn{height:44px;min-height:44px;padding:6px 16px;font-size:14px}
|
|
144
|
+
.bar .x{top:50%;right:12px;translate:0 -50%}
|
|
145
|
+
.mob.bar .f{justify-content:flex-start;padding:14px 60px 16px 16px}
|
|
146
|
+
.mob.bar h2,.mob.bar .f>p{flex-basis:100%}
|
|
147
|
+
.mob.bar .l{flex:1 1 160px;min-width:160px}
|
|
148
|
+
.mob.bar .f>.btn:not(.no){flex:1 0 auto}
|
|
149
|
+
.mob.bar .x{top:6px;translate:none}
|
|
150
|
+
.teaser{left:20px;bottom:20px}
|
|
151
|
+
.teaser.p-bottom-right{left:auto;right:20px}
|
|
152
|
+
.teaser.p-left,.teaser.p-right{bottom:auto;top:50%;translate:0 -50%}
|
|
153
|
+
.teaser.p-left{left:0}
|
|
154
|
+
.teaser.p-right{left:auto;right:0}
|
|
155
|
+
.teaser .w{width:auto;overflow:visible;background:none;box-shadow:none;border-radius:0;animation-name:hp-fade}
|
|
156
|
+
.teaser .f{padding:0}
|
|
157
|
+
.teaser .m{overflow:visible}
|
|
158
|
+
.teaser .io img{width:auto;max-width:220px;max-height:220px;border-radius:var(--r);box-shadow:0 16px 40px -12px rgb(0 0 0/.45)}
|
|
159
|
+
.tb{display:inline-flex;align-items:center;gap:10px;padding:15px 24px;border:0;border-radius:var(--br);background:var(--a);color:var(--ot);font:inherit;font-size:15px;font-weight:650;letter-spacing:.01em;cursor:pointer;box-shadow:0 14px 34px -10px rgb(0 0 0/.45)}
|
|
160
|
+
.b-rounded .tb{border-radius:999px}
|
|
161
|
+
.p-left .tb,.p-right .tb{writing-mode:vertical-rl;padding:22px 13px;border-radius:var(--br) 0 0 var(--br)}
|
|
162
|
+
.p-left .tb{transform:rotate(180deg)}
|
|
163
|
+
.b-pill.teaser .tb{border-radius:999px}
|
|
164
|
+
.teaser .x{top:auto;right:0;bottom:100%;border:10px solid transparent;background:var(--t) padding-box;box-shadow:none;color:var(--b)}
|
|
165
|
+
.teaser .x::before,.teaser .x::after{width:10px}
|
|
166
|
+
.teaser.p-left .x,.teaser.p-right .x{bottom:auto;top:100%}
|
|
167
|
+
.teaser.p-left .x{right:auto;left:0}
|
|
168
|
+
.inline{position:static;display:block;height:100%}
|
|
169
|
+
.inline .w{width:100%;height:100%;box-shadow:none;border:1px solid var(--ln);animation:none}
|
|
170
|
+
.inline .t-stack .m{max-height:none}
|
|
171
|
+
.out .w{animation:hp-out .2s ease-in both}
|
|
172
|
+
.out .ov{animation:hp-fade .2s ease-in reverse both}
|
|
173
|
+
.f>*{animation:hp-rise .5s ${me}}
|
|
174
|
+
.pv .w,.pv .ov,.pv .f>*,.inline .f>*{animation:none}
|
|
175
|
+
@keyframes hp-pop{from{opacity:0;transform:translateY(24px) scale(.96)}}
|
|
176
|
+
@keyframes hp-fade{from{opacity:0}}
|
|
177
|
+
@keyframes hp-rise{from{opacity:0;transform:translateY(10px)}}
|
|
178
|
+
@keyframes hp-up{from{transform:translateY(100%)}}
|
|
179
|
+
@keyframes hp-down{from{transform:translateY(-100%)}}
|
|
180
|
+
@keyframes hp-out{to{opacity:0;transform:translateY(12px) scale(.98)}}
|
|
181
|
+
@media (prefers-reduced-motion:reduce){.s .w,.s .ov,.f>*{animation:hp-fade .15s ease both!important}.btn{transition:none}}
|
|
182
|
+
`;var $t=/^#(?:[0-9a-f]{3}){1,2}$/i,He=["popup","fullscreen"],_t=["ok","verify","already"],zt=["stack","split","overlay","image-only"],Be={bar:["bottom","top"],sheet:["bottom-right","bottom-left","bottom"],teaser:["bottom-left","bottom-right","left","right"]},Tt=["xs","sm","md","lg","xl","display"],Ge={xs:4,sm:8,md:16,lg:28,xl:44},Ve={sm:380,md:480,lg:880},Ct=["left","center","right"],Xe={secondary:" b2",link:" no"},Lt=220,Mt=["verify","already","held","fallback","success"],Ot=[500,1500],It=600,Pt=1800,$={email:"Enter a valid email address.",phone:"Enter a valid mobile number.",intl:"Enter a valid mobile number, starting with + and its country code.",consent:"Tick the box to sign up.",failed:"Something went wrong. Please try again.",busy:"Too many tries. Please wait a moment and try again.",spin:"Sign up first to spin.",yours:"Your code",held:"You\u2019re already on the list",resent:"We\u2019ve sent your code to your inbox again.",inbox:"Your code is in the email we sent when you first signed up.",shop:"Continue shopping",closeOffer:"Close offer",code:"We\u2019ll email your code to you.",claimed:"This email address has already claimed its code.",copied:"Copied",thanks:"Thanks, you\u2019re signed up",unavailable:"Not available right now.",won:"You won"},P=n=>n!==null&&typeof n=="object"&&!Array.isArray(n),F=(n,o,a)=>n.includes(o)?o:a,I=(n,o,a)=>Number.isFinite(n)?Math.min(Math.max(n,o),a):null,ge=n=>n.type==="date"||n.type==="number",xe=()=>globalThis.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches===!0;function Ze(n){let o=P(n.layout)?n.layout:{},a=P(o.media)?o.media:null,l=F(zt,o.template,"stack"),u=a?.side==="right"?"right":"left";return!a&&P(o.image)&&o.image.side!=="none"&&(a=o.image,o.image.side!=="top"&&(l="split",u=o.image.side==="right"?"right":"left")),(!a||!G(a.asset))&&(a=null,l="stack"),{template:l,media:a,side:u,scrim:I(o.scrim,0,.9)??.45,padding:F(["none","sm","md","lg"],o.padding,"md")}}var Je=(n,o)=>F(["sm","md","lg","full"],n.size,null)??(o.template==="split"||o.template==="overlay"?"lg":"md"),Qe=(n,o,a=1)=>{if(n==="fullscreen"||o==="full")return"100vw";let l=n==="teaser"?220:n==="sheet"?400:Ve[o]??Ve.md;return`(max-width: 639px) 100vw, ${Math.round(l*a)}px`},et=(n,o,a)=>{if(!a||!Array.isArray(n.widths)||!o.endsWith(".webp"))return null;let l=n.widths.filter(u=>Number.isInteger(u)&&u>0&&u<a).sort((u,x)=>u-x);return l.length===0?null:[...l.map(u=>`${o.slice(0,-5)}-${u}w.webp ${u}w`),`${o} ${a}w`].join(",")},tt=(n,o)=>n.format==="inline"?"inline":o.format&&o.format!=="inline"?o.format:n.format,ve=n=>n.kind==="video"||n.t==="video",we={webm:"video/webm",mp4:"video/mp4",m4v:"video/mp4",mov:"video/quicktime",ogv:"video/ogg"},ke=n=>we[n.split(/[?#]/)[0].split(".").pop().toLowerCase()],Nt=(n,o)=>[...new Set([o,...Array.isArray(n.sources)?n.sources.map(G):[]])].filter(Boolean).sort((a,l)=>(ke(l)===we.webm)-(ke(a)===we.webm));function Ae(n,o,a,l=new Set){let u=o.steps.find(k=>k.id===a);if(!u)return Promise.resolve();let x=tt(n,o),m=Ze(u),v=x==="teaser"&&u===o.steps[0],h=x==="teaser"&&!v?"popup":x,T=Je(o.theme,m),S=v?[]:u.blocks.filter(k=>P(k)&&(k.t==="image"||k.t==="video")).map(k=>[k,1]);return m.media&&!(v&&m.template!=="image-only")&&S.push([m.media,m.template==="split"?.46:1]),Promise.all(S.map(([k,Z])=>{let C=G(ve(k)?k.poster:k.asset);if(!C)return null;let L=document.createElement("img"),U=!ve(k)&&et(k,C,I(k.width,1,8192));U&&(L.sizes=Qe(h,T,Z),L.srcset=U);let y=`${L.sizes} ${U||C}`;return l.has(y)?null:(l.add(y),L.src=C,L.decode?.().catch(()=>{}))}))}var jt=0,ye=n=>`hp-${n}-${++jt}`;function f(n,o,a){let l=document.createElement(n);return o&&(l.className=o),a!==void 0&&l.append(We(a)),l}var nt=n=>{let o=n.length===4?[...n.slice(1)].map(a=>a+a).join(""):n.slice(1);return[0,2,4].map(a=>Number.parseInt(o.slice(a,a+2),16))},K=n=>{let[o,a,l]=nt(n).map(u=>{let x=u/255;return x<=.04045?x/12.92:((x+.055)/1.055)**2.4});return .2126*o+.7152*a+.0722*l},Ke=(n,o=4.5)=>{let a=K(n)+.05,l=1.05/a;return l>=o?"#fff":a/(K("#111")+.05)>l?"#111":"#fff"};function qt(n,o){let a=(S,k)=>k&&n.style.setProperty(S,k),l=S=>$t.test(S??"")?S:null;a("--hp-accent",l(o.accent)),a("--hp-bg",l(o.background)),a("--hp-text",l(o.text));let u=I(o.radius,0,48);u!==null&&a("--hp-radius",`${u}px`),a("--hp-font",o.font==="site"?n.ownerDocument.defaultView.getComputedStyle(n.parentElement??n.ownerDocument.body).fontFamily:Object.hasOwn(he,o.font)?he[o.font]:null),l(o.accent)&&(a("--hp-on-accent",Ke(o.accent,3)),a("--hp-on-accent-text",Ke(o.accent))),l(o.background)&&K(o.background)<.18&&(a("--hp-field","#fff"),a("--hp-field-text","#111"));let x=P(o.overlay)?o.overlay:{},m=[l(o.text),l(o.background)].filter(Boolean).sort((S,k)=>K(S)-K(k))[0],[v,h,T]=nt(l(x.colour)??m??"#0b0b0f");a("--hp-ov",`rgb(${v} ${h} ${T} / ${I(x.opacity,0,1)??.6})`)}function Dt(n){try{let o=new CSSStyleSheet;o.replaceSync(be),n.adoptedStyleSheets=[o]}catch{let o=document.createElement("style");o.textContent=be,n.append(o)}}function it(n){let{form:o,creative:a,decision:l,access:u,client:x,api:m,counters:v}=n,h=n.preview??null,T=e=>{let t=e.blocks.find(r=>r?.t==="email"||r?.t==="phone");return t?.t==="phone"||!t&&!o.consent_text?o.sms_consent_text:o.consent_text},S=tt(o,a),k=a.theme,Z=F(Be[S]??[],k.position,Be[S]?.[0]),C=document.createElement("hp-onsite");h&&C.setAttribute("preview",""),qt(C,k);let L=C.attachShadow({mode:"open"});Dt(L);let U=S!=="inline"&&!h,y=f(U?"dialog":S==="inline"?"section":"div"),Se=f("div","ov"),E=f("div","w"),W=f("div","m");h&&(W.dataset.hpMedia="");let Ee=()=>{let e=f("form","f");return e.noValidate=!0,e.addEventListener("submit",gt),e.addEventListener("input",()=>{M.textContent&&A.getAttribute("aria-busy")!=="true"&&N(null)}),e},A=Ee(),M=f("p","e");M.id=ye("err"),M.setAttribute("aria-live","assertive");let ie=f("div","hd");ie.setAttribute("aria-hidden","true"),E.append(ie,W,A),y.append(Se,E);let Y=S!=="inline"&&f("button","x");Y&&(Y.type="button",Y.addEventListener("click",()=>j("close")),E.append(Y),Se.addEventListener("click",()=>j("close"))),L.append(y);let i={step:null,mode:S,size:"md",modal:!1,mobile:h?.device==="mobile",answers:{},sent:new Set,receipt:null,claim:n.coupon?{code:n.coupon}:h?{code:"WELCOME15"}:null,claiming:null,touched:!1,toWarm:new Set,warmed:n.warmed??new Set,warming:!1,owed:!1,submitted:!1,pow:null,wheel:null,timers:[],codes:[],videos:[],closed:!1},J=o.locale||document.documentElement.lang,ot=o.questions.some(ge)&&n.loadAnswers().catch(()=>null),$e=new WeakMap,_e=()=>{let e=P(k.button)?k.button:{};y.className=`s ${i.mode}${Z?` p-${Z}`:""} b-${F(["pill","rounded","square"],e.shape,"rounded")}${i.mobile?" mob":""}${h?" pv":""}${e.style==="outline"?" bo":""}${k.caps===!0?" uc":""}`},X=h?null:globalThis.matchMedia?.("(max-width: 639px)"),ze=()=>{i.mobile=X?.matches===!0,ae(),_e()};X&&(i.mobile=X.matches===!0,X.addEventListener?.("change",ze));let Q=(e,t)=>{h||!l.decision_id||!u.analytics()||x.slotEngaged({decision_id:l.decision_id,slot:l.slot,arm:l.arm??null,engagement:e,step:t??i.step?.id??null})},N=(e,t)=>{M.className="e",M.textContent=e??"";for(let s of A.querySelectorAll("[aria-invalid]"))s.removeAttribute("aria-invalid");let r=t?.closest("label,fieldset");r&&A.contains(r)?r.after(M):A.append(M),t&&(t.setAttribute("aria-invalid","true"),t.setAttribute("aria-describedby",M.id),t.focus(),t.scrollIntoView?.({block:"nearest"}))},H=e=>{A.setAttribute("aria-busy",String(e));for(let t of A.querySelectorAll("button"))t.disabled=e},Te=()=>h?Promise.resolve(null):(i.pow??(i.pow=m.challenge().then(e=>e.status===200?Ue(e.body):null).catch(()=>null)),i.pow),oe=()=>{for(let e of i.videos)try{document.hidden||xe()?e.pause():e.play()?.catch?.(()=>{})}catch{}};document.addEventListener("visibilitychange",oe);function Ce(e,t,r,s){let c=G(e.asset);if(!c)return null;let p=typeof e.alt=="string"?e.alt:"",d;if(ve(e)){d=f("video",t),d.muted=d.defaultMuted=d.loop=d.playsInline=!0;let w=G(e.poster);w&&(d.poster=w),p?d.setAttribute("aria-label",p):d.setAttribute("aria-hidden","true"),d.autoplay=!xe()&&!h,d.preload=d.autoplay?"auto":w?"none":"metadata";let _=Nt(e,c);if(_.length>1)for(let z of _){let O=f("source");O.src=z;let q=ke(z);q&&(O.type=q),d.append(O)}else d.src=c;i.videos.push(d)}else{d=f("img",t),d.alt=p,d.decoding="async",d.loading=r?"eager":"lazy",r&&(d.fetchPriority="high");let w=et(e,c,I(e.width,1,8192));w&&(d.sizes=Qe(i.mode,i.size,s),d.srcset=w),d.src=c}let b=I(e.width,1,8192),g=I(e.height,1,8192);return b&&g&&(d.width=b,d.height=g),P(e.focal)&&(d.style.objectPosition=`${I(e.focal.x,0,100)??50}% ${I(e.focal.y,0,100)??50}%`),d}function Le(e,t){let r=f("label","l");r.append(f("span","lt",e.label??(t==="email"?"Email":"Mobile number")));let s=f("input","i");if(s.type=t,s.name=t==="email"?"email":"phone",s.autocomplete=s.inputMode=t,s.required=!0,typeof e.placeholder=="string"&&(s.placeholder=e.placeholder),s.setAttribute("aria-describedby",M.id),s.addEventListener("focus",Te,{once:!0}),t!=="tel")return r.append(s),r;s.id=`${M.id}-p`,r.htmlFor=s.id;let c=fe(f,"Country code","+",Object.entries(ue).map(([d,b])=>[d,`${d} +${b}`]),(e.country||/-(\w\w)$/.exec(J)?.[1]||"").toUpperCase());c.classList.add("cc"),c.name="hp_cc";let p=f("span","ph");return p.append(c,s),r.append(p),r}function rt(e){let t=o.questions.find(b=>b.key===e.question);if(!t||!ge(t)&&!Array.isArray(t.options))return null;let r=f("fieldset");r.dataset.question=t.key,r.append(f("legend","",t.label??""));let s=i.answers[t.key]??[];if(ge(t))return ot.then(b=>{if(!b)return r.append(f("p","sm",$.unavailable));b.answerFields(r,t,f,s[0],J),$e.set(r,()=>b.answerOf(r,t,void 0,J))}),r;let c=t.type==="many",p=F(["list","dropdown"],e.display,"buttons"),d=t.options.filter(b=>P(b)&&typeof b.value=="string");if(p==="dropdown"&&!c)return r.append(fe(f,t.label??t.key,"\u2014",d.map(b=>[b.value,b.label??b.value]),s[0])),r;p!=="buttons"&&(r.className="ls");for(let b of d){let g=f("input");g.value=b.value,g.checked=s.includes(b.value),g.type=c?"checkbox":"radio",g.name=`q_${t.key}`;let w=f("label",p==="buttons"?"ch":"c");w.append(g,f("span","",b.label??b.value)),r.append(w)}return r}function re(){for(let e of i.codes){if(e.replaceChildren(),!i.claim)continue;if(!i.claim.code){e.append(f("p","",i.claim.held?$.claimed:$.code));continue}i.claim.prize?.label&&e.append(f("p","",i.claim.prize.label));let t=f("output");t.textContent=i.claim.code;let r=f("button","btn cp");r.type="button",r.textContent="Copy code",r.addEventListener("click",()=>{navigator.clipboard?.writeText(i.claim.code).then(()=>{r.textContent=$.copied}).catch(()=>{})}),e.append(t,r)}}function st(e){if(i.claim&&!i.claim.code)return null;let t=f("p","tm");t.setAttribute("role","timer");let r=Date.now()+Math.max(0,Number(e.minutes)||0)*6e4,s=()=>{let p=Math.max(0,Math.round((r-Date.now())/1e3));t.textContent=`${String(Math.floor(p/60)).padStart(2,"0")}:${String(p%60).padStart(2,"0")}`,p===0&&clearInterval(c)},c=setInterval(s,1e3);return i.timers.push(c),s(),t}function se(e,t){return e.href=t,e.rel="noopener",e.addEventListener("click",r=>{h?r.preventDefault():Q("click")}),e}function at(e){let t=e.label??"Continue";if(e.action==="link"){let s=B(e.href);return s?se(f("a",`btn${Xe[e.variant]??""}`,t),s):null}let r=f("button",`btn${Xe[e.variant]??""}`,t);return r.type=e.action==="submit"?"submit":"button",r.type==="button"?r.addEventListener("click",()=>te(e)):r.dataset.submit="",r}let Me=(e,t,r)=>(e.classList.add(`x-${F(Tt,t.size,r)}`),Ct.includes(t.align)&&e.classList.add(`a-${t.align}`),e);function Oe(e){let t=Ce(e,"bi",i.step===a.steps[0]);if(!t)return null;t.style.objectFit=e.fit==="contain"?"contain":"cover";let r=I(e.radius,0,48);r!==null&&(t.style.borderRadius=`${r}px`);let s=I(e.max_height,40,800);if(s!==null&&(t.style.maxHeight=`${s}px`),!t.width&&e.fit!=="contain"&&(t.style.aspectRatio="16 / 9"),e.t==="video"||!B(e.href))return t;let c=se(f("a","bl"),B(e.href));return c.append(t),c}function lt(e){let t=I(e.threshold,.01,1e7);if(!t)return null;let r=f("div","pg"),s=f("p"),c=f("div","tr"),p=f("i");c.append(p),c.setAttribute("role","progressbar"),c.setAttribute("aria-valuemin","0"),c.setAttribute("aria-valuemax",String(t)),r.append(s,c);let d=g=>g.toFixed(2);try{let g=new Intl.NumberFormat(J||void 0,{style:"currency",currency:e.currency});d=w=>g.format(w)}catch{}let b=()=>{let g=Math.max(0,Number(n.basket?.())||0),w=t-g;s.textContent=w>0?String(e.text??"").replace("{amount}",d(w)):e.done??"",p.style.transform=`scaleX(${Math.min(1,g/t)})`,c.setAttribute("aria-valuenow",String(Math.min(g,t))),s.id||(s.id=ye("pg")),c.setAttribute("aria-labelledby",s.id)};return b(),i.timers.push(setInterval(b,2e3)),r}let Ie={heading(e){let t=Me(f("h2","",e.text),e,"xl");return t.id=ye("h"),t.tabIndex=-1,y.hasAttribute("aria-labelledby")||(y.setAttribute("aria-labelledby",t.id),i.step===a.steps[0]&&He.includes(i.mode)&&!h&&(t.autofocus=!0)),t},text:e=>Me(f("p","",e.text),e,"md"),email:e=>Le(e,"email"),phone:e=>Le(e,"tel"),consent(e){let t=T(i.step)?.text;if(typeof t!="string")return null;if(e.required!==!0)return f("p","sm",t);let r=f("label","c"),s=f("input");return s.type="checkbox",s.name="hp_consent",s.required=!0,s.setAttribute("aria-describedby",M.id),r.append(s,f("span","",t)),r},question:rt,wheel(){let e=f("div","wh");return n.loadWheel().then(t=>{i.closed||(i.wheel=t.mountWheel(e,o.prizes))}).catch(()=>{}),e},code(){let e=f("div","k");return e.setAttribute("aria-live","polite"),i.codes.push(e),e},button:at,decline(e){let t=f("button","btn no",e.label??"No thanks");return t.type="button",t.addEventListener("click",()=>j("decline")),t},countdown:st,progress:lt,image:Oe,video:Oe,spacer(e){let t=f("div","sp");return t.style.height=`${Ge[e.size]??Ge.md}px`,t.setAttribute("aria-hidden","true"),t},divider:()=>f("hr")};function ct(e,t){W.replaceChildren();let r=e.media,s=!r||t&&e.template!=="image-only";if(i.size=Je(k,e),E.className=`w t-${e.template} z-${i.size}${e.side==="right"?" right":""}${k.text_align==="center"?" ta-center":""}${s?" nm":""}`,E.style.setProperty("--sc",String(e.scrim)),A.className=`f pd-${e.padding}`,W.hidden=s,W.hidden)return;let c=Ce(r,"",i.step===a.steps[0],e.template==="split"?.46:1);if(!c)return;if(c.width?E.style.setProperty("--ar",`${c.width} / ${c.height}`):E.style.removeProperty("--ar"),e.template!=="image-only"){c.tagName==="IMG"&&e.template==="overlay"&&(c.alt=""),W.append(c);return}let p=B(r.href),d=p?se(f("a","io"),p):f("button","io");p||(d.type="button",d.addEventListener("click",()=>te({action:"next"}))),d.append(c),W.append(d)}function dt(e){let t=e.blocks.find(c=>c?.t==="heading"),r=e.blocks.find(c=>c?.t==="button"&&c.action==="next"),s=f("button","tb");return s.textContent=t?f("b","",t.text).textContent:r?.label??"Open",s.type="button",s.addEventListener("click",()=>te(r??{action:"next"})),s}function R(e,t=new Set){let r=a.steps.find(z=>z.id===e);if(!r)return j("done");if(r.kind==="question"&&!h&&!u.analytics()&&!t.has(r.id))return R(V(r,i.answers),t.add(r.id));let s=i.step!==null,c=s&&(L.activeElement||document.activeElement===document.body),p=s&&!h?{mode:i.mode,w:E.offsetWidth,h:E.offsetHeight,top:E.offsetTop}:null;i.step=r,i.touched=!1;for(let z of i.timers.splice(0))clearInterval(z);i.codes=[],i.videos=[],i.wheel=null;let d=S==="teaser"&&r===a.steps[0];if(i.mode=S==="teaser"&&!d?"popup":S,S==="teaser"&&v.tab?.(o.slot,d),Y&&Y.setAttribute("aria-label",d?$.closeOffer:"Close"),_e(),y.removeAttribute("aria-labelledby"),p){let z=Ee();A.replaceWith(z),A=z}let b=Ze(r);ct(b,d);let g=p?.mode==="popup"&&i.mode==="popup";if(ae(),p?.mode===i.mode&&p.h>0&&!g&&(E.style.setProperty("--lw",`${p.w}px`),E.style.setProperty("--lh",`${p.h}px`),E.classList.add("lk")),A.replaceChildren(),d&&b.template!=="image-only")A.append(dt(r));else for(let[z,O]of r.blocks.entries()){let q=P(O)&&Object.hasOwn(Ie,O.t)?Ie[O.t](O):null;q&&(h&&(q.dataset.hpBlock=String(z)),A.append(q))}let w=A.querySelector("[data-submit]"),_=A.querySelector("[name=hp_consent]")?.parentNode;w&&_&&w.before(_),A.hidden=A.childElementCount===0,N(null),re(),y.hasAttribute("aria-labelledby")?y.removeAttribute("aria-label"):y.setAttribute("aria-label",b.media?.alt?.trim?.()||"Sign up"),g&&p.h>0&&pt(p),s&&Pe(),oe(),h||ut(r),c&&A.querySelector("h2")?.focus()}function ae(){E.classList.remove("lk","an"),E.style.removeProperty("--tp")}function pt(e){let t=E.offsetHeight;E.classList.add("an");let r=E.offsetTop,s=Math.max(0,e.top-r);if(s+t>y.clientHeight-2*r)return ae();E.style.setProperty("--tp",`${s}px`)}function ut(e){let t=e.next??{};for(let c of[t.default,...Object.values(P(t.answers)?t.answers:{}),...e.blocks.map(p=>p?.next),...Mt])typeof c=="string"&&i.toWarm.add(c);if(i.warming)return;i.warming=!0;let r=()=>{if(i.warming=!1,!i.closed&&C.isConnected)for(let c of i.toWarm)Ae(o,a,c,i.warmed);i.toWarm.clear()},s=()=>globalThis.requestIdleCallback?requestIdleCallback(r,{timeout:2e3}):setTimeout(r,200);document.readyState==="complete"?s():window.addEventListener("load",s,{once:!0})}function Pe(){if(!U)return;let e=He.includes(i.mode);if(!(y.open&&i.modal===e)){try{y.open&&y.close()}catch{}if(i.modal=e,y.setAttribute("aria-modal",String(e)),e&&typeof y.showModal=="function")y.showModal();else if(typeof y.show=="function"){let t=document.activeElement;y.show(),t&&t!==document.body?t.focus?.({preventScroll:!0}):C.blur()}else y.setAttribute("open","");!e||typeof y.showModal!="function"?y.setAttribute("role","dialog"):y.removeAttribute("role")}}function ft(){for(let e of A.querySelectorAll("fieldset[data-question]")){let t=e.dataset.question,r=$e.get(e)?.()??{};if(r.error)return r;let s=[r.value,...[...e.querySelectorAll("input:checked,select:not([name])")].map(c=>c.value)].filter(Boolean);s.length?i.answers[t]=s:delete i.answers[t]}}function mt(){let e=[];for(let[r,s]of Object.entries(i.answers)){let c=`${r}=${s.join(",")}`;i.sent.has(c)||(i.sent.add(c),e.push({question:r,values:s}))}let t=i.step.id;if(i.signedUp&&e.length)return void m.answers({anonymousId:u.anonymousId(),sessionId:u.sessionId()??void 0,slot:l.slot,arm:l.arm??void 0,decision_id:l.decision_id??void 0,step:t,...i.signedUp,answers:e,context:Ne()});if(u.analytics())for(let r of e)x.preferencesStated({...r,source:"onsite",slot:l.slot,arm:l.arm??null,decision_id:l.decision_id??null,step:t})}let Ne=()=>({page:{url:u.pageUrl()},locale:u.locale()??void 0,consent:u.consent()}),ee=e=>{i.receipt&&!h&&mt(),R(V(i.step,i.answers,e))};async function ht(e){let t=i.step,r=A.querySelector("input[name=email],input[name=phone]");if(!r)return ee(e.next);let s=r.name==="email"?"email":"sms",c=A.querySelector("select[name=hp_cc]")?.value,p=s==="email"?Ye(r.value.trim())?r.value.trim():null:Fe(r.value,c);if(!p)return N(s==="email"?$.email:c?$.phone:$.intl,r);let d=A.querySelector("input[name=hp_consent]");if(d&&!d.checked)return N($.consent,d);N(null),H(!0);let b=await Te();i.pow=null;let g=Object.entries(i.answers).map(([D,de])=>({question:D,values:de})),w=s==="sms"?o.sms_consent_text:o.consent_text,_=await m.capture({anonymousId:u.anonymousId(),sessionId:u.sessionId()??void 0,slot:l.slot,arm:l.arm??void 0,decision_id:l.decision_id??void 0,step:t.id,channel:s,[s==="email"?"email":"phone"]:p,...s==="sms"&&i.signedUp,consent_text:w?{id:w.id,version:w.version}:void 0,...g.length?{answers:g}:{},...b?{altcha:b}:{},context:Ne()}),z=_.body?.status,O=(_.status===202||_.status===200)&&_t.includes(z);if(i.closed&&!O)return;O||H(!1);let q=_.status===400?_.body?.field:null;if(q==="email"||q==="phone")return N($[q],r);if(!O)return N(_.status===429?$.busy:$.failed,r);r.value="";for(let[D,de]of Object.entries(i.answers))i.sent.add(`${D}=${de.join(",")}`);i.receipt=typeof _.body.receipt=="string"?_.body.receipt:null,s==="email"&&(i.signedUp={email:p,email_receipt:i.receipt}),i.submitted=!0,v.submitted(o.slot),Q("submit",t.id),i.owed=s==="email"&&o.prizes.length>0;let ne=i.owed?ce([]):null;ne||n.emit?.("submitted",{coupon:null});let yt=ne&&await Promise.race([ne,new Promise(D=>setTimeout(D,It))]);if(i.closed)return;if(H(!1),yt?.held)return R(le("held"));let vt=z!=="ok"&&a.steps.some(D=>D.id===z);R(vt?z:V(t,i.answers,e.next));let wt=i.step;ne?.then(D=>{D?.held&&!i.closed&&i.step===wt&&!i.touched&&R(le("held"))})}function le(e){if(a.steps.some(r=>r.id===e))return e;let t=e==="fallback"||i.claim?.code?[{t:"heading",text:e==="fallback"?$.thanks:$.yours},{t:"code"}]:[{t:"heading",text:$.held},{t:"text",text:o.code_relayed===!0?$.resent:$.inbox},{t:"button",label:$.shop,action:"close"}];return a.steps.push({id:e,blocks:t}),e}function je(e){i.owed&&(i.owed=!1,n.emit?.("submitted",{coupon:e?{code:e.code??null,prize:e.prize?.key}:null}))}function ce(e=Ot){let t=i.receipt;return i.claiming??(i.claiming=(async()=>{let r;for(let d of[0,...e])if(d&&await new Promise(b=>setTimeout(b,d)),r=await m.claim({slot:l.slot,decision_id:l.decision_id??void 0,receipt:t}),r.status!==503)break;let s=r.body,c=s?.fallback===!0&&!s.code;if(r.status!==200||!(P(s?.prize)||c))return i.claiming=null,!e.length&&r.status===503?ce():(je(null),null);let p=s.held&&!s.code?v.code?.():null;return p&&(s={...s,code:p}),i.claim=s,typeof s.code=="string"&&v.code?.(s.code),je(s),i.closed||re(),s})()),i.claiming}async function bt(e){if(!i.receipt)return N($.spin);H(!0);let t=await ce();if(i.closed)return;if(!t)return H(!1),N($.failed);let r=t.fallback===!0&&!t.code,s=t.held?-1:o.prizes.findIndex(d=>d.key===t.prize?.key&&d.label===t.prize?.label);if(i.wheel&&s>=0&&!r){if(await i.wheel.spinTo(s),i.closed)return;M.className="e won",M.textContent=`${$.won} ${t.prize.label}`,await new Promise(d=>setTimeout(d,Pt))}if(i.closed)return;H(!1);let c=r?"fallback":s<0?"held":null,p=c?le(c):V(i.step,i.answers,e.next);p?R(p):re()}function te(e){if(e.action==="close")return j("close");let t=ft();return h?ee(e.next):t?N(t.error,t.input):e.action==="apply"?(n.emit?.("apply",{coupon:i.claim?.code?{code:i.claim.code}:null}),Q("click"),V(i.step,i.answers,e.next)?ee(e.next):j("done")):e.action==="submit"?ht(e):e.action==="spin"?bt(e):ee(e.next)}function gt(e){if(e.preventDefault(),A.getAttribute("aria-busy")==="true")return;let t=i.step.blocks.find(r=>r?.t==="button"&&r.action==="submit");te(t??{action:"next"})}function qe(){i.closed=!0;for(let t of i.timers.splice(0))clearInterval(t);document.removeEventListener("visibilitychange",oe),X?.removeEventListener?.("change",ze);let e=()=>{try{y.open&&y.close()}catch{}C.remove()};if(!U||xe())return e();y.classList.add("out"),setTimeout(e,Lt)}function j(e){i.closed||h||(!i.submitted&&e!=="done"&&Q("dismiss"),v.closed(o.slot),v.tab?.(o.slot,!1),qe(),n.onClose?.(e))}for(let e of["pointerdown","keydown","input"])y.addEventListener(e,()=>{i.touched=!0});y.addEventListener("cancel",e=>{e.preventDefault(),j("esc")}),y.addEventListener("keydown",e=>{e.key==="Escape"&&!i.modal&&S!=="inline"&&j("esc"),e.key==="Tab"&&i.modal&&xt(e)});function xt(e){let t=[...L.querySelectorAll("input[type=radio]:checked")],r=new Set,s=[...L.querySelectorAll("a[href],button,input,select,textarea")].filter(g=>{if(g.disabled||!g.getClientRects().length)return!1;if(g.type!=="radio")return!0;let w=t.find(_=>_.name===g.name);return(w?g!==w:r.has(g.name))?!1:(r.add(g.name),!0)});if(!s.length)return;let c=e.shiftKey,p=L.activeElement;p?.type==="radio"&&(p=s.find(g=>g.type==="radio"&&g.name===p.name)??p);let d=s.indexOf(p),b=null;if(d<0){let g=w=>p&&p.compareDocumentPosition(w)&4;b=c?s.findLast(w=>!g(w))??s.at(-1):s.find(g)??s[0]}else(c?d===0:d===s.length-1)&&(b=s.at(c?-1:0));b&&(e.preventDefault(),b.focus())}return ie.addEventListener("pointerdown",e=>{if(!i.mobile||i.mode!=="sheet")return;let t=e.clientY,r=0,s=p=>{r=Math.max(0,p.clientY-t),E.style.transform=`translateY(${r}px)`},c=()=>{document.removeEventListener("pointermove",s),document.removeEventListener("pointerup",c),E.style.transform="",r>80&&j("close")};document.addEventListener("pointermove",s),document.addEventListener("pointerup",c)}),R(h?.step&&a.steps.some(e=>e.id===h.step)?h.step:a.steps[0].id),(n.container??document.body).append(C),Pe(),{close:j,root:L,host:C,show:R,step:()=>i.step?.id??null,modal:()=>!i.closed&&i.modal,destroy:()=>!i.closed&&qe()}}window[Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.render")]={mountForm:it,warm:Ae};})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{function S(e,o,t=5){let n=360/o;return t*360+(360-(e+.5)*n)}var w="http://www.w3.org/2000/svg",T=4500,I=.22,L=.95,C=.105,m=.082,O=.62,F=1.15,E="var(--hp-accent,#111)",z="var(--hp-on-accent,#fff)",g="var(--hp-bg,#fff)",M="var(--hp-text,#111)";function l(e,o={}){let t=document.createElementNS(w,e);for(let[n,c]of Object.entries(o))t.setAttribute(n,String(c));return t}function a(e,o,t,n=1){return e.style.fill=o,n<1&&(e.style.fillOpacity=String(n)),t&&(e.style.stroke=t),e}var k=()=>globalThis.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches===!0,$=(e,o=1)=>{let t=(e-90)*Math.PI/180;return`${(o*Math.cos(t)).toFixed(4)} ${(o*Math.sin(t)).toFixed(4)}`};function R(e,o){let t=L-I,n=2*.35*Math.sin(Math.min(Math.PI/o,Math.PI/2)),c=s=>Math.max(m,Math.min(C,n/(s*F))),d=s=>t/(Math.max(1,s.length)*O),r=d(e);if(r>=m)return{lines:[e],size:Math.min(c(1),r)};let y=[...e.matchAll(/ /g)].map(s=>s.index);if(y.length){let s=e.length/2,i=y.reduce((h,p)=>Math.abs(p-s)<Math.abs(h-s)?p:h),u=[e.slice(0,i),e.slice(i+1)],f=Math.min(c(2),...u.map(d));if(f>=m)return{lines:u,size:f}}let x=Math.floor(t/(m*O));return{lines:[`${e.slice(0,x-1).trimEnd()}\u2026`],size:m}}function P(e,o){let t=(Array.isArray(o)?o:[]).map(s=>String(s?.label??s?.key??"")),n=t.length;if(n<2)return null;let c=360/n,d=l("svg",{viewBox:"-1.2 -1.2 2.4 2.4",role:"img","aria-label":`Prize wheel: ${t.join(", ")}`}),r=l("g");r.style.transformBox="fill-box",r.style.transformOrigin="50% 50%";let y=[[1,z],[.14,M],[.72,z]];r.append(a(l("circle",{r:1}),g));let x=[];return t.forEach((s,i)=>{let[u,f]=y[n%2===1&&i===n-1?2:i%2];r.append(a(l("path",{d:`M0 0L${$(i*c)}A1 1 0 ${c>180?1:0} 1 ${$((i+1)*c)}Z`,"stroke-width":.012}),E,g,u));let h=(i+.5)*c-90,p=R(s,n),N=a(l("text",{transform:`rotate(${h}) translate(${(I+L)/2} 0)${h>90&&h<270?" rotate(180)":""}`,"text-anchor":"middle","dominant-baseline":"central","font-size":p.size.toFixed(4),"font-weight":700,"aria-hidden":"true"}),f);p.lines.forEach((b,_)=>{let A=l("tspan",{x:0,y:((_-(p.lines.length-1)/2)*p.size*F).toFixed(4)});A.textContent=b,N.append(A)}),r.append(N);for(let b of[i*c,(i+.5)*c]){let[_,A]=$(b,1.075).split(" ");x.push(a(l("circle",{cx:_,cy:A,r:.024}),g))}}),d.append(a(l("circle",{r:1.13}),M),...x,r,a(l("circle",{r:.17,"stroke-width":.035}),g,M),a(l("circle",{r:.065}),E),a(l("path",{d:"M-0.12 -1.2L0.12 -1.2L0 -0.86Z","stroke-width":.03,"stroke-linejoin":"round"}),E,g)),e.append(d),{spinTo(s){let i=k();return r.style.transition=i?"none":`transform ${T}ms cubic-bezier(.15,.7,.1,1)`,r.style.transform=`rotate(${S(s,t.length,i?0:5)}deg)`,i?Promise.resolve():new Promise(u=>{let f=setTimeout(u,T+200);r.addEventListener("transitionend",()=>{clearTimeout(f),u()},{once:!0})})},remove:()=>d.remove()}}window[Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.wheel")]={mountWheel:P};})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{function P(e){let s=typeof document>"u"?null:document.currentScript?.src;return s?new URL(e,s).href:null}var Y=new Map;function O(e,s){return window[s]?Promise.resolve(window[s]):e?(Y.has(s)||Y.set(s,new Promise((n,r)=>{let d=document.createElement("script");d.src=e,d.async=!0,d.onload=()=>window[s]?n(window[s]):r(new Error(`${e} did not register`)),d.onerror=()=>r(new Error(`${e} did not load`)),document.head.append(d)}).finally(()=>Y.delete(s))),Y.get(s)):Promise.reject(new Error("the CDN script\u2019s own URL is unknown"))}var Ne=P("onsite-answers.min.js"),se=()=>O(Ne,Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.answers"));var ke="/v1/capture/challenge",De=e=>typeof e=="string"&&/^\/v1\/[\w/-]+$/.test(e)?e:ke;function oe(e,s={}){let n=s.fetch??globalThis.fetch?.bind(globalThis),r=s.servingHost??e.servingHost,d=s.gatewayHost??e.gatewayHost;async function o(l,{method:p="GET",body:i,consent:c=!1,timeoutMs:u}={}){if(!n)return{status:0,body:null};try{let w=await n(l,{method:p,credentials:"omit",signal:u&&AbortSignal.timeout?.(u),headers:{accept:"application/json",authorization:`Bearer ${e.writeKey}`,...i?{"content-type":"application/json"}:{},...c?e.headers():{}},...i?{body:JSON.stringify(i)}:{}}),b=null;try{b=await w.json()}catch{}return{status:w.status,body:b}}catch{return{status:0,body:null}}}return{decide:(l,p)=>o(`${r}/v1/decisions`,{method:"POST",consent:!0,body:{slots:[p?{key:l,pin:{experiment:p[0],arm:p[1],split:p[2]}}:l],identifier_value:e.anonymousId()??void 0,session_id:e.sessionId()??void 0,...e.preview?{preview:e.preview}:{}}}),challenge:()=>o(`${d}${De(s.challenge)}`),capture:l=>o(`${d}/v1/capture`,{method:"POST",body:l}),answers:l=>o(`${d}/v1/capture/answers`,{method:"POST",body:l}),claim:l=>o(`${r}/v1/offers/claim`,{method:"POST",consent:!0,body:l,timeoutMs:8e3})}}function ie(e,s){let n={},r=()=>{try{let o=JSON.parse(e().getItem(s));o&&typeof o=="object"&&(n=o)}catch{}return n};return{read:r,write:o=>{let l=r();o(l),n=l;try{e().setItem(s,JSON.stringify(l))}catch{}}}}function re(e,s=()=>!0){let n=ie(()=>sessionStorage,e),r=ie(()=>localStorage,e),d=()=>s()?r:n,o=()=>{let i=r.read();(i.sub!==void 0||i.k!==void 0)&&r.write(c=>{delete c.sub,delete c.k})},l=()=>s()?[n.read(),r.read()]:(o(),[n.read()]),p=(i,c)=>{var u;return i.f??(i.f={}),(u=i.f)[c]??(u[c]={}),i.f[c]};return{seen(i){let c=r.read().f?.[i]??{};return{session:n.read().f?.[i]?.n??0,lifetime:c.n??0,closedAt:c.c??null,submitted:c.s===1}},subscribed:()=>l().some(i=>i.sub===1),shown(i){n.write(c=>{let u=p(c,i);u.n=(u.n??0)+1}),r.write(c=>{let u=p(c,i);u.n=(u.n??0)+1})},closed(i,c=Date.now()){r.write(u=>{p(u,i).c=c})},tab(i,c){n.write(u=>{let w=p(u,i);c?w.t=1:delete w.t})},tabOut:i=>n.read().f?.[i]?.t===1,pin(i,c){if(c===void 0)return n.read().f?.[i]?.p??null;n.write(u=>{p(u,i).p=c})},coveredAt:()=>n.read().o??null,covered(i=Date.now()){n.write(c=>{c.o=i})},code(i,c=Date.now()){if(i===void 0){let[u]=l().flatMap(w=>w.k?[w.k]:[]).sort((w,b)=>b.at-w.at);return u&&c-u.at<14*864e5?u.c:null}return d().write(u=>{u.k={c:i,at:c}}),i},submitted(i){r.write(c=>{p(c,i).s=1}),d().write(c=>{c.sub=1})}}}var Le=P("onsite-render.min.js"),le=()=>O(Le,Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.render"));var de=["popup","sheet","bar","teaser","inline","fullscreen"],Fe=["entry","exit","scroll","time","idle","inline","manual"],q=e=>e!=="inline",pe=e=>e==="popup"||e==="sheet"||e==="fullscreen",S=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),D=e=>Array.isArray(e)?e.filter(s=>typeof s=="string"):[],ce=e=>Number.isInteger(e)&&e>=0?e:null;function fe(e){if(!S(e)||typeof e.slot!="string"||e.slot==="")return null;let s=S(e.trigger)?e.trigger:{};if(!de.includes(e.format)||!Fe.includes(s.type))return null;let n=S(e.caps)?e.caps:{};return{...e,trigger:s,priority:Number.isFinite(e.priority)?e.priority:0,pages:S(e.pages)?e.pages:{},devices:D(e.devices),aliases:D(e.aliases),audiences:D(e.audiences),caps:{per_session:ce(n.per_session),lifetime:ce(n.lifetime),after_close_days:Number.isFinite(n.after_close_days)?n.after_close_days:null},window:S(e.window)?e.window:{},questions:Array.isArray(e.questions)?e.questions.filter(S):[],prizes:Array.isArray(e.prizes)?e.prizes.filter(S):[]}}var We=/^[a-z][a-z0-9_-]{0,31}$/;function he(e){if(!S(e)||e.v!==1||!Array.isArray(e.steps))return null;let s=e.steps.filter(n=>S(n)&&We.test(n.id)&&Array.isArray(n.blocks));return s.length===0?null:{format:de.includes(e.format)?e.format:null,theme:S(e.theme)?e.theme:{},steps:s}}function ae(e,s){let n=String(e).split("*").map(r=>r.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join(".*");return new RegExp(`^${n}$`,"i").test(s)}function je(e,s){let n=D(e?.include);return(!n.length||n.some(r=>ae(r,s)))&&!D(e?.exclude).some(r=>ae(r,s))}function we(e){return e.matchMedia?.("(hover: none) and (pointer: coarse)")?.matches===!0||e.innerWidth<768?"mobile":"desktop"}var ue=e=>typeof e=="string"?Date.parse(e):Number.NaN,L=e=>e.trigger.type==="manual";function J(e,s){let n=[];je(e.pages,s.path)||n.push("page not included"),e.devices.length&&!e.devices.includes(s.device)&&n.push(`not on ${s.device}`);let r=ue(e.window.starts_at),d=ue(e.window.ends_at);if((s.now<r||s.now>=d)&&n.push("outside its dates"),e.audiences.length&&(s.personalisation?s.audiences&&!e.audiences.some(p=>s.audiences.includes(p))&&n.push("not in its audiences"):n.push("audiences need personalisation consent")),s.preview||s.asked||L(e))return n;let{seen:o}=s,{caps:l}=e;return o.submitted&&n.push("already submitted"),e.exclude_subscribed===!0&&s.subscribed&&n.push("already subscribed"),l.per_session!==null&&o.session>=l.per_session&&n.push("per_session cap"),l.lifetime!==null&&o.lifetime>=l.lifetime&&n.push("lifetime cap"),l.after_close_days!==null&&o.closedAt&&s.now-o.closedAt<l.after_close_days*864e5&&n.push("closed recently"),n}var ge=(e,s)=>s.priority-e.priority;var Ue=["mousemove","pointerdown","keydown","scroll","touchstart","wheel"];function Ke(){let e=[];return{on:(r,d,o,l={passive:!0})=>{r.addEventListener(d,o,l),e.push(()=>r.removeEventListener(d,o,l))},later:(r,d)=>{let o=setTimeout(r,d);e.push(()=>clearTimeout(o))},stop:()=>{for(let r of e.splice(0))r()}}}var ye=(e,s)=>{let n=s.documentElement.scrollHeight||0;return n>0?(e.scrollY+e.innerHeight)/n:0},Ye=e=>{let s=e.activeElement;return!!(s&&(/^(INPUT|TEXTAREA|SELECT)$/.test(s.tagName)||s.isContentEditable))};function He({on:e,later:s},n,r,d,o){let l=!1,p=!1,i=null,c=0;s(()=>{l=!0},r.delay_ms??5e3),e(o,"mousemove",u=>{u.clientY>d.innerHeight*.1&&(p=!0),i!==null&&(c=u.clientY-i),i=u.clientY}),e(o,"mouseout",u=>{l&&p&&!u.relatedTarget&&u.clientY<=0&&c<0&&!Ye(o)&&n("exit")})}function ze({on:e,later:s},n,r,d,o){let l=!1,p=0,i=d.scrollY,c=Date.now(),u=null,w=null;s(()=>{l=!0},r.delay_ms??5e3),e(d,"scroll",()=>{let b=d.scrollY,A=Date.now();if(p=Math.max(p,ye(d,o)),b<i){(!u||A-u.t>300)&&(u={y:i,t:c});let _=u.y-b;l&&p>=.3&&_>=120&&_/Math.max(1,A-u.t)>=.5&&n("exit_scroll")}else u=null;i=b,c=A}),e(o,"visibilitychange",()=>{o.visibilityState==="hidden"?w=Date.now():w!==null&&Date.now()-w>=1e4&&n("return"),o.visibilityState!=="hidden"&&(w=null)})}function me(e,s,{device:n,win:r=window,doc:d=document}){let o=Ke(),l=(e.seconds??30)*1e3;if(e.type==="entry"&&o.later(()=>s("entry"),e.delay_ms??0),e.type==="time"&&o.later(()=>s("time"),l),e.type==="exit"&&(n==="mobile"?ze:He)(o,s,e,r,d),e.type==="scroll"){let p=e.depth??.5;o.on(r,"scroll",()=>ye(r,d)>=p&&s("scroll"))}if(e.type==="idle"){let p=null,i=()=>{clearTimeout(p),p=setTimeout(()=>s("idle"),l)};i();for(let c of Ue)o.on(c==="scroll"?r:d,c,i);return o.on(d,"visibilitychange",i),()=>{clearTimeout(p),o.stop()}}return o.stop}var Xe=P("onsite-wheel.min.js"),be=()=>O(Xe,Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.wheel"));var _e=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite-access"),F=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite"),Be=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.pending"),Ge=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.listeners"),Se=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.suppressed"),Ae={seen:()=>({session:0,lifetime:0,closedAt:null,submitted:!1}),subscribed:()=>!1,shown(){},closed(){},submitted(){},tab(){},tabOut:()=>!1,pin:()=>null,coveredAt:()=>null,covered(){},code:()=>null},Ve=50,qe=300,Je=()=>{try{return new URLSearchParams(location.search).get("hp_debug")==="onsite"}catch{return!1}};function Ee(e,s={}){if(typeof window>"u"||typeof document>"u")return null;if(window[F])return window[F];let n=typeof e?.[_e]=="function"?e[_e]():null;if(!n)return console.warn("[hp] onsite: startOnsite needs the client bootstrap or createAnalytics made"),null;let r=s.settings??n.settings??{},d=oe(n,{...s,challenge:r.capture?.challenge}),o=n.preview?Ae:re(n.storageKey,n.personalisation),l=new Map,p=()=>window[Se]?.size>0,i=(t,a)=>{for(let f of window[Ge]?.[t]??[])try{f(a)}catch(h){console.warn(`[hp] onsite ${t} listener failed:`,h)}},c=we(window),u=n.debug||s.debug===!0||Je(),w=new Map,b=new Map,A=[];for(let t of Array.isArray(r.forms)?r.forms:[]){let a=fe(t);a?A.push(a):w.set(String(t?.slot??`form ${w.size+1}`),{slot:String(t?.slot??""),state:"invalid",reasons:["not a form this SDK can show"]})}let _=new Map,W=new Map,x=null,Z=new Set,ve=t=>{for(let a of _.keys()){let f=l.get(a);if(!t||!f||f.modal?.())return a}return null},j=[],H=Number.isInteger(r.overlay_gap_minutes)?r.overlay_gap_minutes:0,xe=()=>{let t=o.coveredAt();if(!(H>0)||typeof t!="number")return null;let a=Math.max(0,Math.floor((Date.now()-t)/6e4));return a<H?`a popup showed ${a} min ago; ${H} min between them`:null},C=new Set,U=new Map,g=(t,a,f=[])=>(w.set(t.slot,{slot:t.slot,format:t.format,trigger:t.trigger.type,priority:t.priority,state:a,reasons:f}),u&&console.info(`[hp] onsite ${t.slot}: ${a}${f.length?` (${f.join("; ")})`:""}`),a),Te=()=>{try{let t=s.audiences?.();return Array.isArray(t)?t:null}catch{return null}},Q=t=>({path:location.pathname,device:c,now:Date.now(),seen:o.seen(t.slot),subscribed:o.subscribed()||s.subscribed?.()===!0,personalisation:n.personalisation(),preview:!!n.preview,audiences:Te()}),z=t=>{b.get(t.slot)?.(),b.delete(t.slot)};function R(t,a,f=!1,h=L(t)){return l.has(t.slot)?Promise.resolve("shown"):(W.has(t.slot)||W.set(t.slot,Ie(t,a,f,h).finally(()=>W.delete(t.slot))),W.get(t.slot))}async function Ie(t,a,f,h){if(p())return g(t,"not shown",[`suppressed: ${[...window[Se]].join(", ")}`]);let T=J(t,{...Q(t),...f?{seen:Ae.seen()}:{},asked:h});if(T.length)return g(t,"not eligible",T);let E=pe(t.format)&&!f,K=E&&!h&&xe();if(K)return g(t,"not shown",[K]);if(E&&!n.preview&&n.consentAnswered?.()===!1)return U.set(t,h),g(t,"not shown",["waiting for the consent banner"]);let v=q(t.format),k=v&&ve(h);if(k)return g(t,"not shown",[`${k} is showing`]);if(v&&x&&!h)return g(t,"not shown",[`${x} already showed on this page view`]);let I=null;if(!v){try{I=document.querySelector(t.trigger.selector??"")}catch{I=null}if(!I)return g(t,"not shown",["no element matches its selector"])}v&&_.set(t.slot,t),z(t),g(t,"asking for a decision",[a]);let Pe=le().catch(m=>(console.warn("[hp] onsite renderer not loaded:",m?.message??m),null)),$=await d.decide(t.slot,o.pin(t.slot)),y=$.status===200?$.body?.decisions?.find(m=>m?.slot===t.slot):null;y?.experiment&&y.arm&&y.split&&o.pin(t.slot,[y.experiment,y.arm,y.split]);let M=y&&y.holdout!==!0?he(y.payload):null,te=M?.steps[0].blocks??[],ne=y?.offer?.code??(n.preview?"PREVIEW":o.code()),Oe=n.basketValue?.()??null,B=te.some(m=>m?.t==="code")&&!ne&&"no code to remind of"||te.some(m=>m?.t==="progress")&&!(Oe>0)&&"the basket is empty";if(B)return _.delete(t.slot),B==="the basket is empty"&&C.add(t),g(t,"not shown",[B]);if(C.delete(t),!M)return y?.holdout===!0&&n.analytics()&&e.recordExposure($.body),_.delete(t.slot),v&&y?.holdout===!0&&(x??(x=t.slot)),y?.holdout===!0&&!h&&i("held",{slot:t.slot,arm:y.arm??null,format:t.format}),g(t,y?.holdout===!0?"held out":"no decision",[$.status===200?"no creative for this visitor":`decisions answered ${$.status}`]);let G=await Pe;if(!G)return _.delete(t.slot),g(t,"not shown",["the renderer did not load"]);if(await Promise.race([G.warm?.(t,M,M.steps[0].id,Z),new Promise(m=>setTimeout(m,qe))]),p())return _.delete(t.slot),g(t,"not shown",["suppressed"]);f||o.shown(t.slot),E&&o.covered(),v&&(x??(x=t.slot));let V=(m,Re={})=>i(m,{slot:t.slot,arm:y.arm??null,format:M.format??t.format,...Re}),Ce=G.mountForm({form:t,creative:M,decision:y,access:n,client:e,api:d,counters:o,loadWheel:be,loadAnswers:se,container:I,warmed:Z,coupon:ne,basket:()=>n.basketValue?.()??null,emit:V,onClose(m){l.delete(t.slot),_.delete(t.slot),g(t,"closed",[m]),V("closed",{reason:m})}});return l.set(t.slot,Ce),n.analytics()&&e.recordExposure($.body),g(t,"shown",[a]),V("shown"),"shown"}function X(t,a,f=L(t)){if(!q(t.format))return R(t,a,!1,f);j.push([t,a,f]),!(j.length>1)&&setTimeout(async()=>{let h=j.sort(([T],[E])=>ge(T,E));j=[];for(let[T,[E,K,v]]of h.entries()){let k=await R(E,K,!1,v);if(k==="shown"||k==="held out"){for(let[I]of h.slice(T+1))g(I,"not shown",[`${E.slot} has a higher priority`]);return}}},Ve)}for(let t of A){if(t.format==="teaser"&&o.tabOut(t.slot)){R(t,"tab kept from an earlier page",!0);continue}let a=J(t,Q(t));if(a.length){g(t,"not eligible",a);continue}let f=t.trigger.type;f==="manual"?g(t,"waiting for hp.onsite.open"):f==="inline"||t.format==="inline"?R(t,"inline"):ee(t)}function ee(t){z(t),b.set(t.slot,me(t.trigger,a=>{z(t),X(t,a)},{device:c})),g(t,"armed",[`${t.trigger.type} on ${c}`])}let $e=n.onConsentAnswered?.(()=>{let t=[...U];U.clear();for(let[a,f]of t)l.has(a.slot)||(f?X(a,"manual",f):ee(a))}),Me=n.onBasket?.(()=>{if(!((n.basketValue?.()??0)>0))return;let t=[...C];C.clear();for(let a of t)l.has(a.slot)||X(a,"the basket changed")}),N=Object.freeze({open(t){let a=A.find(h=>h.slot===t),f=a??A.find(h=>h.aliases.includes(t));return f?l.has(f.slot)?Promise.resolve(!0):R(f,"manual",!1,L(f)||!a).then(h=>h==="shown"):Promise.resolve(!1)},suppress(){for(let[t,a]of l){a.destroy(),l.delete(t),_.delete(t);let f=A.find(h=>h.slot===t);f&&g(f,"closed",["suppressed"])}},debug:()=>[...w.values()].map(t=>({...t,reasons:[...t.reasons]})),stop(){for(let t of b.values())t();b.clear(),Me?.(),$e?.(),C.clear(),U.clear(),window[F]===N&&delete window[F]}});window[F]=N;for(let{slot:t,resolve:a}of window[Be]?.splice(0)??[])a(N.open(t));return u&&console.table?.(N.debug()),N}window[Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.module")]={startOnsite:Ee};})();
|
package/dist/snippet.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{(()=>{let e=window.hp=window.hp||[];if(!(e.initialized||e.invoked)){e.invoked=!0,e.methods=["track","page","identify","reset","flush","productViewed","productListViewed","recommendationsViewed","personalisationExposed","recordExposure","surfaceViewed","productClicked","productListFiltered","productsSearched","searchSuggestionsViewed","productAdded","productRemoved","cartUpdated","identityLinked","slotEngaged","productVariantSelected","cartViewed","productAddedToWishlist","productRemovedFromWishlist","wishlistProductAddedToCart","productShared","cartShared","couponEntered","couponApplied","couponDenied","couponRemoved","checkoutStarted","promotionViewed","promotionClicked","checkoutStepViewed","checkoutStepCompleted","paymentInfoEntered","checkoutFailed","signedIn","signedUp","signedOut","newsletterSubscribed","newsletterUnsubscribed","backInStockSubscribed","productReviewed","consentUpdated"],e.factory=t=>(...o)=>(e.push([t,...o]),e);for(let t of e.methods)e[t]=e.factory(t);e.servingHeaders=()=>({}),e.inHoldout=()=>!0,e.personalisationGroup=()=>"excluded",e.recommendationContext=()=>({}),e.load=(t,o,r)=>{e._config=t,e._options=o||{};let d=document.createElement("script");d.async=!0,d.src=r;let i=document.getElementsByTagName("script")[0];i.parentNode.insertBefore(d,i)},e.SNIPPET_VERSION="1",e.load({writeKey:"hp_pk_live_REPLACE_ME",apiHost:"https://api.example.com"},{consent:{provider:"onetrust"},identityCookies:{sessionId:"session_id"}},"https://cdn.jsdelivr.net/npm/@thg-agentic/hyper-personalisation-web@3/dist/hp.min.js")}})();})();
|
|
1
|
+
(()=>{(()=>{let e=window.hp=window.hp||[];if(!(e.initialized||e.invoked)){e.invoked=!0,e.methods=["track","page","identify","reset","flush","productViewed","productListViewed","recommendationsViewed","personalisationExposed","recordExposure","surfaceViewed","productClicked","productListFiltered","productsSearched","searchSuggestionsViewed","productAdded","productRemoved","cartUpdated","identityLinked","slotEngaged","productVariantSelected","cartViewed","productAddedToWishlist","productRemovedFromWishlist","wishlistProductAddedToCart","productShared","cartShared","couponEntered","couponApplied","couponDenied","couponRemoved","checkoutStarted","promotionViewed","promotionClicked","checkoutStepViewed","checkoutStepCompleted","paymentInfoEntered","checkoutFailed","signedIn","signedUp","signedOut","newsletterSubscribed","newsletterUnsubscribed","preferencesStated","backInStockSubscribed","productReviewed","consentUpdated"],e.factory=t=>(...o)=>(e.push([t,...o]),e);for(let t of e.methods)e[t]=e.factory(t);e.servingHeaders=()=>({}),e.inHoldout=()=>!0,e.personalisationGroup=()=>"excluded",e.recommendationContext=()=>({}),e.load=(t,o,r)=>{e._config=t,e._options=o||{};let d=document.createElement("script");d.async=!0,d.src=r;let i=document.getElementsByTagName("script")[0];i.parentNode.insertBefore(d,i)},e.SNIPPET_VERSION="1",e.load({writeKey:"hp_pk_live_REPLACE_ME",apiHost:"https://api.example.com"},{consent:{provider:"onetrust"},identityCookies:{sessionId:"session_id"}},"https://cdn.jsdelivr.net/npm/@thg-agentic/hyper-personalisation-web@3/dist/hp.min.js")}})();})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thg-agentic/hyper-personalisation-web",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.24.0",
|
|
4
4
|
"description": "Browser SDK for the THG Hyper-Personalisation event specification: event tracking from a write key and remote settings, strict CMP-agnostic consent, a GA4 dataLayer bridge and in-session audience evaluation. Dependency-free ESM on the Segment wire protocol, a CDN script (dist/hp.min.js), and an optional @segment/analytics-next plugin path.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -36,6 +36,18 @@
|
|
|
36
36
|
"types": "./types/auto.d.ts",
|
|
37
37
|
"default": "./src/auto.js"
|
|
38
38
|
},
|
|
39
|
+
"./onsite": {
|
|
40
|
+
"types": "./types/onsite.d.ts",
|
|
41
|
+
"default": "./src/onsite/index.js"
|
|
42
|
+
},
|
|
43
|
+
"./onsite/wheel": {
|
|
44
|
+
"types": "./types/onsite-wheel.d.ts",
|
|
45
|
+
"default": "./src/onsite/wheel.js"
|
|
46
|
+
},
|
|
47
|
+
"./onsite/preview": {
|
|
48
|
+
"types": "./types/onsite-preview.d.ts",
|
|
49
|
+
"default": "./src/onsite/preview.js"
|
|
50
|
+
},
|
|
39
51
|
"./session": "./src/session.js",
|
|
40
52
|
"./experiments": "./src/experiments.js",
|
|
41
53
|
"./conformance": "./src/conformance.js"
|
|
@@ -44,7 +56,11 @@
|
|
|
44
56
|
"src/",
|
|
45
57
|
"types/**/*.d.ts",
|
|
46
58
|
"dist/hp.min.js",
|
|
47
|
-
"dist/snippet.min.js"
|
|
59
|
+
"dist/snippet.min.js",
|
|
60
|
+
"dist/onsite.min.js",
|
|
61
|
+
"dist/onsite-render.min.js",
|
|
62
|
+
"dist/onsite-wheel.min.js",
|
|
63
|
+
"dist/onsite-answers.min.js"
|
|
48
64
|
],
|
|
49
65
|
"sideEffects": false,
|
|
50
66
|
"license": "MIT",
|
|
@@ -74,7 +90,7 @@
|
|
|
74
90
|
"esbuild": "^0.28.2",
|
|
75
91
|
"jsdom": "^30.1.1",
|
|
76
92
|
"typescript": "^7.0.2",
|
|
77
|
-
"@thg-agentic/hyper-personalisation-spec": "1.
|
|
93
|
+
"@thg-agentic/hyper-personalisation-spec": "1.18.0"
|
|
78
94
|
},
|
|
79
95
|
"scripts": {
|
|
80
96
|
"test": "node --test tests/*.test.mjs",
|
package/src/bootstrap.js
CHANGED
|
@@ -44,6 +44,8 @@ import { sessionDebug } from './debug.js';
|
|
|
44
44
|
import { guard } from './guard.js';
|
|
45
45
|
import { IDENTITY_OPTION } from './identity-option.js';
|
|
46
46
|
import { createAnalytics, normaliseSha256, PAGE_TYPES } from './index.js';
|
|
47
|
+
import { dropPendingOpens, onsite } from './onsite-facade.js';
|
|
48
|
+
import { loadOnsite } from './onsite-loader.js';
|
|
47
49
|
import {
|
|
48
50
|
cachedSettings,
|
|
49
51
|
cacheSettings,
|
|
@@ -134,6 +136,12 @@ export function validateConfig(config, options = {}) {
|
|
|
134
136
|
problems.push(
|
|
135
137
|
'autocapture must be false or { promotions, productLists, recommendations }',
|
|
136
138
|
);
|
|
139
|
+
if (
|
|
140
|
+
options.onsite !== undefined &&
|
|
141
|
+
typeof options.onsite !== 'boolean' &&
|
|
142
|
+
!isObject(options.onsite)
|
|
143
|
+
)
|
|
144
|
+
problems.push('onsite must be true, false or the onsite options');
|
|
137
145
|
if (
|
|
138
146
|
options.beforeSend !== undefined &&
|
|
139
147
|
typeof options.beforeSend !== 'function'
|
|
@@ -312,9 +320,24 @@ function startAutocapture(client, autocapture) {
|
|
|
312
320
|
};
|
|
313
321
|
}
|
|
314
322
|
|
|
323
|
+
/**
|
|
324
|
+
* Onsite forms, only when the page opted in and the settings have a live one: the runtime is a
|
|
325
|
+
* separate chunk, fetched here and never part of the core.
|
|
326
|
+
*/
|
|
327
|
+
function startOnsiteForms(client, opted, settings) {
|
|
328
|
+
if (!opted || !settings.onsite) return dropPendingOpens();
|
|
329
|
+
loadOnsite()
|
|
330
|
+
.then((module) => module.startOnsite(client, opted === true ? {} : opted))
|
|
331
|
+
.catch((err) => {
|
|
332
|
+
dropPendingOpens();
|
|
333
|
+
console.warn('[hp] onsite not started:', err?.message ?? err);
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
|
|
315
337
|
/** This page is off: what `hp` queued on it is dropped rather than carried. */
|
|
316
338
|
function off(carry) {
|
|
317
339
|
carry.close();
|
|
340
|
+
dropPendingOpens();
|
|
318
341
|
return null;
|
|
319
342
|
}
|
|
320
343
|
|
|
@@ -351,7 +374,10 @@ async function start(config, options, carry) {
|
|
|
351
374
|
});
|
|
352
375
|
|
|
353
376
|
// Unreachable, or left before the answer: what `hp` queued goes to the next page.
|
|
354
|
-
if (unreachable)
|
|
377
|
+
if (unreachable) {
|
|
378
|
+
dropPendingOpens();
|
|
379
|
+
return null;
|
|
380
|
+
}
|
|
355
381
|
if (!settings.enabled) {
|
|
356
382
|
if (options.debug)
|
|
357
383
|
console.info(
|
|
@@ -379,6 +405,9 @@ async function start(config, options, carry) {
|
|
|
379
405
|
|
|
380
406
|
const client = createAnalytics({
|
|
381
407
|
apiHost: eventsHost(config.apiHost, settings.apiHost),
|
|
408
|
+
// Serving reads (decisions, offers) go where the page pointed the SDK, else the HP API.
|
|
409
|
+
servingHost: resolveApiHost(config.apiHost),
|
|
410
|
+
onsite: settings.onsite ?? null,
|
|
382
411
|
writeKey,
|
|
383
412
|
propertyId,
|
|
384
413
|
// Known before the first page view, so an event the client sends while starting (the consent
|
|
@@ -486,7 +515,7 @@ async function start(config, options, carry) {
|
|
|
486
515
|
const host = typeof window !== 'undefined' ? window : null;
|
|
487
516
|
// A page restored from the back/forward cache runs no script again, so it would be shown
|
|
488
517
|
// with no page view and no list impressions. It is a back_forward view like any other.
|
|
489
|
-
host?.addEventListener('pageshow', (event) => {
|
|
518
|
+
host?.addEventListener?.('pageshow', (event) => {
|
|
490
519
|
if (event.persisted) client.page({ navigation_trigger: 'back_forward' });
|
|
491
520
|
});
|
|
492
521
|
if (options.dataLayer && host) {
|
|
@@ -505,6 +534,8 @@ async function start(config, options, carry) {
|
|
|
505
534
|
}
|
|
506
535
|
|
|
507
536
|
if (identified) client.identify(identified, undefined, IDENTITY_OPTION);
|
|
537
|
+
client.onsite = onsite;
|
|
538
|
+
startOnsiteForms(client, options.onsite, settings);
|
|
508
539
|
return client;
|
|
509
540
|
} catch (err) {
|
|
510
541
|
console.warn('[hp] not started:', err?.message ?? err);
|
package/src/context.js
CHANGED
|
@@ -370,6 +370,25 @@ export function pageContext(cfg) {
|
|
|
370
370
|
};
|
|
371
371
|
}
|
|
372
372
|
|
|
373
|
+
let zone;
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* The browser's IANA time zone, read once per page. Temporal answers in a fraction of the time: the
|
|
377
|
+
* first DateTimeFormat loads ICU's locale data, about 90 ms of the page's start on a throttled phone.
|
|
378
|
+
*/
|
|
379
|
+
function timeZone() {
|
|
380
|
+
if (zone !== undefined) return zone;
|
|
381
|
+
try {
|
|
382
|
+
zone =
|
|
383
|
+
globalThis.Temporal?.Now?.timeZoneId?.() ||
|
|
384
|
+
Intl.DateTimeFormat().resolvedOptions().timeZone ||
|
|
385
|
+
null;
|
|
386
|
+
} catch {
|
|
387
|
+
zone = null;
|
|
388
|
+
}
|
|
389
|
+
return zone;
|
|
390
|
+
}
|
|
391
|
+
|
|
373
392
|
/**
|
|
374
393
|
* @param {object} cfg resolved SDK config
|
|
375
394
|
* @param {object} [overrides] per-call context overrides
|
|
@@ -401,13 +420,7 @@ export function buildContext(cfg, overrides = {}) {
|
|
|
401
420
|
// The site's locale (which storefront was served), not navigator.language, so it agrees with
|
|
402
421
|
// the backend's for the same render.
|
|
403
422
|
locale: localeTag(perRequest(cfg.getLocale, cfg.locale)),
|
|
404
|
-
timezone: (
|
|
405
|
-
try {
|
|
406
|
-
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
407
|
-
} catch {
|
|
408
|
-
return null;
|
|
409
|
-
}
|
|
410
|
-
})(),
|
|
423
|
+
timezone: timeZone(),
|
|
411
424
|
country: countryCode(cfg.country),
|
|
412
425
|
ship_to_country: countryCode(
|
|
413
426
|
perRequest(cfg.getShipToCountry, cfg.shipToCountry),
|
package/src/ga4.js
CHANGED
|
@@ -38,10 +38,9 @@ const text = (v) => {
|
|
|
38
38
|
return trimmed === '' ? null : trimmed;
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
*/
|
|
41
|
+
// GA4's parent id is `item_group_id` (the Merchant Center attribute GA4 items accept); `item_id`
|
|
42
|
+
// is the purchasable variant. The spec's product_id is the parent, so they cross over.
|
|
43
|
+
|
|
45
44
|
/**
|
|
46
45
|
* The first usable id among candidates: a platform that sends `item_group_id: ''` has sent no
|
|
47
46
|
* parent, and letting the blank win would drop the product rather than fall back to the item.
|
package/src/hp.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* site that never loads the SDK.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
+
import { onsite } from './onsite-facade.js';
|
|
14
15
|
import { keptVisit } from './recommendation-context.js';
|
|
15
16
|
import { uuid } from './shape.js';
|
|
16
17
|
|
|
@@ -129,6 +130,7 @@ export const hp = new Proxy(
|
|
|
129
130
|
if (typeof method !== 'string' || method === 'then') return undefined;
|
|
130
131
|
if (method === 'assignmentDecisionId') return assignmentDecisionId;
|
|
131
132
|
if (method === 'recommendationContext') return recommendationContext;
|
|
133
|
+
if (method === 'onsite') return onsite;
|
|
132
134
|
return (...args) => call(method, args);
|
|
133
135
|
},
|
|
134
136
|
},
|