Methods
-
getOptInOptions()
-
Returns the opt-in options currently in use.
Returns:
-
getSubscriptionState()
-
Get the current subscription state.
Returns:
- Type
- WonderPushSDK#SubscriptionState | null
-
setOptInOptions(options)
-
Update the opt-in options. Personalize and localize your opt-in message.
If your website is not served using HTTPS, the user will be asked to take one extra step using an external window to finalize its registration. This function let's you personalize every aspect of this process.
You can specify just a field or two that you wish to update, there is no need to give the whole object.
Parameters:
Name Type Description optionsWonderPushSDK.Notification.OptInOptions Partial configuration to merge with current options.
Type Definitions
-
OptInOptions
-
Type:
- Object
Properties:
Name Type Description modalBoxIconstring URL to an image to use in the modal box next to the title.
Defaults to the
notificationIconinit option.modalBoxTitlestring Title of the modal box.
Defaults to the
applicationNameinit option.modalBoxMessagestring A message displayed in the modal box.
Defaults to
We will send you personalized notifications.<br/>You can always unsubscribe at any time..This is used after the user is asked the notification permission if an extra step is needed to finalize the subscription. Reassure the user and make him click the button to continue the subscription process using the external box.
modalBoxButtonstring Label of the modal box button.
Defaults to
Got it!.This button takes the user to the external box to finalize the subscription.
modalBoxCancellableboolean Whether the modal box can be dismissed.
Defaults to
true.If the modal box is shown as a result of an automatic prompt, this setting will be forced to
true. Therefore this setting is used if you use the subscription switch or call WonderPushSDK.setNotificationEnabled() without an event.externalBoxWidthnumber Width of the external window used to finalize the subscription process.
Defaults to
500.Keep is small but avoid scrollbars.
externalBoxHeightnumber Height of the external window used to finalize the subscription process.
Defaults to
500.Keep is small but avoid scrollbars.
externalBoxLogoUrlstring URL to an image to use in the external box.
Defaults to the
notificationIconinit option.Preferably use an HTTPS served image, if available, to prevent the HTTPS lock in the location bar from switching from green to yellow.
externalBoxLogoWidthnumber Width of the logo displayed in the external box, in pixels.
Defaults to
90.externalBoxLogoHeightnumber Height of the logo displayed in the external box, in pixels.
Defaults to
90.externalBoxProcessingMessagestring Message displayed in the external box during the subscription process.
Defaults to
Subscribing....externalBoxSuccessMessagestring Message displayed in the external box when the subscription completed successfully.
Defaults to
Thanks for subscribing!.externalBoxFailureMessagestring Message displayed in the external box when the subscription failed.
Defaults to
Sorry, something went wrong..externalBoxTooLongHintstring Message displayed in the external box when the subscription process takes too long, under the
externalBoxProcessingMessagemessage.Defaults to
Poor connection or private browsing?.The purpose of this message is to warn the user that slowness can be due to either poor network connectivity or slow connection, or that fact that he might be using private browsing (which cannot be detected).
externalBoxCloseHintstring Label of the close link displayed in the external box after the subscription process is over, under either the
externalBoxSuccessMessageorexternalBoxFailureMessagemessage.Defaults to
Close.externalBoxCloseDelaynumber How long to leave the external box open before automatically closing it, when the subscription process is over.
Defaults to
3000, 3 seconds.Enter either a number positive of milliseconds, or
0for no delay, or-1to disable auto close.