@input-output-hk/mailchimp-subscribe
Advanced tools
Comparing version 0.1.0 to 0.3.0
@@ -8,14 +8,2 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "ERROR_CODES", { | ||
enumerable: true, | ||
get: function get() { | ||
return _constants.ERROR_CODES; | ||
} | ||
}); | ||
Object.defineProperty(exports, "SUCCESS_CODES", { | ||
enumerable: true, | ||
get: function get() { | ||
return _constants.SUCCESS_CODES; | ||
} | ||
}); | ||
exports["default"] = void 0; | ||
@@ -31,4 +19,2 @@ | ||
var _constants = require("./constants"); | ||
var validateFields = function validateFields(_ref) { | ||
@@ -54,3 +40,3 @@ var email = _ref.email, | ||
* | ||
* @return {Promise<MailChimpSuccess>} Rejects with MailChimpError | ||
* @return {Promise<MailChimpSuccess>} Or rejects with MailChimpError | ||
*/ | ||
@@ -81,5 +67,7 @@ | ||
return new Promise(function (resolve, reject) { | ||
(0, _jsonp["default"])("".concat(url).concat(endpoint, "?").concat(Object.keys(parameters).map(function (key) { | ||
return "".concat(key, "=").concat(encodeURIComponent(parameters[key])); | ||
}).join('&')), { | ||
var queryString = Object.keys(parameters).map(function (key) { | ||
return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(parameters[key])); | ||
}).join('&'); | ||
var fullURL = "".concat(url).concat(endpoint, "?").concat(queryString); | ||
(0, _jsonp["default"])(fullURL, { | ||
param: 'c', | ||
@@ -89,3 +77,3 @@ timeout: timeout | ||
try { | ||
if (err) throw new _MailChimpError["default"](err.message); | ||
if (err) throw err; | ||
if (data.result === 'error') throw new _MailChimpError["default"](data.msg); | ||
@@ -101,2 +89,2 @@ resolve(new _MailChimpSuccess["default"](data.msg)); | ||
exports["default"] = _default; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6WyJ2YWxpZGF0ZUZpZWxkcyIsImVtYWlsIiwibGlzdE5hbWUiLCJ1SUQiLC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plY3QpID0+IHtcbiAgICBjb25zdCBxdWVyeVN0cmluZyA9IE9iamVjdC5rZXlzKHBhcmFtZXRlcnMpLm1hcChrZXkgPT4gYCR7ZW5jb2RlVVJJQ29tcG9uZW50KGtleSl9PSR7ZW5jb2RlVVJJQ29tcG9uZW50KHBhcmFtZXRlcnNba2V5XSl9YCkuam9pbignJicpXG4gICAgY29uc3QgZnVsbFVSTCA9IGAke3VybH0ke2VuZHBvaW50fT8ke3F1ZXJ5U3RyaW5nfWBcbiAgICBqc29ucChmdWxsVVJMLCB7XG4gICAgICBwYXJhbTogJ2MnLFxuICAgICAgdGltZW91dFxuICAgIH0sIChlcnIsIGRhdGEpID0+IHtcbiAgICAgIHRyeSB7XG4gICAgICAgIGlmIChlcnIpIHRocm93IGVyclxuICAgICAgICBpZiAoZGF0YS5yZXN1bHQgPT09ICdlcnJvcicpIHRocm93IG5ldyBNYWlsQ2hpbXBFcnJvcihkYXRhLm1zZylcbiAgICAgICAgcmVzb2x2ZShuZXcgTWFpbENoaW1wU3VjY2VzcyhkYXRhLm1zZykpXG4gICAgICB9IGNhdGNoIChlcnJvcikge1xuICAgICAgICByZWplY3QoZXJyb3IpXG4gICAgICB9XG4gICAgfSlcbiAgfSlcbn1cbiJdfQ== |
"use strict"; | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
@@ -13,4 +11,6 @@ | ||
var _ = _interopRequireWildcard(require("./")); | ||
var _ = _interopRequireDefault(require("./")); | ||
var _MailChimpError = _interopRequireDefault(require("./MailChimpError")); | ||
describe('subscribe', function () { | ||
@@ -72,2 +72,7 @@ var email, uID, listName, audienceID; | ||
beforeEach(function () { | ||
data = { | ||
msg: 'Success', | ||
result: 'success' | ||
}; | ||
_jsonp["default"].mockImplementation(function (url, options, cb) { | ||
@@ -92,47 +97,36 @@ cb(null, data); | ||
}); | ||
describe('generic success', function () { | ||
beforeEach(function () { | ||
data = { | ||
msg: 'Success', | ||
result: 'success' | ||
}; | ||
}); | ||
test('it resolves with the GENERIC success code', | ||
/*#__PURE__*/ | ||
(0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee() { | ||
var result; | ||
return _regenerator["default"].wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
_context.next = 2; | ||
return (0, _["default"])({ | ||
email: email, | ||
uID: uID, | ||
audienceID: audienceID, | ||
listName: listName | ||
}); | ||
test('it resolves with the success message', | ||
/*#__PURE__*/ | ||
(0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee() { | ||
var result; | ||
return _regenerator["default"].wrap(function _callee$(_context) { | ||
while (1) { | ||
switch (_context.prev = _context.next) { | ||
case 0: | ||
_context.next = 2; | ||
return (0, _["default"])({ | ||
email: email, | ||
uID: uID, | ||
audienceID: audienceID, | ||
listName: listName | ||
}); | ||
case 2: | ||
result = _context.sent; | ||
expect(result.getCode()).toEqual(_.SUCCESS_CODES.GENERIC); | ||
case 2: | ||
result = _context.sent; | ||
expect(result.message).toEqual('Success'); | ||
case 4: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
case 4: | ||
case "end": | ||
return _context.stop(); | ||
} | ||
}, _callee); | ||
}))); | ||
}); | ||
describe('when a user needs to confirm their email address', function () { | ||
beforeEach(function () { | ||
data = { | ||
msg: 'Almost finished... We need to confirm your email address. To complete the subscription process, please click the link in the email we just sent you.', | ||
result: 'success' | ||
}; | ||
}); | ||
test('it resolves with the CONFIRM_EMAIL_ADDRESS success code', | ||
} | ||
}, _callee); | ||
}))); | ||
}); | ||
describe('errors', function () { | ||
var err, error; | ||
describe('jsonp error', function () { | ||
beforeEach( | ||
/*#__PURE__*/ | ||
@@ -142,3 +136,2 @@ (0, _asyncToGenerator2["default"])( | ||
_regenerator["default"].mark(function _callee2() { | ||
var result; | ||
return _regenerator["default"].wrap(function _callee2$(_context2) { | ||
@@ -148,3 +141,10 @@ while (1) { | ||
case 0: | ||
_context2.next = 2; | ||
err = new Error('jsonp error'); | ||
_jsonp["default"].mockImplementation(function (url, options, cb) { | ||
return cb(err, {}); | ||
}); | ||
_context2.prev = 2; | ||
_context2.next = 5; | ||
return (0, _["default"])({ | ||
@@ -157,7 +157,12 @@ email: email, | ||
case 2: | ||
result = _context2.sent; | ||
expect(result.getCode()).toEqual(_.SUCCESS_CODES.CONFIRM_EMAIL_ADDRESS); | ||
case 5: | ||
_context2.next = 10; | ||
break; | ||
case 4: | ||
case 7: | ||
_context2.prev = 7; | ||
_context2.t0 = _context2["catch"](2); | ||
error = _context2.t0; | ||
case 10: | ||
case "end": | ||
@@ -167,23 +172,32 @@ return _context2.stop(); | ||
} | ||
}, _callee2); | ||
}, _callee2, null, [[2, 7]]); | ||
}))); | ||
test('it rejects with the jsonp error message', function () { | ||
expect(error.message).toEqual('jsonp error'); | ||
}); | ||
test('the error is not an instance of MailChimpError', function () { | ||
expect(error).not.toBeInstanceOf(_MailChimpError["default"]); | ||
}); | ||
}); | ||
}); | ||
describe('errors', function () { | ||
var error = {}; | ||
function assignError() { | ||
return _assignError.apply(this, arguments); | ||
} | ||
function _assignError() { | ||
_assignError = (0, _asyncToGenerator2["default"])( | ||
describe('mailchimp errors', function () { | ||
var data = { | ||
result: 'error' | ||
}; | ||
beforeEach( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee11() { | ||
return _regenerator["default"].wrap(function _callee11$(_context11) { | ||
(0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee3() { | ||
return _regenerator["default"].wrap(function _callee3$(_context3) { | ||
while (1) { | ||
switch (_context11.prev = _context11.next) { | ||
switch (_context3.prev = _context3.next) { | ||
case 0: | ||
_context11.prev = 0; | ||
_context11.next = 3; | ||
data.msg = 'Mailchimp error'; | ||
_jsonp["default"].mockImplementation(function (url, options, cb) { | ||
return cb(null, data); | ||
}); | ||
_context3.prev = 2; | ||
_context3.next = 5; | ||
return (0, _["default"])({ | ||
@@ -196,246 +210,27 @@ email: email, | ||
case 3: | ||
_context11.next = 8; | ||
case 5: | ||
_context3.next = 10; | ||
break; | ||
case 5: | ||
_context11.prev = 5; | ||
_context11.t0 = _context11["catch"](0); | ||
error = _context11.t0; | ||
case 7: | ||
_context3.prev = 7; | ||
_context3.t0 = _context3["catch"](2); | ||
error = _context3.t0; | ||
case 8: | ||
case 10: | ||
case "end": | ||
return _context11.stop(); | ||
return _context3.stop(); | ||
} | ||
} | ||
}, _callee11, null, [[0, 5]]); | ||
})); | ||
return _assignError.apply(this, arguments); | ||
} | ||
describe('jsonp error', function () { | ||
var err; | ||
beforeEach(function () { | ||
_jsonp["default"].mockImplementation(function (url, options, cb) { | ||
cb(err, {}); | ||
}); | ||
}, _callee3, null, [[2, 7]]); | ||
}))); | ||
test('it rejects with the mailchimp error message', function () { | ||
expect(error.message).toEqual('Mailchimp error'); | ||
}); | ||
describe('generic errors', function () { | ||
beforeEach( | ||
/*#__PURE__*/ | ||
(0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee3() { | ||
return _regenerator["default"].wrap(function _callee3$(_context3) { | ||
while (1) { | ||
switch (_context3.prev = _context3.next) { | ||
case 0: | ||
err = new Error('Generic error'); | ||
_context3.next = 3; | ||
return assignError(); | ||
case 3: | ||
case "end": | ||
return _context3.stop(); | ||
} | ||
} | ||
}, _callee3); | ||
}))); | ||
test('it rejects with the GENERIC error code', function () { | ||
expect(error.getCode()).toEqual(_.ERROR_CODES.GENERIC); | ||
}); | ||
test('it rejects with a MailChimpError instance', function () { | ||
expect(error).toBeInstanceOf(_MailChimpError["default"]); | ||
}); | ||
describe('timeout errors', function () { | ||
beforeEach( | ||
/*#__PURE__*/ | ||
(0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee4() { | ||
return _regenerator["default"].wrap(function _callee4$(_context4) { | ||
while (1) { | ||
switch (_context4.prev = _context4.next) { | ||
case 0: | ||
err = new Error('Timeout'); | ||
_context4.next = 3; | ||
return assignError(); | ||
case 3: | ||
case "end": | ||
return _context4.stop(); | ||
} | ||
} | ||
}, _callee4); | ||
}))); | ||
test('it rejects with the TIMEOUT error code', function () { | ||
expect(error.getCode()).toEqual(_.ERROR_CODES.TIMEOUT); | ||
}); | ||
}); | ||
}); | ||
describe('mailchimp errors', function () { | ||
var data = { | ||
result: 'error' | ||
}; | ||
beforeEach(function () { | ||
_jsonp["default"].mockImplementation(function (url, options, cb) { | ||
cb(null, data); | ||
}); | ||
}); | ||
describe('generic error', function () { | ||
beforeEach( | ||
/*#__PURE__*/ | ||
(0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee5() { | ||
return _regenerator["default"].wrap(function _callee5$(_context5) { | ||
while (1) { | ||
switch (_context5.prev = _context5.next) { | ||
case 0: | ||
data.msg = 'borked'; | ||
_context5.next = 3; | ||
return assignError(); | ||
case 3: | ||
case "end": | ||
return _context5.stop(); | ||
} | ||
} | ||
}, _callee5); | ||
}))); | ||
test('it rejects with the GENERIC error code', function () { | ||
expect(error.getCode()).toEqual(_.ERROR_CODES.GENERIC); | ||
}); | ||
}); | ||
describe('invalid emails', function () { | ||
beforeEach( | ||
/*#__PURE__*/ | ||
(0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee6() { | ||
return _regenerator["default"].wrap(function _callee6$(_context6) { | ||
while (1) { | ||
switch (_context6.prev = _context6.next) { | ||
case 0: | ||
data.msg = '0 - This email address looks fake or invalid. Please enter a real email address.'; | ||
_context6.next = 3; | ||
return assignError(); | ||
case 3: | ||
case "end": | ||
return _context6.stop(); | ||
} | ||
} | ||
}, _callee6); | ||
}))); | ||
test('it rejects with the INVALID_EMAIL error code', function () { | ||
expect(error.getCode()).toEqual(_.ERROR_CODES.INVALID_EMAIL); | ||
}); | ||
}); | ||
describe('messages beginning with `0 - `', function () { | ||
beforeEach( | ||
/*#__PURE__*/ | ||
(0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee7() { | ||
return _regenerator["default"].wrap(function _callee7$(_context7) { | ||
while (1) { | ||
switch (_context7.prev = _context7.next) { | ||
case 0: | ||
data.msg = '0 - Some error'; | ||
_context7.next = 3; | ||
return assignError(); | ||
case 3: | ||
case "end": | ||
return _context7.stop(); | ||
} | ||
} | ||
}, _callee7); | ||
}))); | ||
test('it rejects with the INVALID_EMAIL error code', function () { | ||
expect(error.getCode()).toEqual(_.ERROR_CODES.INVALID_EMAIL); | ||
}); | ||
}); | ||
describe('invalid email domain', function () { | ||
beforeEach( | ||
/*#__PURE__*/ | ||
(0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee8() { | ||
return _regenerator["default"].wrap(function _callee8$(_context8) { | ||
while (1) { | ||
switch (_context8.prev = _context8.next) { | ||
case 0: | ||
data.msg = '0 - The domain portion of the email address is invalid (the portion after the @: example)'; | ||
_context8.next = 3; | ||
return assignError(); | ||
case 3: | ||
case "end": | ||
return _context8.stop(); | ||
} | ||
} | ||
}, _callee8); | ||
}))); | ||
test('it rejects with the INVALID_EMAIL_DOMAIN error code', function () { | ||
expect(error.getCode()).toEqual(_.ERROR_CODES.INVALID_EMAIL_DOMAIN); | ||
}); | ||
}); | ||
describe('invalid email username', function () { | ||
beforeEach( | ||
/*#__PURE__*/ | ||
(0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee9() { | ||
return _regenerator["default"].wrap(function _callee9$(_context9) { | ||
while (1) { | ||
switch (_context9.prev = _context9.next) { | ||
case 0: | ||
data.msg = '0 - The username portion of the email address is invalid (the portion before the @: .)'; | ||
_context9.next = 3; | ||
return assignError(); | ||
case 3: | ||
case "end": | ||
return _context9.stop(); | ||
} | ||
} | ||
}, _callee9); | ||
}))); | ||
test('it rejects with the INVALID_EMAIL_USERNAME error code', function () { | ||
expect(error.getCode()).toEqual(_.ERROR_CODES.INVALID_EMAIL_USERNAME); | ||
}); | ||
}); | ||
describe('email already subscribed', function () { | ||
beforeEach( | ||
/*#__PURE__*/ | ||
(0, _asyncToGenerator2["default"])( | ||
/*#__PURE__*/ | ||
_regenerator["default"].mark(function _callee10() { | ||
return _regenerator["default"].wrap(function _callee10$(_context10) { | ||
while (1) { | ||
switch (_context10.prev = _context10.next) { | ||
case 0: | ||
data.msg = 'example@example.org is already subscribed to list abc.def. <a href="https://abc.def.list-manage.com/subscribe/send-email?e=abcdefg">Click here to update your profile</a>'; | ||
_context10.next = 3; | ||
return assignError(); | ||
case 3: | ||
case "end": | ||
return _context10.stop(); | ||
} | ||
} | ||
}, _callee10); | ||
}))); | ||
test('it rejects with the EMAIL_ALREADY_SUBSCRIBED error code', function () { | ||
expect(error.getCode()).toEqual(_.ERROR_CODES.EMAIL_ALREADY_SUBSCRIBED); | ||
}); | ||
test('it returns the manage link in context', function () { | ||
expect(error.getContext()).toEqual({ | ||
manageSubscriptionLink: 'https://abc.def.list-manage.com/subscribe/send-email?e=abcdefg' | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC50ZXN0LmpzIl0sIm5hbWVzIjpbImRlc2NyaWJlIiwiZW1haWwiLCJ1SUQiLCJsaXN0TmFtZSIsImF1ZGllbmNlSUQiLCJiZWZvcmVFYWNoIiwidGVzdCIsImV4cGVjdCIsInRvVGhyb3dFcnJvciIsImRhdGEiLCJqc29ucCIsIm1vY2tJbXBsZW1lbnRhdGlvbiIsInVybCIsIm9wdGlvbnMiLCJjYiIsImV4cGVjdGVkVVJMIiwidGltZW91dCIsInRvQmVDYWxsZWRXaXRoIiwicGFyYW0iLCJhbnkiLCJGdW5jdGlvbi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cmliZSgnZW1haWwgYWxyZWFkeSBzdWJzY3JpYmVkJywgKCkgPT4ge1xuICAgICAgICBiZWZvcmVFYWNoKGFzeW5jICgpID0+IHtcbiAgICAgICAgICBkYXRhLm1zZyA9ICdleGFtcGxlQGV4YW1wbGUub3JnIGlzIGFscmVhZHkgc3Vic2NyaWJlZCB0byBsaXN0IGFiYy5kZWYuIDxhIGhyZWY9XCJodHRwczovL2FiYy5kZWYubGlzdC1tYW5hZ2UuY29tL3N1YnNjcmliZS9zZW5kLWVtYWlsP2U9YWJjZGVmZ1wiPkNsaWNrIGhlcmUgdG8gdXBkYXRlIHlvdXIgcHJvZmlsZTwvYT4nXG4gICAgICAgICAgYXdhaXQgYXNzaWduRXJyb3IoKVxuICAgICAgICB9KVxuXG4gICAgICAgIHRlc3QoJ2l0IHJlamVjdHMgd2l0aCB0aGUgRU1BSUxfQUxSRUFEWV9TVUJTQ1JJQkVEIGVycm9yIGNvZGUnLCAoKSA9PiB7XG4gICAgICAgICAgZXhwZWN0KGVycm9yLmdldENvZGUoKSkudG9FcXVhbChFUlJPUl9DT0RFUy5FTUFJTF9BTFJFQURZX1NVQlNDUklCRUQpXG4gICAgICAgIH0pXG5cbiAgICAgICAgdGVzdCgnaXQgcmV0dXJucyB0aGUgbWFuYWdlIGxpbmsgaW4gY29udGV4dCcsICgpID0+IHtcbiAgICAgICAgICBleHBlY3QoZXJyb3IuZ2V0Q29udGV4dCgpKS50b0VxdWFsKHtcbiAgICAgICAgICAgIG1hbmFnZVN1YnNjcmlwdGlvbkxpbms6ICdodHRwczovL2FiYy5kZWYubGlzdC1tYW5hZ2UuY29tL3N1YnNjcmliZS9zZW5kLWVtYWlsP2U9YWJjZGVmZydcbiAgICAgICAgICB9KVxuICAgICAgICB9KVxuICAgICAgfSlcbiAgICB9KVxuICB9KVxufSlcbiJdfQ== | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9p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zdGFuY2UnLCAoKSA9PiB7XG4gICAgICAgIGV4cGVjdChlcnJvcikudG9CZUluc3RhbmNlT2YoTWFpbENoaW1wRXJyb3IpXG4gICAgICB9KVxuICAgIH0pXG4gIH0pXG59KVxuIl19 |
@@ -12,4 +12,2 @@ "use strict"; | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); | ||
@@ -23,15 +21,2 @@ | ||
var _constants = require("./constants"); | ||
function getLinks(message) { | ||
var matches = message.match(/<a href=("|')[^"']+/g); | ||
return matches ? matches.map(function (match) { | ||
return match.replace(/^.*?("|')([^"']+)/, '$2'); | ||
}) : []; | ||
} | ||
/** | ||
* Transforms error message strings from mailchimp into error codes | ||
*/ | ||
var MailChimpError = | ||
@@ -47,42 +32,2 @@ /*#__PURE__*/ | ||
(0, _createClass2["default"])(MailChimpError, [{ | ||
key: "getCode", | ||
/** | ||
* Get the error code from error code constants | ||
* | ||
* @return {Number} Error code | ||
*/ | ||
value: function getCode() { | ||
var message = this.message.toLowerCase(); | ||
if (message === 'timeout') return _constants.ERROR_CODES.TIMEOUT; | ||
if (message.includes('this email address looks fake or invalid')) return _constants.ERROR_CODES.INVALID_EMAIL; | ||
if (message.includes('the domain portion of the email address is invalid')) return _constants.ERROR_CODES.INVALID_EMAIL_DOMAIN; | ||
if (message.includes('the username portion of the email address is invalid')) return _constants.ERROR_CODES.INVALID_EMAIL_USERNAME; | ||
if (message.includes('is already subscribed to list')) return _constants.ERROR_CODES.EMAIL_ALREADY_SUBSCRIBED; | ||
if (message.match(/^0\s-\s/)) return _constants.ERROR_CODES.INVALID_EMAIL; | ||
return _constants.ERROR_CODES.GENERIC; | ||
} | ||
/** | ||
* Gets optional context for the error code, by further parsing the error message | ||
* | ||
* @return {Object} | ||
*/ | ||
}, { | ||
key: "getContext", | ||
value: function getContext() { | ||
var context = {}; | ||
var message = this.message; | ||
var code = this.getCode(); | ||
switch (code) { | ||
case _constants.ERROR_CODES.EMAIL_ALREADY_SUBSCRIBED: | ||
context.manageSubscriptionLink = getLinks(message)[0]; | ||
break; | ||
} | ||
return context; | ||
} | ||
}]); | ||
return MailChimpError; | ||
@@ -92,2 +37,2 @@ }((0, _wrapNativeSuper2["default"])(Error)); | ||
exports["default"] = MailChimpError; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9NYWlsQ2hpbXBFcnJvci5qcyJdLCJuYW1lcyI6WyJnZXRMaW5rcyIsIm1lc3NhZ2UiLCJtYXRjaGVzIiwibWF0Y2giLCJtYXAiLCJyZXBsYWNlIiwiTWFpbENoaW1wRXJyb3IiLCJ0b0xvd2VyQ2FzZSIsIkVSUk9SX0NPREVTIiwiVElNRU9VVCIsImluY2x1ZGVzIiwiSU5WQUxJRF9FTUFJTCIsIklOVkFMSURfRU1BSUxfRE9NQUlOIiwiSU5WQUxJRF9FTUFJTF9VU0VSTkFNRSIsIkVNQUlMX0FMUkVBRFlfU1VCU0NSSUJFRCIsIkdFTkVSSUMiLCJjb250ZXh0IiwiY29kZSIsImdldENvZGUiLCJtYW5hZ2VTdWJzY3JpcHRpb25MaW5rIiwiRXJyb3IiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFBOztBQUVBLFNBQVNBLFFBQVQsQ0FBbUJDLE9BQW5CLEVBQTRCO0FBQzFCLE1BQU1DLE9BQU8sR0FBR0QsT0FBTyxDQUFDRSxLQUFSLENBQWMsc0JBQWQsQ0FBaEI7QUFDQSxTQUFPRCxPQUFPLEdBQ1ZBLE9BQU8sQ0FBQ0UsR0FBUixDQUFZLFVBQUFELEtBQUs7QUFBQSxXQUFJQSxLQUFLLENBQUNFLE9BQU4sQ0FBYyxtQkFBZCxFQUFtQyxJQUFuQyxDQUFKO0FBQUEsR0FBakIsQ0FEVSxHQUVWL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gICByZXR1cm4gY29udGV4dFxuICB9XG59XG4iXX0= | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9NYWlsQ2hpbXBFcnJvci5qcyJdLCJuYW1lcyI6WyJNYWlsQ2hpbXBFcnJvciIsIkVycm9yIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7O0lBQXFCQSxjOzs7Ozs7Ozs7OztvQ0FBdUJDLEsiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZGVmYXVsdCBjbGFzcyBNYWlsQ2hpbXBFcnJvciBleHRlbmRzIEVycm9yIHt9XG4iXX0= |
@@ -12,39 +12,13 @@ "use strict"; | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _constants = require("./constants"); | ||
var MailChimpSuccess = | ||
/** | ||
* Transforms success messages into codes | ||
* | ||
* @param {String} message The msg from mailchimp | ||
*/ | ||
var MailChimpSuccess = | ||
/*#__PURE__*/ | ||
function () { | ||
/** | ||
* | ||
* @param {String} message The msg from mailchimp | ||
*/ | ||
function MailChimpSuccess(message) { | ||
(0, _classCallCheck2["default"])(this, MailChimpSuccess); | ||
this.message = message; | ||
} | ||
/** | ||
* Gets the success code | ||
* | ||
* @return {Number} | ||
*/ | ||
function MailChimpSuccess(message) { | ||
(0, _classCallCheck2["default"])(this, MailChimpSuccess); | ||
this.message = message; | ||
}; | ||
(0, _createClass2["default"])(MailChimpSuccess, [{ | ||
key: "getCode", | ||
value: function getCode() { | ||
var message = this.message.toLowerCase(); | ||
if (message.includes('we need to confirm your email address')) return _constants.SUCCESS_CODES.CONFIRM_EMAIL_ADDRESS; | ||
return _constants.SUCCESS_CODES.GENERIC; | ||
} | ||
}]); | ||
return MailChimpSuccess; | ||
}(); | ||
exports["default"] = MailChimpSuccess; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjoz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4gICAqIEByZXR1cm4ge051bWJlcn1cbiAgICovXG4gIGdldENvZGUgKCkge1xuICAgIGNvbnN0IG1lc3NhZ2UgPSB0aGlzLm1lc3NhZ2UudG9Mb3dlckNhc2UoKVxuICAgIGlmIChtZXNzYWdlLmluY2x1ZGVzKCd3ZSBuZWVkIHRvIGNvbmZpcm0geW91ciBlbWFpbCBhZGRyZXNzJykpIHJldHVybiBTVUNDRVNTX0NPREVTLkNPTkZJUk1fRU1BSUxfQUREUkVTU1xuICAgIHJldHVybiBTVUNDRVNTX0NPREVTLkdFTkVSSUNcbiAgfVxufVxuIl19 | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9NYWlsQ2hpbXBTdWNjZXNzLmpzIl0sIm5hbWVzIjpbIk1haWxDaGltcFN1Y2Nlc3MiLCJtZXNzYWdlIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7OztJQUFxQkEsZ0I7QUFDbkI7Ozs7QUFJQSwwQkFBYUMsT0FBYixFQUFzQjtBQUFBO0FBQ3BCLE9BQUtBLE9BQUwsR0FBZUEsT0FBZjtBQUNELEMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZGVmYXVsdCBjbGFzcyBNYWlsQ2hpbXBTdWNjZXNzIHtcbiAgLyoqXG4gICAqXG4gICAqIEBwYXJhbSB7U3RyaW5nfSBtZXNzYWdlIFRoZSBtc2cgZnJvbSBtYWlsY2hpbXBcbiAgICovXG4gIGNvbnN0cnVjdG9yIChtZXNzYWdlKSB7XG4gICAgdGhpcy5tZXNzYWdlID0gbWVzc2FnZVxuICB9XG59XG4iXX0= |
{ | ||
"name": "@input-output-hk/mailchimp-subscribe", | ||
"version": "0.1.0", | ||
"description": "i18n friendly mailchimp subscriber", | ||
"version": "0.3.0", | ||
"description": "Lightweight mailchimp subscriber library supporting custom fields", | ||
"main": "build/index.js", | ||
@@ -18,7 +18,3 @@ "homepage": "https://github.com/input-output-hk/mailchimp-subscribe", | ||
"subscribe", | ||
"i18n", | ||
"internationalization", | ||
"locale", | ||
"localization", | ||
"language" | ||
"custom" | ||
], | ||
@@ -25,0 +21,0 @@ "repository": { |
@@ -6,3 +6,3 @@ <h1 align="center"> | ||
<p align="center"> | ||
An internationalization friendly mailchimp subscribe library. Subscribe emails to your mailing lists. | ||
A lightweight [Mailchimp](https://mailchimp.com/) subscriber library supporting custom fields. Subscribe emails to your mailing lists. | ||
</p> | ||
@@ -34,3 +34,2 @@ | ||
* Error codes and success codes for i18n | ||
* Custom fields | ||
@@ -78,63 +77,2 @@ | ||
### Basic supporting localization | ||
``` | ||
import subscribe, { SUCCESS_CODES, ERROR_CODES } from '@input-output-hk/mailchimp-subscribe' | ||
async function submitForm (email) { | ||
try { | ||
const result = await subscribe({ | ||
email, | ||
uID: 'XXXXXXXXX', | ||
audienceID: 'XXXXXXXXX', | ||
listName: 'XXXXXX.XXXX' | ||
}) | ||
const successCode = result.getCode() | ||
switch (successCode) { | ||
case SUCCESS_CODES.CONFIRM_EMAIL_ADDRESS: | ||
// Successfully subscribed, user needs to confirm email | ||
return '' // Use the code to return a localized string message | ||
case SUCCESS_CODES.GENERIC: | ||
// Successfully subscribed, default code | ||
return '' // Use the code to return a localized string message | ||
} | ||
} catch (error) { | ||
// Original message returned from mailchimp | ||
const message = error.message | ||
const errorCode = error.getCode() | ||
switch (successCode) { | ||
case ERROR_CODES.INVALID_EMAIL: | ||
// Email invalid | ||
return '' // Use the code to return a localized string message | ||
case ERROR_CODES.INVALID_EMAIL_DOMAIN: | ||
// Domain section of email invalid | ||
return '' // Use the code to return a localized string message | ||
case ERROR_CODES.INVALID_EMAIL_USERNAME: | ||
// Username section of email invalid | ||
return '' // Use the code to return a localized string message | ||
case ERROR_CODES.EMAIL_ALREADY_SUBSCRIBED: | ||
// Email is already subscribed to mailing list | ||
// Additional context is available here | ||
// Link to manage the subscription for the email address | ||
const manageSubscriptionLink = error.getContext().manageSubscriptionLink | ||
return '' // Use the code to return a localized string message | ||
case ERROR_CODES.TIMEOUT: | ||
// Request timed out | ||
return '' // Use the code to return a localized string message | ||
case ERROR_CODES.GENERIC: | ||
// Generic error code, server errors etc. | ||
return '' // Use the code to return a localized string message | ||
} | ||
} | ||
} | ||
``` | ||
### Basic without localization | ||
@@ -147,3 +85,3 @@ | ||
try { | ||
await subscribe({ | ||
const result = await subscribe({ | ||
email, | ||
@@ -155,7 +93,10 @@ uID: 'XXXXXXXXX', | ||
return true | ||
// Instance of MailChimpSuccess | ||
// result.message is the msg value received from Mailchimp | ||
return result | ||
} catch (error) { | ||
// handle error | ||
// error is instance of MailChimpError when error originates from mailchimp | ||
// error.message is the message returned from Mailchimp if the error originated on mailchimp | ||
return false | ||
return error | ||
} | ||
@@ -184,7 +125,10 @@ } | ||
return true | ||
// Instance of MailChimpSuccess | ||
// result.message is the msg value received from Mailchimp | ||
return result | ||
} catch (error) { | ||
// handle error | ||
// error is instance of MailChimpError when error originates from mailchimp | ||
// error.message is the message returned from Mailchimp if the error originated on mailchimp | ||
return false | ||
return error | ||
} | ||
@@ -211,7 +155,10 @@ } | ||
return true | ||
// Instance of MailChimpSuccess | ||
// result.message is the msg value received from Mailchimp | ||
return result | ||
} catch (error) { | ||
// handle error | ||
// error is instance of MailChimpError when error originates from mailchimp | ||
// error.message is the message returned from Mailchimp if the error originated on mailchimp | ||
return false | ||
return error | ||
} | ||
@@ -218,0 +165,0 @@ } |
import jsonp from 'jsonp' | ||
import MailChimpError from './MailChimpError' | ||
import MailChimpSuccess from './MailChimpSuccess' | ||
import { ERROR_CODES, SUCCESS_CODES } from './constants' | ||
@@ -23,3 +22,3 @@ const validateFields = ({ email, listName, uID, audienceID }) => { | ||
* | ||
* @return {Promise<MailChimpSuccess>} Rejects with MailChimpError | ||
* @return {Promise<MailChimpSuccess>} Or rejects with MailChimpError | ||
*/ | ||
@@ -30,3 +29,3 @@ export default ({ email, customFields, listName, uID, audienceID, timeout = 3000 }) => { | ||
const endpoint = '/subscribe/post-json' | ||
const parameters = { | ||
let parameters = { | ||
u: uID, | ||
@@ -39,3 +38,5 @@ id: audienceID, | ||
return new Promise((resolve, reject) => { | ||
jsonp(`${url}${endpoint}?${Object.keys(parameters).map(key => `${key}=${encodeURIComponent(parameters[key])}`).join('&')}`, { | ||
const queryString = Object.keys(parameters).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(parameters[key])}`).join('&') | ||
const fullURL = `${url}${endpoint}?${queryString}` | ||
jsonp(fullURL, { | ||
param: 'c', | ||
@@ -45,3 +46,3 @@ timeout | ||
try { | ||
if (err) throw new MailChimpError(err.message) | ||
if (err) throw err | ||
if (data.result === 'error') throw new MailChimpError(data.msg) | ||
@@ -55,6 +56,1 @@ resolve(new MailChimpSuccess(data.msg)) | ||
} | ||
export { | ||
ERROR_CODES, | ||
SUCCESS_CODES | ||
} |
import jsonp from 'jsonp' | ||
import subscribe, { ERROR_CODES, SUCCESS_CODES } from './' | ||
import subscribe from './' | ||
import MailChimpError from './MailChimpError' | ||
@@ -48,2 +49,3 @@ describe('subscribe', () => { | ||
beforeEach(() => { | ||
data = { msg: 'Success', result: 'success' } | ||
jsonp.mockImplementation((url, options, cb) => { | ||
@@ -61,67 +63,27 @@ cb(null, data) | ||
describe('generic success', () => { | ||
beforeEach(() => { | ||
data = { msg: 'Success', result: 'success' } | ||
}) | ||
test('it resolves with the GENERIC success code', async () => { | ||
const result = await subscribe({ email, uID, audienceID, listName }) | ||
expect(result.getCode()).toEqual(SUCCESS_CODES.GENERIC) | ||
}) | ||
test('it resolves with the success message', async () => { | ||
const result = await subscribe({ email, uID, audienceID, listName }) | ||
expect(result.message).toEqual('Success') | ||
}) | ||
describe('when a user needs to confirm their email address', () => { | ||
beforeEach(() => { | ||
data = { | ||
msg: 'Almost finished... We need to confirm your email address. To complete the subscription process, please click the link in the email we just sent you.', | ||
result: 'success' | ||
} | ||
}) | ||
test('it resolves with the CONFIRM_EMAIL_ADDRESS success code', async () => { | ||
const result = await subscribe({ email, uID, audienceID, listName }) | ||
expect(result.getCode()).toEqual(SUCCESS_CODES.CONFIRM_EMAIL_ADDRESS) | ||
}) | ||
}) | ||
}) | ||
describe('errors', () => { | ||
let error = {} | ||
async function assignError () { | ||
try { | ||
await subscribe({ email, uID, audienceID, listName }) | ||
} catch (err) { | ||
error = err | ||
} | ||
} | ||
let err, error | ||
describe('jsonp error', () => { | ||
let err | ||
beforeEach(() => { | ||
jsonp.mockImplementation((url, options, cb) => { | ||
cb(err, {}) | ||
}) | ||
beforeEach(async () => { | ||
err = new Error('jsonp error') | ||
jsonp.mockImplementation((url, options, cb) => cb(err, {})) | ||
try { | ||
await subscribe({ email, uID, audienceID, listName }) | ||
} catch (err) { | ||
error = err | ||
} | ||
}) | ||
describe('generic errors', () => { | ||
beforeEach(async () => { | ||
err = new Error('Generic error') | ||
await assignError() | ||
}) | ||
test('it rejects with the GENERIC error code', () => { | ||
expect(error.getCode()).toEqual(ERROR_CODES.GENERIC) | ||
}) | ||
test('it rejects with the jsonp error message', () => { | ||
expect(error.message).toEqual('jsonp error') | ||
}) | ||
describe('timeout errors', () => { | ||
beforeEach(async () => { | ||
err = new Error('Timeout') | ||
await assignError() | ||
}) | ||
test('it rejects with the TIMEOUT error code', () => { | ||
expect(error.getCode()).toEqual(ERROR_CODES.TIMEOUT) | ||
}) | ||
test('the error is not an instance of MailChimpError', () => { | ||
expect(error).not.toBeInstanceOf(MailChimpError) | ||
}) | ||
@@ -132,81 +94,21 @@ }) | ||
let data = { result: 'error' } | ||
beforeEach(() => { | ||
jsonp.mockImplementation((url, options, cb) => { | ||
cb(null, data) | ||
}) | ||
beforeEach(async () => { | ||
data.msg = 'Mailchimp error' | ||
jsonp.mockImplementation((url, options, cb) => cb(null, data)) | ||
try { | ||
await subscribe({ email, uID, audienceID, listName }) | ||
} catch (err) { | ||
error = err | ||
} | ||
}) | ||
describe('generic error', () => { | ||
beforeEach(async () => { | ||
data.msg = 'borked' | ||
await assignError() | ||
}) | ||
test('it rejects with the GENERIC error code', () => { | ||
expect(error.getCode()).toEqual(ERROR_CODES.GENERIC) | ||
}) | ||
test('it rejects with the mailchimp error message', () => { | ||
expect(error.message).toEqual('Mailchimp error') | ||
}) | ||
describe('invalid emails', () => { | ||
beforeEach(async () => { | ||
data.msg = '0 - This email address looks fake or invalid. Please enter a real email address.' | ||
await assignError() | ||
}) | ||
test('it rejects with the INVALID_EMAIL error code', () => { | ||
expect(error.getCode()).toEqual(ERROR_CODES.INVALID_EMAIL) | ||
}) | ||
test('it rejects with a MailChimpError instance', () => { | ||
expect(error).toBeInstanceOf(MailChimpError) | ||
}) | ||
describe('messages beginning with `0 - `', () => { | ||
beforeEach(async () => { | ||
data.msg = '0 - Some error' | ||
await assignError() | ||
}) | ||
test('it rejects with the INVALID_EMAIL error code', () => { | ||
expect(error.getCode()).toEqual(ERROR_CODES.INVALID_EMAIL) | ||
}) | ||
}) | ||
describe('invalid email domain', () => { | ||
beforeEach(async () => { | ||
data.msg = '0 - The domain portion of the email address is invalid (the portion after the @: example)' | ||
await assignError() | ||
}) | ||
test('it rejects with the INVALID_EMAIL_DOMAIN error code', () => { | ||
expect(error.getCode()).toEqual(ERROR_CODES.INVALID_EMAIL_DOMAIN) | ||
}) | ||
}) | ||
describe('invalid email username', () => { | ||
beforeEach(async () => { | ||
data.msg = '0 - The username portion of the email address is invalid (the portion before the @: .)' | ||
await assignError() | ||
}) | ||
test('it rejects with the INVALID_EMAIL_USERNAME error code', () => { | ||
expect(error.getCode()).toEqual(ERROR_CODES.INVALID_EMAIL_USERNAME) | ||
}) | ||
}) | ||
describe('email already subscribed', () => { | ||
beforeEach(async () => { | ||
data.msg = 'example@example.org is already subscribed to list abc.def. <a href="https://abc.def.list-manage.com/subscribe/send-email?e=abcdefg">Click here to update your profile</a>' | ||
await assignError() | ||
}) | ||
test('it rejects with the EMAIL_ALREADY_SUBSCRIBED error code', () => { | ||
expect(error.getCode()).toEqual(ERROR_CODES.EMAIL_ALREADY_SUBSCRIBED) | ||
}) | ||
test('it returns the manage link in context', () => { | ||
expect(error.getContext()).toEqual({ | ||
manageSubscriptionLink: 'https://abc.def.list-manage.com/subscribe/send-email?e=abcdefg' | ||
}) | ||
}) | ||
}) | ||
}) | ||
}) | ||
}) |
@@ -1,47 +0,1 @@ | ||
import { ERROR_CODES } from './constants' | ||
function getLinks (message) { | ||
const matches = message.match(/<a href=("|')[^"']+/g) | ||
return matches | ||
? matches.map(match => match.replace(/^.*?("|')([^"']+)/, '$2')) | ||
: [] | ||
} | ||
/** | ||
* Transforms error message strings from mailchimp into error codes | ||
*/ | ||
export default class MailChimpError extends Error { | ||
/** | ||
* Get the error code from error code constants | ||
* | ||
* @return {Number} Error code | ||
*/ | ||
getCode () { | ||
const message = this.message.toLowerCase() | ||
if (message === 'timeout') return ERROR_CODES.TIMEOUT | ||
if (message.includes('this email address looks fake or invalid')) return ERROR_CODES.INVALID_EMAIL | ||
if (message.includes('the domain portion of the email address is invalid')) return ERROR_CODES.INVALID_EMAIL_DOMAIN | ||
if (message.includes('the username portion of the email address is invalid')) return ERROR_CODES.INVALID_EMAIL_USERNAME | ||
if (message.includes('is already subscribed to list')) return ERROR_CODES.EMAIL_ALREADY_SUBSCRIBED | ||
if (message.match(/^0\s-\s/)) return ERROR_CODES.INVALID_EMAIL | ||
return ERROR_CODES.GENERIC | ||
} | ||
/** | ||
* Gets optional context for the error code, by further parsing the error message | ||
* | ||
* @return {Object} | ||
*/ | ||
getContext () { | ||
let context = {} | ||
const { message } = this | ||
const code = this.getCode() | ||
switch (code) { | ||
case ERROR_CODES.EMAIL_ALREADY_SUBSCRIBED: | ||
context.manageSubscriptionLink = getLinks(message)[0] | ||
break | ||
} | ||
return context | ||
} | ||
} | ||
export default class MailChimpError extends Error {} |
@@ -1,6 +0,1 @@ | ||
import { SUCCESS_CODES } from './constants' | ||
/** | ||
* Transforms success messages into codes | ||
*/ | ||
export default class MailChimpSuccess { | ||
@@ -14,13 +9,2 @@ /** | ||
} | ||
/** | ||
* Gets the success code | ||
* | ||
* @return {Number} | ||
*/ | ||
getCode () { | ||
const message = this.message.toLowerCase() | ||
if (message.includes('we need to confirm your email address')) return SUCCESS_CODES.CONFIRM_EMAIL_ADDRESS | ||
return SUCCESS_CODES.GENERIC | ||
} | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
43072
11
474
165
1