Skip to content

Commit 2ca6fbf

Browse files
committed
hide "submitted" option for non REFERRAL_ENABLED_PROGRAM_IDS
1 parent f22e85c commit 2ca6fbf

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

apps/web/lib/zod/schemas/rewards.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export const REWARD_CONDITIONS: Record<
111111
},
112112
{
113113
id: "submitted",
114-
label: "qualified lead",
114+
label: "submitted lead",
115115
},
116116
{
117117
id: "trial",

apps/web/ui/partners/rewards/rewards-logic.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import { constructRewardAmount } from "@/lib/api/sales/construct-reward-amount";
44
import { getPlanCapabilities } from "@/lib/plan-capabilities";
5+
import { REFERRAL_ENABLED_PROGRAM_IDS } from "@/lib/referrals/constants";
6+
import useProgram from "@/lib/swr/use-program";
57
import useWorkspace from "@/lib/swr/use-workspace";
68
import { RECURRING_MAX_DURATIONS } from "@/lib/zod/schemas/misc";
79
import {
@@ -273,6 +275,7 @@ function ConditionLogic({
273275
conditionIndex: number;
274276
onRemove?: () => void;
275277
}) {
278+
const { program } = useProgram();
276279
const modifierKey = `modifiers.${modifierIndex}` as const;
277280
const conditionKey = `${modifierKey}.conditions.${conditionIndex}` as const;
278281

@@ -511,10 +514,20 @@ function ConditionLogic({
511514
(condition.value as string[] | undefined) ??
512515
(isArrayValue ? [] : undefined)
513516
}
514-
items={attribute.options.map(({ id, label }) => ({
515-
text: label,
516-
value: id,
517-
}))}
517+
items={attribute.options
518+
.filter(
519+
(attribute) =>
520+
isCustomerSourceCondition &&
521+
(attribute.id !== "submitted" ||
522+
(program &&
523+
REFERRAL_ENABLED_PROGRAM_IDS.includes(
524+
program.id,
525+
))),
526+
)
527+
.map(({ id, label }) => ({
528+
text: label,
529+
value: id,
530+
}))}
518531
onSelect={(value) => {
519532
setValue(conditionKey, {
520533
...condition,

0 commit comments

Comments
 (0)