@12-apps/discounts 1.19.1 → 1.19.2
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@12-apps/discounts",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"**/e2e/**"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@12-apps/app-shell": "^5.14.1",
|
|
45
45
|
"@12-apps/forms-core": "^1.23.0",
|
|
46
46
|
"@12-apps/shared-helpers": "^2.2.0",
|
|
47
|
-
"@12-apps/ui": "^6.96.
|
|
47
|
+
"@12-apps/ui": "^6.96.2",
|
|
48
48
|
"@mui/icons-material": "^6.5.0",
|
|
49
49
|
"zod": "^4.3.5"
|
|
50
50
|
},
|
|
@@ -89,12 +89,21 @@ export function DiscountTargetPicker({
|
|
|
89
89
|
const scope = values.scope ?? "ORDER";
|
|
90
90
|
const staleTargets = errors.freeUnitsTargets !== undefined;
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
const picked = selection.comboRequirements.some((slot) => slot.menuItemIds.length > 0);
|
|
93
|
+
const productRefusal = errors.kind === copy.form.freeUnitsTargetRequired;
|
|
94
|
+
|
|
95
|
+
// `setFieldValue` clears only the key it sets, and neither the kind toggle
|
|
96
|
+
// nor a pick sets `freeUnitsTargets`: the product refusal would outlive a
|
|
97
|
+
// switch away, or the product the owner then picks, and keep the error toast
|
|
98
|
+
// up. Setting its own key drops it; the value is never read or sent. A pick
|
|
99
|
+
// also drops the same refusal from `errors.kind` (re-setting the kind it
|
|
100
|
+
// already has), but never a quantity refusal held there (FUT-4470).
|
|
95
101
|
useEffect(() => {
|
|
96
|
-
|
|
97
|
-
|
|
102
|
+
const answered = kind !== "FREE_UNITS" || picked;
|
|
103
|
+
if (!answered) return;
|
|
104
|
+
if (staleTargets) setFieldValue("freeUnitsTargets", "");
|
|
105
|
+
if (kind === "FREE_UNITS" && productRefusal) setFieldValue("kind", kind);
|
|
106
|
+
}, [kind, picked, staleTargets, productRefusal, setFieldValue]);
|
|
98
107
|
|
|
99
108
|
if (kind === "FREE_UNITS") {
|
|
100
109
|
return (
|