Invite people after review, then finish the Rule, with login before inviting and Invite your members on Profile.
This commit is contained in:
1 parent
88bfccd1e7
commit
70ceb73104
31 files changed
+1388
-401
No files matched your search
@@ -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,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user