@uniformdev/context-devtools 14.2.1-alpha.34 → 16.0.1-alpha.128

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 CHANGED
@@ -1,4 +1,4 @@
1
- import{jsx as t}from"@emotion/react";import*as m from"react";import{css as S}from"@emotion/react";var St=[{title:"Dimensions",href:"/dimensions",icon:`<svg
1
+ import{jsx as e}from"@emotion/react";import*as h from"react";import{css as D}from"@emotion/react";import{createContext as ot,useContext as rt}from"react";var me=ot({settings:{},saveSettings:()=>{}}),Z=()=>rt(me),ue=({children:t,settings:r,saveSettings:n})=>e(me.Provider,{value:{settings:r,saveSettings:n}},t);var nt=({route:t,children:r,className:n})=>{let{settings:o,saveSettings:s}=Z();return e("a",{href:"",className:n,onClick:a=>{a.preventDefault(),s({...o,route:t})}},r)},I=nt;var it=[{title:"Dimensions",href:"/dimensions",icon:`<svg
2
2
  width="24"
3
3
  height="24"
4
4
  viewBox="0 0 24 24"
@@ -15,6 +15,9 @@ import{jsx as t}from"@emotion/react";import*as m from"react";import{css as S}fro
15
15
  fill="currentColor"
16
16
  />
17
17
  </svg>
18
+ `},{title:"What if?",href:"/overrides",icon:`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
19
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M16.5123 7.91666L14.5804 8.4343L13.9179 5.96175L11.3371 10.0021L11.3575 10.0143C11.1348 10.3854 10.8997 10.7125 10.6556 11.0003H18.7603L16.9135 9.15347L18.3277 7.73926L22.5703 11.9819L18.3276 16.2245L16.9134 14.8103L18.7235 13.0003H6.65606C6.89995 13.2879 7.13495 13.6148 7.35749 13.9857L7.33713 13.9979L9.9179 18.0382L10.5804 15.5657L12.5123 16.0833L10.9594 21.8789L5.16384 20.326L5.68147 18.3941L8.20425 19.0701C8.20425 19.0701 6.17064 16.0325 5.21659 14.398C4.70173 13.7544 4.17055 13.4257 3.70352 13.2461C3.10532 13.016 2.54358 13.0011 2.06154 13.0003H2V13.0002V11.0003V11.0002L2.02253 11.0002C2.05059 11.0002 2.07985 11.0002 2.11025 11.0003H6V10.9998C6.49549 10.9998 7.07968 10.9939 7.70352 10.7539C8.17055 10.5743 8.70173 10.2456 9.21659 9.60198C10.1706 7.96745 12.2043 4.92988 12.2043 4.92988L9.68147 5.60586L9.16384 3.67401L14.9594 2.12109L16.5123 7.91666Z" fill="white"/>
20
+ </svg>
18
21
  `},{title:"Quirks",href:"/quirks",icon:`<svg
19
22
  width="24"
20
23
  height="24"
@@ -33,50 +36,84 @@ import{jsx as t}from"@emotion/react";import*as m from"react";import{css as S}fro
33
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">
34
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"/>
35
38
  </svg>
36
- `}],rt=({...e})=>{let r=o=>{if(o.preventDefault(),o.currentTarget.pathname)return e.saveSettings({...e.settings,route:o.currentTarget.pathname})},n=o=>{var i;let a="active";return!((i=e.settings)==null?void 0:i.route)&&o==="/dimensions"||e.settings.route===o?a:""};return t("nav",{css:S`
39
+ `}],st=`<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>`,ge=({...t})=>{var o,s;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"&&((s=(o=window.chrome)==null?void 0:o.runtime)==null?void 0:s.id));return e("nav",{css:D`
37
44
  background: var(--brand-secondary-1);
38
45
  padding: var(--spacing-base);
39
46
  min-width: 200px;
40
- `},t("a",{css:S`
47
+ display: flex;
48
+ flex-direction: column;
49
+ `},e("a",{css:D`
50
+ flex-grow: 0;
41
51
  display: inline-block;
42
52
  margin: 0 var(--spacing-base);
43
- `,href:"/settings",onClick:o=>r(o)},t("svg",{css:{display:"block"},width:"120",height:"38",viewBox:"0 0 120 38",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t("g",{clipPath:"url(#clip0_41_612)"},t("path",{d:"M8.82261 3.73315L0 8.82209V18.9999L8.82261 13.911L17.6474 8.82209L8.82261 3.73315Z",fill:"#83C6E1"}),t("path",{d:"M8.82261 24.089V13.9111L0 19.0001V29.1779L8.82261 34.2669L17.6474 29.1779V19.0001L8.82261 24.089Z",fill:"#438FD5"}),t("path",{d:"M17.6474 8.82202L8.82263 13.911L17.6474 18.9999V29.1777L26.47 24.0888V13.911L17.6474 8.82202Z",fill:"#F4220B"}),t("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"})),t("defs",null,t("clipPath",{id:"clip0_41_612"},t("rect",{width:"120",height:"38",fill:"white"}))))),t("ul",{css:S`
53
+ `,href:"https://uniform.dev/"},e("svg",{css:{display:"block"},width:"120",height:"38",viewBox:"0 0 120 38",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e("g",{clipPath:"url(#clip0_41_612)"},e("path",{d:"M8.82261 3.73315L0 8.82209V18.9999L8.82261 13.911L17.6474 8.82209L8.82261 3.73315Z",fill:"#83C6E1"}),e("path",{d:"M8.82261 24.089V13.9111L0 19.0001V29.1779L8.82261 34.2669L17.6474 29.1779V19.0001L8.82261 24.089Z",fill:"#438FD5"}),e("path",{d:"M17.6474 8.82202L8.82263 13.911L17.6474 18.9999V29.1777L26.47 24.0888V13.911L17.6474 8.82202Z",fill:"#F4220B"}),e("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"})),e("defs",null,e("clipPath",{id:"clip0_41_612"},e("rect",{width:"120",height:"38",fill:"white"}))))),e("ul",{css:D`
44
54
  display: flex;
45
55
  flex-flow: column nowrap;
46
56
  padding: 0;
47
57
  margin: 0;
48
58
  list-style-type: none;
49
- height: calc(100% - var(--spacing-base) * 2.5);
50
- `},St.map((o,a)=>t("li",{css:S`
51
- padding: 0;
52
- margin: 0;
53
- list-style-type: none;
54
-
55
- &:last-of-type {
56
- margin-top: auto;
57
- }
58
- `,key:a},t("a",{css:S`
59
- align-items: center;
60
- border-radius: var(--rounded-base);
61
- display: flex;
62
- color: var(--white);
63
- gap: var(--spacing-sm);
64
- padding: var(--spacing-sm) var(--spacing-base);
65
- text-decoration: none;
66
- transition: background-color 0.25s ease-in-out;
67
-
68
- &:hover,
69
- &.active {
70
- background: var(--gray-700);
59
+ flex-grow: 1;
60
+ `},it.map((a,l)=>{var m,u,i,d;let p=0;return a.href==="/overrides"&&Object.keys((m=t.settings.scoreOverrides)!=null?m:{}).length>0&&(p=Object.keys((u=t.settings.scoreOverrides)!=null?u:{}).length),a.href==="/quirks"&&Object.keys((i=t.settings.quirkOverrides)!=null?i:{}).length>0&&(p=Object.keys((d=t.settings.quirkOverrides)!=null?d:{}).length),e("li",{css:D`
61
+ padding: 0;
62
+ margin: 0;
63
+ list-style-type: none;
64
+
65
+ &:last-of-type {
66
+ margin-top: auto;
71
67
  }
72
- `,className:n(o.href),href:o.href,title:o.title,onClick:i=>r(i)},t("i",{css:S`
68
+ `,key:l},e(I,{css:D`
73
69
  align-items: center;
70
+ border-radius: var(--rounded-base);
74
71
  display: flex;
75
- `,dangerouslySetInnerHTML:{__html:o.icon}}),o.title)))))};var nt=()=>t("article",null,t("h1",null,"Something when wrong"),t("p",null,"We could not find the page you're looking for."));import*as _ from"react";import{css as H}from"@emotion/react";import*as I from"react";var at=H({willChange:"height"}),Ht=H`
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},e("i",{css:D`
83
+ align-items: center;
84
+ display: flex;
85
+ `,dangerouslySetInnerHTML:{__html:a.icon}}),a.title,p?e("span",{css:D`
86
+ font-size: var(--fs-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&&e("a",{target:"_blank",href:"https://chrome.google.com/webstore/detail/uniform-context/dcmlokofjljnfjcknpmhjocogllfbhkg",css:D`
95
+ align-items: center;
96
+ border-radius: var(--rounded-base);
97
+ display: flex;
98
+ font-size: var(--fs-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"},e("i",{css:D`
110
+ align-items: center;
111
+ display: flex;
112
+ `,dangerouslySetInnerHTML:{__html:st}}),"Install Chrome Extension"))};var ve=()=>e("article",null,e("h1",null,"Something when wrong"),e("p",null,"We could not find the page you're looking for."));import*as ee from"react";import{css as P}from"@emotion/react";import*as z from"react";var fe=P({willChange:"height"}),at=P`
76
113
  border-bottom: 2px solid var(--brand-secondary-1);
77
- font-size: var(--font-base);
114
+ font-size: var(--fs-base);
78
115
  margin: 0;
79
- `,Vt=H`
116
+ `,ct=P`
80
117
  align-items: center;
81
118
  border: none;
82
119
  background: none;
@@ -84,48 +121,15 @@ import{jsx as t}from"@emotion/react";import*as m from"react";import{css as S}fro
84
121
  display: flex;
85
122
  width: 100%;
86
123
  padding: var(--spacing-sm) 0;
87
- font-weight: var(--font-bold);
124
+ font-weight: var(--fw-bold);
88
125
  justify-content: space-between;
89
- `,Pt=H`
126
+ `,dt=P`
90
127
  align-self: center;
91
- `,At=H`
128
+ `,lt=P`
92
129
  transform: rotate(-180deg);
93
- `,E=({children:e})=>t("div",{css:[at]},e),B=({title:e,children:r})=>{let[n,o]=I.useState(!1),a=e.split(" ").join("-").toLocaleLowerCase();return t(I.Fragment,null,t("h3",{css:Ht},t("button",{"aria-expanded":n,css:Vt,title:e,id:a,"aria-controls":`${a}-section`,onClick:()=>o(i=>!i),type:"button"},e,t("i",{css:[Pt,n?At:void 0]},t("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t("path",{d:"M6.34317 7.75732L4.92896 9.17154L12 16.2426L19.0711 9.17157L17.6569 7.75735L12 13.4142L6.34317 7.75732Z",fill:"currentColor"}))))),t("div",{id:`${a}-section`,css:[at,H`
130
+ `,U=({children:t})=>e("div",{css:[fe]},t),_=({title:t,children:r})=>{let[n,o]=z.useState(!1),s=t.split(" ").join("-").toLocaleLowerCase();return e(z.Fragment,null,e("h3",{css:at},e("button",{"aria-expanded":n,css:ct,title:t,id:s,"aria-controls":`${s}-section`,onClick:()=>o(a=>!a),type:"button"},t,e("i",{css:[dt,n?lt:void 0]},e("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e("path",{d:"M6.34317 7.75732L4.92896 9.17154L12 16.2426L19.0711 9.17157L17.6569 7.75735L12 13.4142L6.34317 7.75732Z",fill:"currentColor"}))))),e("div",{id:`${s}-section`,css:[fe,P`
94
131
  padding: var(--spacing-sm) 0;
95
- `],role:"region","aria-labelledby":a},n?r:null))};import{css as T}from"@emotion/react";import*as it from"react";var Mt=T`
96
- align-items: center;
97
- border: 1px solid transparent;
98
- cursor: pointer;
99
- display: inline-flex;
100
- padding: var(--spacing-sm) var(--spacing-base);
101
- transition: opacity 0.2s ease-in-out, border-color 0.2s ease-in-out;
102
- font-size: var(--font-sm);
103
- &:hover {
104
- opacity: 0.8;
105
- }
106
- `;function zt(e){let r=T`
107
- color: var(--white);
108
- `,n=T`
109
- font-weight: var(--font-bold);
110
- `;switch(e){case"primary":return T`
111
- background: var(--brand-secondary-1);
112
- ${r}
113
- ${n}
114
- `;case"secondary":return T`
115
- background: var(--brand-secondary-5);
116
- ${r}
117
- ${n}
118
- `;case"unimportant":return T`
119
- background: var(--brand-secondary-3);
120
- color: var(--brand-secondary-1);
121
- ${n}
122
- `;case"ghost":return T`
123
- background: transparent;
124
- color: var(--brand-secondary-5);
125
- &:hover {
126
- border: 1px solid var(--brand-secondary-5);
127
- }
128
- `}}var k=({buttonType:e="primary",children:r,className:n,...o})=>t(it.Fragment,null,t("button",{type:"button",css:[Mt,zt(e)],className:n,...o},r));import{css as V}from"@emotion/react";var F=V`
132
+ `],role:"region","aria-labelledby":s},n?r:null))};import{css as H}from"@emotion/react";var G=H`
129
133
  background-color: var(--gray-100);
130
134
  padding: var(--spacing-base) var(--spacing-md);
131
135
  margin: var(--spacing-base) 0;
@@ -133,21 +137,21 @@ import{jsx as t}from"@emotion/react";import*as m from"react";import{css as S}fro
133
137
  &:first-of-type {
134
138
  margin: 0 0 var(--spacing-base);
135
139
  }
136
- `,st=V`
140
+ `,he=H`
137
141
  background: var(--gray-100)
138
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")
139
143
  no-repeat var(--spacing-sm) var(--spacing-base);
140
144
  padding: var(--spacing-base) var(--spacing-xl);
141
- `,Z=V`
145
+ `,$=H`
142
146
  color: var(--brand-secondary-1);
143
147
  margin: 0;
144
- font-size: var(--font-base);
145
- font-weight: var(--font-bold);
146
- `,U=V`
148
+ font-size: var(--fs-base);
149
+ font-weight: var(--fw-bold);
150
+ `,K=H`
147
151
  color: var(--brand-secondary-1);
148
152
  margin: var(--spacing-xs) 0 0;
149
- font-size: var(--font-sm);
150
- `,ct=V`
153
+ font-size: var(--fs-sm);
154
+ `,be=H`
151
155
  align-items: center;
152
156
  border: none;
153
157
  background: transparent
@@ -167,111 +171,39 @@ import{jsx as t}from"@emotion/react";import*as m from"react";import{css as S}fro
167
171
  &:hover {
168
172
  opacity: 0.6;
169
173
  }
170
- `,N=V`
174
+ `,W=H`
171
175
  display: flex;
172
176
  margin: var(--spacing-sm) 0 0;
173
177
  gap: var(--spacing-base);
174
- `;var O=({title:e,text:r,buttonGroup:n,children:o})=>t("div",{css:F},t("h2",{css:Z},e),t("p",{css:U},r),o,n?t("div",{css:N},n):null);import{css as A}from"@emotion/react";var lt=A`
175
- align-items: center;
176
- cursor: pointer;
177
- display: flex;
178
- gap: var(--spacing-xs);
179
- `,pt=A`
180
- color: var(--gray-500);
181
- font-size: var(--font-sm);
182
- `,ge=A`
183
- background: var(--gray-600);
184
- `,dt=A`
185
- display: block;
186
- background: var(--gray-400);
187
- border-radius: var(--rounded-full);
188
- position: relative;
189
- height: 16px;
190
- width: 32px;
191
- &:before {
192
- border-radius: var(--rounded-full);
193
- background: var(--white);
194
- content: '';
195
- display: block;
196
- width: 13px;
197
- height: 13px;
198
- position: absolute;
199
- top: 0;
200
- bottom: 0;
201
- margin: auto 0;
202
- transform: translateX(2px);
203
- transition: transform 0.2s ease-in-out, background-color 0.3s ease-in-out;
204
- }
205
- `,mt=A`
206
- overflow: hidden;
207
- clip: rect(0, 0, 0, 0);
208
- height: 0;
209
- width: 0;
210
- text-indent: -9999px;
211
-
212
- &:checked ~ :before {
213
- transform: translateX(17px);
214
- }
215
-
216
- &:checked ~ span {
217
- background: var(--brand-secondary-5);
218
- }
219
- `;var ut=({label:e,...r})=>t("label",{css:lt},t("span",{css:pt},e),t("input",{type:"checkbox",css:mt,...r}),t("span",{css:dt}));import{css as y}from"@emotion/react";var M=({children:e})=>t("table",{css:y`
220
- border-collapse: collapse;
221
- display: table;
222
- width: 100%;
223
- font-size: var(--font-sm);
224
- `},e),gt=({children:e})=>t("thead",{css:y`
225
- background: var(--gray-50);
226
- text-align: left;
227
- & tr {
228
- border-bottom: 1px solid var(--gray-200);
229
- }
230
- `},e),z=({children:e})=>t("tbody",null,e),P=({border:e,children:r})=>t("tr",{css:e?y`
231
- border-bottom: 1px solid var(--gray-200);
232
- &:where(:last-child) {
233
- border: none;
234
- }
235
- `:void 0},r),J=({children:e})=>t("th",{css:y`
236
- outline: none;
237
- padding: var(--spacing-sm);
238
- `},e);function It(e){switch(e){case"light":return y`
239
- color: var(--gray-400);
240
- `;case"dark":return y`
241
- color: var(--brand-secondary-1);
242
- `}}function Et(e){return y`
243
- text-align: ${e};
244
- `}var w=({alignment:e="left",border:r,color:n="dark",children:o})=>t("td",{css:[y`
245
- padding: var(--spacing-base);
246
- max-width: 180px;
247
- overflow-wrap: break-word;
248
- position: relative;
249
- `,It(n),Et(e),r?y`
250
- border-left: 1px solid var(--gray-200);
251
- `:void 0]},o);import{css as x,keyframes as Bt}from"@emotion/react";var Ft=Bt`from {
178
+ `;var M=({title:t,text:r,buttonGroup:n,children:o})=>e("div",{css:G},e("h2",{css:$},t),e("p",{css:K},r),o,n?e("div",{css:W},n):null);import{css as T,keyframes as pt}from"@emotion/react";var mt=pt`from {
252
179
  transform: scale(1);
253
180
  }
254
181
  to {
255
182
  transform: scale(1.2);
256
183
  }
257
- `,g={page:x`
184
+ `,f={page:T`
258
185
  color: var(--brand-secondary-1);
259
- `,text:x`
186
+ `,text:T`
260
187
  margin: var(--spacing-sm) 0;
261
- `,title:x`
188
+ `,reset:T`
189
+ margin: 0 var(--spacing-md);
190
+ font-size: var(--fs-sm);
191
+ color: var(--gray-500);
192
+ `,title:T`
262
193
  margin: 0 0 var(--spacing-sm);
263
- font-size: var(--font-md);
194
+ font-size: var(--fs-md);
264
195
  & > small {
265
196
  display: block;
266
- font-size: var(--font-xs);
267
- font-weight: var(--font-regular);
197
+ font-size: var(--fs-xs);
198
+ font-weight: var(--fw-regular);
268
199
  margin: var(--spacing-xxs) 0 0;
269
200
  }
270
- `,headingGroup:x`
201
+ `,headingGroup:T`
271
202
  align-items: baseline;
272
203
  display: flex;
273
204
  justify-content: space-between;
274
- `,divider:x`
205
+ align-items: center;
206
+ `,divider:T`
275
207
  background: var(--gray-300);
276
208
  display: block;
277
209
  width: 1px;
@@ -279,15 +211,94 @@ to {
279
211
  position: absolute;
280
212
  inset: 0 auto 0 0;
281
213
  margin: auto 0;
282
- `,submitButton:x`
214
+ `,submitButton:T`
283
215
  position: absolute;
284
216
  right: var(--spacing-base);
285
217
  bottom: var(--spacing-base);
286
- animation: 0.5s 2 alternate ${Ft};
287
- `,error:x`
218
+ animation: 0.5s 2 alternate ${mt};
219
+ `,cancelButton:T`
220
+ position: absolute;
221
+ left: calc(200px + var(--spacing-base));
222
+ bottom: var(--spacing-base);
223
+ background: white;
224
+ padding: var(--spacing-sm);
225
+ border: 1px solid var(--gray-300);
226
+ `,error:T`
288
227
  color: var(--brand-secondary-5);
289
- font-size: var(--font-sm);
290
- `};var ft=({dimensionIndex:{index:e},state:{scores:r,data:n},actions:o})=>{let a=_.useMemo(()=>Object.keys(e).filter(l=>!r[l]).map(l=>{var p;return(p=e[l])!=null?p:{name:l,dim:l,type:"Unknown"}}),[r,e]),i=Object.keys(r).length,u=i+a.length,b=()=>{o.rawUpdate([{type:"setcontrol",data:!n.controlGroup}])};return t(_.Fragment,null,t("article",{css:g.page},t("div",{css:g.headingGroup},t("h2",{css:g.title},"Dimensions",t("small",null,i," active of ",u)),t(ut,{label:"Control Group",onChange:b,checked:n.controlGroup})),i>0?t(M,null,t(z,null,Object.entries(r).map(([l,p],d)=>{var C;let{name:h,type:v,category:f}=(C=e==null?void 0:e[l])!=null?C:{name:l,dim:l,type:"Unknown"};return t(P,{key:d},t(w,null,t("b",null,p)),t(w,null,t("span",{css:g.divider,role:"presentation"}),t("strong",null,f?`${f}:`:""," ",h)),t(w,{alignment:"right",color:"light"},v))}))):t(O,{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?t(k,{buttonType:"secondary",onClick:b},"Exit control group"):null}),t(E,null,t(B,{title:"Inactive Dimensions"},t(M,null,t(z,null,a.map(({dim:l,type:p,name:d,category:h})=>t(P,{key:l},t(w,null,t("strong",null,h?`${h}:`:""," ",d)),t(w,{alignment:"right",color:"light"},p)))))))))};var bt=({...e})=>{let{state:{data:r}}=e;return t(m.Fragment,null,t("article",{css:g.page},t("h1",{css:g.title},"Quirks"),t("p",{css:g.text},"Keys defined in Uniform and their current, programmatically defined values for this visit."),Object.keys(r.quirks).length?t(M,null,t(gt,null,t(P,null,t(J,null,"Key"),t(J,null,"Value"))),t(z,null,Object.entries(r.quirks).map(([n,o],a)=>t(P,{key:a,border:"bottom"},t(w,null,t("strong",null,n)),t(w,null,o))))):t(O,{title:"No quirks configured",text:"There are currently no quirks setup."})))};import{Field as X,Form as _t,Formik as Gt}from"formik";import{ErrorMessage as Zt}from"formik";import{css as D}from"@emotion/react";var ht=D`
228
+ font-size: var(--fs-sm);
229
+ `,quirks:T`
230
+ .uniform-input-select,
231
+ input {
232
+ padding: var(--spacing-sm);
233
+ }
234
+ `};import{css as S}from"@emotion/react";var Y=({children:t})=>e("table",{css:S`
235
+ border-collapse: collapse;
236
+ display: table;
237
+ width: 100%;
238
+ font-size: var(--fs-sm);
239
+ `},t),ye=({children:t})=>e("thead",{css:S`
240
+ background: var(--gray-50);
241
+ text-align: left;
242
+ & tr {
243
+ border-bottom: 1px solid var(--gray-200);
244
+ }
245
+ `},t),J=({children:t})=>e("tbody",null,t),B=({border:t,children:r})=>e("tr",{css:t?S`
246
+ border-bottom: 1px solid var(--gray-200);
247
+ &:where(:last-child) {
248
+ border: none;
249
+ }
250
+ `:void 0},r),X=({children:t,width:r})=>e("th",{css:S`
251
+ outline: none;
252
+ padding: var(--spacing-sm);
253
+ width: ${r!=null?r:"auto"};
254
+ `},t);function ut(t){switch(t){case"light":return S`
255
+ color: var(--gray-400);
256
+ `;case"dark":return S`
257
+ color: var(--brand-secondary-1);
258
+ `}}function gt(t){return S`
259
+ text-align: ${t};
260
+ `}var O=({alignment:t="left",border:r,color:n="dark",children:o})=>e("td",{css:[S`
261
+ padding: var(--spacing-base);
262
+ max-width: 180px;
263
+ overflow-wrap: break-word;
264
+ position: relative;
265
+ `,ut(n),gt(t),r?S`
266
+ border-left: 1px solid var(--gray-200);
267
+ `:void 0]},o);import{css as ne}from"@emotion/react";var Ce=ne`
268
+ position: relative;
269
+ display: inline-block;
270
+ font-size: var(--fs-base);
271
+ `,we=ne`
272
+ display: block;
273
+ text-decoration: line-through;
274
+ `,ke=ne`
275
+ position: absolute;
276
+ width: 6px;
277
+ height: 6px;
278
+ right: -10px;
279
+ top: 9px;
280
+ background: var(--red-tooltip);
281
+ border-radius: 3px;
282
+ `;import{css as vt}from"@emotion/react";var ft=`<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
283
+ <path d="M4.2 7.2C4.53137 7.2 4.8 6.93137 4.8 6.6C4.8 6.26863 4.53137 6 4.2 6C3.86863 6 3.6 6.26863 3.6 6.6C3.6 6.93137 3.86863 7.2 4.2 7.2Z" fill="#828282"/>
284
+ <path d="M8.4 6.6C8.4 6.93137 8.13137 7.2 7.8 7.2C7.46863 7.2 7.2 6.93137 7.2 6.6C7.2 6.26863 7.46863 6 7.8 6C8.13137 6 8.4 6.26863 8.4 6.6Z" fill="#828282"/>
285
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M6 12C9.31371 12 12 9.31371 12 6C12 2.68629 9.31371 0 6 0C2.68629 0 0 2.68629 0 6C0 9.31371 2.68629 12 6 12ZM6 10.8C8.65097 10.8 10.8 8.65097 10.8 6C10.8 5.49824 10.723 5.01447 10.5802 4.55984C10.0795 4.69533 9.55274 4.76763 9.00913 4.76763C6.77526 4.76763 4.82652 3.54683 3.79366 1.73601C2.25282 2.53492 1.2 4.14451 1.2 6C1.2 8.65097 3.34903 10.8 6 10.8Z" fill="#828282"/>
286
+ </svg>`,ht=`<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
287
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M3.59995 5.05775C4.9254 5.05775 5.99992 3.98325 5.99992 2.65778C5.99992 1.33232 4.9254 0.257812 3.59995 0.257812C2.27448 0.257812 1.19998 1.33232 1.19998 2.65778C1.19998 3.98325 2.27448 5.05775 3.59995 5.05775ZM3.59999 3.85777C4.26272 3.85777 4.79997 3.32052 4.79997 2.65778C4.79997 1.99505 4.26272 1.4578 3.59999 1.4578C2.93725 1.4578 2.4 1.99505 2.4 2.65778C2.4 3.32052 2.93725 3.85777 3.59999 3.85777Z" fill="#828282"/>
288
+ <path d="M5.39993 6.8577C5.73131 6.8577 5.99993 7.12632 5.99993 7.45769V11.0576H7.19991V7.45769C7.19991 6.46356 6.39406 5.65771 5.39993 5.65771H1.79998C0.80588 5.65771 0 6.46356 0 7.45769V11.0576H1.19999V7.45769C1.19999 7.12632 1.46861 6.8577 1.79998 6.8577H5.39993Z" fill="#828282"/>
289
+ <path d="M11.9999 5.05762H8.3999V6.2576H11.9999V5.05762Z" fill="#828282"/>
290
+ <path d="M8.3999 7.45752H11.9999V8.6575H8.3999V7.45752Z" fill="#828282"/>
291
+ <path d="M11.9999 2.65771H8.3999V3.8577H11.9999V2.65771Z" fill="#828282"/>
292
+ </svg>`,Te=`<svg width="15" height="11" viewBox="0 0 15 11" fill="none" xmlns="http://www.w3.org/2000/svg">
293
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M7.113 3.12646C8.16729 3.12646 9.02195 3.98113 9.02195 5.03541C9.02195 5.86658 8.49075 6.57368 7.74932 6.83573V10.1259H6.47669V6.83573C5.73526 6.57368 5.20405 5.86658 5.20405 5.03541C5.20405 3.98113 6.05872 3.12646 7.113 3.12646ZM7.113 4.39909C7.46443 4.39909 7.74932 4.68398 7.74932 5.03541C7.74932 5.38684 7.46443 5.67172 7.113 5.67172C6.76158 5.67172 6.47669 5.38684 6.47669 5.03541C6.47669 4.68398 6.76158 4.39909 7.113 4.39909Z" fill="#828282"/>
294
+ <path d="M3.96336 1.88578C3.15733 2.69183 2.65879 3.80537 2.65879 5.03535C2.65879 6.42093 3.29145 7.65875 4.28366 8.47569L5.1895 7.56984C4.42501 6.98876 3.93142 6.06969 3.93142 5.03535C3.93142 4.1568 4.28752 3.36142 4.86325 2.78567L3.96336 1.88578Z" fill="#828282"/>
295
+ <path d="M9.36269 2.7856C9.93846 3.36136 10.2946 4.15676 10.2946 5.03535C10.2946 6.06973 9.80096 6.98882 9.03643 7.5699L9.94228 8.47575C10.9345 7.65881 11.5672 6.42096 11.5672 5.03535C11.5672 3.80533 11.0687 2.69177 10.2626 1.88571L9.36269 2.7856Z" fill="#828282"/>
296
+ <path d="M0.113525 5.03534C0.113525 3.10251 0.896953 1.35266 2.16359 0.0860049L3.06347 0.985892C2.02714 2.02224 1.38616 3.45394 1.38616 5.03534C1.38616 6.61674 2.02714 8.04844 3.06347 9.08479L2.16358 9.98468C0.89695 8.71802 0.113525 6.96817 0.113525 5.03534Z" fill="#828282"/>
297
+ <path d="M12.0624 9.98474C13.329 8.71809 14.1125 6.96821 14.1125 5.03534C14.1125 3.10248 13.329 1.3526 12.0624 0.0859375L11.1625 0.985824C12.1988 2.02218 12.8398 3.4539 12.8398 5.03534C12.8398 6.61678 12.1988 8.0485 11.1625 9.08486L12.0624 9.98474Z" fill="#828282"/>
298
+ </svg>`,De=({type:t})=>{let r="";switch(t){case"Audience":r=ft;break;case"Signal":r=Te;break;case"Intent":r=Te;break;case"Enrichment":r=ht;break}return e("i",{css:vt`
299
+ align-items: center;
300
+ display: inline-block;
301
+ `,dangerouslySetInnerHTML:{__html:r}})};var bt=({dimensionIndex:t,dimensions:r,disableEditOverride:n,onClick:o,preemptiveOverrides:s})=>{var p;let{settings:a}=Z(),l=(p=s!=null?s:a.scoreOverrides)!=null?p:{};return e(Y,null,e(J,null,Object.entries(r).sort(([m],[u])=>m.localeCompare(u)).map(([m,u])=>{var b;let{dim:i,name:d,type:c,category:g}=(b=t[m])!=null?b:{name:m,dim:m,type:void 0,category:void 0},v=l[i];return e(B,{key:i},e(O,null,v!==void 0?e("s",{css:we},v.initial):null,e("b",{css:Ce},u,v!==void 0&&e("i",{css:ke}))),e(O,null,e("div",{onClick:()=>o==null?void 0:o(i),css:o?{cursor:"pointer"}:void 0},e("span",{css:f.divider,role:"presentation"}),e("div",null,e(De,{type:c})," ",c),e("strong",null,g?`${g}:`:""," ",d))),e(O,{alignment:"right",color:"light"},v!==void 0&&!n?e(I,{route:`/overrides/${i}`},"Edit override"):null))})))},x=bt;async function j({actions:t,saveSettings:r,scores:n,settings:o}){var p,m;let s=(p=o.scoreOverrides)!=null?p:{},a={...s},l=[];for(let u of Object.keys(s)){let i=s==null?void 0:s[u];delete a[u],l.push({type:"modscoreS",data:{dimension:u,delta:i.initial-((m=n[u])!=null?m:0)}})}await r({...o,scoreOverrides:a}),await t.rawUpdate(l)}async function Se({quirk:t,settings:r,saveSettings:n,actions:o}){var l;let s=(l=r.quirkOverrides)==null?void 0:l[t];if(!s)return;let a={...r.quirkOverrides};delete a[t],await n({...r,quirkOverrides:a}),await o.rawUpdate([{type:"setquirk",data:{key:t,value:s.initial}}])}import{Button as Le}from"@uniformdev/design-system";import{Switch as yt}from"@uniformdev/design-system";var Oe=({dimensionIndex:{index:t},state:{scores:r,data:n},actions:o,saveSettings:s,settings:a})=>{let l=ee.useMemo(()=>{let i={};return Object.keys(t).filter(d=>!r[d]).map(d=>{i[t[d].dim]=0}),i},[r,t]),p=Object.keys(r).length,m=p+Object.keys(l).length,u=()=>{o.rawUpdate([{type:"setcontrol",data:!n.controlGroup}])};return e(ee.Fragment,null,e("article",{css:f.page},e("div",{css:f.headingGroup},e("h2",{css:f.title},"Dimensions",e("small",null,p," active of ",m)),e("div",{css:f.reset},e(Le,{buttonType:"ghost",onClick:()=>j({actions:o,saveSettings:s,scores:r,settings:a}).then(o.forget)},"clear all dimensions")),e(yt,{name:"controlGroup",label:"Control Group",onChange:u,checked:n.controlGroup})),p>0?e(x,{dimensionIndex:t,dimensions:r}):e(M,{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?e(Le,{buttonType:"secondary",onClick:u},"Exit control group"):null}),e(U,null,e(_,{title:`Inactive Dimensions (${Object.keys(l).length})`},e(x,{dimensionIndex:t,dimensions:l})))))};import*as Re from"react";import{AddButton as Ct}from"@uniformdev/design-system";import{Button as xe}from"@uniformdev/design-system";var Ve=({dimensionIndex:{index:t},state:{data:r,scores:n},actions:o,settings:s,saveSettings:a})=>{var d;let l=(d=s.scoreOverrides)!=null?d:{},p=Object.keys(l).length,m=c=>(c==null||c.preventDefault(),a({...s,route:"/overrides/add"})),u=()=>{o.rawUpdate([{type:"setcontrol",data:!r.controlGroup}])},i={};return Object.entries(n).map(([c,g])=>{l[c]!==void 0&&(i[c]=g)}),e(Re.Fragment,null,e("article",{css:f.page},e("div",{css:f.headingGroup},e("h2",{css:f.title},"What if?"),e("div",{css:f.reset},e(xe,{buttonType:"ghost",onClick:()=>j({actions:o,settings:s,saveSettings:a,scores:n})},"delete all overrides")),e(Ct,{onClick:m})),e("p",null,"Override dimension scores to test personalization"),p>0?e(x,{dimensionIndex:t,dimensions:i,onClick:c=>a({...s,route:`/overrides/${c}`})}):e(M,{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?e(xe,{buttonType:"secondary",onClick:u},"Exit control group"):null})))};import{Field as Qe,Form as Rt,Formik as Vt}from"formik";import*as A from"yup";import{css as R}from"@emotion/react";var Ie=R`
291
302
  background: var(--white);
292
303
  border: 1px solid var(--gray-500);
293
304
  border-radius: var(--rounded-base);
@@ -298,403 +309,115 @@ to {
298
309
  cursor: not-allowed;
299
310
  color: var(--gray-200);
300
311
  }
301
- `,vt=D`
302
- appearance: none;
303
- background: var(--white) url('./assets/chevon-down.svg') no-repeat 98% 50%;
304
- border: 1px solid var(--gray-500);
305
- border-radius: var(--rounded-base);
306
- color: var(--brand-secondary-1);
307
- padding: var(--spacing-base);
308
- &:disabled {
309
- cursor: not-allowed;
310
- color: var(--gray-200);
311
- }
312
- `,G=D`
312
+ `,cr=R`
313
313
  margin: var(--spacing-base) 0;
314
- `,K=D`
314
+ `,Pe=R`
315
315
  color: var(--brand-secondary-1);
316
316
  display: flex;
317
317
  flex-direction: column;
318
318
  margin: 0 0 var(--spacing-sm);
319
- `,$=D`
319
+ `,He=R`
320
320
  color: var(--brand-secondary-1);
321
321
  display: block;
322
- font-weight: var(--font-bold);
322
+ flex: 1 100%;
323
+ font-weight: var(--fw-bold);
323
324
  margin: 0 0 var(--spacing-sm);
324
- `,q=D`
325
+ `,dr=R`
325
326
  color: var(--gray-600);
326
- font-size: var(--font-sm);
327
- `,W=D`
327
+ font-size: var(--fs-sm);
328
+ `,lr=R`
328
329
  color: var(--brand-secondary-5);
329
330
  display: block;
330
- `;var Q=({field:e,form:r,meta:n,...o})=>{let{label:a,caption:i,...u}=o;return t("div",{css:G},t("label",{css:K},t("span",{css:$},a),t("input",{type:"text",css:ht,...e,...u})),i?t("span",{css:q},i):null,t(Zt,{component:"div",css:W,name:e.name}))};import{ErrorMessage as Ut}from"formik";var yt=({field:e,form:r,meta:n,...o})=>{let{label:a,options:i,caption:u,...b}=o;return t("div",{css:G},t("label",{css:K},t("span",{css:$},a),t("select",{...e,...b,css:vt},i.map((l,p)=>t("option",{value:l.value,key:p},l.text)))),u?t("span",{css:q},u):null,t(Ut,{component:"div",css:W,name:e.name}))};import*as R from"yup";import{css as Nt}from"@emotion/react";var j=({children:e,...r})=>t("fieldset",{css:Nt`
331
- border: none;
332
- padding: 0;
333
- `,...r},e);import{css as Ot}from"@emotion/react";var tt=({children:e})=>t("legend",{css:Ot`
334
- font-size: var(--font-base);
335
- font-weight: var(--font-bold);
336
- `},e);var Kt=R.object({apiKey:R.string().matches(/^uf.+$/,"API keys start with `uf`, double check your API key"),apiHost:R.string().matches(/^https:\/\/(localhost:8889|([a-z]+\.)?uniform.app)$/,"API host must be a Uniform domain."),logLevel:R.string(),projectId:R.string().uuid()}),wt=({settings:e,saveSettings:r,dimensionIndex:{error:n,loading:o}})=>{let a=[{value:"none",text:"Logging off"},{value:"info",text:"Log info, warnings, and errors"},{value:"warn",text:"Log warnings and errors"},{value:"error",text:"Log errors"},{value:"debug",text:"Verbose debug logging"}];return t(Gt,{initialValues:{apiHost:"",apiKey:"",projectId:"",logLevel:"none",...e},validationSchema:Kt,enableReinitialize:!0,onSubmit:i=>{r({...e,apiHost:i.apiHost,apiKey:i.apiKey,projectId:i.projectId,logLevel:i.logLevel})}},({dirty:i,isValid:u,isSubmitting:b})=>t(_t,{css:g.page},t("h1",{css:g.title},"Settings"),t(X,{component:yt,label:"Logging",caption:"Logs can be viewed in the browser console",id:"logging",name:"logLevel",options:a,disabled:b}),t(j,{disabled:b},t(tt,null,"Data Connection"),!o&&n?t("p",{css:g.error},"Unable to fetch data from Uniform",t("br",null),t("em",null,n.message)):null,t("p",{css:g.text},t("small",null,"Adding an API key and project ID enables richer dimension data to be shown. You must have access to the Uniform project to do this.")),t(X,{component:Q,label:"Uniform API key",caption:"Generate an API key in your Uniform team settings. Grant only Context: Read Drafts permission.",id:"api-key",name:"apiKey",autoComplete:"off"}),t(X,{component:Q,label:"Uniform Project ID",caption:"Available after generating an API key ",id:"project-id",name:"projectId",autoComplete:"off"}),t(E,null,t(B,{title:"Advanced"},t(X,{component:Q,label:"Alternative API Host",caption:"Use a non-standard Uniform API endpoint. Most people will not not need this option.",id:"api-host",name:"apiHost",autoComplete:"off"}))),i?t(k,{type:"submit",css:g.submitButton,disabled:!u},"Save"):null)))};var et=({settings:e,saveSettings:r})=>{let n=()=>{r({...e,route:"/settings"})},o=()=>{r({...e,ignoreApiKeyPrompt:!0})},a=!(e==null?void 0:e.apiKey);return!e.ignoreApiKeyPrompt&&a?t("div",{css:[F,st]},t("h2",{css:Z},"Connect this site"),t("p",{css:U},"Add a Uniform API key to get better data."),t("div",{css:N},t(k,{buttonType:"secondary",onClick:n},"Connect this site"),t(k,{buttonType:"ghost",onClick:o},"Skip for now")),t("button",{type:"button",css:ct,title:"close",onClick:o},t("span",{hidden:!0},"Close"))):null};import{computeDimensionDefinitionDisplayData as $t,computeDimensionDisplayData as Ct,DimensionClient as qt}from"@uniformdev/context/api";import{useAsync as Wt}from"react-use";import*as Lt from"react";function Tt({apiHost:e,apiKey:r,projectId:n},o){let a=Lt.useMemo(()=>{var p,d,h,v;let l={};return o&&(Object.keys((d=(p=o==null?void 0:o.project.pz)==null?void 0:p.sig)!=null?d:{}).forEach(f=>{let C=Ct(f,o);C&&(l[f]=C)}),Object.keys((v=(h=o==null?void 0:o.project.pz)==null?void 0:h.agg)!=null?v:{}).forEach(f=>{let C=Ct(f,o);C&&(l[f]=C)})),l},[o]),{loading:i,error:u,value:b}=Wt(async()=>{if(!r||!n)return a;let p=(await new qt({projectId:n,apiKey:r,apiHost:e||void 0}).get()).dimensions,d={...a};return p.forEach(h=>{d[h.dim]=$t(h)}),d},[e,r,n,a]);return{loading:i,error:u,index:b!=null?b:a}}import{css as ot}from"@emotion/react";function Y(){return t("style",null,`
337
- :root {
338
- --brand-primary-1: #438fd5; /* bright blue */
339
- --brand-primary-2: #f4220b; /* red */
340
- --brand-primary-3: #83c6e1; /* slate blue */
341
-
342
- /* secondary colours */
343
- --brand-secondary-1: #1f2b34; /* carbon */
344
- --brand-secondary-2: #ecf1f1; /* silver */
345
- --brand-secondary-3: #2ecdb4; /* teal */
346
- --brand-secondary-4: #f6f1c3; /* yellow */
347
- --brand-secondary-5: #d9534f; /* brick red */
348
- --brand-secondary-6: #dbf6f2; /* mint */
349
-
350
- /* off brand */
351
- --input-border: rgba(31, 43, 52, 0.5);
352
-
353
- /* site settings */
354
- --site-width: 700px;
355
- --min-height: 450px;
356
-
357
- --spacing-base: 1.15rem;
358
- --spacing-xs: calc(var(--spacing-base) - 0.75rem);
359
- --spacing-sm: calc(var(--spacing-base) - 0.5rem);
360
- --spacing-md: calc(var(--spacing-base) * 1.5);
361
- --spacing-lg: calc(var(--spacing-base) * 2);
362
- --spacing-xl: calc(var(--spacing-base) * 2.5);
363
-
364
- /* font sizes */
365
- --font-base: 1rem; /* 16px */
366
- --font-xxs: calc(var(--font-base) - 0.5rem);
367
- --font-xs: calc(var(--font-base) - 0.25rem);
368
- --font-sm: calc(var(--font-base) - 0.125rem); /* 14px */
369
- --font-md: calc(var(--font-base) * 1.25);
370
- --font-lg: calc(var(--font-base) * 1.5);
371
-
372
- /* font-weight */
373
- --font-regular: 400;
374
- --font-bold: 700;
375
-
376
- /* brand shadow styles */
377
- --shadow-base: rgba(50, 50, 93, 0.25) 0px 2px 5px -1px, rgba(0, 0, 0, 0.3) 0px 1px 3px -1px;
378
-
379
- /* rounder corners */
380
- --rounded-base: 6px;
381
- --rounded-full: 99999px;
382
-
383
- /* gray spectrum */
384
- --white: #fff;
385
- --gray-50: #f9fafb;
386
- --gray-100: #f3f4f6;
387
- --gray-200: #e5e7eb;
388
- --gray-300: #d1d5db;
389
- --gray-400: #9ca3af;
390
- --gray-500: #6b7280;
391
- --gray-600: #4b5563;
392
- --gray-700: #374151;
393
- --gray-800: #1f2937;
394
- --gray-900: #111827;
395
-
396
- /* z-indexs */
397
- --z-10: 10;
331
+ `,Me=R`
332
+ flex-direction: row;
333
+ flex-wrap: wrap;
334
+
335
+ input[type='range'] {
336
+ height: 28px;
337
+ -webkit-appearance: none;
338
+ margin: 10px 0;
339
+ width: 100%;
340
+ flex: 1 0 80%;
398
341
  }
399
342
 
400
- /*! modern-normalize v1.1.0 | MIT License | https://github.com/sindresorhus/modern-normalize */
401
-
402
- /*
403
- Document
404
- ========
405
- */
406
-
407
- /**
408
- Use a better box model (opinionated).
409
- */
410
-
411
- *,
412
- ::before,
413
- ::after {
414
- box-sizing: border-box;
415
- }
416
-
417
- /**
418
- Use a more readable tab size (opinionated).
419
- */
420
-
421
- html {
422
- -moz-tab-size: 4;
423
- tab-size: 4;
424
- }
425
-
426
- /**
427
- 1. Correct the line height in all browsers.
428
- 2. Prevent adjustments of font size after orientation changes in iOS.
429
- */
430
-
431
- html {
432
- line-height: 1.15; /* 1 */
433
- -webkit-text-size-adjust: 100%; /* 2 */
434
- }
435
-
436
- /*
437
- Sections
438
- ========
439
- */
440
-
441
- /**
442
- Remove the margin in all browsers.
443
- */
444
-
445
- body {
446
- margin: 0;
447
- }
448
-
449
- /**
450
- Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3)
451
- */
452
-
453
- body {
454
- font-family:
455
- system-ui,
456
- -apple-system, /* Firefox supports this but not yet system-ui */
457
- 'Segoe UI',
458
- Roboto,
459
- Helvetica,
460
- Arial,
461
- sans-serif,
462
- 'Apple Color Emoji',
463
- 'Segoe UI Emoji';
464
- }
465
-
466
- /*
467
- Grouping content
468
- ================
469
- */
470
-
471
- /**
472
- 1. Add the correct height in Firefox.
473
- 2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
474
- */
475
-
476
- hr {
477
- height: 0; /* 1 */
478
- color: inherit; /* 2 */
479
- }
480
-
481
- /*
482
- Text-level semantics
483
- ====================
484
- */
485
-
486
- /**
487
- Add the correct text decoration in Chrome, Edge, and Safari.
488
- */
489
-
490
- abbr[title] {
491
- text-decoration: underline dotted;
492
- }
493
-
494
- /**
495
- Add the correct font weight in Edge and Safari.
496
- */
497
-
498
- b,
499
- strong {
500
- font-weight: bolder;
501
- }
502
-
503
- /**
504
- 1. Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3)
505
- 2. Correct the odd 'em' font sizing in all browsers.
506
- */
507
-
508
- code,
509
- kbd,
510
- samp,
511
- pre {
512
- font-family:
513
- ui-monospace,
514
- SFMono-Regular,
515
- Consolas,
516
- 'Liberation Mono',
517
- Menlo,
518
- monospace; /* 1 */
519
- font-size: 1em; /* 2 */
520
- }
521
-
522
- /**
523
- Add the correct font size in all browsers.
524
- */
525
-
526
- small {
527
- font-size: 80%;
528
- }
529
-
530
- /**
531
- Prevent 'sub' and 'sup' elements from affecting the line height in all browsers.
532
- */
533
-
534
- sub,
535
- sup {
536
- font-size: 75%;
537
- line-height: 0;
538
- position: relative;
539
- vertical-align: baseline;
540
- }
541
-
542
- sub {
543
- bottom: -0.25em;
544
- }
545
-
546
- sup {
547
- top: -0.5em;
548
- }
549
-
550
- /*
551
- Tabular data
552
- ============
553
- */
554
-
555
- /**
556
- 1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
557
- 2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
558
- */
559
-
560
- table {
561
- text-indent: 0; /* 1 */
562
- border-color: inherit; /* 2 */
563
- }
564
-
565
- /*
566
- Forms
567
- =====
568
- */
569
-
570
- /**
571
- 1. Change the font styles in all browsers.
572
- 2. Remove the margin in Firefox and Safari.
573
- */
574
-
575
- button,
576
- input,
577
- optgroup,
578
- select,
579
- textarea {
580
- font-family: inherit; /* 1 */
581
- font-size: 100%; /* 1 */
582
- line-height: 1.15; /* 1 */
583
- margin: 0; /* 2 */
584
- }
585
-
586
- /**
587
- Remove the inheritance of text transform in Edge and Firefox.
588
- 1. Remove the inheritance of text transform in Firefox.
589
- */
590
-
591
- button,
592
- select { /* 1 */
593
- text-transform: none;
594
- }
595
-
596
- /**
597
- Correct the inability to style clickable types in iOS and Safari.
598
- */
599
-
600
- button,
601
- [type='button'],
602
- [type='reset'],
603
- [type='submit'] {
604
- -webkit-appearance: button;
605
- }
606
-
607
- /**
608
- Remove the inner border and padding in Firefox.
609
- */
610
-
611
- ::-moz-focus-inner {
612
- border-style: none;
613
- padding: 0;
614
- }
615
-
616
- /**
617
- Restore the focus styles unset by the previous rule.
618
- */
619
-
620
- :-moz-focusring {
621
- outline: 1px dotted ButtonText;
622
- }
623
-
624
- /**
625
- Remove the additional ':invalid' styles in Firefox.
626
- See: https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737
627
- */
628
-
629
- :-moz-ui-invalid {
630
- box-shadow: none;
631
- }
632
-
633
- /**
634
- Remove the padding so developers are not caught out when they zero out 'fieldset' elements in all browsers.
635
- */
636
-
637
- legend {
638
- padding: 0;
639
- }
640
-
641
- /**
642
- Add the correct vertical alignment in Chrome and Firefox.
643
- */
644
-
645
- progress {
646
- vertical-align: baseline;
647
- }
648
-
649
- /**
650
- Correct the cursor style of increment and decrement buttons in Safari.
651
- */
652
-
653
- ::-webkit-inner-spin-button,
654
- ::-webkit-outer-spin-button {
655
- height: auto;
656
- }
657
-
658
- /**
659
- 1. Correct the odd appearance in Chrome and Safari.
660
- 2. Correct the outline style in Safari.
661
- */
662
-
663
- [type='search'] {
664
- -webkit-appearance: textfield; /* 1 */
665
- outline-offset: -2px; /* 2 */
666
- }
667
-
668
- /**
669
- Remove the inner padding in Chrome and Safari on macOS.
670
- */
343
+ input[type='range']:focus {
344
+ outline: none;
345
+ }
671
346
 
672
- ::-webkit-search-decoration {
673
- -webkit-appearance: none;
674
- }
347
+ input[type='range']::-webkit-slider-runnable-track {
348
+ width: 100%;
349
+ height: 6px;
350
+ cursor: pointer;
351
+ animate: 0.2s;
352
+ box-shadow: 0 0 0 #000000;
353
+ background: #2ecdb4;
354
+ border-radius: 0;
355
+ border: 0 solid #000000;
356
+ }
675
357
 
676
- /**
677
- 1. Correct the inability to style clickable types in iOS and Safari.
678
- 2. Change font properties to 'inherit' in Safari.
679
- */
358
+ input[type='range']::-moz-range-track {
359
+ width: 100%;
360
+ height: 6px;
361
+ cursor: pointer;
362
+ animate: 0.2s;
363
+ box-shadow: 0 0 0 #000000;
364
+ background: #2ecdb4;
365
+ border-radius: 0;
366
+ border: 0 solid #000000;
367
+ }
680
368
 
681
- ::-webkit-file-upload-button {
682
- -webkit-appearance: button; /* 1 */
683
- font: inherit; /* 2 */
684
- }
369
+ input[type='range']::-webkit-slider-thumb {
370
+ box-shadow: 1px 1px 2px #000000;
371
+ border: 1px solid #000000;
372
+ height: 20px;
373
+ width: 20px;
374
+ border-radius: 20px;
375
+ background: #ffffff;
376
+ cursor: pointer;
377
+ -webkit-appearance: none;
378
+ margin-top: -7.5px;
379
+ }
380
+ input[type='range']::-moz-range-thumb {
381
+ box-shadow: 1px 1px 2px #000000;
382
+ border: 1px solid #000000;
383
+ height: 20px;
384
+ width: 20px;
385
+ border-radius: 20px;
386
+ background: #ffffff;
387
+ cursor: pointer;
388
+ -webkit-appearance: none;
389
+ margin-top: -7.5px;
390
+ }
391
+ input[type='range']:focus::-webkit-slider-runnable-track {
392
+ background: #2ecdb4;
393
+ }
685
394
 
686
- /*
687
- Interactive
688
- ===========
689
- */
395
+ .value-display {
396
+ flex: 1 0 20%;
397
+ padding: 10px;
398
+ }
399
+ `;import{Caption as wt,ErrorMessage as kt}from"@uniformdev/design-system";var Ae=({field:t,form:r,meta:n,...o})=>{var u,i;let{label:s,caption:a,min:l=0,max:p=100,step:m}=o;return e("div",null,e("label",{css:[Pe,Me]},e("span",{css:He},s),e("input",{type:"range",min:l,max:p,step:m,...t,value:(u=t.value)!=null?u:0}),e("span",{className:"value-display"},(i=t.value)!=null?i:0)),a?e(wt,null,a):null,r.touched[t.name]&&r.errors[t.name]?e(kt,{message:r.errors[t.name]}):null)};import{css as Tt}from"@emotion/react";var V=({children:t,...r})=>e("fieldset",{css:Tt`
400
+ border: none;
401
+ padding: 0;
402
+ & legend {
403
+ margin-bottom: var(--spacing-base);
404
+ }
405
+ `,...r},t);import{css as Dt}from"@emotion/react";var Q=({children:t})=>e("legend",{css:Dt`
406
+ font-size: var(--fs-md);
407
+ font-weight: var(--fw-bold);
408
+ border-bottom: 1px solid var(--gray-400);
409
+ width: 100%;
410
+ `},t);import{Context as St,TransitionDataStore as Lt}from"@uniformdev/context";function Ee({manifest:t,visitor:r,override:n}){let o=new St({manifest:t,transitionStore:new ie({initialData:r})}),s={...o.scores};o.storage.updateData([n]);let l={...{...o.scores}};return Object.entries(l).forEach(([p,m])=>{s[p]===m&&delete l[p]}),l}var ie=class extends Lt{async handleDelete(){}async handleUpdateData(){}};function F({scores:t,scoreOverrides:r}){let n=[];return r?(Object.entries(r).forEach(([o,s])=>{var p;let a=(p=t[o])!=null?p:0;if(a===s.override)return;let l=s.override-a;n.push({type:"modscoreS",data:{dimension:o,delta:l}})}),n):[]}function te({quirks:t,quirkOverrides:r}){let n={};if(!!r)return Object.entries(r).forEach(([o,s])=>{t[o]!==s.override&&(n[o]=s.override)}),Object.keys(n).length>0?n:void 0}import{Button as It}from"@uniformdev/design-system";var se=t=>({field:r,form:n,meta:o,...s})=>e(t,{...s,...r,errorMessage:n.errors[r.name]});import{Input as Ot,InputSelect as xt}from"@uniformdev/design-system";var oe=se(Ot),Be=se(xt);var Pt=A.object({dimension:A.string(),score:A.number()}),ae=({settings:t,saveSettings:r,state:n,actions:o,dimensionIndex:{index:s}})=>{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 e("p",null,"Error, manifest is broken or there is no signal to override.");let p=Object.entries(s).filter(([,i])=>i.type!=="Audience"&&i.type!=="Intent").map(([i,d])=>{let c=d.type?`${d.type}: `:"",g=d.category?`${d.category} - `:"",v=`${c}${g}${d.name}`;return{value:i,label:v}});return p.unshift({value:"",label:"Choose dimension to override"}),e(Vt,{initialValues:{dimension:l,score:(u=n.scores[l])!=null?u:0},validate:i=>{let d={};return(i.score===n.scores[i.dimension]||i.score===0&&!n.scores[l])&&(d.score="You have to modify current score value"),d},validationSchema:Pt,enableReinitialize:!0,validateOnChange:!1,validateOnBlur:!1,onSubmit:async i=>{var b,y,C,k,E,pe;let d=(y=(b=s[i.dimension])==null?void 0:b.cap)!=null?y:0,c=Math.min(i.score,d),g={...t,scoreOverrides:{...t.scoreOverrides,[i.dimension]:{initial:(pe=(E=(k=(C=t.scoreOverrides)==null?void 0:C[i.dimension])==null?void 0:k.initial)!=null?E:n.scores[i.dimension])!=null?pe:0,override:c}},route:"/overrides"};await r(g);let v=F({scores:n.scores,scoreOverrides:g.scoreOverrides});o.rawUpdate(v)}},({isSubmitting:i,values:d})=>{var y;let c=Ee({manifest:n.manifest,visitor:n.data,override:{type:"modscore",data:{dimension:d.dimension,delta:d.score-((y=n.scores[d.dimension])!=null?y:0)}}}),g=Object.entries(n.scores).reduce((C,[k,E])=>(C[k]={initial:E,override:E},C),{}),v={max:100,step:50};s[d.dimension]&&(v.max=s[d.dimension].cap,v.step=s[d.dimension].str);let b=d.score&&Object.keys(c).length>0;return e(Rt,{css:f.page},e("h1",{css:f.title},"Override Dimension"),e(Qe,{component:Be,label:"Dimension",id:"dimension",name:"dimension",options:p,disabled:i}),e("p",{css:f.text},e("small",null,"Audiences and Intents are aggregated from other dimension scores and cannot be overridden directly.")),d.dimension?e(Qe,{component:Ae,name:"score",label:"Score",disabled:i,caption:`Range: 0 - ${v.max} in increments of ${v.step}`}):null,e(V,{disabled:i,css:{marginBottom:"2rem"}},b?e(U,null,e(_,{title:`Impacted Dimensions (${Object.keys(c).length})`},e(x,{preemptiveOverrides:g,dimensionIndex:s,dimensions:c,disableEditOverride:!0}))):null,e(It,{type:"submit",css:f.submitButton,disabled:i},"Save"),e(I,{route:"/overrides",css:f.cancelButton},"Cancel")))})};import{useState as Qt}from"react";import{useState as Ht,useEffect as Mt}from"react";import{Button as At,Input as Et}from"@uniformdev/design-system";var Bt=({name:t,value:r,submit:n})=>{let[o,s]=Ht(r!=null?r:"");return Mt(()=>{s(r!=null?r:"")},[r]),e("div",{css:{display:"flex",gap:"var(--spacing-sm)"}},e(Et,{type:"text",css:[Ie],name:t,value:o,onChange:p=>{s(p.target.value)}}),e(At,{buttonType:"primary",disabled:o===r,size:"sm",onClick:()=>n(t,o!=null?o:"")},"Save"))},Fe=Bt;import{Button as qe,InputSelect as Ft}from"@uniformdev/design-system";var Ne=({...t})=>{let{state:{data:{quirks:r}},quirksIndex:{index:n},settings:o,saveSettings:s,actions:a}=t,[l,p]=Qt(""),m;l&&(m=n[l]);let u=async(i,d)=>{var v,b,y;p("");let c={...o,quirkOverrides:{...o.quirkOverrides,[i]:{initial:(y=(b=(v=o.quirkOverrides)==null?void 0:v[i])==null?void 0:b.initial)!=null?y:r[i],override:d}}};await s(c);let g=te({quirks:r,quirkOverrides:c.quirkOverrides});await a.update({quirks:g})};return e(h.Fragment,null,e("article",{css:[f.page,f.quirks]},e("h1",{css:f.title},"Quirks"),e("p",{css:f.text},"Keys defined in Uniform and their current, programmatically defined values for this visit."),Object.keys(n).length?e(Y,null,e(ye,null,e(B,null,e(X,{width:"30%"},"Key"),e(X,{width:"50%"},"Value"),e(X,{width:"20%"},""))),e(J,null,Object.values(n).map(({name:i,value:d,id:c})=>{var b,y,C;let g=(y=(b=o.quirkOverrides)==null?void 0:b[i])==null?void 0:y.initial,v=[];return m&&m.options&&(v=m.options.map(k=>({value:k.value,label:k.name}))),e(B,{key:c,border:"bottom"},e(O,null,e("strong",null,i)),e(O,null,l!==c?e("div",{onClick:()=>{p(c)}},g?e("div",null,e("s",null,g)):null,d):null,l===c&&m&&e(h.Fragment,null,m.options?e(Ft,{showLabel:!1,label:`Change ${i}`,defaultOption:`Change ${i}`,name:c,onChange:k=>u(k.target.name,k.target.value),options:v}):e(Fe,{name:c,value:d,submit:u}))),e(O,null,l?null:(C=o.quirkOverrides)!=null&&C[c]?e(qe,{buttonType:"ghost",onClick:()=>{Se({quirk:c,settings:o,saveSettings:s,actions:a})}},e("small",null,"Clear Override")):e(qe,{buttonType:"ghost",onClick:()=>{p(c)}},e("small",null,"Override"))))}))):e(M,{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 qt}from"@uniformdev/design-system";import{Switch as Ze}from"@uniformdev/design-system";var ze=({settings:t,saveSettings:r,actions:n,state:{data:o}})=>e("article",{css:[f.page,{display:"flex",flexDirection:"column",gap:"var(--spacing-base)"}]},e("h1",{css:f.title},"Settings"),e(V,null,e(Q,null,"Data Connection"),e(qt,{buttonType:"tertiary",onClick:()=>{r({...t,route:"/connect"})}},"Manage Connection to Uniform")),e(V,null,e(Q,null,"Storage Consent"),e(Ze,{label:"Store visitor data",id:"consent-mode",name:"consentMode",checked:o.consent,onChange:s=>{n.rawUpdate([{type:"consent",data:s.currentTarget.checked}]),r({...t,consentMode:s.currentTarget.checked})}}),e("p",null,e("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."))),e(V,null,e(Q,null,"Logging"),e(Ze,{label:"Write Uniform Context diagnostic logs to browser console",id:"logging",name:"logging",checked:t.logLevel==="debug",onChange:s=>r({...t,logLevel:s.currentTarget.checked?"debug":"none"})})));import{Button as Ue}from"@uniformdev/design-system";var ce=({settings:t,saveSettings:r})=>{let n=()=>{r({...t,route:"/connect"})},o=()=>{r({...t,ignoreApiKeyPrompt:!0})},s=t.route==="/connect",a=!(t!=null&&t.apiKey);return!t.ignoreApiKeyPrompt&&a&&!s?e("div",{css:[G,he]},e("h2",{css:$},"Connect to a Uniform Project"),e("p",{css:K},"This allows reading human-readable labels for the dimensions."),e("div",{css:W},e(Ue,{buttonType:"secondary",onClick:n},"Connect this site"),e(Ue,{buttonType:"ghost",onClick:o},"Skip for now")),e("button",{type:"button",css:be,title:"close",onClick:o},e("span",{hidden:!0},"Close"))):null};import{computeDimensionDefinitionDisplayData as Nt,computeDimensionDisplayData as _e,DimensionClient as Zt}from"@uniformdev/context/api";import{useAsync as zt}from"react-use";import*as Ge from"react";function $e({apiHost:t,apiKey:r,projectId:n},o){let{loading:s,error:a,value:l}=zt(async()=>{if(!r||!n)return p;let u=(await new Zt({projectId:n,apiKey:r,apiHost:t||void 0}).get()).dimensions,i={};return u.map(d=>{var c,g,v,b;if(i[d.dim]={...Nt(d),cap:d.cap,str:10},i[d.dim].type==="Enrichment"){let y=d.dim.split("_")[0];i[d.dim].cap=(b=(v=(g=(c=o==null?void 0:o.project.pz)==null?void 0:c.enr)==null?void 0:g[y])==null?void 0:v.cap)!=null?b:100}}),i},[t,r,n]),p=Ge.useMemo(()=>{var u,i,d,c;let m={};return o&&(Object.entries((i=(u=o==null?void 0:o.project.pz)==null?void 0:u.sig)!=null?i:{}).map(([g,v])=>{let b=_e(g,o);b&&(m[g]={...v,...b})}),Object.entries((c=(d=o==null?void 0:o.project.pz)==null?void 0:d.enr)!=null?c:{}).map(([g,v])=>{var C;let b=_e(g,o),y={cap:(C=v.cap)!=null?C:100,str:10};b&&(m[g]={...b,cap:y.cap,str:y.str})}),l&&Object.entries(l).map(([g,v])=>{m[g]={...m[g],...v}})),m},[o,l]);return{loading:s,error:a,index:p}}import{useMemo as Ut}from"react";import{QuirkClient as _t}from"@uniformdev/context/api";import{useAsync as Gt}from"react-use";function Ke({apiHost:t,apiKey:r,projectId:n},o){let{loading:s,error:a,value:l}=Gt(async()=>{if(!r||!n)return{};let u=await new _t({projectId:n,apiKey:r,apiHost:t||void 0}).get(),i={};return u.quirks.map(d=>{i[d.id]={...d,value:o[d.id]}}),i},[t,r,n]),p=Ut(()=>{let m={};return Object.entries(o).map(([u,i])=>m[u]={value:i,id:u,name:u}),l&&Object.entries(l).map(([u,i])=>m[u]={...i,value:o[u]}),m},[o,l]);return{loading:s,error:a,index:p}}import{css as Xe}from"@emotion/react";import{Theme as no}from"@uniformdev/design-system";function re(){return e("style",null,`
411
+ :root {
412
+ --site-width: 700px;
690
413
 
691
- /*
692
- Add the correct display in Chrome and Safari.
693
- */
414
+ /* Red CTA */
415
+ --red-button: rgb(217 83 79);
416
+ --red-tooltip: #D9534F;
694
417
 
695
- summary {
696
- display: list-item;
697
- }`)}var Qt=ot`
418
+ --min-height: 450px;
419
+ }
420
+ `)}import{useEffect as $t,useState as Kt}from"react";import{useMountedState as Wt}from"react-use";var We=()=>{let[t,r]=Kt(!1),n=Wt();return $t(()=>{setTimeout(()=>{n()&&r(!0)},1e3)},[n]),t?e("article",{css:f.page},e("h1",null,"Loading..."),e("p",null,"Connecting to Uniform API for complete data.")):null};import{parseQuickConnect as Yt}from"@uniformdev/context";import{ApiClientError as Jt,ManifestClient as Xt}from"@uniformdev/context/api";import{Field as de,Form as jt,Formik as eo}from"formik";import*as w from"react";import{ErrorMessage as to,Input as oo,Button as q}from"@uniformdev/design-system";function Ye(t){let[r,n]=w.useState(t.currentData?"c":"qc"),[o,s]=w.useState(void 0),[a,l]=w.useState(void 0),p=w.useCallback(async i=>{let d=new Xt(i);s(void 0);try{let c=await d.get({preview:!0});return l({manifest:c,target:i}),c}catch(c){if(c instanceof Jt){c.statusCode===403?s("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."):s(c.errorMessage);return}if("message"in c){c.message==="Failed to fetch"?s("A network error occurred. Ensure the API host is valid."):s(c.message);return}s(JSON.stringify(c,null,2));return}},[]);w.useEffect(()=>{!t.currentData||p(t.currentData)},[p,t.currentData]);let m=async i=>{await p(i)&&(n("c"),await t.onConnect(i))},u=()=>{confirm("Disconnect from Uniform? Make sure to save your API key if you want to reconnect.")&&(n("qc"),l(void 0),s(void 0),t.onConnect(null))};return e("div",null,o?e(to,{message:o}):null,r==="qc"||r==="mc"?e(ro,{...t,state:r,setState:n,onConnect:m}):e("div",null,a?e(w.Fragment,null,e("p",null,"Connected to"," ",e("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"}},e("strong",null,a==null?void 0:a.manifest.project.name))," ",e("small",null,"(",a==null?void 0:a.manifest.project.id,")")),e(q,{buttonType:"secondary",type:"button",onClick:u},"Disconnect")):null))}function ro({setState:t,state:r,currentData:n,onConnect:o}){var s,a,l;return e("div",null,e(eo,{initialValues:{apiHost:(s=n==null?void 0:n.apiHost)!=null?s:"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:i})=>e(jt,null,e("fieldset",{css:{display:"flex",flexDirection:"column",gap:"var(--spacing-base)"}},r==="qc"?e(w.Fragment,null,e("div",null,e(oo,{placeholder:"Paste Quick Connect Code Here",caption:"Copy the Quick Connect code after creating an API key in Uniform.",errorMessage:u,onChange:d=>{try{let c=Yt(d.currentTarget.value);p("apiHost",c.apiHost),p("apiKey",c.apiKey),p("projectId",c.projectId)}catch(c){m("qc",c.message)}}})),e("section",{css:{display:"flex",gap:"var(--spacing-sm)"}},e(q,{type:"submit",buttonType:"primary",disabled:i},i?"Verifying...":"Connect"),e(q,{type:"button",buttonType:"ghost",onClick:()=>t("mc"),disabled:i},"Connect Manually"))):e(w.Fragment,null,e("div",null,e(de,{component:oe,label:"API Key",name:"apiKey",caption:"Generate an API key in your Uniform team settings."})),e("div",null,e(de,{component:oe,label:"Project ID",name:"projectId",caption:"Available to copy after generating an API key"})),e("div",null,e(de,{component:oe,label:"API Host",name:"apiHost",caption:"Use a non-standard Uniform API endpoint. Most people will not not need this option."})),e("section",{css:{display:"flex",gap:"var(--spacing-sm)"}},e(q,{type:"submit",buttonType:"primary",disabled:i},i?"Verifying...":"Connect"),e(q,{type:"button",buttonType:"ghost",onClick:()=>t("qc"),disabled:i},"Use Quick Connect")))))))}var Je=({settings:t,saveSettings:r})=>{let n=t.apiKey&&t.projectId?{apiKey:t.apiKey,projectId:t.projectId,apiHost:t.apiHost}:void 0;return e("article",{css:f.page},e("h1",{css:f.title},"Connect to a Uniform Project"),e("p",{css:f.text},e("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.")),e(Ye,{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 io=Xe`
698
421
  background: var(--white);
699
422
  padding: var(--spacing-base);
700
423
  overflow-y: auto;
@@ -723,23 +446,16 @@ summary {
723
446
  &::-webkit-scrollbar-thumb:hover {
724
447
  background: var(--gray-500);
725
448
  }
726
- `;function kt(e){let r=typeof chrome!="undefined"&&typeof chrome.storage!="undefined",n=Tt(e.settings,e.state.manifest),o={...e,dimensionIndex:n},a=()=>{var i;switch((i=e.settings)==null?void 0:i.route){case void 0:case"/":case"/dimensions":return t(ft,{...o});case"/quirks":return t(bt,{...o});case"/settings":return t(wt,{...o});default:return t(nt,null)}};return t(m.Fragment,null,t(Y,null),t("div",{css:[ot`
727
- display: grid;
728
- grid-template-columns: 200px auto;
729
- font-weight: var(--font-regular);
730
- font-size: var(--base-font-size);
731
- font-family: var(--base-font-family);
732
- line-height: var(--base-line-height);
733
- height: var(--min-height);
734
- min-width: var(--site-width);
735
- `,r?void 0:ot`
736
- box-shadow: var(--shadow-base);
737
- position: fixed;
738
- bottom: 82px;
739
- right: var(--spacing-base);
740
- z-index: var(--z-10);
741
- max-width: var(--site-width);
742
- `]},t(rt,{...e}),t("main",{css:Qt},t(et,{...e}),a())))}import{Context as Xt,createDebugConsoleLogDrain as Yt}from"@uniformdev/context";import*as L from"react";function xt({context:e,initialSettings:r}){let n=e!=null?e:typeof window!="undefined"?window.__UNIFORM_DEVTOOLS_CONTEXT_INSTANCE__:void 0,o=n!=null?n:new Xt({manifest:{project:{}}}),[a,i]=L.useState({data:o.storage.data,manifest:o.manifest.data,scores:o.scores,personalizations:[],tests:[]}),[u,b]=L.useState(r!=null?r:{});L.useEffect(()=>{var d;let p=Yt((d=u.logLevel)!=null?d:"none");return o.events.on("log",p),()=>{o.events.off("log",p)}},[u,o]),L.useEffect(()=>{let p=()=>{i(v=>({...v,scores:o.scores,data:o.storage.data,manifest:o.manifest.data}))},d=v=>{!v.changed||i(f=>({...f,personalizations:[...f.personalizations,v]}))},h=v=>{!v.variantAssigned||i(f=>({...f,tests:[...f.tests,v]}))};return o.events.on("personalizationResult",d),o.events.on("testResult",h),o.storage.events.on("*",p),()=>{o.storage.events.off("*",p),o.events.off("personalizationResult",d),o.events.off("testResult",h)}},[o,u]);let l=L.useMemo(()=>({update:d=>o.update(d),forget:()=>o.forget(!1),rawUpdate:d=>o.storage.updateData(d)}),[o]);return n?t(kt,{state:a,actions:l,settings:u,saveSettings:b}):t("p",null,"Unable to find Uniform Context. Ensure the devtools plugin is activated.")}import*as Rt from"react";import{css as Jt}from"@emotion/react";var jt=Jt`
449
+ `;function je(t){let r=$e(t.settings,t.state.manifest),n=Ke(t.settings,t.state.data.quirks),o={...t,dimensionIndex:r,quirksIndex:n},s=()=>{var a;if(r.loading||n.loading)return e(We,null);if(t.settings.route&&t.settings.route.match(/overrides\/\w+/))return e(ae,{...o});switch((a=t.settings)==null?void 0:a.route){case void 0:case"/":case"/dimensions":return e(Oe,{...o});case"/overrides":return e(Ve,{...o});case"/overrides/add":return e(ae,{...o});case"/quirks":return e(Ne,{...o});case"/settings":return e(ze,{...o});case"/connect":return e(Je,{...o});default:return e(ve,null)}};return e(ue,{settings:t.settings,saveSettings:t.saveSettings},e(no,null),e(re,null),e("div",{css:Xe`
450
+ display: grid;
451
+ grid-template-columns: 200px auto;
452
+ font-weight: var(--fs-base);
453
+ font-size: var(--base-font-size);
454
+ font-family: var(--base-font-family);
455
+ line-height: var(--base-line-height);
456
+ height: var(--min-height);
457
+ min-width: var(--site-width);
458
+ `},e(ge,{...t}),e("main",{css:io},e(ce,{...t}),s())))}import{Context as so,createDebugConsoleLogDrain as ao}from"@uniformdev/context";import*as L from"react";var le="embeddedUniformDevToolsSettings";function et({context:t,initialSettings:r}){let n=t!=null?t:typeof window!="undefined"?window.__UNIFORM_DEVTOOLS_CONTEXT_INSTANCE__:void 0,o=n!=null?n:new so({manifest:{project:{}}}),[s,a]=L.useState({data:o.storage.data,manifest:o.manifest.data,scores:o.scores,personalizations:[],tests:[]}),[l,p]=L.useState(r!=null?r:{});L.useEffect(()=>{var d;let i=ao((d=l.logLevel)!=null?d:"none");return o.events.on("log",i),()=>{o.events.off("log",i)}},[l,o]),L.useEffect(()=>{let i=()=>{let g=window.localStorage.getItem(le)||"{}",v=JSON.parse(g),b=te({quirks:o.storage.data.quirks,quirkOverrides:v.quirkOverrides});b&&(console.log("Applying overridden quirks:",b),o.update({quirks:b}));let y=F({scores:o.scores,scoreOverrides:v.scoreOverrides});y.length&&(console.log("Applying overridden scores:",y),o.storage.updateData(y)),a(C=>({...C,scores:o.scores,data:o.storage.data,manifest:o.manifest.data}))},d=g=>{!g.changed||a(v=>({...v,personalizations:[...v.personalizations,g]}))},c=g=>{!g.variantAssigned||a(v=>({...v,tests:[...v.tests,g]}))};return o.events.on("personalizationResult",d),o.events.on("testResult",c),o.storage.events.on("*",i),()=>{o.storage.events.off("*",i),o.events.off("personalizationResult",d),o.events.off("testResult",c)}},[o]),L.useEffect(()=>{if(window.localStorage){let i=window.localStorage.getItem(le);if(i)try{let d=JSON.parse(i),c={...r,...d};p(c);let g=F({scores:s.scores,scoreOverrides:c.scoreOverrides});m.rawUpdate(g)}catch(d){window.localStorage.removeItem(le),console.error("Failed to parse settings from localStorage: ",d.message)}}},[]);let{actions:m,saveSettings:u}=L.useMemo(()=>({actions:{update:c=>o.update(c),forget:()=>o.forget(!1),rawUpdate:c=>o.storage.updateData(c)},saveSettings:async c=>{p(c),window.localStorage&&window.localStorage.setItem("embeddedUniformDevToolsSettings",JSON.stringify(c))}}),[o]);return n?e(je,{state:s,actions:m,settings:l,saveSettings:u}):e("p",null,"Unable to find Uniform Context. Ensure the devtools plugin is activated.")}import{css as po}from"@emotion/react";import*as N from"react";import{Theme as mo}from"@uniformdev/design-system";import{css as co}from"@emotion/react";var lo=co`
743
459
  align-items: center;
744
460
  border-radius: var(--rounded-full);
745
461
  background: var(--brand-secondary-5);
@@ -765,4 +481,11 @@ summary {
765
481
  max-width: 100%;
766
482
  height: auto;
767
483
  }
768
- `,Dt=({...e})=>t("button",{type:"button",css:jt,...e},t("span",{hidden:!0},"Uniform devtools"),t("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t("path",{d:"M13.325 3.05011L8.66741 20.4323L10.5993 20.9499L15.2568 3.56775L13.325 3.05011Z",fill:"currentColor"}),t("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"}),t("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 Eo(e){var a;let[r,n]=Rt.useState(!1);return((a=e.context)!=null?a:typeof window!="undefined"?window.__UNIFORM_DEVTOOLS_CONTEXT_INSTANCE__:void 0)?t("div",null,t(Y,null),t(Dt,{onClick:()=>n(i=>!i)}),r?t(xt,{...e}):null):t("p",null,"Unable to find Uniform Context. Ensure the devtools plugin is activated.")}export{kt as ContextDevTools,xt as EmbeddedContextDevTools,Eo as ToggleEmbeddedContextDevTools};
484
+ `,tt=({...t})=>e("button",{type:"button",css:lo,...t},e("span",{hidden:!0},"Uniform devtools"),e("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e("path",{d:"M13.325 3.05011L8.66741 20.4323L10.5993 20.9499L15.2568 3.56775L13.325 3.05011Z",fill:"currentColor"}),e("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"}),e("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 fi(t){let[r,n]=N.useState(!1),[o,s]=N.useState(t.context);return N.useEffect(()=>{!t.context&&typeof document!="undefined"&&s(window.__UNIFORM_DEVTOOLS_CONTEXT_INSTANCE__)},[t.context]),o?e("div",null,e(mo,null),e(re,null),e(tt,{onClick:()=>n(a=>!a)}),r?e("div",{css:po`
485
+ box-shadow: var(--shadow-base);
486
+ position: fixed;
487
+ bottom: 82px;
488
+ right: var(--spacing-base);
489
+ z-index: var(--z-10);
490
+ max-width: var(--site-width);
491
+ `},e(et,{...t})):null):e("p",null,"Unable to find Uniform Context. Ensure the devtools plugin is activated.")}export{je as ContextDevTools,et as EmbeddedContextDevTools,fi as ToggleEmbeddedContextDevTools};