@bluedot-innovation/models 8.3.4 → 8.3.5
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
|
@@ -89,6 +89,13 @@
|
|
|
89
89
|
"nowReadyEnabled": true,
|
|
90
90
|
"clientId": "782241d1-4d7d-4130-92ee-3c4668afe2ab",
|
|
91
91
|
"lastSyncedTime": "2022-10-21T04:12:02.103Z"
|
|
92
|
+
},
|
|
93
|
+
"klaviyo": {
|
|
94
|
+
"enabled": true,
|
|
95
|
+
"trigger": true,
|
|
96
|
+
"tempo": true,
|
|
97
|
+
"wave": true,
|
|
98
|
+
"hello": true
|
|
92
99
|
}
|
|
93
100
|
},
|
|
94
101
|
"tempo": {
|
|
@@ -681,6 +681,53 @@ describe('Project', () => {
|
|
|
681
681
|
})
|
|
682
682
|
})
|
|
683
683
|
|
|
684
|
+
describe("Klaviyo integration validation", () => {
|
|
685
|
+
it('should throw an error when enabled is non boolean', (done) => {
|
|
686
|
+
project.integrations.klaviyo.enabled = "invalid"
|
|
687
|
+
let Project = new ProjectModel(project)
|
|
688
|
+
Project.validate((err, res) => {
|
|
689
|
+
assert.exists(err)
|
|
690
|
+
assert.match(err.message, /Cast to Boolean failed for value "invalid" .* at path "enabled"/)
|
|
691
|
+
done()
|
|
692
|
+
})
|
|
693
|
+
})
|
|
694
|
+
it('should throw an error when trigger is non boolean', (done) => {
|
|
695
|
+
project.integrations.klaviyo.trigger = "invalid"
|
|
696
|
+
let Project = new ProjectModel(project)
|
|
697
|
+
Project.validate((err, res) => {
|
|
698
|
+
assert.exists(err)
|
|
699
|
+
assert.match(err.message, /Cast to Boolean failed for value "invalid" .* at path "trigger"/)
|
|
700
|
+
done()
|
|
701
|
+
})
|
|
702
|
+
})
|
|
703
|
+
it('should throw an error when tempo is non boolean', (done) => {
|
|
704
|
+
project.integrations.klaviyo.tempo = "invalid"
|
|
705
|
+
let Project = new ProjectModel(project)
|
|
706
|
+
Project.validate((err, res) => {
|
|
707
|
+
assert.exists(err)
|
|
708
|
+
assert.match(err.message, /Cast to Boolean failed for value "invalid" .* at path "tempo"/)
|
|
709
|
+
done()
|
|
710
|
+
})
|
|
711
|
+
})
|
|
712
|
+
it('should throw an error when wave is non boolean', (done) => {
|
|
713
|
+
project.integrations.klaviyo.wave = "invalid"
|
|
714
|
+
let Project = new ProjectModel(project)
|
|
715
|
+
Project.validate((err, res) => {
|
|
716
|
+
assert.exists(err)
|
|
717
|
+
assert.match(err.message, /Cast to Boolean failed for value "invalid" .* at path "wave"/)
|
|
718
|
+
done()
|
|
719
|
+
})
|
|
720
|
+
})
|
|
721
|
+
it('should throw an error when hello is non boolean', (done) => {
|
|
722
|
+
project.integrations.klaviyo.hello = "invalid"
|
|
723
|
+
let Project = new ProjectModel(project)
|
|
724
|
+
Project.validate((err, res) => {
|
|
725
|
+
assert.exists(err)
|
|
726
|
+
assert.match(err.message, /Cast to Boolean failed for value "invalid" .* at path "hello"/)
|
|
727
|
+
done()
|
|
728
|
+
})
|
|
729
|
+
})
|
|
730
|
+
})
|
|
684
731
|
})
|
|
685
732
|
|
|
686
733
|
describe('should throw an error when any of the values of the array contains a falsy value', () => {
|
package/package.json
CHANGED
package/schemas/Integration.js
CHANGED
|
@@ -7,6 +7,7 @@ const flipdishIntegrationSchema = require('./FlipdishIntegration')
|
|
|
7
7
|
const projectAttentiveIntegrationSchema = require('./ProjectAttentiveIntegration')
|
|
8
8
|
const incentivioIntegrationSchema = require('./IncentivioIntegration')
|
|
9
9
|
const mparticleIntegrationSchema = require('./MparticleIntegration')
|
|
10
|
+
const klaviyoIntegrationSchema = require('./KlaviyoIntegration');
|
|
10
11
|
|
|
11
12
|
function mParticleValidator(value) {
|
|
12
13
|
const { androidApiKey, iosApiKey, webApiKey } = value;
|
|
@@ -21,7 +22,8 @@ const IntegrationSchema = new mongoose.Schema({
|
|
|
21
22
|
bbot: { type: bbotIntegrationSchema },
|
|
22
23
|
flipdish: { type: flipdishIntegrationSchema },
|
|
23
24
|
attentive: { type: projectAttentiveIntegrationSchema },
|
|
24
|
-
incentivio: { type: incentivioIntegrationSchema }
|
|
25
|
+
incentivio: { type: incentivioIntegrationSchema },
|
|
26
|
+
klaviyo: { type: klaviyoIntegrationSchema }
|
|
25
27
|
},{ _id : false });
|
|
26
28
|
|
|
27
29
|
module.exports = IntegrationSchema
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const mongoose = require('mongoose');
|
|
2
|
+
|
|
3
|
+
let KlaviyoIntegrationSchema = new mongoose.Schema({
|
|
4
|
+
enabled: {type: Boolean, default: false},
|
|
5
|
+
trigger: {type: Boolean, default: false},
|
|
6
|
+
tempo: {type: Boolean, default: false},
|
|
7
|
+
wave: {type: Boolean, default: false},
|
|
8
|
+
hello: {type: Boolean, default: false}
|
|
9
|
+
}, {
|
|
10
|
+
_id: false
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
module.exports = KlaviyoIntegrationSchema
|