@managesome/eposmatic-toolkit 0.2.282 → 0.2.283
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.
|
@@ -230,6 +230,8 @@ function convertCatalogItemModifierToOrderEngineItemModifier({ modifiers, orderI
|
|
|
230
230
|
if (excludeRefs != null && excludeRefs.includes(modifier.ref))
|
|
231
231
|
continue;
|
|
232
232
|
const orderItemModifier = orderItemModifiers?.find((orderModifier) => orderModifier._id === modifier._id);
|
|
233
|
+
const hasOrderItemSelectedOptions = orderItemModifier != null && orderItemModifier.options.length > 0;
|
|
234
|
+
const maxDefaultSelections = modifier.max_aggregate_options_quantity ?? modifier.max_num_options ?? modifier.options.length;
|
|
233
235
|
const orderEngineSingleModifier = {
|
|
234
236
|
...modifier,
|
|
235
237
|
depth,
|
|
@@ -249,11 +251,12 @@ function convertCatalogItemModifierToOrderEngineItemModifier({ modifiers, orderI
|
|
|
249
251
|
const isSoldout = option.sold_out.includes(tenantId) || soldoutModifiers?.includes(option.ref);
|
|
250
252
|
let isDefaultOption = false;
|
|
251
253
|
if (!isSoldout && option.active) {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
+
// In edit flow, use persisted selections as the source of truth.
|
|
255
|
+
if (hasOrderItemSelectedOptions) {
|
|
256
|
+
isDefaultOption = _id != null;
|
|
254
257
|
}
|
|
255
258
|
else {
|
|
256
|
-
isDefaultOption = Boolean(option.default) && totalDefaultOptions <
|
|
259
|
+
isDefaultOption = Boolean(option.default) && totalDefaultOptions < maxDefaultSelections;
|
|
257
260
|
}
|
|
258
261
|
}
|
|
259
262
|
if (isDefaultOption) {
|