@uniformdev/context-ui 20.7.1-alpha.4 → 20.8.2-alpha.15
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.d.mts +23 -11
- package/dist/index.d.ts +23 -11
- package/dist/index.esm.js +223 -115
- package/dist/index.js +240 -140
- package/dist/index.mjs +223 -115
- package/package.json +5 -5
package/dist/index.esm.js
CHANGED
|
@@ -289,23 +289,39 @@ var contextCriteriaMenuOperators = [
|
|
|
289
289
|
{
|
|
290
290
|
name: "has the weakest score",
|
|
291
291
|
value: "-"
|
|
292
|
-
}
|
|
292
|
+
}
|
|
293
|
+
];
|
|
294
|
+
var enrichmentCriteriaMenuOperators = [
|
|
295
|
+
...contextCriteriaMenuOperators,
|
|
293
296
|
{
|
|
294
297
|
name: "has strongest category score",
|
|
295
298
|
value: "^"
|
|
296
299
|
}
|
|
297
300
|
];
|
|
298
|
-
|
|
301
|
+
var quirkCriteriaMenuOperators = [
|
|
302
|
+
{
|
|
303
|
+
name: "=",
|
|
304
|
+
description: "equals",
|
|
305
|
+
value: "="
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
name: "\u2260",
|
|
309
|
+
description: "not equal",
|
|
310
|
+
value: "!="
|
|
311
|
+
}
|
|
312
|
+
];
|
|
313
|
+
function CriteriaOperatorMenu({ onChange, value, rhsType, ...props }) {
|
|
299
314
|
var _a, _b;
|
|
315
|
+
const operators = rhsType === "QUIRK" ? quirkCriteriaMenuOperators : rhsType === "ENR" ? enrichmentCriteriaMenuOperators : contextCriteriaMenuOperators;
|
|
300
316
|
return /* @__PURE__ */ jsx6(
|
|
301
317
|
InputComboBox,
|
|
302
318
|
{
|
|
303
319
|
...props,
|
|
304
320
|
value: {
|
|
305
|
-
label: (_b = (_a =
|
|
321
|
+
label: (_b = (_a = operators.find((e) => e.value === value)) == null ? void 0 : _a.name) != null ? _b : value,
|
|
306
322
|
value
|
|
307
323
|
},
|
|
308
|
-
options:
|
|
324
|
+
options: operators.map((option) => ({
|
|
309
325
|
label: option.description ? `${option.name}:${option.description}` : option.name,
|
|
310
326
|
value: option.value
|
|
311
327
|
})),
|
|
@@ -543,18 +559,23 @@ import { useState as useState5 } from "react";
|
|
|
543
559
|
import { Icon } from "@uniformdev/design-system";
|
|
544
560
|
|
|
545
561
|
// src/components/DimensionMenu/utils.ts
|
|
562
|
+
import { useMemo } from "react";
|
|
546
563
|
function dimensionToMenuOption(dimension) {
|
|
564
|
+
if ("dim" in dimension) {
|
|
565
|
+
return {
|
|
566
|
+
label: dimension.displayName,
|
|
567
|
+
value: dimension.dim,
|
|
568
|
+
original: dimension
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
const quirk = dimension;
|
|
547
572
|
return {
|
|
548
|
-
label:
|
|
549
|
-
value:
|
|
550
|
-
|
|
573
|
+
label: `Quirk:${quirk.name}`,
|
|
574
|
+
value: quirk.id,
|
|
575
|
+
original: quirk
|
|
551
576
|
};
|
|
552
577
|
}
|
|
553
|
-
function dimensionIcon(
|
|
554
|
-
if (!displayName) {
|
|
555
|
-
return "unavailable";
|
|
556
|
-
}
|
|
557
|
-
const [type] = displayName.split(":");
|
|
578
|
+
function dimensionIcon(type) {
|
|
558
579
|
switch (type.toLowerCase()) {
|
|
559
580
|
case "signal":
|
|
560
581
|
return "data";
|
|
@@ -566,25 +587,42 @@ function dimensionIcon(displayName) {
|
|
|
566
587
|
return "user-list";
|
|
567
588
|
}
|
|
568
589
|
}
|
|
569
|
-
function
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
const
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
590
|
+
function useGroupedDimensions(dimensions, quirks) {
|
|
591
|
+
return useMemo(() => {
|
|
592
|
+
const result = [];
|
|
593
|
+
let lastType = "";
|
|
594
|
+
for (const dim of dimensions) {
|
|
595
|
+
const { type } = dimensionDisplayName(dim.displayName);
|
|
596
|
+
if (lastType !== type) {
|
|
597
|
+
result.push({ label: type != null ? type : "", options: [] });
|
|
598
|
+
lastType = type != null ? type : "";
|
|
599
|
+
}
|
|
600
|
+
result[result.length - 1].options.push(dimensionToMenuOption(dim));
|
|
601
|
+
}
|
|
602
|
+
if (quirks == null ? void 0 : quirks.length) {
|
|
603
|
+
result.push({
|
|
604
|
+
label: "Quirks",
|
|
605
|
+
options: quirks.map(dimensionToMenuOption)
|
|
606
|
+
});
|
|
577
607
|
}
|
|
578
|
-
result
|
|
608
|
+
return result;
|
|
609
|
+
}, [dimensions, quirks]);
|
|
610
|
+
}
|
|
611
|
+
function dimensionDisplayName(displayName) {
|
|
612
|
+
if (!displayName) {
|
|
613
|
+
return {};
|
|
579
614
|
}
|
|
580
|
-
|
|
615
|
+
const colonIndex = displayName.indexOf(":");
|
|
616
|
+
const type = colonIndex >= 0 ? displayName.substring(0, colonIndex) : void 0;
|
|
617
|
+
const name = colonIndex >= 0 ? displayName.substring(colonIndex + 1) : displayName;
|
|
618
|
+
return { type, name };
|
|
581
619
|
}
|
|
582
620
|
|
|
583
621
|
// src/components/DimensionMenu/DimensionGroupHeading.tsx
|
|
584
622
|
import { jsx as jsx8, jsxs as jsxs3 } from "@emotion/react/jsx-runtime";
|
|
585
623
|
var DimensionGroupHeading = (props) => {
|
|
586
|
-
var _a;
|
|
587
624
|
const { data, getStyles, className } = props;
|
|
625
|
+
const { type } = dimensionDisplayName(data.label);
|
|
588
626
|
return /* @__PURE__ */ jsx8(
|
|
589
627
|
"div",
|
|
590
628
|
{
|
|
@@ -599,7 +637,7 @@ var DimensionGroupHeading = (props) => {
|
|
|
599
637
|
{
|
|
600
638
|
css: { color: "var(--gray-500)", display: "flex", alignItems: "center", gap: "var(--spacing-xs)" },
|
|
601
639
|
children: [
|
|
602
|
-
/* @__PURE__ */ jsx8(Icon, { icon: dimensionIcon(
|
|
640
|
+
type ? /* @__PURE__ */ jsx8(Icon, { icon: dimensionIcon(type), iconColor: "currentColor", size: 16 }) : null,
|
|
603
641
|
/* @__PURE__ */ jsx8("span", { children: data.label })
|
|
604
642
|
]
|
|
605
643
|
}
|
|
@@ -630,9 +668,8 @@ function DimensionMenuErrorMessage({ message }) {
|
|
|
630
668
|
// src/components/DimensionMenu/DimensionOption.tsx
|
|
631
669
|
import { jsx as jsx10 } from "@emotion/react/jsx-runtime";
|
|
632
670
|
var DimensionOption = (props) => {
|
|
633
|
-
var _a, _b;
|
|
634
671
|
const { data, getStyles, cx, isDisabled, isFocused, isSelected, className, innerRef, innerProps } = props;
|
|
635
|
-
const
|
|
672
|
+
const { name } = dimensionDisplayName(data.label);
|
|
636
673
|
return /* @__PURE__ */ jsx10(
|
|
637
674
|
"div",
|
|
638
675
|
{
|
|
@@ -649,7 +686,7 @@ var DimensionOption = (props) => {
|
|
|
649
686
|
ref: innerRef,
|
|
650
687
|
"aria-disabled": isDisabled,
|
|
651
688
|
...innerProps,
|
|
652
|
-
children: /* @__PURE__ */ jsx10("div", { css: { color: "var(--gray-700)" }, children:
|
|
689
|
+
children: /* @__PURE__ */ jsx10("div", { css: { color: "var(--gray-700)" }, children: name != null ? name : data.label })
|
|
653
690
|
}
|
|
654
691
|
);
|
|
655
692
|
};
|
|
@@ -658,7 +695,7 @@ var DimensionOption = (props) => {
|
|
|
658
695
|
import { Icon as Icon2 } from "@uniformdev/design-system";
|
|
659
696
|
import { jsx as jsx11, jsxs as jsxs4 } from "@emotion/react/jsx-runtime";
|
|
660
697
|
function DimensionValue({ displayName }) {
|
|
661
|
-
const
|
|
698
|
+
const { type, name } = dimensionDisplayName(displayName);
|
|
662
699
|
return /* @__PURE__ */ jsxs4(
|
|
663
700
|
"div",
|
|
664
701
|
{
|
|
@@ -667,7 +704,7 @@ function DimensionValue({ displayName }) {
|
|
|
667
704
|
overflow: "hidden"
|
|
668
705
|
},
|
|
669
706
|
children: [
|
|
670
|
-
|
|
707
|
+
type ? /* @__PURE__ */ jsxs4(
|
|
671
708
|
"small",
|
|
672
709
|
{
|
|
673
710
|
css: { color: "var(--gray-500)", display: "flex", alignItems: "center", gap: "var(--spacing-xs)" },
|
|
@@ -705,6 +742,7 @@ function CriteriaMatchMenu({
|
|
|
705
742
|
);
|
|
706
743
|
const rDim = criteriaMatch.rDim;
|
|
707
744
|
const targetDim = criteriaMatch.rDim ? dimensions.dimIndex[criteriaMatch.rDim] : void 0;
|
|
745
|
+
const groupedDimensions = useGroupedDimensions(dimensions.dimensions, void 0);
|
|
708
746
|
return /* @__PURE__ */ jsxs5(Fragment3, { children: [
|
|
709
747
|
/* @__PURE__ */ jsx13(
|
|
710
748
|
InputComboBox3,
|
|
@@ -723,7 +761,7 @@ function CriteriaMatchMenu({
|
|
|
723
761
|
value: "",
|
|
724
762
|
isDisabled: true
|
|
725
763
|
},
|
|
726
|
-
...
|
|
764
|
+
...groupedDimensions
|
|
727
765
|
],
|
|
728
766
|
styles: {
|
|
729
767
|
...props.styles,
|
|
@@ -802,14 +840,23 @@ function isInt(value) {
|
|
|
802
840
|
// src/components/DimensionMenu/DimensionMenu.tsx
|
|
803
841
|
import { InputComboBox as InputComboBox4 } from "@uniformdev/design-system";
|
|
804
842
|
import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs6 } from "@emotion/react/jsx-runtime";
|
|
805
|
-
function DimensionMenu({
|
|
843
|
+
function DimensionMenu({
|
|
844
|
+
onChange,
|
|
845
|
+
value,
|
|
846
|
+
dimensions,
|
|
847
|
+
errorMessage,
|
|
848
|
+
quirks,
|
|
849
|
+
...props
|
|
850
|
+
}) {
|
|
851
|
+
const groupedDimensions = useGroupedDimensions(dimensions, quirks);
|
|
852
|
+
const valueAsMenuOption = value ? dimensionToMenuOption(value) : void 0;
|
|
806
853
|
return /* @__PURE__ */ jsxs6(Fragment4, { children: [
|
|
807
854
|
/* @__PURE__ */ jsx14(
|
|
808
855
|
InputComboBox4,
|
|
809
856
|
{
|
|
810
857
|
...props,
|
|
811
|
-
value:
|
|
812
|
-
options:
|
|
858
|
+
value: valueAsMenuOption,
|
|
859
|
+
options: groupedDimensions,
|
|
813
860
|
styles: {
|
|
814
861
|
...props.styles,
|
|
815
862
|
valueContainer: (provided, state) => {
|
|
@@ -822,8 +869,10 @@ function DimensionMenu({ onChange, value, dimensions, errorMessage, ...props })
|
|
|
822
869
|
}
|
|
823
870
|
},
|
|
824
871
|
onChange: (e) => {
|
|
825
|
-
if (e) {
|
|
826
|
-
onChange(
|
|
872
|
+
if (e == null ? void 0 : e.original) {
|
|
873
|
+
onChange(e.original);
|
|
874
|
+
} else {
|
|
875
|
+
onChange(void 0);
|
|
827
876
|
}
|
|
828
877
|
},
|
|
829
878
|
components: {
|
|
@@ -892,7 +941,7 @@ import {
|
|
|
892
941
|
LoadingIndicator as LoadingIndicator3
|
|
893
942
|
} from "@uniformdev/design-system";
|
|
894
943
|
import { produce } from "immer";
|
|
895
|
-
import { useMemo, useState as useState6 } from "react";
|
|
944
|
+
import { useMemo as useMemo2, useState as useState6 } from "react";
|
|
896
945
|
import { Fragment as Fragment5, jsx as jsx16, jsxs as jsxs8 } from "@emotion/react/jsx-runtime";
|
|
897
946
|
var addEnrichmentLink = css5`
|
|
898
947
|
flex: 2;
|
|
@@ -913,10 +962,10 @@ var EnrichmentTag = ({
|
|
|
913
962
|
displayTitle = true
|
|
914
963
|
}) => {
|
|
915
964
|
const { loading, result: dimensions, error } = useDimensions(contextConfig);
|
|
916
|
-
const allEnrichments =
|
|
965
|
+
const allEnrichments = useMemo2(() => {
|
|
917
966
|
if (dimensions) return dimensions.dimensions.filter((dimension) => dimension.category === "ENR");
|
|
918
967
|
}, [dimensions]);
|
|
919
|
-
const remainingEnrichments =
|
|
968
|
+
const remainingEnrichments = useMemo2(() => {
|
|
920
969
|
if (!value) return allEnrichments;
|
|
921
970
|
if (allEnrichments)
|
|
922
971
|
return allEnrichments.filter(
|
|
@@ -1262,7 +1311,16 @@ function opHasRhs(op) {
|
|
|
1262
1311
|
// src/components/PersonalizationCriteria/PersonalizationCriteriaStatic.tsx
|
|
1263
1312
|
import { css as css7 } from "@emotion/react";
|
|
1264
1313
|
import { CgCloseO as CgCloseO2 } from "@react-icons/all-files/cg/CgCloseO";
|
|
1265
|
-
import {
|
|
1314
|
+
import {
|
|
1315
|
+
AddListButton as AddListButton3,
|
|
1316
|
+
Callout as Callout3,
|
|
1317
|
+
Heading as Heading2,
|
|
1318
|
+
Icon as Icon5,
|
|
1319
|
+
Input as Input2,
|
|
1320
|
+
InputInlineSelect,
|
|
1321
|
+
InputSelect as InputSelect2,
|
|
1322
|
+
Paragraph
|
|
1323
|
+
} from "@uniformdev/design-system";
|
|
1266
1324
|
import { produce as produce2 } from "immer";
|
|
1267
1325
|
|
|
1268
1326
|
// src/components/PersonalizationCriteria/PersonalizationCriteriaStatic.styles.ts
|
|
@@ -1298,7 +1356,8 @@ var criteriaItem = css6`
|
|
|
1298
1356
|
`;
|
|
1299
1357
|
var criteriaItemInner = css6`
|
|
1300
1358
|
display: flex;
|
|
1301
|
-
gap: var(--spacing-base);
|
|
1359
|
+
row-gap: var(--spacing-base);
|
|
1360
|
+
column-gap: var(--spacing-xs);
|
|
1302
1361
|
flex-grow: 1;
|
|
1303
1362
|
flex-wrap: wrap;
|
|
1304
1363
|
margin-right: var(--spacing-base);
|
|
@@ -1316,6 +1375,7 @@ var criteriaOperandWrapper = css6`
|
|
|
1316
1375
|
`;
|
|
1317
1376
|
var criteriaOperatorWrapper = css6`
|
|
1318
1377
|
flex: 1;
|
|
1378
|
+
flex-wrap: nowrap;
|
|
1319
1379
|
min-width: 80px;
|
|
1320
1380
|
`;
|
|
1321
1381
|
var expand = css6`
|
|
@@ -1329,6 +1389,7 @@ var PersonalizationCriteriaStatic = ({
|
|
|
1329
1389
|
value,
|
|
1330
1390
|
setValue,
|
|
1331
1391
|
dimensions,
|
|
1392
|
+
quirks,
|
|
1332
1393
|
onMenuOpen,
|
|
1333
1394
|
onMenuClose,
|
|
1334
1395
|
onAddCriteria,
|
|
@@ -1378,100 +1439,146 @@ var PersonalizationCriteriaStatic = ({
|
|
|
1378
1439
|
fontSize: "var(--fs-md)",
|
|
1379
1440
|
fontWeight: "var(--fw-bold)"
|
|
1380
1441
|
},
|
|
1381
|
-
children: "
|
|
1442
|
+
children: /* @__PURE__ */ jsx17(Heading2, { level: 5, withMarginBottom: false, children: "Personalization Variation" })
|
|
1382
1443
|
}
|
|
1383
1444
|
) : null,
|
|
1384
1445
|
(components == null ? void 0 : components.CustomVariantName) ? /* @__PURE__ */ jsx17(components.CustomVariantName, {}) : null,
|
|
1385
1446
|
(components == null ? void 0 : components.ControlPercentage) ? /* @__PURE__ */ jsx17(components.ControlPercentage, {}) : null,
|
|
1386
1447
|
!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) => {
|
|
1387
|
-
var _a2, _b, _c, _d;
|
|
1448
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
1388
1449
|
const critHasLhs = ((_a2 = currentCriteria.l) == null ? void 0 : _a2.length) > 0;
|
|
1389
1450
|
const critHasRhs = opHasRhs(currentCriteria.op);
|
|
1451
|
+
const currentDimension = dimensions.dimIndex[currentCriteria.l];
|
|
1452
|
+
const currentQuirk = quirks == null ? void 0 : quirks.find((q) => q.id === currentCriteria.l);
|
|
1390
1453
|
return /* @__PURE__ */ jsxs9("div", { css: criteriaItem, "data-testid": "criteria-container", children: [
|
|
1391
|
-
/* @__PURE__ */ jsxs9(
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
"div",
|
|
1454
|
+
/* @__PURE__ */ jsxs9("div", { css: criteriaItemInner, className: "criteriaItemInner", children: [
|
|
1455
|
+
/* @__PURE__ */ jsx17(
|
|
1456
|
+
"div",
|
|
1457
|
+
{
|
|
1458
|
+
css: [criteriaWrapper, criteriaOperandWrapper],
|
|
1459
|
+
className: "criteria-wrapper",
|
|
1460
|
+
"data-testid": "select-criteria",
|
|
1461
|
+
children: /* @__PURE__ */ jsx17(
|
|
1462
|
+
DimensionMenu,
|
|
1401
1463
|
{
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
styles: { control: (base) => ({ ...base, height: "100%" }) },
|
|
1411
|
-
dimensions: dimensions.dimensions,
|
|
1412
|
-
onChange: (dim) => {
|
|
1413
|
-
update({ ...currentCriteria, l: dim.dim }, index);
|
|
1414
|
-
},
|
|
1415
|
-
value: dimensions.dimIndex[currentCriteria.l],
|
|
1416
|
-
onMenuOpen,
|
|
1417
|
-
onMenuClose
|
|
1464
|
+
errorMessage: (_b = errors.lhs) == null ? void 0 : _b[index],
|
|
1465
|
+
css: expand,
|
|
1466
|
+
styles: { control: (base) => ({ ...base, height: "100%" }) },
|
|
1467
|
+
dimensions: dimensions.dimensions,
|
|
1468
|
+
quirks,
|
|
1469
|
+
onChange: (selection) => {
|
|
1470
|
+
if (!selection) {
|
|
1471
|
+
return;
|
|
1418
1472
|
}
|
|
1419
|
-
|
|
1473
|
+
if ("dim" in selection) {
|
|
1474
|
+
const newCriteria = {
|
|
1475
|
+
...currentCriteria,
|
|
1476
|
+
l: selection.dim,
|
|
1477
|
+
t: void 0,
|
|
1478
|
+
op: ">",
|
|
1479
|
+
r: 0
|
|
1480
|
+
};
|
|
1481
|
+
update(newCriteria, index);
|
|
1482
|
+
} else {
|
|
1483
|
+
update({ ...currentCriteria, l: selection.id, t: "q", op: "=", r: "" }, index);
|
|
1484
|
+
}
|
|
1485
|
+
},
|
|
1486
|
+
value: currentDimension != null ? currentDimension : currentQuirk,
|
|
1487
|
+
onMenuOpen,
|
|
1488
|
+
onMenuClose
|
|
1420
1489
|
}
|
|
1421
|
-
)
|
|
1422
|
-
|
|
1423
|
-
|
|
1490
|
+
)
|
|
1491
|
+
}
|
|
1492
|
+
),
|
|
1493
|
+
/* @__PURE__ */ jsx17(
|
|
1494
|
+
"div",
|
|
1495
|
+
{
|
|
1496
|
+
css: [criteriaWrapper, criteriaOperatorWrapper],
|
|
1497
|
+
className: "criteria-wrapper",
|
|
1498
|
+
"data-testid": "select-operator",
|
|
1499
|
+
children: /* @__PURE__ */ jsx17(
|
|
1500
|
+
CriteriaOperatorMenu,
|
|
1424
1501
|
{
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
onChange: (op) => {
|
|
1436
|
-
if (op === "+" || op === "-") {
|
|
1437
|
-
update({ ...currentCriteria, op, r: void 0, rDim: void 0 }, index);
|
|
1438
|
-
} else {
|
|
1439
|
-
update({ ...currentCriteria, op }, index);
|
|
1440
|
-
}
|
|
1441
|
-
},
|
|
1442
|
-
onMenuOpen,
|
|
1443
|
-
onMenuClose
|
|
1502
|
+
name: `op-${index}`,
|
|
1503
|
+
css: expand,
|
|
1504
|
+
styles: { control: (base) => ({ ...base, height: "100%" }) },
|
|
1505
|
+
value: currentCriteria.op,
|
|
1506
|
+
rhsType: currentQuirk ? "QUIRK" : currentDimension == null ? void 0 : currentDimension.category,
|
|
1507
|
+
onChange: (op) => {
|
|
1508
|
+
if (op === "+" || op === "-") {
|
|
1509
|
+
update({ ...currentCriteria, op, r: void 0, rDim: void 0 }, index);
|
|
1510
|
+
} else {
|
|
1511
|
+
update({ ...currentCriteria, op }, index);
|
|
1444
1512
|
}
|
|
1445
|
-
|
|
1513
|
+
},
|
|
1514
|
+
onMenuOpen,
|
|
1515
|
+
onMenuClose
|
|
1446
1516
|
}
|
|
1447
|
-
)
|
|
1448
|
-
|
|
1517
|
+
)
|
|
1518
|
+
}
|
|
1519
|
+
),
|
|
1520
|
+
critHasRhs ? /* @__PURE__ */ jsx17(
|
|
1521
|
+
"div",
|
|
1522
|
+
{
|
|
1523
|
+
css: [criteriaWrapper, criteriaOperandWrapper],
|
|
1524
|
+
className: "criteria-wrapper",
|
|
1525
|
+
"data-testid": "select-match-criteria",
|
|
1526
|
+
children: currentQuirk ? /* @__PURE__ */ jsx17(
|
|
1449
1527
|
"div",
|
|
1450
1528
|
{
|
|
1451
|
-
css:
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1529
|
+
css: css7`
|
|
1530
|
+
width: 100%;
|
|
1531
|
+
// InputSelect wrapper is unstylable so need a descendant selector
|
|
1532
|
+
// to full-width it
|
|
1533
|
+
& > * {
|
|
1534
|
+
width: 100%;
|
|
1535
|
+
}
|
|
1536
|
+
`,
|
|
1537
|
+
children: currentQuirk.options ? /* @__PURE__ */ jsx17(
|
|
1538
|
+
InputSelect2,
|
|
1539
|
+
{
|
|
1540
|
+
label: "quirk match value",
|
|
1541
|
+
showLabel: false,
|
|
1542
|
+
value: (_c = currentCriteria.r) != null ? _c : "",
|
|
1543
|
+
errorMessage: (_d = errors.rhs) == null ? void 0 : _d[index],
|
|
1544
|
+
onChange: (e) => update({ ...currentCriteria, r: e.currentTarget.value }, index),
|
|
1545
|
+
options: [
|
|
1546
|
+
{ label: "Select\u2026", value: "" },
|
|
1547
|
+
...currentQuirk.options.map((o) => ({ label: o.name, value: o.value }))
|
|
1548
|
+
]
|
|
1549
|
+
}
|
|
1550
|
+
) : /* @__PURE__ */ jsx17(
|
|
1551
|
+
Input2,
|
|
1456
1552
|
{
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
isDisabled: !critHasLhs,
|
|
1465
|
-
dimensions,
|
|
1466
|
-
onMenuOpen,
|
|
1467
|
-
onMenuClose
|
|
1553
|
+
type: "text",
|
|
1554
|
+
label: "quirk match value",
|
|
1555
|
+
showLabel: false,
|
|
1556
|
+
value: (_e = currentCriteria.r) != null ? _e : "",
|
|
1557
|
+
errorMessage: (_f = errors.rhs) == null ? void 0 : _f[index],
|
|
1558
|
+
onChange: (e) => update({ ...currentCriteria, r: e.currentTarget.value }, index),
|
|
1559
|
+
placeholder: "Enter a value"
|
|
1468
1560
|
}
|
|
1469
1561
|
)
|
|
1470
1562
|
}
|
|
1471
|
-
) :
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1563
|
+
) : /* @__PURE__ */ jsx17(
|
|
1564
|
+
CriteriaMatchMenu,
|
|
1565
|
+
{
|
|
1566
|
+
errorMessage: (_g = errors.rhs) == null ? void 0 : _g[index],
|
|
1567
|
+
css: expand,
|
|
1568
|
+
styles: { control: (base) => ({ ...base, height: "100%" }) },
|
|
1569
|
+
criteriaMatch: currentCriteria,
|
|
1570
|
+
onChange: (match) => {
|
|
1571
|
+
update(match, index);
|
|
1572
|
+
},
|
|
1573
|
+
isDisabled: !critHasLhs,
|
|
1574
|
+
dimensions,
|
|
1575
|
+
onMenuOpen,
|
|
1576
|
+
onMenuClose
|
|
1577
|
+
}
|
|
1578
|
+
)
|
|
1579
|
+
}
|
|
1580
|
+
) : null
|
|
1581
|
+
] }),
|
|
1475
1582
|
/* @__PURE__ */ jsx17(
|
|
1476
1583
|
"button",
|
|
1477
1584
|
{
|
|
@@ -1497,7 +1604,7 @@ var PersonalizationCriteriaStatic = ({
|
|
|
1497
1604
|
{
|
|
1498
1605
|
"data-testid": "dropdown-button-combine",
|
|
1499
1606
|
disabled: index > 1,
|
|
1500
|
-
value: (
|
|
1607
|
+
value: (_h = currentValue.op) != null ? _h : "&",
|
|
1501
1608
|
options: [
|
|
1502
1609
|
{ label: "AND", value: "&" },
|
|
1503
1610
|
{ label: "OR", value: "|" }
|
|
@@ -1729,6 +1836,7 @@ export {
|
|
|
1729
1836
|
addEnrichmentLink,
|
|
1730
1837
|
contextCriteriaMenuOperators,
|
|
1731
1838
|
convertErrorsToObj,
|
|
1839
|
+
enrichmentCriteriaMenuOperators,
|
|
1732
1840
|
isEnrichmentTagData,
|
|
1733
1841
|
isPersonalizationCriteriaData,
|
|
1734
1842
|
opHasRhs,
|