Skip to content

Conversation

@hariombalhara
Copy link
Member

docs: add closeModal() API documentation for embed instructions

Summary

Adds comprehensive documentation for the new closeModal() API method introduced in cal.com PR #24746. This method allows developers to programmatically close modal-based embeds (pop-ups and floating buttons) instead of using the undocumented internal hack.

Changes:

  • Added new "Close modal" section to embedding/embed-instructions.mdx with full API documentation
  • Added practical example in embedding/embed-events.mdx showing how to close modal after successful booking
  • Included both namespaced and non-namespaced usage examples
  • Documented supported embed types, error handling, and migration path from internal API

Review & Testing Checklist for Human

  • Test the closeModal() API with actual embeds - Verify that Cal("closeModal") actually works with pop-up and floating button embeds as documented
  • Verify the anchor link works - Check that the cross-reference link from embed-events.mdx to #close-modal in embed-instructions.mdx renders correctly on the help site
  • Confirm API details match implementation - Double-check against cal.com PR #24746 that the API name, error message, and behavior are accurately documented
  • Test the example code - Copy the example code snippets and verify they work in a real embed scenario (especially the bookingSuccessfulV2 callback example)

Test Plan

  1. Create a test page with a pop-up embed (element click or floating button)
  2. Add the bookingSuccessfulV2 event listener with closeModal() callback
  3. Complete a test booking and verify the modal closes automatically
  4. Try calling closeModal() on an inline embed and verify it throws the documented error
  5. Test with both namespaced and non-namespaced embed configurations

Notes

  • Documentation is based on code inspection of cal.com PR #24746, not actual testing
  • The API was renamed from close() to closeModal() during development - confirmed the final name from the PR diff
  • Examples use bookingSuccessfulV2 (not the deprecated bookingSuccessful event) per existing help docs
  • All syntax follows existing help repo conventions (capitalized Cal(), proper MDX formatting)

Link to Devin run: https://app.devin.ai/sessions/8b4ff4e64f8a465384db398b61ac7f2b
Requested by: @hariombalhara ([email protected])

@devin-ai-integration
Copy link

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

- Add comprehensive closeModal() documentation to embed-instructions.mdx
- Include usage examples for both namespaced and non-namespaced embeds
- Add common use case example in embed-events.mdx
- Document supported embed types and error handling
- Include migration note from internal API

Co-Authored-By: [email protected] <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants