@12-apps/discounts 1.6.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.6.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.3.1",
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,
@@ -243,6 +243,8 @@ export interface DiscountsActionsCopy {
243
243
  readonly deleteFailed: string;
244
244
  /** The shared snackbar's heading, over whatever an action reported. */
245
245
  readonly actionFailed: string;
246
+ /** The dismiss on that failure's toast — a glyph with no visible label. */
247
+ readonly actionFailedDismiss: string;
246
248
  }
247
249
 
248
250
  /** The two card layouts. */
@@ -287,6 +289,13 @@ export interface DiscountsWebCopy {
287
289
  */
288
290
  readonly confirmAction: ConfirmActionCopy;
289
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;
290
299
  readonly dataViews: DataViewsCopy;
291
300
  }
292
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
  );
@@ -291,6 +291,7 @@ function ScreenBody({
291
291
  tenantSlug=""
292
292
  onRefresh={refresh}
293
293
  errorTitle={copy.actions.actionFailed}
294
+ errorDismissLabel={copy.actions.actionFailedDismiss}
294
295
  >
295
296
  <DiscountsGrid
296
297
  rows={rows}
@@ -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,
@@ -163,6 +164,7 @@ export const PT_BR_DISCOUNTS_WEB_COPY: DiscountsWebCopy = {
163
164
  deleteManyDescription: "Deixam de valer na vitrine e não podem ser restaurados.",
164
165
  deleteFailed: "Não foi possível excluir o desconto.",
165
166
  actionFailed: "Não foi possível concluir a ação",
167
+ actionFailedDismiss: "Fechar o aviso",
166
168
  },
167
169
  card: {
168
170
  paused: "Pausado",
@@ -181,4 +183,5 @@ export const PT_BR_DISCOUNTS_WEB_COPY: DiscountsWebCopy = {
181
183
  confirmAction: PT_BR_CONFIRM_ACTION_COPY,
182
184
  dataViews: PT_BR_DATA_VIEWS_COPY,
183
185
  categorySelect: PT_BR_CATEGORY_SELECT_COPY,
186
+ autocomplete: PT_BR_AUTOCOMPLETE_COPY,
184
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}