@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/esm/index.js
CHANGED
|
@@ -1,10 +1,66 @@
|
|
|
1
|
-
import{jsx as g}from"@emotion/react";import*as b from"react";import{css as
|
|
1
|
+
import{jsx as g}from"@emotion/react";import*as b from"react";import{css as Mt}from"@emotion/react";import{Theme as sr}from"@uniformdev/design-system";import{computeDimensionDefinitionDisplayData as Nt,computeDimensionDisplayData as Ae,UncachedDimensionClient as Zt}from"@uniformdev/context/api";import*as Be from"react";import{useAsync as zt}from"react-use";function Qe({apiHost:e,apiKey:o,projectId:r},t){let{loading:n,error:s,value:l}=zt(async()=>{if(!o||!r)return d;let m=(await new Zt({projectId:r,apiKey:o,apiHost:e||void 0}).get()).dimensions,i={};return m.map(a=>{var c,v,u,f,C,w,k,q;if(i[a.dim]={...Nt(a),cap:a.cap,str:(f=(u=(v=(c=t==null?void 0:t.project.pz)==null?void 0:c.sig)==null?void 0:v[a.dim])==null?void 0:u.str)!=null?f:50},i[a.dim].type==="Enrichment"){let N=a.dim.split("_")[0];i[a.dim].cap=(q=(k=(w=(C=t==null?void 0:t.project.pz)==null?void 0:C.enr)==null?void 0:w[N])==null?void 0:k.cap)!=null?q:100}}),i},[e,o,r]),d=Be.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(([v,u])=>{let f=Ae(v,t);f&&(p[v]={...u,...f})}),Object.entries((c=(a=t==null?void 0:t.project.pz)==null?void 0:a.enr)!=null?c:{}).map(([v,u])=>{var w;let f=Ae(v,t),C={cap:(w=u.cap)!=null?w:100,str:10};f&&(p[v]={...f,cap:C.cap,str:C.str})}),l&&Object.entries(l).map(([v,u])=>{p[v]={...p[v],...u}})),p},[t,l]);return{loading:n,error:s,index:d}}import{UncachedQuirkClient as Ut}from"@uniformdev/context/api";import{useMemo as jt}from"react";import{useAsync as _t}from"react-use";function Fe({apiHost:e,apiKey:o,projectId:r},t){let{loading:n,error:s,value:l}=_t(async()=>{if(!o||!r)return{};let m=await new Ut({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=jt(()=>{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}}import{createContext as Gt,useContext as $t}from"react";import{jsx as Kt}from"@emotion/react/jsx-runtime";var qe=Gt({settings:{},saveSettings:()=>{}}),ce=()=>$t(qe),Ne=({children:e,settings:o,saveSettings:r})=>Kt(qe.Provider,{value:{settings:o,saveSettings:r},children:e});import{jsx as Wt}from"@emotion/react/jsx-runtime";function le(){return Wt("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
|
+
`})}import{Button as Ue}from"@uniformdev/design-system";import{css as j}from"@emotion/react";var de=j`
|
|
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
|
+
`,Ze=j`
|
|
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
|
+
`,pe=j`
|
|
25
|
+
color: var(--brand-secondary-1);
|
|
26
|
+
margin: 0;
|
|
27
|
+
font-size: var(--fs-base);
|
|
28
|
+
font-weight: var(--fw-bold);
|
|
29
|
+
`,me=j`
|
|
30
|
+
color: var(--brand-secondary-1);
|
|
31
|
+
margin: var(--spacing-xs) 0 0;
|
|
32
|
+
font-size: var(--fs-sm);
|
|
33
|
+
`,ze=j`
|
|
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
|
+
`,ue=j`
|
|
54
|
+
display: flex;
|
|
55
|
+
margin: var(--spacing-sm) 0 0;
|
|
56
|
+
gap: var(--spacing-base);
|
|
57
|
+
`;import{jsx as _,jsxs as je}from"@emotion/react/jsx-runtime";var Se=({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?je("div",{css:[de,Ze],children:[_("h2",{css:pe,children:"Connect to a Uniform Project"}),_("p",{css:me,children:"This allows reading human-readable labels for the dimensions."}),je("div",{css:ue,children:[_(Ue,{buttonType:"secondary",onClick:r,children:"Connect this site"}),_(Ue,{buttonType:"ghost",onClick:t,children:"Skip for now"})]}),_("button",{type:"button",css:ze,title:"close",onClick:t,children:_("span",{hidden:!0,children:"Close"})})]}):null};import{css as V}from"@emotion/react";import{css as Yt}from"@emotion/react";import{jsx as Jt}from"@emotion/react/jsx-runtime";var _e=()=>{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 Jt("div",{css:Yt`
|
|
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}`})};import{jsx as T,jsxs as re}from"@emotion/react/jsx-runtime";var
|
|
63
|
+
`,children:`v${o}`})};import{jsx as eo}from"@emotion/react/jsx-runtime";var Xt=({route:e,children:o,className:r})=>{let{settings:t,saveSettings:n}=ce();return eo("a",{href:"",className:r,onClick:s=>{s.preventDefault(),n({...t,route:e})},children:o})},G=Xt;import{jsx as T,jsxs as re}from"@emotion/react/jsx-runtime";var to=[{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 @@ import{jsx as g}from"@emotion/react";import*as b from"react";import{css as V}fro
|
|
|
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
|
+
`}],oo=`<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>`,Ge=({...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 re("nav",{css:V`
|
|
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 @@ import{jsx as g}from"@emotion/react";import*as b from"react";import{css as V}fro
|
|
|
64
120
|
margin: 0;
|
|
65
121
|
list-style-type: none;
|
|
66
122
|
flex-grow: 1;
|
|
67
|
-
`,children
|
|
123
|
+
`,children:to.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),T("li",{css:V`
|
|
68
124
|
padding: 0;
|
|
69
125
|
margin: 0;
|
|
70
126
|
list-style-type: none;
|
|
@@ -72,7 +128,7 @@ import{jsx as g}from"@emotion/react";import*as b from"react";import{css as V}fro
|
|
|
72
128
|
&:last-of-type {
|
|
73
129
|
margin-top: auto;
|
|
74
130
|
}
|
|
75
|
-
`,children:re(
|
|
131
|
+
`,children:re(G,{css:V`
|
|
76
132
|
align-items: center;
|
|
77
133
|
border-radius: var(--rounded-base);
|
|
78
134
|
display: flex;
|
|
@@ -116,11 +172,11 @@ import{jsx as g}from"@emotion/react";import*as b from"react";import{css as V}fro
|
|
|
116
172
|
`,rel:"noreferrer",children:[T("i",{css:V`
|
|
117
173
|
align-items: center;
|
|
118
174
|
display: flex;
|
|
119
|
-
`,dangerouslySetInnerHTML:{__html:
|
|
175
|
+
`,dangerouslySetInnerHTML:{__html:oo}}),"Install Chrome Extension"]}),T(_e,{})]})};import{Button as Ro}from"@uniformdev/design-system";import{Field as pt,Form as Vo,Formik as Po}from"formik";import*as X from"yup";function ne({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 ge({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}import{Context as ro,TransitionDataStore as no}from"@uniformdev/context";function $e({manifest:e,visitor:o,override:r}){let t=new ro({manifest:e,transitionStore:new Le({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 Le=class extends no{async handleDelete(){}async handleUpdateData(){}};import{css as K}from"@emotion/react";import*as We from"react";import{Fragment as lo,jsx as $,jsxs as Ke}from"@emotion/react/jsx-runtime";var Ye=K({willChange:"height"}),io=K`
|
|
120
176
|
border-bottom: 2px solid var(--brand-secondary-1);
|
|
121
177
|
font-size: var(--fs-base);
|
|
122
178
|
margin: 0;
|
|
123
|
-
`,
|
|
179
|
+
`,so=K`
|
|
124
180
|
align-items: center;
|
|
125
181
|
border: none;
|
|
126
182
|
background: none;
|
|
@@ -130,59 +186,141 @@ import{jsx as g}from"@emotion/react";import*as b from"react";import{css as V}fro
|
|
|
130
186
|
padding: var(--spacing-sm) 0;
|
|
131
187
|
font-weight: var(--fw-bold);
|
|
132
188
|
justify-content: space-between;
|
|
133
|
-
`,
|
|
189
|
+
`,ao=K`
|
|
134
190
|
align-self: center;
|
|
135
|
-
`,
|
|
191
|
+
`,co=K`
|
|
136
192
|
transform: rotate(-180deg);
|
|
137
|
-
`,
|
|
193
|
+
`,ve=({children:e})=>$("div",{css:[Ye],children:e}),fe=({title:e,children:o})=>{let[r,t]=We.useState(!1),n=e.split(" ").join("-").toLocaleLowerCase();return Ke(lo,{children:[$("h3",{css:io,children:Ke("button",{"aria-expanded":r,css:so,title:e,id:n,"aria-controls":`${n}-section`,onClick:()=>t(s=>!s),type:"button",children:[e,$("i",{css:[ao,r?co:void 0],children:$("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:$("path",{d:"M6.34317 7.75732L4.92896 9.17154L12 16.2426L19.0711 9.17157L17.6569 7.75735L12 13.4142L6.34317 7.75732Z",fill:"currentColor"})})})]})}),$("div",{id:`${n}-section`,css:[Ye,K`
|
|
138
194
|
padding: var(--spacing-sm) 0;
|
|
139
|
-
`],role:"region","aria-labelledby":n,children:r?o:null})]})};import{css as
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
195
|
+
`],role:"region","aria-labelledby":n,children:r?o:null})]})};import{css as po}from"@emotion/react";import{jsx as mo}from"@emotion/react/jsx-runtime";var B=({children:e,...o})=>mo("fieldset",{css:po`
|
|
196
|
+
border: none;
|
|
197
|
+
padding: 0;
|
|
198
|
+
& legend {
|
|
199
|
+
margin-bottom: var(--spacing-base);
|
|
200
|
+
}
|
|
201
|
+
`,...o,children:e});import{css as uo}from"@emotion/react";import{jsx as go}from"@emotion/react/jsx-runtime";var W=({children:e})=>go("legend",{css:uo`
|
|
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});import{Input as fo,InputSelect as ho}from"@uniformdev/design-system";import{jsx as vo}from"@emotion/react/jsx-runtime";var Oe=e=>({field:o,form:r,meta:t,...n})=>vo(e,{...o,...n,errorMessage:r.errors[o.name]});var he=Oe(fo),Je=Oe(ho);import{Caption as bo,ErrorMessage as xo}from"@uniformdev/design-system";import{css as Z}from"@emotion/react";var Xe=Z`
|
|
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
|
-
`,me=$`
|
|
217
|
+
`,hn=Z`
|
|
218
|
+
margin: var(--spacing-base) 0;
|
|
219
|
+
`,et=Z`
|
|
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
|
+
`,tt=Z`
|
|
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
|
+
`,bn=Z`
|
|
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
|
+
`,xn=Z`
|
|
234
|
+
color: var(--brand-secondary-5);
|
|
235
|
+
display: block;
|
|
236
|
+
`,ot=Z`
|
|
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
|
+
`;import{jsx as ie,jsxs as rt}from"@emotion/react/jsx-runtime";var nt=({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 rt("div",{children:[rt("label",{css:[et,ot],children:[ie("span",{css:tt,children:n}),ie("input",{type:"range",min:l,max:d,step:p,...e,value:(m=e.value)!=null?m:0}),ie("span",{className:"value-display",children:(i=e.value)!=null?i:0})]}),s?ie(bo,{children:s}):null,o.touched[e.name]&&o.errors[e.name]?ie(xo,{message:o.errors[e.name]}):null]})};import{css as yo}from"@emotion/react";import{jsx as ko}from"@emotion/react/jsx-runtime";var Co=`<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>`,wo=`<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>`,it=`<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>`,st=({type:e})=>{let o="";switch(e){case"Audience":o=Co;break;case"Signal":o=it;break;case"Intent":o=it;break;case"Enrichment":o=wo;break}return ko("i",{css:yo`
|
|
321
|
+
align-items: center;
|
|
322
|
+
display: inline-block;
|
|
323
|
+
`,dangerouslySetInnerHTML:{__html:o}})};import{css as O,keyframes as To}from"@emotion/react";var Do=To`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 ${Do};
|
|
226
364
|
`,cancelButton:O`
|
|
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
|
-
`};import{css as P}from"@emotion/react";import{jsx as
|
|
379
|
+
`};import{css as P}from"@emotion/react";import{jsx as Y}from"@emotion/react/jsx-runtime";var be=({children:e})=>Y("table",{css:P`
|
|
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}),at=({children:e})=>Y("thead",{css:P`
|
|
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}),xe=({children:e})=>Y("tbody",{children:e}),se=({border:e,children:o})=>Y("tr",{css:e?P`
|
|
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}),ye=({children:e,width:o})=>Y("th",{css:P`
|
|
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 So(e){switch(e){case"light":return P`
|
|
262
400
|
color: var(--gray-400);
|
|
263
401
|
`;case"dark":return P`
|
|
264
402
|
color: var(--brand-secondary-1);
|
|
265
|
-
`}}function
|
|
403
|
+
`}}function Lo(e){return P`
|
|
266
404
|
text-align: ${e};
|
|
267
|
-
`}var
|
|
405
|
+
`}var Q=({alignment:e="left",border:o,color:r="dark",children:t})=>Y("td",{css:[P`
|
|
268
406
|
padding: var(--spacing-base);
|
|
269
407
|
max-width: 180px;
|
|
270
408
|
overflow-wrap: break-word;
|
|
271
409
|
position: relative;
|
|
272
|
-
`,
|
|
410
|
+
`,So(r),Lo(e),o?P`
|
|
273
411
|
border-left: 1px solid var(--gray-200);
|
|
274
|
-
`:void 0],children:t});import{css as
|
|
412
|
+
`:void 0],children:t});import{css as Re}from"@emotion/react";var ct=Re`
|
|
275
413
|
position: relative;
|
|
276
414
|
display: inline-block;
|
|
277
415
|
font-size: var(--fs-base);
|
|
278
|
-
`,
|
|
416
|
+
`,lt=Re`
|
|
279
417
|
display: block;
|
|
280
418
|
text-decoration: line-through;
|
|
281
|
-
`,
|
|
419
|
+
`,dt=Re`
|
|
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
|
-
`;import{css as ao}from"@emotion/react";import{jsx as po}from"@emotion/react/jsx-runtime";var co=`<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>`,lo=`<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>`,Ye=`<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>`,Je=({type:e})=>{let o="";switch(e){case"Audience":o=co;break;case"Signal":o=Ye;break;case"Intent":o=Ye;break;case"Enrichment":o=lo;break}return po("i",{css:ao`
|
|
306
|
-
align-items: center;
|
|
307
|
-
display: inline-block;
|
|
308
|
-
`,dangerouslySetInnerHTML:{__html:o}})};import{jsx as I,jsxs as Y}from"@emotion/react/jsx-runtime";var mo=({dimensionIndex:e,dimensions:o,disableEditOverride:r,onClick:t,preemptiveOverrides:n})=>{var d;let{settings:s}=ce(),l=(d=n!=null?n:s.scoreOverrides)!=null?d:{};return I(ve,{children:I(fe,{children:Object.entries(o).sort(([p],[m])=>p.localeCompare(m)).map(([p,m])=>{var f;let{dim:i,name:a,type:c,category:v}=(f=e[p])!=null?f:{name:p,dim:p,type:void 0,category:void 0},u=l[i];return Y(ne,{children:[Y(B,{children:[u!==void 0?I("s",{css:Ke,children:u.initial}):null,Y("b",{css:$e,children:[m,u!==void 0&&I("i",{css:We})]})]}),I(B,{children:Y("div",{onClick:()=>t==null?void 0:t(i),css:t?{cursor:"pointer"}:void 0,children:[I("span",{css:h.divider,role:"presentation"}),Y("div",{children:[I(Je,{type:c})," ",c]}),Y("strong",{children:[v?`${v}:`:""," ",a]})]})}),I(B,{alignment:"right",color:"light",children:u!==void 0&&!r?I(j,{route:`/overrides/${i}`,children:"Edit override"}):null})]},i)})})})},Z=mo;async function be({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 Xe({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}}])}import{Button as et}from"@uniformdev/design-system";import{Switch as uo}from"@uniformdev/design-system";import{Fragment as go,jsx as R,jsxs as xe}from"@emotion/react/jsx-runtime";var ot=({dimensionIndex:{index:e},state:{scores:o,data:r},actions:t,saveSettings:n,settings:s})=>{let l=tt.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 R(go,{children:xe("article",{css:h.page,children:[xe("div",{css:h.headingGroup,children:[xe("h2",{css:h.title,children:["Dimensions",xe("small",{children:[d," active of ",p]})]}),R("div",{css:h.reset,children:R(et,{buttonType:"ghost",onClick:()=>be({actions:t,saveSettings:n,scores:o,settings:s}).then(t.forget),children:"clear all dimensions"})}),R(uo,{name:"controlGroup",label:"Control Group",onChange:m,checked:r.controlGroup})]}),d>0?R(Z,{dimensionIndex:e,dimensions:o}):R(K,{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?R(et,{buttonType:"secondary",onClick:m,children:"Exit control group"}):null}),R(le,{children:R(de,{title:`Inactive Dimensions (${Object.keys(l).length})`,children:R(Z,{dimensionIndex:e,dimensions:l})})})]})})};import{AddButton as vo}from"@uniformdev/design-system";import{Button as rt}from"@uniformdev/design-system";import{Fragment as fo,jsx as H,jsxs as nt}from"@emotion/react/jsx-runtime";var it=({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,v])=>{l[c]!==void 0&&(i[c]=v)}),H(fo,{children:nt("article",{css:h.page,children:[nt("div",{css:h.headingGroup,children:[H("h2",{css:h.title,children:"What if?"}),H("div",{css:h.reset,children:H(rt,{buttonType:"ghost",onClick:()=>be({actions:t,settings:n,saveSettings:s,scores:r}),children:"delete all overrides"})}),H(vo,{onClick:p})]}),H("p",{children:"Override dimension scores to test personalization"}),d>0?H(Z,{dimensionIndex:e,dimensions:i,onClick:c=>s({...n,route:`/overrides/${c}`})}):H(K,{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?H(rt,{buttonType:"secondary",onClick:m,children:"Exit control group"}):null})]})})};import{Field as gt,Form as Oo,Formik as Ro}from"formik";import*as X from"yup";import{css as z}from"@emotion/react";var st=z`
|
|
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
|
-
`,bn=z`
|
|
320
|
-
margin: var(--spacing-base) 0;
|
|
321
|
-
`,at=z`
|
|
322
|
-
color: var(--brand-secondary-1);
|
|
323
|
-
display: flex;
|
|
324
|
-
flex-direction: column;
|
|
325
|
-
margin: 0 0 var(--spacing-sm);
|
|
326
|
-
`,ct=z`
|
|
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
|
-
`,xn=z`
|
|
333
|
-
color: var(--gray-600);
|
|
334
|
-
font-size: var(--fs-sm);
|
|
335
|
-
`,yn=z`
|
|
336
|
-
color: var(--brand-secondary-5);
|
|
337
|
-
display: block;
|
|
338
|
-
`,lt=z`
|
|
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
|
-
`;import{Caption as ho,ErrorMessage as bo}from"@uniformdev/design-system";import{jsx as ie,jsxs as dt}from"@emotion/react/jsx-runtime";var pt=({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 dt("div",{children:[dt("label",{css:[at,lt],children:[ie("span",{css:ct,children:n}),ie("input",{type:"range",min:l,max:d,step:p,...e,value:(m=e.value)!=null?m:0}),ie("span",{className:"value-display",children:(i=e.value)!=null?i:0})]}),s?ie(ho,{children:s}):null,o.touched[e.name]&&o.errors[e.name]?ie(bo,{message:o.errors[e.name]}):null]})};import{css as xo}from"@emotion/react";import{jsx as yo}from"@emotion/react/jsx-runtime";var Q=({children:e,...o})=>yo("fieldset",{css:xo`
|
|
407
|
-
border: none;
|
|
408
|
-
padding: 0;
|
|
409
|
-
& legend {
|
|
410
|
-
margin-bottom: var(--spacing-base);
|
|
411
|
-
}
|
|
412
|
-
`,...o,children:e});import{css as Co}from"@emotion/react";import{jsx as wo}from"@emotion/react/jsx-runtime";var J=({children:e})=>wo("legend",{css:Co`
|
|
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});import{Context as ko,TransitionDataStore as To}from"@uniformdev/context";function mt({manifest:e,visitor:o,override:r}){let t=new ko({manifest:e,transitionStore:new Oe({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 Oe=class extends To{async handleDelete(){}async handleUpdateData(){}};function se({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}import{Button as Vo}from"@uniformdev/design-system";import{jsx as Do}from"@emotion/react/jsx-runtime";var Re=e=>({field:o,form:r,meta:t,...n})=>Do(e,{...o,...n,errorMessage:r.errors[o.name]});import{Input as So,InputSelect as Lo}from"@uniformdev/design-system";var Ce=Re(So),ut=Re(Lo);import{jsx as L,jsxs as vt}from"@emotion/react/jsx-runtime";var Po=X.object({dimension:X.string(),score:X.number()}),Ve=({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 L("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}: `:"",v=a.category?`${a.category} - `:"",u=`${c}${v}${a.name}`;return{value:i,label:u}});return d.unshift({value:"",label:"Choose dimension to override"}),L(Ro,{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:Po,enableReinitialize:!0,validateOnChange:!1,validateOnBlur:!1,onSubmit:async i=>{var f,C,w,k,q,N;let a=(C=(f=n[i.dimension])==null?void 0:f.cap)!=null?C:0,c=Math.min(i.score,a),v={...e,scoreOverrides:{...e.scoreOverrides,[i.dimension]:{initial:(N=(q=(k=(w=e.scoreOverrides)==null?void 0:w[i.dimension])==null?void 0:k.initial)!=null?q:r.scores[i.dimension])!=null?N:0,override:c}},route:"/overrides"};await o(v);let u=se({scores:r.scores,scoreOverrides:v.scoreOverrides});t.rawUpdate(u)},children:({isSubmitting:i,values:a,setFieldValue:c})=>{var w;let v=mt({manifest:r.manifest,visitor:r.data,override:{type:"modscore",data:{dimension:a.dimension,delta:a.score-((w=r.scores[a.dimension])!=null?w:0)}}}),u=Object.entries(r.scores).reduce((k,[q,N])=>(k[q]={initial:N,override:N},k),{}),f={max:100,step:50};n[a.dimension]&&(f.max=n[a.dimension].cap,f.step=n[a.dimension].str);let C=a.score&&Object.keys(v).length>0;return vt(Oo,{css:h.page,children:[L("h1",{css:h.title,children:"Override Dimension"}),L(gt,{component:ut,label:"Dimension",id:"dimension",name:"dimension",options:d,disabled:i,onChange:k=>{c("score",0,!1),c("dimension",k.target.value)}}),L("p",{css:h.text,children:L("small",{children:"Audiences and Intents are aggregated from other dimension scores and cannot be overridden directly."})}),a.dimension?L(gt,{component:pt,name:"score",label:"Score",disabled:i,max:f.max,step:f.step,caption:`Range: 0 - ${f.max} in increments of ${f.step}`}):null,vt(Q,{disabled:i,css:{marginBottom:"2rem"},children:[C?L(le,{children:L(de,{title:`Impacted Dimensions (${Object.keys(v).length})`,children:L(Z,{preemptiveOverrides:u,dimensionIndex:n,dimensions:v,disableEditOverride:!0})})}):null,L(Vo,{type:"submit",css:h.submitButton,disabled:i,children:"Save"}),L(j,{route:"/overrides",css:h.cancelButton,children:"Cancel"})]})]})}})};import{useState as Qo}from"react";import{useState as Io,useEffect as Ho}from"react";import{Button as Mo,Input as Eo}from"@uniformdev/design-system";import{jsx as ft,jsxs as Bo}from"@emotion/react/jsx-runtime";var Ao=({name:e,value:o,submit:r})=>{let[t,n]=Io(o!=null?o:"");return Ho(()=>{n(o!=null?o:"")},[o]),Bo("div",{css:{display:"flex",gap:"var(--spacing-sm)"},children:[ft(Eo,{type:"text",css:[st],name:e,value:t,onChange:d=>{n(d.target.value)}}),ft(Mo,{buttonType:"primary",disabled:t===o,size:"sm",onClick:()=>r(e,t!=null?t:""),children:"Save"})]})},ht=Ao;import{Button as bt,InputSelect as Fo}from"@uniformdev/design-system";import{Fragment as xt,jsx as y,jsxs as ee}from"@emotion/react/jsx-runtime";var yt=({...e})=>{let{state:{data:{quirks:o}},quirksIndex:{index:r},settings:t,saveSettings:n,actions:s}=e,[l,d]=Qo(""),p;l&&(p=r[l]);let m=async(i,a)=>{var u,f,C;d("");let c={...t,quirkOverrides:{...t.quirkOverrides,[i]:{initial:(C=(f=(u=t.quirkOverrides)==null?void 0:u[i])==null?void 0:f.initial)!=null?C:o[i],override:a}}};await n(c);let v=ye({quirks:o,quirkOverrides:c.quirkOverrides});await s.update({quirks:v})};return y(xt,{children:ee("article",{css:[h.page,h.quirks],children:[y("h1",{css:h.title,children:"Quirks"}),y("p",{css:h.text,children:"Keys defined in Uniform and their current, programmatically defined values for this visit."}),Object.keys(r).length?ee(ve,{children:[y(Ge,{children:ee(ne,{children:[y(he,{width:"30%",children:"Key"}),y(he,{width:"50%",children:"Value"}),y(he,{width:"20%",children:""})]})}),y(fe,{children:Object.values(r).map(({name:i,value:a,id:c})=>{var f,C,w;let v=(C=(f=t.quirkOverrides)==null?void 0:f[i])==null?void 0:C.initial,u=[];return p&&p.options&&(u=p.options.map(k=>({value:k.value,label:k.name}))),ee(ne,{border:"bottom",children:[y(B,{children:y("strong",{children:i})}),ee(B,{children:[l!==c?ee("div",{onClick:()=>{d(c)},children:[v?y("div",{children:y("s",{children:v})}):null,a]}):null,l===c&&p&&y(xt,{children:p.options?y(Fo,{showLabel:!1,label:`Change ${i}`,defaultOption:`Change ${i}`,name:c,onChange:k=>m(k.target.name,k.target.value),options:u}):y(ht,{name:c,value:a,submit:m})})]}),y(B,{children:l?null:(w=t.quirkOverrides)!=null&&w[c]?y(bt,{buttonType:"ghost",onClick:()=>{Xe({quirk:c,settings:t,saveSettings:n,actions:s})},children:y("small",{children:"Clear Override"})}):y(bt,{buttonType:"ghost",onClick:()=>{d(c)},children:y("small",{children:"Override"})})})]},c)})})]}):y(K,{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."})]})})};import{Button as Ct}from"@uniformdev/design-system";import{Switch as wt}from"@uniformdev/design-system";import{jsx as D,jsxs as ae}from"@emotion/react/jsx-runtime";var kt=({settings:e,saveSettings:o,actions:r,state:{data:t},clearAllExtensionData:n})=>ae("article",{css:[h.page,{display:"flex",flexDirection:"column",gap:"var(--spacing-base)"}],children:[D("h1",{css:h.title,children:"Settings"}),ae(Q,{children:[D(J,{children:"Data Connection"}),D(Ct,{buttonType:"tertiary",onClick:()=>{o({...e,route:"/connect"})},children:"Manage Connection to Uniform"})]}),ae(Q,{children:[D(J,{children:"Storage Consent"}),D(wt,{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})}}),D("p",{children:D("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."})})]}),ae(Q,{children:[D(J,{children:"Logging"}),D(wt,{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"})})]}),ae(Q,{children:[D(J,{children:"Clear extension storage"}),D(Ct,{onClick:()=>{n()},children:"Clear"}),D("p",{children:D("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."})})]})]});import{Button as Tt}from"@uniformdev/design-system";import{jsx as te,jsxs as Dt}from"@emotion/react/jsx-runtime";var Pe=({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?Dt("div",{css:[pe,je],children:[te("h2",{css:me,children:"Connect to a Uniform Project"}),te("p",{css:ue,children:"This allows reading human-readable labels for the dimensions."}),Dt("div",{css:ge,children:[te(Tt,{buttonType:"secondary",onClick:r,children:"Connect this site"}),te(Tt,{buttonType:"ghost",onClick:t,children:"Skip for now"})]}),te("button",{type:"button",css:_e,title:"close",onClick:t,children:te("span",{hidden:!0,children:"Close"})})]}):null};import{computeDimensionDefinitionDisplayData as qo,computeDimensionDisplayData as St,UncachedDimensionClient as No}from"@uniformdev/context/api";import{useAsync as Zo}from"react-use";import*as Lt from"react";function Ot({apiHost:e,apiKey:o,projectId:r},t){let{loading:n,error:s,value:l}=Zo(async()=>{if(!o||!r)return d;let m=(await new No({projectId:r,apiKey:o,apiHost:e||void 0}).get()).dimensions,i={};return m.map(a=>{var c,v,u,f,C,w,k,q;if(i[a.dim]={...qo(a),cap:a.cap,str:(f=(u=(v=(c=t==null?void 0:t.project.pz)==null?void 0:c.sig)==null?void 0:v[a.dim])==null?void 0:u.str)!=null?f:50},i[a.dim].type==="Enrichment"){let N=a.dim.split("_")[0];i[a.dim].cap=(q=(k=(w=(C=t==null?void 0:t.project.pz)==null?void 0:C.enr)==null?void 0:w[N])==null?void 0:k.cap)!=null?q:100}}),i},[e,o,r]),d=Lt.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(([v,u])=>{let f=St(v,t);f&&(p[v]={...u,...f})}),Object.entries((c=(a=t==null?void 0:t.project.pz)==null?void 0:a.enr)!=null?c:{}).map(([v,u])=>{var w;let f=St(v,t),C={cap:(w=u.cap)!=null?w:100,str:10};f&&(p[v]={...f,cap:C.cap,str:C.str})}),l&&Object.entries(l).map(([v,u])=>{p[v]={...p[v],...u}})),p},[t,l]);return{loading:n,error:s,index:d}}import{useMemo as zo}from"react";import{UncachedQuirkClient as Uo}from"@uniformdev/context/api";import{useAsync as jo}from"react-use";function Rt({apiHost:e,apiKey:o,projectId:r},t){let{loading:n,error:s,value:l}=jo(async()=>{if(!o||!r)return{};let m=await new Uo({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=zo(()=>{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}}import{css as Mt}from"@emotion/react";import{Theme as sr}from"@uniformdev/design-system";import{jsx as _o}from"@emotion/react/jsx-runtime";function we(){return _o("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
|
-
`})}import{useEffect as Go,useState as $o}from"react";import{useMountedState as Ko}from"react-use";import{jsx as Vt,jsxs as Wo}from"@emotion/react/jsx-runtime";var Pt=()=>{let[e,o]=$o(!1),r=Ko();return Go(()=>{setTimeout(()=>{r()&&o(!0)},1e3)},[r]),e?Wo("article",{css:h.page,children:[Vt("h1",{children:"Loading..."}),Vt("p",{children:"Connecting to Uniform API for complete data."})]}):null};import{parseQuickConnect as Yo}from"@uniformdev/context";import{ApiClientError as Jo,UncachedManifestClient as Xo}from"@uniformdev/context/api";import{Field as Ie,Form as er,Formik as tr}from"formik";import*as F from"react";import{ErrorMessage as or,Input as rr,Button as oe}from"@uniformdev/design-system";import{Fragment as ke,jsx as x,jsxs as M}from"@emotion/react/jsx-runtime";function It(e){let[o,r]=F.useState(e.currentData?"c":"qc"),[t,n]=F.useState(void 0),[s,l]=F.useState(void 0),d=F.useCallback(async i=>{let a=new Xo(i);n(void 0);try{let c=await a.get({preview:!0});return l({manifest:c,target:i}),c}catch(c){if(c instanceof Jo){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}},[]);F.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 M("div",{children:[t?M(ke,{children:[x(or,{message:t}),x(oe,{buttonType:"secondary",type:"button",onClick:m,children:"Clear old/broken settings"})]}):null,o==="qc"||o==="mc"?x(nr,{...e,state:o,setState:r,onConnect:p}):x("div",{children:s?M(ke,{children:[M("p",{children:["Connected to"," ",x("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:x("strong",{children:s==null?void 0:s.manifest.project.name})})," ",M("small",{children:["(",s==null?void 0:s.manifest.project.id,")"]})]}),x(oe,{buttonType:"secondary",type:"button",onClick:m,children:"Disconnect"})]}):null})]})}function nr({setState:e,state:o,currentData:r,onConnect:t}){var n,s,l;return x("div",{children:x(tr,{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})=>x(er,{children:x("fieldset",{css:{display:"flex",flexDirection:"column",gap:"var(--spacing-base)"},children:o==="qc"?M(ke,{children:[x("div",{children:x(rr,{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=Yo(a.currentTarget.value);d("apiHost",c.apiHost),d("apiKey",c.apiKey),d("projectId",c.projectId)}catch(c){p("qc",c.message)}}})}),M("section",{css:{display:"flex",gap:"var(--spacing-sm)"},children:[x(oe,{type:"submit",buttonType:"primary",disabled:i,children:i?"Verifying...":"Connect"}),x(oe,{type:"button",buttonType:"ghost",onClick:()=>e("mc"),disabled:i,children:"Connect Manually"})]})]}):M(ke,{children:[x("div",{children:x(Ie,{component:Ce,label:"API Key",name:"apiKey",caption:"Generate an API key in your Uniform team settings."})}),x("div",{children:x(Ie,{component:Ce,label:"Project ID",name:"projectId",caption:"Available to copy after generating an API key"})}),x("div",{children:x(Ie,{component:Ce,label:"API Host",name:"apiHost",caption:"Use a non-standard Uniform API endpoint. Most people will not not need this option."})}),M("section",{css:{display:"flex",gap:"var(--spacing-sm)"},children:[x(oe,{type:"submit",buttonType:"primary",disabled:i,children:i?"Verifying...":"Connect"}),x(oe,{type:"button",buttonType:"ghost",onClick:()=>e("qc"),disabled:i,children:"Use Quick Connect"})]})]})})})})})}import{jsx as Te,jsxs as ir}from"@emotion/react/jsx-runtime";var Ht=({settings:e,saveSettings:o})=>{let r=e.apiKey&&e.projectId?{apiKey:e.apiKey,projectId:e.projectId,apiHost:e.apiHost}:void 0;return ir("article",{css:h.page,children:[Te("h1",{css:h.title,children:"Connect to a Uniform Project"}),Te("p",{css:h.text,children:Te("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."})}),Te(It,{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})]})};import{jsx as S,jsxs as He}from"@emotion/react/jsx-runtime";var ar=Mt`
|
|
427
|
+
`;import{jsx as I,jsxs as J}from"@emotion/react/jsx-runtime";var Oo=({dimensionIndex:e,dimensions:o,disableEditOverride:r,onClick:t,preemptiveOverrides:n})=>{var d;let{settings:s}=ce(),l=(d=n!=null?n:s.scoreOverrides)!=null?d:{};return I(be,{children:I(xe,{children:Object.entries(o).sort(([p],[m])=>p.localeCompare(m)).map(([p,m])=>{var f;let{dim:i,name:a,type:c,category:v}=(f=e[p])!=null?f:{name:p,dim:p,type:void 0,category:void 0},u=l[i];return J(se,{children:[J(Q,{children:[u!==void 0?I("s",{css:lt,children:u.initial}):null,J("b",{css:ct,children:[m,u!==void 0&&I("i",{css:dt})]})]}),I(Q,{children:J("div",{onClick:()=>t==null?void 0:t(i),css:t?{cursor:"pointer"}:void 0,children:[I("span",{css:h.divider,role:"presentation"}),J("div",{children:[I(st,{type:c})," ",c]}),J("strong",{children:[v?`${v}:`:""," ",a]})]})}),I(Q,{alignment:"right",color:"light",children:u!==void 0&&!r?I(G,{route:`/overrides/${i}`,children:"Edit override"}):null})]},i)})})})},z=Oo;import{jsx as L,jsxs as mt}from"@emotion/react/jsx-runtime";var Io=X.object({dimension:X.string(),score:X.number()}),Ve=({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 L("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}: `:"",v=a.category?`${a.category} - `:"",u=`${c}${v}${a.name}`;return{value:i,label:u}});return d.unshift({value:"",label:"Choose dimension to override"}),L(Po,{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:Io,enableReinitialize:!0,validateOnChange:!1,validateOnBlur:!1,onSubmit:async i=>{var f,C,w,k,q,N;let a=(C=(f=n[i.dimension])==null?void 0:f.cap)!=null?C:0,c=Math.min(i.score,a),v={...e,scoreOverrides:{...e.scoreOverrides,[i.dimension]:{initial:(N=(q=(k=(w=e.scoreOverrides)==null?void 0:w[i.dimension])==null?void 0:k.initial)!=null?q:r.scores[i.dimension])!=null?N:0,override:c}},route:"/overrides"};await o(v);let u=ne({scores:r.scores,scoreOverrides:v.scoreOverrides});t.rawUpdate(u)},children:({isSubmitting:i,values:a,setFieldValue:c})=>{var w;let v=$e({manifest:r.manifest,visitor:r.data,override:{type:"modscore",data:{dimension:a.dimension,delta:a.score-((w=r.scores[a.dimension])!=null?w:0)}}}),u=Object.entries(r.scores).reduce((k,[q,N])=>(k[q]={initial:N,override:N},k),{}),f={max:100,step:50};n[a.dimension]&&(f.max=n[a.dimension].cap,f.step=n[a.dimension].str);let C=a.score&&Object.keys(v).length>0;return mt(Vo,{css:h.page,children:[L("h1",{css:h.title,children:"Override Dimension"}),L(pt,{component:Je,label:"Dimension",id:"dimension",name:"dimension",options:d,disabled:i,onChange:k=>{c("score",0,!1),c("dimension",k.target.value)}}),L("p",{css:h.text,children:L("small",{children:"Audiences and Intents are aggregated from other dimension scores and cannot be overridden directly."})}),a.dimension?L(pt,{component:nt,name:"score",label:"Score",disabled:i,max:f.max,step:f.step,caption:`Range: 0 - ${f.max} in increments of ${f.step}`}):null,mt(B,{disabled:i,css:{marginBottom:"2rem"},children:[C?L(ve,{children:L(fe,{title:`Impacted Dimensions (${Object.keys(v).length})`,children:L(z,{preemptiveOverrides:u,dimensionIndex:n,dimensions:v,disableEditOverride:!0})})}):null,L(Ro,{type:"submit",css:h.submitButton,disabled:i,children:"Save"}),L(G,{route:"/overrides",css:h.cancelButton,children:"Cancel"})]})]})}})};import{Button as gt}from"@uniformdev/design-system";import{Switch as Mo}from"@uniformdev/design-system";import*as vt from"react";async function Ce({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 ut({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}}])}import{jsx as Pe,jsxs as Ho}from"@emotion/react/jsx-runtime";var ee=({title:e,text:o,buttonGroup:r,children:t})=>Ho("div",{css:de,children:[Pe("h2",{css:pe,children:e}),Pe("p",{css:me,children:o}),t,r?Pe("div",{css:ue,children:r}):null]});import{Fragment as Eo,jsx as R,jsxs as we}from"@emotion/react/jsx-runtime";var ft=({dimensionIndex:{index:e},state:{scores:o,data:r},actions:t,saveSettings:n,settings:s})=>{let l=vt.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 R(Eo,{children:we("article",{css:h.page,children:[we("div",{css:h.headingGroup,children:[we("h2",{css:h.title,children:["Dimensions",we("small",{children:[d," active of ",p]})]}),R("div",{css:h.reset,children:R(gt,{buttonType:"ghost",onClick:()=>Ce({actions:t,saveSettings:n,scores:o,settings:s}).then(t.forget),children:"clear all dimensions"})}),R(Mo,{name:"controlGroup",label:"Control Group",onChange:m,checked:r.controlGroup})]}),d>0?R(z,{dimensionIndex:e,dimensions:o}):R(ee,{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?R(gt,{buttonType:"secondary",onClick:m,children:"Exit control group"}):null}),R(ve,{children:R(fe,{title:`Inactive Dimensions (${Object.keys(l).length})`,children:R(z,{dimensionIndex:e,dimensions:l})})})]})})};import{AddButton as Ao}from"@uniformdev/design-system";import{Button as ht}from"@uniformdev/design-system";import{Fragment as Bo,jsx as H,jsxs as bt}from"@emotion/react/jsx-runtime";var xt=({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,v])=>{l[c]!==void 0&&(i[c]=v)}),H(Bo,{children:bt("article",{css:h.page,children:[bt("div",{css:h.headingGroup,children:[H("h2",{css:h.title,children:"What if?"}),H("div",{css:h.reset,children:H(ht,{buttonType:"ghost",onClick:()=>Ce({actions:t,settings:n,saveSettings:s,scores:r}),children:"delete all overrides"})}),H(Ao,{onClick:p})]}),H("p",{children:"Override dimension scores to test personalization"}),d>0?H(z,{dimensionIndex:e,dimensions:i,onClick:c=>s({...n,route:`/overrides/${c}`})}):H(ee,{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?H(ht,{buttonType:"secondary",onClick:m,children:"Exit control group"}):null})]})})};import{Button as wt,InputSelect as Uo}from"@uniformdev/design-system";import{useState as jo}from"react";import{Button as Qo,Input as Fo}from"@uniformdev/design-system";import{useEffect as qo,useState as No}from"react";import{jsx as yt,jsxs as zo}from"@emotion/react/jsx-runtime";var Zo=({name:e,value:o,submit:r})=>{let[t,n]=No(o!=null?o:"");return qo(()=>{n(o!=null?o:"")},[o]),zo("div",{css:{display:"flex",gap:"var(--spacing-sm)"},children:[yt(Fo,{type:"text",css:[Xe],name:e,value:t,onChange:d=>{n(d.target.value)}}),yt(Qo,{buttonType:"primary",disabled:t===o,size:"sm",onClick:()=>r(e,t!=null?t:""),children:"Save"})]})},Ct=Zo;import{Fragment as kt,jsx as y,jsxs as te}from"@emotion/react/jsx-runtime";var Tt=({...e})=>{let{state:{data:{quirks:o}},quirksIndex:{index:r},settings:t,saveSettings:n,actions:s}=e,[l,d]=jo(""),p;l&&(p=r[l]);let m=async(i,a)=>{var u,f,C;d("");let c={...t,quirkOverrides:{...t.quirkOverrides,[i]:{initial:(C=(f=(u=t.quirkOverrides)==null?void 0:u[i])==null?void 0:f.initial)!=null?C:o[i],override:a}}};await n(c);let v=ge({quirks:o,quirkOverrides:c.quirkOverrides});await s.update({quirks:v})};return y(kt,{children:te("article",{css:[h.page,h.quirks],children:[y("h1",{css:h.title,children:"Quirks"}),y("p",{css:h.text,children:"Keys defined in Uniform and their current, programmatically defined values for this visit."}),Object.keys(r).length?te(be,{children:[y(at,{children:te(se,{children:[y(ye,{width:"30%",children:"Key"}),y(ye,{width:"50%",children:"Value"}),y(ye,{width:"20%",children:""})]})}),y(xe,{children:Object.values(r).map(({name:i,value:a,id:c})=>{var f,C,w;let v=(C=(f=t.quirkOverrides)==null?void 0:f[i])==null?void 0:C.initial,u=[];return p&&p.options&&(u=p.options.map(k=>({value:k.value,label:k.name}))),te(se,{border:"bottom",children:[y(Q,{children:y("strong",{children:i})}),te(Q,{children:[l!==c?te("div",{onClick:()=>{d(c)},children:[v?y("div",{children:y("s",{children:v})}):null,a]}):null,l===c&&p&&y(kt,{children:p.options?y(Uo,{showLabel:!1,label:`Change ${i}`,defaultOption:`Change ${i}`,name:c,onChange:k=>m(k.target.name,k.target.value),options:u}):y(Ct,{name:c,value:a,submit:m})})]}),y(Q,{children:l?null:(w=t.quirkOverrides)!=null&&w[c]?y(wt,{buttonType:"ghost",onClick:()=>{ut({quirk:c,settings:t,saveSettings:n,actions:s})},children:y("small",{children:"Clear Override"})}):y(wt,{buttonType:"ghost",onClick:()=>{d(c)},children:y("small",{children:"Override"})})})]},c)})})]}):y(ee,{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."})]})})};import{Button as Dt}from"@uniformdev/design-system";import{Switch as St}from"@uniformdev/design-system";import{jsx as D,jsxs as ae}from"@emotion/react/jsx-runtime";var Lt=({settings:e,saveSettings:o,actions:r,state:{data:t},clearAllExtensionData:n})=>ae("article",{css:[h.page,{display:"flex",flexDirection:"column",gap:"var(--spacing-base)"}],children:[D("h1",{css:h.title,children:"Settings"}),ae(B,{children:[D(W,{children:"Data Connection"}),D(Dt,{buttonType:"tertiary",onClick:()=>{o({...e,route:"/connect"})},children:"Manage Connection to Uniform"})]}),ae(B,{children:[D(W,{children:"Storage Consent"}),D(St,{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})}}),D("p",{children:D("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."})})]}),ae(B,{children:[D(W,{children:"Logging"}),D(St,{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"})})]}),ae(B,{children:[D(W,{children:"Clear extension storage"}),D(Dt,{onClick:()=>{n()},children:"Clear"}),D("p",{children:D("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."})})]})]});import{parseQuickConnect as _o}from"@uniformdev/context";import{ApiClientError as Go,UncachedManifestClient as $o}from"@uniformdev/context/api";import{Button as oe,ErrorMessage as Ko,Input as Wo}from"@uniformdev/design-system";import{Field as Ie,Form as Yo,Formik as Jo}from"formik";import*as F from"react";import{Fragment as ke,jsx as x,jsxs as M}from"@emotion/react/jsx-runtime";function Ot(e){let[o,r]=F.useState(e.currentData?"c":"qc"),[t,n]=F.useState(void 0),[s,l]=F.useState(void 0),d=F.useCallback(async i=>{let a=new $o(i);n(void 0);try{let c=await a.get({preview:!0});return l({manifest:c,target:i}),c}catch(c){if(c instanceof Go){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}},[]);F.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 M("div",{children:[t?M(ke,{children:[x(Ko,{message:t}),x(oe,{buttonType:"secondary",type:"button",onClick:m,children:"Clear old/broken settings"})]}):null,o==="qc"||o==="mc"?x(Xo,{...e,state:o,setState:r,onConnect:p}):x("div",{children:s?M(ke,{children:[M("p",{children:["Connected to"," ",x("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:x("strong",{children:s==null?void 0:s.manifest.project.name})})," ",M("small",{children:["(",s==null?void 0:s.manifest.project.id,")"]})]}),x(oe,{buttonType:"secondary",type:"button",onClick:m,children:"Disconnect"})]}):null})]})}function Xo({setState:e,state:o,currentData:r,onConnect:t}){var n,s,l;return x("div",{children:x(Jo,{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})=>x(Yo,{children:x("fieldset",{css:{display:"flex",flexDirection:"column",gap:"var(--spacing-base)"},children:o==="qc"?M(ke,{children:[x("div",{children:x(Wo,{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=_o(a.currentTarget.value);d("apiHost",c.apiHost),d("apiKey",c.apiKey),d("projectId",c.projectId)}catch(c){p("qc",c.message)}}})}),M("section",{css:{display:"flex",gap:"var(--spacing-sm)"},children:[x(oe,{type:"submit",buttonType:"primary",disabled:i,children:i?"Verifying...":"Connect"}),x(oe,{type:"button",buttonType:"ghost",onClick:()=>e("mc"),disabled:i,children:"Connect Manually"})]})]}):M(ke,{children:[x("div",{children:x(Ie,{component:he,label:"API Key",name:"apiKey",caption:"Generate an API key in your Uniform team settings."})}),x("div",{children:x(Ie,{component:he,label:"Project ID",name:"projectId",caption:"Available to copy after generating an API key"})}),x("div",{children:x(Ie,{component:he,label:"API Host",name:"apiHost",caption:"Use a non-standard Uniform API endpoint. Most people will not not need this option."})}),M("section",{css:{display:"flex",gap:"var(--spacing-sm)"},children:[x(oe,{type:"submit",buttonType:"primary",disabled:i,children:i?"Verifying...":"Connect"}),x(oe,{type:"button",buttonType:"ghost",onClick:()=>e("qc"),disabled:i,children:"Use Quick Connect"})]})]})})})})})}import{jsx as Te,jsxs as er}from"@emotion/react/jsx-runtime";var Rt=({settings:e,saveSettings:o})=>{let r=e.apiKey&&e.projectId?{apiKey:e.apiKey,projectId:e.projectId,apiHost:e.apiHost}:void 0;return er("article",{css:h.page,children:[Te("h1",{css:h.title,children:"Connect to a Uniform Project"}),Te("p",{css:h.text,children:Te("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."})}),Te(Ot,{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})]})};import{useEffect as tr,useState as or}from"react";import{useMountedState as rr}from"react-use";import{jsx as Vt,jsxs as nr}from"@emotion/react/jsx-runtime";var Pt=()=>{let[e,o]=or(!1),r=rr();return tr(()=>{setTimeout(()=>{r()&&o(!0)},1e3)},[r]),e?nr("article",{css:h.page,children:[Vt("h1",{children:"Loading..."}),Vt("p",{children:"Connecting to Uniform API for complete data."})]}):null};import{jsx as It,jsxs as ir}from"@emotion/react/jsx-runtime";var Ht=()=>ir("article",{children:[It("h1",{children:"Something when wrong"}),It("p",{children:"We could not find the page you're looking for."})]});import{jsx as S,jsxs as He}from"@emotion/react/jsx-runtime";var ar=Mt`
|
|
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 Et(e){let o=
|
|
456
|
+
`;function Et(e){let o=Qe(e.settings,e.state.manifest),r=Fe(e.settings,e.state.data.quirks),t={...e,dimensionIndex:o,quirksIndex:r},n=()=>{var s;if(o.loading||r.loading)return S(Pt,{});if(e.settings.route&&e.settings.route.match(/overrides\/\w+/))return S(Ve,{...t});switch((s=e.settings)==null?void 0:s.route){case void 0:case"/":case"/dimensions":return S(ft,{...t});case"/overrides":return S(xt,{...t});case"/overrides/add":return S(Ve,{...t});case"/quirks":return S(Tt,{...t});case"/settings":return S(Lt,{...t});case"/connect":return S(Rt,{...t});default:return S(Ht,{})}};return He(Ne,{settings:e.settings,saveSettings:e.saveSettings,children:[S(sr,{}),S(le,{}),He("div",{css:Mt`
|
|
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:[S(
|
|
465
|
+
`,children:[S(Ge,{...e}),He("main",{css:ar,children:[S(Se,{...e}),n()]})]})]})}import{Context as cr,createDebugConsoleLogDrain as lr}from"@uniformdev/context";import*as E from"react";import{jsx as At}from"@emotion/react/jsx-runtime";var Me="embeddedUniformDevToolsSettings";function Bt({context:e,initialSettings:o}){let r=e!=null?e:typeof window!="undefined"?window.__UNIFORM_DEVTOOLS_CONTEXT_INSTANCE__:void 0,t=r!=null?r:new cr({manifest:{project:{}}}),[n,s]=E.useState({data:t.storage.data,manifest:t.manifest.data,scores:t.scores,personalizations:[],tests:[]}),[l,d]=E.useState(o!=null?o:{});E.useEffect(()=>{var c;let a=lr((c=l.logLevel)!=null?c:"none");return t.events.on("log",a),()=>{t.events.off("log",a)}},[l,t]),E.useEffect(()=>{let a=()=>{let u=window.localStorage.getItem(Me)||"{}",f=JSON.parse(u),C=ge({quirks:t.storage.data.quirks,quirkOverrides:f.quirkOverrides});C&&(console.log("Applying overridden quirks:",C),t.update({quirks:C}));let w=ne({scores:t.scores,scoreOverrides:f.scoreOverrides});w.length&&(console.log("Applying overridden scores:",w),t.storage.updateData(w)),s(k=>({...k,scores:t.scores,data:t.storage.data,manifest:t.manifest.data}))},c=u=>{!u.changed||s(f=>({...f,personalizations:[...f.personalizations,u]}))},v=u=>{!u.variantAssigned||s(f=>({...f,tests:[...f.tests,u]}))};return t.events.on("personalizationResult",c),t.events.on("testResult",v),t.storage.events.on("*",a),()=>{t.storage.events.off("*",a),t.events.off("personalizationResult",c),t.events.off("testResult",v)}},[t]),E.useEffect(()=>{if(window.localStorage){let a=window.localStorage.getItem(Me);if(a)try{let c=JSON.parse(a),v={...o,...c};d(v);let u=ne({scores:n.scores,scoreOverrides:v.scoreOverrides});p.rawUpdate(u)}catch(c){window.localStorage.removeItem(Me),console.error("Failed to parse settings from localStorage: ",c.message)}}},[]);let{actions:p,saveSettings:m,clearAllExtensionData:i}=E.useMemo(()=>({actions:{update:u=>t.update(u),forget:()=>t.forget(!1),rawUpdate:u=>t.storage.updateData(u)},saveSettings:async u=>{d(u),window.localStorage&&window.localStorage.setItem("embeddedUniformDevToolsSettings",JSON.stringify(u))},clearAllExtensionData:async()=>{d({route:"/"}),window.localStorage&&(window.localStorage.removeItem("embeddedUniformDevToolsSettings"),window.location.reload())}}),[t]);return r?At(Et,{state:n,actions:p,settings:l,saveSettings:m,clearAllExtensionData:i}):At("p",{children:"Unable to find Uniform Context. Ensure the devtools plugin is activated."})}import{css as Ee}from"@emotion/react";import{Button as mr,Callout as ur,Paragraph as gr,Theme as vr}from"@uniformdev/design-system";import*as U from"react";import{useLocalStorage as fr}from"react-use";import{css as dr}from"@emotion/react";import{jsx as De,jsxs as Qt}from"@emotion/react/jsx-runtime";var pr=dr`
|
|
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
|
-
`,Ft=({...e})=>Qt("button",{type:"button",css:pr,...e,children:[De("span",{hidden:!0,children:"Uniform devtools"}),Qt("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[De("path",{d:"M13.325 3.05011L8.66741 20.4323L10.5993 20.9499L15.2568 3.56775L13.325 3.05011Z",fill:"currentColor"}),De("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"}),De("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"})]})]});import{jsx as A,jsxs as qt}from"@emotion/react/jsx-runtime";var hr="dblgnkbknchechcibdojfdoeeodhmgbd",br="dcmlokofjljnfjcknpmhjocogllfbhkg";function Os(e){let[o,r]=U.useState(!1),[t,n]=U.useState(e.context),[s,l]=U.useState(!1),[d,p]=fr("isUniformInlineDevtoolsDisabled",!1);return U.useEffect(()=>{!e.context&&typeof document!="undefined"&&n(window.__UNIFORM_DEVTOOLS_CONTEXT_INSTANCE__)},[e.context]),U.useEffect(()=>{[br,hr].map(m=>{let i=new Image;i.src=`chrome-extension://${m}/icons/uniform-logo.png`,i.onload=()=>l(!0)})},[]),d?null:t?qt("div",{children:[A(
|
|
491
|
+
`,Ft=({...e})=>Qt("button",{type:"button",css:pr,...e,children:[De("span",{hidden:!0,children:"Uniform devtools"}),Qt("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[De("path",{d:"M13.325 3.05011L8.66741 20.4323L10.5993 20.9499L15.2568 3.56775L13.325 3.05011Z",fill:"currentColor"}),De("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"}),De("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"})]})]});import{jsx as A,jsxs as qt}from"@emotion/react/jsx-runtime";var hr="dblgnkbknchechcibdojfdoeeodhmgbd",br="dcmlokofjljnfjcknpmhjocogllfbhkg";function Os(e){let[o,r]=U.useState(!1),[t,n]=U.useState(e.context),[s,l]=U.useState(!1),[d,p]=fr("isUniformInlineDevtoolsDisabled",!1);return U.useEffect(()=>{!e.context&&typeof document!="undefined"&&n(window.__UNIFORM_DEVTOOLS_CONTEXT_INSTANCE__)},[e.context]),U.useEffect(()=>{[br,hr].map(m=>{let i=new Image;i.src=`chrome-extension://${m}/icons/uniform-logo.png`,i.onload=()=>l(!0)})},[]),d?null:t?qt("div",{children:[A(vr,{}),A(le,{}),A(Ft,{onClick:()=>r(m=>!m)}),o?A("div",{css:Ee`
|
|
492
492
|
box-shadow: var(--shadow-base);
|
|
493
493
|
position: fixed;
|
|
494
494
|
bottom: 82px;
|
|
@@ -497,6 +497,6 @@ to {
|
|
|
497
497
|
max-width: var(--site-width);
|
|
498
498
|
`,children:s?A("div",{css:Ee`
|
|
499
499
|
padding: var(--spacing-md);
|
|
500
|
-
`,children:qt(
|
|
500
|
+
`,children:qt(ur,{type:"danger",title:"This functionality is disabled.",children:[A(gr,{children:"We detected you already use the Uniform Context browser extension. Using both tools is not supported. Please use the functionality of the browser extension instead."}),A(mr,{css:Ee`
|
|
501
501
|
margin-top: var(--spacing-md);
|
|
502
502
|
`,buttonType:"secondary",onClick:()=>p(!0),children:"Disabled inline tools"})]})}):A(Bt,{...e})}):null]}):A("p",{children:"Unable to find Uniform Context. Ensure the devtools plugin is activated."})}export{Et as ContextDevTools,Bt as EmbeddedContextDevTools,Os as ToggleEmbeddedContextDevTools};
|