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 options
WonderPushSDK.Notification.OptInOptions Partial configuration to merge with current options.
Type Definitions
-
OptInOptions
-
Type:
- Object
Properties:
Name Type Description modalBoxIcon
string URL to an image to use in the modal box next to the title.
Defaults to the
notificationIcon
init option.modalBoxTitle
string Title of the modal box.
Defaults to the
applicationName
init option.modalBoxMessage
string 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.
modalBoxButton
string Label of the modal box button.
Defaults to
Got it!
.This button takes the user to the external box to finalize the subscription.
modalBoxCancellable
boolean 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.externalBoxWidth
number Width of the external window used to finalize the subscription process.
Defaults to
500
.Keep is small but avoid scrollbars.
externalBoxHeight
number Height of the external window used to finalize the subscription process.
Defaults to
500
.Keep is small but avoid scrollbars.
externalBoxLogoUrl
string URL to an image to use in the external box.
Defaults to the
notificationIcon
init option.Preferably use an HTTPS served image, if available, to prevent the HTTPS lock in the location bar from switching from green to yellow.
externalBoxLogoWidth
number Width of the logo displayed in the external box, in pixels.
Defaults to
90
.externalBoxLogoHeight
number Height of the logo displayed in the external box, in pixels.
Defaults to
90
.externalBoxProcessingMessage
string Message displayed in the external box during the subscription process.
Defaults to
Subscribing...
.externalBoxSuccessMessage
string Message displayed in the external box when the subscription completed successfully.
Defaults to
Thanks for subscribing!
.externalBoxFailureMessage
string Message displayed in the external box when the subscription failed.
Defaults to
Sorry, something went wrong.
.externalBoxTooLongHint
string Message displayed in the external box when the subscription process takes too long, under the
externalBoxProcessingMessage
message.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).
externalBoxCloseHint
string Label of the close link displayed in the external box after the subscription process is over, under either the
externalBoxSuccessMessage
orexternalBoxFailureMessage
message.Defaults to
Close
.externalBoxCloseDelay
number 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
0
for no delay, or-1
to disable auto close.