@uniformdev/context-ui 20.31.1-alpha.1 → 20.31.1-alpha.185
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 +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.esm.js +244 -219
- package/dist/index.js +252 -227
- package/dist/index.mjs +244 -219
- package/package.json +7 -8
package/dist/index.mjs
CHANGED
|
@@ -310,9 +310,12 @@ var quirkCriteriaMenuOperators = [
|
|
|
310
310
|
value: "!="
|
|
311
311
|
}
|
|
312
312
|
];
|
|
313
|
+
function getValidCriteriaOperatorsFor(rhsType) {
|
|
314
|
+
return rhsType === "QUIRK" ? quirkCriteriaMenuOperators : rhsType === "ENR" ? enrichmentCriteriaMenuOperators : contextCriteriaMenuOperators;
|
|
315
|
+
}
|
|
313
316
|
function CriteriaOperatorMenu({ onChange, value, rhsType, ...props }) {
|
|
314
317
|
var _a, _b;
|
|
315
|
-
const operators = rhsType
|
|
318
|
+
const operators = getValidCriteriaOperatorsFor(rhsType);
|
|
316
319
|
return /* @__PURE__ */ jsx6(
|
|
317
320
|
InputComboBox,
|
|
318
321
|
{
|
|
@@ -553,7 +556,7 @@ function useDimensionsDataContext() {
|
|
|
553
556
|
|
|
554
557
|
// src/components/DimensionMenu/CriteriaMatchMenu.tsx
|
|
555
558
|
import { InputComboBox as InputComboBox3 } from "@uniformdev/design-system";
|
|
556
|
-
import { useState as useState5 } from "react";
|
|
559
|
+
import { useEffect as useEffect4, useRef, useState as useState5 } from "react";
|
|
557
560
|
|
|
558
561
|
// src/components/DimensionMenu/DimensionGroupHeading.tsx
|
|
559
562
|
import { Icon } from "@uniformdev/design-system";
|
|
@@ -692,32 +695,38 @@ var DimensionOption = (props) => {
|
|
|
692
695
|
};
|
|
693
696
|
|
|
694
697
|
// src/components/DimensionMenu/DimensionValue.tsx
|
|
695
|
-
import {
|
|
698
|
+
import { css as css4 } from "@emotion/react";
|
|
699
|
+
import { Icon as Icon2, Tooltip } from "@uniformdev/design-system";
|
|
696
700
|
import { jsx as jsx11, jsxs as jsxs4 } from "@emotion/react/jsx-runtime";
|
|
701
|
+
var styles = {
|
|
702
|
+
dimensionValueWrapper: css4`
|
|
703
|
+
white-space: normal;
|
|
704
|
+
overflow: hidden;
|
|
705
|
+
`,
|
|
706
|
+
dimensionName: css4`
|
|
707
|
+
color: var(--gray-500);
|
|
708
|
+
display: flex;
|
|
709
|
+
align-items: center;
|
|
710
|
+
gap: var(--spacing-xs);
|
|
711
|
+
`,
|
|
712
|
+
dimensionValue: css4`
|
|
713
|
+
color: var(--gray-700);
|
|
714
|
+
text-overflow: ellipsis;
|
|
715
|
+
overflow: hidden;
|
|
716
|
+
white-space: nowrap;
|
|
717
|
+
`
|
|
718
|
+
};
|
|
697
719
|
function DimensionValue({ displayName }) {
|
|
720
|
+
var _a;
|
|
698
721
|
const { type, name } = dimensionDisplayName(displayName);
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
{
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
type ? /* @__PURE__ */ jsxs4(
|
|
708
|
-
"small",
|
|
709
|
-
{
|
|
710
|
-
css: { color: "var(--gray-500)", display: "flex", alignItems: "center", gap: "var(--spacing-xs)" },
|
|
711
|
-
children: [
|
|
712
|
-
type ? /* @__PURE__ */ jsx11(Icon2, { icon: dimensionIcon(type), iconColor: "currentColor", size: 16 }) : null,
|
|
713
|
-
/* @__PURE__ */ jsx11("span", { "data-testid": "dimension-name", children: type })
|
|
714
|
-
]
|
|
715
|
-
}
|
|
716
|
-
) : null,
|
|
717
|
-
/* @__PURE__ */ jsx11("div", { css: { color: "var(--gray-700)" }, "data-testid": "dimension-value", children: name != null ? name : type })
|
|
718
|
-
]
|
|
719
|
-
}
|
|
720
|
-
);
|
|
722
|
+
const tooltip = (_a = name != null ? name : type) != null ? _a : "";
|
|
723
|
+
return /* @__PURE__ */ jsxs4("div", { css: styles.dimensionValueWrapper, children: [
|
|
724
|
+
type ? /* @__PURE__ */ jsxs4("small", { css: styles.dimensionName, children: [
|
|
725
|
+
type ? /* @__PURE__ */ jsx11(Icon2, { icon: dimensionIcon(type), iconColor: "currentColor", size: 16 }) : null,
|
|
726
|
+
/* @__PURE__ */ jsx11("span", { "data-testid": "dimension-name", children: type })
|
|
727
|
+
] }) : null,
|
|
728
|
+
/* @__PURE__ */ jsx11(Tooltip, { title: tooltip, children: /* @__PURE__ */ jsx11("div", { css: styles.dimensionValue, "data-testid": "dimension-value", children: name != null ? name : type }) })
|
|
729
|
+
] });
|
|
721
730
|
}
|
|
722
731
|
|
|
723
732
|
// src/components/DimensionMenu/DimensionSingleValue.tsx
|
|
@@ -740,6 +749,15 @@ function CriteriaMatchMenu({
|
|
|
740
749
|
const [inputValue, setInputValue] = useState5(
|
|
741
750
|
typeof criteriaMatch.r !== "undefined" && isInt(criteriaMatch.r) !== null ? criteriaMatch.r.toString(10) : ""
|
|
742
751
|
);
|
|
752
|
+
const currentInputValue = useRef(inputValue);
|
|
753
|
+
currentInputValue.current = inputValue;
|
|
754
|
+
useEffect4(() => {
|
|
755
|
+
if (currentInputValue.current !== criteriaMatch.r && !criteriaMatch.rDim) {
|
|
756
|
+
setInputValue(
|
|
757
|
+
typeof criteriaMatch.r !== "undefined" && isInt(criteriaMatch.r) !== null ? criteriaMatch.r.toString(10) : ""
|
|
758
|
+
);
|
|
759
|
+
}
|
|
760
|
+
}, [criteriaMatch.r, criteriaMatch.rDim]);
|
|
743
761
|
const rDim = criteriaMatch.rDim;
|
|
744
762
|
const targetDim = criteriaMatch.rDim ? dimensions.dimIndex[criteriaMatch.rDim] : void 0;
|
|
745
763
|
const groupedDimensions = useGroupedDimensions(dimensions.dimensions, void 0);
|
|
@@ -893,8 +911,8 @@ import { CgChevronRight } from "@react-icons/all-files/cg/CgChevronRight";
|
|
|
893
911
|
import { Icon as Icon3 } from "@uniformdev/design-system";
|
|
894
912
|
|
|
895
913
|
// src/components/EditLink/EditLink.styles.ts
|
|
896
|
-
import { css as
|
|
897
|
-
var editLink =
|
|
914
|
+
import { css as css5 } from "@emotion/react";
|
|
915
|
+
var editLink = css5`
|
|
898
916
|
display: flex;
|
|
899
917
|
align-items: center;
|
|
900
918
|
font-weight: var(--fw-bold);
|
|
@@ -927,7 +945,7 @@ var EditLink = ({ linkTo, name, linkText = `Edit ${name} Component` }) => {
|
|
|
927
945
|
};
|
|
928
946
|
|
|
929
947
|
// src/components/EnrichmentTag/EnrichmentTag.tsx
|
|
930
|
-
import { css as
|
|
948
|
+
import { css as css6 } from "@emotion/react";
|
|
931
949
|
import { CgCloseO } from "@react-icons/all-files/cg/CgCloseO";
|
|
932
950
|
import { CgMathMinus } from "@react-icons/all-files/cg/CgMathMinus";
|
|
933
951
|
import { CgMathPlus } from "@react-icons/all-files/cg/CgMathPlus";
|
|
@@ -944,7 +962,7 @@ import {
|
|
|
944
962
|
import { produce } from "immer";
|
|
945
963
|
import { useMemo as useMemo2, useState as useState6 } from "react";
|
|
946
964
|
import { Fragment as Fragment5, jsx as jsx16, jsxs as jsxs8 } from "@emotion/react/jsx-runtime";
|
|
947
|
-
var addEnrichmentLink =
|
|
965
|
+
var addEnrichmentLink = css6`
|
|
948
966
|
flex: 2;
|
|
949
967
|
display: flex;
|
|
950
968
|
width: 50%;
|
|
@@ -1133,7 +1151,7 @@ var NoEnrichmentsView = ({ contextConfig }) => /* @__PURE__ */ jsx16(Callout2, {
|
|
|
1133
1151
|
var getCappedValue = (value, maxCap = 100, minCap = 0) => {
|
|
1134
1152
|
return Math.max(Math.min(value, maxCap), minCap);
|
|
1135
1153
|
};
|
|
1136
|
-
var scoreCounterMinusButtonStyles =
|
|
1154
|
+
var scoreCounterMinusButtonStyles = css6`
|
|
1137
1155
|
position: absolute;
|
|
1138
1156
|
bottom: 0.875rem;
|
|
1139
1157
|
left: var(--spacing-sm);
|
|
@@ -1146,7 +1164,7 @@ var scoreCounterMinusButtonStyles = css5`
|
|
|
1146
1164
|
border: 1px solid var(--gray-300);
|
|
1147
1165
|
border-radius: var(--rounded-full);
|
|
1148
1166
|
`;
|
|
1149
|
-
var scoreCounterPlusButtonStyles =
|
|
1167
|
+
var scoreCounterPlusButtonStyles = css6`
|
|
1150
1168
|
${scoreCounterMinusButtonStyles}
|
|
1151
1169
|
left: auto;
|
|
1152
1170
|
right: var(--spacing-sm);
|
|
@@ -1310,7 +1328,7 @@ function opHasRhs(op) {
|
|
|
1310
1328
|
}
|
|
1311
1329
|
|
|
1312
1330
|
// src/components/PersonalizationCriteria/PersonalizationCriteriaStatic.tsx
|
|
1313
|
-
import { css as
|
|
1331
|
+
import { css as css8 } from "@emotion/react";
|
|
1314
1332
|
import { CgCloseO as CgCloseO2 } from "@react-icons/all-files/cg/CgCloseO";
|
|
1315
1333
|
import {
|
|
1316
1334
|
AddListButton as AddListButton3,
|
|
@@ -1320,19 +1338,20 @@ import {
|
|
|
1320
1338
|
Input as Input2,
|
|
1321
1339
|
InputInlineSelect,
|
|
1322
1340
|
InputSelect as InputSelect2,
|
|
1323
|
-
Paragraph
|
|
1341
|
+
Paragraph,
|
|
1342
|
+
VerticalRhythm
|
|
1324
1343
|
} from "@uniformdev/design-system";
|
|
1325
1344
|
import { produce as produce2 } from "immer";
|
|
1326
1345
|
|
|
1327
1346
|
// src/components/PersonalizationCriteria/PersonalizationCriteriaStatic.styles.ts
|
|
1328
|
-
import { css as
|
|
1347
|
+
import { css as css7 } from "@emotion/react";
|
|
1329
1348
|
var spaceBetweenCriteriaItems = "6rem";
|
|
1330
|
-
var criteriaItem =
|
|
1349
|
+
var criteriaItem = css7`
|
|
1331
1350
|
position: relative;
|
|
1332
1351
|
padding: var(--spacing-md) var(--spacing-base);
|
|
1333
1352
|
border: 1px solid var(--gray-300);
|
|
1334
|
-
box-shadow: var(--
|
|
1335
|
-
background-color: white;
|
|
1353
|
+
box-shadow: var(--elevation-200);
|
|
1354
|
+
background-color: var(--white);
|
|
1336
1355
|
border-radius: var(--rounded-base);
|
|
1337
1356
|
margin-top: ${spaceBetweenCriteriaItems};
|
|
1338
1357
|
display: flex;
|
|
@@ -1349,13 +1368,13 @@ var criteriaItem = css6`
|
|
|
1349
1368
|
}
|
|
1350
1369
|
|
|
1351
1370
|
&:first-of-type {
|
|
1352
|
-
margin-top:
|
|
1371
|
+
margin-top: 0;
|
|
1353
1372
|
&:before {
|
|
1354
1373
|
display: none;
|
|
1355
1374
|
}
|
|
1356
1375
|
}
|
|
1357
1376
|
`;
|
|
1358
|
-
var criteriaItemInner =
|
|
1377
|
+
var criteriaItemInner = css7`
|
|
1359
1378
|
display: flex;
|
|
1360
1379
|
row-gap: var(--spacing-base);
|
|
1361
1380
|
column-gap: var(--spacing-xs);
|
|
@@ -1363,23 +1382,23 @@ var criteriaItemInner = css6`
|
|
|
1363
1382
|
flex-wrap: wrap;
|
|
1364
1383
|
margin-right: var(--spacing-base);
|
|
1365
1384
|
`;
|
|
1366
|
-
var criteriaWrapper =
|
|
1385
|
+
var criteriaWrapper = css7`
|
|
1367
1386
|
width: 100%;
|
|
1368
1387
|
display: flex;
|
|
1369
1388
|
align-items: stretch;
|
|
1370
1389
|
position: relative;
|
|
1371
1390
|
`;
|
|
1372
|
-
var criteriaOperandWrapper =
|
|
1391
|
+
var criteriaOperandWrapper = css7`
|
|
1373
1392
|
flex: 2;
|
|
1374
1393
|
height: 52px;
|
|
1375
1394
|
min-width: 200px;
|
|
1376
1395
|
`;
|
|
1377
|
-
var criteriaOperatorWrapper =
|
|
1396
|
+
var criteriaOperatorWrapper = css7`
|
|
1378
1397
|
flex: 1;
|
|
1379
1398
|
flex-wrap: nowrap;
|
|
1380
1399
|
min-width: 80px;
|
|
1381
1400
|
`;
|
|
1382
|
-
var expand =
|
|
1401
|
+
var expand = css7`
|
|
1383
1402
|
height: 100%;
|
|
1384
1403
|
width: 100%;
|
|
1385
1404
|
`;
|
|
@@ -1443,192 +1462,197 @@ var PersonalizationCriteriaStatic = ({
|
|
|
1443
1462
|
children: /* @__PURE__ */ jsx17(Heading2, { level: 5, withMarginBottom: false, children: "Personalization Variation" })
|
|
1444
1463
|
}
|
|
1445
1464
|
) : null,
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
/* @__PURE__ */ jsxs9("div", { css:
|
|
1465
|
+
/* @__PURE__ */ jsxs9(VerticalRhythm, { children: [
|
|
1466
|
+
(components == null ? void 0 : components.CustomVariantName) ? /* @__PURE__ */ jsx17(components.CustomVariantName, {}) : null,
|
|
1467
|
+
(components == null ? void 0 : components.ControlPercentage) ? /* @__PURE__ */ jsx17(components.ControlPercentage, {}) : null,
|
|
1468
|
+
!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) => {
|
|
1469
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
1470
|
+
const critHasLhs = ((_a2 = currentCriteria.l) == null ? void 0 : _a2.length) > 0;
|
|
1471
|
+
const critHasRhs = opHasRhs(currentCriteria.op);
|
|
1472
|
+
const selectedValueIsQuirk = "t" in currentCriteria && currentCriteria.t === "q";
|
|
1473
|
+
const currentDimension = selectedValueIsQuirk ? void 0 : dimensions.dimIndex[currentCriteria.l];
|
|
1474
|
+
const currentQuirk = selectedValueIsQuirk ? quirks == null ? void 0 : quirks.find((q) => q.id === currentCriteria.l) : void 0;
|
|
1475
|
+
return /* @__PURE__ */ jsxs9("div", { css: criteriaItem, "data-testid": "criteria-container", children: [
|
|
1476
|
+
/* @__PURE__ */ jsxs9("div", { css: criteriaItemInner, className: "criteriaItemInner", children: [
|
|
1477
|
+
/* @__PURE__ */ jsx17(
|
|
1478
|
+
"div",
|
|
1479
|
+
{
|
|
1480
|
+
css: [criteriaWrapper, criteriaOperandWrapper],
|
|
1481
|
+
className: "criteria-wrapper",
|
|
1482
|
+
"data-testid": "select-criteria",
|
|
1483
|
+
children: /* @__PURE__ */ jsx17(
|
|
1484
|
+
DimensionMenu,
|
|
1485
|
+
{
|
|
1486
|
+
errorMessage: (_b = errors.lhs) == null ? void 0 : _b[index],
|
|
1487
|
+
css: expand,
|
|
1488
|
+
styles: { control: (base) => ({ ...base, height: "100%" }) },
|
|
1489
|
+
dimensions: dimensions.dimensions,
|
|
1490
|
+
quirks,
|
|
1491
|
+
onChange: (selection) => {
|
|
1492
|
+
if (!selection) {
|
|
1493
|
+
return;
|
|
1494
|
+
}
|
|
1495
|
+
if ("dim" in selection) {
|
|
1496
|
+
const validOperators = getValidCriteriaOperatorsFor(selection.category);
|
|
1497
|
+
const existingOpRemainsValid = !("t" in currentCriteria && currentCriteria.t === "q") && validOperators.some((op) => op.value === currentCriteria.op);
|
|
1498
|
+
const newCriteria = {
|
|
1499
|
+
...currentCriteria,
|
|
1500
|
+
l: selection.dim,
|
|
1501
|
+
t: void 0,
|
|
1502
|
+
op: existingOpRemainsValid ? currentCriteria.op : ">",
|
|
1503
|
+
r: existingOpRemainsValid ? currentCriteria.r : 0,
|
|
1504
|
+
rDim: existingOpRemainsValid ? currentCriteria.rDim : void 0
|
|
1505
|
+
};
|
|
1506
|
+
update(newCriteria, index);
|
|
1507
|
+
} else {
|
|
1508
|
+
update({ ...currentCriteria, l: selection.id, t: "q", op: "=", r: "" }, index);
|
|
1509
|
+
}
|
|
1510
|
+
},
|
|
1511
|
+
value: currentDimension != null ? currentDimension : currentQuirk,
|
|
1512
|
+
onMenuOpen,
|
|
1513
|
+
onMenuClose
|
|
1514
|
+
}
|
|
1515
|
+
)
|
|
1516
|
+
}
|
|
1517
|
+
),
|
|
1518
|
+
/* @__PURE__ */ jsx17(
|
|
1519
|
+
"div",
|
|
1520
|
+
{
|
|
1521
|
+
css: [criteriaWrapper, criteriaOperatorWrapper],
|
|
1522
|
+
className: "criteria-wrapper",
|
|
1523
|
+
"data-testid": "select-operator",
|
|
1524
|
+
children: /* @__PURE__ */ jsx17(
|
|
1525
|
+
CriteriaOperatorMenu,
|
|
1526
|
+
{
|
|
1527
|
+
name: `op-${index}`,
|
|
1528
|
+
css: expand,
|
|
1529
|
+
styles: { control: (base) => ({ ...base, height: "100%" }) },
|
|
1530
|
+
value: currentCriteria.op,
|
|
1531
|
+
rhsType: currentQuirk ? "QUIRK" : currentDimension == null ? void 0 : currentDimension.category,
|
|
1532
|
+
onChange: (op) => {
|
|
1533
|
+
if (op === "+" || op === "-") {
|
|
1534
|
+
update({ ...currentCriteria, op, r: void 0, rDim: void 0 }, index);
|
|
1535
|
+
} else {
|
|
1536
|
+
update({ ...currentCriteria, op }, index);
|
|
1537
|
+
}
|
|
1538
|
+
},
|
|
1539
|
+
onMenuOpen,
|
|
1540
|
+
onMenuClose
|
|
1541
|
+
}
|
|
1542
|
+
)
|
|
1543
|
+
}
|
|
1544
|
+
),
|
|
1545
|
+
critHasRhs ? /* @__PURE__ */ jsx17(
|
|
1546
|
+
"div",
|
|
1547
|
+
{
|
|
1548
|
+
css: [criteriaWrapper, criteriaOperandWrapper],
|
|
1549
|
+
className: "criteria-wrapper",
|
|
1550
|
+
"data-testid": "select-match-criteria",
|
|
1551
|
+
children: currentQuirk ? /* @__PURE__ */ jsx17(
|
|
1552
|
+
"div",
|
|
1553
|
+
{
|
|
1554
|
+
css: css8`
|
|
1555
|
+
width: 100%;
|
|
1556
|
+
// InputSelect wrapper is unstylable so need a descendant selector
|
|
1557
|
+
// to full-width it
|
|
1558
|
+
& > * {
|
|
1559
|
+
width: 100%;
|
|
1560
|
+
}
|
|
1561
|
+
`,
|
|
1562
|
+
children: currentQuirk.options ? /* @__PURE__ */ jsx17(
|
|
1563
|
+
InputSelect2,
|
|
1564
|
+
{
|
|
1565
|
+
label: "quirk match value",
|
|
1566
|
+
showLabel: false,
|
|
1567
|
+
value: (_c = currentCriteria.r) != null ? _c : "",
|
|
1568
|
+
errorMessage: (_d = errors.rhs) == null ? void 0 : _d[index],
|
|
1569
|
+
onChange: (e) => update({ ...currentCriteria, r: e.currentTarget.value }, index),
|
|
1570
|
+
options: [
|
|
1571
|
+
{ label: "Select\u2026", value: "" },
|
|
1572
|
+
...currentQuirk.options.map((o) => ({ label: o.name, value: o.value }))
|
|
1573
|
+
]
|
|
1574
|
+
}
|
|
1575
|
+
) : /* @__PURE__ */ jsx17(
|
|
1576
|
+
Input2,
|
|
1577
|
+
{
|
|
1578
|
+
type: "text",
|
|
1579
|
+
label: "quirk match value",
|
|
1580
|
+
showLabel: false,
|
|
1581
|
+
value: (_e = currentCriteria.r) != null ? _e : "",
|
|
1582
|
+
errorMessage: (_f = errors.rhs) == null ? void 0 : _f[index],
|
|
1583
|
+
onChange: (e) => update({ ...currentCriteria, r: e.currentTarget.value }, index),
|
|
1584
|
+
placeholder: "Enter a value"
|
|
1585
|
+
}
|
|
1586
|
+
)
|
|
1587
|
+
}
|
|
1588
|
+
) : /* @__PURE__ */ jsx17(
|
|
1589
|
+
CriteriaMatchMenu,
|
|
1590
|
+
{
|
|
1591
|
+
errorMessage: (_g = errors.rhs) == null ? void 0 : _g[index],
|
|
1592
|
+
css: expand,
|
|
1593
|
+
styles: { control: (base) => ({ ...base, height: "100%" }) },
|
|
1594
|
+
criteriaMatch: currentCriteria,
|
|
1595
|
+
onChange: (match) => {
|
|
1596
|
+
update(match, index);
|
|
1597
|
+
},
|
|
1598
|
+
isDisabled: !critHasLhs,
|
|
1599
|
+
dimensions,
|
|
1600
|
+
onMenuOpen,
|
|
1601
|
+
onMenuClose
|
|
1602
|
+
}
|
|
1603
|
+
)
|
|
1604
|
+
}
|
|
1605
|
+
) : null
|
|
1606
|
+
] }),
|
|
1457
1607
|
/* @__PURE__ */ jsx17(
|
|
1458
|
-
"
|
|
1608
|
+
"button",
|
|
1459
1609
|
{
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
errorMessage: (_b = errors.lhs) == null ? void 0 : _b[index],
|
|
1467
|
-
css: expand,
|
|
1468
|
-
styles: { control: (base) => ({ ...base, height: "100%" }) },
|
|
1469
|
-
dimensions: dimensions.dimensions,
|
|
1470
|
-
quirks,
|
|
1471
|
-
onChange: (selection) => {
|
|
1472
|
-
if (!selection) {
|
|
1473
|
-
return;
|
|
1474
|
-
}
|
|
1475
|
-
if ("dim" in selection) {
|
|
1476
|
-
const newCriteria = {
|
|
1477
|
-
...currentCriteria,
|
|
1478
|
-
l: selection.dim,
|
|
1479
|
-
t: void 0,
|
|
1480
|
-
op: ">",
|
|
1481
|
-
r: 0
|
|
1482
|
-
};
|
|
1483
|
-
update(newCriteria, index);
|
|
1484
|
-
} else {
|
|
1485
|
-
update({ ...currentCriteria, l: selection.id, t: "q", op: "=", r: "" }, index);
|
|
1486
|
-
}
|
|
1487
|
-
},
|
|
1488
|
-
value: currentDimension != null ? currentDimension : currentQuirk,
|
|
1489
|
-
onMenuOpen,
|
|
1490
|
-
onMenuClose
|
|
1491
|
-
}
|
|
1492
|
-
)
|
|
1610
|
+
type: "button",
|
|
1611
|
+
onClick: () => removeFromList(index),
|
|
1612
|
+
title: `Delete Personalization`,
|
|
1613
|
+
css: { backgroundColor: "transparent", backgroundImage: "none", borderWidth: 0 },
|
|
1614
|
+
"data-testid": "button-delete",
|
|
1615
|
+
children: /* @__PURE__ */ jsx17(Icon5, { icon: CgCloseO2, iconColor: "red", size: "1.5rem" })
|
|
1493
1616
|
}
|
|
1494
1617
|
),
|
|
1495
|
-
/* @__PURE__ */ jsx17(
|
|
1618
|
+
index > 0 ? /* @__PURE__ */ jsx17(
|
|
1496
1619
|
"div",
|
|
1497
1620
|
{
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1621
|
+
className: "criteria-group-operation",
|
|
1622
|
+
css: {
|
|
1623
|
+
position: "absolute",
|
|
1624
|
+
top: "-4rem",
|
|
1625
|
+
transform: "translateX(calc(1.5rem - 50%))"
|
|
1626
|
+
},
|
|
1501
1627
|
children: /* @__PURE__ */ jsx17(
|
|
1502
|
-
|
|
1628
|
+
InputInlineSelect,
|
|
1503
1629
|
{
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
}
|
|
1515
|
-
},
|
|
1516
|
-
onMenuOpen,
|
|
1517
|
-
onMenuClose
|
|
1518
|
-
}
|
|
1519
|
-
)
|
|
1520
|
-
}
|
|
1521
|
-
),
|
|
1522
|
-
critHasRhs ? /* @__PURE__ */ jsx17(
|
|
1523
|
-
"div",
|
|
1524
|
-
{
|
|
1525
|
-
css: [criteriaWrapper, criteriaOperandWrapper],
|
|
1526
|
-
className: "criteria-wrapper",
|
|
1527
|
-
"data-testid": "select-match-criteria",
|
|
1528
|
-
children: currentQuirk ? /* @__PURE__ */ jsx17(
|
|
1529
|
-
"div",
|
|
1530
|
-
{
|
|
1531
|
-
css: css7`
|
|
1532
|
-
width: 100%;
|
|
1533
|
-
// InputSelect wrapper is unstylable so need a descendant selector
|
|
1534
|
-
// to full-width it
|
|
1535
|
-
& > * {
|
|
1536
|
-
width: 100%;
|
|
1537
|
-
}
|
|
1538
|
-
`,
|
|
1539
|
-
children: currentQuirk.options ? /* @__PURE__ */ jsx17(
|
|
1540
|
-
InputSelect2,
|
|
1541
|
-
{
|
|
1542
|
-
label: "quirk match value",
|
|
1543
|
-
showLabel: false,
|
|
1544
|
-
value: (_c = currentCriteria.r) != null ? _c : "",
|
|
1545
|
-
errorMessage: (_d = errors.rhs) == null ? void 0 : _d[index],
|
|
1546
|
-
onChange: (e) => update({ ...currentCriteria, r: e.currentTarget.value }, index),
|
|
1547
|
-
options: [
|
|
1548
|
-
{ label: "Select\u2026", value: "" },
|
|
1549
|
-
...currentQuirk.options.map((o) => ({ label: o.name, value: o.value }))
|
|
1550
|
-
]
|
|
1551
|
-
}
|
|
1552
|
-
) : /* @__PURE__ */ jsx17(
|
|
1553
|
-
Input2,
|
|
1554
|
-
{
|
|
1555
|
-
type: "text",
|
|
1556
|
-
label: "quirk match value",
|
|
1557
|
-
showLabel: false,
|
|
1558
|
-
value: (_e = currentCriteria.r) != null ? _e : "",
|
|
1559
|
-
errorMessage: (_f = errors.rhs) == null ? void 0 : _f[index],
|
|
1560
|
-
onChange: (e) => update({ ...currentCriteria, r: e.currentTarget.value }, index),
|
|
1561
|
-
placeholder: "Enter a value"
|
|
1562
|
-
}
|
|
1563
|
-
)
|
|
1564
|
-
}
|
|
1565
|
-
) : /* @__PURE__ */ jsx17(
|
|
1566
|
-
CriteriaMatchMenu,
|
|
1567
|
-
{
|
|
1568
|
-
errorMessage: (_g = errors.rhs) == null ? void 0 : _g[index],
|
|
1569
|
-
css: expand,
|
|
1570
|
-
styles: { control: (base) => ({ ...base, height: "100%" }) },
|
|
1571
|
-
criteriaMatch: currentCriteria,
|
|
1572
|
-
onChange: (match) => {
|
|
1573
|
-
update(match, index);
|
|
1574
|
-
},
|
|
1575
|
-
isDisabled: !critHasLhs,
|
|
1576
|
-
dimensions,
|
|
1577
|
-
onMenuOpen,
|
|
1578
|
-
onMenuClose
|
|
1630
|
+
"data-testid": "dropdown-button-combine",
|
|
1631
|
+
disabled: index > 1,
|
|
1632
|
+
value: (_h = currentValue.op) != null ? _h : "&",
|
|
1633
|
+
options: [
|
|
1634
|
+
{ label: "AND", value: "&" },
|
|
1635
|
+
{ label: "OR", value: "|" }
|
|
1636
|
+
],
|
|
1637
|
+
onChange: (v) => {
|
|
1638
|
+
setOp(v.value);
|
|
1639
|
+
}
|
|
1579
1640
|
}
|
|
1580
1641
|
)
|
|
1581
1642
|
}
|
|
1582
1643
|
) : null
|
|
1583
|
-
] })
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
index > 0 ? /* @__PURE__ */ jsx17(
|
|
1596
|
-
"div",
|
|
1597
|
-
{
|
|
1598
|
-
className: "criteria-group-operation",
|
|
1599
|
-
css: {
|
|
1600
|
-
position: "absolute",
|
|
1601
|
-
top: "-4rem",
|
|
1602
|
-
transform: "translateX(calc(1.5rem - 50%))"
|
|
1603
|
-
},
|
|
1604
|
-
children: /* @__PURE__ */ jsx17(
|
|
1605
|
-
InputInlineSelect,
|
|
1606
|
-
{
|
|
1607
|
-
"data-testid": "dropdown-button-combine",
|
|
1608
|
-
disabled: index > 1,
|
|
1609
|
-
value: (_h = currentValue.op) != null ? _h : "&",
|
|
1610
|
-
options: [
|
|
1611
|
-
{ label: "AND", value: "&" },
|
|
1612
|
-
{ label: "OR", value: "|" }
|
|
1613
|
-
],
|
|
1614
|
-
onChange: (v) => {
|
|
1615
|
-
setOp(v.value);
|
|
1616
|
-
}
|
|
1617
|
-
}
|
|
1618
|
-
)
|
|
1619
|
-
}
|
|
1620
|
-
) : null
|
|
1621
|
-
] }, index);
|
|
1622
|
-
}) }),
|
|
1623
|
-
dimensions.dimensions.length === 0 && !(quirks == null ? void 0 : quirks.length) ? (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(
|
|
1624
|
-
AddListButton3,
|
|
1625
|
-
{
|
|
1626
|
-
"data-testid": "button-add-criteria",
|
|
1627
|
-
className: "add-more",
|
|
1628
|
-
buttonText: "Add Criteria",
|
|
1629
|
-
onButtonClick: addToList
|
|
1630
|
-
}
|
|
1631
|
-
)
|
|
1644
|
+
] }, index);
|
|
1645
|
+
}) }),
|
|
1646
|
+
dimensions.dimensions.length === 0 && !(quirks == null ? void 0 : quirks.length) ? (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(
|
|
1647
|
+
AddListButton3,
|
|
1648
|
+
{
|
|
1649
|
+
"data-testid": "button-add-criteria",
|
|
1650
|
+
className: "add-more",
|
|
1651
|
+
buttonText: "Add Criteria",
|
|
1652
|
+
onButtonClick: addToList
|
|
1653
|
+
}
|
|
1654
|
+
)
|
|
1655
|
+
] })
|
|
1632
1656
|
] });
|
|
1633
1657
|
};
|
|
1634
1658
|
|
|
@@ -1757,7 +1781,7 @@ function ProjectUIVersion({ children, versionMap, contextConfig }) {
|
|
|
1757
1781
|
}
|
|
1758
1782
|
|
|
1759
1783
|
// src/hooks/useValidateContextConfig.ts
|
|
1760
|
-
import { useEffect as
|
|
1784
|
+
import { useEffect as useEffect5, useState as useState8 } from "react";
|
|
1761
1785
|
|
|
1762
1786
|
// src/utils/validateContextConfig.ts
|
|
1763
1787
|
import { UncachedManifestClient } from "@uniformdev/context/api";
|
|
@@ -1798,7 +1822,7 @@ var useValidateContextConfig = (contextConfig) => {
|
|
|
1798
1822
|
error: void 0
|
|
1799
1823
|
});
|
|
1800
1824
|
const { apiKey, apiHost, projectId } = contextConfig || {};
|
|
1801
|
-
|
|
1825
|
+
useEffect5(() => {
|
|
1802
1826
|
if (!apiKey || !apiHost) {
|
|
1803
1827
|
return;
|
|
1804
1828
|
}
|
|
@@ -1839,6 +1863,7 @@ export {
|
|
|
1839
1863
|
contextCriteriaMenuOperators,
|
|
1840
1864
|
convertErrorsToObj,
|
|
1841
1865
|
enrichmentCriteriaMenuOperators,
|
|
1866
|
+
getValidCriteriaOperatorsFor,
|
|
1842
1867
|
isEnrichmentTagData,
|
|
1843
1868
|
isPersonalizationCriteriaData,
|
|
1844
1869
|
opHasRhs,
|