78c411621e
* feat(embed-core): add public close() API for modal-based embeds
Add a proper public API method close() to the CalApi class that allows
users to programmatically close modal-based embeds (ModalBox and FloatingButton).
This replaces the need for the undocumented hack:
cal.instance.actionManager.fire('__closeIframe')
The new API is cleaner and more intuitive:
cal('close')
Key features:
- Works for modal-based embeds only (ModalBox and FloatingButton)
- Throws a clear error if called on inline embeds
- Well-documented with JSDoc comments explaining usage and limitations
Example usage:
cal('on', {
action: 'bookingSuccessful',
callback: () => {
cal('close');
}
});
Also fixed pre-existing lint issues: unused variable in catch block and
eslint-disable comment for missing rule definition.
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
* refactor(embed-core): rename close() to closeModal() for clarity
Rename the close() method to closeModal() to make it immediately clear
from the API name itself that this method is for modal-based embeds only.
This makes the API more self-documenting:
- Before: cal('close')
- After: cal('closeModal')
Updated:
- Method name from close() to closeModal()
- JSDoc example to use cal('closeModal')
- Error message to reference closeModal()
The TypeScript types automatically recognize the new action name through
the SingleInstructionMap type system.
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
* cleanup
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>