@uniformdev/context-ui 19.62.0 → 19.62.1-alpha.127

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/index.esm.js CHANGED
@@ -2,18 +2,188 @@
2
2
  import { jsx } from "@emotion/react";
3
3
  import * as React from "react";
4
4
 
5
+ // src/components/AbTestSelector/AbTestSelector.tsx
6
+ import { css } from "@emotion/react";
7
+ import {
8
+ AddListButton,
9
+ Button,
10
+ Callout,
11
+ Heading,
12
+ Link,
13
+ LoadingIndicator,
14
+ ScrollableList,
15
+ ScrollableListItem
16
+ } from "@uniformdev/design-system";
17
+ import { useState as useState2 } from "react";
18
+
19
+ // src/hooks/useABTests.ts
20
+ import { ApiClientError, CachedTestClient } from "@uniformdev/context/api";
21
+ import { useEffect, useState } from "react";
22
+ function useABTests({ apiHost, apiKey, projectId }) {
23
+ const [reload, setReload] = useState(true);
24
+ const [state, setState] = useState({
25
+ loading: false,
26
+ notConfigured: false,
27
+ error: null,
28
+ result: null
29
+ });
30
+ useEffect(() => {
31
+ if (!projectId || !apiKey || !apiHost) {
32
+ setState({ notConfigured: true, loading: false, error: null, result: null });
33
+ return;
34
+ }
35
+ const runEffect = async () => {
36
+ setState({ notConfigured: false, loading: true, error: null, result: null });
37
+ try {
38
+ const client = new CachedTestClient({
39
+ projectId,
40
+ apiKey,
41
+ apiHost
42
+ });
43
+ const { tests } = await client.get();
44
+ setState({ notConfigured: false, loading: false, error: null, result: tests });
45
+ } catch (e) {
46
+ let message;
47
+ if (e instanceof ApiClientError) {
48
+ message = e.message;
49
+ } else {
50
+ message = e.toString();
51
+ }
52
+ setState({ notConfigured: false, loading: false, error: message, result: null });
53
+ return;
54
+ }
55
+ };
56
+ if (reload) {
57
+ runEffect().then(() => {
58
+ setReload(false);
59
+ });
60
+ }
61
+ }, [apiHost, apiKey, projectId, reload]);
62
+ return {
63
+ result: state.result,
64
+ error: state.error,
65
+ loading: state.loading,
66
+ notConfigured: state.notConfigured,
67
+ doReload: () => setReload(true)
68
+ };
69
+ }
70
+
71
+ // src/components/AbTestSelector/AbTestSelector.tsx
72
+ import { Fragment, jsx as jsx2, jsxs } from "@emotion/react/jsx-runtime";
73
+ var addAbTestLink = css`
74
+ flex: 2;
75
+ display: flex;
76
+ width: 50%;
77
+ align-items: center;
78
+ font-weight: var(--fw-bold);
79
+ color: var(--brand-primary-1);
80
+ &:hover,
81
+ &:focus {
82
+ text-decoration-line: underline;
83
+ }
84
+ `;
85
+ var AbTestList = ({ contextConfig, onSelect, value }) => {
86
+ const { loading, result, doReload = () => {
87
+ } } = useABTests(contextConfig);
88
+ if (loading) {
89
+ return /* @__PURE__ */ jsx2(LoadingIndicator, {});
90
+ }
91
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
92
+ /* @__PURE__ */ jsx2("div", { children: /* @__PURE__ */ jsx2(Link, { text: "Refresh A/B Test list", style: { marginRight: "10px" }, onClick: () => doReload() }) }),
93
+ !result || result.length === 0 ? /* @__PURE__ */ jsx2(NoAbTestsView, { contextConfig }) : /* @__PURE__ */ jsxs("div", { style: { marginTop: "10px" }, children: [
94
+ /* @__PURE__ */ jsx2(ScrollableList, { children: result.map((abTest) => {
95
+ const { id, name } = abTest;
96
+ return /* @__PURE__ */ jsx2(
97
+ ScrollableListItem,
98
+ {
99
+ buttonText: name,
100
+ active: id === (value == null ? void 0 : value.id),
101
+ onClick: () => onSelect(abTest)
102
+ },
103
+ id
104
+ );
105
+ }) }),
106
+ /* @__PURE__ */ jsx2(
107
+ AddListButton,
108
+ {
109
+ className: "add-more",
110
+ onButtonClick: () => {
111
+ window.open(
112
+ `${contextConfig.apiHost}/projects/${encodeURIComponent(contextConfig.projectId)}/testing`,
113
+ "_blank"
114
+ );
115
+ },
116
+ buttonText: "Add new A/B Test"
117
+ }
118
+ )
119
+ ] })
120
+ ] });
121
+ };
122
+ var AbTestSelector = ({ value, setValue, contextConfig, loading }) => {
123
+ var _a;
124
+ const [showAbTests, setShowAbTests] = useState2(false);
125
+ if (loading) {
126
+ return /* @__PURE__ */ jsx2(LoadingIndicator, {});
127
+ }
128
+ return /* @__PURE__ */ jsx2("fieldset", { className: "ab-test", children: /* @__PURE__ */ jsxs("div", { children: [
129
+ !showAbTests && /* @__PURE__ */ jsxs("div", { children: [
130
+ value && Object.keys(value).length > 0 && /* @__PURE__ */ jsx2(Heading, { level: 4, style: { marginBottom: "10px" }, children: (_a = value == null ? void 0 : value.name) != null ? _a : "Unknown test" }),
131
+ /* @__PURE__ */ jsx2(Button, { buttonType: "primary", style: { marginRight: "10px" }, onClick: () => setShowAbTests(true), children: "Select A/B Test" })
132
+ ] }),
133
+ showAbTests && /* @__PURE__ */ jsx2(
134
+ AbTestList,
135
+ {
136
+ contextConfig,
137
+ onSelect: (abTest) => {
138
+ if ((value == null ? void 0 : value.id) === abTest.id) {
139
+ setValue(void 0);
140
+ setShowAbTests(true);
141
+ return;
142
+ }
143
+ setValue(abTest);
144
+ setShowAbTests(false);
145
+ },
146
+ value
147
+ }
148
+ )
149
+ ] }) });
150
+ };
151
+ var NoAbTestsView = ({ contextConfig }) => /* @__PURE__ */ jsx2(
152
+ Callout,
153
+ {
154
+ title: "No A/B tests found in your Uniform project.",
155
+ type: "caution",
156
+ css: { marginBlock: "var(--spacing-base)" },
157
+ children: /* @__PURE__ */ jsxs("p", { children: [
158
+ "Looks like you do not have any A/B tests created in your connected Uniform project. Start by creating your first test",
159
+ " ",
160
+ /* @__PURE__ */ jsx2(
161
+ "a",
162
+ {
163
+ href: `${contextConfig.apiHost}/projects/${encodeURIComponent(contextConfig.projectId)}/testing`,
164
+ target: "_blank",
165
+ rel: "noopener noreferrer",
166
+ css: { ":hover": { textDecorationLine: "underline" } },
167
+ children: "here"
168
+ }
169
+ ),
170
+ "."
171
+ ] })
172
+ }
173
+ );
174
+
5
175
  // src/components/CriteriaOperatorMenu/CriteriaOperatorMenu.tsx
6
176
  import { InputComboBox } from "@uniformdev/design-system";
7
177
 
8
178
  // src/components/CriteriaOperatorMenu/OperatorBubble.tsx
9
- import { css } from "@emotion/react";
10
- import { jsx as jsx2 } from "@emotion/react/jsx-runtime";
179
+ import { css as css2 } from "@emotion/react";
180
+ import { jsx as jsx3 } from "@emotion/react/jsx-runtime";
11
181
  function OperatorBubble({ op }) {
12
- return /* @__PURE__ */ jsx2(
182
+ return /* @__PURE__ */ jsx3(
13
183
  "div",
14
184
  {
15
185
  className: "operation-bubble",
16
- css: css`
186
+ css: css2`
17
187
  align-items: center;
18
188
  background: var(--gray-700);
19
189
  border-radius: var(--rounded-full);
@@ -30,12 +200,12 @@ function OperatorBubble({ op }) {
30
200
  }
31
201
 
32
202
  // src/components/CriteriaOperatorMenu/CriteriaOperatorOption.tsx
33
- import { jsx as jsx3, jsxs } from "@emotion/react/jsx-runtime";
203
+ import { jsx as jsx4, jsxs as jsxs2 } from "@emotion/react/jsx-runtime";
34
204
  var CriteriaOperatorOption = (props) => {
35
205
  var _a, _b;
36
206
  const { data, getStyles, isDisabled, innerRef, innerProps } = props;
37
207
  const [name, description] = (_b = (_a = data.label) == null ? void 0 : _a.split(":")) != null ? _b : [];
38
- return /* @__PURE__ */ jsxs(
208
+ return /* @__PURE__ */ jsxs2(
39
209
  "div",
40
210
  {
41
211
  css: {
@@ -48,7 +218,7 @@ var CriteriaOperatorOption = (props) => {
48
218
  "aria-disabled": isDisabled,
49
219
  ...innerProps,
50
220
  children: [
51
- description ? /* @__PURE__ */ jsx3(OperatorBubble, { op: name }) : /* @__PURE__ */ jsx3(
221
+ description ? /* @__PURE__ */ jsx4(OperatorBubble, { op: name }) : /* @__PURE__ */ jsx4(
52
222
  "div",
53
223
  {
54
224
  css: {
@@ -57,30 +227,30 @@ var CriteriaOperatorOption = (props) => {
57
227
  }
58
228
  }
59
229
  ),
60
- /* @__PURE__ */ jsx3("div", { children: description != null ? description : name })
230
+ /* @__PURE__ */ jsx4("div", { children: description != null ? description : name })
61
231
  ]
62
232
  }
63
233
  );
64
234
  };
65
235
 
66
236
  // src/components/CriteriaOperatorMenu/CriteriaOperatorSingleValue.tsx
67
- import { jsx as jsx4 } from "@emotion/react/jsx-runtime";
237
+ import { jsx as jsx5 } from "@emotion/react/jsx-runtime";
68
238
  var CriteriaOperatorSingleValue = (props) => {
69
239
  const { data, getStyles } = props;
70
- return /* @__PURE__ */ jsx4(
240
+ return /* @__PURE__ */ jsx5(
71
241
  "div",
72
242
  {
73
243
  css: {
74
244
  ...getStyles("singleValue", props),
75
245
  width: "max-content"
76
246
  },
77
- children: data.label.length === 1 ? /* @__PURE__ */ jsx4(OperatorBubble, { op: data.label }) : data.label
247
+ children: data.label.length === 1 ? /* @__PURE__ */ jsx5(OperatorBubble, { op: data.label }) : data.label
78
248
  }
79
249
  );
80
250
  };
81
251
 
82
252
  // src/components/CriteriaOperatorMenu/CriteriaOperatorMenu.tsx
83
- import { jsx as jsx5 } from "@emotion/react/jsx-runtime";
253
+ import { jsx as jsx6 } from "@emotion/react/jsx-runtime";
84
254
  var contextCriteriaMenuOperators = [
85
255
  {
86
256
  name: "=",
@@ -113,17 +283,21 @@ var contextCriteriaMenuOperators = [
113
283
  value: "<="
114
284
  },
115
285
  {
116
- name: "has the strongest score",
286
+ name: "has strongest score across all categories",
117
287
  value: "+"
118
288
  },
119
289
  {
120
290
  name: "has the weakest score",
121
291
  value: "-"
292
+ },
293
+ {
294
+ name: "has strongest category score",
295
+ value: "^"
122
296
  }
123
297
  ];
124
298
  function CriteriaOperatorMenu({ onChange, value, ...props }) {
125
299
  var _a, _b;
126
- return /* @__PURE__ */ jsx5(
300
+ return /* @__PURE__ */ jsx6(
127
301
  InputComboBox,
128
302
  {
129
303
  ...props,
@@ -185,20 +359,20 @@ function CriteriaOperatorMenu({ onChange, value, ...props }) {
185
359
  }
186
360
 
187
361
  // src/components/DataContext/DataContext.tsx
188
- import { LoadingIndicator } from "@uniformdev/design-system";
362
+ import { LoadingIndicator as LoadingIndicator2 } from "@uniformdev/design-system";
189
363
  import { createContext, useContext } from "react";
190
364
 
191
365
  // src/hooks/useContextData.ts
192
- import { ApiClientError, CachedManifestClient } from "@uniformdev/context/api";
193
- import { useEffect, useState } from "react";
366
+ import { ApiClientError as ApiClientError2, CachedManifestClient } from "@uniformdev/context/api";
367
+ import { useEffect as useEffect2, useState as useState3 } from "react";
194
368
  function useContextData({ apiHost, apiKey, projectId }) {
195
- const [state, setState] = useState({
369
+ const [state, setState] = useState3({
196
370
  loading: false,
197
371
  notConfigured: false,
198
372
  error: null,
199
373
  result: null
200
374
  });
201
- useEffect(() => {
375
+ useEffect2(() => {
202
376
  if (!projectId || !apiKey || !apiHost) {
203
377
  setState({ notConfigured: true, loading: false, error: null, result: null });
204
378
  return;
@@ -215,7 +389,7 @@ function useContextData({ apiHost, apiKey, projectId }) {
215
389
  setState({ notConfigured: false, loading: false, error: null, result });
216
390
  } catch (e) {
217
391
  let message;
218
- if (e instanceof ApiClientError) {
392
+ if (e instanceof ApiClientError2) {
219
393
  if (e.statusCode === 403) {
220
394
  message = `The API key ${apiKey} did not have permissions to fetch the manifest. Ensure Context > Read Drafts permissions are granted.`;
221
395
  }
@@ -238,8 +412,8 @@ function useContextData({ apiHost, apiKey, projectId }) {
238
412
  }
239
413
 
240
414
  // src/hooks/useDimensions.ts
241
- import { ApiClientError as ApiClientError2, CachedDimensionClient, computeDimensionDisplayName } from "@uniformdev/context/api";
242
- import { useEffect as useEffect2, useState as useState2 } from "react";
415
+ import { ApiClientError as ApiClientError3, CachedDimensionClient, computeDimensionDisplayName } from "@uniformdev/context/api";
416
+ import { useEffect as useEffect3, useState as useState4 } from "react";
243
417
 
244
418
  // src/utils/objectify.ts
245
419
  function objectify(array2, keySelector, valueSelector) {
@@ -255,13 +429,13 @@ function objectify(array2, keySelector, valueSelector) {
255
429
 
256
430
  // src/hooks/useDimensions.ts
257
431
  function useDimensions({ apiHost, apiKey, projectId }) {
258
- const [state, setState] = useState2({
432
+ const [state, setState] = useState4({
259
433
  loading: false,
260
434
  notConfigured: false,
261
435
  error: null,
262
436
  result: null
263
437
  });
264
- useEffect2(() => {
438
+ useEffect3(() => {
265
439
  if (!projectId || !apiKey || !apiHost) {
266
440
  setState({ notConfigured: true, loading: false, error: null, result: null });
267
441
  return;
@@ -289,7 +463,7 @@ function useDimensions({ apiHost, apiKey, projectId }) {
289
463
  setState({ notConfigured: false, loading: false, error: null, result });
290
464
  } catch (e) {
291
465
  let message;
292
- if (e instanceof ApiClientError2) {
466
+ if (e instanceof ApiClientError3) {
293
467
  message = e.message;
294
468
  } else {
295
469
  message = e.toString();
@@ -309,7 +483,7 @@ function useDimensions({ apiHost, apiKey, projectId }) {
309
483
  }
310
484
 
311
485
  // src/components/DataContext/DataContext.tsx
312
- import { Fragment, jsx as jsx6 } from "@emotion/react/jsx-runtime";
486
+ import { Fragment as Fragment2, jsx as jsx7 } from "@emotion/react/jsx-runtime";
313
487
  var ContextDataContext = createContext(null);
314
488
  var ContextData = ({
315
489
  loadingComponent: LoadingComponent,
@@ -321,23 +495,23 @@ var ContextData = ({
321
495
  const dimensionsData = useDimensions(contextConfig);
322
496
  if (contextData.error || contextData.notConfigured) {
323
497
  if (ErrorComponent)
324
- return /* @__PURE__ */ jsx6(ErrorComponent, { contextConfig, result: contextData });
498
+ return /* @__PURE__ */ jsx7(ErrorComponent, { contextConfig, result: contextData });
325
499
  else
326
- return /* @__PURE__ */ jsx6(Fragment, { children: "ErrorComponent is not configured" });
500
+ return /* @__PURE__ */ jsx7(Fragment2, { children: "ErrorComponent is not configured" });
327
501
  }
328
502
  if (dimensionsData.error || dimensionsData.notConfigured) {
329
503
  if (ErrorComponent)
330
- return /* @__PURE__ */ jsx6(ErrorComponent, { contextConfig, result: dimensionsData });
504
+ return /* @__PURE__ */ jsx7(ErrorComponent, { contextConfig, result: dimensionsData });
331
505
  else
332
- return /* @__PURE__ */ jsx6(Fragment, { children: "ErrorComponent is not configured" });
506
+ return /* @__PURE__ */ jsx7(Fragment2, { children: "ErrorComponent is not configured" });
333
507
  }
334
508
  if (contextData.loading || dimensionsData.loading) {
335
509
  if (LoadingComponent)
336
- return /* @__PURE__ */ jsx6(LoadingComponent, {});
510
+ return /* @__PURE__ */ jsx7(LoadingComponent, {});
337
511
  else
338
- return /* @__PURE__ */ jsx6(LoadingIndicator, {});
512
+ return /* @__PURE__ */ jsx7(LoadingIndicator2, {});
339
513
  }
340
- return /* @__PURE__ */ jsx6(
514
+ return /* @__PURE__ */ jsx7(
341
515
  ContextDataContext.Provider,
342
516
  {
343
517
  value: { manifest: contextData.result, dimensions: dimensionsData.result, contextConfig },
@@ -369,7 +543,7 @@ function useDimensionsDataContext() {
369
543
 
370
544
  // src/components/DimensionMenu/CriteriaMatchMenu.tsx
371
545
  import { InputComboBox as InputComboBox3 } from "@uniformdev/design-system";
372
- import { useState as useState3 } from "react";
546
+ import { useState as useState5 } from "react";
373
547
 
374
548
  // src/components/DimensionMenu/DimensionGroupHeading.tsx
375
549
  import { Icon } from "@uniformdev/design-system";
@@ -413,11 +587,11 @@ function groupDimensions(dimensions) {
413
587
  }
414
588
 
415
589
  // src/components/DimensionMenu/DimensionGroupHeading.tsx
416
- import { jsx as jsx7, jsxs as jsxs2 } from "@emotion/react/jsx-runtime";
590
+ import { jsx as jsx8, jsxs as jsxs3 } from "@emotion/react/jsx-runtime";
417
591
  var DimensionGroupHeading = (props) => {
418
592
  var _a;
419
593
  const { data, getStyles, className } = props;
420
- return /* @__PURE__ */ jsx7(
594
+ return /* @__PURE__ */ jsx8(
421
595
  "div",
422
596
  {
423
597
  css: {
@@ -426,13 +600,13 @@ var DimensionGroupHeading = (props) => {
426
600
  fontSize: "var(--font-size-sm)"
427
601
  },
428
602
  className,
429
- children: /* @__PURE__ */ jsxs2(
603
+ children: /* @__PURE__ */ jsxs3(
430
604
  "small",
431
605
  {
432
606
  css: { color: "var(--gray-500)", display: "flex", alignItems: "center", gap: "var(--spacing-xs)" },
433
607
  children: [
434
- /* @__PURE__ */ jsx7(Icon, { icon: dimensionIcon((_a = data.label) != null ? _a : ""), iconColor: "currentColor", size: 16 }),
435
- /* @__PURE__ */ jsx7("span", { children: data.label })
608
+ /* @__PURE__ */ jsx8(Icon, { icon: dimensionIcon((_a = data.label) != null ? _a : ""), iconColor: "currentColor", size: 16 }),
609
+ /* @__PURE__ */ jsx8("span", { children: data.label })
436
610
  ]
437
611
  }
438
612
  )
@@ -441,15 +615,15 @@ var DimensionGroupHeading = (props) => {
441
615
  };
442
616
 
443
617
  // src/components/DimensionMenu/DimensionMenuErrorMessage.tsx
444
- import { css as css2 } from "@emotion/react";
445
- import { jsx as jsx8 } from "@emotion/react/jsx-runtime";
618
+ import { css as css3 } from "@emotion/react";
619
+ import { jsx as jsx9 } from "@emotion/react/jsx-runtime";
446
620
  function DimensionMenuErrorMessage({ message }) {
447
621
  if (!message)
448
622
  return null;
449
- return /* @__PURE__ */ jsx8(
623
+ return /* @__PURE__ */ jsx9(
450
624
  "div",
451
625
  {
452
- css: css2`
626
+ css: css3`
453
627
  color: var(--brand-primary-2);
454
628
  font-size: var(--fs-xs);
455
629
  position: absolute;
@@ -461,12 +635,12 @@ function DimensionMenuErrorMessage({ message }) {
461
635
  }
462
636
 
463
637
  // src/components/DimensionMenu/DimensionOption.tsx
464
- import { jsx as jsx9 } from "@emotion/react/jsx-runtime";
638
+ import { jsx as jsx10 } from "@emotion/react/jsx-runtime";
465
639
  var DimensionOption = (props) => {
466
640
  var _a, _b;
467
641
  const { data, getStyles, cx, isDisabled, isFocused, isSelected, className, innerRef, innerProps } = props;
468
642
  const [, value] = (_b = (_a = data.label) == null ? void 0 : _a.split(":")) != null ? _b : [];
469
- return /* @__PURE__ */ jsx9(
643
+ return /* @__PURE__ */ jsx10(
470
644
  "div",
471
645
  {
472
646
  css: getStyles("option", props),
@@ -482,17 +656,17 @@ var DimensionOption = (props) => {
482
656
  ref: innerRef,
483
657
  "aria-disabled": isDisabled,
484
658
  ...innerProps,
485
- children: /* @__PURE__ */ jsx9("div", { css: { color: "var(--gray-700)" }, children: value != null ? value : data.label })
659
+ children: /* @__PURE__ */ jsx10("div", { css: { color: "var(--gray-700)" }, children: value != null ? value : data.label })
486
660
  }
487
661
  );
488
662
  };
489
663
 
490
664
  // src/components/DimensionMenu/DimensionValue.tsx
491
665
  import { Icon as Icon2 } from "@uniformdev/design-system";
492
- import { jsx as jsx10, jsxs as jsxs3 } from "@emotion/react/jsx-runtime";
666
+ import { jsx as jsx11, jsxs as jsxs4 } from "@emotion/react/jsx-runtime";
493
667
  function DimensionValue({ displayName }) {
494
668
  const [type, name] = displayName.split(":");
495
- return /* @__PURE__ */ jsxs3(
669
+ return /* @__PURE__ */ jsxs4(
496
670
  "div",
497
671
  {
498
672
  css: {
@@ -500,31 +674,31 @@ function DimensionValue({ displayName }) {
500
674
  overflow: "hidden"
501
675
  },
502
676
  children: [
503
- name ? /* @__PURE__ */ jsxs3(
677
+ name ? /* @__PURE__ */ jsxs4(
504
678
  "small",
505
679
  {
506
680
  css: { color: "var(--gray-500)", display: "flex", alignItems: "center", gap: "var(--spacing-xs)" },
507
681
  children: [
508
- type ? /* @__PURE__ */ jsx10(Icon2, { icon: dimensionIcon(type), iconColor: "currentColor", size: 16 }) : null,
509
- /* @__PURE__ */ jsx10("span", { "data-testid": "dimension-name", children: type })
682
+ type ? /* @__PURE__ */ jsx11(Icon2, { icon: dimensionIcon(type), iconColor: "currentColor", size: 16 }) : null,
683
+ /* @__PURE__ */ jsx11("span", { "data-testid": "dimension-name", children: type })
510
684
  ]
511
685
  }
512
686
  ) : null,
513
- /* @__PURE__ */ jsx10("div", { css: { color: "var(--gray-700)" }, "data-testid": "dimension-value", children: name != null ? name : type })
687
+ /* @__PURE__ */ jsx11("div", { css: { color: "var(--gray-700)" }, "data-testid": "dimension-value", children: name != null ? name : type })
514
688
  ]
515
689
  }
516
690
  );
517
691
  }
518
692
 
519
693
  // src/components/DimensionMenu/DimensionSingleValue.tsx
520
- import { jsx as jsx11 } from "@emotion/react/jsx-runtime";
694
+ import { jsx as jsx12 } from "@emotion/react/jsx-runtime";
521
695
  var DimensionSingleValue = (props) => {
522
696
  const { data, getStyles } = props;
523
- return /* @__PURE__ */ jsx11("div", { css: getStyles("singleValue", props), children: /* @__PURE__ */ jsx11(DimensionValue, { displayName: data.label }) });
697
+ return /* @__PURE__ */ jsx12("div", { css: getStyles("singleValue", props), children: /* @__PURE__ */ jsx12(DimensionValue, { displayName: data.label }) });
524
698
  };
525
699
 
526
700
  // src/components/DimensionMenu/CriteriaMatchMenu.tsx
527
- import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs4 } from "@emotion/react/jsx-runtime";
701
+ import { Fragment as Fragment3, jsx as jsx13, jsxs as jsxs5 } from "@emotion/react/jsx-runtime";
528
702
  function CriteriaMatchMenu({
529
703
  onChange,
530
704
  criteriaMatch,
@@ -533,13 +707,13 @@ function CriteriaMatchMenu({
533
707
  ...props
534
708
  }) {
535
709
  var _a, _b;
536
- const [inputValue, setInputValue] = useState3(
710
+ const [inputValue, setInputValue] = useState5(
537
711
  typeof criteriaMatch.r !== "undefined" && isInt(criteriaMatch.r) !== null ? criteriaMatch.r.toString(10) : ""
538
712
  );
539
713
  const rDim = criteriaMatch.rDim;
540
714
  const targetDim = criteriaMatch.rDim ? dimensions.dimIndex[criteriaMatch.rDim] : void 0;
541
- return /* @__PURE__ */ jsxs4(Fragment2, { children: [
542
- /* @__PURE__ */ jsx12(
715
+ return /* @__PURE__ */ jsxs5(Fragment3, { children: [
716
+ /* @__PURE__ */ jsx13(
543
717
  InputComboBox3,
544
718
  {
545
719
  ...props,
@@ -606,26 +780,26 @@ function CriteriaMatchMenu({
606
780
  },
607
781
  noOptionsMessage: ({ inputValue: inputValue2 }) => {
608
782
  if (isInt(inputValue2)) {
609
- return /* @__PURE__ */ jsxs4(Fragment2, { children: [
610
- /* @__PURE__ */ jsxs4("div", { children: [
783
+ return /* @__PURE__ */ jsxs5(Fragment3, { children: [
784
+ /* @__PURE__ */ jsxs5("div", { children: [
611
785
  "Score: ",
612
786
  inputValue2
613
787
  ] }),
614
- /* @__PURE__ */ jsx12("small", { children: "If you want to match on another dimension\u2019s score instead, clear the score value to search for a dimension." })
788
+ /* @__PURE__ */ jsx13("small", { children: "If you want to match on another dimension\u2019s score instead, clear the score value to search for a dimension." })
615
789
  ] });
616
790
  }
617
- return /* @__PURE__ */ jsxs4(Fragment2, { children: [
618
- /* @__PURE__ */ jsxs4("div", { children: [
791
+ return /* @__PURE__ */ jsxs5(Fragment3, { children: [
792
+ /* @__PURE__ */ jsxs5("div", { children: [
619
793
  "No dimensions match your search \u201C",
620
794
  inputValue2,
621
795
  "\u201D"
622
796
  ] }),
623
- /* @__PURE__ */ jsx12("small", { children: "If you want to match a literal score, enter a numeric value." })
797
+ /* @__PURE__ */ jsx13("small", { children: "If you want to match a literal score, enter a numeric value." })
624
798
  ] });
625
799
  }
626
800
  }
627
801
  ),
628
- /* @__PURE__ */ jsx12(DimensionMenuErrorMessage, { message: errorMessage })
802
+ /* @__PURE__ */ jsx13(DimensionMenuErrorMessage, { message: errorMessage })
629
803
  ] });
630
804
  }
631
805
  function isInt(value) {
@@ -634,10 +808,10 @@ function isInt(value) {
634
808
 
635
809
  // src/components/DimensionMenu/DimensionMenu.tsx
636
810
  import { InputComboBox as InputComboBox4 } from "@uniformdev/design-system";
637
- import { Fragment as Fragment3, jsx as jsx13, jsxs as jsxs5 } from "@emotion/react/jsx-runtime";
811
+ import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs6 } from "@emotion/react/jsx-runtime";
638
812
  function DimensionMenu({ onChange, value, dimensions, errorMessage, ...props }) {
639
- return /* @__PURE__ */ jsxs5(Fragment3, { children: [
640
- /* @__PURE__ */ jsx13(
813
+ return /* @__PURE__ */ jsxs6(Fragment4, { children: [
814
+ /* @__PURE__ */ jsx14(
641
815
  InputComboBox4,
642
816
  {
643
817
  ...props,
@@ -667,7 +841,7 @@ function DimensionMenu({ onChange, value, dimensions, errorMessage, ...props })
667
841
  }
668
842
  }
669
843
  ),
670
- /* @__PURE__ */ jsx13(DimensionMenuErrorMessage, { message: errorMessage })
844
+ /* @__PURE__ */ jsx14(DimensionMenuErrorMessage, { message: errorMessage })
671
845
  ] });
672
846
  }
673
847
 
@@ -676,8 +850,8 @@ import { CgChevronRight } from "@react-icons/all-files/cg/CgChevronRight";
676
850
  import { Icon as Icon3 } from "@uniformdev/design-system";
677
851
 
678
852
  // src/components/EditLink/EditLink.styles.ts
679
- import { css as css3 } from "@emotion/react";
680
- var editLink = css3`
853
+ import { css as css4 } from "@emotion/react";
854
+ var editLink = css4`
681
855
  display: flex;
682
856
  align-items: center;
683
857
  font-weight: var(--fw-bold);
@@ -691,9 +865,9 @@ var editLink = css3`
691
865
  `;
692
866
 
693
867
  // src/components/EditLink/EditLink.tsx
694
- import { jsx as jsx14, jsxs as jsxs6 } from "@emotion/react/jsx-runtime";
868
+ import { jsx as jsx15, jsxs as jsxs7 } from "@emotion/react/jsx-runtime";
695
869
  var EditLink = ({ linkTo, name, linkText = `Edit ${name} Component` }) => {
696
- return /* @__PURE__ */ jsxs6(
870
+ return /* @__PURE__ */ jsxs7(
697
871
  "a",
698
872
  {
699
873
  css: editLink,
@@ -703,31 +877,31 @@ var EditLink = ({ linkTo, name, linkText = `Edit ${name} Component` }) => {
703
877
  href: linkTo,
704
878
  children: [
705
879
  linkText,
706
- /* @__PURE__ */ jsx14(Icon3, { icon: CgChevronRight, iconColor: "currentColor", size: "1.5rem" })
880
+ /* @__PURE__ */ jsx15(Icon3, { icon: CgChevronRight, iconColor: "currentColor", size: "1.5rem" })
707
881
  ]
708
882
  }
709
883
  );
710
884
  };
711
885
 
712
886
  // src/components/EnrichmentTag/EnrichmentTag.tsx
713
- import { css as css4 } from "@emotion/react";
887
+ import { css as css5 } from "@emotion/react";
714
888
  import { CgCloseO } from "@react-icons/all-files/cg/CgCloseO";
715
889
  import { CgMathMinus } from "@react-icons/all-files/cg/CgMathMinus";
716
890
  import { CgMathPlus } from "@react-icons/all-files/cg/CgMathPlus";
717
891
  import { getEnrichmentVectorKey } from "@uniformdev/context";
718
892
  import {
719
- AddListButton,
720
- Button,
721
- Callout,
893
+ AddListButton as AddListButton2,
894
+ Button as Button2,
895
+ Callout as Callout2,
722
896
  Icon as Icon4,
723
897
  Input,
724
898
  InputSelect,
725
- LoadingIndicator as LoadingIndicator2
899
+ LoadingIndicator as LoadingIndicator3
726
900
  } from "@uniformdev/design-system";
727
- import produce from "immer";
728
- import { useMemo, useState as useState4 } from "react";
729
- import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs7 } from "@emotion/react/jsx-runtime";
730
- var addEnrichmentLink = css4`
901
+ import { produce } from "immer";
902
+ import { useMemo, useState as useState6 } from "react";
903
+ import { Fragment as Fragment5, jsx as jsx16, jsxs as jsxs8 } from "@emotion/react/jsx-runtime";
904
+ var addEnrichmentLink = css5`
731
905
  flex: 2;
732
906
  display: flex;
733
907
  width: 50%;
@@ -758,9 +932,9 @@ var EnrichmentTag = ({
758
932
  (enr) => !value.some((val) => getEnrichmentVectorKey(val.cat, val.key) === enr.dim)
759
933
  );
760
934
  }, [allEnrichments, value]);
761
- const [selectValue, setSelectValue] = useState4("");
762
- const [score, setScore] = useState4(50);
763
- const [showAddNewEnrichmentTagPanel, setShowAddNewEnrichmentTagPanel] = useState4(false);
935
+ const [selectValue, setSelectValue] = useState6("");
936
+ const [score, setScore] = useState6(50);
937
+ const [showAddNewEnrichmentTagPanel, setShowAddNewEnrichmentTagPanel] = useState6(false);
764
938
  const selectedEnrichment = allEnrichments == null ? void 0 : allEnrichments.find((dimension) => dimension.dim === selectValue);
765
939
  const addEnrichment = () => {
766
940
  const [cat, key] = selectValue.split("_");
@@ -783,21 +957,21 @@ var EnrichmentTag = ({
783
957
  setValue(finalValue);
784
958
  };
785
959
  if (error)
786
- return /* @__PURE__ */ jsx15(Callout, { type: "danger", children: error });
960
+ return /* @__PURE__ */ jsx16(Callout2, { type: "danger", children: error });
787
961
  if (loading || dimensions === null)
788
- return /* @__PURE__ */ jsx15(LoadingIndicator2, {});
789
- return /* @__PURE__ */ jsxs7("fieldset", { className: "enrichment-tag", children: [
790
- displayTitle ? /* @__PURE__ */ jsx15("div", { css: { display: "flex", justifyContent: "space-between", marginBottom: "var(--spacing-base)" }, children: /* @__PURE__ */ jsx15("legend", { css: { fontSize: "var(--fs-md)", fontWeight: "var(--fw-bold)" }, children: "Enrichment Tags" }) }) : null,
791
- !(allEnrichments == null ? void 0 : allEnrichments.length) ? /* @__PURE__ */ jsx15(NoEnrichmentsView, { contextConfig }) : !showAddNewEnrichmentTagPanel && !value ? /* @__PURE__ */ jsx15(
792
- Callout,
962
+ return /* @__PURE__ */ jsx16(LoadingIndicator3, {});
963
+ return /* @__PURE__ */ jsxs8("fieldset", { className: "enrichment-tag", children: [
964
+ displayTitle ? /* @__PURE__ */ jsx16("div", { css: { display: "flex", justifyContent: "space-between", marginBottom: "var(--spacing-base)" }, children: /* @__PURE__ */ jsx16("legend", { css: { fontSize: "var(--fs-md)", fontWeight: "var(--fw-bold)" }, children: "Enrichment Tags" }) }) : null,
965
+ !(allEnrichments == null ? void 0 : allEnrichments.length) ? /* @__PURE__ */ jsx16(NoEnrichmentsView, { contextConfig }) : !showAddNewEnrichmentTagPanel && !value ? /* @__PURE__ */ jsx16(
966
+ Callout2,
793
967
  {
794
968
  title: "No enrichment tags assigned.",
795
969
  type: "info",
796
970
  css: { marginBlock: "var(--spacing-base)" },
797
- children: /* @__PURE__ */ jsxs7("p", { children: [
971
+ children: /* @__PURE__ */ jsxs8("p", { children: [
798
972
  "Click",
799
973
  " ",
800
- /* @__PURE__ */ jsx15(
974
+ /* @__PURE__ */ jsx16(
801
975
  "a",
802
976
  {
803
977
  onClick: () => setShowAddNewEnrichmentTagPanel(true),
@@ -811,9 +985,9 @@ var EnrichmentTag = ({
811
985
  "to assign your first enrichment tag."
812
986
  ] })
813
987
  }
814
- ) : /* @__PURE__ */ jsxs7(Fragment4, { children: [
815
- dimensions && /* @__PURE__ */ jsx15(SelectedEnrichments, { list: value != null ? value : [], setList: update, dimIndex: dimensions.dimIndex }),
816
- showAddNewEnrichmentTagPanel && remainingEnrichments && remainingEnrichments.length > 0 ? /* @__PURE__ */ jsxs7(
988
+ ) : /* @__PURE__ */ jsxs8(Fragment5, { children: [
989
+ dimensions && /* @__PURE__ */ jsx16(SelectedEnrichments, { list: value != null ? value : [], setList: update, dimIndex: dimensions.dimIndex }),
990
+ showAddNewEnrichmentTagPanel && remainingEnrichments && remainingEnrichments.length > 0 ? /* @__PURE__ */ jsxs8(
817
991
  "div",
818
992
  {
819
993
  className: "add-enrichment-tag",
@@ -825,7 +999,7 @@ var EnrichmentTag = ({
825
999
  alignItems: "center"
826
1000
  },
827
1001
  children: [
828
- /* @__PURE__ */ jsx15("div", { css: { flexGrow: 1 }, children: /* @__PURE__ */ jsx15(
1002
+ /* @__PURE__ */ jsx16("div", { css: { flexGrow: 1 }, children: /* @__PURE__ */ jsx16(
829
1003
  InputSelect,
830
1004
  {
831
1005
  name: `enrichment-type`,
@@ -842,7 +1016,7 @@ var EnrichmentTag = ({
842
1016
  onChange: (e) => setSelectValue(e.currentTarget.value)
843
1017
  }
844
1018
  ) }),
845
- /* @__PURE__ */ jsx15(
1019
+ /* @__PURE__ */ jsx16(
846
1020
  ScoreCounter,
847
1021
  {
848
1022
  score,
@@ -851,8 +1025,8 @@ var EnrichmentTag = ({
851
1025
  css: { flexBasis: "9rem" }
852
1026
  }
853
1027
  ),
854
- /* @__PURE__ */ jsx15(
855
- Button,
1028
+ /* @__PURE__ */ jsx16(
1029
+ Button2,
856
1030
  {
857
1031
  buttonType: "tertiary",
858
1032
  size: "xl",
@@ -870,21 +1044,21 @@ var EnrichmentTag = ({
870
1044
  ]
871
1045
  }
872
1046
  ) : null,
873
- /* @__PURE__ */ jsxs7(
1047
+ /* @__PURE__ */ jsxs8(
874
1048
  "div",
875
1049
  {
876
1050
  className: "enrichment-cta",
877
1051
  style: { paddingTop: "10px", display: "flex", justifyContent: "space-between" },
878
1052
  children: [
879
- !showAddNewEnrichmentTagPanel && remainingEnrichments && remainingEnrichments.length > 0 && value ? /* @__PURE__ */ jsx15(
880
- AddListButton,
1053
+ !showAddNewEnrichmentTagPanel && remainingEnrichments && remainingEnrichments.length > 0 && value ? /* @__PURE__ */ jsx16(
1054
+ AddListButton2,
881
1055
  {
882
1056
  className: "add-more",
883
1057
  buttonText: "Add More",
884
1058
  onButtonClick: () => setShowAddNewEnrichmentTagPanel(true)
885
1059
  }
886
- ) : /* @__PURE__ */ jsx15("a", { css: addEnrichmentLink, title: `none`, href: "#" }),
887
- /* @__PURE__ */ jsx15(
1060
+ ) : /* @__PURE__ */ jsx16("a", { css: addEnrichmentLink, title: `none`, href: "#" }),
1061
+ /* @__PURE__ */ jsx16(
888
1062
  EditLink,
889
1063
  {
890
1064
  name: "Enrichments",
@@ -900,10 +1074,10 @@ var EnrichmentTag = ({
900
1074
  ] })
901
1075
  ] });
902
1076
  };
903
- var NoEnrichmentsView = ({ contextConfig }) => /* @__PURE__ */ jsx15(Callout, { title: "No enrichments found.", type: "caution", css: { marginBlock: "var(--spacing-base)" }, children: /* @__PURE__ */ jsxs7("p", { children: [
1077
+ var NoEnrichmentsView = ({ contextConfig }) => /* @__PURE__ */ jsx16(Callout2, { title: "No enrichments found.", type: "caution", css: { marginBlock: "var(--spacing-base)" }, children: /* @__PURE__ */ jsxs8("p", { children: [
904
1078
  "Looks like you do not have any enrichment created in your connected Uniform project. Start by creating your first enrichment",
905
1079
  " ",
906
- /* @__PURE__ */ jsx15(
1080
+ /* @__PURE__ */ jsx16(
907
1081
  "a",
908
1082
  {
909
1083
  href: `${contextConfig.apiHost}/projects/${encodeURIComponent(
@@ -920,7 +1094,7 @@ var NoEnrichmentsView = ({ contextConfig }) => /* @__PURE__ */ jsx15(Callout, {
920
1094
  var getCappedValue = (value, maxCap = 100, minCap = 0) => {
921
1095
  return Math.max(Math.min(value, maxCap), minCap);
922
1096
  };
923
- var scoreCounterMinusButtonStyles = css4`
1097
+ var scoreCounterMinusButtonStyles = css5`
924
1098
  position: absolute;
925
1099
  bottom: 0.875rem;
926
1100
  left: var(--spacing-sm);
@@ -933,7 +1107,7 @@ var scoreCounterMinusButtonStyles = css4`
933
1107
  border: 1px solid var(--gray-300);
934
1108
  border-radius: var(--rounded-full);
935
1109
  `;
936
- var scoreCounterPlusButtonStyles = css4`
1110
+ var scoreCounterPlusButtonStyles = css5`
937
1111
  ${scoreCounterMinusButtonStyles}
938
1112
  left: auto;
939
1113
  right: var(--spacing-sm);
@@ -954,8 +1128,8 @@ var ScoreCounter = ({
954
1128
  }
955
1129
  setValue(newScore);
956
1130
  };
957
- return /* @__PURE__ */ jsxs7("div", { css: { position: "relative" }, ...otherProps, children: [
958
- /* @__PURE__ */ jsx15(
1131
+ return /* @__PURE__ */ jsxs8("div", { css: { position: "relative" }, ...otherProps, children: [
1132
+ /* @__PURE__ */ jsx16(
959
1133
  Input,
960
1134
  {
961
1135
  label: "Strength",
@@ -968,7 +1142,7 @@ var ScoreCounter = ({
968
1142
  css: { textAlign: "center", boxSizing: "border-box" }
969
1143
  }
970
1144
  ),
971
- /* @__PURE__ */ jsx15(
1145
+ /* @__PURE__ */ jsx16(
972
1146
  "button",
973
1147
  {
974
1148
  type: "button",
@@ -977,10 +1151,10 @@ var ScoreCounter = ({
977
1151
  disabled: score === 0,
978
1152
  className: "scoreCounterButton",
979
1153
  css: scoreCounterMinusButtonStyles,
980
- children: /* @__PURE__ */ jsx15(Icon4, { icon: CgMathMinus, iconColor: "gray", size: "1.5rem" })
1154
+ children: /* @__PURE__ */ jsx16(Icon4, { icon: CgMathMinus, iconColor: "gray", size: "1.5rem" })
981
1155
  }
982
1156
  ),
983
- /* @__PURE__ */ jsx15(
1157
+ /* @__PURE__ */ jsx16(
984
1158
  "button",
985
1159
  {
986
1160
  type: "button",
@@ -988,7 +1162,7 @@ var ScoreCounter = ({
988
1162
  onClick: () => handleCounter("increment"),
989
1163
  className: "scoreCounterButton",
990
1164
  css: scoreCounterPlusButtonStyles,
991
- children: /* @__PURE__ */ jsx15(Icon4, { icon: CgMathPlus, iconColor: "gray", size: "1.5rem" })
1165
+ children: /* @__PURE__ */ jsx16(Icon4, { icon: CgMathPlus, iconColor: "gray", size: "1.5rem" })
992
1166
  }
993
1167
  )
994
1168
  ] });
@@ -1010,11 +1184,11 @@ var SelectedEnrichments = ({ list, setList, dimIndex }) => {
1010
1184
  })
1011
1185
  );
1012
1186
  };
1013
- return /* @__PURE__ */ jsx15(Fragment4, { children: list.map((enrichment, index) => {
1187
+ return /* @__PURE__ */ jsx16(Fragment5, { children: list.map((enrichment, index) => {
1014
1188
  const dimData = dimIndex[getEnrichmentVectorKey(enrichment.cat, enrichment.key)];
1015
1189
  if (!dimData)
1016
1190
  return;
1017
- return /* @__PURE__ */ jsxs7(
1191
+ return /* @__PURE__ */ jsxs8(
1018
1192
  "div",
1019
1193
  {
1020
1194
  css: {
@@ -1029,14 +1203,14 @@ var SelectedEnrichments = ({ list, setList, dimIndex }) => {
1029
1203
  },
1030
1204
  className: "selected-enrichments",
1031
1205
  children: [
1032
- /* @__PURE__ */ jsx15(
1206
+ /* @__PURE__ */ jsx16(
1033
1207
  "span",
1034
1208
  {
1035
1209
  css: { fontWeight: "var(--fw-bold)", color: dimData ? void 0 : "var(--brand-secondary-5)" },
1036
1210
  children: dimData ? dimData.displayName : `Enrichment '${enrichment.cat}_${enrichment.key}' is unknown`
1037
1211
  }
1038
1212
  ),
1039
- /* @__PURE__ */ jsx15(
1213
+ /* @__PURE__ */ jsx16(
1040
1214
  "div",
1041
1215
  {
1042
1216
  css: {
@@ -1049,7 +1223,7 @@ var SelectedEnrichments = ({ list, setList, dimIndex }) => {
1049
1223
  padding: "var(--spacing-sm) var(--spacing-base)",
1050
1224
  flexBasis: "9rem"
1051
1225
  },
1052
- children: /* @__PURE__ */ jsx15(
1226
+ children: /* @__PURE__ */ jsx16(
1053
1227
  Input,
1054
1228
  {
1055
1229
  type: "text",
@@ -1063,14 +1237,14 @@ var SelectedEnrichments = ({ list, setList, dimIndex }) => {
1063
1237
  )
1064
1238
  }
1065
1239
  ),
1066
- /* @__PURE__ */ jsx15(
1240
+ /* @__PURE__ */ jsx16(
1067
1241
  "button",
1068
1242
  {
1069
1243
  type: "button",
1070
1244
  title: `Delete enrichment`,
1071
1245
  onClick: () => removeEnrichment(index),
1072
1246
  css: { border: 0 },
1073
- children: /* @__PURE__ */ jsx15(Icon4, { icon: CgCloseO, iconColor: "red", size: "1.5rem" })
1247
+ children: /* @__PURE__ */ jsx16(Icon4, { icon: CgCloseO, iconColor: "red", size: "1.5rem" })
1074
1248
  }
1075
1249
  )
1076
1250
  ]
@@ -1081,8 +1255,8 @@ var SelectedEnrichments = ({ list, setList, dimIndex }) => {
1081
1255
  };
1082
1256
 
1083
1257
  // src/components/PersonalizationCriteria/PersonalizationCriteria.tsx
1084
- import { Callout as Callout3, LoadingIndicator as LoadingIndicator3 } from "@uniformdev/design-system";
1085
- import { useState as useState5 } from "react";
1258
+ import { Callout as Callout4, LoadingIndicator as LoadingIndicator4 } from "@uniformdev/design-system";
1259
+ import { useState as useState7 } from "react";
1086
1260
  import { useAsync } from "react-use";
1087
1261
  import * as yup from "yup";
1088
1262
 
@@ -1094,19 +1268,19 @@ function isPersonalizationCriteriaData(obj) {
1094
1268
  return obj.crit !== void 0;
1095
1269
  }
1096
1270
  function opHasRhs(op) {
1097
- return op !== "+" && op !== "-";
1271
+ return op !== "+" && op !== "-" && op !== "^";
1098
1272
  }
1099
1273
 
1100
1274
  // src/components/PersonalizationCriteria/PersonalizationCriteriaStatic.tsx
1101
- import { css as css6 } from "@emotion/react";
1275
+ import { css as css7 } from "@emotion/react";
1102
1276
  import { CgCloseO as CgCloseO2 } from "@react-icons/all-files/cg/CgCloseO";
1103
- import { AddListButton as AddListButton2, Callout as Callout2, Icon as Icon5, InputInlineSelect, Paragraph } from "@uniformdev/design-system";
1104
- import produce2 from "immer";
1277
+ import { AddListButton as AddListButton3, Callout as Callout3, Icon as Icon5, InputInlineSelect, Paragraph } from "@uniformdev/design-system";
1278
+ import { produce as produce2 } from "immer";
1105
1279
 
1106
1280
  // src/components/PersonalizationCriteria/PersonalizationCriteriaStatic.styles.ts
1107
- import { css as css5 } from "@emotion/react";
1281
+ import { css as css6 } from "@emotion/react";
1108
1282
  var spaceBetweenCriteriaItems = "6rem";
1109
- var criteriaItem = css5`
1283
+ var criteriaItem = css6`
1110
1284
  position: relative;
1111
1285
  padding: var(--spacing-md) var(--spacing-base);
1112
1286
  border: 1px solid var(--gray-300);
@@ -1134,35 +1308,35 @@ var criteriaItem = css5`
1134
1308
  }
1135
1309
  }
1136
1310
  `;
1137
- var criteriaItemInner = css5`
1311
+ var criteriaItemInner = css6`
1138
1312
  display: flex;
1139
1313
  gap: var(--spacing-base);
1140
1314
  flex-grow: 1;
1141
1315
  flex-wrap: wrap;
1142
1316
  margin-right: var(--spacing-base);
1143
1317
  `;
1144
- var criteriaWrapper = css5`
1318
+ var criteriaWrapper = css6`
1145
1319
  width: 100%;
1146
1320
  display: flex;
1147
1321
  align-items: stretch;
1148
1322
  position: relative;
1149
1323
  `;
1150
- var criteriaOperandWrapper = css5`
1324
+ var criteriaOperandWrapper = css6`
1151
1325
  flex: 2;
1152
1326
  height: 52px;
1153
1327
  min-width: 200px;
1154
1328
  `;
1155
- var criteriaOperatorWrapper = css5`
1329
+ var criteriaOperatorWrapper = css6`
1156
1330
  flex: 1;
1157
1331
  min-width: 80px;
1158
1332
  `;
1159
- var expand = css5`
1333
+ var expand = css6`
1160
1334
  height: 100%;
1161
1335
  width: 100%;
1162
1336
  `;
1163
1337
 
1164
1338
  // src/components/PersonalizationCriteria/PersonalizationCriteriaStatic.tsx
1165
- import { jsx as jsx16, jsxs as jsxs8 } from "@emotion/react/jsx-runtime";
1339
+ import { jsx as jsx17, jsxs as jsxs9 } from "@emotion/react/jsx-runtime";
1166
1340
  var PersonalizationCriteriaStatic = ({
1167
1341
  value,
1168
1342
  setValue,
@@ -1208,8 +1382,8 @@ var PersonalizationCriteriaStatic = ({
1208
1382
  setValue(finalValue);
1209
1383
  onRemoveCriteria == null ? void 0 : onRemoveCriteria(finalValue);
1210
1384
  };
1211
- return /* @__PURE__ */ jsxs8("fieldset", { className: "personalization-criteria", children: [
1212
- displayTitle ? (components == null ? void 0 : components.Title) ? /* @__PURE__ */ jsx16(components.Title, {}) : /* @__PURE__ */ jsx16(
1385
+ return /* @__PURE__ */ jsxs9("fieldset", { className: "personalization-criteria", "data-testid": "personalization-panel", children: [
1386
+ displayTitle ? (components == null ? void 0 : components.Title) ? /* @__PURE__ */ jsx17(components.Title, {}) : /* @__PURE__ */ jsx17(
1213
1387
  "legend",
1214
1388
  {
1215
1389
  css: {
@@ -1219,27 +1393,28 @@ var PersonalizationCriteriaStatic = ({
1219
1393
  children: "Personalize This"
1220
1394
  }
1221
1395
  ) : null,
1222
- (components == null ? void 0 : components.CustomVariantName) ? /* @__PURE__ */ jsx16(components.CustomVariantName, {}) : null,
1223
- !currentValue.crit.length ? /* @__PURE__ */ jsx16(Callout2, { title: "Default variant", type: "info", css: { marginBlock: "var(--spacing-base)" }, children: /* @__PURE__ */ jsx16(Paragraph, { children: 'This personalized variant has no match criteria and will be shown to any visitor that does not match any preceding variants. Ensure that default variants come last in the variant list. Personalize this variant by clicking "Add Criteria" to get started.' }) }) : /* @__PURE__ */ jsx16("div", { children: currentValue.crit.map((currentCriteria, index) => {
1396
+ (components == null ? void 0 : components.CustomVariantName) ? /* @__PURE__ */ jsx17(components.CustomVariantName, {}) : null,
1397
+ (components == null ? void 0 : components.ControlPercentage) ? /* @__PURE__ */ jsx17(components.ControlPercentage, {}) : null,
1398
+ !currentValue.crit.length ? /* @__PURE__ */ jsx17(Callout3, { title: "Default variant", type: "info", css: { marginBlock: "var(--spacing-base)" }, children: /* @__PURE__ */ jsx17(Paragraph, { children: 'This personalized variant has no match criteria and will be shown to any visitor that does not match any preceding variants. Ensure that default variants come last in the variant list. Personalize this variant by clicking "Add Criteria" to get started.' }) }) : /* @__PURE__ */ jsx17("div", { children: currentValue.crit.map((currentCriteria, index) => {
1224
1399
  var _a2, _b, _c, _d;
1225
1400
  const critHasLhs = ((_a2 = currentCriteria.l) == null ? void 0 : _a2.length) > 0;
1226
- const critHasRhs = currentCriteria.op !== "+" && currentCriteria.op !== "-";
1227
- return /* @__PURE__ */ jsxs8("div", { css: criteriaItem, "data-testid": "criteria-container", children: [
1228
- /* @__PURE__ */ jsxs8(
1401
+ const critHasRhs = opHasRhs(currentCriteria.op);
1402
+ return /* @__PURE__ */ jsxs9("div", { css: criteriaItem, "data-testid": "criteria-container", children: [
1403
+ /* @__PURE__ */ jsxs9(
1229
1404
  "div",
1230
1405
  {
1231
- css: css6`
1406
+ css: css7`
1232
1407
  ${criteriaItemInner}/* grid-template-columns: minmax(0, 1fr) ${critHasRhs ? "minmax(0, 79px) minmax(0, 1fr)" : "minmax(0, 1fr)"} */
1233
1408
  `,
1234
1409
  className: "criteriaItemInner",
1235
1410
  children: [
1236
- /* @__PURE__ */ jsx16(
1411
+ /* @__PURE__ */ jsx17(
1237
1412
  "div",
1238
1413
  {
1239
1414
  css: [criteriaWrapper, criteriaOperandWrapper],
1240
1415
  className: "criteria-wrapper",
1241
1416
  "data-testid": "select-criteria",
1242
- children: /* @__PURE__ */ jsx16(
1417
+ children: /* @__PURE__ */ jsx17(
1243
1418
  DimensionMenu,
1244
1419
  {
1245
1420
  errorMessage: (_b = errors.lhs) == null ? void 0 : _b[index],
@@ -1256,13 +1431,13 @@ var PersonalizationCriteriaStatic = ({
1256
1431
  )
1257
1432
  }
1258
1433
  ),
1259
- /* @__PURE__ */ jsx16(
1434
+ /* @__PURE__ */ jsx17(
1260
1435
  "div",
1261
1436
  {
1262
1437
  css: [criteriaWrapper, criteriaOperatorWrapper],
1263
1438
  className: "criteria-wrapper",
1264
1439
  "data-testid": "select-operator",
1265
- children: /* @__PURE__ */ jsx16(
1440
+ children: /* @__PURE__ */ jsx17(
1266
1441
  CriteriaOperatorMenu,
1267
1442
  {
1268
1443
  name: `op-${index}`,
@@ -1282,13 +1457,13 @@ var PersonalizationCriteriaStatic = ({
1282
1457
  )
1283
1458
  }
1284
1459
  ),
1285
- critHasRhs ? /* @__PURE__ */ jsx16(
1460
+ critHasRhs ? /* @__PURE__ */ jsx17(
1286
1461
  "div",
1287
1462
  {
1288
1463
  css: [criteriaWrapper, criteriaOperandWrapper],
1289
1464
  className: "criteria-wrapper",
1290
1465
  "data-testid": "select-match-criteria",
1291
- children: /* @__PURE__ */ jsx16(
1466
+ children: /* @__PURE__ */ jsx17(
1292
1467
  CriteriaMatchMenu,
1293
1468
  {
1294
1469
  errorMessage: (_c = errors.rhs) == null ? void 0 : _c[index],
@@ -1309,7 +1484,7 @@ var PersonalizationCriteriaStatic = ({
1309
1484
  ]
1310
1485
  }
1311
1486
  ),
1312
- /* @__PURE__ */ jsx16(
1487
+ /* @__PURE__ */ jsx17(
1313
1488
  "button",
1314
1489
  {
1315
1490
  type: "button",
@@ -1317,10 +1492,10 @@ var PersonalizationCriteriaStatic = ({
1317
1492
  title: `Delete Personalization`,
1318
1493
  css: { backgroundColor: "transparent", backgroundImage: "none", borderWidth: 0 },
1319
1494
  "data-testid": "button-delete",
1320
- children: /* @__PURE__ */ jsx16(Icon5, { icon: CgCloseO2, iconColor: "red", size: "1.5rem" })
1495
+ children: /* @__PURE__ */ jsx17(Icon5, { icon: CgCloseO2, iconColor: "red", size: "1.5rem" })
1321
1496
  }
1322
1497
  ),
1323
- index > 0 ? /* @__PURE__ */ jsx16(
1498
+ index > 0 ? /* @__PURE__ */ jsx17(
1324
1499
  "div",
1325
1500
  {
1326
1501
  className: "criteria-group-operation",
@@ -1329,7 +1504,7 @@ var PersonalizationCriteriaStatic = ({
1329
1504
  top: "-4rem",
1330
1505
  transform: "translateX(calc(1.5rem - 50%))"
1331
1506
  },
1332
- children: /* @__PURE__ */ jsx16(
1507
+ children: /* @__PURE__ */ jsx17(
1333
1508
  InputInlineSelect,
1334
1509
  {
1335
1510
  "data-testid": "dropdown-button-combine",
@@ -1348,8 +1523,8 @@ var PersonalizationCriteriaStatic = ({
1348
1523
  ) : null
1349
1524
  ] }, index);
1350
1525
  }) }),
1351
- dimensions.dimensions.length === 0 ? (components == null ? void 0 : components.NoDimensionsDefined) ? /* @__PURE__ */ jsx16(components.NoDimensionsDefined, {}) : /* @__PURE__ */ jsx16(Callout2, { title: "Dimensions", type: "info", css: { marginBlock: "var(--spacing-base)" }, children: /* @__PURE__ */ jsx16("p", { children: "You do not have any dimensions configured." }) }) : /* @__PURE__ */ jsx16(
1352
- AddListButton2,
1526
+ dimensions.dimensions.length === 0 ? (components == null ? void 0 : components.NoDimensionsDefined) ? /* @__PURE__ */ jsx17(components.NoDimensionsDefined, {}) : /* @__PURE__ */ jsx17(Callout3, { title: "Dimensions", type: "info", css: { marginBlock: "var(--spacing-base)" }, children: /* @__PURE__ */ jsx17("p", { children: "You do not have any dimensions configured." }) }) : /* @__PURE__ */ jsx17(
1527
+ AddListButton3,
1353
1528
  {
1354
1529
  "data-testid": "button-add-criteria",
1355
1530
  className: "add-more",
@@ -1361,7 +1536,7 @@ var PersonalizationCriteriaStatic = ({
1361
1536
  };
1362
1537
 
1363
1538
  // src/components/PersonalizationCriteria/PersonalizationCriteria.tsx
1364
- import { jsx as jsx17, jsxs as jsxs9 } from "@emotion/react/jsx-runtime";
1539
+ import { jsx as jsx18, jsxs as jsxs10 } from "@emotion/react/jsx-runtime";
1365
1540
  function convertErrorsToObj(errors) {
1366
1541
  const result = { crit: [] };
1367
1542
  errors.forEach((err) => {
@@ -1422,7 +1597,7 @@ var PersonalizationCriteria = ({
1422
1597
  ...staticProps
1423
1598
  }) => {
1424
1599
  var _a, _b;
1425
- const [validationError, setValidationError] = useState5(void 0);
1600
+ const [validationError, setValidationError] = useState7(void 0);
1426
1601
  const { loading, result: dimensions, error } = useDimensions(contextConfig);
1427
1602
  useAsync(async () => {
1428
1603
  if (value && dimensions) {
@@ -1431,15 +1606,15 @@ var PersonalizationCriteria = ({
1431
1606
  }
1432
1607
  }, [value, dimensions, validate]);
1433
1608
  if (error)
1434
- return /* @__PURE__ */ jsx17(Callout3, { type: "danger", children: error });
1609
+ return /* @__PURE__ */ jsx18(Callout4, { type: "danger", children: error });
1435
1610
  if (loading || dimensions === null)
1436
- return /* @__PURE__ */ jsx17(LoadingIndicator3, {});
1611
+ return /* @__PURE__ */ jsx18(LoadingIndicator4, {});
1437
1612
  const handleSetValue = async (value2) => {
1438
1613
  const err = await validate(value2, dimensions);
1439
1614
  setValidationError(err);
1440
1615
  setValue(value2);
1441
1616
  };
1442
- return /* @__PURE__ */ jsx17(
1617
+ return /* @__PURE__ */ jsx18(
1443
1618
  PersonalizationCriteriaStatic,
1444
1619
  {
1445
1620
  ...staticProps,
@@ -1451,10 +1626,10 @@ var PersonalizationCriteria = ({
1451
1626
  },
1452
1627
  dimensions,
1453
1628
  components: {
1454
- NoDimensionsDefined: () => /* @__PURE__ */ jsx17(Callout3, { title: "Dimensions", type: "info", css: { marginBlock: "var(--spacing-base)" }, children: /* @__PURE__ */ jsxs9("p", { children: [
1629
+ NoDimensionsDefined: () => /* @__PURE__ */ jsx18(Callout4, { title: "Dimensions", type: "info", css: { marginBlock: "var(--spacing-base)" }, children: /* @__PURE__ */ jsxs10("p", { children: [
1455
1630
  "You do not have any dimensions configured. Create your first",
1456
1631
  " ",
1457
- /* @__PURE__ */ jsx17(
1632
+ /* @__PURE__ */ jsx18(
1458
1633
  "a",
1459
1634
  {
1460
1635
  href: `${contextConfig.apiHost}/projects/${encodeURIComponent(
@@ -1473,23 +1648,23 @@ var PersonalizationCriteria = ({
1473
1648
  };
1474
1649
 
1475
1650
  // src/components/ProjectUIVersion/ProjectUIVersion.tsx
1476
- import { LoadingIndicator as LoadingIndicator4 } from "@uniformdev/design-system";
1477
- import { Fragment as Fragment5, jsx as jsx18 } from "@emotion/react/jsx-runtime";
1651
+ import { LoadingIndicator as LoadingIndicator5 } from "@uniformdev/design-system";
1652
+ import { Fragment as Fragment6, jsx as jsx19 } from "@emotion/react/jsx-runtime";
1478
1653
  function ProjectUIVersion({ children, versionMap, contextConfig }) {
1479
1654
  const { loading, result: data } = useContextData(contextConfig);
1480
1655
  if (loading)
1481
- return /* @__PURE__ */ jsx18(LoadingIndicator4, {});
1656
+ return /* @__PURE__ */ jsx19(LoadingIndicator5, {});
1482
1657
  if (data) {
1483
1658
  const Component = versionMap[data.project.ui_version];
1484
1659
  if (Component) {
1485
- return /* @__PURE__ */ jsx18(Component, {});
1660
+ return /* @__PURE__ */ jsx19(Component, {});
1486
1661
  }
1487
1662
  }
1488
- return /* @__PURE__ */ jsx18(Fragment5, { children });
1663
+ return /* @__PURE__ */ jsx19(Fragment6, { children });
1489
1664
  }
1490
1665
 
1491
1666
  // src/hooks/useValidateContextConfig.ts
1492
- import { useEffect as useEffect3, useState as useState6 } from "react";
1667
+ import { useEffect as useEffect4, useState as useState8 } from "react";
1493
1668
 
1494
1669
  // src/utils/validateContextConfig.ts
1495
1670
  import { UncachedManifestClient } from "@uniformdev/context/api";
@@ -1525,12 +1700,12 @@ var validateContextConfig = async (contextConfig) => {
1525
1700
 
1526
1701
  // src/hooks/useValidateContextConfig.ts
1527
1702
  var useValidateContextConfig = (contextConfig) => {
1528
- const [state, setState] = useState6({
1703
+ const [state, setState] = useState8({
1529
1704
  validating: false,
1530
1705
  error: void 0
1531
1706
  });
1532
1707
  const { apiKey, apiHost, projectId } = contextConfig || {};
1533
- useEffect3(() => {
1708
+ useEffect4(() => {
1534
1709
  if (!apiKey || !apiHost) {
1535
1710
  return;
1536
1711
  }
@@ -1555,6 +1730,7 @@ var useValidateContextConfig = (contextConfig) => {
1555
1730
  // src/index.ts
1556
1731
  export * from "@uniformdev/design-system";
1557
1732
  export {
1733
+ AbTestSelector,
1558
1734
  ContextData,
1559
1735
  CriteriaMatchMenu,
1560
1736
  CriteriaOperatorMenu,
@@ -1565,6 +1741,7 @@ export {
1565
1741
  PersonalizationCriteria,
1566
1742
  PersonalizationCriteriaStatic,
1567
1743
  ProjectUIVersion,
1744
+ addAbTestLink,
1568
1745
  addEnrichmentLink,
1569
1746
  contextCriteriaMenuOperators,
1570
1747
  convertErrorsToObj,