@timeax/digital-service-engine 0.3.4 → 0.3.5
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/core/index.cjs +29 -5
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +29 -5
- package/dist/core/index.js.map +1 -1
- package/dist/react/index.cjs +776 -628
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +68 -54
- package/dist/react/index.d.ts +68 -54
- package/dist/react/index.js +776 -628
- package/dist/react/index.js.map +1 -1
- package/dist/workspace/index.cjs +58 -0
- package/dist/workspace/index.cjs.map +1 -1
- package/dist/workspace/index.d.cts +131 -1
- package/dist/workspace/index.d.ts +131 -1
- package/dist/workspace/index.js +58 -0
- package/dist/workspace/index.js.map +1 -1
- package/package.json +1 -1
package/dist/core/index.js
CHANGED
|
@@ -4745,12 +4745,32 @@ function toSelectedOptionKeys(byField) {
|
|
|
4745
4745
|
}
|
|
4746
4746
|
return keys;
|
|
4747
4747
|
}
|
|
4748
|
-
function getSelectedOptionsByFieldId(selection, fieldById) {
|
|
4749
|
-
|
|
4748
|
+
function getSelectedOptionsByFieldId(selection, fieldById, mode) {
|
|
4749
|
+
var _a, _b;
|
|
4750
|
+
const collected = {};
|
|
4750
4751
|
for (const visit of buildSelectedNodeVisitOrder(selection, fieldById)) {
|
|
4751
4752
|
if (visit.kind !== "option") continue;
|
|
4752
|
-
if (!
|
|
4753
|
-
|
|
4753
|
+
if (!collected[visit.fieldId]) collected[visit.fieldId] = [];
|
|
4754
|
+
collected[visit.fieldId].push(visit.optionId);
|
|
4755
|
+
}
|
|
4756
|
+
const out = {};
|
|
4757
|
+
for (const [fieldId, optionIds] of Object.entries(collected)) {
|
|
4758
|
+
const field = fieldById.get(fieldId);
|
|
4759
|
+
if (!field) continue;
|
|
4760
|
+
const validOptionIds = new Set(
|
|
4761
|
+
((_a = field.options) != null ? _a : []).map((option) => option.id)
|
|
4762
|
+
);
|
|
4763
|
+
const dedupedValid = [];
|
|
4764
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4765
|
+
for (const optionId of optionIds) {
|
|
4766
|
+
if (!validOptionIds.has(optionId)) continue;
|
|
4767
|
+
if (seen.has(optionId)) continue;
|
|
4768
|
+
seen.add(optionId);
|
|
4769
|
+
dedupedValid.push(optionId);
|
|
4770
|
+
}
|
|
4771
|
+
const isMulti = ((_b = field.meta) == null ? void 0 : _b.multi) === true;
|
|
4772
|
+
const normalized = mode === "prod" && !isMulti ? dedupedValid.length ? [dedupedValid[dedupedValid.length - 1]] : [] : dedupedValid;
|
|
4773
|
+
if (normalized.length) out[fieldId] = normalized;
|
|
4754
4774
|
}
|
|
4755
4775
|
return out;
|
|
4756
4776
|
}
|
|
@@ -5240,7 +5260,11 @@ function buildOrderSnapshot(props, builder, selection, services, settings = {})
|
|
|
5240
5260
|
const tagById = new Map(((_e = props.filters) != null ? _e : []).map((t) => [t.id, t]));
|
|
5241
5261
|
const fieldById = new Map(((_f = props.fields) != null ? _f : []).map((f) => [f.id, f]));
|
|
5242
5262
|
const tagConstraints = (_h = (_g = tagById.get(tagId)) == null ? void 0 : _g.constraints) != null ? _h : void 0;
|
|
5243
|
-
const selectedOptionsByFieldId = getSelectedOptionsByFieldId(
|
|
5263
|
+
const selectedOptionsByFieldId = getSelectedOptionsByFieldId(
|
|
5264
|
+
selection,
|
|
5265
|
+
fieldById,
|
|
5266
|
+
mode
|
|
5267
|
+
);
|
|
5244
5268
|
const selectionFields = visibleFieldIds.map((fid) => fieldById.get(fid)).filter((f) => !!f).map((f) => {
|
|
5245
5269
|
var _a2;
|
|
5246
5270
|
const optionIds = isOptionBased(f) ? (_a2 = selectedOptionsByFieldId[f.id]) != null ? _a2 : [] : void 0;
|