Skip to content

feat(shared,ui): Add onMoment prop to GoogleOneTap#8099

Open
tmilewski wants to merge 1 commit intomainfrom
tom/user-4979-investigate-google-one-tap-moment_notification
Open

feat(shared,ui): Add onMoment prop to GoogleOneTap#8099
tmilewski wants to merge 1 commit intomainfrom
tom/user-4979-investigate-google-one-tap-moment_notification

Conversation

@tmilewski
Copy link
Member

@tmilewski tmilewski commented Mar 17, 2026

Description

  • Adds onMoment callback prop to <GoogleOneTap>, exposing Google's PromptMomentNotification for tracking when the One Tap prompt is displayed, dismissed, or skipped
  • Exports GoogleOneTapMomentNotification type from @clerk/shared with full GIS notification surface (getMomentType, isDisplayMoment, getDismissedReason, etc.)
  • Uses a ref for the callback to avoid stale closures, and wraps invocation in try/catch so a throwing callback never blocks closeGoogleOneTap()
<GoogleOneTap
  onMoment={(notification) => {
    if (notification.isDisplayMoment()) {
      // ...
    }
  }}
/>

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

  • New Features
    • GoogleOneTap component now includes an optional onMoment callback prop. This callback receives notification events when the prompt is displayed, dismissed, or skipped, allowing you to monitor prompt lifecycle changes.

@tmilewski tmilewski self-assigned this Mar 17, 2026
@changeset-bot
Copy link

changeset-bot bot commented Mar 17, 2026

🦋 Changeset detected

Latest commit: 675e29e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 21 packages
Name Type
@clerk/shared Minor
@clerk/ui Minor
@clerk/agent-toolkit Patch
@clerk/astro Patch
@clerk/backend Patch
@clerk/chrome-extension Patch
@clerk/clerk-js Patch
@clerk/expo-passkeys Patch
@clerk/expo Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/hono Patch
@clerk/localizations Patch
@clerk/msw Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/react Patch
@clerk/tanstack-react-start Patch
@clerk/testing Patch
@clerk/vue Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the ui label Mar 17, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 17, 2026

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@8099

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@8099

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@8099

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@8099

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@8099

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@8099

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@8099

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@8099

@clerk/express

npm i https://pkg.pr.new/@clerk/express@8099

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@8099

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@8099

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@8099

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@8099

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@8099

@clerk/react

npm i https://pkg.pr.new/@clerk/react@8099

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@8099

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@8099

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@8099

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@8099

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@8099

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@8099

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@8099

commit: 675e29e

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 17, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: 8e4ac99e-38ef-4aaf-b3bd-fa14e689b1ba

📥 Commits

Reviewing files that changed from the base of the PR and between b9cb6e5 and 675e29e.

📒 Files selected for processing (6)
  • .changeset/google-one-tap-on-moment.md
  • packages/shared/src/types/clerk.ts
  • packages/ui/src/components/GoogleOneTap/__tests__/OneTapStart.test.tsx
  • packages/ui/src/components/GoogleOneTap/one-tap-start.tsx
  • packages/ui/src/test/fixture-helpers.ts
  • packages/ui/src/utils/one-tap.ts

📝 Walkthrough

Walkthrough

This change introduces event lifecycle tracking for the GoogleOneTap component. A new onMoment callback prop is added to GoogleOneTap, accepting a GoogleOneTapMomentNotification object that provides query and predicate methods for detecting prompt display, dismissal, and skip events. The implementation captures the callback via a ref and invokes it when prompt moments occur, with error handling included. Supporting types are exported publicly, test coverage is added for the event handling scenarios, and fixture helpers are expanded to support testing with Google One Tap configuration.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding an onMoment prop to the GoogleOneTap component across shared and ui packages.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can generate a title for your PR based on the changes.

Add @coderabbitai placeholder anywhere in the title of your PR and CodeRabbit will replace it with a title based on the changes in the PR. You can change the placeholder by changing the reviews.auto_title_placeholder setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant