@uniformdev/context-devtools 17.5.1-alpha.7 → 17.6.1-alpha.60
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/dist/esm/index.js +207 -207
- package/dist/index.d.ts +1 -1
- package/dist/index.js +205 -205
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1,10 +1,66 @@
|
|
|
1
|
-
"use strict";var to=Object.create;var me=Object.defineProperty;var oo=Object.getOwnPropertyDescriptor;var ro=Object.getOwnPropertyNames;var no=Object.getPrototypeOf,io=Object.prototype.hasOwnProperty;var so=(e,o)=>{for(var r in o)me(e,r,{get:o[r],enumerable:!0})},et=(e,o,r,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of ro(o))!io.call(e,n)&&n!==r&&me(e,n,{get:()=>o[n],enumerable:!(t=oo(o,n))||t.enumerable});return e};var F=(e,o,r)=>(r=e!=null?to(no(e)):{},et(o||!e||!e.__esModule?me(r,"default",{value:e,enumerable:!0}):r,e)),ao=e=>et(me({},"__esModule",{value:!0}),e);var Qo={};so(Qo,{ContextDevTools:()=>Ye,EmbeddedContextDevTools:()=>Xe,ToggleEmbeddedContextDevTools:()=>Bo});module.exports=ao(Qo);var u=require("@emotion/react"),y=F(require("react"));var
|
|
1
|
+
"use strict";var to=Object.create;var me=Object.defineProperty;var oo=Object.getOwnPropertyDescriptor;var ro=Object.getOwnPropertyNames;var no=Object.getPrototypeOf,io=Object.prototype.hasOwnProperty;var so=(e,o)=>{for(var r in o)me(e,r,{get:o[r],enumerable:!0})},et=(e,o,r,t)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of ro(o))!io.call(e,n)&&n!==r&&me(e,n,{get:()=>o[n],enumerable:!(t=oo(o,n))||t.enumerable});return e};var F=(e,o,r)=>(r=e!=null?to(no(e)):{},et(o||!e||!e.__esModule?me(r,"default",{value:e,enumerable:!0}):r,e)),ao=e=>et(me({},"__esModule",{value:!0}),e);var Qo={};so(Qo,{ContextDevTools:()=>Ye,EmbeddedContextDevTools:()=>Xe,ToggleEmbeddedContextDevTools:()=>Bo});module.exports=ao(Qo);var u=require("@emotion/react"),y=F(require("react"));var We=require("@emotion/react"),Wt=require("@uniformdev/design-system");var K=require("@uniformdev/context/api"),tt=F(require("react")),ot=require("react-use");function rt({apiHost:e,apiKey:o,projectId:r},t){let{loading:n,error:s,value:l}=(0,ot.useAsync)(async()=>{if(!o||!r)return d;let m=(await new K.UncachedDimensionClient({projectId:r,apiKey:o,apiHost:e||void 0}).get()).dimensions,i={};return m.map(a=>{var c,f,g,h,C,T,D,G;if(i[a.dim]={...(0,K.computeDimensionDefinitionDisplayData)(a),cap:a.cap,str:(h=(g=(f=(c=t==null?void 0:t.project.pz)==null?void 0:c.sig)==null?void 0:f[a.dim])==null?void 0:g.str)!=null?h:50},i[a.dim].type==="Enrichment"){let $=a.dim.split("_")[0];i[a.dim].cap=(G=(D=(T=(C=t==null?void 0:t.project.pz)==null?void 0:C.enr)==null?void 0:T[$])==null?void 0:D.cap)!=null?G:100}}),i},[e,o,r]),d=tt.useMemo(()=>{var m,i,a,c;let p={};return t&&(Object.entries((i=(m=t==null?void 0:t.project.pz)==null?void 0:m.sig)!=null?i:{}).map(([f,g])=>{let h=(0,K.computeDimensionDisplayData)(f,t);h&&(p[f]={...g,...h})}),Object.entries((c=(a=t==null?void 0:t.project.pz)==null?void 0:a.enr)!=null?c:{}).map(([f,g])=>{var T;let h=(0,K.computeDimensionDisplayData)(f,t),C={cap:(T=g.cap)!=null?T:100,str:10};h&&(p[f]={...h,cap:C.cap,str:C.str})}),l&&Object.entries(l).map(([f,g])=>{p[f]={...p[f],...g}})),p},[t,l]);return{loading:n,error:s,index:d}}var nt=require("@uniformdev/context/api"),it=require("react"),st=require("react-use");function at({apiHost:e,apiKey:o,projectId:r},t){let{loading:n,error:s,value:l}=(0,st.useAsync)(async()=>{if(!o||!r)return{};let m=await new nt.UncachedQuirkClient({projectId:r,apiKey:o,apiHost:e||void 0}).get(),i={};return m.quirks.map(a=>{i[a.id]={...a,value:t[a.id]}}),i},[e,o,r]),d=(0,it.useMemo)(()=>{let p={};return Object.entries(t).map(([m,i])=>p[m]={value:i,id:m,name:m}),l&&Object.entries(l).map(([m,i])=>p[m]={...i,value:t[m]}),p},[t,l]);return{loading:n,error:s,index:d}}var ue=require("react"),co=require("@emotion/react/jsx-runtime"),ct=(0,ue.createContext)({settings:{},saveSettings:()=>{}}),ge=()=>(0,ue.useContext)(ct),lt=({children:e,settings:o,saveSettings:r})=>(0,co.jsx)(ct.Provider,{value:{settings:o,saveSettings:r},children:e});var lo=require("@emotion/react/jsx-runtime");function ve(){return(0,lo.jsx)("style",{children:`
|
|
2
|
+
:root {
|
|
3
|
+
--site-width: 700px;
|
|
4
|
+
|
|
5
|
+
/* Red CTA */
|
|
6
|
+
--red-button: rgb(217 83 79);
|
|
7
|
+
--red-tooltip: #D9534F;
|
|
8
|
+
|
|
9
|
+
--min-height: 450px;
|
|
10
|
+
}
|
|
11
|
+
`})}var Ne=require("@uniformdev/design-system");var W=require("@emotion/react"),fe=W.css`
|
|
12
|
+
background-color: var(--gray-100);
|
|
13
|
+
padding: var(--spacing-base) var(--spacing-md);
|
|
14
|
+
margin: var(--spacing-base) 0;
|
|
15
|
+
position: relative;
|
|
16
|
+
&:first-of-type {
|
|
17
|
+
margin: 0 0 var(--spacing-base);
|
|
18
|
+
}
|
|
19
|
+
`,dt=W.css`
|
|
20
|
+
background: var(--gray-100)
|
|
21
|
+
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")
|
|
22
|
+
no-repeat var(--spacing-sm) var(--spacing-base);
|
|
23
|
+
padding: var(--spacing-base) var(--spacing-xl);
|
|
24
|
+
`,he=W.css`
|
|
25
|
+
color: var(--brand-secondary-1);
|
|
26
|
+
margin: 0;
|
|
27
|
+
font-size: var(--fs-base);
|
|
28
|
+
font-weight: var(--fw-bold);
|
|
29
|
+
`,be=W.css`
|
|
30
|
+
color: var(--brand-secondary-1);
|
|
31
|
+
margin: var(--spacing-xs) 0 0;
|
|
32
|
+
font-size: var(--fs-sm);
|
|
33
|
+
`,pt=W.css`
|
|
34
|
+
align-items: center;
|
|
35
|
+
border: none;
|
|
36
|
+
background: transparent
|
|
37
|
+
url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6.2253 4.81108C5.83477 4.42056 5.20161 4.42056 4.81108 4.81108C4.42056 5.20161 4.42056 5.83477 4.81108 6.2253L10.5858 12L4.81114 17.7747C4.42062 18.1652 4.42062 18.7984 4.81114 19.1889C5.20167 19.5794 5.83483 19.5794 6.22535 19.1889L12 13.4142L17.7747 19.1889C18.1652 19.5794 18.7984 19.5794 19.1889 19.1889C19.5794 18.7984 19.5794 18.1652 19.1889 17.7747L13.4142 12L19.189 6.2253C19.5795 5.83477 19.5795 5.20161 19.189 4.81108C18.7985 4.42056 18.1653 4.42056 17.7748 4.81108L12 10.5858L6.2253 4.81108Z' fill='%232ecdb4' /%3E%3C/svg%3E")
|
|
38
|
+
no-repeat center center;
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
color: var(--brand-secondary-3);
|
|
41
|
+
display: flex;
|
|
42
|
+
padding: 0;
|
|
43
|
+
position: absolute;
|
|
44
|
+
width: 24px;
|
|
45
|
+
height: 24px;
|
|
46
|
+
top: var(--spacing-base);
|
|
47
|
+
right: var(--spacing-sm);
|
|
48
|
+
transition: opacity 0.2s ease-in-out;
|
|
49
|
+
|
|
50
|
+
&:hover {
|
|
51
|
+
opacity: 0.6;
|
|
52
|
+
}
|
|
53
|
+
`,xe=W.css`
|
|
54
|
+
display: flex;
|
|
55
|
+
margin: var(--spacing-sm) 0 0;
|
|
56
|
+
gap: var(--spacing-base);
|
|
57
|
+
`;var B=require("@emotion/react/jsx-runtime"),Ze=({settings:e,saveSettings:o})=>{let r=()=>{o({...e,route:"/connect"})},t=()=>{o({...e,ignoreApiKeyPrompt:!0})},n=e.route==="/connect",s=!(e!=null&&e.apiKey);return!e.ignoreApiKeyPrompt&&s&&!n?(0,B.jsxs)("div",{css:[fe,dt],children:[(0,B.jsx)("h2",{css:he,children:"Connect to a Uniform Project"}),(0,B.jsx)("p",{css:be,children:"This allows reading human-readable labels for the dimensions."}),(0,B.jsxs)("div",{css:xe,children:[(0,B.jsx)(Ne.Button,{buttonType:"secondary",onClick:r,children:"Connect this site"}),(0,B.jsx)(Ne.Button,{buttonType:"ghost",onClick:t,children:"Skip for now"})]}),(0,B.jsx)("button",{type:"button",css:pt,title:"close",onClick:t,children:(0,B.jsx)("span",{hidden:!0,children:"Close"})})]}):null};var E=require("@emotion/react");var mt=require("@emotion/react"),po=require("@emotion/react/jsx-runtime"),ut=()=>{var r;let e=typeof chrome!="undefined"&&typeof chrome.storage!="undefined"&&((r=chrome==null?void 0:chrome.runtime)==null?void 0:r.getManifest()),o=e?e==null?void 0:e.version:"DEV";return(0,po.jsx)("div",{css:mt.css`
|
|
2
58
|
font-size: var(--fs-sm);
|
|
3
59
|
color: var(--gray-400);
|
|
4
60
|
position: absolute;
|
|
5
61
|
bottom: 2px;
|
|
6
62
|
right: 5px;
|
|
7
|
-
`,children:`v${o}`})};var
|
|
63
|
+
`,children:`v${o}`})};var uo=require("@emotion/react/jsx-runtime"),mo=({route:e,children:o,className:r})=>{let{settings:t,saveSettings:n}=ge();return(0,uo.jsx)("a",{href:"",className:r,onClick:s=>{s.preventDefault(),n({...t,route:e})},children:o})},oe=mo;var w=require("@emotion/react/jsx-runtime"),go=[{title:"Dimensions",href:"/dimensions",icon:`<svg
|
|
8
64
|
width="24"
|
|
9
65
|
height="24"
|
|
10
66
|
viewBox="0 0 24 24"
|
|
@@ -42,11 +98,11 @@
|
|
|
42
98
|
</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">
|
|
43
99
|
<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"/>
|
|
44
100
|
</svg>
|
|
45
|
-
`}],
|
|
101
|
+
`}],vo=`<svg width="24" height="24" fill="white" viewBox="0 0 122.88 116.67" xmlns="http://www.w3.org/2000/svg">
|
|
46
102
|
<g>
|
|
47
103
|
<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>
|
|
48
104
|
</g>
|
|
49
|
-
</svg>`,
|
|
105
|
+
</svg>`,gt=({...e})=>{var t,n;let o=s=>{var d;let l="active";return!((d=e.settings)!=null&&d.route)&&s==="/dimensions"||e.settings.route===s?l:""},r=Boolean(typeof window!="undefined"&&((n=(t=window.chrome)==null?void 0:t.runtime)==null?void 0:n.id));return(0,w.jsxs)("nav",{css:E.css`
|
|
50
106
|
background: var(--brand-secondary-1);
|
|
51
107
|
padding: var(--spacing-base) var(--spacing-base) var(--spacing-md);
|
|
52
108
|
min-width: 200px;
|
|
@@ -64,7 +120,7 @@
|
|
|
64
120
|
margin: 0;
|
|
65
121
|
list-style-type: none;
|
|
66
122
|
flex-grow: 1;
|
|
67
|
-
`,children:
|
|
123
|
+
`,children:go.map((s,l)=>{var p,m,i,a;let d=0;return s.href==="/overrides"&&Object.keys((p=e.settings.scoreOverrides)!=null?p:{}).length>0&&(d=Object.keys((m=e.settings.scoreOverrides)!=null?m:{}).length),s.href==="/quirks"&&Object.keys((i=e.settings.quirkOverrides)!=null?i:{}).length>0&&(d=Object.keys((a=e.settings.quirkOverrides)!=null?a:{}).length),(0,w.jsx)("li",{css:E.css`
|
|
68
124
|
padding: 0;
|
|
69
125
|
margin: 0;
|
|
70
126
|
list-style-type: none;
|
|
@@ -116,11 +172,11 @@
|
|
|
116
172
|
`,rel:"noreferrer",children:[(0,w.jsx)("i",{css:E.css`
|
|
117
173
|
align-items: center;
|
|
118
174
|
display: flex;
|
|
119
|
-
`,dangerouslySetInnerHTML:{__html:
|
|
175
|
+
`,dangerouslySetInnerHTML:{__html:vo}}),"Install Chrome Extension"]}),(0,w.jsx)(ut,{})]})};var Ht=require("@uniformdev/design-system"),X=require("formik"),ie=F(require("yup"));function ce({scores:e,scoreOverrides:o}){let r=[];return o?(Object.entries(o).forEach(([t,n])=>{var d;let s=(d=e[t])!=null?d:0;if(s===n.override)return;let l=n.override-s;r.push({type:"modscoreS",data:{dimension:t,delta:l}})}),r):[]}function ye({quirks:e,quirkOverrides:o}){let r={};if(!!o)return Object.entries(o).forEach(([t,n])=>{e[t]!==n.override&&(r[t]=n.override)}),Object.keys(r).length>0?r:void 0}var Ce=require("@uniformdev/context");function vt({manifest:e,visitor:o,override:r}){let t=new Ce.Context({manifest:e,transitionStore:new ze({initialData:o})}),n={...t.scores};t.storage.updateData([r]);let l={...{...t.scores}};return Object.entries(l).forEach(([d,p])=>{n[d]===p&&delete l[d]}),l}var ze=class extends Ce.TransitionDataStore{async handleDelete(){}async handleUpdateData(){}};var Y=require("@emotion/react"),ft=F(require("react")),H=require("@emotion/react/jsx-runtime"),ht=(0,Y.css)({willChange:"height"}),fo=Y.css`
|
|
120
176
|
border-bottom: 2px solid var(--brand-secondary-1);
|
|
121
177
|
font-size: var(--fs-base);
|
|
122
178
|
margin: 0;
|
|
123
|
-
`,
|
|
179
|
+
`,ho=Y.css`
|
|
124
180
|
align-items: center;
|
|
125
181
|
border: none;
|
|
126
182
|
background: none;
|
|
@@ -130,59 +186,141 @@
|
|
|
130
186
|
padding: var(--spacing-sm) 0;
|
|
131
187
|
font-weight: var(--fw-bold);
|
|
132
188
|
justify-content: space-between;
|
|
133
|
-
`,
|
|
189
|
+
`,bo=Y.css`
|
|
134
190
|
align-self: center;
|
|
135
|
-
`,
|
|
191
|
+
`,xo=Y.css`
|
|
136
192
|
transform: rotate(-180deg);
|
|
137
|
-
`,
|
|
193
|
+
`,we=({children:e})=>(0,H.jsx)("div",{css:[ht],children:e}),ke=({title:e,children:o})=>{let[r,t]=ft.useState(!1),n=e.split(" ").join("-").toLocaleLowerCase();return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)("h3",{css:fo,children:(0,H.jsxs)("button",{"aria-expanded":r,css:ho,title:e,id:n,"aria-controls":`${n}-section`,onClick:()=>t(s=>!s),type:"button",children:[e,(0,H.jsx)("i",{css:[bo,r?xo:void 0],children:(0,H.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,H.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,H.jsx)("div",{id:`${n}-section`,css:[ht,Y.css`
|
|
138
194
|
padding: var(--spacing-sm) 0;
|
|
139
|
-
`],role:"region","aria-labelledby":n,children:r?o:null})]})};var
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
195
|
+
`],role:"region","aria-labelledby":n,children:r?o:null})]})};var bt=require("@emotion/react"),yo=require("@emotion/react/jsx-runtime"),q=({children:e,...o})=>(0,yo.jsx)("fieldset",{css:bt.css`
|
|
196
|
+
border: none;
|
|
197
|
+
padding: 0;
|
|
198
|
+
& legend {
|
|
199
|
+
margin-bottom: var(--spacing-base);
|
|
200
|
+
}
|
|
201
|
+
`,...o,children:e});var xt=require("@emotion/react"),Co=require("@emotion/react/jsx-runtime"),re=({children:e})=>(0,Co.jsx)("legend",{css:xt.css`
|
|
202
|
+
font-size: var(--fs-md);
|
|
203
|
+
font-weight: var(--fw-bold);
|
|
204
|
+
border-bottom: 1px solid var(--gray-400);
|
|
205
|
+
width: 100%;
|
|
206
|
+
`,children:e});var Te=require("@uniformdev/design-system");var wo=require("@emotion/react/jsx-runtime"),Ue=e=>({field:o,form:r,meta:t,...n})=>(0,wo.jsx)(e,{...o,...n,errorMessage:r.errors[o.name]});var De=Ue(Te.Input),yt=Ue(Te.InputSelect);var Se=require("@uniformdev/design-system");var N=require("@emotion/react"),Ct=N.css`
|
|
207
|
+
background: var(--white);
|
|
208
|
+
border: 1px solid var(--gray-500);
|
|
209
|
+
border-radius: var(--rounded-base);
|
|
210
|
+
color: var(--brand-secondary-1);
|
|
211
|
+
padding: var(--spacing-base);
|
|
212
|
+
|
|
213
|
+
&:disabled {
|
|
214
|
+
cursor: not-allowed;
|
|
215
|
+
color: var(--gray-200);
|
|
146
216
|
}
|
|
147
|
-
`,
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
no-repeat var(--spacing-sm) var(--spacing-base);
|
|
151
|
-
padding: var(--spacing-base) var(--spacing-xl);
|
|
152
|
-
`,xe=W.css`
|
|
217
|
+
`,yr=N.css`
|
|
218
|
+
margin: var(--spacing-base) 0;
|
|
219
|
+
`,wt=N.css`
|
|
153
220
|
color: var(--brand-secondary-1);
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
`,
|
|
221
|
+
display: flex;
|
|
222
|
+
flex-direction: column;
|
|
223
|
+
margin: 0 0 var(--spacing-sm);
|
|
224
|
+
`,kt=N.css`
|
|
158
225
|
color: var(--brand-secondary-1);
|
|
159
|
-
|
|
226
|
+
display: block;
|
|
227
|
+
flex: 1 100%;
|
|
228
|
+
font-weight: var(--fw-bold);
|
|
229
|
+
margin: 0 0 var(--spacing-sm);
|
|
230
|
+
`,Cr=N.css`
|
|
231
|
+
color: var(--gray-600);
|
|
160
232
|
font-size: var(--fs-sm);
|
|
161
|
-
`,
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
cursor: pointer;
|
|
168
|
-
color: var(--brand-secondary-3);
|
|
169
|
-
display: flex;
|
|
170
|
-
padding: 0;
|
|
171
|
-
position: absolute;
|
|
172
|
-
width: 24px;
|
|
173
|
-
height: 24px;
|
|
174
|
-
top: var(--spacing-base);
|
|
175
|
-
right: var(--spacing-sm);
|
|
176
|
-
transition: opacity 0.2s ease-in-out;
|
|
233
|
+
`,wr=N.css`
|
|
234
|
+
color: var(--brand-secondary-5);
|
|
235
|
+
display: block;
|
|
236
|
+
`,Tt=N.css`
|
|
237
|
+
flex-direction: row;
|
|
238
|
+
flex-wrap: wrap;
|
|
177
239
|
|
|
178
|
-
|
|
179
|
-
|
|
240
|
+
input[type='range'] {
|
|
241
|
+
height: 28px;
|
|
242
|
+
-webkit-appearance: none;
|
|
243
|
+
margin: 10px 0;
|
|
244
|
+
width: 100%;
|
|
245
|
+
flex: 1 0 80%;
|
|
180
246
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
247
|
+
|
|
248
|
+
input[type='range']:focus {
|
|
249
|
+
outline: none;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
input[type='range']::-webkit-slider-runnable-track {
|
|
253
|
+
width: 100%;
|
|
254
|
+
height: 6px;
|
|
255
|
+
cursor: pointer;
|
|
256
|
+
animate: 0.2s;
|
|
257
|
+
box-shadow: 0 0 0 #000000;
|
|
258
|
+
background: #2ecdb4;
|
|
259
|
+
border-radius: 0;
|
|
260
|
+
border: 0 solid #000000;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
input[type='range']::-moz-range-track {
|
|
264
|
+
width: 100%;
|
|
265
|
+
height: 6px;
|
|
266
|
+
cursor: pointer;
|
|
267
|
+
animate: 0.2s;
|
|
268
|
+
box-shadow: 0 0 0 #000000;
|
|
269
|
+
background: #2ecdb4;
|
|
270
|
+
border-radius: 0;
|
|
271
|
+
border: 0 solid #000000;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
input[type='range']::-webkit-slider-thumb {
|
|
275
|
+
box-shadow: 1px 1px 2px #000000;
|
|
276
|
+
border: 1px solid #000000;
|
|
277
|
+
height: 20px;
|
|
278
|
+
width: 20px;
|
|
279
|
+
border-radius: 20px;
|
|
280
|
+
background: #ffffff;
|
|
281
|
+
cursor: pointer;
|
|
282
|
+
-webkit-appearance: none;
|
|
283
|
+
margin-top: -7.5px;
|
|
284
|
+
}
|
|
285
|
+
input[type='range']::-moz-range-thumb {
|
|
286
|
+
box-shadow: 1px 1px 2px #000000;
|
|
287
|
+
border: 1px solid #000000;
|
|
288
|
+
height: 20px;
|
|
289
|
+
width: 20px;
|
|
290
|
+
border-radius: 20px;
|
|
291
|
+
background: #ffffff;
|
|
292
|
+
cursor: pointer;
|
|
293
|
+
-webkit-appearance: none;
|
|
294
|
+
margin-top: -7.5px;
|
|
295
|
+
}
|
|
296
|
+
input[type='range']:focus::-webkit-slider-runnable-track {
|
|
297
|
+
background: #2ecdb4;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.value-display {
|
|
301
|
+
flex: 1 0 20%;
|
|
302
|
+
padding: 10px;
|
|
303
|
+
}
|
|
304
|
+
`;var Z=require("@emotion/react/jsx-runtime"),Dt=({field:e,form:o,meta:r,...t})=>{var m,i;let{label:n,caption:s,min:l=0,max:d=100,step:p}=t;return(0,Z.jsxs)("div",{children:[(0,Z.jsxs)("label",{css:[wt,Tt],children:[(0,Z.jsx)("span",{css:kt,children:n}),(0,Z.jsx)("input",{type:"range",min:l,max:d,step:p,...e,value:(m=e.value)!=null?m:0}),(0,Z.jsx)("span",{className:"value-display",children:(i=e.value)!=null?i:0})]}),s?(0,Z.jsx)(Se.Caption,{children:s}):null,o.touched[e.name]&&o.errors[e.name]?(0,Z.jsx)(Se.ErrorMessage,{message:o.errors[e.name]}):null]})};var Lt=require("@emotion/react"),Do=require("@emotion/react/jsx-runtime"),ko=`<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
305
|
+
<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"/>
|
|
306
|
+
<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"/>
|
|
307
|
+
<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"/>
|
|
308
|
+
</svg>`,To=`<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
309
|
+
<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"/>
|
|
310
|
+
<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"/>
|
|
311
|
+
<path d="M11.9999 5.05762H8.3999V6.2576H11.9999V5.05762Z" fill="#828282"/>
|
|
312
|
+
<path d="M8.3999 7.45752H11.9999V8.6575H8.3999V7.45752Z" fill="#828282"/>
|
|
313
|
+
<path d="M11.9999 2.65771H8.3999V3.8577H11.9999V2.65771Z" fill="#828282"/>
|
|
314
|
+
</svg>`,St=`<svg width="15" height="11" viewBox="0 0 15 11" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
315
|
+
<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"/>
|
|
316
|
+
<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"/>
|
|
317
|
+
<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"/>
|
|
318
|
+
<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"/>
|
|
319
|
+
<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"/>
|
|
320
|
+
</svg>`,Ot=({type:e})=>{let o="";switch(e){case"Audience":o=ko;break;case"Signal":o=St;break;case"Intent":o=St;break;case"Enrichment":o=To;break}return(0,Do.jsx)("i",{css:Lt.css`
|
|
321
|
+
align-items: center;
|
|
322
|
+
display: inline-block;
|
|
323
|
+
`,dangerouslySetInnerHTML:{__html:o}})};var P=require("@emotion/react"),So=P.keyframes`from {
|
|
186
324
|
transform: scale(1);
|
|
187
325
|
}
|
|
188
326
|
to {
|
|
@@ -222,7 +360,7 @@ to {
|
|
|
222
360
|
position: absolute;
|
|
223
361
|
right: var(--spacing-base);
|
|
224
362
|
bottom: var(--spacing-base);
|
|
225
|
-
animation: 0.5s 2 alternate ${
|
|
363
|
+
animation: 0.5s 2 alternate ${So};
|
|
226
364
|
`,cancelButton:P.css`
|
|
227
365
|
position: absolute;
|
|
228
366
|
left: calc(200px + var(--spacing-base));
|
|
@@ -238,47 +376,47 @@ to {
|
|
|
238
376
|
input {
|
|
239
377
|
padding: var(--spacing-sm);
|
|
240
378
|
}
|
|
241
|
-
`};var A=require("@emotion/react"),ne=require("@emotion/react/jsx-runtime"),
|
|
379
|
+
`};var A=require("@emotion/react"),ne=require("@emotion/react/jsx-runtime"),Le=({children:e})=>(0,ne.jsx)("table",{css:A.css`
|
|
242
380
|
border-collapse: collapse;
|
|
243
381
|
display: table;
|
|
244
382
|
width: 100%;
|
|
245
383
|
font-size: var(--fs-sm);
|
|
246
|
-
`,children:e}),
|
|
384
|
+
`,children:e}),Rt=({children:e})=>(0,ne.jsx)("thead",{css:A.css`
|
|
247
385
|
background: var(--gray-50);
|
|
248
386
|
text-align: left;
|
|
249
387
|
& tr {
|
|
250
388
|
border-bottom: 1px solid var(--gray-200);
|
|
251
389
|
}
|
|
252
|
-
`,children:e}),
|
|
390
|
+
`,children:e}),Oe=({children:e})=>(0,ne.jsx)("tbody",{children:e}),le=({border:e,children:o})=>(0,ne.jsx)("tr",{css:e?A.css`
|
|
253
391
|
border-bottom: 1px solid var(--gray-200);
|
|
254
392
|
&:where(:last-child) {
|
|
255
393
|
border: none;
|
|
256
394
|
}
|
|
257
|
-
`:void 0,children:o}),
|
|
395
|
+
`:void 0,children:o}),Re=({children:e,width:o})=>(0,ne.jsx)("th",{css:A.css`
|
|
258
396
|
outline: none;
|
|
259
397
|
padding: var(--spacing-sm);
|
|
260
398
|
width: ${o!=null?o:"auto"};
|
|
261
|
-
`,children:e});function
|
|
399
|
+
`,children:e});function Lo(e){switch(e){case"light":return A.css`
|
|
262
400
|
color: var(--gray-400);
|
|
263
401
|
`;case"dark":return A.css`
|
|
264
402
|
color: var(--brand-secondary-1);
|
|
265
|
-
`}}function
|
|
403
|
+
`}}function Oo(e){return A.css`
|
|
266
404
|
text-align: ${e};
|
|
267
|
-
`}var
|
|
405
|
+
`}var z=({alignment:e="left",border:o,color:r="dark",children:t})=>(0,ne.jsx)("td",{css:[A.css`
|
|
268
406
|
padding: var(--spacing-base);
|
|
269
407
|
max-width: 180px;
|
|
270
408
|
overflow-wrap: break-word;
|
|
271
409
|
position: relative;
|
|
272
|
-
`,
|
|
410
|
+
`,Lo(r),Oo(e),o?A.css`
|
|
273
411
|
border-left: 1px solid var(--gray-200);
|
|
274
|
-
`:void 0],children:t});var
|
|
412
|
+
`:void 0],children:t});var Ve=require("@emotion/react"),Vt=Ve.css`
|
|
275
413
|
position: relative;
|
|
276
414
|
display: inline-block;
|
|
277
415
|
font-size: var(--fs-base);
|
|
278
|
-
`,
|
|
416
|
+
`,Pt=Ve.css`
|
|
279
417
|
display: block;
|
|
280
418
|
text-decoration: line-through;
|
|
281
|
-
`,
|
|
419
|
+
`,It=Ve.css`
|
|
282
420
|
position: absolute;
|
|
283
421
|
width: 6px;
|
|
284
422
|
height: 6px;
|
|
@@ -286,145 +424,7 @@ to {
|
|
|
286
424
|
top: 9px;
|
|
287
425
|
background: var(--red-tooltip);
|
|
288
426
|
border-radius: 3px;
|
|
289
|
-
`;var ft=require("@emotion/react"),To=require("@emotion/react/jsx-runtime"),wo=`<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
290
|
-
<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"/>
|
|
291
|
-
<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"/>
|
|
292
|
-
<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"/>
|
|
293
|
-
</svg>`,ko=`<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
294
|
-
<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"/>
|
|
295
|
-
<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"/>
|
|
296
|
-
<path d="M11.9999 5.05762H8.3999V6.2576H11.9999V5.05762Z" fill="#828282"/>
|
|
297
|
-
<path d="M8.3999 7.45752H11.9999V8.6575H8.3999V7.45752Z" fill="#828282"/>
|
|
298
|
-
<path d="M11.9999 2.65771H8.3999V3.8577H11.9999V2.65771Z" fill="#828282"/>
|
|
299
|
-
</svg>`,vt=`<svg width="15" height="11" viewBox="0 0 15 11" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
300
|
-
<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"/>
|
|
301
|
-
<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"/>
|
|
302
|
-
<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"/>
|
|
303
|
-
<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"/>
|
|
304
|
-
<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"/>
|
|
305
|
-
</svg>`,ht=({type:e})=>{let o="";switch(e){case"Audience":o=wo;break;case"Signal":o=vt;break;case"Intent":o=vt;break;case"Enrichment":o=ko;break}return(0,To.jsx)("i",{css:ft.css`
|
|
306
|
-
align-items: center;
|
|
307
|
-
display: inline-block;
|
|
308
|
-
`,dangerouslySetInnerHTML:{__html:o}})};var O=require("@emotion/react/jsx-runtime"),Do=({dimensionIndex:e,dimensions:o,disableEditOverride:r,onClick:t,preemptiveOverrides:n})=>{var d;let{settings:s}=ge(),l=(d=n!=null?n:s.scoreOverrides)!=null?d:{};return(0,O.jsx)(we,{children:(0,O.jsx)(ke,{children:Object.entries(o).sort(([p],[m])=>p.localeCompare(m)).map(([p,m])=>{var h;let{dim:i,name:a,type:c,category:f}=(h=e[p])!=null?h:{name:p,dim:p,type:void 0,category:void 0},g=l[i];return(0,O.jsxs)(le,{children:[(0,O.jsxs)(q,{children:[g!==void 0?(0,O.jsx)("s",{css:ut,children:g.initial}):null,(0,O.jsxs)("b",{css:mt,children:[m,g!==void 0&&(0,O.jsx)("i",{css:gt})]})]}),(0,O.jsx)(q,{children:(0,O.jsxs)("div",{onClick:()=>t==null?void 0:t(i),css:t?{cursor:"pointer"}:void 0,children:[(0,O.jsx)("span",{css:b.divider,role:"presentation"}),(0,O.jsxs)("div",{children:[(0,O.jsx)(ht,{type:c})," ",c]}),(0,O.jsxs)("strong",{children:[f?`${f}:`:""," ",a]})]})}),(0,O.jsx)(q,{alignment:"right",color:"light",children:g!==void 0&&!r?(0,O.jsx)(oe,{route:`/overrides/${i}`,children:"Edit override"}):null})]},i)})})})},Y=Do;async function Se({actions:e,saveSettings:o,scores:r,settings:t}){var d,p;let n=(d=t.scoreOverrides)!=null?d:{},s={...n},l=[];for(let m of Object.keys(n)){let i=n==null?void 0:n[m];delete s[m],l.push({type:"modscoreS",data:{dimension:m,delta:i.initial-((p=r[m])!=null?p:0)}})}await o({...t,scoreOverrides:s}),await e.rawUpdate(l)}async function bt({quirk:e,settings:o,saveSettings:r,actions:t}){var l;let n=(l=o.quirkOverrides)==null?void 0:l[e];if(!n)return;let s={...o.quirkOverrides};delete s[e],await r({...o,quirkOverrides:s}),await t.rawUpdate([{type:"setquirk",data:{key:e,value:n.initial}}])}var Ne=require("@uniformdev/design-system"),yt=require("@uniformdev/design-system"),S=require("@emotion/react/jsx-runtime"),Ct=({dimensionIndex:{index:e},state:{scores:o,data:r},actions:t,saveSettings:n,settings:s})=>{let l=xt.useMemo(()=>{let i={};return Object.keys(e).filter(a=>!o[a]).map(a=>{i[e[a].dim]=0}),i},[o,e]),d=Object.keys(o).length,p=d+Object.keys(l).length,m=()=>{t.rawUpdate([{type:"setcontrol",data:!r.controlGroup}])};return(0,S.jsx)(S.Fragment,{children:(0,S.jsxs)("article",{css:b.page,children:[(0,S.jsxs)("div",{css:b.headingGroup,children:[(0,S.jsxs)("h2",{css:b.title,children:["Dimensions",(0,S.jsxs)("small",{children:[d," active of ",p]})]}),(0,S.jsx)("div",{css:b.reset,children:(0,S.jsx)(Ne.Button,{buttonType:"ghost",onClick:()=>Se({actions:t,saveSettings:n,scores:o,settings:s}).then(t.forget),children:"clear all dimensions"})}),(0,S.jsx)(yt.Switch,{name:"controlGroup",label:"Control Group",onChange:m,checked:r.controlGroup})]}),d>0?(0,S.jsx)(Y,{dimensionIndex:e,dimensions:o}):(0,S.jsx)(re,{title:r.controlGroup?"In control group":"No active dimensions",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 score in any dimensions yet.",buttonGroup:r.controlGroup?(0,S.jsx)(Ne.Button,{buttonType:"secondary",onClick:m,children:"Exit control group"}):null}),(0,S.jsx)(fe,{children:(0,S.jsx)(he,{title:`Inactive Dimensions (${Object.keys(l).length})`,children:(0,S.jsx)(Y,{dimensionIndex:e,dimensions:l})})})]})})};var wt=require("@uniformdev/design-system");var Ze=require("@uniformdev/design-system"),V=require("@emotion/react/jsx-runtime"),kt=({dimensionIndex:{index:e},state:{data:o,scores:r},actions:t,settings:n,saveSettings:s})=>{var a;let l=(a=n.scoreOverrides)!=null?a:{},d=Object.keys(l).length,p=c=>(c==null||c.preventDefault(),s({...n,route:"/overrides/add"})),m=()=>{t.rawUpdate([{type:"setcontrol",data:!o.controlGroup}])},i={};return Object.entries(r).map(([c,f])=>{l[c]!==void 0&&(i[c]=f)}),(0,V.jsx)(V.Fragment,{children:(0,V.jsxs)("article",{css:b.page,children:[(0,V.jsxs)("div",{css:b.headingGroup,children:[(0,V.jsx)("h2",{css:b.title,children:"What if?"}),(0,V.jsx)("div",{css:b.reset,children:(0,V.jsx)(Ze.Button,{buttonType:"ghost",onClick:()=>Se({actions:t,settings:n,saveSettings:s,scores:r}),children:"delete all overrides"})}),(0,V.jsx)(wt.AddButton,{onClick:p})]}),(0,V.jsx)("p",{children:"Override dimension scores to test personalization"}),d>0?(0,V.jsx)(Y,{dimensionIndex:e,dimensions:i,onClick:c=>s({...n,route:`/overrides/${c}`})}):(0,V.jsx)(re,{title:o.controlGroup?"In control group":"No overrides",text:o.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:o.controlGroup?(0,V.jsx)(Ze.Button,{buttonType:"secondary",onClick:m,children:"Exit control group"}):null})]})})};var J=require("formik");var se=F(require("yup"));var N=require("@emotion/react"),Tt=N.css`
|
|
309
|
-
background: var(--white);
|
|
310
|
-
border: 1px solid var(--gray-500);
|
|
311
|
-
border-radius: var(--rounded-base);
|
|
312
|
-
color: var(--brand-secondary-1);
|
|
313
|
-
padding: var(--spacing-base);
|
|
314
|
-
|
|
315
|
-
&:disabled {
|
|
316
|
-
cursor: not-allowed;
|
|
317
|
-
color: var(--gray-200);
|
|
318
|
-
}
|
|
319
|
-
`,kr=N.css`
|
|
320
|
-
margin: var(--spacing-base) 0;
|
|
321
|
-
`,Dt=N.css`
|
|
322
|
-
color: var(--brand-secondary-1);
|
|
323
|
-
display: flex;
|
|
324
|
-
flex-direction: column;
|
|
325
|
-
margin: 0 0 var(--spacing-sm);
|
|
326
|
-
`,St=N.css`
|
|
327
|
-
color: var(--brand-secondary-1);
|
|
328
|
-
display: block;
|
|
329
|
-
flex: 1 100%;
|
|
330
|
-
font-weight: var(--fw-bold);
|
|
331
|
-
margin: 0 0 var(--spacing-sm);
|
|
332
|
-
`,Tr=N.css`
|
|
333
|
-
color: var(--gray-600);
|
|
334
|
-
font-size: var(--fs-sm);
|
|
335
|
-
`,Dr=N.css`
|
|
336
|
-
color: var(--brand-secondary-5);
|
|
337
|
-
display: block;
|
|
338
|
-
`,Lt=N.css`
|
|
339
|
-
flex-direction: row;
|
|
340
|
-
flex-wrap: wrap;
|
|
341
|
-
|
|
342
|
-
input[type='range'] {
|
|
343
|
-
height: 28px;
|
|
344
|
-
-webkit-appearance: none;
|
|
345
|
-
margin: 10px 0;
|
|
346
|
-
width: 100%;
|
|
347
|
-
flex: 1 0 80%;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
input[type='range']:focus {
|
|
351
|
-
outline: none;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
input[type='range']::-webkit-slider-runnable-track {
|
|
355
|
-
width: 100%;
|
|
356
|
-
height: 6px;
|
|
357
|
-
cursor: pointer;
|
|
358
|
-
animate: 0.2s;
|
|
359
|
-
box-shadow: 0 0 0 #000000;
|
|
360
|
-
background: #2ecdb4;
|
|
361
|
-
border-radius: 0;
|
|
362
|
-
border: 0 solid #000000;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
input[type='range']::-moz-range-track {
|
|
366
|
-
width: 100%;
|
|
367
|
-
height: 6px;
|
|
368
|
-
cursor: pointer;
|
|
369
|
-
animate: 0.2s;
|
|
370
|
-
box-shadow: 0 0 0 #000000;
|
|
371
|
-
background: #2ecdb4;
|
|
372
|
-
border-radius: 0;
|
|
373
|
-
border: 0 solid #000000;
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
input[type='range']::-webkit-slider-thumb {
|
|
377
|
-
box-shadow: 1px 1px 2px #000000;
|
|
378
|
-
border: 1px solid #000000;
|
|
379
|
-
height: 20px;
|
|
380
|
-
width: 20px;
|
|
381
|
-
border-radius: 20px;
|
|
382
|
-
background: #ffffff;
|
|
383
|
-
cursor: pointer;
|
|
384
|
-
-webkit-appearance: none;
|
|
385
|
-
margin-top: -7.5px;
|
|
386
|
-
}
|
|
387
|
-
input[type='range']::-moz-range-thumb {
|
|
388
|
-
box-shadow: 1px 1px 2px #000000;
|
|
389
|
-
border: 1px solid #000000;
|
|
390
|
-
height: 20px;
|
|
391
|
-
width: 20px;
|
|
392
|
-
border-radius: 20px;
|
|
393
|
-
background: #ffffff;
|
|
394
|
-
cursor: pointer;
|
|
395
|
-
-webkit-appearance: none;
|
|
396
|
-
margin-top: -7.5px;
|
|
397
|
-
}
|
|
398
|
-
input[type='range']:focus::-webkit-slider-runnable-track {
|
|
399
|
-
background: #2ecdb4;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
.value-display {
|
|
403
|
-
flex: 1 0 20%;
|
|
404
|
-
padding: 10px;
|
|
405
|
-
}
|
|
406
|
-
`;var Le=require("@uniformdev/design-system"),Z=require("@emotion/react/jsx-runtime"),Ot=({field:e,form:o,meta:r,...t})=>{var m,i;let{label:n,caption:s,min:l=0,max:d=100,step:p}=t;return(0,Z.jsxs)("div",{children:[(0,Z.jsxs)("label",{css:[Dt,Lt],children:[(0,Z.jsx)("span",{css:St,children:n}),(0,Z.jsx)("input",{type:"range",min:l,max:d,step:p,...e,value:(m=e.value)!=null?m:0}),(0,Z.jsx)("span",{className:"value-display",children:(i=e.value)!=null?i:0})]}),s?(0,Z.jsx)(Le.Caption,{children:s}):null,o.touched[e.name]&&o.errors[e.name]?(0,Z.jsx)(Le.ErrorMessage,{message:o.errors[e.name]}):null]})};var Rt=require("@emotion/react"),So=require("@emotion/react/jsx-runtime"),z=({children:e,...o})=>(0,So.jsx)("fieldset",{css:Rt.css`
|
|
407
|
-
border: none;
|
|
408
|
-
padding: 0;
|
|
409
|
-
& legend {
|
|
410
|
-
margin-bottom: var(--spacing-base);
|
|
411
|
-
}
|
|
412
|
-
`,...o,children:e});var Vt=require("@emotion/react"),Lo=require("@emotion/react/jsx-runtime"),ie=({children:e})=>(0,Lo.jsx)("legend",{css:Vt.css`
|
|
413
|
-
font-size: var(--fs-md);
|
|
414
|
-
font-weight: var(--fw-bold);
|
|
415
|
-
border-bottom: 1px solid var(--gray-400);
|
|
416
|
-
width: 100%;
|
|
417
|
-
`,children:e});var Oe=require("@uniformdev/context");function Pt({manifest:e,visitor:o,override:r}){let t=new Oe.Context({manifest:e,transitionStore:new ze({initialData:o})}),n={...t.scores};t.storage.updateData([r]);let l={...{...t.scores}};return Object.entries(l).forEach(([d,p])=>{n[d]===p&&delete l[d]}),l}var ze=class extends Oe.TransitionDataStore{async handleDelete(){}async handleUpdateData(){}};function de({scores:e,scoreOverrides:o}){let r=[];return o?(Object.entries(o).forEach(([t,n])=>{var d;let s=(d=e[t])!=null?d:0;if(s===n.override)return;let l=n.override-s;r.push({type:"modscoreS",data:{dimension:t,delta:l}})}),r):[]}function Re({quirks:e,quirkOverrides:o}){let r={};if(!!o)return Object.entries(o).forEach(([t,n])=>{e[t]!==n.override&&(r[t]=n.override)}),Object.keys(r).length>0?r:void 0}var Ht=require("@uniformdev/design-system");var Oo=require("@emotion/react/jsx-runtime"),Ue=e=>({field:o,form:r,meta:t,...n})=>(0,Oo.jsx)(e,{...o,...n,errorMessage:r.errors[o.name]});var Ve=require("@uniformdev/design-system"),Pe=Ue(Ve.Input),It=Ue(Ve.InputSelect);var R=require("@emotion/react/jsx-runtime"),Ro=se.object({dimension:se.string(),score:se.number()}),je=({settings:e,saveSettings:o,state:r,actions:t,dimensionIndex:{index:n}})=>{var p,m;let s=e.route?[...e.route.matchAll(/overrides\/(?!.*add)(\w+)?/g)]:[],l=s[0]?s[0][1]:"";if(!((p=r.manifest.project.pz)!=null&&p.sig))return(0,R.jsx)("p",{children:"Error, manifest is broken or there is no signal to override."});let d=Object.entries(n).filter(([,i])=>i.type!=="Audience"&&i.type!=="Intent").map(([i,a])=>{let c=a.type?`${a.type}: `:"",f=a.category?`${a.category} - `:"",g=`${c}${f}${a.name}`;return{value:i,label:g}});return d.unshift({value:"",label:"Choose dimension to override"}),(0,R.jsx)(J.Formik,{initialValues:{dimension:l,score:(m=r.scores[l])!=null?m:0},validate:i=>{let a={};return(i.score===r.scores[i.dimension]||i.score===0&&!r.scores[l])&&(a.score="You have to modify current score value"),a},validationSchema:Ro,enableReinitialize:!0,validateOnChange:!1,validateOnBlur:!1,onSubmit:async i=>{var h,C,T,D,G,$;let a=(C=(h=n[i.dimension])==null?void 0:h.cap)!=null?C:0,c=Math.min(i.score,a),f={...e,scoreOverrides:{...e.scoreOverrides,[i.dimension]:{initial:($=(G=(D=(T=e.scoreOverrides)==null?void 0:T[i.dimension])==null?void 0:D.initial)!=null?G:r.scores[i.dimension])!=null?$:0,override:c}},route:"/overrides"};await o(f);let g=de({scores:r.scores,scoreOverrides:f.scoreOverrides});t.rawUpdate(g)},children:({isSubmitting:i,values:a,setFieldValue:c})=>{var T;let f=Pt({manifest:r.manifest,visitor:r.data,override:{type:"modscore",data:{dimension:a.dimension,delta:a.score-((T=r.scores[a.dimension])!=null?T:0)}}}),g=Object.entries(r.scores).reduce((D,[G,$])=>(D[G]={initial:$,override:$},D),{}),h={max:100,step:50};n[a.dimension]&&(h.max=n[a.dimension].cap,h.step=n[a.dimension].str);let C=a.score&&Object.keys(f).length>0;return(0,R.jsxs)(J.Form,{css:b.page,children:[(0,R.jsx)("h1",{css:b.title,children:"Override Dimension"}),(0,R.jsx)(J.Field,{component:It,label:"Dimension",id:"dimension",name:"dimension",options:d,disabled:i,onChange:D=>{c("score",0,!1),c("dimension",D.target.value)}}),(0,R.jsx)("p",{css:b.text,children:(0,R.jsx)("small",{children:"Audiences and Intents are aggregated from other dimension scores and cannot be overridden directly."})}),a.dimension?(0,R.jsx)(J.Field,{component:Ot,name:"score",label:"Score",disabled:i,max:h.max,step:h.step,caption:`Range: 0 - ${h.max} in increments of ${h.step}`}):null,(0,R.jsxs)(z,{disabled:i,css:{marginBottom:"2rem"},children:[C?(0,R.jsx)(fe,{children:(0,R.jsx)(he,{title:`Impacted Dimensions (${Object.keys(f).length})`,children:(0,R.jsx)(Y,{preemptiveOverrides:g,dimensionIndex:n,dimensions:f,disableEditOverride:!0})})}):null,(0,R.jsx)(Ht.Button,{type:"submit",css:b.submitButton,disabled:i,children:"Save"}),(0,R.jsx)(oe,{route:"/overrides",css:b.cancelButton,children:"Cancel"})]})]})}})};var Et=require("react");var He=require("react"),Me=require("@uniformdev/design-system");var Ie=require("@emotion/react/jsx-runtime"),Vo=({name:e,value:o,submit:r})=>{let[t,n]=(0,He.useState)(o!=null?o:"");return(0,He.useEffect)(()=>{n(o!=null?o:"")},[o]),(0,Ie.jsxs)("div",{css:{display:"flex",gap:"var(--spacing-sm)"},children:[(0,Ie.jsx)(Me.Input,{type:"text",css:[Tt],name:e,value:t,onChange:d=>{n(d.target.value)}}),(0,Ie.jsx)(Me.Button,{buttonType:"primary",disabled:t===o,size:"sm",onClick:()=>r(e,t!=null?t:""),children:"Save"})]})},Mt=Vo;var pe=require("@uniformdev/design-system"),x=require("@emotion/react/jsx-runtime"),At=({...e})=>{let{state:{data:{quirks:o}},quirksIndex:{index:r},settings:t,saveSettings:n,actions:s}=e,[l,d]=(0,Et.useState)(""),p;l&&(p=r[l]);let m=async(i,a)=>{var g,h,C;d("");let c={...t,quirkOverrides:{...t.quirkOverrides,[i]:{initial:(C=(h=(g=t.quirkOverrides)==null?void 0:g[i])==null?void 0:h.initial)!=null?C:o[i],override:a}}};await n(c);let f=Re({quirks:o,quirkOverrides:c.quirkOverrides});await s.update({quirks:f})};return(0,x.jsx)(x.Fragment,{children:(0,x.jsxs)("article",{css:[b.page,b.quirks],children:[(0,x.jsx)("h1",{css:b.title,children:"Quirks"}),(0,x.jsx)("p",{css:b.text,children:"Keys defined in Uniform and their current, programmatically defined values for this visit."}),Object.keys(r).length?(0,x.jsxs)(we,{children:[(0,x.jsx)(pt,{children:(0,x.jsxs)(le,{children:[(0,x.jsx)(Te,{width:"30%",children:"Key"}),(0,x.jsx)(Te,{width:"50%",children:"Value"}),(0,x.jsx)(Te,{width:"20%",children:""})]})}),(0,x.jsx)(ke,{children:Object.values(r).map(({name:i,value:a,id:c})=>{var h,C,T;let f=(C=(h=t.quirkOverrides)==null?void 0:h[i])==null?void 0:C.initial,g=[];return p&&p.options&&(g=p.options.map(D=>({value:D.value,label:D.name}))),(0,x.jsxs)(le,{border:"bottom",children:[(0,x.jsx)(q,{children:(0,x.jsx)("strong",{children:i})}),(0,x.jsxs)(q,{children:[l!==c?(0,x.jsxs)("div",{onClick:()=>{d(c)},children:[f?(0,x.jsx)("div",{children:(0,x.jsx)("s",{children:f})}):null,a]}):null,l===c&&p&&(0,x.jsx)(x.Fragment,{children:p.options?(0,x.jsx)(pe.InputSelect,{showLabel:!1,label:`Change ${i}`,defaultOption:`Change ${i}`,name:c,onChange:D=>m(D.target.name,D.target.value),options:g}):(0,x.jsx)(Mt,{name:c,value:a,submit:m})})]}),(0,x.jsx)(q,{children:l?null:(T=t.quirkOverrides)!=null&&T[c]?(0,x.jsx)(pe.Button,{buttonType:"ghost",onClick:()=>{bt({quirk:c,settings:t,saveSettings:n,actions:s})},children:(0,x.jsx)("small",{children:"Clear Override"})}):(0,x.jsx)(pe.Button,{buttonType:"ghost",onClick:()=>{d(c)},children:(0,x.jsx)("small",{children:"Override"})})})]},c)})})]}):(0,x.jsx)(re,{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 _e=require("@uniformdev/design-system"),Ge=require("@uniformdev/design-system"),k=require("@emotion/react/jsx-runtime"),Bt=({settings:e,saveSettings:o,actions:r,state:{data:t},clearAllExtensionData:n})=>(0,k.jsxs)("article",{css:[b.page,{display:"flex",flexDirection:"column",gap:"var(--spacing-base)"}],children:[(0,k.jsx)("h1",{css:b.title,children:"Settings"}),(0,k.jsxs)(z,{children:[(0,k.jsx)(ie,{children:"Data Connection"}),(0,k.jsx)(_e.Button,{buttonType:"tertiary",onClick:()=>{o({...e,route:"/connect"})},children:"Manage Connection to Uniform"})]}),(0,k.jsxs)(z,{children:[(0,k.jsx)(ie,{children:"Storage Consent"}),(0,k.jsx)(Ge.Switch,{label:"Store visitor data",id:"consent-mode",name:"consentMode",checked:t.consent,onChange:s=>{r.rawUpdate([{type:"consent",data:s.currentTarget.checked}]),o({...e,consentMode:s.currentTarget.checked})}}),(0,k.jsx)("p",{children:(0,k.jsx)("small",{children:"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,k.jsxs)(z,{children:[(0,k.jsx)(ie,{children:"Logging"}),(0,k.jsx)(Ge.Switch,{label:"Write Uniform Context diagnostic logs to browser console",id:"logging",name:"logging",checked:e.logLevel==="debug",onChange:s=>o({...e,logLevel:s.currentTarget.checked?"debug":"none"})})]}),(0,k.jsxs)(z,{children:[(0,k.jsx)(ie,{children:"Clear extension storage"}),(0,k.jsx)(_e.Button,{onClick:()=>{n()},children:"Clear"}),(0,k.jsx)("p",{children:(0,k.jsx)("small",{children:"May be necessary when you have multiple different sites on the same domain name (e.g. http://localhost:3000) and there are some conflicts or other unexpected behaviour."})})]})]});var $e=require("@uniformdev/design-system");var B=require("@emotion/react/jsx-runtime"),Ke=({settings:e,saveSettings:o})=>{let r=()=>{o({...e,route:"/connect"})},t=()=>{o({...e,ignoreApiKeyPrompt:!0})},n=e.route==="/connect",s=!(e!=null&&e.apiKey);return!e.ignoreApiKeyPrompt&&s&&!n?(0,B.jsxs)("div",{css:[be,lt],children:[(0,B.jsx)("h2",{css:xe,children:"Connect to a Uniform Project"}),(0,B.jsx)("p",{css:ye,children:"This allows reading human-readable labels for the dimensions."}),(0,B.jsxs)("div",{css:Ce,children:[(0,B.jsx)($e.Button,{buttonType:"secondary",onClick:r,children:"Connect this site"}),(0,B.jsx)($e.Button,{buttonType:"ghost",onClick:t,children:"Skip for now"})]}),(0,B.jsx)("button",{type:"button",css:dt,title:"close",onClick:t,children:(0,B.jsx)("span",{hidden:!0,children:"Close"})})]}):null};var X=require("@uniformdev/context/api"),Qt=require("react-use"),Ft=F(require("react"));function qt({apiHost:e,apiKey:o,projectId:r},t){let{loading:n,error:s,value:l}=(0,Qt.useAsync)(async()=>{if(!o||!r)return d;let m=(await new X.UncachedDimensionClient({projectId:r,apiKey:o,apiHost:e||void 0}).get()).dimensions,i={};return m.map(a=>{var c,f,g,h,C,T,D,G;if(i[a.dim]={...(0,X.computeDimensionDefinitionDisplayData)(a),cap:a.cap,str:(h=(g=(f=(c=t==null?void 0:t.project.pz)==null?void 0:c.sig)==null?void 0:f[a.dim])==null?void 0:g.str)!=null?h:50},i[a.dim].type==="Enrichment"){let $=a.dim.split("_")[0];i[a.dim].cap=(G=(D=(T=(C=t==null?void 0:t.project.pz)==null?void 0:C.enr)==null?void 0:T[$])==null?void 0:D.cap)!=null?G:100}}),i},[e,o,r]),d=Ft.useMemo(()=>{var m,i,a,c;let p={};return t&&(Object.entries((i=(m=t==null?void 0:t.project.pz)==null?void 0:m.sig)!=null?i:{}).map(([f,g])=>{let h=(0,X.computeDimensionDisplayData)(f,t);h&&(p[f]={...g,...h})}),Object.entries((c=(a=t==null?void 0:t.project.pz)==null?void 0:a.enr)!=null?c:{}).map(([f,g])=>{var T;let h=(0,X.computeDimensionDisplayData)(f,t),C={cap:(T=g.cap)!=null?T:100,str:10};h&&(p[f]={...h,cap:C.cap,str:C.str})}),l&&Object.entries(l).map(([f,g])=>{p[f]={...p[f],...g}})),p},[t,l]);return{loading:n,error:s,index:d}}var Nt=require("react"),Zt=require("@uniformdev/context/api"),zt=require("react-use");function Ut({apiHost:e,apiKey:o,projectId:r},t){let{loading:n,error:s,value:l}=(0,zt.useAsync)(async()=>{if(!o||!r)return{};let m=await new Zt.UncachedQuirkClient({projectId:r,apiKey:o,apiHost:e||void 0}).get(),i={};return m.quirks.map(a=>{i[a.id]={...a,value:t[a.id]}}),i},[e,o,r]),d=(0,Nt.useMemo)(()=>{let p={};return Object.entries(t).map(([m,i])=>p[m]={value:i,id:m,name:m}),l&&Object.entries(l).map(([m,i])=>p[m]={...i,value:t[m]}),p},[t,l]);return{loading:n,error:s,index:d}}var We=require("@emotion/react"),Wt=require("@uniformdev/design-system");var Po=require("@emotion/react/jsx-runtime");function Ee(){return(0,Po.jsx)("style",{children:`
|
|
418
|
-
:root {
|
|
419
|
-
--site-width: 700px;
|
|
420
|
-
|
|
421
|
-
/* Red CTA */
|
|
422
|
-
--red-button: rgb(217 83 79);
|
|
423
|
-
--red-tooltip: #D9534F;
|
|
424
|
-
|
|
425
|
-
--min-height: 450px;
|
|
426
|
-
}
|
|
427
|
-
`})}var Be=require("react"),jt=require("react-use");var Ae=require("@emotion/react/jsx-runtime"),_t=()=>{let[e,o]=(0,Be.useState)(!1),r=(0,jt.useMountedState)();return(0,Be.useEffect)(()=>{setTimeout(()=>{r()&&o(!0)},1e3)},[r]),e?(0,Ae.jsxs)("article",{css:b.page,children:[(0,Ae.jsx)("h1",{children:"Loading..."}),(0,Ae.jsx)("p",{children:"Connecting to Uniform API for complete data."})]}):null};var Gt=require("@uniformdev/context"),Qe=require("@uniformdev/context/api"),U=require("formik"),j=F(require("react")),M=require("@uniformdev/design-system");var v=require("@emotion/react/jsx-runtime");function $t(e){let[o,r]=j.useState(e.currentData?"c":"qc"),[t,n]=j.useState(void 0),[s,l]=j.useState(void 0),d=j.useCallback(async i=>{let a=new Qe.UncachedManifestClient(i);n(void 0);try{let c=await a.get({preview:!0});return l({manifest:c,target:i}),c}catch(c){if(c instanceof Qe.ApiClientError){c.statusCode===403?n("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."):n(c.errorMessage);return}if("message"in c){c.message==="Failed to fetch"?n("A network error occurred. Ensure the API host is valid."):n(c.message);return}n(JSON.stringify(c,null,2));return}},[]);j.useEffect(()=>{!e.currentData||d(e.currentData)},[d,e.currentData]);let p=async i=>{await d(i)&&(r("c"),await e.onConnect(i))},m=()=>{confirm("Disconnect from Uniform? Make sure to save your API key if you want to reconnect.")&&(r("qc"),l(void 0),n(void 0),e.onConnect(null))};return(0,v.jsxs)("div",{children:[t?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(M.ErrorMessage,{message:t}),(0,v.jsx)(M.Button,{buttonType:"secondary",type:"button",onClick:m,children:"Clear old/broken settings"})]}):null,o==="qc"||o==="mc"?(0,v.jsx)(Io,{...e,state:o,setState:r,onConnect:p}):(0,v.jsx)("div",{children:s?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)("p",{children:["Connected to"," ",(0,v.jsx)("a",{href:`${s==null?void 0:s.target.apiHost}/projects/${s==null?void 0:s.target.projectId}`,target:"_blank",rel:"noopener noreferrer",css:{textDecoration:"underline"},children:(0,v.jsx)("strong",{children:s==null?void 0:s.manifest.project.name})})," ",(0,v.jsxs)("small",{children:["(",s==null?void 0:s.manifest.project.id,")"]})]}),(0,v.jsx)(M.Button,{buttonType:"secondary",type:"button",onClick:m,children:"Disconnect"})]}):null})]})}function Io({setState:e,state:o,currentData:r,onConnect:t}){var n,s,l;return(0,v.jsx)("div",{children:(0,v.jsx)(U.Formik,{initialValues:{apiHost:(n=r==null?void 0:r.apiHost)!=null?n:"https://uniform.app",apiKey:(s=r==null?void 0:r.apiKey)!=null?s:"",projectId:(l=r==null?void 0:r.projectId)!=null?l:"",qc:""},onSubmit:t,children:({setFieldValue:d,setFieldError:p,errors:{qc:m},isSubmitting:i})=>(0,v.jsx)(U.Form,{children:(0,v.jsx)("fieldset",{css:{display:"flex",flexDirection:"column",gap:"var(--spacing-base)"},children:o==="qc"?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{children:(0,v.jsx)(M.Input,{placeholder:"Paste Quick Connect Code Here",caption:"Copy the Quick Connect code after creating an API key in Uniform.",errorMessage:m,onChange:a=>{try{let c=(0,Gt.parseQuickConnect)(a.currentTarget.value);d("apiHost",c.apiHost),d("apiKey",c.apiKey),d("projectId",c.projectId)}catch(c){p("qc",c.message)}}})}),(0,v.jsxs)("section",{css:{display:"flex",gap:"var(--spacing-sm)"},children:[(0,v.jsx)(M.Button,{type:"submit",buttonType:"primary",disabled:i,children:i?"Verifying...":"Connect"}),(0,v.jsx)(M.Button,{type:"button",buttonType:"ghost",onClick:()=>e("mc"),disabled:i,children:"Connect Manually"})]})]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{children:(0,v.jsx)(U.Field,{component:Pe,label:"API Key",name:"apiKey",caption:"Generate an API key in your Uniform team settings."})}),(0,v.jsx)("div",{children:(0,v.jsx)(U.Field,{component:Pe,label:"Project ID",name:"projectId",caption:"Available to copy after generating an API key"})}),(0,v.jsx)("div",{children:(0,v.jsx)(U.Field,{component:Pe,label:"API Host",name:"apiHost",caption:"Use a non-standard Uniform API endpoint. Most people will not not need this option."})}),(0,v.jsxs)("section",{css:{display:"flex",gap:"var(--spacing-sm)"},children:[(0,v.jsx)(M.Button,{type:"submit",buttonType:"primary",disabled:i,children:i?"Verifying...":"Connect"}),(0,v.jsx)(M.Button,{type:"button",buttonType:"ghost",onClick:()=>e("qc"),disabled:i,children:"Use Quick Connect"})]})]})})})})})}var ae=require("@emotion/react/jsx-runtime"),Kt=({settings:e,saveSettings:o})=>{let r=e.apiKey&&e.projectId?{apiKey:e.apiKey,projectId:e.projectId,apiHost:e.apiHost}:void 0;return(0,ae.jsxs)("article",{css:b.page,children:[(0,ae.jsx)("h1",{css:b.title,children:"Connect to a Uniform Project"}),(0,ae.jsx)("p",{css:b.text,children:(0,ae.jsx)("small",{children:"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,ae.jsx)($t,{onConnect:async t=>{t?await o({...e,apiKey:t.apiKey,projectId:t.projectId,apiHost:t.apiHost}):await o({...e,apiKey:void 0,projectId:void 0,apiHost:void 0})},currentData:r})]})};var L=require("@emotion/react/jsx-runtime"),Ho=We.css`
|
|
427
|
+
`;var O=require("@emotion/react/jsx-runtime"),Ro=({dimensionIndex:e,dimensions:o,disableEditOverride:r,onClick:t,preemptiveOverrides:n})=>{var d;let{settings:s}=ge(),l=(d=n!=null?n:s.scoreOverrides)!=null?d:{};return(0,O.jsx)(Le,{children:(0,O.jsx)(Oe,{children:Object.entries(o).sort(([p],[m])=>p.localeCompare(m)).map(([p,m])=>{var h;let{dim:i,name:a,type:c,category:f}=(h=e[p])!=null?h:{name:p,dim:p,type:void 0,category:void 0},g=l[i];return(0,O.jsxs)(le,{children:[(0,O.jsxs)(z,{children:[g!==void 0?(0,O.jsx)("s",{css:Pt,children:g.initial}):null,(0,O.jsxs)("b",{css:Vt,children:[m,g!==void 0&&(0,O.jsx)("i",{css:It})]})]}),(0,O.jsx)(z,{children:(0,O.jsxs)("div",{onClick:()=>t==null?void 0:t(i),css:t?{cursor:"pointer"}:void 0,children:[(0,O.jsx)("span",{css:b.divider,role:"presentation"}),(0,O.jsxs)("div",{children:[(0,O.jsx)(Ot,{type:c})," ",c]}),(0,O.jsxs)("strong",{children:[f?`${f}:`:""," ",a]})]})}),(0,O.jsx)(z,{alignment:"right",color:"light",children:g!==void 0&&!r?(0,O.jsx)(oe,{route:`/overrides/${i}`,children:"Edit override"}):null})]},i)})})})},J=Ro;var R=require("@emotion/react/jsx-runtime"),Vo=ie.object({dimension:ie.string(),score:ie.number()}),je=({settings:e,saveSettings:o,state:r,actions:t,dimensionIndex:{index:n}})=>{var p,m;let s=e.route?[...e.route.matchAll(/overrides\/(?!.*add)(\w+)?/g)]:[],l=s[0]?s[0][1]:"";if(!((p=r.manifest.project.pz)!=null&&p.sig))return(0,R.jsx)("p",{children:"Error, manifest is broken or there is no signal to override."});let d=Object.entries(n).filter(([,i])=>i.type!=="Audience"&&i.type!=="Intent").map(([i,a])=>{let c=a.type?`${a.type}: `:"",f=a.category?`${a.category} - `:"",g=`${c}${f}${a.name}`;return{value:i,label:g}});return d.unshift({value:"",label:"Choose dimension to override"}),(0,R.jsx)(X.Formik,{initialValues:{dimension:l,score:(m=r.scores[l])!=null?m:0},validate:i=>{let a={};return(i.score===r.scores[i.dimension]||i.score===0&&!r.scores[l])&&(a.score="You have to modify current score value"),a},validationSchema:Vo,enableReinitialize:!0,validateOnChange:!1,validateOnBlur:!1,onSubmit:async i=>{var h,C,T,D,G,$;let a=(C=(h=n[i.dimension])==null?void 0:h.cap)!=null?C:0,c=Math.min(i.score,a),f={...e,scoreOverrides:{...e.scoreOverrides,[i.dimension]:{initial:($=(G=(D=(T=e.scoreOverrides)==null?void 0:T[i.dimension])==null?void 0:D.initial)!=null?G:r.scores[i.dimension])!=null?$:0,override:c}},route:"/overrides"};await o(f);let g=ce({scores:r.scores,scoreOverrides:f.scoreOverrides});t.rawUpdate(g)},children:({isSubmitting:i,values:a,setFieldValue:c})=>{var T;let f=vt({manifest:r.manifest,visitor:r.data,override:{type:"modscore",data:{dimension:a.dimension,delta:a.score-((T=r.scores[a.dimension])!=null?T:0)}}}),g=Object.entries(r.scores).reduce((D,[G,$])=>(D[G]={initial:$,override:$},D),{}),h={max:100,step:50};n[a.dimension]&&(h.max=n[a.dimension].cap,h.step=n[a.dimension].str);let C=a.score&&Object.keys(f).length>0;return(0,R.jsxs)(X.Form,{css:b.page,children:[(0,R.jsx)("h1",{css:b.title,children:"Override Dimension"}),(0,R.jsx)(X.Field,{component:yt,label:"Dimension",id:"dimension",name:"dimension",options:d,disabled:i,onChange:D=>{c("score",0,!1),c("dimension",D.target.value)}}),(0,R.jsx)("p",{css:b.text,children:(0,R.jsx)("small",{children:"Audiences and Intents are aggregated from other dimension scores and cannot be overridden directly."})}),a.dimension?(0,R.jsx)(X.Field,{component:Dt,name:"score",label:"Score",disabled:i,max:h.max,step:h.step,caption:`Range: 0 - ${h.max} in increments of ${h.step}`}):null,(0,R.jsxs)(q,{disabled:i,css:{marginBottom:"2rem"},children:[C?(0,R.jsx)(we,{children:(0,R.jsx)(ke,{title:`Impacted Dimensions (${Object.keys(f).length})`,children:(0,R.jsx)(J,{preemptiveOverrides:g,dimensionIndex:n,dimensions:f,disableEditOverride:!0})})}):null,(0,R.jsx)(Ht.Button,{type:"submit",css:b.submitButton,disabled:i,children:"Save"}),(0,R.jsx)(oe,{route:"/overrides",css:b.cancelButton,children:"Cancel"})]})]})}})};var _e=require("@uniformdev/design-system"),Et=require("@uniformdev/design-system"),At=F(require("react"));async function Pe({actions:e,saveSettings:o,scores:r,settings:t}){var d,p;let n=(d=t.scoreOverrides)!=null?d:{},s={...n},l=[];for(let m of Object.keys(n)){let i=n==null?void 0:n[m];delete s[m],l.push({type:"modscoreS",data:{dimension:m,delta:i.initial-((p=r[m])!=null?p:0)}})}await o({...t,scoreOverrides:s}),await e.rawUpdate(l)}async function Mt({quirk:e,settings:o,saveSettings:r,actions:t}){var l;let n=(l=o.quirkOverrides)==null?void 0:l[e];if(!n)return;let s={...o.quirkOverrides};delete s[e],await r({...o,quirkOverrides:s}),await t.rawUpdate([{type:"setquirk",data:{key:e,value:n.initial}}])}var de=require("@emotion/react/jsx-runtime"),se=({title:e,text:o,buttonGroup:r,children:t})=>(0,de.jsxs)("div",{css:fe,children:[(0,de.jsx)("h2",{css:he,children:e}),(0,de.jsx)("p",{css:be,children:o}),t,r?(0,de.jsx)("div",{css:xe,children:r}):null]});var S=require("@emotion/react/jsx-runtime"),Bt=({dimensionIndex:{index:e},state:{scores:o,data:r},actions:t,saveSettings:n,settings:s})=>{let l=At.useMemo(()=>{let i={};return Object.keys(e).filter(a=>!o[a]).map(a=>{i[e[a].dim]=0}),i},[o,e]),d=Object.keys(o).length,p=d+Object.keys(l).length,m=()=>{t.rawUpdate([{type:"setcontrol",data:!r.controlGroup}])};return(0,S.jsx)(S.Fragment,{children:(0,S.jsxs)("article",{css:b.page,children:[(0,S.jsxs)("div",{css:b.headingGroup,children:[(0,S.jsxs)("h2",{css:b.title,children:["Dimensions",(0,S.jsxs)("small",{children:[d," active of ",p]})]}),(0,S.jsx)("div",{css:b.reset,children:(0,S.jsx)(_e.Button,{buttonType:"ghost",onClick:()=>Pe({actions:t,saveSettings:n,scores:o,settings:s}).then(t.forget),children:"clear all dimensions"})}),(0,S.jsx)(Et.Switch,{name:"controlGroup",label:"Control Group",onChange:m,checked:r.controlGroup})]}),d>0?(0,S.jsx)(J,{dimensionIndex:e,dimensions:o}):(0,S.jsx)(se,{title:r.controlGroup?"In control group":"No active dimensions",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 score in any dimensions yet.",buttonGroup:r.controlGroup?(0,S.jsx)(_e.Button,{buttonType:"secondary",onClick:m,children:"Exit control group"}):null}),(0,S.jsx)(we,{children:(0,S.jsx)(ke,{title:`Inactive Dimensions (${Object.keys(l).length})`,children:(0,S.jsx)(J,{dimensionIndex:e,dimensions:l})})})]})})};var Qt=require("@uniformdev/design-system"),Ge=require("@uniformdev/design-system");var V=require("@emotion/react/jsx-runtime"),Ft=({dimensionIndex:{index:e},state:{data:o,scores:r},actions:t,settings:n,saveSettings:s})=>{var a;let l=(a=n.scoreOverrides)!=null?a:{},d=Object.keys(l).length,p=c=>(c==null||c.preventDefault(),s({...n,route:"/overrides/add"})),m=()=>{t.rawUpdate([{type:"setcontrol",data:!o.controlGroup}])},i={};return Object.entries(r).map(([c,f])=>{l[c]!==void 0&&(i[c]=f)}),(0,V.jsx)(V.Fragment,{children:(0,V.jsxs)("article",{css:b.page,children:[(0,V.jsxs)("div",{css:b.headingGroup,children:[(0,V.jsx)("h2",{css:b.title,children:"What if?"}),(0,V.jsx)("div",{css:b.reset,children:(0,V.jsx)(Ge.Button,{buttonType:"ghost",onClick:()=>Pe({actions:t,settings:n,saveSettings:s,scores:r}),children:"delete all overrides"})}),(0,V.jsx)(Qt.AddButton,{onClick:p})]}),(0,V.jsx)("p",{children:"Override dimension scores to test personalization"}),d>0?(0,V.jsx)(J,{dimensionIndex:e,dimensions:i,onClick:c=>s({...n,route:`/overrides/${c}`})}):(0,V.jsx)(se,{title:o.controlGroup?"In control group":"No overrides",text:o.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:o.controlGroup?(0,V.jsx)(Ge.Button,{buttonType:"secondary",onClick:m,children:"Exit control group"}):null})]})})};var pe=require("@uniformdev/design-system"),Nt=require("react");var He=require("@uniformdev/design-system"),Me=require("react");var Ie=require("@emotion/react/jsx-runtime"),Po=({name:e,value:o,submit:r})=>{let[t,n]=(0,Me.useState)(o!=null?o:"");return(0,Me.useEffect)(()=>{n(o!=null?o:"")},[o]),(0,Ie.jsxs)("div",{css:{display:"flex",gap:"var(--spacing-sm)"},children:[(0,Ie.jsx)(He.Input,{type:"text",css:[Ct],name:e,value:t,onChange:d=>{n(d.target.value)}}),(0,Ie.jsx)(He.Button,{buttonType:"primary",disabled:t===o,size:"sm",onClick:()=>r(e,t!=null?t:""),children:"Save"})]})},qt=Po;var x=require("@emotion/react/jsx-runtime"),Zt=({...e})=>{let{state:{data:{quirks:o}},quirksIndex:{index:r},settings:t,saveSettings:n,actions:s}=e,[l,d]=(0,Nt.useState)(""),p;l&&(p=r[l]);let m=async(i,a)=>{var g,h,C;d("");let c={...t,quirkOverrides:{...t.quirkOverrides,[i]:{initial:(C=(h=(g=t.quirkOverrides)==null?void 0:g[i])==null?void 0:h.initial)!=null?C:o[i],override:a}}};await n(c);let f=ye({quirks:o,quirkOverrides:c.quirkOverrides});await s.update({quirks:f})};return(0,x.jsx)(x.Fragment,{children:(0,x.jsxs)("article",{css:[b.page,b.quirks],children:[(0,x.jsx)("h1",{css:b.title,children:"Quirks"}),(0,x.jsx)("p",{css:b.text,children:"Keys defined in Uniform and their current, programmatically defined values for this visit."}),Object.keys(r).length?(0,x.jsxs)(Le,{children:[(0,x.jsx)(Rt,{children:(0,x.jsxs)(le,{children:[(0,x.jsx)(Re,{width:"30%",children:"Key"}),(0,x.jsx)(Re,{width:"50%",children:"Value"}),(0,x.jsx)(Re,{width:"20%",children:""})]})}),(0,x.jsx)(Oe,{children:Object.values(r).map(({name:i,value:a,id:c})=>{var h,C,T;let f=(C=(h=t.quirkOverrides)==null?void 0:h[i])==null?void 0:C.initial,g=[];return p&&p.options&&(g=p.options.map(D=>({value:D.value,label:D.name}))),(0,x.jsxs)(le,{border:"bottom",children:[(0,x.jsx)(z,{children:(0,x.jsx)("strong",{children:i})}),(0,x.jsxs)(z,{children:[l!==c?(0,x.jsxs)("div",{onClick:()=>{d(c)},children:[f?(0,x.jsx)("div",{children:(0,x.jsx)("s",{children:f})}):null,a]}):null,l===c&&p&&(0,x.jsx)(x.Fragment,{children:p.options?(0,x.jsx)(pe.InputSelect,{showLabel:!1,label:`Change ${i}`,defaultOption:`Change ${i}`,name:c,onChange:D=>m(D.target.name,D.target.value),options:g}):(0,x.jsx)(qt,{name:c,value:a,submit:m})})]}),(0,x.jsx)(z,{children:l?null:(T=t.quirkOverrides)!=null&&T[c]?(0,x.jsx)(pe.Button,{buttonType:"ghost",onClick:()=>{Mt({quirk:c,settings:t,saveSettings:n,actions:s})},children:(0,x.jsx)("small",{children:"Clear Override"})}):(0,x.jsx)(pe.Button,{buttonType:"ghost",onClick:()=>{d(c)},children:(0,x.jsx)("small",{children:"Override"})})})]},c)})})]}):(0,x.jsx)(se,{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 $e=require("@uniformdev/design-system"),Ke=require("@uniformdev/design-system");var k=require("@emotion/react/jsx-runtime"),zt=({settings:e,saveSettings:o,actions:r,state:{data:t},clearAllExtensionData:n})=>(0,k.jsxs)("article",{css:[b.page,{display:"flex",flexDirection:"column",gap:"var(--spacing-base)"}],children:[(0,k.jsx)("h1",{css:b.title,children:"Settings"}),(0,k.jsxs)(q,{children:[(0,k.jsx)(re,{children:"Data Connection"}),(0,k.jsx)($e.Button,{buttonType:"tertiary",onClick:()=>{o({...e,route:"/connect"})},children:"Manage Connection to Uniform"})]}),(0,k.jsxs)(q,{children:[(0,k.jsx)(re,{children:"Storage Consent"}),(0,k.jsx)(Ke.Switch,{label:"Store visitor data",id:"consent-mode",name:"consentMode",checked:t.consent,onChange:s=>{r.rawUpdate([{type:"consent",data:s.currentTarget.checked}]),o({...e,consentMode:s.currentTarget.checked})}}),(0,k.jsx)("p",{children:(0,k.jsx)("small",{children:"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,k.jsxs)(q,{children:[(0,k.jsx)(re,{children:"Logging"}),(0,k.jsx)(Ke.Switch,{label:"Write Uniform Context diagnostic logs to browser console",id:"logging",name:"logging",checked:e.logLevel==="debug",onChange:s=>o({...e,logLevel:s.currentTarget.checked?"debug":"none"})})]}),(0,k.jsxs)(q,{children:[(0,k.jsx)(re,{children:"Clear extension storage"}),(0,k.jsx)($e.Button,{onClick:()=>{n()},children:"Clear"}),(0,k.jsx)("p",{children:(0,k.jsx)("small",{children:"May be necessary when you have multiple different sites on the same domain name (e.g. http://localhost:3000) and there are some conflicts or other unexpected behaviour."})})]})]});var Ut=require("@uniformdev/context"),Ee=require("@uniformdev/context/api"),M=require("@uniformdev/design-system"),U=require("formik"),j=F(require("react"));var v=require("@emotion/react/jsx-runtime");function jt(e){let[o,r]=j.useState(e.currentData?"c":"qc"),[t,n]=j.useState(void 0),[s,l]=j.useState(void 0),d=j.useCallback(async i=>{let a=new Ee.UncachedManifestClient(i);n(void 0);try{let c=await a.get({preview:!0});return l({manifest:c,target:i}),c}catch(c){if(c instanceof Ee.ApiClientError){c.statusCode===403?n("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."):n(c.errorMessage);return}if("message"in c){c.message==="Failed to fetch"?n("A network error occurred. Ensure the API host is valid."):n(c.message);return}n(JSON.stringify(c,null,2));return}},[]);j.useEffect(()=>{!e.currentData||d(e.currentData)},[d,e.currentData]);let p=async i=>{await d(i)&&(r("c"),await e.onConnect(i))},m=()=>{confirm("Disconnect from Uniform? Make sure to save your API key if you want to reconnect.")&&(r("qc"),l(void 0),n(void 0),e.onConnect(null))};return(0,v.jsxs)("div",{children:[t?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(M.ErrorMessage,{message:t}),(0,v.jsx)(M.Button,{buttonType:"secondary",type:"button",onClick:m,children:"Clear old/broken settings"})]}):null,o==="qc"||o==="mc"?(0,v.jsx)(Io,{...e,state:o,setState:r,onConnect:p}):(0,v.jsx)("div",{children:s?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)("p",{children:["Connected to"," ",(0,v.jsx)("a",{href:`${s==null?void 0:s.target.apiHost}/projects/${s==null?void 0:s.target.projectId}`,target:"_blank",rel:"noopener noreferrer",css:{textDecoration:"underline"},children:(0,v.jsx)("strong",{children:s==null?void 0:s.manifest.project.name})})," ",(0,v.jsxs)("small",{children:["(",s==null?void 0:s.manifest.project.id,")"]})]}),(0,v.jsx)(M.Button,{buttonType:"secondary",type:"button",onClick:m,children:"Disconnect"})]}):null})]})}function Io({setState:e,state:o,currentData:r,onConnect:t}){var n,s,l;return(0,v.jsx)("div",{children:(0,v.jsx)(U.Formik,{initialValues:{apiHost:(n=r==null?void 0:r.apiHost)!=null?n:"https://uniform.app",apiKey:(s=r==null?void 0:r.apiKey)!=null?s:"",projectId:(l=r==null?void 0:r.projectId)!=null?l:"",qc:""},onSubmit:t,children:({setFieldValue:d,setFieldError:p,errors:{qc:m},isSubmitting:i})=>(0,v.jsx)(U.Form,{children:(0,v.jsx)("fieldset",{css:{display:"flex",flexDirection:"column",gap:"var(--spacing-base)"},children:o==="qc"?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{children:(0,v.jsx)(M.Input,{placeholder:"Paste Quick Connect Code Here",caption:"Copy the Quick Connect code after creating an API key in Uniform.",errorMessage:m,onChange:a=>{try{let c=(0,Ut.parseQuickConnect)(a.currentTarget.value);d("apiHost",c.apiHost),d("apiKey",c.apiKey),d("projectId",c.projectId)}catch(c){p("qc",c.message)}}})}),(0,v.jsxs)("section",{css:{display:"flex",gap:"var(--spacing-sm)"},children:[(0,v.jsx)(M.Button,{type:"submit",buttonType:"primary",disabled:i,children:i?"Verifying...":"Connect"}),(0,v.jsx)(M.Button,{type:"button",buttonType:"ghost",onClick:()=>e("mc"),disabled:i,children:"Connect Manually"})]})]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{children:(0,v.jsx)(U.Field,{component:De,label:"API Key",name:"apiKey",caption:"Generate an API key in your Uniform team settings."})}),(0,v.jsx)("div",{children:(0,v.jsx)(U.Field,{component:De,label:"Project ID",name:"projectId",caption:"Available to copy after generating an API key"})}),(0,v.jsx)("div",{children:(0,v.jsx)(U.Field,{component:De,label:"API Host",name:"apiHost",caption:"Use a non-standard Uniform API endpoint. Most people will not not need this option."})}),(0,v.jsxs)("section",{css:{display:"flex",gap:"var(--spacing-sm)"},children:[(0,v.jsx)(M.Button,{type:"submit",buttonType:"primary",disabled:i,children:i?"Verifying...":"Connect"}),(0,v.jsx)(M.Button,{type:"button",buttonType:"ghost",onClick:()=>e("qc"),disabled:i,children:"Use Quick Connect"})]})]})})})})})}var ae=require("@emotion/react/jsx-runtime"),_t=({settings:e,saveSettings:o})=>{let r=e.apiKey&&e.projectId?{apiKey:e.apiKey,projectId:e.projectId,apiHost:e.apiHost}:void 0;return(0,ae.jsxs)("article",{css:b.page,children:[(0,ae.jsx)("h1",{css:b.title,children:"Connect to a Uniform Project"}),(0,ae.jsx)("p",{css:b.text,children:(0,ae.jsx)("small",{children:"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,ae.jsx)(jt,{onConnect:async t=>{t?await o({...e,apiKey:t.apiKey,projectId:t.projectId,apiHost:t.apiHost}):await o({...e,apiKey:void 0,projectId:void 0,apiHost:void 0})},currentData:r})]})};var Be=require("react"),Gt=require("react-use");var Ae=require("@emotion/react/jsx-runtime"),$t=()=>{let[e,o]=(0,Be.useState)(!1),r=(0,Gt.useMountedState)();return(0,Be.useEffect)(()=>{setTimeout(()=>{r()&&o(!0)},1e3)},[r]),e?(0,Ae.jsxs)("article",{css:b.page,children:[(0,Ae.jsx)("h1",{children:"Loading..."}),(0,Ae.jsx)("p",{children:"Connecting to Uniform API for complete data."})]}):null};var Qe=require("@emotion/react/jsx-runtime"),Kt=()=>(0,Qe.jsxs)("article",{children:[(0,Qe.jsx)("h1",{children:"Something when wrong"}),(0,Qe.jsx)("p",{children:"We could not find the page you're looking for."})]});var L=require("@emotion/react/jsx-runtime"),Ho=We.css`
|
|
428
428
|
background: var(--white);
|
|
429
429
|
padding: var(--spacing-base);
|
|
430
430
|
overflow-y: auto;
|
|
@@ -453,7 +453,7 @@ to {
|
|
|
453
453
|
&::-webkit-scrollbar-thumb:hover {
|
|
454
454
|
background: var(--gray-500);
|
|
455
455
|
}
|
|
456
|
-
`;function Ye(e){let o=
|
|
456
|
+
`;function Ye(e){let o=rt(e.settings,e.state.manifest),r=at(e.settings,e.state.data.quirks),t={...e,dimensionIndex:o,quirksIndex:r},n=()=>{var s;if(o.loading||r.loading)return(0,L.jsx)($t,{});if(e.settings.route&&e.settings.route.match(/overrides\/\w+/))return(0,L.jsx)(je,{...t});switch((s=e.settings)==null?void 0:s.route){case void 0:case"/":case"/dimensions":return(0,L.jsx)(Bt,{...t});case"/overrides":return(0,L.jsx)(Ft,{...t});case"/overrides/add":return(0,L.jsx)(je,{...t});case"/quirks":return(0,L.jsx)(Zt,{...t});case"/settings":return(0,L.jsx)(zt,{...t});case"/connect":return(0,L.jsx)(_t,{...t});default:return(0,L.jsx)(Kt,{})}};return(0,L.jsxs)(lt,{settings:e.settings,saveSettings:e.saveSettings,children:[(0,L.jsx)(Wt.Theme,{}),(0,L.jsx)(ve,{}),(0,L.jsxs)("div",{css:We.css`
|
|
457
457
|
display: grid;
|
|
458
458
|
grid-template-columns: 200px auto;
|
|
459
459
|
font-weight: var(--fs-base);
|
|
@@ -462,7 +462,7 @@ to {
|
|
|
462
462
|
line-height: var(--base-line-height);
|
|
463
463
|
height: var(--min-height);
|
|
464
464
|
min-width: var(--site-width);
|
|
465
|
-
`,children:[(0,L.jsx)(
|
|
465
|
+
`,children:[(0,L.jsx)(gt,{...e}),(0,L.jsxs)("main",{css:Ho,children:[(0,L.jsx)(Ze,{...e}),n()]})]})]})}var Fe=require("@uniformdev/context"),Q=F(require("react"));var Yt=require("@emotion/react/jsx-runtime"),Je="embeddedUniformDevToolsSettings";function Xe({context:e,initialSettings:o}){let r=e!=null?e:typeof window!="undefined"?window.__UNIFORM_DEVTOOLS_CONTEXT_INSTANCE__:void 0,t=r!=null?r:new Fe.Context({manifest:{project:{}}}),[n,s]=Q.useState({data:t.storage.data,manifest:t.manifest.data,scores:t.scores,personalizations:[],tests:[]}),[l,d]=Q.useState(o!=null?o:{});Q.useEffect(()=>{var c;let a=(0,Fe.createDebugConsoleLogDrain)((c=l.logLevel)!=null?c:"none");return t.events.on("log",a),()=>{t.events.off("log",a)}},[l,t]),Q.useEffect(()=>{let a=()=>{let g=window.localStorage.getItem(Je)||"{}",h=JSON.parse(g),C=ye({quirks:t.storage.data.quirks,quirkOverrides:h.quirkOverrides});C&&(console.log("Applying overridden quirks:",C),t.update({quirks:C}));let T=ce({scores:t.scores,scoreOverrides:h.scoreOverrides});T.length&&(console.log("Applying overridden scores:",T),t.storage.updateData(T)),s(D=>({...D,scores:t.scores,data:t.storage.data,manifest:t.manifest.data}))},c=g=>{!g.changed||s(h=>({...h,personalizations:[...h.personalizations,g]}))},f=g=>{!g.variantAssigned||s(h=>({...h,tests:[...h.tests,g]}))};return t.events.on("personalizationResult",c),t.events.on("testResult",f),t.storage.events.on("*",a),()=>{t.storage.events.off("*",a),t.events.off("personalizationResult",c),t.events.off("testResult",f)}},[t]),Q.useEffect(()=>{if(window.localStorage){let a=window.localStorage.getItem(Je);if(a)try{let c=JSON.parse(a),f={...o,...c};d(f);let g=ce({scores:n.scores,scoreOverrides:f.scoreOverrides});p.rawUpdate(g)}catch(c){window.localStorage.removeItem(Je),console.error("Failed to parse settings from localStorage: ",c.message)}}},[]);let{actions:p,saveSettings:m,clearAllExtensionData:i}=Q.useMemo(()=>({actions:{update:g=>t.update(g),forget:()=>t.forget(!1),rawUpdate:g=>t.storage.updateData(g)},saveSettings:async g=>{d(g),window.localStorage&&window.localStorage.setItem("embeddedUniformDevToolsSettings",JSON.stringify(g))},clearAllExtensionData:async()=>{d({route:"/"}),window.localStorage&&(window.localStorage.removeItem("embeddedUniformDevToolsSettings"),window.location.reload())}}),[t]);return r?(0,Yt.jsx)(Ye,{state:n,actions:p,settings:l,saveSettings:m,clearAllExtensionData:i}):(0,Yt.jsx)("p",{children:"Unable to find Uniform Context. Ensure the devtools plugin is activated."})}var qe=require("@emotion/react"),_=require("@uniformdev/design-system"),te=F(require("react")),eo=require("react-use");var Jt=require("@emotion/react"),ee=require("@emotion/react/jsx-runtime"),Mo=Jt.css`
|
|
466
466
|
align-items: center;
|
|
467
467
|
border-radius: var(--rounded-full);
|
|
468
468
|
background: var(--brand-secondary-5);
|
|
@@ -488,7 +488,7 @@ to {
|
|
|
488
488
|
max-width: 100%;
|
|
489
489
|
height: auto;
|
|
490
490
|
}
|
|
491
|
-
`,Xt=({...e})=>(0,ee.jsxs)("button",{type:"button",css:Mo,...e,children:[(0,ee.jsx)("span",{hidden:!0,children:"Uniform devtools"}),(0,ee.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,ee.jsx)("path",{d:"M13.325 3.05011L8.66741 20.4323L10.5993 20.9499L15.2568 3.56775L13.325 3.05011Z",fill:"currentColor"}),(0,ee.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,ee.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"})]})]});var I=require("@emotion/react/jsx-runtime"),Eo="dblgnkbknchechcibdojfdoeeodhmgbd",Ao="dcmlokofjljnfjcknpmhjocogllfbhkg";function Bo(e){let[o,r]=te.useState(!1),[t,n]=te.useState(e.context),[s,l]=te.useState(!1),[d,p]=(0,eo.useLocalStorage)("isUniformInlineDevtoolsDisabled",!1);return te.useEffect(()=>{!e.context&&typeof document!="undefined"&&n(window.__UNIFORM_DEVTOOLS_CONTEXT_INSTANCE__)},[e.context]),te.useEffect(()=>{[Ao,Eo].map(m=>{let i=new Image;i.src=`chrome-extension://${m}/icons/uniform-logo.png`,i.onload=()=>l(!0)})},[]),d?null:t?(0,I.jsxs)("div",{children:[(0,I.jsx)(_.Theme,{}),(0,I.jsx)(
|
|
491
|
+
`,Xt=({...e})=>(0,ee.jsxs)("button",{type:"button",css:Mo,...e,children:[(0,ee.jsx)("span",{hidden:!0,children:"Uniform devtools"}),(0,ee.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,ee.jsx)("path",{d:"M13.325 3.05011L8.66741 20.4323L10.5993 20.9499L15.2568 3.56775L13.325 3.05011Z",fill:"currentColor"}),(0,ee.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,ee.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"})]})]});var I=require("@emotion/react/jsx-runtime"),Eo="dblgnkbknchechcibdojfdoeeodhmgbd",Ao="dcmlokofjljnfjcknpmhjocogllfbhkg";function Bo(e){let[o,r]=te.useState(!1),[t,n]=te.useState(e.context),[s,l]=te.useState(!1),[d,p]=(0,eo.useLocalStorage)("isUniformInlineDevtoolsDisabled",!1);return te.useEffect(()=>{!e.context&&typeof document!="undefined"&&n(window.__UNIFORM_DEVTOOLS_CONTEXT_INSTANCE__)},[e.context]),te.useEffect(()=>{[Ao,Eo].map(m=>{let i=new Image;i.src=`chrome-extension://${m}/icons/uniform-logo.png`,i.onload=()=>l(!0)})},[]),d?null:t?(0,I.jsxs)("div",{children:[(0,I.jsx)(_.Theme,{}),(0,I.jsx)(ve,{}),(0,I.jsx)(Xt,{onClick:()=>r(m=>!m)}),o?(0,I.jsx)("div",{css:qe.css`
|
|
492
492
|
box-shadow: var(--shadow-base);
|
|
493
493
|
position: fixed;
|
|
494
494
|
bottom: 82px;
|