@botonic/plugin-flow-builder
Version:
Use Flow Builder to show your contents
49 lines • 2.13 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlowGoToFlow = void 0;
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const core_1 = require("@botonic/core");
const tracking_1 = require("../tracking");
const content_fields_base_1 = require("./content-fields-base");
class FlowGoToFlow extends content_fields_base_1.ContentFieldsBase {
constructor() {
super(...arguments);
this.flowTargetId = '';
this.flowTargetName = '';
this.targetId = '';
}
static fromHubtypeCMS(component, cmsApi) {
const newGoToFlow = new FlowGoToFlow(component.id);
newGoToFlow.code = component.code;
newGoToFlow.flowTargetId = component.content.flow_id;
const targetId = cmsApi.getNodeByFlowId(component.content.flow_id).id;
newGoToFlow.targetId = targetId;
newGoToFlow.flowTargetName = cmsApi.getFlowName(component.content.flow_id);
newGoToFlow.followUp = cmsApi.getNodeById(targetId);
return newGoToFlow;
}
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 eventGoToFlow = {
action: core_1.EventAction.RedirectFlow,
flowThreadId,
flowId,
flowName,
flowNodeId,
flowNodeContentId: flowNodeContentId || 'Go to flow',
flowTargetId: this.flowTargetId,
flowTargetName: this.flowTargetName,
flowNodeIsMeaningful: false,
};
const { action } = eventGoToFlow, eventArgs = tslib_1.__rest(eventGoToFlow, ["action"]);
yield (0, tracking_1.trackEvent)(request, action, eventArgs);
});
}
toBotonic() {
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
}
}
exports.FlowGoToFlow = FlowGoToFlow;
//# sourceMappingURL=flow-go-to-flow.js.map