Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 7x 7x 64x 7x 150x | import { MemberData } from "@customTypes/team.member";
/** The mobile-only door role, branded "Host" in the product copy. */
const OPERATOR_ROLE = "operator";
export const isOperatorMember = (member?: Pick<MemberData, "roleName">) =>
member?.roleName === OPERATOR_ROLE;
/**
* Whether the member is done joining — they accepted the invitation *and* hold
* the credentials they need to sign in. Where this is false the Team surfaces
* keep treating them as invited: the panel shows the "Invitation Sent" banner
* with Resend/Revoke, and the row menu keeps "Resend invitation".
*
* Accepting is only half the story for a password member: one who accepted but
* still carries the API-generated password cannot sign in yet, so the resend
* affordance has to stay in reach (that is the `isPasswordGenerated` test).
*
* A Host (`operator`) never has a password to set — they onboard in the
* GiveCash app with an email OTP plus a PIN, and their invite email carries no
* set-password link — so `isPasswordGenerated` stays true for them for good.
* Their `joined` status *is* the completed setup: the API flips the membership
* on first PIN setup. Testing the password flag for them left an accepted Host
* permanently stuck behind the invitation banner.
*/
export const isMemberJoined = (member?: MemberData) =>
member?.memberStatus === "joined" &&
(isOperatorMember(member) || !member?.isPasswordGenerated);
|