@uniformdev/context-devtools 14.2.1-alpha.256 → 16.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +176 -188
- package/dist/index.d.ts +11 -10
- package/dist/index.js +176 -188
- package/package.json +15 -10
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Ft=Object.create;var W=Object.defineProperty;var Bt=Object.getOwnPropertyDescriptor;var Qt=Object.getOwnPropertyNames;var qt=Object.getPrototypeOf,Nt=Object.prototype.hasOwnProperty;var Zt=(t,r)=>{for(var n in r)W(t,n,{get:r[n],enumerable:!0})},Ee=(t,r,n,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of Qt(r))!Nt.call(t,i)&&i!==n&&W(t,i,{get:()=>r[i],enumerable:!(o=Bt(r,i))||o.enumerable});return t};var D=(t,r,n)=>(n=t!=null?Ft(qt(t)):{},Ee(r||!t||!t.__esModule?W(n,"default",{value:t,enumerable:!0}):n,t)),Ut=t=>Ee(W({},"__esModule",{value:!0}),t);var po={};Zt(po,{ContextDevTools:()=>Pe,EmbeddedContextDevTools:()=>Me,ToggleEmbeddedContextDevTools:()=>lo});module.exports=Ut(po);var e=require("@emotion/react"),b=D(require("react"));var x=require("@emotion/react");var Y=require("react"),ze=(0,Y.createContext)({settings:{},saveSettings:()=>null}),J=()=>(0,Y.useContext)(ze),Fe=({children:t,settings:r,saveSettings:n})=>(0,e.jsx)(ze.Provider,{value:{settings:r,saveSettings:n}},t);var _t=({route:t,children:r,className:n})=>{let{settings:o,saveSettings:i}=J();return(0,e.jsx)("a",{href:"",className:n,onClick:a=>{a.preventDefault(),i({...o,route:t})}},r)},B=_t;var Gt=[{title:"Dimensions",href:"/dimensions",icon:`<svg
|
|
2
2
|
width="24"
|
|
3
3
|
height="24"
|
|
4
4
|
viewBox="0 0 24 24"
|
|
@@ -36,58 +36,84 @@ var Rt=Object.create;var Y=Object.defineProperty;var Mt=Object.getOwnPropertyDes
|
|
|
36
36
|
</svg>`},{title:"Settings",href:"/settings",icon:`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
37
37
|
<path d="M19.1469 12.716C19.1986 12.2636 19.201 11.8069 19.1539 11.354L21.7429 9.474C21.8681 9.3822 21.9548 9.24723 21.9862 9.0952C22.0176 8.94316 21.9915 8.78489 21.9129 8.651L19.9939 5.399C19.9182 5.26986 19.7985 5.17231 19.6568 5.1242C19.515 5.07608 19.3606 5.08063 19.2219 5.137L16.3599 6.292C15.9237 5.9578 15.4502 5.67525 14.9489 5.45L14.5739 2.545C14.5547 2.39441 14.4813 2.25598 14.3673 2.15566C14.2534 2.05534 14.1068 1.99999 13.9549 2H10.0859C9.93402 1.99997 9.78728 2.05527 9.67317 2.15558C9.55906 2.25588 9.48539 2.39432 9.46595 2.545L9.09395 5.433C8.63957 5.63249 8.20723 5.87882 7.80395 6.168L5.00895 4.954C4.87173 4.89484 4.71787 4.88672 4.57519 4.9311C4.4325 4.97549 4.3104 5.06945 4.23095 5.196L2.22195 8.398C2.1396 8.52998 2.10934 8.68789 2.13707 8.84096C2.1648 8.99403 2.24854 9.1313 2.37195 9.226L4.86795 11.142C4.83172 11.4266 4.81302 11.7131 4.81195 12C4.81195 12.18 4.82095 12.362 4.83795 12.558L2.26495 14.375C2.13766 14.4647 2.04844 14.5987 2.01478 14.7508C1.98112 14.9028 2.00543 15.0619 2.08295 15.197L3.95695 18.474C4.11095 18.742 4.43695 18.857 4.72595 18.746L7.56095 17.644C8.00795 17.997 8.49195 18.294 9.00795 18.53L9.33795 21.396C9.37495 21.709 9.63795 21.946 9.95195 21.95L13.8169 22H13.8249C14.1349 22 14.3989 21.771 14.4439 21.463L14.8549 18.59C15.3703 18.3674 15.8579 18.0855 16.3079 17.75L19.1279 18.93C19.4129 19.05 19.7419 18.944 19.9029 18.679L21.8669 15.452C21.9477 15.319 21.976 15.1608 21.9464 15.0081C21.9168 14.8554 21.8315 14.7192 21.7069 14.626L19.1469 12.716ZM11.9999 15C10.3459 15 8.99995 13.655 8.99995 12C8.99995 10.346 10.3449 9 11.9999 9C13.6539 9 14.9999 10.345 14.9999 12C14.9999 13.654 13.6539 15 11.9999 15Z" fill="white"/>
|
|
38
38
|
</svg>
|
|
39
|
-
`}]
|
|
39
|
+
`}],$t=`<svg width="24" height="24" fill="white" viewBox="0 0 122.88 116.67" xmlns="http://www.w3.org/2000/svg">
|
|
40
|
+
<g>
|
|
41
|
+
<path d="M84.55,116.66c2.49,0,4.53-1.99,4.53-4.41V88.08c1.55-13.03,7.27-9.16,14-5.13 c16.27,9.74,27.08-15.88,13.93-23.78c-10.32-6.2-14.79,4.46-22.35,3.36c-2.92-0.43-4.95-3.5-5.59-8.17V36.9 c0-2.43-2.04-4.41-4.53-4.41H63.73c-17.18-2.12-1.93-11.37-1.93-19.98C61.81,5.6,55.38,0,47.45,0c-7.92,0-15.19,5.6-15.19,12.51 c0,8.12,15.78,17.86-1.64,19.98H4.53C2.04,32.49,0,34.47,0,36.9v17.42c1.33,7.43,6.49,9.15,13.1,4.25 c2.23-1.66,5.99-3.59,8.71-3.59c7.09,0,12.85,6.25,12.85,13.96S28.91,84.6,21.81,84.6c-2.53,0-4.89-0.8-6.89-2.19 c0,0.59-12.4-10.85-14.92,3.15v26.71c0,2.43,2.04,4.41,4.53,4.41c13.97,0,27.92,0,41.88-0.01c0.55-2.55-1.24-5.47-2.92-8 c-13.22-19.93,38.21-21.92,24.99,0.62c-0.65,1.11-1.3,2.19-1.8,3.24c-0.63,1.31-1.05,2.91-0.96,4.14L84.55,116.66L84.55,116.66z"></path>
|
|
42
|
+
</g>
|
|
43
|
+
</svg>`,Be=({...t})=>{var o,i;let r=a=>{var p;let l="active";return!((p=t.settings)!=null&&p.route)&&a==="/dimensions"||t.settings.route===a?l:""},n=Boolean(typeof window!="undefined"&&((i=(o=window.chrome)==null?void 0:o.runtime)==null?void 0:i.id));return(0,e.jsx)("nav",{css:x.css`
|
|
40
44
|
background: var(--brand-secondary-1);
|
|
41
45
|
padding: var(--spacing-base);
|
|
42
46
|
min-width: 200px;
|
|
43
|
-
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
`},(0,e.jsx)("a",{css:x.css`
|
|
50
|
+
flex-grow: 0;
|
|
44
51
|
display: inline-block;
|
|
45
52
|
margin: 0 var(--spacing-base);
|
|
46
|
-
`,
|
|
53
|
+
`,href:"https://uniform.dev/"},(0,e.jsx)("svg",{css:{display:"block"},width:"120",height:"38",viewBox:"0 0 120 38",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,e.jsx)("g",{clipPath:"url(#clip0_41_612)"},(0,e.jsx)("path",{d:"M8.82261 3.73315L0 8.82209V18.9999L8.82261 13.911L17.6474 8.82209L8.82261 3.73315Z",fill:"#83C6E1"}),(0,e.jsx)("path",{d:"M8.82261 24.089V13.9111L0 19.0001V29.1779L8.82261 34.2669L17.6474 29.1779V19.0001L8.82261 24.089Z",fill:"#438FD5"}),(0,e.jsx)("path",{d:"M17.6474 8.82202L8.82263 13.911L17.6474 18.9999V29.1777L26.47 24.0888V13.911L17.6474 8.82202Z",fill:"#F4220B"}),(0,e.jsx)("path",{d:"M64.6069 13.9025H67.8036V25.5528H64.6069V13.9025ZM64.4902 8.5415H67.9181V11.7348H64.4902V8.5415ZM72.5153 10.1025V13.9025H70.3691V16.6272H72.5153V25.5528H75.7119V16.6272H78.2774V13.9025H75.7119V11.2684H78.2774V8.5415H75.2213L72.5153 10.1025ZM83.1059 13.7859L80.3999 15.3469V24.1084L83.1059 25.6694H88.0748L90.7808 24.1084V15.3469L88.0748 13.7859H83.1059ZM87.5842 22.9425H83.5943V16.5106H87.5842V22.9425ZM97.4723 14.8611L95.8103 13.9025H94.2779V25.5528H97.4745V16.6272H101.486V13.9025H99.1344L97.4723 14.8611ZM55.713 13.7859L53.8499 14.8611L51.9847 13.7859H50.7289V25.5528H53.9256V16.5106H57.9133V25.5528H61.1099V15.3469L58.4039 13.7859H55.713ZM44.0353 22.9425H40.0454V13.9025H36.851V24.1084L39.557 25.6694H42.3753L44.0309 24.7129L44.0331 24.7151L44.0353 24.7129V24.7151L45.6887 25.6694H47.2297V13.9025H44.0353V22.9425ZM117.51 13.7859H115.271L113.079 15.0425L110.909 13.7859H108.67L107.015 14.7402L105.359 13.7859H103.818V25.5528H107.015V16.5106H110.421V25.5528H113.615V16.5106H117.022V25.5528H120.216V15.3469L117.51 13.7859Z",fill:"white"})),(0,e.jsx)("defs",null,(0,e.jsx)("clipPath",{id:"clip0_41_612"},(0,e.jsx)("rect",{width:"120",height:"38",fill:"white"}))))),(0,e.jsx)("ul",{css:x.css`
|
|
47
54
|
display: flex;
|
|
48
55
|
flex-flow: column nowrap;
|
|
49
56
|
padding: 0;
|
|
50
57
|
margin: 0;
|
|
51
58
|
list-style-type: none;
|
|
52
|
-
|
|
53
|
-
`},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
`,key:o},(0,e.jsx)(V,{css:R.css`
|
|
62
|
-
align-items: center;
|
|
63
|
-
border-radius: var(--rounded-base);
|
|
64
|
-
display: flex;
|
|
65
|
-
color: var(--white);
|
|
66
|
-
gap: var(--spacing-sm);
|
|
67
|
-
padding: var(--spacing-sm) var(--spacing-base);
|
|
68
|
-
text-decoration: none;
|
|
69
|
-
transition: background-color 0.25s ease-in-out;
|
|
70
|
-
|
|
71
|
-
&:hover,
|
|
72
|
-
&.active {
|
|
73
|
-
background: var(--gray-700);
|
|
59
|
+
flex-grow: 1;
|
|
60
|
+
`},Gt.map((a,l)=>{var m,u,s,c;let p=0;return a.href==="/overrides"&&Object.keys((m=t.settings.scoreOverrides)!=null?m:{}).length>0&&(p=Object.keys((u=t.settings.scoreOverrides)!=null?u:{}).length),a.href==="/quirks"&&Object.keys((s=t.settings.quirkOverrides)!=null?s:{}).length>0&&(p=Object.keys((c=t.settings.quirkOverrides)!=null?c:{}).length),(0,e.jsx)("li",{css:x.css`
|
|
61
|
+
padding: 0;
|
|
62
|
+
margin: 0;
|
|
63
|
+
list-style-type: none;
|
|
64
|
+
|
|
65
|
+
&:last-of-type {
|
|
66
|
+
margin-top: auto;
|
|
74
67
|
}
|
|
75
|
-
`,
|
|
68
|
+
`,key:l},(0,e.jsx)(B,{css:x.css`
|
|
76
69
|
align-items: center;
|
|
70
|
+
border-radius: var(--rounded-base);
|
|
77
71
|
display: flex;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
72
|
+
color: var(--white);
|
|
73
|
+
gap: var(--spacing-sm);
|
|
74
|
+
padding: var(--spacing-sm) var(--spacing-base);
|
|
75
|
+
text-decoration: none;
|
|
76
|
+
transition: background-color 0.25s ease-in-out;
|
|
77
|
+
|
|
78
|
+
&:hover,
|
|
79
|
+
&.active {
|
|
80
|
+
background: var(--gray-700);
|
|
81
|
+
}
|
|
82
|
+
`,className:r(a.href),route:a.href},(0,e.jsx)("i",{css:x.css`
|
|
83
|
+
align-items: center;
|
|
84
|
+
display: flex;
|
|
85
|
+
`,dangerouslySetInnerHTML:{__html:a.icon}}),a.title,p?(0,e.jsx)("span",{css:x.css`
|
|
86
|
+
font-size: var(--font-xxs);
|
|
87
|
+
display: inline-block;
|
|
88
|
+
width: 12px;
|
|
89
|
+
height: 12px;
|
|
90
|
+
border-radius: 6px;
|
|
91
|
+
background-color: var(--red-tooltip);
|
|
92
|
+
text-align: center;
|
|
93
|
+
line-height: 12px;
|
|
94
|
+
`},p):null))})),!n&&(0,e.jsx)("a",{target:"_blank",href:"https://chrome.google.com/webstore/detail/uniform-context/dcmlokofjljnfjcknpmhjocogllfbhkg",css:x.css`
|
|
95
|
+
align-items: center;
|
|
96
|
+
border-radius: var(--rounded-base);
|
|
97
|
+
display: flex;
|
|
98
|
+
font-size: var(--font-sm);
|
|
99
|
+
color: var(--white);
|
|
100
|
+
gap: var(--spacing-sm);
|
|
101
|
+
padding: var(--spacing-sm) var(--spacing-base);
|
|
102
|
+
text-decoration: none;
|
|
103
|
+
transition: background-color 0.25s ease-in-out;
|
|
104
|
+
|
|
105
|
+
&:hover,
|
|
106
|
+
&.active {
|
|
107
|
+
background: var(--gray-700);
|
|
108
|
+
}
|
|
109
|
+
`,rel:"noreferrer"},(0,e.jsx)("i",{css:x.css`
|
|
110
|
+
align-items: center;
|
|
111
|
+
display: flex;
|
|
112
|
+
`,dangerouslySetInnerHTML:{__html:$t}}),"Install Chrome Extension"))};var Qe=()=>(0,e.jsx)("article",null,(0,e.jsx)("h1",null,"Something when wrong"),(0,e.jsx)("p",null,"We could not find the page you're looking for."));var pe=D(require("react"));var H=require("@emotion/react"),X=D(require("react")),qe=(0,H.css)({willChange:"height"}),Kt=H.css`
|
|
87
113
|
border-bottom: 2px solid var(--brand-secondary-1);
|
|
88
114
|
font-size: var(--font-base);
|
|
89
115
|
margin: 0;
|
|
90
|
-
`,
|
|
116
|
+
`,Wt=H.css`
|
|
91
117
|
align-items: center;
|
|
92
118
|
border: none;
|
|
93
119
|
background: none;
|
|
@@ -97,46 +123,13 @@ var Rt=Object.create;var Y=Object.defineProperty;var Mt=Object.getOwnPropertyDes
|
|
|
97
123
|
padding: var(--spacing-sm) 0;
|
|
98
124
|
font-weight: var(--font-bold);
|
|
99
125
|
justify-content: space-between;
|
|
100
|
-
`,
|
|
126
|
+
`,Yt=H.css`
|
|
101
127
|
align-self: center;
|
|
102
|
-
`,
|
|
128
|
+
`,Jt=H.css`
|
|
103
129
|
transform: rotate(-180deg);
|
|
104
|
-
`,
|
|
130
|
+
`,j=({children:t})=>(0,e.jsx)("div",{css:[qe]},t),ee=({title:t,children:r})=>{let[n,o]=X.useState(!1),i=t.split(" ").join("-").toLocaleLowerCase();return(0,e.jsx)(X.Fragment,null,(0,e.jsx)("h3",{css:Kt},(0,e.jsx)("button",{"aria-expanded":n,css:Wt,title:t,id:i,"aria-controls":`${i}-section`,onClick:()=>o(a=>!a),type:"button"},t,(0,e.jsx)("i",{css:[Yt,n?Jt:void 0]},(0,e.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,e.jsx)("path",{d:"M6.34317 7.75732L4.92896 9.17154L12 16.2426L19.0711 9.17157L17.6569 7.75735L12 13.4142L6.34317 7.75732Z",fill:"currentColor"}))))),(0,e.jsx)("div",{id:`${i}-section`,css:[qe,H.css`
|
|
105
131
|
padding: var(--spacing-sm) 0;
|
|
106
|
-
`],role:"region","aria-labelledby":i},n?r:null))};var M=require("@emotion/react"),
|
|
107
|
-
align-items: center;
|
|
108
|
-
border: 1px solid transparent;
|
|
109
|
-
cursor: pointer;
|
|
110
|
-
display: inline-flex;
|
|
111
|
-
padding: var(--spacing-sm) var(--spacing-base);
|
|
112
|
-
transition: opacity 0.2s ease-in-out, border-color 0.2s ease-in-out;
|
|
113
|
-
font-size: var(--font-sm);
|
|
114
|
-
&:hover {
|
|
115
|
-
opacity: 0.8;
|
|
116
|
-
}
|
|
117
|
-
`;function _t(t){let r=M.css`
|
|
118
|
-
color: var(--white);
|
|
119
|
-
`,n=M.css`
|
|
120
|
-
font-weight: var(--font-bold);
|
|
121
|
-
`;switch(t){case"primary":return M.css`
|
|
122
|
-
background: var(--brand-secondary-1);
|
|
123
|
-
${r}
|
|
124
|
-
${n}
|
|
125
|
-
`;case"secondary":return M.css`
|
|
126
|
-
background: var(--brand-secondary-5);
|
|
127
|
-
${r}
|
|
128
|
-
${n}
|
|
129
|
-
`;case"unimportant":return M.css`
|
|
130
|
-
background: var(--brand-secondary-3);
|
|
131
|
-
color: var(--brand-secondary-1);
|
|
132
|
-
${n}
|
|
133
|
-
`;case"ghost":return M.css`
|
|
134
|
-
background: transparent;
|
|
135
|
-
color: var(--brand-secondary-5);
|
|
136
|
-
&:hover {
|
|
137
|
-
border: 1px solid var(--brand-secondary-5);
|
|
138
|
-
}
|
|
139
|
-
`}}var C=({buttonType:t="primary",children:r,className:n,...o})=>(0,e.jsx)(Ne.Fragment,null,(0,e.jsx)("button",{type:"button",css:[Qt,_t(t)],className:n,...o},r));var A=require("@emotion/react"),j=A.css`
|
|
132
|
+
`],role:"region","aria-labelledby":i},n?r:null))};var M=require("@emotion/react"),te=M.css`
|
|
140
133
|
background-color: var(--gray-100);
|
|
141
134
|
padding: var(--spacing-base) var(--spacing-md);
|
|
142
135
|
margin: var(--spacing-base) 0;
|
|
@@ -144,21 +137,21 @@ var Rt=Object.create;var Y=Object.defineProperty;var Mt=Object.getOwnPropertyDes
|
|
|
144
137
|
&:first-of-type {
|
|
145
138
|
margin: 0 0 var(--spacing-base);
|
|
146
139
|
}
|
|
147
|
-
`,
|
|
140
|
+
`,Ne=M.css`
|
|
148
141
|
background: var(--gray-100)
|
|
149
142
|
url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%0A%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M9 2C8.44771 2 8 2.44772 8 3V5C8 5.55228 8.44771 6 9 6C9.55229 6 10 5.55228 10 5V3C10 2.44772 9.55229 2 9 2ZM8 9H16V11C16 13.2091 14.2091 15 12 15C9.79086 15 8 13.2091 8 11V9ZM13 16.917C15.8377 16.441 18 13.973 18 11V7H6V11C6 13.973 8.16229 16.441 11 16.917V22C11 22.5523 11.4477 23 12 23C12.5523 23 13 22.5523 13 22V16.917ZM14 3C14 2.44772 14.4477 2 15 2C15.5523 2 16 2.44772 16 3V5C16 5.55228 15.5523 6 15 6C14.4477 6 14 5.55228 14 5V3Z' fill='%232ecdb4' /%3E%3C/svg%3E")
|
|
150
143
|
no-repeat var(--spacing-sm) var(--spacing-base);
|
|
151
144
|
padding: var(--spacing-base) var(--spacing-xl);
|
|
152
|
-
`,
|
|
145
|
+
`,oe=M.css`
|
|
153
146
|
color: var(--brand-secondary-1);
|
|
154
147
|
margin: 0;
|
|
155
148
|
font-size: var(--font-base);
|
|
156
149
|
font-weight: var(--font-bold);
|
|
157
|
-
`,
|
|
150
|
+
`,re=M.css`
|
|
158
151
|
color: var(--brand-secondary-1);
|
|
159
152
|
margin: var(--spacing-xs) 0 0;
|
|
160
153
|
font-size: var(--font-sm);
|
|
161
|
-
`,Ze=
|
|
154
|
+
`,Ze=M.css`
|
|
162
155
|
align-items: center;
|
|
163
156
|
border: none;
|
|
164
157
|
background: transparent
|
|
@@ -178,71 +171,25 @@ var Rt=Object.create;var Y=Object.defineProperty;var Mt=Object.getOwnPropertyDes
|
|
|
178
171
|
&:hover {
|
|
179
172
|
opacity: 0.6;
|
|
180
173
|
}
|
|
181
|
-
`,
|
|
174
|
+
`,ne=M.css`
|
|
182
175
|
display: flex;
|
|
183
176
|
margin: var(--spacing-sm) 0 0;
|
|
184
177
|
gap: var(--spacing-base);
|
|
185
|
-
`;var
|
|
186
|
-
align-items: center;
|
|
187
|
-
cursor: pointer;
|
|
188
|
-
display: flex;
|
|
189
|
-
gap: var(--spacing-xs);
|
|
190
|
-
margin-top: var(--spacing-base);
|
|
191
|
-
`,ye=Z.css`
|
|
192
|
-
color: var(--gray-500);
|
|
193
|
-
font-size: var(--font-sm);
|
|
194
|
-
`,ko=Z.css`
|
|
195
|
-
background: var(--gray-600);
|
|
196
|
-
`,Ce=Z.css`
|
|
197
|
-
display: block;
|
|
198
|
-
background: var(--gray-400);
|
|
199
|
-
border-radius: var(--rounded-full);
|
|
200
|
-
position: relative;
|
|
201
|
-
height: 16px;
|
|
202
|
-
width: 32px;
|
|
203
|
-
&:before {
|
|
204
|
-
border-radius: var(--rounded-full);
|
|
205
|
-
background: var(--white);
|
|
206
|
-
content: '';
|
|
207
|
-
display: block;
|
|
208
|
-
width: 13px;
|
|
209
|
-
height: 13px;
|
|
210
|
-
position: absolute;
|
|
211
|
-
top: 0;
|
|
212
|
-
bottom: 0;
|
|
213
|
-
margin: auto 0;
|
|
214
|
-
transform: translateX(2px);
|
|
215
|
-
transition: transform 0.2s ease-in-out, background-color 0.3s ease-in-out;
|
|
216
|
-
}
|
|
217
|
-
`,we=Z.css`
|
|
218
|
-
overflow: hidden;
|
|
219
|
-
clip: rect(0, 0, 0, 0);
|
|
220
|
-
height: 0;
|
|
221
|
-
width: 0;
|
|
222
|
-
text-indent: -9999px;
|
|
223
|
-
|
|
224
|
-
&:checked ~ :before {
|
|
225
|
-
transform: translateX(17px);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
&:checked ~ span {
|
|
229
|
-
background: var(--brand-secondary-5);
|
|
230
|
-
}
|
|
231
|
-
`;var Ue=({label:t,...r})=>(0,e.jsx)("label",{css:he},(0,e.jsx)("span",{css:ye},t),(0,e.jsx)("input",{type:"checkbox",css:we,...r}),(0,e.jsx)("span",{css:Ce})),xe=({field:t,form:r,meta:n,...o})=>{let{label:i}=o;return(0,e.jsx)("label",{css:he},(0,e.jsx)("span",{css:ye},i),(0,e.jsx)("input",{type:"checkbox",css:we,checked:t.value,...t}),(0,e.jsx)("span",{css:Ce}))};var w=require("@emotion/react"),Gt=w.keyframes`from {
|
|
178
|
+
`;var Q=({title:t,text:r,buttonGroup:n,children:o})=>(0,e.jsx)("div",{css:te},(0,e.jsx)("h2",{css:oe},t),(0,e.jsx)("p",{css:re},r),o,n?(0,e.jsx)("div",{css:ne},n):null);var k=require("@emotion/react"),Xt=k.keyframes`from {
|
|
232
179
|
transform: scale(1);
|
|
233
180
|
}
|
|
234
181
|
to {
|
|
235
182
|
transform: scale(1.2);
|
|
236
183
|
}
|
|
237
|
-
`,
|
|
184
|
+
`,h={page:k.css`
|
|
238
185
|
color: var(--brand-secondary-1);
|
|
239
|
-
`,text:
|
|
186
|
+
`,text:k.css`
|
|
240
187
|
margin: var(--spacing-sm) 0;
|
|
241
|
-
`,reset:
|
|
188
|
+
`,reset:k.css`
|
|
242
189
|
margin: 0 var(--spacing-md);
|
|
243
190
|
font-size: var(--font-sm);
|
|
244
191
|
color: var(--gray-500);
|
|
245
|
-
`,title:
|
|
192
|
+
`,title:k.css`
|
|
246
193
|
margin: 0 0 var(--spacing-sm);
|
|
247
194
|
font-size: var(--font-md);
|
|
248
195
|
& > small {
|
|
@@ -251,12 +198,12 @@ to {
|
|
|
251
198
|
font-weight: var(--font-regular);
|
|
252
199
|
margin: var(--spacing-xxs) 0 0;
|
|
253
200
|
}
|
|
254
|
-
`,headingGroup:
|
|
201
|
+
`,headingGroup:k.css`
|
|
255
202
|
align-items: baseline;
|
|
256
203
|
display: flex;
|
|
257
204
|
justify-content: space-between;
|
|
258
205
|
align-items: center;
|
|
259
|
-
`,divider:
|
|
206
|
+
`,divider:k.css`
|
|
260
207
|
background: var(--gray-300);
|
|
261
208
|
display: block;
|
|
262
209
|
width: 1px;
|
|
@@ -264,59 +211,66 @@ to {
|
|
|
264
211
|
position: absolute;
|
|
265
212
|
inset: 0 auto 0 0;
|
|
266
213
|
margin: auto 0;
|
|
267
|
-
`,submitButton:
|
|
214
|
+
`,submitButton:k.css`
|
|
268
215
|
position: absolute;
|
|
269
216
|
right: var(--spacing-base);
|
|
270
217
|
bottom: var(--spacing-base);
|
|
271
|
-
animation: 0.5s 2 alternate ${
|
|
272
|
-
`,cancelButton:
|
|
218
|
+
animation: 0.5s 2 alternate ${Xt};
|
|
219
|
+
`,cancelButton:k.css`
|
|
273
220
|
position: absolute;
|
|
274
221
|
left: calc(200px + var(--spacing-base));
|
|
275
222
|
bottom: var(--spacing-base);
|
|
276
223
|
background: white;
|
|
277
224
|
padding: var(--spacing-sm);
|
|
278
|
-
|
|
225
|
+
border: 1px solid var(--gray-300);
|
|
226
|
+
`,error:k.css`
|
|
279
227
|
color: var(--brand-secondary-5);
|
|
280
228
|
font-size: var(--font-sm);
|
|
281
|
-
|
|
229
|
+
`,quirks:k.css`
|
|
230
|
+
.uniform-input-select,
|
|
231
|
+
input {
|
|
232
|
+
padding: var(--spacing-sm);
|
|
233
|
+
}
|
|
234
|
+
`};var L=require("@emotion/react"),ie=({children:t})=>(0,e.jsx)("table",{css:L.css`
|
|
282
235
|
border-collapse: collapse;
|
|
283
236
|
display: table;
|
|
284
237
|
width: 100%;
|
|
285
238
|
font-size: var(--font-sm);
|
|
286
|
-
`},t),
|
|
239
|
+
`},t),Ue=({children:t})=>(0,e.jsx)("thead",{css:L.css`
|
|
287
240
|
background: var(--gray-50);
|
|
288
241
|
text-align: left;
|
|
289
242
|
& tr {
|
|
290
243
|
border-bottom: 1px solid var(--gray-200);
|
|
291
244
|
}
|
|
292
|
-
`},t),
|
|
245
|
+
`},t),se=({children:t})=>(0,e.jsx)("tbody",null,t),U=({border:t,children:r})=>(0,e.jsx)("tr",{css:t?L.css`
|
|
293
246
|
border-bottom: 1px solid var(--gray-200);
|
|
294
247
|
&:where(:last-child) {
|
|
295
248
|
border: none;
|
|
296
249
|
}
|
|
297
|
-
`:void 0},r),
|
|
250
|
+
`:void 0},r),ae=({children:t,width:r})=>(0,e.jsx)("th",{css:L.css`
|
|
298
251
|
outline: none;
|
|
299
252
|
padding: var(--spacing-sm);
|
|
300
|
-
|
|
253
|
+
width: ${r!=null?r:"auto"};
|
|
254
|
+
`},t);function jt(t){switch(t){case"light":return L.css`
|
|
301
255
|
color: var(--gray-400);
|
|
302
256
|
`;case"dark":return L.css`
|
|
303
257
|
color: var(--brand-secondary-1);
|
|
304
|
-
`}}function
|
|
258
|
+
`}}function eo(t){return L.css`
|
|
305
259
|
text-align: ${t};
|
|
306
|
-
`}var
|
|
260
|
+
`}var R=({alignment:t="left",border:r,color:n="dark",children:o})=>(0,e.jsx)("td",{css:[L.css`
|
|
307
261
|
padding: var(--spacing-base);
|
|
308
262
|
max-width: 180px;
|
|
309
263
|
overflow-wrap: break-word;
|
|
310
264
|
position: relative;
|
|
311
|
-
|
|
265
|
+
`,jt(n),eo(t),r?L.css`
|
|
312
266
|
border-left: 1px solid var(--gray-200);
|
|
313
|
-
`:void 0]},o);var
|
|
267
|
+
`:void 0]},o);var ce=require("@emotion/react"),_e=ce.css`
|
|
314
268
|
position: relative;
|
|
315
269
|
display: inline-block;
|
|
316
270
|
font-size: var(--font-base);
|
|
317
|
-
`,Ge=
|
|
271
|
+
`,Ge=ce.css`
|
|
318
272
|
display: block;
|
|
319
|
-
`,$e=
|
|
273
|
+
`,$e=ce.css`
|
|
320
274
|
position: absolute;
|
|
321
275
|
width: 6px;
|
|
322
276
|
height: 6px;
|
|
@@ -324,11 +278,11 @@ to {
|
|
|
324
278
|
top: 9px;
|
|
325
279
|
background: var(--red-tooltip);
|
|
326
280
|
border-radius: 3px;
|
|
327
|
-
`;var We=require("@emotion/react"),
|
|
281
|
+
`;var We=require("@emotion/react"),to=`<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
328
282
|
<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"/>
|
|
329
283
|
<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"/>
|
|
330
284
|
<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"/>
|
|
331
|
-
</svg>`,
|
|
285
|
+
</svg>`,oo=`<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
332
286
|
<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"/>
|
|
333
287
|
<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"/>
|
|
334
288
|
<path d="M11.9999 5.05762H8.3999V6.2576H11.9999V5.05762Z" fill="#828282"/>
|
|
@@ -340,19 +294,66 @@ to {
|
|
|
340
294
|
<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"/>
|
|
341
295
|
<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"/>
|
|
342
296
|
<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"/>
|
|
343
|
-
</svg>`,
|
|
297
|
+
</svg>`,Ye=({type:t})=>{let r="";switch(t){case"Audience":r=to;break;case"Signal":r=Ke;break;case"Intent":r=Ke;break;case"Enrichment":r=oo;break}return(0,e.jsx)("i",{css:We.css`
|
|
344
298
|
align-items: center;
|
|
345
299
|
display: inline-block;
|
|
346
|
-
`,dangerouslySetInnerHTML:{__html:r}})};var
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
300
|
+
`,dangerouslySetInnerHTML:{__html:r}})};var ro=({dimensionIndex:t,dimensions:r,disableEditOverride:n,onClick:o,preemptiveOverrides:i})=>{var p;let{settings:a}=J(),l=(p=i!=null?i:a.scoreOverrides)!=null?p:{};return(0,e.jsx)(ie,null,(0,e.jsx)(se,null,Object.entries(r).sort(([m],[u])=>m.localeCompare(u)).map(([m,u])=>{var y;let{dim:s,name:c,type:d,category:f}=(y=t[m])!=null?y:{name:m,dim:m,type:void 0,category:void 0},v=l[s];return(0,e.jsx)(U,{key:s},(0,e.jsx)(R,null,v!==void 0?(0,e.jsx)("s",{css:Ge},v.initial):null,(0,e.jsx)("b",{css:_e},u,v!==void 0&&(0,e.jsx)("i",{css:$e}))),(0,e.jsx)(R,null,(0,e.jsx)("div",{onClick:()=>o==null?void 0:o(s),css:o?{cursor:"pointer"}:void 0},(0,e.jsx)("span",{css:h.divider,role:"presentation"}),(0,e.jsx)("div",null,(0,e.jsx)(Ye,{type:d})," ",d),(0,e.jsx)("strong",null,f?`${f}:`:""," ",c))),(0,e.jsx)(R,{alignment:"right",color:"light"},v!==void 0&&!n?(0,e.jsx)(B,{route:`/overrides/${s}`},"Edit override"):null))})))},A=ro;async function de({actions:t,saveSettings:r,scores:n,settings:o}){var p,m;let i=(p=o.scoreOverrides)!=null?p:{},a={...i},l=[];for(let u of Object.keys(i)){let s=i==null?void 0:i[u];delete a[u],l.push({type:"modscoreS",data:{dimension:u,delta:s.initial-((m=n[u])!=null?m:0)}})}await r({...o,scoreOverrides:a}),await t.rawUpdate(l)}async function Je({quirk:t,settings:r,saveSettings:n,actions:o}){var l;let i=(l=r.quirkOverrides)==null?void 0:l[t];if(!i)return;let a={...r.quirkOverrides};delete a[t],await n({...r,quirkOverrides:a}),await o.rawUpdate([{type:"setquirk",data:{key:t,value:i.initial}}])}var Te=require("@uniformdev/design-system");var ot=D(require("react"));var q=require("@emotion/react"),Xe=q.css`
|
|
301
|
+
position: relative;
|
|
302
|
+
display: inline-block;
|
|
303
|
+
margin-right: var(--spacing-sm);
|
|
304
|
+
transition: var(--duration) var(--timing);
|
|
305
|
+
vertical-align: middle;
|
|
306
|
+
user-select: none;
|
|
307
|
+
width: var(--spacing-xl);
|
|
308
|
+
`,je=q.css`
|
|
309
|
+
appearance: none;
|
|
310
|
+
border-radius: var(--rounded-full);
|
|
311
|
+
background-color: var(--white);
|
|
312
|
+
border: 2px solid var(--gray-400);
|
|
350
313
|
cursor: pointer;
|
|
351
|
-
|
|
314
|
+
position: absolute;
|
|
315
|
+
display: block;
|
|
316
|
+
width: var(--spacing-md);
|
|
317
|
+
height: var(--spacing-md);
|
|
318
|
+
transition: transform var(--duration) var(--timing), background-color var(--duration) var(--timing),
|
|
319
|
+
background-image var(--duration) var(--timing);
|
|
320
|
+
|
|
321
|
+
&:focus {
|
|
322
|
+
outline: 3px solid var(--brand-primary-1);
|
|
323
|
+
outline-offset: 2px;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
&:checked {
|
|
327
|
+
background-color: var(--brand-secondary-3);
|
|
328
|
+
background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%0A%3E%3Cpath d='M10.5858 13.4142L7.75735 10.5858L6.34314 12L10.5858 16.2427L17.6568 9.1716L16.2426 7.75739L10.5858 13.4142Z' fill='%23fff' /%3E%3C/svg%3E");
|
|
329
|
+
background-position: center center;
|
|
330
|
+
border-color: var(--brand-secondary-3);
|
|
331
|
+
transform: translateX(var(--spacing-base));
|
|
332
|
+
|
|
333
|
+
&:hover,
|
|
334
|
+
&:focus {
|
|
335
|
+
border-color: var(--brand-primary-1);
|
|
336
|
+
background-color: var(--brand-primary-1);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
`,et=q.css`
|
|
340
|
+
border-radius: var(--rounded-full);
|
|
341
|
+
background-color: var(--gray-300);
|
|
342
|
+
cursor: pointer;
|
|
343
|
+
display: block;
|
|
344
|
+
overflow: hidden;
|
|
345
|
+
width: var(--spacing-xl);
|
|
346
|
+
height: var(--spacing-md);
|
|
347
|
+
`,tt=q.css`
|
|
348
|
+
color: var(--brand-secondary-1);
|
|
352
349
|
font-weight: var(--font-bold);
|
|
353
|
-
|
|
350
|
+
line-height: 1.25rem;
|
|
351
|
+
cursor: default;
|
|
352
|
+
`,le=q.css`
|
|
353
|
+
color: var(--gray-700);
|
|
354
354
|
font-size: var(--font-sm);
|
|
355
|
-
|
|
355
|
+
margin: var(--spacing-sm) 0;
|
|
356
|
+
`;var _=({label:t,infoText:r,toggleText:n,...o})=>{let i=()=>r&&n?o.checked?(0,e.jsx)("p",{css:le},n):(0,e.jsx)("p",{css:le},r):r?(0,e.jsx)("p",{css:le},r):null;return(0,e.jsx)(ot.Fragment,null,(0,e.jsx)("div",{css:Xe},(0,e.jsx)("input",{type:"checkbox",css:je,...o,className:o.className}),(0,e.jsx)("label",{htmlFor:o.id,css:et})),(0,e.jsx)("label",{htmlFor:o.id,css:tt},t),i())};var rt=({dimensionIndex:{index:t},state:{scores:r,data:n},actions:o,saveSettings:i,settings:a})=>{let l=pe.useMemo(()=>{let s={};return Object.keys(t).filter(c=>!r[c]).map(c=>{s[t[c].dim]=0}),s},[r,t]),p=Object.keys(r).length,m=p+Object.keys(l).length,u=()=>{o.rawUpdate([{type:"setcontrol",data:!n.controlGroup}])};return(0,e.jsx)(pe.Fragment,null,(0,e.jsx)("article",{css:h.page},(0,e.jsx)("div",{css:h.headingGroup},(0,e.jsx)("h2",{css:h.title},"Dimensions",(0,e.jsx)("small",null,p," active of ",m)),(0,e.jsx)("div",{css:h.reset},(0,e.jsx)(Te.Button,{buttonType:"ghost",onClick:()=>de({actions:o,saveSettings:i,scores:r,settings:a}).then(o.forget)},"clear all dimensions")),(0,e.jsx)(_,{name:"controlGroup",label:"Control Group",onChange:u,checked:n.controlGroup})),p>0?(0,e.jsx)(A,{dimensionIndex:t,dimensions:r}):(0,e.jsx)(Q,{title:n.controlGroup?"In control group":"No active dimensions",text:n.controlGroup?"You are part of the personalization control group. While in the control group you do not have dimension scores and will not see personalized content. A/B tests will still run.":"You do not have score in any dimensions yet.",buttonGroup:n.controlGroup?(0,e.jsx)(Te.Button,{buttonType:"secondary",onClick:u},"Exit control group"):null}),(0,e.jsx)(j,null,(0,e.jsx)(ee,{title:`Inactive Dimensions (${Object.keys(l).length})`},(0,e.jsx)(A,{dimensionIndex:t,dimensions:l})))))};var it=D(require("react"));var nt=require("@emotion/react");function Se({onClick:t}){return(0,e.jsx)("button",{css:nt.css`
|
|
356
357
|
width: 3.5rem;
|
|
357
358
|
height: 3.5rem;
|
|
358
359
|
display: flex;
|
|
@@ -365,7 +366,7 @@ to {
|
|
|
365
366
|
svg {
|
|
366
367
|
color: var(--red-button);
|
|
367
368
|
}
|
|
368
|
-
`,onClick:t,"aria-label":"Add new override",className:"text-secondary shadow-xl rounded-full flex items-center bg-secondary","data-test-id":"add-new-overrides-button"},(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"66",height:"66",viewBox:"0 0 66 66"},(0,e.jsx)("g",{fill:"none",fillRule:"evenodd"},(0,e.jsx)("circle",{cx:"33",cy:"33",r:"33",fill:"currentColor"}),(0,e.jsx)("g",{fill:"#FFF",transform:"translate(19 19)"},(0,e.jsx)("rect",{width:"4",height:"28",x:"12",rx:"2"}),(0,e.jsx)("path",{d:"M14,0 C15.1045695,-2.02906125e-16 16,0.8954305 16,2 L16,26 C16,27.1045695 15.1045695,28 14,28 C12.8954305,28 12,27.1045695 12,26 L12,2 C12,0.8954305 12.8954305,2.02906125e-16 14,0 Z",transform:"rotate(90 14 14)"})))))}var
|
|
369
|
+
`,onClick:t,"aria-label":"Add new override",className:"text-secondary shadow-xl rounded-full flex items-center bg-secondary","data-test-id":"add-new-overrides-button"},(0,e.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"66",height:"66",viewBox:"0 0 66 66"},(0,e.jsx)("g",{fill:"none",fillRule:"evenodd"},(0,e.jsx)("circle",{cx:"33",cy:"33",r:"33",fill:"currentColor"}),(0,e.jsx)("g",{fill:"#FFF",transform:"translate(19 19)"},(0,e.jsx)("rect",{width:"4",height:"28",x:"12",rx:"2"}),(0,e.jsx)("path",{d:"M14,0 C15.1045695,-2.02906125e-16 16,0.8954305 16,2 L16,26 C16,27.1045695 15.1045695,28 14,28 C12.8954305,28 12,27.1045695 12,26 L12,2 C12,0.8954305 12.8954305,2.02906125e-16 14,0 Z",transform:"rotate(90 14 14)"})))))}var De=require("@uniformdev/design-system"),st=({dimensionIndex:{index:t},state:{data:r,scores:n},actions:o,settings:i,saveSettings:a})=>{var c;let l=(c=i.scoreOverrides)!=null?c:{},p=Object.keys(l).length,m=d=>(d.preventDefault(),a({...i,route:"/overrides/add"})),u=()=>{o.rawUpdate([{type:"setcontrol",data:!r.controlGroup}])},s={};return Object.entries(n).map(([d,f])=>{l[d]!==void 0&&(s[d]=f)}),(0,e.jsx)(it.Fragment,null,(0,e.jsx)("article",{css:h.page},(0,e.jsx)("div",{css:h.headingGroup},(0,e.jsx)("h2",{css:h.title},"What if?"),(0,e.jsx)("div",{css:h.reset},(0,e.jsx)(De.Button,{buttonType:"ghost",onClick:()=>de({actions:o,settings:i,saveSettings:a,scores:n})},"delete all overrides")),(0,e.jsx)(Se,{onClick:m})),(0,e.jsx)("p",null,"Override dimension scores to test personalization"),p>0?(0,e.jsx)(A,{dimensionIndex:t,dimensions:s,onClick:d=>a({...i,route:`/overrides/${d}`})}):(0,e.jsx)(Q,{title:r.controlGroup?"In control group":"No overrides",text:r.controlGroup?"You are part of the personalization control group. While in the control group you do not have dimension scores and will not see personalized content. A/B tests will still run.":"You do not have any dimension overrides yet.",buttonGroup:r.controlGroup?(0,e.jsx)(De.Button,{buttonType:"secondary",onClick:u},"Exit control group"):null})))};var z=require("formik");var N=D(require("yup"));var V=require("@emotion/react"),at=V.css`
|
|
369
370
|
background: var(--white);
|
|
370
371
|
border: 1px solid var(--gray-500);
|
|
371
372
|
border-radius: var(--rounded-base);
|
|
@@ -376,42 +377,26 @@ to {
|
|
|
376
377
|
cursor: not-allowed;
|
|
377
378
|
color: var(--gray-200);
|
|
378
379
|
}
|
|
379
|
-
`,
|
|
380
|
-
appearance: none;
|
|
381
|
-
background: var(--white)
|
|
382
|
-
url('data:image/svg+xml;base64,PHN2ZwogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKPgogIDxwYXRoCiAgICBkPSJNNi4zNDMxNyA3Ljc1NzMyTDQuOTI4OTYgOS4xNzE1NEwxMiAxNi4yNDI2TDE5LjA3MTEgOS4xNzE1N0wxNy42NTY5IDcuNzU3MzVMMTIgMTMuNDE0Mkw2LjM0MzE3IDcuNzU3MzJaIgogICAgZmlsbD0iIzgyODI4MiIKICAvPgo8L3N2Zz4=')
|
|
383
|
-
no-repeat 98% 50%;
|
|
384
|
-
border: 1px solid var(--gray-500);
|
|
385
|
-
border-radius: var(--rounded-base);
|
|
386
|
-
color: var(--brand-secondary-1);
|
|
387
|
-
padding: var(--spacing-base);
|
|
388
|
-
&:disabled {
|
|
389
|
-
cursor: not-allowed;
|
|
390
|
-
color: var(--gray-200);
|
|
391
|
-
}
|
|
392
|
-
`,de=T.css`
|
|
393
|
-
padding: var(--spacing-sm);
|
|
394
|
-
max-width: 160px;
|
|
395
|
-
`,le=T.css`
|
|
380
|
+
`,er=V.css`
|
|
396
381
|
margin: var(--spacing-base) 0;
|
|
397
|
-
`,
|
|
382
|
+
`,ct=V.css`
|
|
398
383
|
color: var(--brand-secondary-1);
|
|
399
384
|
display: flex;
|
|
400
385
|
flex-direction: column;
|
|
401
386
|
margin: 0 0 var(--spacing-sm);
|
|
402
|
-
`,
|
|
387
|
+
`,dt=V.css`
|
|
403
388
|
color: var(--brand-secondary-1);
|
|
404
389
|
display: block;
|
|
405
390
|
flex: 1 100%;
|
|
406
391
|
font-weight: var(--font-bold);
|
|
407
392
|
margin: 0 0 var(--spacing-sm);
|
|
408
|
-
`,
|
|
393
|
+
`,tr=V.css`
|
|
409
394
|
color: var(--gray-600);
|
|
410
395
|
font-size: var(--font-sm);
|
|
411
|
-
`,
|
|
396
|
+
`,or=V.css`
|
|
412
397
|
color: var(--brand-secondary-5);
|
|
413
398
|
display: block;
|
|
414
|
-
`,
|
|
399
|
+
`,lt=V.css`
|
|
415
400
|
flex-direction: row;
|
|
416
401
|
flex-wrap: wrap;
|
|
417
402
|
|
|
@@ -479,15 +464,18 @@ to {
|
|
|
479
464
|
flex: 1 0 20%;
|
|
480
465
|
padding: 10px;
|
|
481
466
|
}
|
|
482
|
-
`;var
|
|
467
|
+
`;var me=require("@uniformdev/design-system"),pt=({field:t,form:r,meta:n,...o})=>{var u,s;let{label:i,caption:a,min:l=0,max:p=100,step:m}=o;return(0,e.jsx)("div",null,(0,e.jsx)("label",{css:[ct,lt]},(0,e.jsx)("span",{css:dt},i),(0,e.jsx)("input",{type:"range",min:l,max:p,step:m,...t,value:(u=t.value)!=null?u:0}),(0,e.jsx)("span",{className:"value-display"},(s=t.value)!=null?s:0)),a?(0,e.jsx)(me.Caption,null,a):null,r.touched[t.name]&&r.errors[t.name]?(0,e.jsx)(me.ErrorMessage,{message:r.errors[t.name]}):null)};var mt=require("@emotion/react"),E=({children:t,...r})=>(0,e.jsx)("fieldset",{css:mt.css`
|
|
483
468
|
border: none;
|
|
484
469
|
padding: 0;
|
|
485
|
-
|
|
470
|
+
& legend {
|
|
471
|
+
margin-bottom: var(--spacing-base);
|
|
472
|
+
}
|
|
473
|
+
`,...r},t);var ut=require("@emotion/react"),G=({children:t})=>(0,e.jsx)("legend",{css:ut.css`
|
|
486
474
|
font-size: var(--font-md);
|
|
487
475
|
font-weight: var(--font-bold);
|
|
488
476
|
border-bottom: 1px solid var(--gray-400);
|
|
489
477
|
width: 100%;
|
|
490
|
-
`},t);var
|
|
478
|
+
`},t);var ue=require("@uniformdev/context");function gt({manifest:t,visitor:r,override:n}){let o=new ue.Context({manifest:t,transitionStore:new xe({initialData:r})}),i={...o.scores};o.storage.updateData([n]);let l={...{...o.scores}};return Object.entries(l).forEach(([p,m])=>{i[p]===m&&delete l[p]}),l}var xe=class extends ue.TransitionDataStore{async handleDelete(){}async handleUpdateData(){}};function $({scores:t,scoreOverrides:r}){let n=[];return r?(Object.entries(r).forEach(([o,i])=>{var p;let a=(p=t[o])!=null?p:0;if(a===i.override)return;let l=i.override-a;n.push({type:"modscoreS",data:{dimension:o,delta:l}})}),n):[]}function ge({quirks:t,quirkOverrides:r}){let n={};if(!!r)return Object.entries(r).forEach(([o,i])=>{t[o]!==i.override&&(n[o]=i.override)}),Object.keys(n).length>0?n:void 0}var vt=require("@uniformdev/design-system");var Le=t=>({field:r,form:n,meta:o,...i})=>(0,e.jsx)(t,{...i,...r,errorMessage:n.errors[r.name]});var fe=require("@uniformdev/design-system"),ve=Le(fe.Input),ft=Le(fe.InputSelect);var no=N.object({dimension:N.string(),score:N.number()}),Oe=({settings:t,saveSettings:r,state:n,actions:o,dimensionIndex:{index:i}})=>{var m,u;let a=t.route?[...t.route.matchAll(/overrides\/(?!.*add)(\w+)?/g)]:[],l=a[0]?a[0][1]:"";if(!((m=n.manifest.project.pz)!=null&&m.sig))return(0,e.jsx)("p",null,"Error, manifest is broken or there is no signal to override.");let p=Object.entries(i).filter(([,s])=>s.type!=="Audience"&&s.type!=="Intent").map(([s,c])=>{let d=c.type?`${c.type}: `:"",f=c.category?`${c.category} - `:"",v=`${d}${f}${c.name}`;return{value:s,label:v}});return p.unshift({value:"",label:"Choose dimension to override"}),(0,e.jsx)(z.Formik,{initialValues:{dimension:l,score:(u=n.scores[l])!=null?u:0},validate:s=>{let c={};return(s.score===n.scores[s.dimension]||s.score===0&&!n.scores[l])&&(c.score="You have to modify current score value"),c},validationSchema:no,enableReinitialize:!0,validateOnChange:!1,validateOnBlur:!1,onSubmit:async s=>{var y,C,w,S,Z,Ae;let c=(C=(y=i[s.dimension])==null?void 0:y.cap)!=null?C:0,d=Math.min(s.score,c),f={...t,scoreOverrides:{...t.scoreOverrides,[s.dimension]:{initial:(Ae=(Z=(S=(w=t.scoreOverrides)==null?void 0:w[s.dimension])==null?void 0:S.initial)!=null?Z:n.scores[s.dimension])!=null?Ae:0,override:d}},route:"/overrides"};await r(f);let v=$({scores:n.scores,scoreOverrides:f.scoreOverrides});o.rawUpdate(v)}},({isSubmitting:s,values:c})=>{var C;let d=gt({manifest:n.manifest,visitor:n.data,override:{type:"modscore",data:{dimension:c.dimension,delta:c.score-((C=n.scores[c.dimension])!=null?C:0)}}}),f=Object.entries(n.scores).reduce((w,[S,Z])=>(w[S]={initial:Z,override:Z},w),{}),v={max:100,step:50};i[c.dimension]&&(v.max=i[c.dimension].cap,v.step=i[c.dimension].str);let y=c.score&&Object.keys(d).length>0;return(0,e.jsx)(z.Form,{css:h.page},(0,e.jsx)("h1",{css:h.title},"Override Dimension"),(0,e.jsx)(z.Field,{component:ft,label:"Dimension",id:"dimension",name:"dimension",options:p,disabled:s}),(0,e.jsx)("p",{css:h.text},(0,e.jsx)("small",null,"Audiences and Intents are aggregated from other dimension scores and cannot be overridden directly.")),c.dimension?(0,e.jsx)(z.Field,{component:pt,name:"score",label:"Score",disabled:s,caption:`Range: 0 - ${v.max} in increments of ${v.step}`}):null,(0,e.jsx)(E,{disabled:s,css:{marginBottom:"2rem"}},y?(0,e.jsx)(j,null,(0,e.jsx)(ee,{title:`Impacted Dimensions (${Object.keys(d).length})`},(0,e.jsx)(A,{preemptiveOverrides:f,dimensionIndex:i,dimensions:d,disableEditOverride:!0}))):null,(0,e.jsx)(vt.Button,{type:"submit",css:h.submitButton,disabled:s},"Save"),(0,e.jsx)(B,{route:"/overrides",css:h.cancelButton},"Cancel")))})};var bt=require("react");var he=require("react"),be=require("@uniformdev/design-system");var io=({name:t,value:r,submit:n})=>{let[o,i]=(0,he.useState)(r!=null?r:"");return(0,he.useEffect)(()=>{i(r!=null?r:"")},[r]),(0,e.jsx)("div",{css:{display:"flex",gap:"var(--spacing-sm)"}},(0,e.jsx)(be.Input,{type:"text",css:[at],name:t,value:o,onChange:p=>{i(p.target.value)}}),(0,e.jsx)(be.Button,{buttonType:"primary",disabled:o===r,size:"sm",onClick:()=>n(t,o!=null?o:"")},"Save"))},ht=io;var K=require("@uniformdev/design-system"),yt=({...t})=>{let{state:{data:{quirks:r}},quirksIndex:{index:n},settings:o,saveSettings:i,actions:a}=t,[l,p]=(0,bt.useState)(""),m;l&&(m=n[l]);let u=async(s,c)=>{var v,y,C;p("");let d={...o,quirkOverrides:{...o.quirkOverrides,[s]:{initial:(C=(y=(v=o.quirkOverrides)==null?void 0:v[s])==null?void 0:y.initial)!=null?C:r[s],override:c}}};await i(d);let f=ge({quirks:r,quirkOverrides:d.quirkOverrides});await a.update({quirks:f})};return(0,e.jsx)(b.Fragment,null,(0,e.jsx)("article",{css:[h.page,h.quirks]},(0,e.jsx)("h1",{css:h.title},"Quirks"),(0,e.jsx)("p",{css:h.text},"Keys defined in Uniform and their current, programmatically defined values for this visit."),Object.keys(n).length?(0,e.jsx)(ie,null,(0,e.jsx)(Ue,null,(0,e.jsx)(U,null,(0,e.jsx)(ae,{width:"30%"},"Key"),(0,e.jsx)(ae,{width:"50%"},"Value"),(0,e.jsx)(ae,{width:"20%"},""))),(0,e.jsx)(se,null,Object.values(n).map(({name:s,value:c,id:d})=>{var y,C,w;let f=(C=(y=o.quirkOverrides)==null?void 0:y[s])==null?void 0:C.initial,v=[];return m&&m.options&&(v=m.options.map(S=>({value:S.value,label:S.name}))),(0,e.jsx)(U,{key:d,border:"bottom"},(0,e.jsx)(R,null,(0,e.jsx)("strong",null,s)),(0,e.jsx)(R,null,l!==d?(0,e.jsx)("div",{onClick:()=>{p(d)}},f?(0,e.jsx)("div",null,(0,e.jsx)("s",null,f)):null,c):null,l===d&&m&&(0,e.jsx)(b.Fragment,null,m.options?(0,e.jsx)(K.InputSelect,{showLabel:!1,label:`Change ${s}`,defaultOption:`Change ${s}`,name:d,onChange:S=>u(S.target.name,S.target.value),options:v}):(0,e.jsx)(ht,{name:d,value:c,submit:u}))),(0,e.jsx)(R,null,l?null:(w=o.quirkOverrides)!=null&&w[d]?(0,e.jsx)(K.Button,{buttonType:"ghost",onClick:()=>{Je({quirk:d,settings:o,saveSettings:i,actions:a})}},(0,e.jsx)("small",null,"Clear Override")):(0,e.jsx)(K.Button,{buttonType:"ghost",onClick:()=>{p(d)}},(0,e.jsx)("small",null,"Override"))))}))):(0,e.jsx)(Q,{title:"No quirks configured",text:"There are currently no quirks setup. Try to connect to Uniform API to load additional information about Quirks and Quirks without defined value."})))};var Ct=require("@uniformdev/design-system");var wt=({settings:t,saveSettings:r,actions:n,state:{data:o}})=>(0,e.jsx)("article",{css:[h.page,{display:"flex",flexDirection:"column",gap:"var(--spacing-base)"}]},(0,e.jsx)("h1",{css:h.title},"Settings"),(0,e.jsx)(E,null,(0,e.jsx)(G,null,"Data Connection"),(0,e.jsx)(Ct.Button,{buttonType:"tertiary",onClick:()=>{r({...t,route:"/connect"})}},"Manage Connection to Uniform")),(0,e.jsx)(E,null,(0,e.jsx)(G,null,"Storage Consent"),(0,e.jsx)(_,{label:"Store visitor data",id:"consent-mode",name:"consentMode",checked:o.consent,onChange:i=>{n.rawUpdate([{type:"consent",data:i.currentTarget.checked}]),r({...t,consentMode:i.currentTarget.checked})}}),(0,e.jsx)("p",null,(0,e.jsx)("small",null,"Enabling storage consent allows storing behavior in this browser for personalization across sessions. Only affects this browser. Personalization works with this disabled, but dimension scores are lost on refresh."))),(0,e.jsx)(E,null,(0,e.jsx)(G,null,"Logging"),(0,e.jsx)(_,{label:"Write Uniform Context diagnostic logs to browser console",id:"logging",name:"logging",checked:t.logLevel!=="none",onChange:i=>r({...t,logLevel:i.currentTarget.checked?"debug":"none"})})));var Ie=require("@uniformdev/design-system");var Re=({settings:t,saveSettings:r})=>{let n=()=>{r({...t,route:"/connect"})},o=()=>{r({...t,ignoreApiKeyPrompt:!0})},i=t.route==="/connect",a=!(t!=null&&t.apiKey);return!t.ignoreApiKeyPrompt&&a&&!i?(0,e.jsx)("div",{css:[te,Ne]},(0,e.jsx)("h2",{css:oe},"Connect to a Uniform Project"),(0,e.jsx)("p",{css:re},"This allows reading human-readable labels for the dimensions."),(0,e.jsx)("div",{css:ne},(0,e.jsx)(Ie.Button,{buttonType:"secondary",onClick:n},"Connect this site"),(0,e.jsx)(Ie.Button,{buttonType:"ghost",onClick:o},"Skip for now")),(0,e.jsx)("button",{type:"button",css:Ze,title:"close",onClick:o},(0,e.jsx)("span",{hidden:!0},"Close"))):null};var F=require("@uniformdev/context/api"),kt=require("react-use"),Tt=D(require("react"));function St({apiHost:t,apiKey:r,projectId:n},o){let{loading:i,error:a,value:l}=(0,kt.useAsync)(async()=>{if(!r||!n)return p;let u=(await new F.DimensionClient({projectId:n,apiKey:r,apiHost:t||void 0}).get()).dimensions,s={};return u.map(c=>{var d,f,v,y;if(s[c.dim]={...(0,F.computeDimensionDefinitionDisplayData)(c),cap:c.cap,str:10},s[c.dim].type==="Enrichment"){let C=c.dim.split("_")[0];s[c.dim].cap=(y=(v=(f=(d=o==null?void 0:o.project.pz)==null?void 0:d.enr)==null?void 0:f[C])==null?void 0:v.cap)!=null?y:100}}),s},[t,r,n]),p=Tt.useMemo(()=>{var u,s,c,d;let m={};return o&&(Object.entries((s=(u=o==null?void 0:o.project.pz)==null?void 0:u.sig)!=null?s:{}).map(([f,v])=>{let y=(0,F.computeDimensionDisplayData)(f,o);y&&(m[f]={...v,...y})}),Object.entries((d=(c=o==null?void 0:o.project.pz)==null?void 0:c.enr)!=null?d:{}).map(([f,v])=>{var w;let y=(0,F.computeDimensionDisplayData)(f,o),C={cap:(w=v.cap)!=null?w:100,str:10};y&&(m[f]={...y,cap:C.cap,str:C.str})}),l&&Object.entries(l).map(([f,v])=>{m[f]={...m[f],...v}})),m},[o,l]);return{loading:i,error:a,index:p}}var Dt=require("react"),xt=require("@uniformdev/context/api"),Lt=require("react-use");function Ot({apiHost:t,apiKey:r,projectId:n},o){let{loading:i,error:a,value:l}=(0,Lt.useAsync)(async()=>{if(!r||!n)return{};let u=await new xt.QuirkClient({projectId:n,apiKey:r,apiHost:t||void 0}).get(),s={};return u.quirks.map(c=>{s[c.id]={...c,value:o[c.id]}}),s},[t,r,n]),p=(0,Dt.useMemo)(()=>{let m={};return Object.entries(o).map(([u,s])=>m[u]={value:s,id:u,name:u}),l&&Object.entries(l).map(([u,s])=>m[u]={...s,value:o[u]}),m},[o,l]);return{loading:i,error:a,index:p}}var Ve=require("@emotion/react");function ye(){return(0,e.jsx)("style",null,`
|
|
491
479
|
:root {
|
|
492
480
|
--brand-primary-1: #438fd5; /* bright blue */
|
|
493
481
|
--brand-primary-2: #f4220b; /* red */
|
|
@@ -852,7 +840,7 @@ Add the correct display in Chrome and Safari.
|
|
|
852
840
|
|
|
853
841
|
summary {
|
|
854
842
|
display: list-item;
|
|
855
|
-
}`)}var
|
|
843
|
+
}`)}var Ce=require("react"),It=require("react-use");var Rt=()=>{let[t,r]=(0,Ce.useState)(!1),n=(0,It.useMountedState)();return(0,Ce.useEffect)(()=>{setTimeout(()=>{n()&&r(!0)},1e3)},[n]),t?(0,e.jsx)("article",{css:h.page},(0,e.jsx)("h1",null,"Loading..."),(0,e.jsx)("p",null,"Connecting to Uniform API for complete data.")):null};var Vt=require("@uniformdev/context"),we=require("@uniformdev/context/api"),P=require("formik"),T=D(require("react")),O=require("@uniformdev/design-system");function Pt(t){let[r,n]=T.useState(t.currentData?"c":"qc"),[o,i]=T.useState(void 0),[a,l]=T.useState(void 0),p=T.useCallback(async s=>{let c=new we.ManifestClient(s);i(void 0);try{let d=await c.get({preview:!0});return l({manifest:d,target:s}),d}catch(d){if(d instanceof we.ApiClientError){d.statusCode===403?i("API key is valid but does not have Context > Read Drafts permission, or the API key does not have permissions to the project, or the project does not exist."):i(d.errorMessage);return}if("message"in d){d.message==="Failed to fetch"?i("A network error occurred. Ensure the API host is valid."):i(d.message);return}i(JSON.stringify(d,null,2));return}},[]);T.useEffect(()=>{!t.currentData||p(t.currentData)},[p,t.currentData]);let m=async s=>{await p(s)&&(n("c"),await t.onConnect(s))},u=()=>{confirm("Disconnect from Uniform? Make sure to save your API key if you want to reconnect.")&&(n("qc"),l(void 0),i(void 0),t.onConnect(null))};return(0,e.jsx)("div",null,o?(0,e.jsx)(O.ErrorMessage,{message:o}):null,r==="qc"||r==="mc"?(0,e.jsx)(so,{...t,state:r,setState:n,onConnect:m}):(0,e.jsx)("div",null,a?(0,e.jsx)(T.Fragment,null,(0,e.jsx)("p",null,"Connected to"," ",(0,e.jsx)("a",{href:`${a==null?void 0:a.target.apiHost}/projects/${a==null?void 0:a.target.projectId}`,target:"_blank",rel:"noopener noreferrer",css:{textDecoration:"underline"}},(0,e.jsx)("strong",null,a==null?void 0:a.manifest.project.name))," ",(0,e.jsx)("small",null,"(",a==null?void 0:a.manifest.project.id,")")),(0,e.jsx)(O.Button,{buttonType:"secondary",type:"button",onClick:u},"Disconnect")):null))}function so({setState:t,state:r,currentData:n,onConnect:o}){var i,a,l;return(0,e.jsx)("div",null,(0,e.jsx)(P.Formik,{initialValues:{apiHost:(i=n==null?void 0:n.apiHost)!=null?i:"https://uniform.dev",apiKey:(a=n==null?void 0:n.apiKey)!=null?a:"",projectId:(l=n==null?void 0:n.projectId)!=null?l:"",qc:""},onSubmit:o},({setFieldValue:p,setFieldError:m,errors:{qc:u},isSubmitting:s})=>(0,e.jsx)(P.Form,null,(0,e.jsx)("fieldset",{css:{display:"flex",flexDirection:"column",gap:"var(--spacing-base)"}},r==="qc"?(0,e.jsx)(T.Fragment,null,(0,e.jsx)("div",null,(0,e.jsx)(O.Input,{placeholder:"Paste Quick Connect Code Here",caption:"Copy the Quick Connect code after creating an API key in Uniform.",errorMessage:u,onChange:c=>{try{let d=(0,Vt.parseQuickConnect)(c.currentTarget.value);p("apiHost",d.apiHost),p("apiKey",d.apiKey),p("projectId",d.projectId)}catch(d){m("qc",d.message)}}})),(0,e.jsx)("section",{css:{display:"flex",gap:"var(--spacing-sm)"}},(0,e.jsx)(O.Button,{type:"submit",buttonType:"primary",disabled:s},s?"Verifying...":"Connect"),(0,e.jsx)(O.Button,{type:"button",buttonType:"ghost",onClick:()=>t("mc"),disabled:s},"Connect Manually"))):(0,e.jsx)(T.Fragment,null,(0,e.jsx)("div",null,(0,e.jsx)(P.Field,{component:ve,label:"API Key",name:"apiKey",caption:"Generate an API key in your Uniform team settings."})),(0,e.jsx)("div",null,(0,e.jsx)(P.Field,{component:ve,label:"Project ID",name:"projectId",caption:"Available to copy after generating an API key"})),(0,e.jsx)("div",null,(0,e.jsx)(P.Field,{component:ve,label:"API Host",name:"apiHost",caption:"Use a non-standard Uniform API endpoint. Most people will not not need this option."})),(0,e.jsx)("section",{css:{display:"flex",gap:"var(--spacing-sm)"}},(0,e.jsx)(O.Button,{type:"submit",buttonType:"primary",disabled:s},s?"Verifying...":"Connect"),(0,e.jsx)(O.Button,{type:"button",buttonType:"ghost",onClick:()=>t("qc"),disabled:s},"Use Quick Connect")))))))}var Ht=({settings:t,saveSettings:r})=>{let n=t.apiKey&&t.projectId?{apiKey:t.apiKey,projectId:t.projectId,apiHost:t.apiHost}:void 0;return(0,e.jsx)("article",{css:h.page},(0,e.jsx)("h1",{css:h.title},"Connect to a Uniform Project"),(0,e.jsx)("p",{css:h.text},(0,e.jsx)("small",null,"Adding an API key and project ID enables human-readable dimension labels to be shown. You must have access to the Uniform project to do this.")),(0,e.jsx)(Pt,{onConnect:async o=>{o?await r({...t,apiKey:o.apiKey,projectId:o.projectId,apiHost:o.apiHost}):await r({...t,apiKey:void 0,projectId:void 0,apiHost:void 0})},currentData:n}))};var ao=Ve.css`
|
|
856
844
|
background: var(--white);
|
|
857
845
|
padding: var(--spacing-base);
|
|
858
846
|
overflow-y: auto;
|
|
@@ -881,7 +869,7 @@ summary {
|
|
|
881
869
|
&::-webkit-scrollbar-thumb:hover {
|
|
882
870
|
background: var(--gray-500);
|
|
883
871
|
}
|
|
884
|
-
`;function
|
|
872
|
+
`;function Pe(t){let r=St(t.settings,t.state.manifest),n=Ot(t.settings,t.state.data.quirks),o={...t,dimensionIndex:r,quirksIndex:n},i=()=>{var a;if(r.loading||n.loading)return(0,e.jsx)(Rt,null);if(t.settings.route&&t.settings.route.match(/overrides\/\w+/))return(0,e.jsx)(Oe,{...o});switch((a=t.settings)==null?void 0:a.route){case void 0:case"/":case"/dimensions":return(0,e.jsx)(rt,{...o});case"/overrides":return(0,e.jsx)(st,{...o});case"/overrides/add":return(0,e.jsx)(Oe,{...o});case"/quirks":return(0,e.jsx)(yt,{...o});case"/settings":return(0,e.jsx)(wt,{...o});case"/connect":return(0,e.jsx)(Ht,{...o});default:return(0,e.jsx)(Qe,null)}};return(0,e.jsx)(Fe,{settings:t.settings,saveSettings:t.saveSettings},(0,e.jsx)(ye,null),(0,e.jsx)("div",{css:Ve.css`
|
|
885
873
|
display: grid;
|
|
886
874
|
grid-template-columns: 200px auto;
|
|
887
875
|
font-weight: var(--font-regular);
|
|
@@ -890,7 +878,7 @@ summary {
|
|
|
890
878
|
line-height: var(--base-line-height);
|
|
891
879
|
height: var(--min-height);
|
|
892
880
|
min-width: var(--site-width);
|
|
893
|
-
`},(0,e.jsx)(
|
|
881
|
+
`},(0,e.jsx)(Be,{...t}),(0,e.jsx)("main",{css:ao},(0,e.jsx)(Re,{...t}),i())))}var ke=require("@uniformdev/context"),I=D(require("react"));var He="embeddedUniformDevToolsSettings";function Me({context:t,initialSettings:r}){let n=t!=null?t:typeof window!="undefined"?window.__UNIFORM_DEVTOOLS_CONTEXT_INSTANCE__:void 0,o=n!=null?n:new ke.Context({manifest:{project:{}}}),[i,a]=I.useState({data:o.storage.data,manifest:o.manifest.data,scores:o.scores,personalizations:[],tests:[]}),[l,p]=I.useState(r!=null?r:{});I.useEffect(()=>{var c;let s=(0,ke.createDebugConsoleLogDrain)((c=l.logLevel)!=null?c:"none");return o.events.on("log",s),()=>{o.events.off("log",s)}},[l,o]),I.useEffect(()=>{let s=()=>{let f=window.localStorage.getItem(He)||"{}",v=JSON.parse(f),y=ge({quirks:o.storage.data.quirks,quirkOverrides:v.quirkOverrides});y&&(console.log("Applying overridden quirks:",y),o.update({quirks:y}));let C=$({scores:o.scores,scoreOverrides:v.scoreOverrides});C.length&&(console.log("Applying overridden scores:",C),o.storage.updateData(C)),a(w=>({...w,scores:o.scores,data:o.storage.data,manifest:o.manifest.data}))},c=f=>{!f.changed||a(v=>({...v,personalizations:[...v.personalizations,f]}))},d=f=>{!f.variantAssigned||a(v=>({...v,tests:[...v.tests,f]}))};return o.events.on("personalizationResult",c),o.events.on("testResult",d),o.storage.events.on("*",s),()=>{o.storage.events.off("*",s),o.events.off("personalizationResult",c),o.events.off("testResult",d)}},[o]),I.useEffect(()=>{if(window.localStorage){let s=window.localStorage.getItem(He);if(s)try{let c=JSON.parse(s),d={...r,...c};p(d);let f=$({scores:i.scores,scoreOverrides:d.scoreOverrides});m.rawUpdate(f)}catch(c){window.localStorage.removeItem(He),console.error("Failed to parse settings from localStorage: ",c.message)}}},[]);let{actions:m,saveSettings:u}=I.useMemo(()=>({actions:{update:d=>o.update(d),forget:()=>o.forget(!1),rawUpdate:d=>o.storage.updateData(d)},saveSettings:async d=>{p(d),window.localStorage&&window.localStorage.setItem("embeddedUniformDevToolsSettings",JSON.stringify(d))}}),[o]);return n?(0,e.jsx)(Pe,{state:i,actions:m,settings:l,saveSettings:u}):(0,e.jsx)("p",null,"Unable to find Uniform Context. Ensure the devtools plugin is activated.")}var Et=require("@emotion/react"),zt=D(require("react"));var Mt=require("@emotion/react"),co=Mt.css`
|
|
894
882
|
align-items: center;
|
|
895
883
|
border-radius: var(--rounded-full);
|
|
896
884
|
background: var(--brand-secondary-5);
|
|
@@ -916,11 +904,11 @@ summary {
|
|
|
916
904
|
max-width: 100%;
|
|
917
905
|
height: auto;
|
|
918
906
|
}
|
|
919
|
-
`,
|
|
907
|
+
`,At=({...t})=>(0,e.jsx)("button",{type:"button",css:co,...t},(0,e.jsx)("span",{hidden:!0},"Uniform devtools"),(0,e.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,e.jsx)("path",{d:"M13.325 3.05011L8.66741 20.4323L10.5993 20.9499L15.2568 3.56775L13.325 3.05011Z",fill:"currentColor"}),(0,e.jsx)("path",{d:"M7.61197 18.3608L8.97136 16.9124L8.97086 16.8933L3.87657 12.1121L8.66699 7.00798L7.20868 5.63928L1.04956 12.2017L7.61197 18.3608Z",fill:"currentColor"}),(0,e.jsx)("path",{d:"M16.388 18.3608L15.0286 16.9124L15.0291 16.8933L20.1234 12.1121L15.333 7.00798L16.7913 5.63928L22.9504 12.2017L16.388 18.3608Z",fill:"currentColor"})));function lo(t){var i;let[r,n]=zt.useState(!1);return((i=t.context)!=null?i:typeof window!="undefined"?window.__UNIFORM_DEVTOOLS_CONTEXT_INSTANCE__:void 0)?(0,e.jsx)("div",null,(0,e.jsx)(ye,null),(0,e.jsx)(At,{onClick:()=>n(a=>!a)}),r?(0,e.jsx)("div",{css:Et.css`
|
|
920
908
|
box-shadow: var(--shadow-base);
|
|
921
909
|
position: fixed;
|
|
922
910
|
bottom: 82px;
|
|
923
911
|
right: var(--spacing-base);
|
|
924
912
|
z-index: var(--z-10);
|
|
925
913
|
max-width: var(--site-width);
|
|
926
|
-
`},(0,e.jsx)(
|
|
914
|
+
`},(0,e.jsx)(Me,{...t})):null):(0,e.jsx)("p",null,"Unable to find Uniform Context. Ensure the devtools plugin is activated.")}0&&(module.exports={ContextDevTools,EmbeddedContextDevTools,ToggleEmbeddedContextDevTools});
|