UNPKG

@botonic/plugin-flow-builder

Version:

Botonic plugin for **Hubtype Flow Builder**: run and bridge flow-driven logic from bots on the **current** line.

47 lines 2.03 kB
import { __awaiter, __rest } from "tslib"; import { EventAction } from '@botonic/shared'; import { getCommonFlowContentEventArgsForContentId, trackEvent, } from '../tracking'; import { ContentFieldsBase } from './content-fields-base'; export class FlowWebview extends 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(botonicContext) { return __awaiter(this, void 0, void 0, function* () { const { flowThreadId, flowId, flowName, flowNodeId, flowNodeContentId } = yield getCommonFlowContentEventArgsForContentId(botonicContext, this.id); const eventWebviewActionTriggered = { action: EventAction.WebviewActionTriggered, flowThreadId, flowId, flowName, flowNodeId, flowNodeContentId, flowNodeIsMeaningful: false, webviewTargetId: this.webviewTargetId, webviewName: this.webviewName, }; const { action } = eventWebviewActionTriggered, eventArgs = __rest(eventWebviewActionTriggered, ["action"]); yield trackEvent(botonicContext, action, eventArgs); }); } processContent(botonicContext) { return __awaiter(this, void 0, void 0, function* () { yield this.trackFlow(botonicContext); return; }); } } //# sourceMappingURL=flow-webview.js.map