leadconduit-trustedform 2.0.1 → 2.0.2

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org)
4
4
 
5
+ ## [2.0.2] - 2023-01-05
6
+ ### Fixed
7
+ - Revert previous change; make insights set `billable` again ([sc-47859](https://app.shortcut.com/active-prospect/story/47859/include-tf-insights-in-usages-results))
8
+
5
9
  ## [2.0.1] - 2022-12-14
6
10
  ### Fixed
7
11
  - Issue with billable being set in insights ([sc-47158](https://app.shortcut.com/active-prospect/story/47158/tf-insights-missing-from-usages-exclusion-list))
package/lib/insights.js CHANGED
@@ -63,7 +63,8 @@ const response = (vars, req, res) => {
63
63
  } catch (e) {
64
64
  return {
65
65
  outcome: 'error',
66
- reason: 'unable to parse response'
66
+ reason: 'unable to parse response',
67
+ billable: 0
67
68
  };
68
69
  }
69
70
  if (res.status === 201) {
@@ -72,6 +73,7 @@ const response = (vars, req, res) => {
72
73
 
73
74
  const response = {
74
75
  outcome: 'success',
76
+ billable: 1,
75
77
  age: event.age,
76
78
  browser: cert.browser,
77
79
  created_at: cert.created_at,
@@ -108,12 +110,14 @@ const response = (vars, req, res) => {
108
110
  } else if (res.status >= 400 && res.status < 500) {
109
111
  return {
110
112
  outcome: 'failure',
111
- reason: get(event, 'errors.detail')
113
+ reason: get(event, 'errors.detail'),
114
+ billable: 0
112
115
  };
113
116
  } else {
114
117
  return {
115
118
  outcome: 'error',
116
- reason: `unknown error (${res.status})`
119
+ reason: `unknown error (${res.status})`,
120
+ billable: 0
117
121
  };
118
122
  }
119
123
  };
@@ -121,6 +125,7 @@ const response = (vars, req, res) => {
121
125
  response.variables = () => [
122
126
  { name: 'outcome', type: 'string', description: 'Integration outcome (success, failure, or error)' },
123
127
  { name: 'reason', type: 'string', description: 'in case of failure, the reason for failure' },
128
+ { name: 'billable', type: 'number', description: 'If the event is billable, the billable count for the event, else 0' },
124
129
  { name: 'age', type: 'number', description: 'Number of seconds since the certificate was created' },
125
130
  { name: 'browser', type: 'string', description: 'Human friendly version of user-agent' },
126
131
  { name: 'consented_at', type: 'time', description: 'Time the user checked the consent language checkbox, in UTC ISO8601 format' },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leadconduit-trustedform",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "LeadConduit integration with TrustedForm",
5
5
  "main": "index.js",
6
6
  "scripts": {