@timeax/digital-service-engine 0.0.2 → 0.0.3
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 +15 -15
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +2 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +15 -15
- package/dist/core/index.js.map +1 -1
- package/dist/react/index.cjs +145 -56
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +32 -9
- package/dist/react/index.d.ts +32 -9
- package/dist/react/index.js +145 -56
- package/dist/react/index.js.map +1 -1
- package/dist/schema/index.d.cts +1 -0
- package/dist/schema/index.d.ts +1 -0
- package/dist/workspace/index.cjs +100 -23
- package/dist/workspace/index.cjs.map +1 -1
- package/dist/workspace/index.d.cts +25 -1
- package/dist/workspace/index.d.ts +25 -1
- package/dist/workspace/index.js +100 -23
- package/dist/workspace/index.js.map +1 -1
- package/package.json +106 -106
package/dist/core/index.cjs
CHANGED
|
@@ -555,13 +555,10 @@ function visibleFieldIdsUnder(props, tagId, opts = {}) {
|
|
|
555
555
|
if (order && order.length) {
|
|
556
556
|
const ordered = order.filter((fid) => visible.has(fid));
|
|
557
557
|
const orderedSet = new Set(ordered);
|
|
558
|
-
const
|
|
559
|
-
return [...ordered, ...
|
|
558
|
+
const rest = base.filter((fid) => !orderedSet.has(fid));
|
|
559
|
+
return [...ordered, ...rest];
|
|
560
560
|
}
|
|
561
|
-
|
|
562
|
-
const promotedSet = new Set(promoted);
|
|
563
|
-
const rest = base.filter((fid) => !promotedSet.has(fid));
|
|
564
|
-
return [...promoted, ...rest];
|
|
561
|
+
return base;
|
|
565
562
|
}
|
|
566
563
|
function visibleFieldsUnder(props, tagId, opts = {}) {
|
|
567
564
|
var _a;
|
|
@@ -3263,7 +3260,7 @@ function rateOk(svcMap, candidate, primary, policy) {
|
|
|
3263
3260
|
|
|
3264
3261
|
// src/utils/build-order-snapshot.ts
|
|
3265
3262
|
function buildOrderSnapshot(props, builder, selection, services, settings = {}) {
|
|
3266
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
3263
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3267
3264
|
const mode = (_a = settings.mode) != null ? _a : "prod";
|
|
3268
3265
|
const hostDefaultQty = Number.isFinite(
|
|
3269
3266
|
(_b = settings.hostDefaultQuantity) != null ? _b : 1
|
|
@@ -3277,20 +3274,18 @@ function buildOrderSnapshot(props, builder, selection, services, settings = {})
|
|
|
3277
3274
|
};
|
|
3278
3275
|
const builtAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
3279
3276
|
const tagId = selection.activeTagId;
|
|
3280
|
-
const
|
|
3281
|
-
selection.optionSelectionsByFieldId
|
|
3282
|
-
);
|
|
3277
|
+
const selectedButtonKeys = (_d = selection.selectedKeys) != null ? _d : toSelectedOptionKeys(selection.optionSelectionsByFieldId);
|
|
3283
3278
|
const visibleFieldIds = builder.visibleFields(
|
|
3284
3279
|
tagId,
|
|
3285
|
-
|
|
3280
|
+
selectedButtonKeys
|
|
3286
3281
|
);
|
|
3287
3282
|
const tagById = new Map(
|
|
3288
|
-
((
|
|
3283
|
+
((_e = props.filters) != null ? _e : []).map((t) => [t.id, t])
|
|
3289
3284
|
);
|
|
3290
3285
|
const fieldById = new Map(
|
|
3291
|
-
((
|
|
3286
|
+
((_f = props.fields) != null ? _f : []).map((f) => [f.id, f])
|
|
3292
3287
|
);
|
|
3293
|
-
const tagConstraints = (
|
|
3288
|
+
const tagConstraints = (_h = (_g = tagById.get(tagId)) == null ? void 0 : _g.constraints) != null ? _h : void 0;
|
|
3294
3289
|
const selectionFields = visibleFieldIds.map((fid) => fieldById.get(fid)).filter((f) => !!f).map((f) => {
|
|
3295
3290
|
var _a2;
|
|
3296
3291
|
const optIds = isOptionBased(f) ? (_a2 = selection.optionSelectionsByFieldId[f.id]) != null ? _a2 : [] : void 0;
|
|
@@ -3367,6 +3362,7 @@ function buildOrderSnapshot(props, builder, selection, services, settings = {})
|
|
|
3367
3362
|
builtAt,
|
|
3368
3363
|
selection: {
|
|
3369
3364
|
tag: tagId,
|
|
3365
|
+
buttons: selectedButtonKeys,
|
|
3370
3366
|
fields: selectionFields
|
|
3371
3367
|
},
|
|
3372
3368
|
inputs: {
|
|
@@ -3399,6 +3395,10 @@ function toSelectedOptionKeys(byField) {
|
|
|
3399
3395
|
}
|
|
3400
3396
|
return keys;
|
|
3401
3397
|
}
|
|
3398
|
+
function isServicedBased(field) {
|
|
3399
|
+
if (field.service_id) return true;
|
|
3400
|
+
return !!(field.options && field.options.some((item) => item.service_id));
|
|
3401
|
+
}
|
|
3402
3402
|
function buildInputs(visibleFieldIds, fieldById, selection) {
|
|
3403
3403
|
const formValues = {};
|
|
3404
3404
|
const selections = {};
|
|
@@ -3409,7 +3409,7 @@ function buildInputs(visibleFieldIds, fieldById, selection) {
|
|
|
3409
3409
|
if (selOptIds && selOptIds.length) {
|
|
3410
3410
|
selections[fid] = [...selOptIds];
|
|
3411
3411
|
}
|
|
3412
|
-
if (!
|
|
3412
|
+
if (!isServicedBased(f)) {
|
|
3413
3413
|
const name = f.name;
|
|
3414
3414
|
const val = selection.formValuesByFieldId[fid];
|
|
3415
3415
|
if (!name || val === void 0) continue;
|