@botonic/plugin-flow-builder 0.27.4 → 0.27.6
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/lib/cjs/tracking.d.ts +0 -14
- package/lib/cjs/tracking.js +13 -14
- package/lib/cjs/tracking.js.map +1 -1
- package/lib/esm/tracking.d.ts +0 -14
- package/lib/esm/tracking.js +13 -13
- package/lib/esm/tracking.js.map +1 -1
- package/package.json +2 -2
- package/src/tracking.ts +13 -13
package/lib/cjs/tracking.d.ts
CHANGED
|
@@ -14,17 +14,3 @@ export declare enum KnowledgebaseFailReason {
|
|
|
14
14
|
}
|
|
15
15
|
export declare function trackEvent(request: ActionRequest, eventAction: EventAction, args?: Record<string, any>): Promise<void>;
|
|
16
16
|
export declare function trackFlowContent(request: ActionRequest, contents: FlowContent[]): Promise<void>;
|
|
17
|
-
export declare function getContentEventArgs(request: ActionRequest, contentInfo: {
|
|
18
|
-
code: string;
|
|
19
|
-
flowId: string;
|
|
20
|
-
flowName: string;
|
|
21
|
-
id: string;
|
|
22
|
-
isMeaningful: boolean;
|
|
23
|
-
}): {
|
|
24
|
-
flowThreadId: string;
|
|
25
|
-
flowId: string;
|
|
26
|
-
flowName: string;
|
|
27
|
-
flowNodeId: string;
|
|
28
|
-
flowNodeContentId: string;
|
|
29
|
-
flowNodeIsMeaningful: boolean;
|
|
30
|
-
};
|
package/lib/cjs/tracking.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.trackFlowContent = exports.trackEvent = exports.KnowledgebaseFailReason = exports.EventAction = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const uuid_1 = require("uuid");
|
|
6
6
|
const helpers_1 = require("./helpers");
|
|
@@ -33,31 +33,30 @@ function trackFlowContent(request, contents) {
|
|
|
33
33
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
34
34
|
const flowBuilderPlugin = (0, helpers_1.getFlowBuilderPlugin)(request.plugins);
|
|
35
35
|
const cmsApi = flowBuilderPlugin.cmsApi;
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
for (const content of contents) {
|
|
37
|
+
const nodeContent = cmsApi.getNodeById(content.id);
|
|
38
|
+
const eventArgs = getContentEventArgs(request, {
|
|
39
|
+
code: nodeContent.code,
|
|
40
|
+
flowId: nodeContent.flow_id,
|
|
41
|
+
flowName: flowBuilderPlugin.getFlowName(nodeContent.flow_id),
|
|
42
|
+
id: nodeContent.id,
|
|
43
|
+
isMeaningful: (_a = nodeContent.is_meaningful) !== null && _a !== void 0 ? _a : false,
|
|
44
|
+
});
|
|
45
|
+
yield trackEvent(request, EventAction.FlowNode, eventArgs);
|
|
46
|
+
}
|
|
46
47
|
});
|
|
47
48
|
}
|
|
48
49
|
exports.trackFlowContent = trackFlowContent;
|
|
49
50
|
function getContentEventArgs(request, contentInfo) {
|
|
50
51
|
var _a;
|
|
51
|
-
const flowBuilderPlugin = (0, helpers_1.getFlowBuilderPlugin)(request.plugins);
|
|
52
52
|
const flowThreadId = (_a = request.session.flow_thread_id) !== null && _a !== void 0 ? _a : (0, uuid_1.v4)();
|
|
53
53
|
return {
|
|
54
54
|
flowThreadId,
|
|
55
55
|
flowId: contentInfo.flowId,
|
|
56
|
-
flowName:
|
|
56
|
+
flowName: contentInfo.flowName,
|
|
57
57
|
flowNodeId: contentInfo.id,
|
|
58
58
|
flowNodeContentId: contentInfo.code,
|
|
59
59
|
flowNodeIsMeaningful: contentInfo.isMeaningful,
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
exports.getContentEventArgs = getContentEventArgs;
|
|
63
62
|
//# sourceMappingURL=tracking.js.map
|
package/lib/cjs/tracking.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracking.js","sourceRoot":"","sources":["../../src/tracking.ts"],"names":[],"mappings":";;;;AACA,+BAAiC;AAIjC,uCAAgD;AAEhD,IAAY,WAOX;AAPD,WAAY,WAAW;IACrB,qCAAsB,CAAA;IACtB,sCAAuB,CAAA;IACvB,oCAAqB,CAAA;IACrB,+CAAgC,CAAA;IAChC,8CAA+B,CAAA;IAC/B,oCAAqB,CAAA;AACvB,CAAC,EAPW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAOtB;AAED,IAAY,uBAGX;AAHD,WAAY,uBAAuB;IACjC,uDAA4B,CAAA;IAC5B,0DAA+B,CAAA;AACjC,CAAC,EAHW,uBAAuB,GAAvB,+BAAuB,KAAvB,+BAAuB,QAGlC;AAED,SAAsB,UAAU,CAC9B,OAAsB,EACtB,WAAwB,EACxB,IAA0B;;QAE1B,MAAM,iBAAiB,GAAG,IAAA,8BAAoB,EAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAC/D,IAAI,iBAAiB,CAAC,UAAU,EAAE;YAChC,MAAM,iBAAiB,CAAC,UAAU,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,CAAA;SAC/D;QACD,OAAM;IACR,CAAC;CAAA;AAVD,gCAUC;AAED,SAAsB,gBAAgB,CACpC,OAAsB,EACtB,QAAuB;;;QAEvB,MAAM,iBAAiB,GAAG,IAAA,8BAAoB,EAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAC/D,MAAM,MAAM,GAAG,iBAAiB,CAAC,MAAM,CAAA;QACvC,
|
|
1
|
+
{"version":3,"file":"tracking.js","sourceRoot":"","sources":["../../src/tracking.ts"],"names":[],"mappings":";;;;AACA,+BAAiC;AAIjC,uCAAgD;AAEhD,IAAY,WAOX;AAPD,WAAY,WAAW;IACrB,qCAAsB,CAAA;IACtB,sCAAuB,CAAA;IACvB,oCAAqB,CAAA;IACrB,+CAAgC,CAAA;IAChC,8CAA+B,CAAA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;;CACF;AAjBD,4CAiBC;AAED,SAAS,mBAAmB,CAC1B,OAAsB,EACtB,WAMC;;IAED,MAAM,YAAY,GAAG,MAAA,OAAO,CAAC,OAAO,CAAC,cAAc,mCAAI,IAAA,SAAI,GAAE,CAAA;IAC7D,OAAO;QACL,YAAY;QACZ,MAAM,EAAE,WAAW,CAAC,MAAM;QAC1B,QAAQ,EAAE,WAAW,CAAC,QAAQ;QAC9B,UAAU,EAAE,WAAW,CAAC,EAAE;QAC1B,iBAAiB,EAAE,WAAW,CAAC,IAAI;QACnC,oBAAoB,EAAE,WAAW,CAAC,YAAY;KAC/C,CAAA;AACH,CAAC"}
|
package/lib/esm/tracking.d.ts
CHANGED
|
@@ -14,17 +14,3 @@ export declare enum KnowledgebaseFailReason {
|
|
|
14
14
|
}
|
|
15
15
|
export declare function trackEvent(request: ActionRequest, eventAction: EventAction, args?: Record<string, any>): Promise<void>;
|
|
16
16
|
export declare function trackFlowContent(request: ActionRequest, contents: FlowContent[]): Promise<void>;
|
|
17
|
-
export declare function getContentEventArgs(request: ActionRequest, contentInfo: {
|
|
18
|
-
code: string;
|
|
19
|
-
flowId: string;
|
|
20
|
-
flowName: string;
|
|
21
|
-
id: string;
|
|
22
|
-
isMeaningful: boolean;
|
|
23
|
-
}): {
|
|
24
|
-
flowThreadId: string;
|
|
25
|
-
flowId: string;
|
|
26
|
-
flowName: string;
|
|
27
|
-
flowNodeId: string;
|
|
28
|
-
flowNodeContentId: string;
|
|
29
|
-
flowNodeIsMeaningful: boolean;
|
|
30
|
-
};
|
package/lib/esm/tracking.js
CHANGED
|
@@ -29,26 +29,26 @@ export function trackFlowContent(request, contents) {
|
|
|
29
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
30
|
const flowBuilderPlugin = getFlowBuilderPlugin(request.plugins);
|
|
31
31
|
const cmsApi = flowBuilderPlugin.cmsApi;
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
32
|
+
for (const content of contents) {
|
|
33
|
+
const nodeContent = cmsApi.getNodeById(content.id);
|
|
34
|
+
const eventArgs = getContentEventArgs(request, {
|
|
35
|
+
code: nodeContent.code,
|
|
36
|
+
flowId: nodeContent.flow_id,
|
|
37
|
+
flowName: flowBuilderPlugin.getFlowName(nodeContent.flow_id),
|
|
38
|
+
id: nodeContent.id,
|
|
39
|
+
isMeaningful: (_a = nodeContent.is_meaningful) !== null && _a !== void 0 ? _a : false,
|
|
40
|
+
});
|
|
41
|
+
yield trackEvent(request, EventAction.FlowNode, eventArgs);
|
|
42
|
+
}
|
|
42
43
|
});
|
|
43
44
|
}
|
|
44
|
-
|
|
45
|
+
function getContentEventArgs(request, contentInfo) {
|
|
45
46
|
var _a;
|
|
46
|
-
const flowBuilderPlugin = getFlowBuilderPlugin(request.plugins);
|
|
47
47
|
const flowThreadId = (_a = request.session.flow_thread_id) !== null && _a !== void 0 ? _a : uuid();
|
|
48
48
|
return {
|
|
49
49
|
flowThreadId,
|
|
50
50
|
flowId: contentInfo.flowId,
|
|
51
|
-
flowName:
|
|
51
|
+
flowName: contentInfo.flowName,
|
|
52
52
|
flowNodeId: contentInfo.id,
|
|
53
53
|
flowNodeContentId: contentInfo.code,
|
|
54
54
|
flowNodeIsMeaningful: contentInfo.isMeaningful,
|
package/lib/esm/tracking.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracking.js","sourceRoot":"","sources":["../../src/tracking.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAA;AAIjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAEhD,MAAM,CAAN,IAAY,WAOX;AAPD,WAAY,WAAW;IACrB,qCAAsB,CAAA;IACtB,sCAAuB,CAAA;IACvB,oCAAqB,CAAA;IACrB,+CAAgC,CAAA;IAChC,8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AC,QAAQ;QAC9B,UAAU,EAAE,WAAW,CAAC,EAAE;QAC1B,iBAAiB,EAAE,WAAW,CAAC,IAAI;QACnC,oBAAoB,EAAE,WAAW,CAAC,YAAY;KAC/C,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botonic/plugin-flow-builder",
|
|
3
|
-
"version": "0.27.
|
|
3
|
+
"version": "0.27.6",
|
|
4
4
|
"main": "./lib/cjs/index.js",
|
|
5
5
|
"module": "./lib/esm/index.js",
|
|
6
6
|
"description": "Use Flow Builder to show your contents",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"lint_core": "../../node_modules/.bin/eslint_d --cache --quiet 'src/**/*.ts*'"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@botonic/react": "^0.27.
|
|
17
|
+
"@botonic/react": "^0.27.2",
|
|
18
18
|
"axios": "^1.6.8",
|
|
19
19
|
"uuid": "^9.0.1"
|
|
20
20
|
},
|
package/src/tracking.ts
CHANGED
|
@@ -37,19 +37,20 @@ export async function trackFlowContent(
|
|
|
37
37
|
) {
|
|
38
38
|
const flowBuilderPlugin = getFlowBuilderPlugin(request.plugins)
|
|
39
39
|
const cmsApi = flowBuilderPlugin.cmsApi
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
for (const content of contents) {
|
|
41
|
+
const nodeContent = cmsApi.getNodeById<HtNodeWithContent>(content.id)
|
|
42
|
+
const eventArgs = getContentEventArgs(request, {
|
|
43
|
+
code: nodeContent.code,
|
|
44
|
+
flowId: nodeContent.flow_id,
|
|
45
|
+
flowName: flowBuilderPlugin.getFlowName(nodeContent.flow_id),
|
|
46
|
+
id: nodeContent.id,
|
|
47
|
+
isMeaningful: nodeContent.is_meaningful ?? false,
|
|
48
|
+
})
|
|
49
|
+
await trackEvent(request, EventAction.FlowNode, eventArgs)
|
|
50
|
+
}
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
|
|
53
|
+
function getContentEventArgs(
|
|
53
54
|
request: ActionRequest,
|
|
54
55
|
contentInfo: {
|
|
55
56
|
code: string
|
|
@@ -59,12 +60,11 @@ export function getContentEventArgs(
|
|
|
59
60
|
isMeaningful: boolean
|
|
60
61
|
}
|
|
61
62
|
) {
|
|
62
|
-
const flowBuilderPlugin = getFlowBuilderPlugin(request.plugins)
|
|
63
63
|
const flowThreadId = request.session.flow_thread_id ?? uuid()
|
|
64
64
|
return {
|
|
65
65
|
flowThreadId,
|
|
66
66
|
flowId: contentInfo.flowId,
|
|
67
|
-
flowName:
|
|
67
|
+
flowName: contentInfo.flowName,
|
|
68
68
|
flowNodeId: contentInfo.id,
|
|
69
69
|
flowNodeContentId: contentInfo.code,
|
|
70
70
|
flowNodeIsMeaningful: contentInfo.isMeaningful,
|