Errors and lifecycle limitations
Handle current browser SDK failures and lifecycle limitations.
Host-page errors
| Condition | Current behavior | Host responsibility |
|---|---|---|
| Loader blocked or unavailable | window.Giftie is not created. | Handle the script error event and keep the trigger disabled. |
| Widget iframe fails to load | The loader writes a console error. | Provide a timeout or support path; no documented structured error callback exists. |
| Camera or microphone denied | The widget handles the permission flow internally. | Do not treat iframe onLoad as permission success. |
| Save callback throws synchronously | A configuration callback throw prevents the instance save hook and automatic close. An instance-hook throw also prevents automatic close. | Catch synchronous errors inside each callback. |
| Save callback promise rejects | The loader does not await or observe the promise; later hooks and close have already continued. | Catch rejections inside the callback to avoid an unhandled rejection and recover the host operation. |
onClose throws synchronously | Close has begun, but the throw prevents lifecycle state reset and focus restoration. | Do not let onClose throw; contain its synchronous work. |
onClose promise rejects | The loader does not await it and resets lifecycle state immediately. | Catch the rejection inside onClose. |
Lifecycle limitations
- The SDK uses shared global state. Multiple instances or simultaneous widgets are not supported.
- There is no documented loader-ready promise, official npm package, or bundled TypeScript declaration.
onLoadreports the iframe's browser load event, not full recording readiness.updateConfig()does not change an already-open iframe.- After invoking both save callbacks, the widget begins automatic close if neither callback threw synchronously. It does not wait for returned promises.
- The first close attempt during upload is blocked; a second attempt forces close and can abandon the upload.
open()ignores a call made while already open.- Configuration and per-open context are URL values. Do not send secrets or sensitive customer/order data.
- The current loader lifecycle has no structured events for permission denial, upload progress, upload failure, or iframe failure.
