@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.d.cts
CHANGED
|
@@ -251,6 +251,7 @@ type OrderSnapshot = {
|
|
|
251
251
|
builtAt: string;
|
|
252
252
|
selection: {
|
|
253
253
|
tag: string;
|
|
254
|
+
buttons: string[];
|
|
254
255
|
fields: Array<{
|
|
255
256
|
id: string;
|
|
256
257
|
type: string;
|
|
@@ -631,6 +632,7 @@ type BuildOrderSelection = {
|
|
|
631
632
|
formValuesByFieldId: Record<string, Scalar | Scalar[]>;
|
|
632
633
|
/** Option selections, keyed by fieldId → optionId[] */
|
|
633
634
|
optionSelectionsByFieldId: Record<string, string[]>;
|
|
635
|
+
selectedKeys?: string[];
|
|
634
636
|
/**
|
|
635
637
|
* Selection visit order for options (optional, improves "first option wins primary" determinism).
|
|
636
638
|
* If omitted, iteration order falls back to Object.entries(optionSelectionsByFieldId).
|
package/dist/core/index.d.ts
CHANGED
|
@@ -251,6 +251,7 @@ type OrderSnapshot = {
|
|
|
251
251
|
builtAt: string;
|
|
252
252
|
selection: {
|
|
253
253
|
tag: string;
|
|
254
|
+
buttons: string[];
|
|
254
255
|
fields: Array<{
|
|
255
256
|
id: string;
|
|
256
257
|
type: string;
|
|
@@ -631,6 +632,7 @@ type BuildOrderSelection = {
|
|
|
631
632
|
formValuesByFieldId: Record<string, Scalar | Scalar[]>;
|
|
632
633
|
/** Option selections, keyed by fieldId → optionId[] */
|
|
633
634
|
optionSelectionsByFieldId: Record<string, string[]>;
|
|
635
|
+
selectedKeys?: string[];
|
|
634
636
|
/**
|
|
635
637
|
* Selection visit order for options (optional, improves "first option wins primary" determinism).
|
|
636
638
|
* If omitted, iteration order falls back to Object.entries(optionSelectionsByFieldId).
|
package/dist/core/index.js
CHANGED
|
@@ -520,13 +520,10 @@ function visibleFieldIdsUnder(props, tagId, opts = {}) {
|
|
|
520
520
|
if (order && order.length) {
|
|
521
521
|
const ordered = order.filter((fid) => visible.has(fid));
|
|
522
522
|
const orderedSet = new Set(ordered);
|
|
523
|
-
const
|
|
524
|
-
return [...ordered, ...
|
|
523
|
+
const rest = base.filter((fid) => !orderedSet.has(fid));
|
|
524
|
+
return [...ordered, ...rest];
|
|
525
525
|
}
|
|
526
|
-
|
|
527
|
-
const promotedSet = new Set(promoted);
|
|
528
|
-
const rest = base.filter((fid) => !promotedSet.has(fid));
|
|
529
|
-
return [...promoted, ...rest];
|
|
526
|
+
return base;
|
|
530
527
|
}
|
|
531
528
|
function visibleFieldsUnder(props, tagId, opts = {}) {
|
|
532
529
|
var _a;
|
|
@@ -3228,7 +3225,7 @@ function rateOk(svcMap, candidate, primary, policy) {
|
|
|
3228
3225
|
|
|
3229
3226
|
// src/utils/build-order-snapshot.ts
|
|
3230
3227
|
function buildOrderSnapshot(props, builder, selection, services, settings = {}) {
|
|
3231
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
3228
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3232
3229
|
const mode = (_a = settings.mode) != null ? _a : "prod";
|
|
3233
3230
|
const hostDefaultQty = Number.isFinite(
|
|
3234
3231
|
(_b = settings.hostDefaultQuantity) != null ? _b : 1
|
|
@@ -3242,20 +3239,18 @@ function buildOrderSnapshot(props, builder, selection, services, settings = {})
|
|
|
3242
3239
|
};
|
|
3243
3240
|
const builtAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
3244
3241
|
const tagId = selection.activeTagId;
|
|
3245
|
-
const
|
|
3246
|
-
selection.optionSelectionsByFieldId
|
|
3247
|
-
);
|
|
3242
|
+
const selectedButtonKeys = (_d = selection.selectedKeys) != null ? _d : toSelectedOptionKeys(selection.optionSelectionsByFieldId);
|
|
3248
3243
|
const visibleFieldIds = builder.visibleFields(
|
|
3249
3244
|
tagId,
|
|
3250
|
-
|
|
3245
|
+
selectedButtonKeys
|
|
3251
3246
|
);
|
|
3252
3247
|
const tagById = new Map(
|
|
3253
|
-
((
|
|
3248
|
+
((_e = props.filters) != null ? _e : []).map((t) => [t.id, t])
|
|
3254
3249
|
);
|
|
3255
3250
|
const fieldById = new Map(
|
|
3256
|
-
((
|
|
3251
|
+
((_f = props.fields) != null ? _f : []).map((f) => [f.id, f])
|
|
3257
3252
|
);
|
|
3258
|
-
const tagConstraints = (
|
|
3253
|
+
const tagConstraints = (_h = (_g = tagById.get(tagId)) == null ? void 0 : _g.constraints) != null ? _h : void 0;
|
|
3259
3254
|
const selectionFields = visibleFieldIds.map((fid) => fieldById.get(fid)).filter((f) => !!f).map((f) => {
|
|
3260
3255
|
var _a2;
|
|
3261
3256
|
const optIds = isOptionBased(f) ? (_a2 = selection.optionSelectionsByFieldId[f.id]) != null ? _a2 : [] : void 0;
|
|
@@ -3332,6 +3327,7 @@ function buildOrderSnapshot(props, builder, selection, services, settings = {})
|
|
|
3332
3327
|
builtAt,
|
|
3333
3328
|
selection: {
|
|
3334
3329
|
tag: tagId,
|
|
3330
|
+
buttons: selectedButtonKeys,
|
|
3335
3331
|
fields: selectionFields
|
|
3336
3332
|
},
|
|
3337
3333
|
inputs: {
|
|
@@ -3364,6 +3360,10 @@ function toSelectedOptionKeys(byField) {
|
|
|
3364
3360
|
}
|
|
3365
3361
|
return keys;
|
|
3366
3362
|
}
|
|
3363
|
+
function isServicedBased(field) {
|
|
3364
|
+
if (field.service_id) return true;
|
|
3365
|
+
return !!(field.options && field.options.some((item) => item.service_id));
|
|
3366
|
+
}
|
|
3367
3367
|
function buildInputs(visibleFieldIds, fieldById, selection) {
|
|
3368
3368
|
const formValues = {};
|
|
3369
3369
|
const selections = {};
|
|
@@ -3374,7 +3374,7 @@ function buildInputs(visibleFieldIds, fieldById, selection) {
|
|
|
3374
3374
|
if (selOptIds && selOptIds.length) {
|
|
3375
3375
|
selections[fid] = [...selOptIds];
|
|
3376
3376
|
}
|
|
3377
|
-
if (!
|
|
3377
|
+
if (!isServicedBased(f)) {
|
|
3378
3378
|
const name = f.name;
|
|
3379
3379
|
const val = selection.formValuesByFieldId[fid];
|
|
3380
3380
|
if (!name || val === void 0) continue;
|