@botonic/plugin-flow-builder
Version:
Use Flow Builder to show your contents
45 lines • 1.98 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlowWebview = void 0;
const tslib_1 = require("tslib");
const core_1 = require("@botonic/core");
const tracking_1 = require("../tracking");
const content_fields_base_1 = require("./content-fields-base");
class FlowWebview extends content_fields_base_1.ContentFieldsBase {
constructor() {
super(...arguments);
this.webviewTargetId = '';
this.webviewName = '';
this.webviewComponentName = '';
this.exits = [];
}
static fromHubtypeCMS(component) {
const newWebview = new FlowWebview(component.id);
newWebview.webviewTargetId = component.content.webview_target_id;
newWebview.webviewName = component.content.webview_name;
newWebview.webviewComponentName = component.content.webview_component_name;
newWebview.exits = component.content.exits;
newWebview.followUp = component.follow_up;
return newWebview;
}
trackFlow(request) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const { flowThreadId, flowId, flowName, flowNodeId, flowNodeContentId } = (0, tracking_1.getCommonFlowContentEventArgsForContentId)(request, this.id);
const eventWebviewActionTriggered = {
action: core_1.EventAction.WebviewActionTriggered,
flowThreadId,
flowId,
flowName,
flowNodeId,
flowNodeContentId,
flowNodeIsMeaningful: false,
webviewTargetId: this.webviewTargetId,
webviewName: this.webviewName,
};
const { action } = eventWebviewActionTriggered, eventArgs = tslib_1.__rest(eventWebviewActionTriggered, ["action"]);
yield (0, tracking_1.trackEvent)(request, action, eventArgs);
});
}
}
exports.FlowWebview = FlowWebview;
//# sourceMappingURL=flow-webview.js.map