@uniformdev/context-devtools 16.0.0 → 16.0.1-alpha.164

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 (3) hide show
  1. package/dist/esm/index.js +86 -509
  2. package/dist/index.js +75 -498
  3. package/package.json +20 -16
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var Ft=Object.create;var W=Object.defineProperty;var Bt=Object.getOwnPropertyDescriptor;var Qt=Object.getOwnPropertyNames;var qt=Object.getPrototypeOf,Nt=Object.prototype.hasOwnProperty;var Zt=(t,r)=>{for(var n in r)W(t,n,{get:r[n],enumerable:!0})},Ee=(t,r,n,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of Qt(r))!Nt.call(t,i)&&i!==n&&W(t,i,{get:()=>r[i],enumerable:!(o=Bt(r,i))||o.enumerable});return t};var D=(t,r,n)=>(n=t!=null?Ft(qt(t)):{},Ee(r||!t||!t.__esModule?W(n,"default",{value:t,enumerable:!0}):n,t)),Ut=t=>Ee(W({},"__esModule",{value:!0}),t);var po={};Zt(po,{ContextDevTools:()=>Pe,EmbeddedContextDevTools:()=>Me,ToggleEmbeddedContextDevTools:()=>lo});module.exports=Ut(po);var e=require("@emotion/react"),b=D(require("react"));var x=require("@emotion/react");var Y=require("react"),ze=(0,Y.createContext)({settings:{},saveSettings:()=>null}),J=()=>(0,Y.useContext)(ze),Fe=({children:t,settings:r,saveSettings:n})=>(0,e.jsx)(ze.Provider,{value:{settings:r,saveSettings:n}},t);var _t=({route:t,children:r,className:n})=>{let{settings:o,saveSettings:i}=J();return(0,e.jsx)("a",{href:"",className:n,onClick:a=>{a.preventDefault(),i({...o,route:t})}},r)},B=_t;var Gt=[{title:"Dimensions",href:"/dimensions",icon:`<svg
1
+ var Ht=Object.create;var $=Object.defineProperty;var Mt=Object.getOwnPropertyDescriptor;var At=Object.getOwnPropertyNames;var Et=Object.getPrototypeOf,Bt=Object.prototype.hasOwnProperty;var Qt=(t,r)=>{for(var n in r)$(t,n,{get:r[n],enumerable:!0})},He=(t,r,n,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of At(r))!Bt.call(t,i)&&i!==n&&$(t,i,{get:()=>r[i],enumerable:!(o=Mt(r,i))||o.enumerable});return t};var x=(t,r,n)=>(n=t!=null?Ht(Et(t)):{},He(r||!t||!t.__esModule?$(n,"default",{value:t,enumerable:!0}):n,t)),Ft=t=>He($({},"__esModule",{value:!0}),t);var io={};Qt(io,{ContextDevTools:()=>Re,EmbeddedContextDevTools:()=>Ie,ToggleEmbeddedContextDevTools:()=>no});module.exports=Ft(io);var e=require("@emotion/react"),b=x(require("react"));var S=require("@emotion/react");var K=require("react"),Me=(0,K.createContext)({settings:{},saveSettings:()=>{}}),W=()=>(0,K.useContext)(Me),Ae=({children:t,settings:r,saveSettings:n})=>(0,e.jsx)(Me.Provider,{value:{settings:r,saveSettings:n}},t);var qt=({route:t,children:r,className:n})=>{let{settings:o,saveSettings:i}=W();return(0,e.jsx)("a",{href:"",className:n,onClick:a=>{a.preventDefault(),i({...o,route:t})}},r)},F=qt;var Nt=[{title:"Dimensions",href:"/dimensions",icon:`<svg
2
2
  width="24"
3
3
  height="24"
4
4
  viewBox="0 0 24 24"
@@ -36,28 +36,28 @@ var Ft=Object.create;var W=Object.defineProperty;var Bt=Object.getOwnPropertyDes
36
36
  </svg>`},{title:"Settings",href:"/settings",icon:`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
37
37
  <path d="M19.1469 12.716C19.1986 12.2636 19.201 11.8069 19.1539 11.354L21.7429 9.474C21.8681 9.3822 21.9548 9.24723 21.9862 9.0952C22.0176 8.94316 21.9915 8.78489 21.9129 8.651L19.9939 5.399C19.9182 5.26986 19.7985 5.17231 19.6568 5.1242C19.515 5.07608 19.3606 5.08063 19.2219 5.137L16.3599 6.292C15.9237 5.9578 15.4502 5.67525 14.9489 5.45L14.5739 2.545C14.5547 2.39441 14.4813 2.25598 14.3673 2.15566C14.2534 2.05534 14.1068 1.99999 13.9549 2H10.0859C9.93402 1.99997 9.78728 2.05527 9.67317 2.15558C9.55906 2.25588 9.48539 2.39432 9.46595 2.545L9.09395 5.433C8.63957 5.63249 8.20723 5.87882 7.80395 6.168L5.00895 4.954C4.87173 4.89484 4.71787 4.88672 4.57519 4.9311C4.4325 4.97549 4.3104 5.06945 4.23095 5.196L2.22195 8.398C2.1396 8.52998 2.10934 8.68789 2.13707 8.84096C2.1648 8.99403 2.24854 9.1313 2.37195 9.226L4.86795 11.142C4.83172 11.4266 4.81302 11.7131 4.81195 12C4.81195 12.18 4.82095 12.362 4.83795 12.558L2.26495 14.375C2.13766 14.4647 2.04844 14.5987 2.01478 14.7508C1.98112 14.9028 2.00543 15.0619 2.08295 15.197L3.95695 18.474C4.11095 18.742 4.43695 18.857 4.72595 18.746L7.56095 17.644C8.00795 17.997 8.49195 18.294 9.00795 18.53L9.33795 21.396C9.37495 21.709 9.63795 21.946 9.95195 21.95L13.8169 22H13.8249C14.1349 22 14.3989 21.771 14.4439 21.463L14.8549 18.59C15.3703 18.3674 15.8579 18.0855 16.3079 17.75L19.1279 18.93C19.4129 19.05 19.7419 18.944 19.9029 18.679L21.8669 15.452C21.9477 15.319 21.976 15.1608 21.9464 15.0081C21.9168 14.8554 21.8315 14.7192 21.7069 14.626L19.1469 12.716ZM11.9999 15C10.3459 15 8.99995 13.655 8.99995 12C8.99995 10.346 10.3449 9 11.9999 9C13.6539 9 14.9999 10.345 14.9999 12C14.9999 13.654 13.6539 15 11.9999 15Z" fill="white"/>
38
38
  </svg>
39
- `}],$t=`<svg width="24" height="24" fill="white" viewBox="0 0 122.88 116.67" xmlns="http://www.w3.org/2000/svg">
39
+ `}],Zt=`<svg width="24" height="24" fill="white" viewBox="0 0 122.88 116.67" xmlns="http://www.w3.org/2000/svg">
40
40
  <g>
41
41
  <path d="M84.55,116.66c2.49,0,4.53-1.99,4.53-4.41V88.08c1.55-13.03,7.27-9.16,14-5.13 c16.27,9.74,27.08-15.88,13.93-23.78c-10.32-6.2-14.79,4.46-22.35,3.36c-2.92-0.43-4.95-3.5-5.59-8.17V36.9 c0-2.43-2.04-4.41-4.53-4.41H63.73c-17.18-2.12-1.93-11.37-1.93-19.98C61.81,5.6,55.38,0,47.45,0c-7.92,0-15.19,5.6-15.19,12.51 c0,8.12,15.78,17.86-1.64,19.98H4.53C2.04,32.49,0,34.47,0,36.9v17.42c1.33,7.43,6.49,9.15,13.1,4.25 c2.23-1.66,5.99-3.59,8.71-3.59c7.09,0,12.85,6.25,12.85,13.96S28.91,84.6,21.81,84.6c-2.53,0-4.89-0.8-6.89-2.19 c0,0.59-12.4-10.85-14.92,3.15v26.71c0,2.43,2.04,4.41,4.53,4.41c13.97,0,27.92,0,41.88-0.01c0.55-2.55-1.24-5.47-2.92-8 c-13.22-19.93,38.21-21.92,24.99,0.62c-0.65,1.11-1.3,2.19-1.8,3.24c-0.63,1.31-1.05,2.91-0.96,4.14L84.55,116.66L84.55,116.66z"></path>
42
42
  </g>
43
- </svg>`,Be=({...t})=>{var o,i;let r=a=>{var p;let l="active";return!((p=t.settings)!=null&&p.route)&&a==="/dimensions"||t.settings.route===a?l:""},n=Boolean(typeof window!="undefined"&&((i=(o=window.chrome)==null?void 0:o.runtime)==null?void 0:i.id));return(0,e.jsx)("nav",{css:x.css`
43
+ </svg>`,Ee=({...t})=>{var o,i;let r=a=>{var p;let l="active";return!((p=t.settings)!=null&&p.route)&&a==="/dimensions"||t.settings.route===a?l:""},n=Boolean(typeof window!="undefined"&&((i=(o=window.chrome)==null?void 0:o.runtime)==null?void 0:i.id));return(0,e.jsx)("nav",{css:S.css`
44
44
  background: var(--brand-secondary-1);
45
45
  padding: var(--spacing-base);
46
46
  min-width: 200px;
47
47
  display: flex;
48
48
  flex-direction: column;
49
- `},(0,e.jsx)("a",{css:x.css`
49
+ `},(0,e.jsx)("a",{css:S.css`
50
50
  flex-grow: 0;
51
51
  display: inline-block;
52
52
  margin: 0 var(--spacing-base);
53
- `,href:"https://uniform.dev/"},(0,e.jsx)("svg",{css:{display:"block"},width:"120",height:"38",viewBox:"0 0 120 38",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,e.jsx)("g",{clipPath:"url(#clip0_41_612)"},(0,e.jsx)("path",{d:"M8.82261 3.73315L0 8.82209V18.9999L8.82261 13.911L17.6474 8.82209L8.82261 3.73315Z",fill:"#83C6E1"}),(0,e.jsx)("path",{d:"M8.82261 24.089V13.9111L0 19.0001V29.1779L8.82261 34.2669L17.6474 29.1779V19.0001L8.82261 24.089Z",fill:"#438FD5"}),(0,e.jsx)("path",{d:"M17.6474 8.82202L8.82263 13.911L17.6474 18.9999V29.1777L26.47 24.0888V13.911L17.6474 8.82202Z",fill:"#F4220B"}),(0,e.jsx)("path",{d:"M64.6069 13.9025H67.8036V25.5528H64.6069V13.9025ZM64.4902 8.5415H67.9181V11.7348H64.4902V8.5415ZM72.5153 10.1025V13.9025H70.3691V16.6272H72.5153V25.5528H75.7119V16.6272H78.2774V13.9025H75.7119V11.2684H78.2774V8.5415H75.2213L72.5153 10.1025ZM83.1059 13.7859L80.3999 15.3469V24.1084L83.1059 25.6694H88.0748L90.7808 24.1084V15.3469L88.0748 13.7859H83.1059ZM87.5842 22.9425H83.5943V16.5106H87.5842V22.9425ZM97.4723 14.8611L95.8103 13.9025H94.2779V25.5528H97.4745V16.6272H101.486V13.9025H99.1344L97.4723 14.8611ZM55.713 13.7859L53.8499 14.8611L51.9847 13.7859H50.7289V25.5528H53.9256V16.5106H57.9133V25.5528H61.1099V15.3469L58.4039 13.7859H55.713ZM44.0353 22.9425H40.0454V13.9025H36.851V24.1084L39.557 25.6694H42.3753L44.0309 24.7129L44.0331 24.7151L44.0353 24.7129V24.7151L45.6887 25.6694H47.2297V13.9025H44.0353V22.9425ZM117.51 13.7859H115.271L113.079 15.0425L110.909 13.7859H108.67L107.015 14.7402L105.359 13.7859H103.818V25.5528H107.015V16.5106H110.421V25.5528H113.615V16.5106H117.022V25.5528H120.216V15.3469L117.51 13.7859Z",fill:"white"})),(0,e.jsx)("defs",null,(0,e.jsx)("clipPath",{id:"clip0_41_612"},(0,e.jsx)("rect",{width:"120",height:"38",fill:"white"}))))),(0,e.jsx)("ul",{css:x.css`
53
+ `,href:"https://uniform.dev/"},(0,e.jsx)("svg",{css:{display:"block"},width:"120",height:"38",viewBox:"0 0 120 38",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,e.jsx)("g",{clipPath:"url(#clip0_41_612)"},(0,e.jsx)("path",{d:"M8.82261 3.73315L0 8.82209V18.9999L8.82261 13.911L17.6474 8.82209L8.82261 3.73315Z",fill:"#83C6E1"}),(0,e.jsx)("path",{d:"M8.82261 24.089V13.9111L0 19.0001V29.1779L8.82261 34.2669L17.6474 29.1779V19.0001L8.82261 24.089Z",fill:"#438FD5"}),(0,e.jsx)("path",{d:"M17.6474 8.82202L8.82263 13.911L17.6474 18.9999V29.1777L26.47 24.0888V13.911L17.6474 8.82202Z",fill:"#F4220B"}),(0,e.jsx)("path",{d:"M64.6069 13.9025H67.8036V25.5528H64.6069V13.9025ZM64.4902 8.5415H67.9181V11.7348H64.4902V8.5415ZM72.5153 10.1025V13.9025H70.3691V16.6272H72.5153V25.5528H75.7119V16.6272H78.2774V13.9025H75.7119V11.2684H78.2774V8.5415H75.2213L72.5153 10.1025ZM83.1059 13.7859L80.3999 15.3469V24.1084L83.1059 25.6694H88.0748L90.7808 24.1084V15.3469L88.0748 13.7859H83.1059ZM87.5842 22.9425H83.5943V16.5106H87.5842V22.9425ZM97.4723 14.8611L95.8103 13.9025H94.2779V25.5528H97.4745V16.6272H101.486V13.9025H99.1344L97.4723 14.8611ZM55.713 13.7859L53.8499 14.8611L51.9847 13.7859H50.7289V25.5528H53.9256V16.5106H57.9133V25.5528H61.1099V15.3469L58.4039 13.7859H55.713ZM44.0353 22.9425H40.0454V13.9025H36.851V24.1084L39.557 25.6694H42.3753L44.0309 24.7129L44.0331 24.7151L44.0353 24.7129V24.7151L45.6887 25.6694H47.2297V13.9025H44.0353V22.9425ZM117.51 13.7859H115.271L113.079 15.0425L110.909 13.7859H108.67L107.015 14.7402L105.359 13.7859H103.818V25.5528H107.015V16.5106H110.421V25.5528H113.615V16.5106H117.022V25.5528H120.216V15.3469L117.51 13.7859Z",fill:"white"})),(0,e.jsx)("defs",null,(0,e.jsx)("clipPath",{id:"clip0_41_612"},(0,e.jsx)("rect",{width:"120",height:"38",fill:"white"}))))),(0,e.jsx)("ul",{css:S.css`
54
54
  display: flex;
55
55
  flex-flow: column nowrap;
56
56
  padding: 0;
57
57
  margin: 0;
58
58
  list-style-type: none;
59
59
  flex-grow: 1;
60
- `},Gt.map((a,l)=>{var m,u,s,c;let p=0;return a.href==="/overrides"&&Object.keys((m=t.settings.scoreOverrides)!=null?m:{}).length>0&&(p=Object.keys((u=t.settings.scoreOverrides)!=null?u:{}).length),a.href==="/quirks"&&Object.keys((s=t.settings.quirkOverrides)!=null?s:{}).length>0&&(p=Object.keys((c=t.settings.quirkOverrides)!=null?c:{}).length),(0,e.jsx)("li",{css:x.css`
60
+ `},Nt.map((a,l)=>{var m,u,s,d;let p=0;return a.href==="/overrides"&&Object.keys((m=t.settings.scoreOverrides)!=null?m:{}).length>0&&(p=Object.keys((u=t.settings.scoreOverrides)!=null?u:{}).length),a.href==="/quirks"&&Object.keys((s=t.settings.quirkOverrides)!=null?s:{}).length>0&&(p=Object.keys((d=t.settings.quirkOverrides)!=null?d:{}).length),(0,e.jsx)("li",{css:S.css`
61
61
  padding: 0;
62
62
  margin: 0;
63
63
  list-style-type: none;
@@ -65,7 +65,7 @@ var Ft=Object.create;var W=Object.defineProperty;var Bt=Object.getOwnPropertyDes
65
65
  &:last-of-type {
66
66
  margin-top: auto;
67
67
  }
68
- `,key:l},(0,e.jsx)(B,{css:x.css`
68
+ `,key:l},(0,e.jsx)(F,{css:S.css`
69
69
  align-items: center;
70
70
  border-radius: var(--rounded-base);
71
71
  display: flex;
@@ -79,11 +79,11 @@ var Ft=Object.create;var W=Object.defineProperty;var Bt=Object.getOwnPropertyDes
79
79
  &.active {
80
80
  background: var(--gray-700);
81
81
  }
82
- `,className:r(a.href),route:a.href},(0,e.jsx)("i",{css:x.css`
82
+ `,className:r(a.href),route:a.href},(0,e.jsx)("i",{css:S.css`
83
83
  align-items: center;
84
84
  display: flex;
85
- `,dangerouslySetInnerHTML:{__html:a.icon}}),a.title,p?(0,e.jsx)("span",{css:x.css`
86
- font-size: var(--font-xxs);
85
+ `,dangerouslySetInnerHTML:{__html:a.icon}}),a.title,p?(0,e.jsx)("span",{css:S.css`
86
+ font-size: var(--fs-xxs);
87
87
  display: inline-block;
88
88
  width: 12px;
89
89
  height: 12px;
@@ -91,11 +91,11 @@ var Ft=Object.create;var W=Object.defineProperty;var Bt=Object.getOwnPropertyDes
91
91
  background-color: var(--red-tooltip);
92
92
  text-align: center;
93
93
  line-height: 12px;
94
- `},p):null))})),!n&&(0,e.jsx)("a",{target:"_blank",href:"https://chrome.google.com/webstore/detail/uniform-context/dcmlokofjljnfjcknpmhjocogllfbhkg",css:x.css`
94
+ `},p):null))})),!n&&(0,e.jsx)("a",{target:"_blank",href:"https://chrome.google.com/webstore/detail/uniform-context/dcmlokofjljnfjcknpmhjocogllfbhkg",css:S.css`
95
95
  align-items: center;
96
96
  border-radius: var(--rounded-base);
97
97
  display: flex;
98
- font-size: var(--font-sm);
98
+ font-size: var(--fs-sm);
99
99
  color: var(--white);
100
100
  gap: var(--spacing-sm);
101
101
  padding: var(--spacing-sm) var(--spacing-base);
@@ -106,14 +106,14 @@ var Ft=Object.create;var W=Object.defineProperty;var Bt=Object.getOwnPropertyDes
106
106
  &.active {
107
107
  background: var(--gray-700);
108
108
  }
109
- `,rel:"noreferrer"},(0,e.jsx)("i",{css:x.css`
109
+ `,rel:"noreferrer"},(0,e.jsx)("i",{css:S.css`
110
110
  align-items: center;
111
111
  display: flex;
112
- `,dangerouslySetInnerHTML:{__html:$t}}),"Install Chrome Extension"))};var Qe=()=>(0,e.jsx)("article",null,(0,e.jsx)("h1",null,"Something when wrong"),(0,e.jsx)("p",null,"We could not find the page you're looking for."));var pe=D(require("react"));var H=require("@emotion/react"),X=D(require("react")),qe=(0,H.css)({willChange:"height"}),Kt=H.css`
112
+ `,dangerouslySetInnerHTML:{__html:Zt}}),"Install Chrome Extension"))};var Be=()=>(0,e.jsx)("article",null,(0,e.jsx)("h1",null,"Something when wrong"),(0,e.jsx)("p",null,"We could not find the page you're looking for."));var ce=x(require("react"));var H=require("@emotion/react"),Y=x(require("react")),Qe=(0,H.css)({willChange:"height"}),zt=H.css`
113
113
  border-bottom: 2px solid var(--brand-secondary-1);
114
- font-size: var(--font-base);
114
+ font-size: var(--fs-base);
115
115
  margin: 0;
116
- `,Wt=H.css`
116
+ `,Ut=H.css`
117
117
  align-items: center;
118
118
  border: none;
119
119
  background: none;
@@ -121,15 +121,15 @@ var Ft=Object.create;var W=Object.defineProperty;var Bt=Object.getOwnPropertyDes
121
121
  display: flex;
122
122
  width: 100%;
123
123
  padding: var(--spacing-sm) 0;
124
- font-weight: var(--font-bold);
124
+ font-weight: var(--fw-bold);
125
125
  justify-content: space-between;
126
- `,Yt=H.css`
126
+ `,_t=H.css`
127
127
  align-self: center;
128
- `,Jt=H.css`
128
+ `,Gt=H.css`
129
129
  transform: rotate(-180deg);
130
- `,j=({children:t})=>(0,e.jsx)("div",{css:[qe]},t),ee=({title:t,children:r})=>{let[n,o]=X.useState(!1),i=t.split(" ").join("-").toLocaleLowerCase();return(0,e.jsx)(X.Fragment,null,(0,e.jsx)("h3",{css:Kt},(0,e.jsx)("button",{"aria-expanded":n,css:Wt,title:t,id:i,"aria-controls":`${i}-section`,onClick:()=>o(a=>!a),type:"button"},t,(0,e.jsx)("i",{css:[Yt,n?Jt:void 0]},(0,e.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,e.jsx)("path",{d:"M6.34317 7.75732L4.92896 9.17154L12 16.2426L19.0711 9.17157L17.6569 7.75735L12 13.4142L6.34317 7.75732Z",fill:"currentColor"}))))),(0,e.jsx)("div",{id:`${i}-section`,css:[qe,H.css`
130
+ `,J=({children:t})=>(0,e.jsx)("div",{css:[Qe]},t),X=({title:t,children:r})=>{let[n,o]=Y.useState(!1),i=t.split(" ").join("-").toLocaleLowerCase();return(0,e.jsx)(Y.Fragment,null,(0,e.jsx)("h3",{css:zt},(0,e.jsx)("button",{"aria-expanded":n,css:Ut,title:t,id:i,"aria-controls":`${i}-section`,onClick:()=>o(a=>!a),type:"button"},t,(0,e.jsx)("i",{css:[_t,n?Gt:void 0]},(0,e.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,e.jsx)("path",{d:"M6.34317 7.75732L4.92896 9.17154L12 16.2426L19.0711 9.17157L17.6569 7.75735L12 13.4142L6.34317 7.75732Z",fill:"currentColor"}))))),(0,e.jsx)("div",{id:`${i}-section`,css:[Qe,H.css`
131
131
  padding: var(--spacing-sm) 0;
132
- `],role:"region","aria-labelledby":i},n?r:null))};var M=require("@emotion/react"),te=M.css`
132
+ `],role:"region","aria-labelledby":i},n?r:null))};var M=require("@emotion/react"),j=M.css`
133
133
  background-color: var(--gray-100);
134
134
  padding: var(--spacing-base) var(--spacing-md);
135
135
  margin: var(--spacing-base) 0;
@@ -137,21 +137,21 @@ var Ft=Object.create;var W=Object.defineProperty;var Bt=Object.getOwnPropertyDes
137
137
  &:first-of-type {
138
138
  margin: 0 0 var(--spacing-base);
139
139
  }
140
- `,Ne=M.css`
140
+ `,Fe=M.css`
141
141
  background: var(--gray-100)
142
142
  url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%0A%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M9 2C8.44771 2 8 2.44772 8 3V5C8 5.55228 8.44771 6 9 6C9.55229 6 10 5.55228 10 5V3C10 2.44772 9.55229 2 9 2ZM8 9H16V11C16 13.2091 14.2091 15 12 15C9.79086 15 8 13.2091 8 11V9ZM13 16.917C15.8377 16.441 18 13.973 18 11V7H6V11C6 13.973 8.16229 16.441 11 16.917V22C11 22.5523 11.4477 23 12 23C12.5523 23 13 22.5523 13 22V16.917ZM14 3C14 2.44772 14.4477 2 15 2C15.5523 2 16 2.44772 16 3V5C16 5.55228 15.5523 6 15 6C14.4477 6 14 5.55228 14 5V3Z' fill='%232ecdb4' /%3E%3C/svg%3E")
143
143
  no-repeat var(--spacing-sm) var(--spacing-base);
144
144
  padding: var(--spacing-base) var(--spacing-xl);
145
- `,oe=M.css`
145
+ `,ee=M.css`
146
146
  color: var(--brand-secondary-1);
147
147
  margin: 0;
148
- font-size: var(--font-base);
149
- font-weight: var(--font-bold);
150
- `,re=M.css`
148
+ font-size: var(--fs-base);
149
+ font-weight: var(--fw-bold);
150
+ `,te=M.css`
151
151
  color: var(--brand-secondary-1);
152
152
  margin: var(--spacing-xs) 0 0;
153
- font-size: var(--font-sm);
154
- `,Ze=M.css`
153
+ font-size: var(--fs-sm);
154
+ `,qe=M.css`
155
155
  align-items: center;
156
156
  border: none;
157
157
  background: transparent
@@ -171,11 +171,11 @@ var Ft=Object.create;var W=Object.defineProperty;var Bt=Object.getOwnPropertyDes
171
171
  &:hover {
172
172
  opacity: 0.6;
173
173
  }
174
- `,ne=M.css`
174
+ `,oe=M.css`
175
175
  display: flex;
176
176
  margin: var(--spacing-sm) 0 0;
177
177
  gap: var(--spacing-base);
178
- `;var Q=({title:t,text:r,buttonGroup:n,children:o})=>(0,e.jsx)("div",{css:te},(0,e.jsx)("h2",{css:oe},t),(0,e.jsx)("p",{css:re},r),o,n?(0,e.jsx)("div",{css:ne},n):null);var k=require("@emotion/react"),Xt=k.keyframes`from {
178
+ `;var q=({title:t,text:r,buttonGroup:n,children:o})=>(0,e.jsx)("div",{css:j},(0,e.jsx)("h2",{css:ee},t),(0,e.jsx)("p",{css:te},r),o,n?(0,e.jsx)("div",{css:oe},n):null);var k=require("@emotion/react"),$t=k.keyframes`from {
179
179
  transform: scale(1);
180
180
  }
181
181
  to {
@@ -187,15 +187,15 @@ to {
187
187
  margin: var(--spacing-sm) 0;
188
188
  `,reset:k.css`
189
189
  margin: 0 var(--spacing-md);
190
- font-size: var(--font-sm);
190
+ font-size: var(--fs-sm);
191
191
  color: var(--gray-500);
192
192
  `,title:k.css`
193
193
  margin: 0 0 var(--spacing-sm);
194
- font-size: var(--font-md);
194
+ font-size: var(--fs-md);
195
195
  & > small {
196
196
  display: block;
197
- font-size: var(--font-xs);
198
- font-weight: var(--font-regular);
197
+ font-size: var(--fs-xs);
198
+ font-weight: var(--fw-regular);
199
199
  margin: var(--spacing-xxs) 0 0;
200
200
  }
201
201
  `,headingGroup:k.css`
@@ -215,7 +215,7 @@ to {
215
215
  position: absolute;
216
216
  right: var(--spacing-base);
217
217
  bottom: var(--spacing-base);
218
- animation: 0.5s 2 alternate ${Xt};
218
+ animation: 0.5s 2 alternate ${$t};
219
219
  `,cancelButton:k.css`
220
220
  position: absolute;
221
221
  left: calc(200px + var(--spacing-base));
@@ -225,52 +225,53 @@ to {
225
225
  border: 1px solid var(--gray-300);
226
226
  `,error:k.css`
227
227
  color: var(--brand-secondary-5);
228
- font-size: var(--font-sm);
228
+ font-size: var(--fs-sm);
229
229
  `,quirks:k.css`
230
230
  .uniform-input-select,
231
231
  input {
232
232
  padding: var(--spacing-sm);
233
233
  }
234
- `};var L=require("@emotion/react"),ie=({children:t})=>(0,e.jsx)("table",{css:L.css`
234
+ `};var L=require("@emotion/react"),re=({children:t})=>(0,e.jsx)("table",{css:L.css`
235
235
  border-collapse: collapse;
236
236
  display: table;
237
237
  width: 100%;
238
- font-size: var(--font-sm);
239
- `},t),Ue=({children:t})=>(0,e.jsx)("thead",{css:L.css`
238
+ font-size: var(--fs-sm);
239
+ `},t),Ne=({children:t})=>(0,e.jsx)("thead",{css:L.css`
240
240
  background: var(--gray-50);
241
241
  text-align: left;
242
242
  & tr {
243
243
  border-bottom: 1px solid var(--gray-200);
244
244
  }
245
- `},t),se=({children:t})=>(0,e.jsx)("tbody",null,t),U=({border:t,children:r})=>(0,e.jsx)("tr",{css:t?L.css`
245
+ `},t),ne=({children:t})=>(0,e.jsx)("tbody",null,t),z=({border:t,children:r})=>(0,e.jsx)("tr",{css:t?L.css`
246
246
  border-bottom: 1px solid var(--gray-200);
247
247
  &:where(:last-child) {
248
248
  border: none;
249
249
  }
250
- `:void 0},r),ae=({children:t,width:r})=>(0,e.jsx)("th",{css:L.css`
250
+ `:void 0},r),ie=({children:t,width:r})=>(0,e.jsx)("th",{css:L.css`
251
251
  outline: none;
252
252
  padding: var(--spacing-sm);
253
253
  width: ${r!=null?r:"auto"};
254
- `},t);function jt(t){switch(t){case"light":return L.css`
254
+ `},t);function Kt(t){switch(t){case"light":return L.css`
255
255
  color: var(--gray-400);
256
256
  `;case"dark":return L.css`
257
257
  color: var(--brand-secondary-1);
258
- `}}function eo(t){return L.css`
258
+ `}}function Wt(t){return L.css`
259
259
  text-align: ${t};
260
- `}var R=({alignment:t="left",border:r,color:n="dark",children:o})=>(0,e.jsx)("td",{css:[L.css`
260
+ `}var V=({alignment:t="left",border:r,color:n="dark",children:o})=>(0,e.jsx)("td",{css:[L.css`
261
261
  padding: var(--spacing-base);
262
262
  max-width: 180px;
263
263
  overflow-wrap: break-word;
264
264
  position: relative;
265
- `,jt(n),eo(t),r?L.css`
265
+ `,Kt(n),Wt(t),r?L.css`
266
266
  border-left: 1px solid var(--gray-200);
267
- `:void 0]},o);var ce=require("@emotion/react"),_e=ce.css`
267
+ `:void 0]},o);var se=require("@emotion/react"),Ze=se.css`
268
268
  position: relative;
269
269
  display: inline-block;
270
- font-size: var(--font-base);
271
- `,Ge=ce.css`
270
+ font-size: var(--fs-base);
271
+ `,ze=se.css`
272
272
  display: block;
273
- `,$e=ce.css`
273
+ text-decoration: line-through;
274
+ `,Ue=se.css`
274
275
  position: absolute;
275
276
  width: 6px;
276
277
  height: 6px;
@@ -278,95 +279,26 @@ to {
278
279
  top: 9px;
279
280
  background: var(--red-tooltip);
280
281
  border-radius: 3px;
281
- `;var We=require("@emotion/react"),to=`<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
282
+ `;var Ge=require("@emotion/react"),Yt=`<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
282
283
  <path d="M4.2 7.2C4.53137 7.2 4.8 6.93137 4.8 6.6C4.8 6.26863 4.53137 6 4.2 6C3.86863 6 3.6 6.26863 3.6 6.6C3.6 6.93137 3.86863 7.2 4.2 7.2Z" fill="#828282"/>
283
284
  <path d="M8.4 6.6C8.4 6.93137 8.13137 7.2 7.8 7.2C7.46863 7.2 7.2 6.93137 7.2 6.6C7.2 6.26863 7.46863 6 7.8 6C8.13137 6 8.4 6.26863 8.4 6.6Z" fill="#828282"/>
284
285
  <path fill-rule="evenodd" clip-rule="evenodd" d="M6 12C9.31371 12 12 9.31371 12 6C12 2.68629 9.31371 0 6 0C2.68629 0 0 2.68629 0 6C0 9.31371 2.68629 12 6 12ZM6 10.8C8.65097 10.8 10.8 8.65097 10.8 6C10.8 5.49824 10.723 5.01447 10.5802 4.55984C10.0795 4.69533 9.55274 4.76763 9.00913 4.76763C6.77526 4.76763 4.82652 3.54683 3.79366 1.73601C2.25282 2.53492 1.2 4.14451 1.2 6C1.2 8.65097 3.34903 10.8 6 10.8Z" fill="#828282"/>
285
- </svg>`,oo=`<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
286
+ </svg>`,Jt=`<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
286
287
  <path fill-rule="evenodd" clip-rule="evenodd" d="M3.59995 5.05775C4.9254 5.05775 5.99992 3.98325 5.99992 2.65778C5.99992 1.33232 4.9254 0.257812 3.59995 0.257812C2.27448 0.257812 1.19998 1.33232 1.19998 2.65778C1.19998 3.98325 2.27448 5.05775 3.59995 5.05775ZM3.59999 3.85777C4.26272 3.85777 4.79997 3.32052 4.79997 2.65778C4.79997 1.99505 4.26272 1.4578 3.59999 1.4578C2.93725 1.4578 2.4 1.99505 2.4 2.65778C2.4 3.32052 2.93725 3.85777 3.59999 3.85777Z" fill="#828282"/>
287
288
  <path d="M5.39993 6.8577C5.73131 6.8577 5.99993 7.12632 5.99993 7.45769V11.0576H7.19991V7.45769C7.19991 6.46356 6.39406 5.65771 5.39993 5.65771H1.79998C0.80588 5.65771 0 6.46356 0 7.45769V11.0576H1.19999V7.45769C1.19999 7.12632 1.46861 6.8577 1.79998 6.8577H5.39993Z" fill="#828282"/>
288
289
  <path d="M11.9999 5.05762H8.3999V6.2576H11.9999V5.05762Z" fill="#828282"/>
289
290
  <path d="M8.3999 7.45752H11.9999V8.6575H8.3999V7.45752Z" fill="#828282"/>
290
291
  <path d="M11.9999 2.65771H8.3999V3.8577H11.9999V2.65771Z" fill="#828282"/>
291
- </svg>`,Ke=`<svg width="15" height="11" viewBox="0 0 15 11" fill="none" xmlns="http://www.w3.org/2000/svg">
292
+ </svg>`,_e=`<svg width="15" height="11" viewBox="0 0 15 11" fill="none" xmlns="http://www.w3.org/2000/svg">
292
293
  <path fill-rule="evenodd" clip-rule="evenodd" d="M7.113 3.12646C8.16729 3.12646 9.02195 3.98113 9.02195 5.03541C9.02195 5.86658 8.49075 6.57368 7.74932 6.83573V10.1259H6.47669V6.83573C5.73526 6.57368 5.20405 5.86658 5.20405 5.03541C5.20405 3.98113 6.05872 3.12646 7.113 3.12646ZM7.113 4.39909C7.46443 4.39909 7.74932 4.68398 7.74932 5.03541C7.74932 5.38684 7.46443 5.67172 7.113 5.67172C6.76158 5.67172 6.47669 5.38684 6.47669 5.03541C6.47669 4.68398 6.76158 4.39909 7.113 4.39909Z" fill="#828282"/>
293
294
  <path d="M3.96336 1.88578C3.15733 2.69183 2.65879 3.80537 2.65879 5.03535C2.65879 6.42093 3.29145 7.65875 4.28366 8.47569L5.1895 7.56984C4.42501 6.98876 3.93142 6.06969 3.93142 5.03535C3.93142 4.1568 4.28752 3.36142 4.86325 2.78567L3.96336 1.88578Z" fill="#828282"/>
294
295
  <path d="M9.36269 2.7856C9.93846 3.36136 10.2946 4.15676 10.2946 5.03535C10.2946 6.06973 9.80096 6.98882 9.03643 7.5699L9.94228 8.47575C10.9345 7.65881 11.5672 6.42096 11.5672 5.03535C11.5672 3.80533 11.0687 2.69177 10.2626 1.88571L9.36269 2.7856Z" fill="#828282"/>
295
296
  <path d="M0.113525 5.03534C0.113525 3.10251 0.896953 1.35266 2.16359 0.0860049L3.06347 0.985892C2.02714 2.02224 1.38616 3.45394 1.38616 5.03534C1.38616 6.61674 2.02714 8.04844 3.06347 9.08479L2.16358 9.98468C0.89695 8.71802 0.113525 6.96817 0.113525 5.03534Z" fill="#828282"/>
296
297
  <path d="M12.0624 9.98474C13.329 8.71809 14.1125 6.96821 14.1125 5.03534C14.1125 3.10248 13.329 1.3526 12.0624 0.0859375L11.1625 0.985824C12.1988 2.02218 12.8398 3.4539 12.8398 5.03534C12.8398 6.61678 12.1988 8.0485 11.1625 9.08486L12.0624 9.98474Z" fill="#828282"/>
297
- </svg>`,Ye=({type:t})=>{let r="";switch(t){case"Audience":r=to;break;case"Signal":r=Ke;break;case"Intent":r=Ke;break;case"Enrichment":r=oo;break}return(0,e.jsx)("i",{css:We.css`
298
+ </svg>`,$e=({type:t})=>{let r="";switch(t){case"Audience":r=Yt;break;case"Signal":r=_e;break;case"Intent":r=_e;break;case"Enrichment":r=Jt;break}return(0,e.jsx)("i",{css:Ge.css`
298
299
  align-items: center;
299
300
  display: inline-block;
300
- `,dangerouslySetInnerHTML:{__html:r}})};var ro=({dimensionIndex:t,dimensions:r,disableEditOverride:n,onClick:o,preemptiveOverrides:i})=>{var p;let{settings:a}=J(),l=(p=i!=null?i:a.scoreOverrides)!=null?p:{};return(0,e.jsx)(ie,null,(0,e.jsx)(se,null,Object.entries(r).sort(([m],[u])=>m.localeCompare(u)).map(([m,u])=>{var y;let{dim:s,name:c,type:d,category:f}=(y=t[m])!=null?y:{name:m,dim:m,type:void 0,category:void 0},v=l[s];return(0,e.jsx)(U,{key:s},(0,e.jsx)(R,null,v!==void 0?(0,e.jsx)("s",{css:Ge},v.initial):null,(0,e.jsx)("b",{css:_e},u,v!==void 0&&(0,e.jsx)("i",{css:$e}))),(0,e.jsx)(R,null,(0,e.jsx)("div",{onClick:()=>o==null?void 0:o(s),css:o?{cursor:"pointer"}:void 0},(0,e.jsx)("span",{css:h.divider,role:"presentation"}),(0,e.jsx)("div",null,(0,e.jsx)(Ye,{type:d})," ",d),(0,e.jsx)("strong",null,f?`${f}:`:""," ",c))),(0,e.jsx)(R,{alignment:"right",color:"light"},v!==void 0&&!n?(0,e.jsx)(B,{route:`/overrides/${s}`},"Edit override"):null))})))},A=ro;async function de({actions:t,saveSettings:r,scores:n,settings:o}){var p,m;let i=(p=o.scoreOverrides)!=null?p:{},a={...i},l=[];for(let u of Object.keys(i)){let s=i==null?void 0:i[u];delete a[u],l.push({type:"modscoreS",data:{dimension:u,delta:s.initial-((m=n[u])!=null?m:0)}})}await r({...o,scoreOverrides:a}),await t.rawUpdate(l)}async function Je({quirk:t,settings:r,saveSettings:n,actions:o}){var l;let i=(l=r.quirkOverrides)==null?void 0:l[t];if(!i)return;let a={...r.quirkOverrides};delete a[t],await n({...r,quirkOverrides:a}),await o.rawUpdate([{type:"setquirk",data:{key:t,value:i.initial}}])}var Te=require("@uniformdev/design-system");var ot=D(require("react"));var q=require("@emotion/react"),Xe=q.css`
301
- position: relative;
302
- display: inline-block;
303
- margin-right: var(--spacing-sm);
304
- transition: var(--duration) var(--timing);
305
- vertical-align: middle;
306
- user-select: none;
307
- width: var(--spacing-xl);
308
- `,je=q.css`
309
- appearance: none;
310
- border-radius: var(--rounded-full);
311
- background-color: var(--white);
312
- border: 2px solid var(--gray-400);
313
- cursor: pointer;
314
- position: absolute;
315
- display: block;
316
- width: var(--spacing-md);
317
- height: var(--spacing-md);
318
- transition: transform var(--duration) var(--timing), background-color var(--duration) var(--timing),
319
- background-image var(--duration) var(--timing);
320
-
321
- &:focus {
322
- outline: 3px solid var(--brand-primary-1);
323
- outline-offset: 2px;
324
- }
325
-
326
- &:checked {
327
- background-color: var(--brand-secondary-3);
328
- background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%0A%3E%3Cpath d='M10.5858 13.4142L7.75735 10.5858L6.34314 12L10.5858 16.2427L17.6568 9.1716L16.2426 7.75739L10.5858 13.4142Z' fill='%23fff' /%3E%3C/svg%3E");
329
- background-position: center center;
330
- border-color: var(--brand-secondary-3);
331
- transform: translateX(var(--spacing-base));
332
-
333
- &:hover,
334
- &:focus {
335
- border-color: var(--brand-primary-1);
336
- background-color: var(--brand-primary-1);
337
- }
338
- }
339
- `,et=q.css`
340
- border-radius: var(--rounded-full);
341
- background-color: var(--gray-300);
342
- cursor: pointer;
343
- display: block;
344
- overflow: hidden;
345
- width: var(--spacing-xl);
346
- height: var(--spacing-md);
347
- `,tt=q.css`
348
- color: var(--brand-secondary-1);
349
- font-weight: var(--font-bold);
350
- line-height: 1.25rem;
351
- cursor: default;
352
- `,le=q.css`
353
- color: var(--gray-700);
354
- font-size: var(--font-sm);
355
- margin: var(--spacing-sm) 0;
356
- `;var _=({label:t,infoText:r,toggleText:n,...o})=>{let i=()=>r&&n?o.checked?(0,e.jsx)("p",{css:le},n):(0,e.jsx)("p",{css:le},r):r?(0,e.jsx)("p",{css:le},r):null;return(0,e.jsx)(ot.Fragment,null,(0,e.jsx)("div",{css:Xe},(0,e.jsx)("input",{type:"checkbox",css:je,...o,className:o.className}),(0,e.jsx)("label",{htmlFor:o.id,css:et})),(0,e.jsx)("label",{htmlFor:o.id,css:tt},t),i())};var rt=({dimensionIndex:{index:t},state:{scores:r,data:n},actions:o,saveSettings:i,settings:a})=>{let l=pe.useMemo(()=>{let s={};return Object.keys(t).filter(c=>!r[c]).map(c=>{s[t[c].dim]=0}),s},[r,t]),p=Object.keys(r).length,m=p+Object.keys(l).length,u=()=>{o.rawUpdate([{type:"setcontrol",data:!n.controlGroup}])};return(0,e.jsx)(pe.Fragment,null,(0,e.jsx)("article",{css:h.page},(0,e.jsx)("div",{css:h.headingGroup},(0,e.jsx)("h2",{css:h.title},"Dimensions",(0,e.jsx)("small",null,p," active of ",m)),(0,e.jsx)("div",{css:h.reset},(0,e.jsx)(Te.Button,{buttonType:"ghost",onClick:()=>de({actions:o,saveSettings:i,scores:r,settings:a}).then(o.forget)},"clear all dimensions")),(0,e.jsx)(_,{name:"controlGroup",label:"Control Group",onChange:u,checked:n.controlGroup})),p>0?(0,e.jsx)(A,{dimensionIndex:t,dimensions:r}):(0,e.jsx)(Q,{title:n.controlGroup?"In control group":"No active dimensions",text:n.controlGroup?"You are part of the personalization control group. While in the control group you do not have dimension scores and will not see personalized content. A/B tests will still run.":"You do not have score in any dimensions yet.",buttonGroup:n.controlGroup?(0,e.jsx)(Te.Button,{buttonType:"secondary",onClick:u},"Exit control group"):null}),(0,e.jsx)(j,null,(0,e.jsx)(ee,{title:`Inactive Dimensions (${Object.keys(l).length})`},(0,e.jsx)(A,{dimensionIndex:t,dimensions:l})))))};var it=D(require("react"));var nt=require("@emotion/react");function Se({onClick:t}){return(0,e.jsx)("button",{css:nt.css`
357
- width: 3.5rem;
358
- height: 3.5rem;
359
- display: flex;
360
- align-items: center;
361
- border-radius: 9999px;
362
- border: none;
363
- cursor: pointer;
364
- background-color: var(--red-button);
365
-
366
- svg {
367
- color: var(--red-button);
368
- }
369
- `,onClick:t,"aria-label":"Add new override",className:"text-secondary shadow-xl rounded-full flex items-center bg-secondary","data-test-id":"add-new-overrides-button"},(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"66",height:"66",viewBox:"0 0 66 66"},(0,e.jsx)("g",{fill:"none",fillRule:"evenodd"},(0,e.jsx)("circle",{cx:"33",cy:"33",r:"33",fill:"currentColor"}),(0,e.jsx)("g",{fill:"#FFF",transform:"translate(19 19)"},(0,e.jsx)("rect",{width:"4",height:"28",x:"12",rx:"2"}),(0,e.jsx)("path",{d:"M14,0 C15.1045695,-2.02906125e-16 16,0.8954305 16,2 L16,26 C16,27.1045695 15.1045695,28 14,28 C12.8954305,28 12,27.1045695 12,26 L12,2 C12,0.8954305 12.8954305,2.02906125e-16 14,0 Z",transform:"rotate(90 14 14)"})))))}var De=require("@uniformdev/design-system"),st=({dimensionIndex:{index:t},state:{data:r,scores:n},actions:o,settings:i,saveSettings:a})=>{var c;let l=(c=i.scoreOverrides)!=null?c:{},p=Object.keys(l).length,m=d=>(d.preventDefault(),a({...i,route:"/overrides/add"})),u=()=>{o.rawUpdate([{type:"setcontrol",data:!r.controlGroup}])},s={};return Object.entries(n).map(([d,f])=>{l[d]!==void 0&&(s[d]=f)}),(0,e.jsx)(it.Fragment,null,(0,e.jsx)("article",{css:h.page},(0,e.jsx)("div",{css:h.headingGroup},(0,e.jsx)("h2",{css:h.title},"What if?"),(0,e.jsx)("div",{css:h.reset},(0,e.jsx)(De.Button,{buttonType:"ghost",onClick:()=>de({actions:o,settings:i,saveSettings:a,scores:n})},"delete all overrides")),(0,e.jsx)(Se,{onClick:m})),(0,e.jsx)("p",null,"Override dimension scores to test personalization"),p>0?(0,e.jsx)(A,{dimensionIndex:t,dimensions:s,onClick:d=>a({...i,route:`/overrides/${d}`})}):(0,e.jsx)(Q,{title:r.controlGroup?"In control group":"No overrides",text:r.controlGroup?"You are part of the personalization control group. While in the control group you do not have dimension scores and will not see personalized content. A/B tests will still run.":"You do not have any dimension overrides yet.",buttonGroup:r.controlGroup?(0,e.jsx)(De.Button,{buttonType:"secondary",onClick:u},"Exit control group"):null})))};var z=require("formik");var N=D(require("yup"));var V=require("@emotion/react"),at=V.css`
301
+ `,dangerouslySetInnerHTML:{__html:r}})};var Xt=({dimensionIndex:t,dimensions:r,disableEditOverride:n,onClick:o,preemptiveOverrides:i})=>{var p;let{settings:a}=W(),l=(p=i!=null?i:a.scoreOverrides)!=null?p:{};return(0,e.jsx)(re,null,(0,e.jsx)(ne,null,Object.entries(r).sort(([m],[u])=>m.localeCompare(u)).map(([m,u])=>{var y;let{dim:s,name:d,type:c,category:v}=(y=t[m])!=null?y:{name:m,dim:m,type:void 0,category:void 0},f=l[s];return(0,e.jsx)(z,{key:s},(0,e.jsx)(V,null,f!==void 0?(0,e.jsx)("s",{css:ze},f.initial):null,(0,e.jsx)("b",{css:Ze},u,f!==void 0&&(0,e.jsx)("i",{css:Ue}))),(0,e.jsx)(V,null,(0,e.jsx)("div",{onClick:()=>o==null?void 0:o(s),css:o?{cursor:"pointer"}:void 0},(0,e.jsx)("span",{css:h.divider,role:"presentation"}),(0,e.jsx)("div",null,(0,e.jsx)($e,{type:c})," ",c),(0,e.jsx)("strong",null,v?`${v}:`:""," ",d))),(0,e.jsx)(V,{alignment:"right",color:"light"},f!==void 0&&!n?(0,e.jsx)(F,{route:`/overrides/${s}`},"Edit override"):null))})))},A=Xt;async function ae({actions:t,saveSettings:r,scores:n,settings:o}){var p,m;let i=(p=o.scoreOverrides)!=null?p:{},a={...i},l=[];for(let u of Object.keys(i)){let s=i==null?void 0:i[u];delete a[u],l.push({type:"modscoreS",data:{dimension:u,delta:s.initial-((m=n[u])!=null?m:0)}})}await r({...o,scoreOverrides:a}),await t.rawUpdate(l)}async function Ke({quirk:t,settings:r,saveSettings:n,actions:o}){var l;let i=(l=r.quirkOverrides)==null?void 0:l[t];if(!i)return;let a={...r.quirkOverrides};delete a[t],await n({...r,quirkOverrides:a}),await o.rawUpdate([{type:"setquirk",data:{key:t,value:i.initial}}])}var Ce=require("@uniformdev/design-system"),We=require("@uniformdev/design-system"),Ye=({dimensionIndex:{index:t},state:{scores:r,data:n},actions:o,saveSettings:i,settings:a})=>{let l=ce.useMemo(()=>{let s={};return Object.keys(t).filter(d=>!r[d]).map(d=>{s[t[d].dim]=0}),s},[r,t]),p=Object.keys(r).length,m=p+Object.keys(l).length,u=()=>{o.rawUpdate([{type:"setcontrol",data:!n.controlGroup}])};return(0,e.jsx)(ce.Fragment,null,(0,e.jsx)("article",{css:h.page},(0,e.jsx)("div",{css:h.headingGroup},(0,e.jsx)("h2",{css:h.title},"Dimensions",(0,e.jsx)("small",null,p," active of ",m)),(0,e.jsx)("div",{css:h.reset},(0,e.jsx)(Ce.Button,{buttonType:"ghost",onClick:()=>ae({actions:o,saveSettings:i,scores:r,settings:a}).then(o.forget)},"clear all dimensions")),(0,e.jsx)(We.Switch,{name:"controlGroup",label:"Control Group",onChange:u,checked:n.controlGroup})),p>0?(0,e.jsx)(A,{dimensionIndex:t,dimensions:r}):(0,e.jsx)(q,{title:n.controlGroup?"In control group":"No active dimensions",text:n.controlGroup?"You are part of the personalization control group. While in the control group you do not have dimension scores and will not see personalized content. A/B tests will still run.":"You do not have score in any dimensions yet.",buttonGroup:n.controlGroup?(0,e.jsx)(Ce.Button,{buttonType:"secondary",onClick:u},"Exit control group"):null}),(0,e.jsx)(J,null,(0,e.jsx)(X,{title:`Inactive Dimensions (${Object.keys(l).length})`},(0,e.jsx)(A,{dimensionIndex:t,dimensions:l})))))};var Je=x(require("react"));var Xe=require("@uniformdev/design-system");var we=require("@uniformdev/design-system"),je=({dimensionIndex:{index:t},state:{data:r,scores:n},actions:o,settings:i,saveSettings:a})=>{var d;let l=(d=i.scoreOverrides)!=null?d:{},p=Object.keys(l).length,m=c=>(c==null||c.preventDefault(),a({...i,route:"/overrides/add"})),u=()=>{o.rawUpdate([{type:"setcontrol",data:!r.controlGroup}])},s={};return Object.entries(n).map(([c,v])=>{l[c]!==void 0&&(s[c]=v)}),(0,e.jsx)(Je.Fragment,null,(0,e.jsx)("article",{css:h.page},(0,e.jsx)("div",{css:h.headingGroup},(0,e.jsx)("h2",{css:h.title},"What if?"),(0,e.jsx)("div",{css:h.reset},(0,e.jsx)(we.Button,{buttonType:"ghost",onClick:()=>ae({actions:o,settings:i,saveSettings:a,scores:n})},"delete all overrides")),(0,e.jsx)(Xe.AddButton,{onClick:m})),(0,e.jsx)("p",null,"Override dimension scores to test personalization"),p>0?(0,e.jsx)(A,{dimensionIndex:t,dimensions:s,onClick:c=>a({...i,route:`/overrides/${c}`})}):(0,e.jsx)(q,{title:r.controlGroup?"In control group":"No overrides",text:r.controlGroup?"You are part of the personalization control group. While in the control group you do not have dimension scores and will not see personalized content. A/B tests will still run.":"You do not have any dimension overrides yet.",buttonGroup:r.controlGroup?(0,e.jsx)(we.Button,{buttonType:"secondary",onClick:u},"Exit control group"):null})))};var B=require("formik");var N=x(require("yup"));var I=require("@emotion/react"),et=I.css`
370
302
  background: var(--white);
371
303
  border: 1px solid var(--gray-500);
372
304
  border-radius: var(--rounded-base);
@@ -377,26 +309,26 @@ to {
377
309
  cursor: not-allowed;
378
310
  color: var(--gray-200);
379
311
  }
380
- `,er=V.css`
312
+ `,zo=I.css`
381
313
  margin: var(--spacing-base) 0;
382
- `,ct=V.css`
314
+ `,tt=I.css`
383
315
  color: var(--brand-secondary-1);
384
316
  display: flex;
385
317
  flex-direction: column;
386
318
  margin: 0 0 var(--spacing-sm);
387
- `,dt=V.css`
319
+ `,ot=I.css`
388
320
  color: var(--brand-secondary-1);
389
321
  display: block;
390
322
  flex: 1 100%;
391
- font-weight: var(--font-bold);
323
+ font-weight: var(--fw-bold);
392
324
  margin: 0 0 var(--spacing-sm);
393
- `,tr=V.css`
325
+ `,Uo=I.css`
394
326
  color: var(--gray-600);
395
- font-size: var(--font-sm);
396
- `,or=V.css`
327
+ font-size: var(--fs-sm);
328
+ `,_o=I.css`
397
329
  color: var(--brand-secondary-5);
398
330
  display: block;
399
- `,lt=V.css`
331
+ `,rt=I.css`
400
332
  flex-direction: row;
401
333
  flex-wrap: wrap;
402
334
 
@@ -464,383 +396,28 @@ to {
464
396
  flex: 1 0 20%;
465
397
  padding: 10px;
466
398
  }
467
- `;var me=require("@uniformdev/design-system"),pt=({field:t,form:r,meta:n,...o})=>{var u,s;let{label:i,caption:a,min:l=0,max:p=100,step:m}=o;return(0,e.jsx)("div",null,(0,e.jsx)("label",{css:[ct,lt]},(0,e.jsx)("span",{css:dt},i),(0,e.jsx)("input",{type:"range",min:l,max:p,step:m,...t,value:(u=t.value)!=null?u:0}),(0,e.jsx)("span",{className:"value-display"},(s=t.value)!=null?s:0)),a?(0,e.jsx)(me.Caption,null,a):null,r.touched[t.name]&&r.errors[t.name]?(0,e.jsx)(me.ErrorMessage,{message:r.errors[t.name]}):null)};var mt=require("@emotion/react"),E=({children:t,...r})=>(0,e.jsx)("fieldset",{css:mt.css`
399
+ `;var de=require("@uniformdev/design-system"),nt=({field:t,form:r,meta:n,...o})=>{var u,s;let{label:i,caption:a,min:l=0,max:p=100,step:m}=o;return(0,e.jsx)("div",null,(0,e.jsx)("label",{css:[tt,rt]},(0,e.jsx)("span",{css:ot},i),(0,e.jsx)("input",{type:"range",min:l,max:p,step:m,...t,value:(u=t.value)!=null?u:0}),(0,e.jsx)("span",{className:"value-display"},(s=t.value)!=null?s:0)),a?(0,e.jsx)(de.Caption,null,a):null,r.touched[t.name]&&r.errors[t.name]?(0,e.jsx)(de.ErrorMessage,{message:r.errors[t.name]}):null)};var it=require("@emotion/react"),E=({children:t,...r})=>(0,e.jsx)("fieldset",{css:it.css`
468
400
  border: none;
469
401
  padding: 0;
470
402
  & legend {
471
403
  margin-bottom: var(--spacing-base);
472
404
  }
473
- `,...r},t);var ut=require("@emotion/react"),G=({children:t})=>(0,e.jsx)("legend",{css:ut.css`
474
- font-size: var(--font-md);
475
- font-weight: var(--font-bold);
405
+ `,...r},t);var st=require("@emotion/react"),U=({children:t})=>(0,e.jsx)("legend",{css:st.css`
406
+ font-size: var(--fs-md);
407
+ font-weight: var(--fw-bold);
476
408
  border-bottom: 1px solid var(--gray-400);
477
409
  width: 100%;
478
- `},t);var ue=require("@uniformdev/context");function gt({manifest:t,visitor:r,override:n}){let o=new ue.Context({manifest:t,transitionStore:new xe({initialData:r})}),i={...o.scores};o.storage.updateData([n]);let l={...{...o.scores}};return Object.entries(l).forEach(([p,m])=>{i[p]===m&&delete l[p]}),l}var xe=class extends ue.TransitionDataStore{async handleDelete(){}async handleUpdateData(){}};function $({scores:t,scoreOverrides:r}){let n=[];return r?(Object.entries(r).forEach(([o,i])=>{var p;let a=(p=t[o])!=null?p:0;if(a===i.override)return;let l=i.override-a;n.push({type:"modscoreS",data:{dimension:o,delta:l}})}),n):[]}function ge({quirks:t,quirkOverrides:r}){let n={};if(!!r)return Object.entries(r).forEach(([o,i])=>{t[o]!==i.override&&(n[o]=i.override)}),Object.keys(n).length>0?n:void 0}var vt=require("@uniformdev/design-system");var Le=t=>({field:r,form:n,meta:o,...i})=>(0,e.jsx)(t,{...i,...r,errorMessage:n.errors[r.name]});var fe=require("@uniformdev/design-system"),ve=Le(fe.Input),ft=Le(fe.InputSelect);var no=N.object({dimension:N.string(),score:N.number()}),Oe=({settings:t,saveSettings:r,state:n,actions:o,dimensionIndex:{index:i}})=>{var m,u;let a=t.route?[...t.route.matchAll(/overrides\/(?!.*add)(\w+)?/g)]:[],l=a[0]?a[0][1]:"";if(!((m=n.manifest.project.pz)!=null&&m.sig))return(0,e.jsx)("p",null,"Error, manifest is broken or there is no signal to override.");let p=Object.entries(i).filter(([,s])=>s.type!=="Audience"&&s.type!=="Intent").map(([s,c])=>{let d=c.type?`${c.type}: `:"",f=c.category?`${c.category} - `:"",v=`${d}${f}${c.name}`;return{value:s,label:v}});return p.unshift({value:"",label:"Choose dimension to override"}),(0,e.jsx)(z.Formik,{initialValues:{dimension:l,score:(u=n.scores[l])!=null?u:0},validate:s=>{let c={};return(s.score===n.scores[s.dimension]||s.score===0&&!n.scores[l])&&(c.score="You have to modify current score value"),c},validationSchema:no,enableReinitialize:!0,validateOnChange:!1,validateOnBlur:!1,onSubmit:async s=>{var y,C,w,S,Z,Ae;let c=(C=(y=i[s.dimension])==null?void 0:y.cap)!=null?C:0,d=Math.min(s.score,c),f={...t,scoreOverrides:{...t.scoreOverrides,[s.dimension]:{initial:(Ae=(Z=(S=(w=t.scoreOverrides)==null?void 0:w[s.dimension])==null?void 0:S.initial)!=null?Z:n.scores[s.dimension])!=null?Ae:0,override:d}},route:"/overrides"};await r(f);let v=$({scores:n.scores,scoreOverrides:f.scoreOverrides});o.rawUpdate(v)}},({isSubmitting:s,values:c})=>{var C;let d=gt({manifest:n.manifest,visitor:n.data,override:{type:"modscore",data:{dimension:c.dimension,delta:c.score-((C=n.scores[c.dimension])!=null?C:0)}}}),f=Object.entries(n.scores).reduce((w,[S,Z])=>(w[S]={initial:Z,override:Z},w),{}),v={max:100,step:50};i[c.dimension]&&(v.max=i[c.dimension].cap,v.step=i[c.dimension].str);let y=c.score&&Object.keys(d).length>0;return(0,e.jsx)(z.Form,{css:h.page},(0,e.jsx)("h1",{css:h.title},"Override Dimension"),(0,e.jsx)(z.Field,{component:ft,label:"Dimension",id:"dimension",name:"dimension",options:p,disabled:s}),(0,e.jsx)("p",{css:h.text},(0,e.jsx)("small",null,"Audiences and Intents are aggregated from other dimension scores and cannot be overridden directly.")),c.dimension?(0,e.jsx)(z.Field,{component:pt,name:"score",label:"Score",disabled:s,caption:`Range: 0 - ${v.max} in increments of ${v.step}`}):null,(0,e.jsx)(E,{disabled:s,css:{marginBottom:"2rem"}},y?(0,e.jsx)(j,null,(0,e.jsx)(ee,{title:`Impacted Dimensions (${Object.keys(d).length})`},(0,e.jsx)(A,{preemptiveOverrides:f,dimensionIndex:i,dimensions:d,disableEditOverride:!0}))):null,(0,e.jsx)(vt.Button,{type:"submit",css:h.submitButton,disabled:s},"Save"),(0,e.jsx)(B,{route:"/overrides",css:h.cancelButton},"Cancel")))})};var bt=require("react");var he=require("react"),be=require("@uniformdev/design-system");var io=({name:t,value:r,submit:n})=>{let[o,i]=(0,he.useState)(r!=null?r:"");return(0,he.useEffect)(()=>{i(r!=null?r:"")},[r]),(0,e.jsx)("div",{css:{display:"flex",gap:"var(--spacing-sm)"}},(0,e.jsx)(be.Input,{type:"text",css:[at],name:t,value:o,onChange:p=>{i(p.target.value)}}),(0,e.jsx)(be.Button,{buttonType:"primary",disabled:o===r,size:"sm",onClick:()=>n(t,o!=null?o:"")},"Save"))},ht=io;var K=require("@uniformdev/design-system"),yt=({...t})=>{let{state:{data:{quirks:r}},quirksIndex:{index:n},settings:o,saveSettings:i,actions:a}=t,[l,p]=(0,bt.useState)(""),m;l&&(m=n[l]);let u=async(s,c)=>{var v,y,C;p("");let d={...o,quirkOverrides:{...o.quirkOverrides,[s]:{initial:(C=(y=(v=o.quirkOverrides)==null?void 0:v[s])==null?void 0:y.initial)!=null?C:r[s],override:c}}};await i(d);let f=ge({quirks:r,quirkOverrides:d.quirkOverrides});await a.update({quirks:f})};return(0,e.jsx)(b.Fragment,null,(0,e.jsx)("article",{css:[h.page,h.quirks]},(0,e.jsx)("h1",{css:h.title},"Quirks"),(0,e.jsx)("p",{css:h.text},"Keys defined in Uniform and their current, programmatically defined values for this visit."),Object.keys(n).length?(0,e.jsx)(ie,null,(0,e.jsx)(Ue,null,(0,e.jsx)(U,null,(0,e.jsx)(ae,{width:"30%"},"Key"),(0,e.jsx)(ae,{width:"50%"},"Value"),(0,e.jsx)(ae,{width:"20%"},""))),(0,e.jsx)(se,null,Object.values(n).map(({name:s,value:c,id:d})=>{var y,C,w;let f=(C=(y=o.quirkOverrides)==null?void 0:y[s])==null?void 0:C.initial,v=[];return m&&m.options&&(v=m.options.map(S=>({value:S.value,label:S.name}))),(0,e.jsx)(U,{key:d,border:"bottom"},(0,e.jsx)(R,null,(0,e.jsx)("strong",null,s)),(0,e.jsx)(R,null,l!==d?(0,e.jsx)("div",{onClick:()=>{p(d)}},f?(0,e.jsx)("div",null,(0,e.jsx)("s",null,f)):null,c):null,l===d&&m&&(0,e.jsx)(b.Fragment,null,m.options?(0,e.jsx)(K.InputSelect,{showLabel:!1,label:`Change ${s}`,defaultOption:`Change ${s}`,name:d,onChange:S=>u(S.target.name,S.target.value),options:v}):(0,e.jsx)(ht,{name:d,value:c,submit:u}))),(0,e.jsx)(R,null,l?null:(w=o.quirkOverrides)!=null&&w[d]?(0,e.jsx)(K.Button,{buttonType:"ghost",onClick:()=>{Je({quirk:d,settings:o,saveSettings:i,actions:a})}},(0,e.jsx)("small",null,"Clear Override")):(0,e.jsx)(K.Button,{buttonType:"ghost",onClick:()=>{p(d)}},(0,e.jsx)("small",null,"Override"))))}))):(0,e.jsx)(Q,{title:"No quirks configured",text:"There are currently no quirks setup. Try to connect to Uniform API to load additional information about Quirks and Quirks without defined value."})))};var Ct=require("@uniformdev/design-system");var wt=({settings:t,saveSettings:r,actions:n,state:{data:o}})=>(0,e.jsx)("article",{css:[h.page,{display:"flex",flexDirection:"column",gap:"var(--spacing-base)"}]},(0,e.jsx)("h1",{css:h.title},"Settings"),(0,e.jsx)(E,null,(0,e.jsx)(G,null,"Data Connection"),(0,e.jsx)(Ct.Button,{buttonType:"tertiary",onClick:()=>{r({...t,route:"/connect"})}},"Manage Connection to Uniform")),(0,e.jsx)(E,null,(0,e.jsx)(G,null,"Storage Consent"),(0,e.jsx)(_,{label:"Store visitor data",id:"consent-mode",name:"consentMode",checked:o.consent,onChange:i=>{n.rawUpdate([{type:"consent",data:i.currentTarget.checked}]),r({...t,consentMode:i.currentTarget.checked})}}),(0,e.jsx)("p",null,(0,e.jsx)("small",null,"Enabling storage consent allows storing behavior in this browser for personalization across sessions. Only affects this browser. Personalization works with this disabled, but dimension scores are lost on refresh."))),(0,e.jsx)(E,null,(0,e.jsx)(G,null,"Logging"),(0,e.jsx)(_,{label:"Write Uniform Context diagnostic logs to browser console",id:"logging",name:"logging",checked:t.logLevel!=="none",onChange:i=>r({...t,logLevel:i.currentTarget.checked?"debug":"none"})})));var Ie=require("@uniformdev/design-system");var Re=({settings:t,saveSettings:r})=>{let n=()=>{r({...t,route:"/connect"})},o=()=>{r({...t,ignoreApiKeyPrompt:!0})},i=t.route==="/connect",a=!(t!=null&&t.apiKey);return!t.ignoreApiKeyPrompt&&a&&!i?(0,e.jsx)("div",{css:[te,Ne]},(0,e.jsx)("h2",{css:oe},"Connect to a Uniform Project"),(0,e.jsx)("p",{css:re},"This allows reading human-readable labels for the dimensions."),(0,e.jsx)("div",{css:ne},(0,e.jsx)(Ie.Button,{buttonType:"secondary",onClick:n},"Connect this site"),(0,e.jsx)(Ie.Button,{buttonType:"ghost",onClick:o},"Skip for now")),(0,e.jsx)("button",{type:"button",css:Ze,title:"close",onClick:o},(0,e.jsx)("span",{hidden:!0},"Close"))):null};var F=require("@uniformdev/context/api"),kt=require("react-use"),Tt=D(require("react"));function St({apiHost:t,apiKey:r,projectId:n},o){let{loading:i,error:a,value:l}=(0,kt.useAsync)(async()=>{if(!r||!n)return p;let u=(await new F.DimensionClient({projectId:n,apiKey:r,apiHost:t||void 0}).get()).dimensions,s={};return u.map(c=>{var d,f,v,y;if(s[c.dim]={...(0,F.computeDimensionDefinitionDisplayData)(c),cap:c.cap,str:10},s[c.dim].type==="Enrichment"){let C=c.dim.split("_")[0];s[c.dim].cap=(y=(v=(f=(d=o==null?void 0:o.project.pz)==null?void 0:d.enr)==null?void 0:f[C])==null?void 0:v.cap)!=null?y:100}}),s},[t,r,n]),p=Tt.useMemo(()=>{var u,s,c,d;let m={};return o&&(Object.entries((s=(u=o==null?void 0:o.project.pz)==null?void 0:u.sig)!=null?s:{}).map(([f,v])=>{let y=(0,F.computeDimensionDisplayData)(f,o);y&&(m[f]={...v,...y})}),Object.entries((d=(c=o==null?void 0:o.project.pz)==null?void 0:c.enr)!=null?d:{}).map(([f,v])=>{var w;let y=(0,F.computeDimensionDisplayData)(f,o),C={cap:(w=v.cap)!=null?w:100,str:10};y&&(m[f]={...y,cap:C.cap,str:C.str})}),l&&Object.entries(l).map(([f,v])=>{m[f]={...m[f],...v}})),m},[o,l]);return{loading:i,error:a,index:p}}var Dt=require("react"),xt=require("@uniformdev/context/api"),Lt=require("react-use");function Ot({apiHost:t,apiKey:r,projectId:n},o){let{loading:i,error:a,value:l}=(0,Lt.useAsync)(async()=>{if(!r||!n)return{};let u=await new xt.QuirkClient({projectId:n,apiKey:r,apiHost:t||void 0}).get(),s={};return u.quirks.map(c=>{s[c.id]={...c,value:o[c.id]}}),s},[t,r,n]),p=(0,Dt.useMemo)(()=>{let m={};return Object.entries(o).map(([u,s])=>m[u]={value:s,id:u,name:u}),l&&Object.entries(l).map(([u,s])=>m[u]={...s,value:o[u]}),m},[o,l]);return{loading:i,error:a,index:p}}var Ve=require("@emotion/react");function ye(){return(0,e.jsx)("style",null,`
410
+ `},t);var le=require("@uniformdev/context");function at({manifest:t,visitor:r,override:n}){let o=new le.Context({manifest:t,transitionStore:new ke({initialData:r})}),i={...o.scores};o.storage.updateData([n]);let l={...{...o.scores}};return Object.entries(l).forEach(([p,m])=>{i[p]===m&&delete l[p]}),l}var ke=class extends le.TransitionDataStore{async handleDelete(){}async handleUpdateData(){}};function _({scores:t,scoreOverrides:r}){let n=[];return r?(Object.entries(r).forEach(([o,i])=>{var p;let a=(p=t[o])!=null?p:0;if(a===i.override)return;let l=i.override-a;n.push({type:"modscoreS",data:{dimension:o,delta:l}})}),n):[]}function pe({quirks:t,quirkOverrides:r}){let n={};if(!!r)return Object.entries(r).forEach(([o,i])=>{t[o]!==i.override&&(n[o]=i.override)}),Object.keys(n).length>0?n:void 0}var dt=require("@uniformdev/design-system");var Te=t=>({field:r,form:n,meta:o,...i})=>(0,e.jsx)(t,{...i,...r,errorMessage:n.errors[r.name]});var me=require("@uniformdev/design-system"),ue=Te(me.Input),ct=Te(me.InputSelect);var jt=N.object({dimension:N.string(),score:N.number()}),De=({settings:t,saveSettings:r,state:n,actions:o,dimensionIndex:{index:i}})=>{var m,u;let a=t.route?[...t.route.matchAll(/overrides\/(?!.*add)(\w+)?/g)]:[],l=a[0]?a[0][1]:"";if(!((m=n.manifest.project.pz)!=null&&m.sig))return(0,e.jsx)("p",null,"Error, manifest is broken or there is no signal to override.");let p=Object.entries(i).filter(([,s])=>s.type!=="Audience"&&s.type!=="Intent").map(([s,d])=>{let c=d.type?`${d.type}: `:"",v=d.category?`${d.category} - `:"",f=`${c}${v}${d.name}`;return{value:s,label:f}});return p.unshift({value:"",label:"Choose dimension to override"}),(0,e.jsx)(B.Formik,{initialValues:{dimension:l,score:(u=n.scores[l])!=null?u:0},validate:s=>{let d={};return(s.score===n.scores[s.dimension]||s.score===0&&!n.scores[l])&&(d.score="You have to modify current score value"),d},validationSchema:jt,enableReinitialize:!0,validateOnChange:!1,validateOnBlur:!1,onSubmit:async s=>{var y,C,w,D,Z,Pe;let d=(C=(y=i[s.dimension])==null?void 0:y.cap)!=null?C:0,c=Math.min(s.score,d),v={...t,scoreOverrides:{...t.scoreOverrides,[s.dimension]:{initial:(Pe=(Z=(D=(w=t.scoreOverrides)==null?void 0:w[s.dimension])==null?void 0:D.initial)!=null?Z:n.scores[s.dimension])!=null?Pe:0,override:c}},route:"/overrides"};await r(v);let f=_({scores:n.scores,scoreOverrides:v.scoreOverrides});o.rawUpdate(f)}},({isSubmitting:s,values:d})=>{var C;let c=at({manifest:n.manifest,visitor:n.data,override:{type:"modscore",data:{dimension:d.dimension,delta:d.score-((C=n.scores[d.dimension])!=null?C:0)}}}),v=Object.entries(n.scores).reduce((w,[D,Z])=>(w[D]={initial:Z,override:Z},w),{}),f={max:100,step:50};i[d.dimension]&&(f.max=i[d.dimension].cap,f.step=i[d.dimension].str);let y=d.score&&Object.keys(c).length>0;return(0,e.jsx)(B.Form,{css:h.page},(0,e.jsx)("h1",{css:h.title},"Override Dimension"),(0,e.jsx)(B.Field,{component:ct,label:"Dimension",id:"dimension",name:"dimension",options:p,disabled:s}),(0,e.jsx)("p",{css:h.text},(0,e.jsx)("small",null,"Audiences and Intents are aggregated from other dimension scores and cannot be overridden directly.")),d.dimension?(0,e.jsx)(B.Field,{component:nt,name:"score",label:"Score",disabled:s,caption:`Range: 0 - ${f.max} in increments of ${f.step}`}):null,(0,e.jsx)(E,{disabled:s,css:{marginBottom:"2rem"}},y?(0,e.jsx)(J,null,(0,e.jsx)(X,{title:`Impacted Dimensions (${Object.keys(c).length})`},(0,e.jsx)(A,{preemptiveOverrides:v,dimensionIndex:i,dimensions:c,disableEditOverride:!0}))):null,(0,e.jsx)(dt.Button,{type:"submit",css:h.submitButton,disabled:s},"Save"),(0,e.jsx)(F,{route:"/overrides",css:h.cancelButton},"Cancel")))})};var pt=require("react");var ge=require("react"),ve=require("@uniformdev/design-system");var eo=({name:t,value:r,submit:n})=>{let[o,i]=(0,ge.useState)(r!=null?r:"");return(0,ge.useEffect)(()=>{i(r!=null?r:"")},[r]),(0,e.jsx)("div",{css:{display:"flex",gap:"var(--spacing-sm)"}},(0,e.jsx)(ve.Input,{type:"text",css:[et],name:t,value:o,onChange:p=>{i(p.target.value)}}),(0,e.jsx)(ve.Button,{buttonType:"primary",disabled:o===r,size:"sm",onClick:()=>n(t,o!=null?o:"")},"Save"))},lt=eo;var G=require("@uniformdev/design-system"),mt=({...t})=>{let{state:{data:{quirks:r}},quirksIndex:{index:n},settings:o,saveSettings:i,actions:a}=t,[l,p]=(0,pt.useState)(""),m;l&&(m=n[l]);let u=async(s,d)=>{var f,y,C;p("");let c={...o,quirkOverrides:{...o.quirkOverrides,[s]:{initial:(C=(y=(f=o.quirkOverrides)==null?void 0:f[s])==null?void 0:y.initial)!=null?C:r[s],override:d}}};await i(c);let v=pe({quirks:r,quirkOverrides:c.quirkOverrides});await a.update({quirks:v})};return(0,e.jsx)(b.Fragment,null,(0,e.jsx)("article",{css:[h.page,h.quirks]},(0,e.jsx)("h1",{css:h.title},"Quirks"),(0,e.jsx)("p",{css:h.text},"Keys defined in Uniform and their current, programmatically defined values for this visit."),Object.keys(n).length?(0,e.jsx)(re,null,(0,e.jsx)(Ne,null,(0,e.jsx)(z,null,(0,e.jsx)(ie,{width:"30%"},"Key"),(0,e.jsx)(ie,{width:"50%"},"Value"),(0,e.jsx)(ie,{width:"20%"},""))),(0,e.jsx)(ne,null,Object.values(n).map(({name:s,value:d,id:c})=>{var y,C,w;let v=(C=(y=o.quirkOverrides)==null?void 0:y[s])==null?void 0:C.initial,f=[];return m&&m.options&&(f=m.options.map(D=>({value:D.value,label:D.name}))),(0,e.jsx)(z,{key:c,border:"bottom"},(0,e.jsx)(V,null,(0,e.jsx)("strong",null,s)),(0,e.jsx)(V,null,l!==c?(0,e.jsx)("div",{onClick:()=>{p(c)}},v?(0,e.jsx)("div",null,(0,e.jsx)("s",null,v)):null,d):null,l===c&&m&&(0,e.jsx)(b.Fragment,null,m.options?(0,e.jsx)(G.InputSelect,{showLabel:!1,label:`Change ${s}`,defaultOption:`Change ${s}`,name:c,onChange:D=>u(D.target.name,D.target.value),options:f}):(0,e.jsx)(lt,{name:c,value:d,submit:u}))),(0,e.jsx)(V,null,l?null:(w=o.quirkOverrides)!=null&&w[c]?(0,e.jsx)(G.Button,{buttonType:"ghost",onClick:()=>{Ke({quirk:c,settings:o,saveSettings:i,actions:a})}},(0,e.jsx)("small",null,"Clear Override")):(0,e.jsx)(G.Button,{buttonType:"ghost",onClick:()=>{p(c)}},(0,e.jsx)("small",null,"Override"))))}))):(0,e.jsx)(q,{title:"No quirks configured",text:"There are currently no quirks setup. Try to connect to Uniform API to load additional information about Quirks and Quirks without defined value."})))};var ut=require("@uniformdev/design-system"),Se=require("@uniformdev/design-system"),gt=({settings:t,saveSettings:r,actions:n,state:{data:o}})=>(0,e.jsx)("article",{css:[h.page,{display:"flex",flexDirection:"column",gap:"var(--spacing-base)"}]},(0,e.jsx)("h1",{css:h.title},"Settings"),(0,e.jsx)(E,null,(0,e.jsx)(U,null,"Data Connection"),(0,e.jsx)(ut.Button,{buttonType:"tertiary",onClick:()=>{r({...t,route:"/connect"})}},"Manage Connection to Uniform")),(0,e.jsx)(E,null,(0,e.jsx)(U,null,"Storage Consent"),(0,e.jsx)(Se.Switch,{label:"Store visitor data",id:"consent-mode",name:"consentMode",checked:o.consent,onChange:i=>{n.rawUpdate([{type:"consent",data:i.currentTarget.checked}]),r({...t,consentMode:i.currentTarget.checked})}}),(0,e.jsx)("p",null,(0,e.jsx)("small",null,"Enabling storage consent allows storing behavior in this browser for personalization across sessions. Only affects this browser. Personalization works with this disabled, but dimension scores are lost on refresh."))),(0,e.jsx)(E,null,(0,e.jsx)(U,null,"Logging"),(0,e.jsx)(Se.Switch,{label:"Write Uniform Context diagnostic logs to browser console",id:"logging",name:"logging",checked:t.logLevel==="debug",onChange:i=>r({...t,logLevel:i.currentTarget.checked?"debug":"none"})})));var Le=require("@uniformdev/design-system");var Oe=({settings:t,saveSettings:r})=>{let n=()=>{r({...t,route:"/connect"})},o=()=>{r({...t,ignoreApiKeyPrompt:!0})},i=t.route==="/connect",a=!(t!=null&&t.apiKey);return!t.ignoreApiKeyPrompt&&a&&!i?(0,e.jsx)("div",{css:[j,Fe]},(0,e.jsx)("h2",{css:ee},"Connect to a Uniform Project"),(0,e.jsx)("p",{css:te},"This allows reading human-readable labels for the dimensions."),(0,e.jsx)("div",{css:oe},(0,e.jsx)(Le.Button,{buttonType:"secondary",onClick:n},"Connect this site"),(0,e.jsx)(Le.Button,{buttonType:"ghost",onClick:o},"Skip for now")),(0,e.jsx)("button",{type:"button",css:qe,title:"close",onClick:o},(0,e.jsx)("span",{hidden:!0},"Close"))):null};var Q=require("@uniformdev/context/api"),vt=require("react-use"),ft=x(require("react"));function ht({apiHost:t,apiKey:r,projectId:n},o){let{loading:i,error:a,value:l}=(0,vt.useAsync)(async()=>{if(!r||!n)return p;let u=(await new Q.DimensionClient({projectId:n,apiKey:r,apiHost:t||void 0}).get()).dimensions,s={};return u.map(d=>{var c,v,f,y;if(s[d.dim]={...(0,Q.computeDimensionDefinitionDisplayData)(d),cap:d.cap,str:10},s[d.dim].type==="Enrichment"){let C=d.dim.split("_")[0];s[d.dim].cap=(y=(f=(v=(c=o==null?void 0:o.project.pz)==null?void 0:c.enr)==null?void 0:v[C])==null?void 0:f.cap)!=null?y:100}}),s},[t,r,n]),p=ft.useMemo(()=>{var u,s,d,c;let m={};return o&&(Object.entries((s=(u=o==null?void 0:o.project.pz)==null?void 0:u.sig)!=null?s:{}).map(([v,f])=>{let y=(0,Q.computeDimensionDisplayData)(v,o);y&&(m[v]={...f,...y})}),Object.entries((c=(d=o==null?void 0:o.project.pz)==null?void 0:d.enr)!=null?c:{}).map(([v,f])=>{var w;let y=(0,Q.computeDimensionDisplayData)(v,o),C={cap:(w=f.cap)!=null?w:100,str:10};y&&(m[v]={...y,cap:C.cap,str:C.str})}),l&&Object.entries(l).map(([v,f])=>{m[v]={...m[v],...f}})),m},[o,l]);return{loading:i,error:a,index:p}}var bt=require("react"),yt=require("@uniformdev/context/api"),Ct=require("react-use");function wt({apiHost:t,apiKey:r,projectId:n},o){let{loading:i,error:a,value:l}=(0,Ct.useAsync)(async()=>{if(!r||!n)return{};let u=await new yt.QuirkClient({projectId:n,apiKey:r,apiHost:t||void 0}).get(),s={};return u.quirks.map(d=>{s[d.id]={...d,value:o[d.id]}}),s},[t,r,n]),p=(0,bt.useMemo)(()=>{let m={};return Object.entries(o).map(([u,s])=>m[u]={value:s,id:u,name:u}),l&&Object.entries(l).map(([u,s])=>m[u]={...s,value:o[u]}),m},[o,l]);return{loading:i,error:a,index:p}}var xe=require("@emotion/react"),Ot=require("@uniformdev/design-system");function fe(){return(0,e.jsx)("style",null,`
479
411
  :root {
480
- --brand-primary-1: #438fd5; /* bright blue */
481
- --brand-primary-2: #f4220b; /* red */
482
- --brand-primary-3: #83c6e1; /* slate blue */
483
-
484
- /* secondary colours */
485
- --brand-secondary-1: #1f2b34; /* carbon */
486
- --brand-secondary-2: #ecf1f1; /* silver */
487
- --brand-secondary-3: #2ecdb4; /* teal */
488
- --brand-secondary-4: #f6f1c3; /* yellow */
489
- --brand-secondary-5: #d9534f; /* brick red */
490
- --brand-secondary-6: #dbf6f2; /* mint */
491
-
492
- /* off brand */
493
- --input-border: rgba(31, 43, 52, 0.5);
494
-
495
- /* site settings */
496
412
  --site-width: 700px;
497
- --min-height: 450px;
498
-
499
- --spacing-base: 1.15rem;
500
- --spacing-xs: calc(var(--spacing-base) - 0.75rem);
501
- --spacing-sm: calc(var(--spacing-base) - 0.5rem);
502
- --spacing-md: calc(var(--spacing-base) * 1.5);
503
- --spacing-lg: calc(var(--spacing-base) * 2);
504
- --spacing-xl: calc(var(--spacing-base) * 2.5);
505
-
506
- /* font sizes */
507
- --font-base: 1rem; /* 16px */
508
- --font-xxs: calc(var(--font-base) - 0.5rem);
509
- --font-xs: calc(var(--font-base) - 0.25rem);
510
- --font-sm: calc(var(--font-base) - 0.125rem); /* 14px */
511
- --font-md: calc(var(--font-base) * 1.25);
512
- --font-lg: calc(var(--font-base) * 1.5);
513
-
514
- /* font-weight */
515
- --font-regular: 400;
516
- --font-bold: 700;
517
-
518
- /* brand shadow styles */
519
- --shadow-base: rgba(50, 50, 93, 0.25) 0px 2px 5px -1px, rgba(0, 0, 0, 0.3) 0px 1px 3px -1px;
520
-
521
- /* rounder corners */
522
- --rounded-base: 6px;
523
- --rounded-full: 99999px;
524
-
525
- /* gray spectrum */
526
- --white: #fff;
527
- --gray-50: #f9fafb;
528
- --gray-100: #f3f4f6;
529
- --gray-200: #e5e7eb;
530
- --gray-300: #d1d5db;
531
- --gray-400: #9ca3af;
532
- --gray-500: #6b7280;
533
- --gray-600: #4b5563;
534
- --gray-700: #374151;
535
- --gray-800: #1f2937;
536
- --gray-900: #111827;
537
413
 
538
414
  /* Red CTA */
539
415
  --red-button: rgb(217 83 79);
540
416
  --red-tooltip: #D9534F;
541
417
 
542
- /* z-indexs */
543
- --z-10: 10;
418
+ --min-height: 450px;
544
419
  }
545
-
546
- /*! modern-normalize v1.1.0 | MIT License | https://github.com/sindresorhus/modern-normalize */
547
-
548
- /*
549
- Document
550
- ========
551
- */
552
-
553
- /**
554
- Use a better box model (opinionated).
555
- */
556
-
557
- *,
558
- ::before,
559
- ::after {
560
- box-sizing: border-box;
561
- }
562
-
563
- /**
564
- Use a more readable tab size (opinionated).
565
- */
566
-
567
- html {
568
- -moz-tab-size: 4;
569
- tab-size: 4;
570
- }
571
-
572
- /**
573
- 1. Correct the line height in all browsers.
574
- 2. Prevent adjustments of font size after orientation changes in iOS.
575
- */
576
-
577
- html {
578
- line-height: 1.15; /* 1 */
579
- -webkit-text-size-adjust: 100%; /* 2 */
580
- }
581
-
582
- /*
583
- Sections
584
- ========
585
- */
586
-
587
- /**
588
- Remove the margin in all browsers.
589
- */
590
-
591
- body {
592
- margin: 0;
593
- }
594
-
595
- /**
596
- Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3)
597
- */
598
-
599
- body {
600
- font-family:
601
- system-ui,
602
- -apple-system, /* Firefox supports this but not yet system-ui */
603
- 'Segoe UI',
604
- Roboto,
605
- Helvetica,
606
- Arial,
607
- sans-serif,
608
- 'Apple Color Emoji',
609
- 'Segoe UI Emoji';
610
- }
611
-
612
- /*
613
- Grouping content
614
- ================
615
- */
616
-
617
- /**
618
- 1. Add the correct height in Firefox.
619
- 2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
620
- */
621
-
622
- hr {
623
- height: 0; /* 1 */
624
- color: inherit; /* 2 */
625
- }
626
-
627
- /*
628
- Text-level semantics
629
- ====================
630
- */
631
-
632
- /**
633
- Add the correct text decoration in Chrome, Edge, and Safari.
634
- */
635
-
636
- abbr[title] {
637
- text-decoration: underline dotted;
638
- }
639
-
640
- /**
641
- Add the correct font weight in Edge and Safari.
642
- */
643
-
644
- b,
645
- strong {
646
- font-weight: bolder;
647
- }
648
-
649
- /**
650
- 1. Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3)
651
- 2. Correct the odd 'em' font sizing in all browsers.
652
- */
653
-
654
- code,
655
- kbd,
656
- samp,
657
- pre {
658
- font-family:
659
- ui-monospace,
660
- SFMono-Regular,
661
- Consolas,
662
- 'Liberation Mono',
663
- Menlo,
664
- monospace; /* 1 */
665
- font-size: 1em; /* 2 */
666
- }
667
-
668
- /**
669
- Add the correct font size in all browsers.
670
- */
671
-
672
- small {
673
- font-size: 80%;
674
- }
675
-
676
- /**
677
- Prevent 'sub' and 'sup' elements from affecting the line height in all browsers.
678
- */
679
-
680
- sub,
681
- sup {
682
- font-size: 75%;
683
- line-height: 0;
684
- position: relative;
685
- vertical-align: baseline;
686
- }
687
-
688
- sub {
689
- bottom: -0.25em;
690
- }
691
-
692
- sup {
693
- top: -0.5em;
694
- }
695
-
696
- /*
697
- Tabular data
698
- ============
699
- */
700
-
701
- /**
702
- 1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
703
- 2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
704
- */
705
-
706
- table {
707
- text-indent: 0; /* 1 */
708
- border-color: inherit; /* 2 */
709
- }
710
-
711
- /*
712
- Forms
713
- =====
714
- */
715
-
716
- /**
717
- 1. Change the font styles in all browsers.
718
- 2. Remove the margin in Firefox and Safari.
719
- */
720
-
721
- button,
722
- input,
723
- optgroup,
724
- select,
725
- textarea {
726
- font-family: inherit; /* 1 */
727
- font-size: 100%; /* 1 */
728
- line-height: 1.15; /* 1 */
729
- margin: 0; /* 2 */
730
- }
731
-
732
- /**
733
- Remove the inheritance of text transform in Edge and Firefox.
734
- 1. Remove the inheritance of text transform in Firefox.
735
- */
736
-
737
- button,
738
- select { /* 1 */
739
- text-transform: none;
740
- }
741
-
742
- /**
743
- Correct the inability to style clickable types in iOS and Safari.
744
- */
745
-
746
- button,
747
- [type='button'],
748
- [type='reset'],
749
- [type='submit'] {
750
- -webkit-appearance: button;
751
- }
752
-
753
- /**
754
- Remove the inner border and padding in Firefox.
755
- */
756
-
757
- ::-moz-focus-inner {
758
- border-style: none;
759
- padding: 0;
760
- }
761
-
762
- /**
763
- Restore the focus styles unset by the previous rule.
764
- */
765
-
766
- :-moz-focusring {
767
- outline: 1px dotted ButtonText;
768
- }
769
-
770
- /**
771
- Remove the additional ':invalid' styles in Firefox.
772
- See: https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737
773
- */
774
-
775
- :-moz-ui-invalid {
776
- box-shadow: none;
777
- }
778
-
779
- /**
780
- Remove the padding so developers are not caught out when they zero out 'fieldset' elements in all browsers.
781
- */
782
-
783
- legend {
784
- padding: 0;
785
- }
786
-
787
- /**
788
- Add the correct vertical alignment in Chrome and Firefox.
789
- */
790
-
791
- progress {
792
- vertical-align: baseline;
793
- }
794
-
795
- /**
796
- Correct the cursor style of increment and decrement buttons in Safari.
797
- */
798
-
799
- ::-webkit-inner-spin-button,
800
- ::-webkit-outer-spin-button {
801
- height: auto;
802
- }
803
-
804
- /**
805
- 1. Correct the odd appearance in Chrome and Safari.
806
- 2. Correct the outline style in Safari.
807
- */
808
-
809
- [type='search'] {
810
- -webkit-appearance: textfield; /* 1 */
811
- outline-offset: -2px; /* 2 */
812
- }
813
-
814
- /**
815
- Remove the inner padding in Chrome and Safari on macOS.
816
- */
817
-
818
- ::-webkit-search-decoration {
819
- -webkit-appearance: none;
820
- }
821
-
822
- /**
823
- 1. Correct the inability to style clickable types in iOS and Safari.
824
- 2. Change font properties to 'inherit' in Safari.
825
- */
826
-
827
- ::-webkit-file-upload-button {
828
- -webkit-appearance: button; /* 1 */
829
- font: inherit; /* 2 */
830
- }
831
-
832
- /*
833
- Interactive
834
- ===========
835
- */
836
-
837
- /*
838
- Add the correct display in Chrome and Safari.
839
- */
840
-
841
- summary {
842
- display: list-item;
843
- }`)}var Ce=require("react"),It=require("react-use");var Rt=()=>{let[t,r]=(0,Ce.useState)(!1),n=(0,It.useMountedState)();return(0,Ce.useEffect)(()=>{setTimeout(()=>{n()&&r(!0)},1e3)},[n]),t?(0,e.jsx)("article",{css:h.page},(0,e.jsx)("h1",null,"Loading..."),(0,e.jsx)("p",null,"Connecting to Uniform API for complete data.")):null};var Vt=require("@uniformdev/context"),we=require("@uniformdev/context/api"),P=require("formik"),T=D(require("react")),O=require("@uniformdev/design-system");function Pt(t){let[r,n]=T.useState(t.currentData?"c":"qc"),[o,i]=T.useState(void 0),[a,l]=T.useState(void 0),p=T.useCallback(async s=>{let c=new we.ManifestClient(s);i(void 0);try{let d=await c.get({preview:!0});return l({manifest:d,target:s}),d}catch(d){if(d instanceof we.ApiClientError){d.statusCode===403?i("API key is valid but does not have Context > Read Drafts permission, or the API key does not have permissions to the project, or the project does not exist."):i(d.errorMessage);return}if("message"in d){d.message==="Failed to fetch"?i("A network error occurred. Ensure the API host is valid."):i(d.message);return}i(JSON.stringify(d,null,2));return}},[]);T.useEffect(()=>{!t.currentData||p(t.currentData)},[p,t.currentData]);let m=async s=>{await p(s)&&(n("c"),await t.onConnect(s))},u=()=>{confirm("Disconnect from Uniform? Make sure to save your API key if you want to reconnect.")&&(n("qc"),l(void 0),i(void 0),t.onConnect(null))};return(0,e.jsx)("div",null,o?(0,e.jsx)(O.ErrorMessage,{message:o}):null,r==="qc"||r==="mc"?(0,e.jsx)(so,{...t,state:r,setState:n,onConnect:m}):(0,e.jsx)("div",null,a?(0,e.jsx)(T.Fragment,null,(0,e.jsx)("p",null,"Connected to"," ",(0,e.jsx)("a",{href:`${a==null?void 0:a.target.apiHost}/projects/${a==null?void 0:a.target.projectId}`,target:"_blank",rel:"noopener noreferrer",css:{textDecoration:"underline"}},(0,e.jsx)("strong",null,a==null?void 0:a.manifest.project.name))," ",(0,e.jsx)("small",null,"(",a==null?void 0:a.manifest.project.id,")")),(0,e.jsx)(O.Button,{buttonType:"secondary",type:"button",onClick:u},"Disconnect")):null))}function so({setState:t,state:r,currentData:n,onConnect:o}){var i,a,l;return(0,e.jsx)("div",null,(0,e.jsx)(P.Formik,{initialValues:{apiHost:(i=n==null?void 0:n.apiHost)!=null?i:"https://uniform.dev",apiKey:(a=n==null?void 0:n.apiKey)!=null?a:"",projectId:(l=n==null?void 0:n.projectId)!=null?l:"",qc:""},onSubmit:o},({setFieldValue:p,setFieldError:m,errors:{qc:u},isSubmitting:s})=>(0,e.jsx)(P.Form,null,(0,e.jsx)("fieldset",{css:{display:"flex",flexDirection:"column",gap:"var(--spacing-base)"}},r==="qc"?(0,e.jsx)(T.Fragment,null,(0,e.jsx)("div",null,(0,e.jsx)(O.Input,{placeholder:"Paste Quick Connect Code Here",caption:"Copy the Quick Connect code after creating an API key in Uniform.",errorMessage:u,onChange:c=>{try{let d=(0,Vt.parseQuickConnect)(c.currentTarget.value);p("apiHost",d.apiHost),p("apiKey",d.apiKey),p("projectId",d.projectId)}catch(d){m("qc",d.message)}}})),(0,e.jsx)("section",{css:{display:"flex",gap:"var(--spacing-sm)"}},(0,e.jsx)(O.Button,{type:"submit",buttonType:"primary",disabled:s},s?"Verifying...":"Connect"),(0,e.jsx)(O.Button,{type:"button",buttonType:"ghost",onClick:()=>t("mc"),disabled:s},"Connect Manually"))):(0,e.jsx)(T.Fragment,null,(0,e.jsx)("div",null,(0,e.jsx)(P.Field,{component:ve,label:"API Key",name:"apiKey",caption:"Generate an API key in your Uniform team settings."})),(0,e.jsx)("div",null,(0,e.jsx)(P.Field,{component:ve,label:"Project ID",name:"projectId",caption:"Available to copy after generating an API key"})),(0,e.jsx)("div",null,(0,e.jsx)(P.Field,{component:ve,label:"API Host",name:"apiHost",caption:"Use a non-standard Uniform API endpoint. Most people will not not need this option."})),(0,e.jsx)("section",{css:{display:"flex",gap:"var(--spacing-sm)"}},(0,e.jsx)(O.Button,{type:"submit",buttonType:"primary",disabled:s},s?"Verifying...":"Connect"),(0,e.jsx)(O.Button,{type:"button",buttonType:"ghost",onClick:()=>t("qc"),disabled:s},"Use Quick Connect")))))))}var Ht=({settings:t,saveSettings:r})=>{let n=t.apiKey&&t.projectId?{apiKey:t.apiKey,projectId:t.projectId,apiHost:t.apiHost}:void 0;return(0,e.jsx)("article",{css:h.page},(0,e.jsx)("h1",{css:h.title},"Connect to a Uniform Project"),(0,e.jsx)("p",{css:h.text},(0,e.jsx)("small",null,"Adding an API key and project ID enables human-readable dimension labels to be shown. You must have access to the Uniform project to do this.")),(0,e.jsx)(Pt,{onConnect:async o=>{o?await r({...t,apiKey:o.apiKey,projectId:o.projectId,apiHost:o.apiHost}):await r({...t,apiKey:void 0,projectId:void 0,apiHost:void 0})},currentData:n}))};var ao=Ve.css`
420
+ `)}var he=require("react"),kt=require("react-use");var Tt=()=>{let[t,r]=(0,he.useState)(!1),n=(0,kt.useMountedState)();return(0,he.useEffect)(()=>{setTimeout(()=>{n()&&r(!0)},1e3)},[n]),t?(0,e.jsx)("article",{css:h.page},(0,e.jsx)("h1",null,"Loading..."),(0,e.jsx)("p",null,"Connecting to Uniform API for complete data.")):null};var Dt=require("@uniformdev/context"),be=require("@uniformdev/context/api"),P=require("formik"),T=x(require("react")),O=require("@uniformdev/design-system");function St(t){let[r,n]=T.useState(t.currentData?"c":"qc"),[o,i]=T.useState(void 0),[a,l]=T.useState(void 0),p=T.useCallback(async s=>{let d=new be.ManifestClient(s);i(void 0);try{let c=await d.get({preview:!0});return l({manifest:c,target:s}),c}catch(c){if(c instanceof be.ApiClientError){c.statusCode===403?i("API key is valid but does not have Context > Read Drafts permission, or the API key does not have permissions to the project, or the project does not exist."):i(c.errorMessage);return}if("message"in c){c.message==="Failed to fetch"?i("A network error occurred. Ensure the API host is valid."):i(c.message);return}i(JSON.stringify(c,null,2));return}},[]);T.useEffect(()=>{!t.currentData||p(t.currentData)},[p,t.currentData]);let m=async s=>{await p(s)&&(n("c"),await t.onConnect(s))},u=()=>{confirm("Disconnect from Uniform? Make sure to save your API key if you want to reconnect.")&&(n("qc"),l(void 0),i(void 0),t.onConnect(null))};return(0,e.jsx)("div",null,o?(0,e.jsx)(O.ErrorMessage,{message:o}):null,r==="qc"||r==="mc"?(0,e.jsx)(to,{...t,state:r,setState:n,onConnect:m}):(0,e.jsx)("div",null,a?(0,e.jsx)(T.Fragment,null,(0,e.jsx)("p",null,"Connected to"," ",(0,e.jsx)("a",{href:`${a==null?void 0:a.target.apiHost}/projects/${a==null?void 0:a.target.projectId}`,target:"_blank",rel:"noopener noreferrer",css:{textDecoration:"underline"}},(0,e.jsx)("strong",null,a==null?void 0:a.manifest.project.name))," ",(0,e.jsx)("small",null,"(",a==null?void 0:a.manifest.project.id,")")),(0,e.jsx)(O.Button,{buttonType:"secondary",type:"button",onClick:u},"Disconnect")):null))}function to({setState:t,state:r,currentData:n,onConnect:o}){var i,a,l;return(0,e.jsx)("div",null,(0,e.jsx)(P.Formik,{initialValues:{apiHost:(i=n==null?void 0:n.apiHost)!=null?i:"https://uniform.dev",apiKey:(a=n==null?void 0:n.apiKey)!=null?a:"",projectId:(l=n==null?void 0:n.projectId)!=null?l:"",qc:""},onSubmit:o},({setFieldValue:p,setFieldError:m,errors:{qc:u},isSubmitting:s})=>(0,e.jsx)(P.Form,null,(0,e.jsx)("fieldset",{css:{display:"flex",flexDirection:"column",gap:"var(--spacing-base)"}},r==="qc"?(0,e.jsx)(T.Fragment,null,(0,e.jsx)("div",null,(0,e.jsx)(O.Input,{placeholder:"Paste Quick Connect Code Here",caption:"Copy the Quick Connect code after creating an API key in Uniform.",errorMessage:u,onChange:d=>{try{let c=(0,Dt.parseQuickConnect)(d.currentTarget.value);p("apiHost",c.apiHost),p("apiKey",c.apiKey),p("projectId",c.projectId)}catch(c){m("qc",c.message)}}})),(0,e.jsx)("section",{css:{display:"flex",gap:"var(--spacing-sm)"}},(0,e.jsx)(O.Button,{type:"submit",buttonType:"primary",disabled:s},s?"Verifying...":"Connect"),(0,e.jsx)(O.Button,{type:"button",buttonType:"ghost",onClick:()=>t("mc"),disabled:s},"Connect Manually"))):(0,e.jsx)(T.Fragment,null,(0,e.jsx)("div",null,(0,e.jsx)(P.Field,{component:ue,label:"API Key",name:"apiKey",caption:"Generate an API key in your Uniform team settings."})),(0,e.jsx)("div",null,(0,e.jsx)(P.Field,{component:ue,label:"Project ID",name:"projectId",caption:"Available to copy after generating an API key"})),(0,e.jsx)("div",null,(0,e.jsx)(P.Field,{component:ue,label:"API Host",name:"apiHost",caption:"Use a non-standard Uniform API endpoint. Most people will not not need this option."})),(0,e.jsx)("section",{css:{display:"flex",gap:"var(--spacing-sm)"}},(0,e.jsx)(O.Button,{type:"submit",buttonType:"primary",disabled:s},s?"Verifying...":"Connect"),(0,e.jsx)(O.Button,{type:"button",buttonType:"ghost",onClick:()=>t("qc"),disabled:s},"Use Quick Connect")))))))}var Lt=({settings:t,saveSettings:r})=>{let n=t.apiKey&&t.projectId?{apiKey:t.apiKey,projectId:t.projectId,apiHost:t.apiHost}:void 0;return(0,e.jsx)("article",{css:h.page},(0,e.jsx)("h1",{css:h.title},"Connect to a Uniform Project"),(0,e.jsx)("p",{css:h.text},(0,e.jsx)("small",null,"Adding an API key and project ID enables human-readable dimension labels to be shown. You must have access to the Uniform project to do this.")),(0,e.jsx)(St,{onConnect:async o=>{o?await r({...t,apiKey:o.apiKey,projectId:o.projectId,apiHost:o.apiHost}):await r({...t,apiKey:void 0,projectId:void 0,apiHost:void 0})},currentData:n}))};var oo=xe.css`
844
421
  background: var(--white);
845
422
  padding: var(--spacing-base);
846
423
  overflow-y: auto;
@@ -869,16 +446,16 @@ summary {
869
446
  &::-webkit-scrollbar-thumb:hover {
870
447
  background: var(--gray-500);
871
448
  }
872
- `;function Pe(t){let r=St(t.settings,t.state.manifest),n=Ot(t.settings,t.state.data.quirks),o={...t,dimensionIndex:r,quirksIndex:n},i=()=>{var a;if(r.loading||n.loading)return(0,e.jsx)(Rt,null);if(t.settings.route&&t.settings.route.match(/overrides\/\w+/))return(0,e.jsx)(Oe,{...o});switch((a=t.settings)==null?void 0:a.route){case void 0:case"/":case"/dimensions":return(0,e.jsx)(rt,{...o});case"/overrides":return(0,e.jsx)(st,{...o});case"/overrides/add":return(0,e.jsx)(Oe,{...o});case"/quirks":return(0,e.jsx)(yt,{...o});case"/settings":return(0,e.jsx)(wt,{...o});case"/connect":return(0,e.jsx)(Ht,{...o});default:return(0,e.jsx)(Qe,null)}};return(0,e.jsx)(Fe,{settings:t.settings,saveSettings:t.saveSettings},(0,e.jsx)(ye,null),(0,e.jsx)("div",{css:Ve.css`
449
+ `;function Re(t){let r=ht(t.settings,t.state.manifest),n=wt(t.settings,t.state.data.quirks),o={...t,dimensionIndex:r,quirksIndex:n},i=()=>{var a;if(r.loading||n.loading)return(0,e.jsx)(Tt,null);if(t.settings.route&&t.settings.route.match(/overrides\/\w+/))return(0,e.jsx)(De,{...o});switch((a=t.settings)==null?void 0:a.route){case void 0:case"/":case"/dimensions":return(0,e.jsx)(Ye,{...o});case"/overrides":return(0,e.jsx)(je,{...o});case"/overrides/add":return(0,e.jsx)(De,{...o});case"/quirks":return(0,e.jsx)(mt,{...o});case"/settings":return(0,e.jsx)(gt,{...o});case"/connect":return(0,e.jsx)(Lt,{...o});default:return(0,e.jsx)(Be,null)}};return(0,e.jsx)(Ae,{settings:t.settings,saveSettings:t.saveSettings},(0,e.jsx)(Ot.Theme,null),(0,e.jsx)(fe,null),(0,e.jsx)("div",{css:xe.css`
873
450
  display: grid;
874
451
  grid-template-columns: 200px auto;
875
- font-weight: var(--font-regular);
452
+ font-weight: var(--fs-base);
876
453
  font-size: var(--base-font-size);
877
454
  font-family: var(--base-font-family);
878
455
  line-height: var(--base-line-height);
879
456
  height: var(--min-height);
880
457
  min-width: var(--site-width);
881
- `},(0,e.jsx)(Be,{...t}),(0,e.jsx)("main",{css:ao},(0,e.jsx)(Re,{...t}),i())))}var ke=require("@uniformdev/context"),I=D(require("react"));var He="embeddedUniformDevToolsSettings";function Me({context:t,initialSettings:r}){let n=t!=null?t:typeof window!="undefined"?window.__UNIFORM_DEVTOOLS_CONTEXT_INSTANCE__:void 0,o=n!=null?n:new ke.Context({manifest:{project:{}}}),[i,a]=I.useState({data:o.storage.data,manifest:o.manifest.data,scores:o.scores,personalizations:[],tests:[]}),[l,p]=I.useState(r!=null?r:{});I.useEffect(()=>{var c;let s=(0,ke.createDebugConsoleLogDrain)((c=l.logLevel)!=null?c:"none");return o.events.on("log",s),()=>{o.events.off("log",s)}},[l,o]),I.useEffect(()=>{let s=()=>{let f=window.localStorage.getItem(He)||"{}",v=JSON.parse(f),y=ge({quirks:o.storage.data.quirks,quirkOverrides:v.quirkOverrides});y&&(console.log("Applying overridden quirks:",y),o.update({quirks:y}));let C=$({scores:o.scores,scoreOverrides:v.scoreOverrides});C.length&&(console.log("Applying overridden scores:",C),o.storage.updateData(C)),a(w=>({...w,scores:o.scores,data:o.storage.data,manifest:o.manifest.data}))},c=f=>{!f.changed||a(v=>({...v,personalizations:[...v.personalizations,f]}))},d=f=>{!f.variantAssigned||a(v=>({...v,tests:[...v.tests,f]}))};return o.events.on("personalizationResult",c),o.events.on("testResult",d),o.storage.events.on("*",s),()=>{o.storage.events.off("*",s),o.events.off("personalizationResult",c),o.events.off("testResult",d)}},[o]),I.useEffect(()=>{if(window.localStorage){let s=window.localStorage.getItem(He);if(s)try{let c=JSON.parse(s),d={...r,...c};p(d);let f=$({scores:i.scores,scoreOverrides:d.scoreOverrides});m.rawUpdate(f)}catch(c){window.localStorage.removeItem(He),console.error("Failed to parse settings from localStorage: ",c.message)}}},[]);let{actions:m,saveSettings:u}=I.useMemo(()=>({actions:{update:d=>o.update(d),forget:()=>o.forget(!1),rawUpdate:d=>o.storage.updateData(d)},saveSettings:async d=>{p(d),window.localStorage&&window.localStorage.setItem("embeddedUniformDevToolsSettings",JSON.stringify(d))}}),[o]);return n?(0,e.jsx)(Pe,{state:i,actions:m,settings:l,saveSettings:u}):(0,e.jsx)("p",null,"Unable to find Uniform Context. Ensure the devtools plugin is activated.")}var Et=require("@emotion/react"),zt=D(require("react"));var Mt=require("@emotion/react"),co=Mt.css`
458
+ `},(0,e.jsx)(Ee,{...t}),(0,e.jsx)("main",{css:oo},(0,e.jsx)(Oe,{...t}),i())))}var ye=require("@uniformdev/context"),R=x(require("react"));var Ve="embeddedUniformDevToolsSettings";function Ie({context:t,initialSettings:r}){let n=t!=null?t:typeof window!="undefined"?window.__UNIFORM_DEVTOOLS_CONTEXT_INSTANCE__:void 0,o=n!=null?n:new ye.Context({manifest:{project:{}}}),[i,a]=R.useState({data:o.storage.data,manifest:o.manifest.data,scores:o.scores,personalizations:[],tests:[]}),[l,p]=R.useState(r!=null?r:{});R.useEffect(()=>{var d;let s=(0,ye.createDebugConsoleLogDrain)((d=l.logLevel)!=null?d:"none");return o.events.on("log",s),()=>{o.events.off("log",s)}},[l,o]),R.useEffect(()=>{let s=()=>{let v=window.localStorage.getItem(Ve)||"{}",f=JSON.parse(v),y=pe({quirks:o.storage.data.quirks,quirkOverrides:f.quirkOverrides});y&&(console.log("Applying overridden quirks:",y),o.update({quirks:y}));let C=_({scores:o.scores,scoreOverrides:f.scoreOverrides});C.length&&(console.log("Applying overridden scores:",C),o.storage.updateData(C)),a(w=>({...w,scores:o.scores,data:o.storage.data,manifest:o.manifest.data}))},d=v=>{!v.changed||a(f=>({...f,personalizations:[...f.personalizations,v]}))},c=v=>{!v.variantAssigned||a(f=>({...f,tests:[...f.tests,v]}))};return o.events.on("personalizationResult",d),o.events.on("testResult",c),o.storage.events.on("*",s),()=>{o.storage.events.off("*",s),o.events.off("personalizationResult",d),o.events.off("testResult",c)}},[o]),R.useEffect(()=>{if(window.localStorage){let s=window.localStorage.getItem(Ve);if(s)try{let d=JSON.parse(s),c={...r,...d};p(c);let v=_({scores:i.scores,scoreOverrides:c.scoreOverrides});m.rawUpdate(v)}catch(d){window.localStorage.removeItem(Ve),console.error("Failed to parse settings from localStorage: ",d.message)}}},[]);let{actions:m,saveSettings:u}=R.useMemo(()=>({actions:{update:c=>o.update(c),forget:()=>o.forget(!1),rawUpdate:c=>o.storage.updateData(c)},saveSettings:async c=>{p(c),window.localStorage&&window.localStorage.setItem("embeddedUniformDevToolsSettings",JSON.stringify(c))}}),[o]);return n?(0,e.jsx)(Re,{state:i,actions:m,settings:l,saveSettings:u}):(0,e.jsx)("p",null,"Unable to find Uniform Context. Ensure the devtools plugin is activated.")}var Vt=require("@emotion/react"),It=x(require("react"));var Pt=require("@uniformdev/design-system");var xt=require("@emotion/react"),ro=xt.css`
882
459
  align-items: center;
883
460
  border-radius: var(--rounded-full);
884
461
  background: var(--brand-secondary-5);
@@ -904,11 +481,11 @@ summary {
904
481
  max-width: 100%;
905
482
  height: auto;
906
483
  }
907
- `,At=({...t})=>(0,e.jsx)("button",{type:"button",css:co,...t},(0,e.jsx)("span",{hidden:!0},"Uniform devtools"),(0,e.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,e.jsx)("path",{d:"M13.325 3.05011L8.66741 20.4323L10.5993 20.9499L15.2568 3.56775L13.325 3.05011Z",fill:"currentColor"}),(0,e.jsx)("path",{d:"M7.61197 18.3608L8.97136 16.9124L8.97086 16.8933L3.87657 12.1121L8.66699 7.00798L7.20868 5.63928L1.04956 12.2017L7.61197 18.3608Z",fill:"currentColor"}),(0,e.jsx)("path",{d:"M16.388 18.3608L15.0286 16.9124L15.0291 16.8933L20.1234 12.1121L15.333 7.00798L16.7913 5.63928L22.9504 12.2017L16.388 18.3608Z",fill:"currentColor"})));function lo(t){var i;let[r,n]=zt.useState(!1);return((i=t.context)!=null?i:typeof window!="undefined"?window.__UNIFORM_DEVTOOLS_CONTEXT_INSTANCE__:void 0)?(0,e.jsx)("div",null,(0,e.jsx)(ye,null),(0,e.jsx)(At,{onClick:()=>n(a=>!a)}),r?(0,e.jsx)("div",{css:Et.css`
484
+ `,Rt=({...t})=>(0,e.jsx)("button",{type:"button",css:ro,...t},(0,e.jsx)("span",{hidden:!0},"Uniform devtools"),(0,e.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,e.jsx)("path",{d:"M13.325 3.05011L8.66741 20.4323L10.5993 20.9499L15.2568 3.56775L13.325 3.05011Z",fill:"currentColor"}),(0,e.jsx)("path",{d:"M7.61197 18.3608L8.97136 16.9124L8.97086 16.8933L3.87657 12.1121L8.66699 7.00798L7.20868 5.63928L1.04956 12.2017L7.61197 18.3608Z",fill:"currentColor"}),(0,e.jsx)("path",{d:"M16.388 18.3608L15.0286 16.9124L15.0291 16.8933L20.1234 12.1121L15.333 7.00798L16.7913 5.63928L22.9504 12.2017L16.388 18.3608Z",fill:"currentColor"})));function no(t){var i;let[r,n]=It.useState(!1);return((i=t.context)!=null?i:typeof window!="undefined"?window.__UNIFORM_DEVTOOLS_CONTEXT_INSTANCE__:void 0)?(0,e.jsx)("div",null,(0,e.jsx)(Pt.Theme,null),(0,e.jsx)(fe,null),(0,e.jsx)(Rt,{onClick:()=>n(a=>!a)}),r?(0,e.jsx)("div",{css:Vt.css`
908
485
  box-shadow: var(--shadow-base);
909
486
  position: fixed;
910
487
  bottom: 82px;
911
488
  right: var(--spacing-base);
912
489
  z-index: var(--z-10);
913
490
  max-width: var(--site-width);
914
- `},(0,e.jsx)(Me,{...t})):null):(0,e.jsx)("p",null,"Unable to find Uniform Context. Ensure the devtools plugin is activated.")}0&&(module.exports={ContextDevTools,EmbeddedContextDevTools,ToggleEmbeddedContextDevTools});
491
+ `},(0,e.jsx)(Ie,{...t})):null):(0,e.jsx)("p",null,"Unable to find Uniform Context. Ensure the devtools plugin is activated.")}0&&(module.exports={ContextDevTools,EmbeddedContextDevTools,ToggleEmbeddedContextDevTools});