Skip to content

Commit 9481570

Browse files
guitavanoclaude
andcommitted
fix(vtex): render userSegment options and give birthday its own icon
userSegment `Props` was a union of interfaces whose only discriminant (`segment`) was `@hide true`. deco wraps every block config as `{ allOf: [PropsRef], properties: { __resolveType } }`, so admins that treat `allOf` as an intersection flatten the union — the hidden discriminant collapses and only a stray field (`months`) renders, giving no way to pick a segment. Flatten `Props` to a single object with a visible `segment` enum so it renders as an options dropdown; the handler already reads `props.segment` / `props.months`, so behavior is unchanged. Also give the birthday matcher `@icon gift` (was `calendar-event`, identical to the generic Date matcher) so it has its own identity in the picker. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent a0a57a1 commit 9481570

2 files changed

Lines changed: 12 additions & 54 deletions

File tree

vtex/matchers/birthday.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export interface Props {
1616
/**
1717
* @title Birthday
1818
* @description Target users based on their birth date
19-
* @icon calendar-event
19+
* @icon gift
2020
*/
2121
const MatchBirthday = async (
2222
props: Props,

vtex/matchers/userSegment.ts

Lines changed: 11 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,26 @@
11
import { type MatchContext } from "@deco/deco/blocks";
22
import { parseAuthCookie } from "../utils/vtexId.ts";
33

4-
/** @title Anonymous without cart */
5-
interface AnonymousWithoutCart {
4+
export interface Props {
65
/**
7-
* @hide true
6+
* @title Segment
7+
* @description Anonymous without cart, Anonymous with cart, Logged in, Logged in without orders, Logged in with orders, or Logged in with recent orders
88
*/
9-
segment: "anonymous-without-cart";
10-
}
11-
12-
/** @title Anonymous with cart */
13-
interface AnonymousWithCart {
14-
/**
15-
* @hide true
16-
*/
17-
segment: "anonymous-with-cart";
18-
}
19-
20-
/** @title Logged in */
21-
interface LoggedIn {
22-
/**
23-
* @hide true
24-
*/
25-
segment: "logged-in";
26-
}
27-
28-
/** @title Logged in without orders */
29-
interface LoggedInWithoutOrders {
30-
/**
31-
* @hide true
32-
*/
33-
segment: "logged-in-without-orders";
34-
}
35-
36-
/** @title Logged in with orders */
37-
interface LoggedInWithOrders {
38-
/**
39-
* @hide true
40-
*/
41-
segment: "logged-in-with-orders";
42-
}
43-
44-
/** @title Logged in with recent orders */
45-
interface LoggedInWithRecentOrders {
46-
/**
47-
* @hide true
48-
*/
49-
segment: "logged-in-with-recent-orders";
9+
segment:
10+
| "anonymous-without-cart"
11+
| "anonymous-with-cart"
12+
| "logged-in"
13+
| "logged-in-without-orders"
14+
| "logged-in-with-orders"
15+
| "logged-in-with-recent-orders";
5016
/**
5117
* @title Months
52-
* @description Number of months to consider an order as "recent"
18+
* @description Number of months to consider an order as "recent" (only used by "Logged in with recent orders")
5319
* @default 3
5420
*/
5521
months?: number;
5622
}
5723

58-
export type Props =
59-
| AnonymousWithoutCart
60-
| AnonymousWithCart
61-
| LoggedIn
62-
| LoggedInWithoutOrders
63-
| LoggedInWithOrders
64-
| LoggedInWithRecentOrders;
65-
6624
/**
6725
* @title User Segment
6826
* @description Segment users by authentication status, cart state, and order history

0 commit comments

Comments
 (0)