Skip to content

feat(core, react): add schemas, i18n, and checkpoint pagination hook#159

Open
rax7389 wants to merge 3 commits intofeat/mm-invitations-ui-primitivesfrom
feat/mm-invitations-core-types
Open

feat(core, react): add schemas, i18n, and checkpoint pagination hook#159
rax7389 wants to merge 3 commits intofeat/mm-invitations-ui-primitivesfrom
feat/mm-invitations-core-types

Conversation

@rax7389
Copy link
Copy Markdown
Contributor

@rax7389 rax7389 commented Mar 14, 2026

Changes

Summary: Adds Zod validation schemas, i18n translations, config types, and a reusable checkpoint pagination hook for the organization member management invitations feature. This is the foundational layer that all subsequent PRs build upon.

Why: The invitation feature requires well-defined schemas and translations before building UI components and hooks. Separating these into their own PR keeps the review focused. React types that depend on MemberInvitation from @auth0/myorganization-js are in PR 3.

What:

i18n Translations (core)

Added member_management translation keys in both en-US.json and ja.json covering all invitation flows — table columns, actions, create/revoke/details modals, success/error messages.

{
  "member_management": {
    "invitation": {
      "table": { "columns": { "email": "Email", "status": "Status", ... } },
      "actions": { "view_details": "View Details", "revoke": "Revoke Invitation", ... },
      "create": { "title": "Invite Member", "email_label": "Email Address", ... },
      "revoke": { "title": "Revoke Invitation", "description": "Are you sure...?", ... }
    }
  }
}

Zod Schemas (core)

  • invitation-create-schema.ts — Factory function createInvitationCreateSchema() with customizable email regex, error messages, and max email limit (default 10).
const schema = createInvitationCreateSchema({
  email: { regex: /^[\w.+-]+@auth0\.com$/, errorMessage: "Only @auth0.com allowed" },
  maxEmails: 5,
});
schema.emailSchema.safeParse("user@auth0.com"); // { success: true }
  • invitation-schema.ts — Zod schemas for invitationSchema, invitationListResponseSchema, createInvitationSchema, and revokeInvitationSchema.

  • member-schema.ts — Zod schemas for memberSchema, memberListResponseSchema, and removeMemberSchema.

Schema Tests (core)

  • invitation-create-schema.test.ts — comprehensive test suite covering valid/invalid emails, custom regex, custom error messages, and maxEmails configuration.

Config Types (react)

  • config-types.ts — Added allowedRoles to config interface.

Shared Hook (react)

  • use-checkpoint-pagination.ts — Reusable hook for cursor/checkpoint-based pagination with token stack management for navigating back through pages.
const { currentToken, hasNextPage, hasPreviousPage, goToNextPage, goToPreviousPage } = useCheckpointPagination({
  pageSize: 10,
  nextToken: response.next,
});
  • use-checkpoint-pagination.test.ts — Test suite for the pagination hook covering token stack management, page navigation, and edge cases.

Exports

  • Updated packages/core/src/schemas/my-organization/index.ts with new schema exports

References

Part of the member management invitations feature.

Testing

  • This change adds unit test coverage (invitation-create-schema.test.ts, use-checkpoint-pagination.test.ts)
  • This change has been tested on the latest version of the platform/language

Checklist

@rax7389 rax7389 force-pushed the feat/mm-invitations-core-types branch from d32ea46 to a3edf1e Compare March 14, 2026 12:06
@rax7389 rax7389 self-assigned this Mar 15, 2026
@rax7389 rax7389 added the enhancement New feature or request label Mar 15, 2026
@rax7389 rax7389 force-pushed the feat/mm-invitations-ui-primitives branch from 4cd1add to f543326 Compare March 29, 2026 17:41
@rax7389 rax7389 force-pushed the feat/mm-invitations-core-types branch from a3edf1e to 038ed92 Compare March 29, 2026 17:43
@rax7389 rax7389 force-pushed the feat/mm-invitations-ui-primitives branch from f543326 to 41ed260 Compare April 8, 2026 08:49
@rax7389 rax7389 force-pushed the feat/mm-invitations-core-types branch from 038ed92 to 27b3080 Compare April 8, 2026 09:03
@rax7389 rax7389 force-pushed the feat/mm-invitations-core-types branch from a6cfe0d to 2b6461e Compare April 8, 2026 11:07
@rax7389 rax7389 changed the title feat(core, react): add types, schemas, and i18n for invitations feat(core, react): add schemas, i18n, and checkpoint pagination hook Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant