Skip to content

Commit 06cc780

Browse files
committed
[sdk] Journey trigger events
1 parent 32b326f commit 06cc780

10 files changed

Lines changed: 60 additions & 10 deletions

File tree

plugins/sdk/api/api.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const validOptions = [
2828
"ltl",
2929
"lt",
3030
"rcz",
31+
"jte",
3132
"bom",
3233
"bom_at",
3334
"bom_rqp",

plugins/sdk/frontend/public/javascripts/countly.views.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
var v2_web = "25.4.1";
1616
var v2_flutter = "25.4.1";
1717
var v2_react_native = "25.4.0";
18+
// Initial SDKs that support Journey Trigger Events
19+
var v3_android = "26.1.0";
20+
var v3_ios = "26.1.0";
21+
var v3_web = "26.1.0";
22+
var v3_flutter = "26.1.0";
23+
var v3_react_native = "26.1.0";
1824
// dart sdk placeholder version to indicate experimental support
1925
var v0_dart = "25.0.0";
2026
// Supporting SDK Versions for the SC options
@@ -41,6 +47,7 @@
4147
ltl: { android: v1_android, ios: v1_ios, web: v1_web, flutter: v2_flutter, react_native: v2_react_native },
4248
lt: { android: v1_android, ios: v1_ios, web: v1_web, flutter: v2_flutter, react_native: v2_react_native },
4349
rcz: { android: v1_android, ios: v1_ios, web: v1_web, flutter: v2_flutter, react_native: v2_react_native },
50+
jte: { android: v3_android, ios: v3_ios, web: v3_web, flutter: v3_flutter, react_native: v3_react_native },
4451
bom_preset: { android: v2_android, ios: v2_ios, web: v2_web, flutter: v2_flutter, react_native: v2_react_native },
4552
bom: { android: v2_android, ios: v2_ios, web: v2_web, flutter: v2_flutter, react_native: v2_react_native },
4653
bom_at: { android: v2_android, ios: v2_ios, web: v2_web, flutter: v2_flutter, react_native: v2_react_native },
@@ -59,7 +66,7 @@
5966
esw: { dart: v0_dart }
6067
};
6168

62-
var nonJSONExperimentalKeys = ['eb', 'upb', 'sb', 'ew', 'upw', 'sw'];
69+
var nonJSONExperimentalKeys = ['eb', 'upb', 'sb', 'ew', 'upw', 'sw', 'jte'];
6370
var jsonExperimentalKeys = ['esb', 'esw'];
6471
var shouldShowExperimental = true;
6572
var experimentalKeys = ['upcl', 'filter_preset'].concat(nonJSONExperimentalKeys, jsonExperimentalKeys);
@@ -222,7 +229,7 @@
222229
},
223230
experimental: {
224231
label: "Experimental",
225-
list: ["upcl", "filter_preset", "eb", "upb", "sb", "esb", "ew", "upw", "sw", "esw"]
232+
list: ["upcl", "filter_preset", "jte", "eb", "upb", "sb", "esb", "ew", "upw", "sw", "esw"]
226233
},
227234
},
228235
configs: {
@@ -475,6 +482,15 @@
475482
enforced: false,
476483
value: null
477484
},
485+
jte: {
486+
type: "text",
487+
name: "Journey Trigger Events",
488+
description: "CSV* list of event keys that should trigger a Journey<br>* Use double quotes for values with commas",
489+
default: "",
490+
enforced: false,
491+
value: null,
492+
attrs: { type: 'textarea', rows: 4, placeholder: 'event1,event2 or "event3"' }
493+
},
478494
filter_preset: {
479495
type: "preset",
480496
name: "Filtering Preset",
@@ -1131,7 +1147,7 @@
11311147
for (var key in this.configs) {
11321148
this.configs[key].experimental = false;
11331149
this.configs[key].tooltipMessage = "No SDK data present. Please use the latest versions of Android, Web, iOS, Flutter or RN SDKs to use this option.";
1134-
if (key === 'upcl' || key === 'eb' || key === 'upb' || key === 'sb' || key === 'esb' || key === 'ew' || key === 'upw' || key === 'sw' || key === 'esw' || key === 'filter_preset') {
1150+
if (key === 'upcl' || key === 'eb' || key === 'upb' || key === 'sb' || key === 'esb' || key === 'ew' || key === 'upw' || key === 'sw' || key === 'esw' || key === 'filter_preset' || key === 'jte') {
11351151
this.configs[key].experimental = true;
11361152
this.configs[key].tooltipMessage = "This is an experimental option. SDK support for this option may be limited or unavailable.";
11371153
}

plugins/sdk/tests/tests.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ var validOptions = {
3131
"ltl": false,
3232
"lt": false,
3333
"rcz": false,
34+
"jte": false,
3435
"bom": false,
3536
"bom_at": false,
3637
"bom_rqp": false,

plugins/sdk/tests/validation_tests.js

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ describe('CSV/Array and JSON validation', function() {
2424
eb: true,
2525
upb: true,
2626
sb: true,
27-
esb: true
27+
esb: true,
28+
jte: true
2829
};
2930

3031
request
@@ -139,6 +140,37 @@ describe('CSV/Array and JSON validation', function() {
139140
done();
140141
});
141142
});
143+
144+
it('4. should save arrays for jte when provided as array', function(done) {
145+
const parameter = {
146+
jte: ['event1', 'event,2']
147+
};
148+
149+
request
150+
.post('/i/sdk-config/update-parameter')
151+
.send({ api_key: API_KEY_ADMIN, app_id: APP_ID, parameter: JSON.stringify(parameter) })
152+
.expect(200)
153+
.end(function(err, res) {
154+
should.not.exist(err);
155+
res.body.should.have.property('result', 'Success');
156+
157+
request
158+
.get('/o/sdk')
159+
.query({ method: 'sc', app_key: APP_KEY, device_id: 'test' })
160+
.expect(200)
161+
.end(function(err, res) {
162+
should.not.exist(err);
163+
res.body.should.have.property('c');
164+
const c = res.body.c;
165+
c.should.have.property('jte');
166+
c.jte.should.be.an.Array();
167+
c.jte.should.have.length(2);
168+
c.jte.should.containEql('event1');
169+
c.jte.should.containEql('event,2');
170+
done();
171+
});
172+
});
173+
});
142174
});
143175

144176
// CSV unit tests

ui-tests/cypress/e2e/sdk/tool_01.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ describe('1.Neutral tooltip (default at app creation)', () => {
99
});
1010
it('1.3-Test', function() {
1111
goToConfigTab(true);
12-
checkTooltipAppears('neutral', 34);
12+
checkTooltipAppears('neutral', 35);
1313
});
1414
});

ui-tests/cypress/e2e/sdk/tool_02.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ describe('2.Warning tooltip (old Web SDK version)', () => {
1414
});
1515
it('2.3-Test', function() {
1616
goToConfigTab(true);
17-
checkTooltipAppears('warning', 34);
17+
checkTooltipAppears('warning', 35);
1818
});
1919
});

ui-tests/cypress/e2e/sdk/tool_04.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ describe('4.Mixed tooltip (old Android SDK version)', () => {
1515
it('4.3-Test', function() {
1616
goToConfigTab(true);
1717
checkTooltipAppears('success', 2, true);
18-
checkTooltipAppears('warning', 32, true);
18+
checkTooltipAppears('warning', 33, true);
1919
});
2020
});

ui-tests/cypress/e2e/sdk/tool_05.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ describe('5.Mixed tooltip (old iOS SDK version)', () => {
1515
it('5.3-Test', function() {
1616
goToConfigTab(true);
1717
checkTooltipAppears('success', 2, true);
18-
checkTooltipAppears('warning', 32, true);
18+
checkTooltipAppears('warning', 33, true);
1919
});
2020
});

ui-tests/cypress/e2e/sdk/tool_06.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ describe('6.Danger tooltip (unsupported SDK)', () => {
1414
});
1515
it('6.3-Test', function() {
1616
goToConfigTab(true);
17-
checkTooltipAppears('danger', 34);
17+
checkTooltipAppears('danger', 35);
1818
});
1919
});

ui-tests/cypress/e2e/sdk/tool_09.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ describe('9.Mixed tooltip (multiple SDK versions)', () => {
1818
it('9.3-Test', function() {
1919
goToConfigTab(true);
2020
checkTooltipAppears('success', 2, true);
21-
checkTooltipAppears('warning', 32, true);
21+
checkTooltipAppears('warning', 33, true);
2222
});
2323
});

0 commit comments

Comments
 (0)