New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

blocks-subscribe-email

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blocks-subscribe-email - npm Package Compare versions

Comparing version

to
1.1.0

2

package.json
{
"name": "blocks-subscribe-email",
"version": "1.0.0",
"version": "1.1.0",
"description": "Subscribes an email address to a list. Supports a selection of email marketing services.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -41,5 +41,17 @@ Subscribe Email is a standalone UMD JavaScript module for rendering a mailing list sign up form quickly on a webpage.

### `prependMessagesTo`
By default, responses from the different mailing list platforms will be prepended to the SubscribeEmail `element` as a dismissable alert, but you can use this option to override which element the alerts are prepended to. Accepts a query string or a jQuery object.
### `alerter`
SubscribeEmail uses [`blocks-alerter`](https://github.com/blocks/alerter) to display response messages from the different mailing list platforms. By default, alerts will be prepended to `element` and use Alerter's default template. You can turn alerts off by setting `alerter: false`. If you would like to override the defaults, you can pass in an options hash with [options for Alerter](https://github.com/blocks/alerter#options). Example;
```
var mySubscribeForm = new SubscribeEmail({
element: '#subscribe-form',
service: 'universe',
key: 'your-api-key-here',
alerter: {
prependTo: 'body',
template: myCustomTemplate
}
});
```
### `service`

@@ -46,0 +58,0 @@ **(Required)** The mailing list platform you are using. Available options are `mailchimp`, `sendgrid` and `universe`.

@@ -26,5 +26,4 @@ var template = require('./subscribe-form.hbs');

var messageHolder = new Alerter({
prependTo: options.prependMessagesTo
});
var messageHolder;
if (options.alerter) messageHolder = new Alerter(options.alerter);

@@ -47,8 +46,10 @@ //Override Default Submit Action with CORS request

//Listen for Message Events
this.on('subscriptionMessage', function (message) {
messageHolder.create({
message: message,
dismissable: true
if (messageHolder) {
this.on('subscriptionMessage', function (message) {
messageHolder.create({
message: message,
dismissable: true
});
});
});
}
}

@@ -96,3 +97,9 @@

options.submitText = options.submitText || 'Subscribe';
options.prependMessagesTo = options.prependMessagesTo || options.element;
if (options.alerter === undefined || options.alerter === null) {
options.alerter = {};
}
if (options.alerter) {
//options.prependMessagesTo is to maintain backward compatibility
options.alerter.prependTo = options.alerter.prependTo || options.prependMessagesTo || options.element;
}
//get/set the ID of the HTML element (may be different than the value of element)

@@ -99,0 +106,0 @@ options.id = instance.theForm.id || ('subscribe-email-' + options.service);