Invite
The Invite interface defines the structure for an invitation record, typically used when inviting new users to a subscription or team. It includes details about the invitation itself, the host, the invited user’s email, and the status of the invitation.
Properties
- id:- stringThe unique identifier for the invitation.
- subscription_id:- stringThe ID of the subscription to which the user is invited.
- subscription_name:- stringThe name of the subscription.
- host_uid:- stringThe Firebase User ID (UID) of the user who sent the invitation.
- host_name:- stringThe display name of the user who sent the invitation.
- email:- stringThe email address of the invited user.
- status:- 'pending' | 'accepted' | 'rejected' | 'revoked'The current status of the invitation.
- create_time:- anyThe timestamp when the invitation was created. This can be a Firebase- Timestampobject or a compatible type.
- permissions:- string[]An array of strings representing the permissions that will be granted to the invited user upon accepting the invitation.
- accept_time?:- anyOptional. The timestamp when the invitation was accepted.
- accepted_by?:- stringOptional. The Firebase User ID (UID) of the user who accepted the invitation.
- reject_time?:- anyOptional. The timestamp when the invitation was rejected.
- rejected_by?:- stringOptional. The Firebase User ID (UID) of the user who rejected the invitation.
- revoke_time?:- anyOptional. The timestamp when the invitation was revoked.
- revoked_by?:- stringOptional. The Firebase User ID (UID) of the user who revoked the invitation.
Usage
The Invite interface is used to define the structure of invitation documents stored in a Firestore collection (e.g., invites). It is consumed by components that manage invitations, such as InviteUser and UserTable.
// Example of an Invite object
const pendingInvite: Invite = {
  id: "invite_xyz123",
  subscription_id: "sub_abc456",
  subscription_name: "My SaaS Project",
  host_uid: "host_uid_789",
  host_name: "Admin User",
  email: "new.user@example.com",
  status: "pending",
  create_time: { _seconds: 1678886400, _nanoseconds: 0 },
  permissions: ["member"]
};
// In a React component (e.g., InviteUser):
import { InviteUser } from '@fireact.dev/app';
import { type Invite } from '@fireact.dev/app/types'; // Import the type
function InvitationManagement() {
  const [invites, setInvites] = useState<Invite[]>([]);
  // ... logic to fetch invites ...
  return (
    <div>
      <h2>Pending Invitations</h2>
      <ul>
        {invites.map(invite => (
          <li key={invite.id}>
            {invite.email} - Status: {invite.status}
          </li>
        ))}
      </ul>
    </div>
  );
}
Related Components/Hooks
- InviteUsercomponent: Creates and sends new- Inviterecords.
- UserTablecomponent: Displays pending- Inviterecords and allows revoking them.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.