@sprucelabs/spruce-mmp-vc-plugin 2.1.388 → 2.1.390
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/build/AdjustMmpVcPlugin.d.ts +1 -0
- package/build/AdjustMmpVcPlugin.js +4 -7
- package/build/MockAdjustMmpVcPlugin.js +2 -3
- package/build/errors/SpruceError.js +1 -1
- package/build/esm/AdjustMmpVcPlugin.d.ts +1 -0
- package/build/esm/AdjustMmpVcPlugin.js +4 -4
- package/build/mmpAssert.js +5 -5
- package/package.json +20 -21
|
@@ -3,6 +3,7 @@ import { MmpVcPlugin } from './mmp.types';
|
|
|
3
3
|
export default class AdjustMmpVcPlugin implements ViewControllerPlugin, MmpVcPlugin<AdjustMmpVcPluginSetupOptions, AdjustTrackEventOptions> {
|
|
4
4
|
private device;
|
|
5
5
|
private isSetup;
|
|
6
|
+
private log;
|
|
6
7
|
constructor(options: ViewControllerPluginOptions);
|
|
7
8
|
setup(options: AdjustMmpVcPluginSetupOptions): void;
|
|
8
9
|
trackEvent(eventName: string, options?: AdjustTrackEventOptions): void;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
const schema_1 = require("@sprucelabs/schema");
|
|
7
|
-
const
|
|
4
|
+
const spruce_skill_utils_1 = require("@sprucelabs/spruce-skill-utils");
|
|
8
5
|
class AdjustMmpVcPlugin {
|
|
9
6
|
constructor(options) {
|
|
10
7
|
this.isSetup = false;
|
|
8
|
+
this.log = (0, spruce_skill_utils_1.buildLog)('AdjustMmpVcPlugin');
|
|
11
9
|
const { device } = options;
|
|
12
10
|
this.device = device;
|
|
13
11
|
}
|
|
@@ -24,9 +22,8 @@ class AdjustMmpVcPlugin {
|
|
|
24
22
|
}
|
|
25
23
|
trackEvent(eventName, options) {
|
|
26
24
|
if (!this.isSetup) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
});
|
|
25
|
+
this.log.warn('AdjustMmpVcPlugin not setup, skipping trackEvent');
|
|
26
|
+
return;
|
|
30
27
|
}
|
|
31
28
|
(0, schema_1.assertOptions)({ eventName }, ['eventName']);
|
|
32
29
|
this.device.sendCommand('mmp_track_event:adjust', {
|
|
@@ -22,9 +22,8 @@ class MockAdjustMmpVcPlugin extends AdjustMmpVcPlugin_1.default {
|
|
|
22
22
|
test_utils_1.assert.isTruthy(this.lastTrackedEvent, `You gotta call this.plugins.mmp.trackEvent(...)`);
|
|
23
23
|
}
|
|
24
24
|
assertTrackEventWasCalledWith(eventName, options) {
|
|
25
|
-
|
|
26
|
-
test_utils_1.assert.
|
|
27
|
-
test_utils_1.assert.isEqualDeep(options, (_c = this.lastTrackedEvent) === null || _c === void 0 ? void 0 : _c.options, `this.plugins.mmp.trackEvent(...) was not called with the expected options.`);
|
|
25
|
+
test_utils_1.assert.isEqual(eventName, this.lastTrackedEvent?.eventName, `this.plugins.mmp.trackEvent(...) was not called with the expected eventName. Expected: ${eventName}, got: ${this.lastTrackedEvent?.eventName}`);
|
|
26
|
+
test_utils_1.assert.isEqualDeep(options, this.lastTrackedEvent?.options, `this.plugins.mmp.trackEvent(...) was not called with the expected options.`);
|
|
28
27
|
}
|
|
29
28
|
assertSetupWasCalled() {
|
|
30
29
|
test_utils_1.assert.isTruthy(this.lastSetupOptions, `You gotta call this.plugins.mmp.setup(...)`);
|
|
@@ -9,7 +9,7 @@ class SpruceError extends error_1.default {
|
|
|
9
9
|
friendlyMessage() {
|
|
10
10
|
const { options } = this;
|
|
11
11
|
let message;
|
|
12
|
-
switch (options
|
|
12
|
+
switch (options?.code) {
|
|
13
13
|
case 'ADJUST_NOT_SETUP':
|
|
14
14
|
message =
|
|
15
15
|
'Adjust is not setup yet. Try `this.plugins.adjustMmp.setup(...)`';
|
|
@@ -3,6 +3,7 @@ import { MmpVcPlugin } from './mmp.types';
|
|
|
3
3
|
export default class AdjustMmpVcPlugin implements ViewControllerPlugin, MmpVcPlugin<AdjustMmpVcPluginSetupOptions, AdjustTrackEventOptions> {
|
|
4
4
|
private device;
|
|
5
5
|
private isSetup;
|
|
6
|
+
private log;
|
|
6
7
|
constructor(options: ViewControllerPluginOptions);
|
|
7
8
|
setup(options: AdjustMmpVcPluginSetupOptions): void;
|
|
8
9
|
trackEvent(eventName: string, options?: AdjustTrackEventOptions): void;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { assertOptions } from '@sprucelabs/schema';
|
|
2
|
-
import
|
|
2
|
+
import { buildLog } from '@sprucelabs/spruce-skill-utils';
|
|
3
3
|
export default class AdjustMmpVcPlugin {
|
|
4
4
|
constructor(options) {
|
|
5
5
|
this.isSetup = false;
|
|
6
|
+
this.log = buildLog('AdjustMmpVcPlugin');
|
|
6
7
|
const { device } = options;
|
|
7
8
|
this.device = device;
|
|
8
9
|
}
|
|
@@ -19,9 +20,8 @@ export default class AdjustMmpVcPlugin {
|
|
|
19
20
|
}
|
|
20
21
|
trackEvent(eventName, options) {
|
|
21
22
|
if (!this.isSetup) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
23
|
+
this.log.warn('AdjustMmpVcPlugin not setup, skipping trackEvent');
|
|
24
|
+
return;
|
|
25
25
|
}
|
|
26
26
|
assertOptions({ eventName }, ['eventName']);
|
|
27
27
|
this.device.sendCommand('mmp_track_event:adjust', Object.assign({ eventName }, options));
|
package/build/mmpAssert.js
CHANGED
|
@@ -13,7 +13,7 @@ const mmpAssert = {
|
|
|
13
13
|
views.addPlugin('mmp', mockPlugin);
|
|
14
14
|
},
|
|
15
15
|
async pluginIsSetup(options) {
|
|
16
|
-
const { action, partner, setupOptions } = options
|
|
16
|
+
const { action, partner, setupOptions } = options ?? {};
|
|
17
17
|
assertBeforeEachCalled();
|
|
18
18
|
(0, schema_1.assertOptions)({
|
|
19
19
|
action,
|
|
@@ -21,9 +21,9 @@ const mmpAssert = {
|
|
|
21
21
|
}, ['action', 'partner']);
|
|
22
22
|
test_utils_1.assert.isEqual(partner, 'adjust', 'The partner you passed was invalid. For now I only support Adjust.');
|
|
23
23
|
await action();
|
|
24
|
-
mockPlugin
|
|
24
|
+
mockPlugin?.assertSetupWasCalled();
|
|
25
25
|
if (setupOptions) {
|
|
26
|
-
mockPlugin
|
|
26
|
+
mockPlugin?.assertSetupWasCalledWith(setupOptions);
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
async didTrackEvent(options) {
|
|
@@ -33,8 +33,8 @@ const mmpAssert = {
|
|
|
33
33
|
'eventName',
|
|
34
34
|
]);
|
|
35
35
|
await action();
|
|
36
|
-
mockPlugin
|
|
37
|
-
mockPlugin
|
|
36
|
+
mockPlugin?.assertTrackEventWasCalled();
|
|
37
|
+
mockPlugin?.assertTrackEventWasCalledWith(eventName, trackOptions);
|
|
38
38
|
},
|
|
39
39
|
};
|
|
40
40
|
exports.default = mmpAssert;
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"sprucebot",
|
|
14
14
|
"sprucelabs"
|
|
15
15
|
],
|
|
16
|
-
"version": "2.1.
|
|
16
|
+
"version": "2.1.390",
|
|
17
17
|
"scripts": {
|
|
18
18
|
"build.ci": "yarn run build.tsc && yarn run build.resolve-paths && yarn run lint",
|
|
19
19
|
"build.copy-files": "mkdir -p build && rsync -avzq --exclude='*.ts' ./src/ ./build/",
|
|
@@ -41,15 +41,14 @@
|
|
|
41
41
|
"watch.tsc": "tsc -w"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@sprucelabs/esm-postbuild": "^6.0.
|
|
45
|
-
"@sprucelabs/jest-json-reporter": "^8.0.
|
|
46
|
-
"@sprucelabs/
|
|
47
|
-
"@sprucelabs/resolve-path-aliases": "^2.0.456",
|
|
44
|
+
"@sprucelabs/esm-postbuild": "^6.0.462",
|
|
45
|
+
"@sprucelabs/jest-json-reporter": "^8.0.480",
|
|
46
|
+
"@sprucelabs/resolve-path-aliases": "^2.0.457",
|
|
48
47
|
"@sprucelabs/semantic-release": "^5.0.2",
|
|
49
|
-
"@sprucelabs/spruce-test-fixtures": "^62.3.
|
|
50
|
-
"@sprucelabs/test": "^9.0.
|
|
51
|
-
"@sprucelabs/test-utils": "^5.1.
|
|
52
|
-
"@types/node": "^22.7.
|
|
48
|
+
"@sprucelabs/spruce-test-fixtures": "^62.3.45",
|
|
49
|
+
"@sprucelabs/test": "^9.0.51",
|
|
50
|
+
"@sprucelabs/test-utils": "^5.1.433",
|
|
51
|
+
"@types/node": "^22.7.6",
|
|
53
52
|
"chokidar-cli": "^3.0.0",
|
|
54
53
|
"eslint": "^9.12.0",
|
|
55
54
|
"eslint-config-spruce": "^11.2.26",
|
|
@@ -83,17 +82,17 @@
|
|
|
83
82
|
}
|
|
84
83
|
},
|
|
85
84
|
"dependencies": {
|
|
86
|
-
"@sprucelabs/error": "^6.0.
|
|
87
|
-
"@sprucelabs/heartwood-view-controllers": "^110.12.
|
|
88
|
-
"@sprucelabs/mercury-client": "^42.0.
|
|
89
|
-
"@sprucelabs/mercury-core-events": "^24.3.
|
|
90
|
-
"@sprucelabs/mercury-types": "^47.0.
|
|
91
|
-
"@sprucelabs/schema": "^30.0.
|
|
92
|
-
"@sprucelabs/spruce-core-schemas": "^40.1.
|
|
93
|
-
"@sprucelabs/spruce-event-plugin": "^62.3.
|
|
94
|
-
"@sprucelabs/spruce-event-utils": "^40.1.
|
|
95
|
-
"@sprucelabs/spruce-permission-plugin": "^31.0.
|
|
96
|
-
"@sprucelabs/spruce-skill-utils": "^31.0.
|
|
97
|
-
"@sprucelabs/spruce-view-plugin": "^47.0.
|
|
85
|
+
"@sprucelabs/error": "^6.0.480",
|
|
86
|
+
"@sprucelabs/heartwood-view-controllers": "^110.12.160",
|
|
87
|
+
"@sprucelabs/mercury-client": "^42.0.528",
|
|
88
|
+
"@sprucelabs/mercury-core-events": "^24.3.290",
|
|
89
|
+
"@sprucelabs/mercury-types": "^47.0.529",
|
|
90
|
+
"@sprucelabs/schema": "^30.0.489",
|
|
91
|
+
"@sprucelabs/spruce-core-schemas": "^40.1.474",
|
|
92
|
+
"@sprucelabs/spruce-event-plugin": "^62.3.45",
|
|
93
|
+
"@sprucelabs/spruce-event-utils": "^40.1.249",
|
|
94
|
+
"@sprucelabs/spruce-permission-plugin": "^31.0.615",
|
|
95
|
+
"@sprucelabs/spruce-skill-utils": "^31.0.548",
|
|
96
|
+
"@sprucelabs/spruce-view-plugin": "^47.0.616"
|
|
98
97
|
}
|
|
99
98
|
}
|