Invite people after review, then finish the Rule, with login before inviting and Invite your members on Profile.

This commit is contained in:
adilallo committed 2026-11-06 08:56:13 -07:00
1 parent 88bfccd1e7
commit 70ceb73104
31 files changed
+1388 -401

No files matched your search

+43
View File
@@ -0,0 +1,43 @@
import type { CreateFlowState } from "../../app/(app)/create/types";
import { RULE_SECTION_CATEGORY } from "./ruleSectionsFromMethodSelections";
import {
membershipPresetFor,
publishedMethodDisplayLabel,
} from "./finalReviewChipPresets";
export type MembershipInvitePreview = {
categoryName: string;
title: string;
eligibility: string;
joiningProcess: string;
};
/** First selected membership method, for the Invite your members card. */
export function membershipInvitePreview(
state: CreateFlowState,
): MembershipInvitePreview | null {
const ids = state.selectedMembershipMethodIds ?? [];
const firstId = ids.find((id) => typeof id === "string" && id.trim() !== "");
if (!firstId) return null;
const saved = state.membershipMethodDetailsById?.[firstId];
const preset = membershipPresetFor(firstId);
const eligibility = (saved?.eligibility ?? "").trim() || preset.eligibility;
const joiningProcess =
(saved?.joiningProcess ?? "").trim() || preset.joiningProcess;
const title =
publishedMethodDisplayLabel(
"membership",
firstId,
state.customMethodCardMetaById,
) || firstId;
if (!title && !eligibility && !joiningProcess) return null;
return {
categoryName: RULE_SECTION_CATEGORY.membership,
title,
eligibility,
joiningProcess,
};
}