openGiftRegistryFormModal
This method attempts to open the Gift Registry form modal, allowing users to fill in their gift registry details.
sdk.gift-registry.methods.openGiftRegistryFormModal()openGiftRegistryFormModal(): Promise<Success | ErrorResult>Returns
Promise<Success | ErrorResult>The method returns a Promise that resolves with Success on success or rejects with ErrorResult on failure. For detailed information about error codes and response handling, see the Method Responses guide.
Usage example
Before call a request, ensure the SDK and the Gift Registry modules are ready:
function onSdkReady() {
const moduleName = window.gw.sdk.common.constants.modules.GIFT_REGISTRY;
window.gw.sdk.runIfModuleReady(moduleName, () => {
window.gw.sdk.gift_registry.methods
.openGiftRegistryFormModal()
.then(console.log)
.catch(console.error);
});
}
if (window.gw && window.gw.sdk) {
onSdkReady();
} else {
document.addEventListener("gwSdkReady", onSdkReady);
}
This code ensures that the SDK and the Gift Registry modules are ready before attempting to call a request. The method will either succeed, returning a success result, or fail, returning an error with details about what went wrong.