Constructor
new AirshipSubscriptionFormFactory()
Example
var element = document.querySelector("[rel=email-opt-in]")
var options = {
platform: "email",
size: "large"
i18n: {
en: {
terms:
'By opting into email, I agree to the <a href="https://brand.example/terms">terms and conditions</a>.'
}
}
}
// use the correct path for your region; EU, or Global
var pluginPath = isEU ?
"https://aswpsdkeu.com/notify/v1/ua-subscription-form.min.js" :
"https://aswpsdkus.com/notify/v1/ua-subscription-form.min.js"
UA.then(function (sdk) {
return sdk.plugins.load("subscription-form", pluginPath)
}).then(function (formFactory) {
formFactory.embedForm(element, options)
})
Methods
embedForm(el, options) → {SubscriptionPluginForm}
Parameters:
Name | Type | Description |
---|---|---|
el |
HTMLElement
|
the HTML element into which the form will be rendered, replacing its contents. |
options |
SmsFormOptions
|
EmailFormOptions
|
form options |
setupModalForm(options) → {ModalForm}
Instantiate a new modal subscription form.
Parameters:
Name | Type | Description |
---|---|---|
options |
SubscriptionPluginModalOptions
|
form options |
Returns:
- Type:
-
ModalForm
the modal form
Events
registration
The factory will emit a registration event whenever any form registers a new channel.
Properties:
Name | Type | Description |
---|---|---|
ev.detail |
EmailRegistrationEvent
|
SmsRegistrationEvent
|
Registration data |