UNPKG

@botonic/plugin-flow-builder

Version:

Use Flow Builder to show your contents

41 lines 1.82 kB
import { __awaiter, __rest } from "tslib"; import { EventAction } from '@botonic/core'; 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(request) { return __awaiter(this, void 0, void 0, function* () { const { flowThreadId, flowId, flowName, flowNodeId, flowNodeContentId } = getCommonFlowContentEventArgsForContentId(request, 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(request, action, eventArgs); }); } } //# sourceMappingURL=flow-webview.js.map