@12-apps/discounts 1.7.0 → 1.8.0

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.7.0",
3
+ "version": "1.8.0",
4
4
  "type": "module",
5
5
  "description": "The discount/promotion domain: a host-agnostic evaluator (percentage or fixed amount, order/category/item scope, automatic or coupon-triggered, stacking and exclusivity, integer-cent allocation) plus the admin CRUD surface as wiring-contract route descriptors over a store port. No database, no framework, no baked user copy.",
6
6
  "exports": {
@@ -31,7 +31,7 @@
31
31
  "@12-apps/app-shell": "^5.2.0",
32
32
  "@12-apps/forms-core": "^1.20.0",
33
33
  "@12-apps/shared-helpers": "^2.0.2",
34
- "@12-apps/ui": "^6.7.0",
34
+ "@12-apps/ui": "^6.8.0",
35
35
  "@mui/icons-material": "^6.5.0",
36
36
  "zod": "^4.3.5"
37
37
  },
@@ -137,6 +137,7 @@ function ComboSlotRow({
137
137
  ids={idsFor(slot, group.targetType)}
138
138
  onChange={(ids) => onChange(withIds(slot, group.targetType, ids))}
139
139
  copy={copy.categorySelect}
140
+ autocompleteCopy={copy.autocomplete}
140
141
  dataTestId={`combo-slot-${index}-${group.slug}`}
141
142
  />
142
143
  ))}
package/src/react/copy.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { CategorySelectCopy, ConfirmActionCopy } from "@12-apps/ui/copy";
1
+ import type { AutocompleteCopy, CategorySelectCopy, ConfirmActionCopy } from "@12-apps/ui/copy";
2
2
  import type { DataViewsCopy } from "@12-apps/ui/data-display/DataViews";
3
3
  import type {
4
4
  DiscountScope,
@@ -289,6 +289,13 @@ export interface DiscountsWebCopy {
289
289
  */
290
290
  readonly confirmAction: ConfirmActionCopy;
291
291
  readonly categorySelect: CategorySelectCopy;
292
+ /**
293
+ * The flat half of the target picker. A group that NESTS renders a
294
+ * `CategorySelect`; one that does not renders an `Autocomplete`, and that
295
+ * component stopped shipping defaults for its loading row, its empty row and
296
+ * its placeholder in the same wave.
297
+ */
298
+ readonly autocomplete: AutocompleteCopy;
292
299
  readonly dataViews: DataViewsCopy;
293
300
  }
294
301
 
@@ -126,6 +126,7 @@ export function DiscountTargetPicker({
126
126
  ids={ids}
127
127
  onChange={onChange}
128
128
  copy={copy.categorySelect}
129
+ autocompleteCopy={copy.autocomplete}
129
130
  dataTestId={`discount-${group.slug}-targets`}
130
131
  />
131
132
  );
@@ -157,6 +157,7 @@ export function FreeUnitsBuilder({
157
157
  ids={slot.menuItemIds}
158
158
  onChange={(ids) => onChange([{ ...slot, menuItemIds: ids }])}
159
159
  copy={copy.categorySelect}
160
+ autocompleteCopy={copy.autocomplete}
160
161
  dataTestId="free-units-items"
161
162
  />
162
163
  {error !== undefined && (
@@ -1,4 +1,5 @@
1
1
  import {
2
+ PT_BR_AUTOCOMPLETE_COPY,
2
3
  PT_BR_CATEGORY_SELECT_COPY,
3
4
  PT_BR_CONFIRM_ACTION_COPY,
4
5
  PT_BR_DATA_VIEWS_COPY,
@@ -182,4 +183,5 @@ export const PT_BR_DISCOUNTS_WEB_COPY: DiscountsWebCopy = {
182
183
  confirmAction: PT_BR_CONFIRM_ACTION_COPY,
183
184
  dataViews: PT_BR_DATA_VIEWS_COPY,
184
185
  categorySelect: PT_BR_CATEGORY_SELECT_COPY,
186
+ autocomplete: PT_BR_AUTOCOMPLETE_COPY,
185
187
  };
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import type { CategorySelectCopy } from "@12-apps/ui/copy";
3
+ import type { AutocompleteCopy, CategorySelectCopy } from "@12-apps/ui/copy";
4
4
  import { useState, type JSX } from "react";
5
5
 
6
6
  import { Autocomplete } from "@12-apps/ui/form/Autocomplete";
@@ -35,10 +35,12 @@ function TargetField({
35
35
  ids,
36
36
  onChange,
37
37
  dataTestId,
38
+ autocompleteCopy,
38
39
  }: {
39
40
  label: string;
40
41
  placeholder: string;
41
42
  requiredMessage: string | undefined;
43
+ autocompleteCopy: AutocompleteCopy;
42
44
  options: readonly WireTarget[];
43
45
  ids: readonly string[];
44
46
  onChange: (next: string[]) => void;
@@ -57,6 +59,7 @@ function TargetField({
57
59
  <FormLabel error={missing}>{label}</FormLabel>
58
60
  <div data-testid={dataTestId}>
59
61
  <Autocomplete<WireTarget>
62
+ copy={autocompleteCopy}
60
63
  multiple
61
64
  value={query}
62
65
  onChange={setQuery}
@@ -102,6 +105,7 @@ export function TargetPickerField({
102
105
  onChange,
103
106
  dataTestId,
104
107
  copy,
108
+ autocompleteCopy,
105
109
  }: {
106
110
  group: WireTargetGroup;
107
111
  label: string;
@@ -112,6 +116,8 @@ export function TargetPickerField({
112
116
  dataTestId: string;
113
117
  /** `CategorySelect`'s own words — required since FUT-760, never defaulted. */
114
118
  copy: CategorySelectCopy;
119
+ /** `Autocomplete`'s, for the flat branch. Same rule, same wave. */
120
+ autocompleteCopy: AutocompleteCopy;
115
121
  }): JSX.Element {
116
122
  if (group.nests) {
117
123
  return (
@@ -130,6 +136,7 @@ export function TargetPickerField({
130
136
  }
131
137
  return (
132
138
  <TargetField
139
+ autocompleteCopy={autocompleteCopy}
133
140
  label={label}
134
141
  placeholder={placeholder}
135
142
  requiredMessage={requiredMessage}