rejoiner 2.10.2 → 2.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,11 +11,11 @@ const customerEndpoint = (client) => {
11
11
  if (always) return dispatchReturnData('post')(`${endpoint}/always_convert/`, data)
12
12
  return dispatchReturnData('post')(`${endpoint}/convert/`, data)
13
13
  },
14
- cancel: email => postEmail(`${endpoint}/cancel/`, email),
15
- unsubscribe: email => postEmail(`${endpoint}/unsubscribe/`, email),
16
- optIn: email => postEmail(`${endpoint}/opt_in/`, email),
17
- get: email => dispatchReturnData('get')(`customers/${email}/`),
18
- update: data => putEmail(`customers/${data.email}/`, data),
14
+ cancel: (email) => postEmail(`${endpoint}/cancel/`, email),
15
+ unsubscribe: (email) => postEmail(`${endpoint}/unsubscribe/`, email),
16
+ optIn: (email) => postEmail(`${endpoint}/opt_in/`, email),
17
+ get: (email) => dispatchReturnData('get')(`customers/${email}/`),
18
+ update: (data) => putEmail(`customers/${data.email}/`, data),
19
19
  }
20
20
  }
21
21
 
@@ -5,8 +5,8 @@ const path = 'journeys'
5
5
  const journeysEndpoint = (client) => {
6
6
  const { dispatchReturnData } = withClient(client)
7
7
 
8
- const endpoint = journeyId => ({
9
- nodes: nodeId => ({
8
+ const endpoint = (journeyId) => ({
9
+ nodes: (nodeId) => ({
10
10
  webhook: (email) => {
11
11
  const requestPath = `${path}/${journeyId}/nodes/${nodeId}/webhook_event_wait/`
12
12
 
@@ -19,11 +19,12 @@ const journeysEndpoint = (client) => {
19
19
  }
20
20
 
21
21
  if (typeof email === 'object' && typeof email.email === 'string') {
22
- return dispatchReturnData('post')(requestPath, Object.assign(
23
- { customer_data: {}, session_data: {} },
24
- email,
25
- { email: email.email.toLowerCase() },
26
- ))
22
+ return dispatchReturnData('post')(requestPath, {
23
+ customer_data: {},
24
+ session_data: {},
25
+ ...email,
26
+ email: email.email.toLowerCase(),
27
+ })
27
28
  }
28
29
 
29
30
  return Promise.reject(new Error('Request is missing required email parameter.'))
@@ -15,13 +15,13 @@ const listsEndpoint = (client) => {
15
15
 
16
16
  return dispatchReturnData('post')(`${endpoint}/`, name)
17
17
  },
18
- contacts: listId => ({
18
+ contacts: (listId) => ({
19
19
  get: (page) => {
20
20
  const pagination = page ? `?page=${page}` : ''
21
21
  return dispatchReturnData('get')(`${endpoint}/${listId}/contacts/${pagination}`)
22
22
  },
23
- add: email => postEmail(`${endpoint}/${listId}/contacts/`, email),
24
- remove: email => postEmail(`${endpoint}/${listId}/contacts/remove/`, email),
23
+ add: (email) => postEmail(`${endpoint}/${listId}/contacts/`, email),
24
+ remove: (email) => postEmail(`${endpoint}/${listId}/contacts/remove/`, email),
25
25
  }),
26
26
  }
27
27
  }
@@ -4,7 +4,7 @@ const pingEndpoint = (client) => {
4
4
  return {
5
5
  path: endpoint,
6
6
  ping: () => client.dispatch.get('/ping/')
7
- .then(res => res.data),
7
+ .then((res) => res.data),
8
8
  }
9
9
  }
10
10
 
@@ -7,7 +7,7 @@ const segmentsEndpoint = (client) => {
7
7
 
8
8
  return {
9
9
  path: endpoint,
10
- customers: segmentId => ({
10
+ customers: (segmentId) => ({
11
11
  get: () => dispatchReturnData('get')(`${endpoint}/${segmentId}/customers/`),
12
12
  }),
13
13
  }
package/lib/helpers.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const withClient = (client) => {
2
- const dispatchReturnData = method => (...args) => client.dispatch[method](...args)
3
- .then(res => res.data)
2
+ const dispatchReturnData = (method) => (...args) => client.dispatch[method](...args)
3
+ .then((res) => res.data)
4
4
 
5
5
  const withEmail = (method, path, email) => {
6
6
  if (typeof email === 'string') {
@@ -8,11 +8,11 @@ const withClient = (client) => {
8
8
  }
9
9
 
10
10
  if (typeof email === 'object' && typeof email.email === 'string') {
11
- return dispatchReturnData(method)(path, Object.assign(
12
- {},
13
- email,
14
- { email: email.email.toLowerCase() },
15
- ))
11
+ return dispatchReturnData(method)(path, {
12
+
13
+ ...email,
14
+ email: email.email.toLowerCase(),
15
+ })
16
16
  }
17
17
 
18
18
  return Promise.reject(new Error('Request is missing required email parameter.'))
package/lib/rejoiner.js CHANGED
@@ -32,7 +32,7 @@ function Rejoiner2(options) {
32
32
  })
33
33
 
34
34
  fs.readdirSync(path.join(__dirname, 'endpoints'))
35
- .filter(file => file.indexOf('.') !== 0)
35
+ .filter((file) => file.indexOf('.') !== 0)
36
36
  .forEach((file) => {
37
37
  // eslint-disable-next-line global-require, import/no-dynamic-require
38
38
  const endpoint = require(path.join(__dirname, 'endpoints', file))(this)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rejoiner",
3
3
  "description": "Rejoiner REST API client wrapper for Node.js",
4
- "version": "2.10.2",
4
+ "version": "2.10.3",
5
5
  "main": "lib/rejoiner.js",
6
6
  "author": "Sascha Bratton <sascha@brattonbratton.com>",
7
7
  "license": "MIT",
@@ -19,9 +19,9 @@
19
19
  ],
20
20
  "scripts": {
21
21
  "lint": "eslint lib --ext .js",
22
- "test": "yarn lint",
23
- "precommit": "yarn test",
24
- "prepush": "yarn test"
22
+ "test": "npm run lint",
23
+ "precommit": "npm run test",
24
+ "prepush": "npm run test"
25
25
  },
26
26
  "dependencies": {
27
27
  "axios": ">=0.18.1",
@@ -29,10 +29,10 @@
29
29
  "lodash.merge": "^4.6.2"
30
30
  },
31
31
  "devDependencies": {
32
- "eslint": "^5.3.0",
33
- "eslint-config-airbnb-base": "^13.2.0",
32
+ "eslint": "^8.16.0",
33
+ "eslint-config-airbnb-base": "^15.0.0",
34
34
  "eslint-plugin-import": "^2.17.2",
35
- "husky": "^0.14.3"
35
+ "husky": "^8.0.1"
36
36
  },
37
37
  "engines": {
38
38
  "node": ">=8.3.0"