Skip to content

Commit

Permalink
Merge branch 'master' into fix/hsm-fallback-images
Browse files Browse the repository at this point in the history
  • Loading branch information
akanshaaa19 authored Sep 3, 2024
2 parents 4dbd788 + 7584cb0 commit 9986063
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 25 deletions.
8 changes: 4 additions & 4 deletions src/components/floweditor/FlowEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect, useState } from 'react';
import { useMutation, useLazyQuery, useQuery } from '@apollo/client';
import { Navigate, useLocation, useNavigate, useParams } from 'react-router-dom';
import { Navigate, useNavigate, useParams } from 'react-router-dom';
import { Menu, MenuItem, Typography } from '@mui/material';
import BackIconFlow from 'assets/images/icons/BackIconFlow.svg?react';
import WarningIcon from 'assets/images/icons/Warning.svg?react';
Expand Down Expand Up @@ -31,13 +31,10 @@ export const FlowEditor = () => {
const params = useParams();
const { uuid } = params;
const navigate = useNavigate();
const location = useLocation();
const [publishDialog, setPublishDialog] = useState(false);
const [loading, setLoading] = useState(true);
const [flowEditorLoaded, setFlowEditorLoaded] = useState(false);
const [flowId, setFlowId] = useState();
const isTemplate = location?.state === 'template';
const config = setConfig(uuid, isTemplate);
const [published, setPublished] = useState(false);
const [showSimulator, setShowSimulator] = useState(false);
const [stayOnPublish, setStayOnPublish] = useState(false);
Expand All @@ -48,6 +45,8 @@ export const FlowEditor = () => {
const [currentEditDialogBox, setCurrentEditDialogBox] = useState(false);
const [dialogMessage, setDialogMessage] = useState('');
const [publishLoading, setPublishLoading] = useState(false);
const [isTemplate, setIsTemplate] = useState(false);
const config = setConfig(uuid, isTemplate);

const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
const open = Boolean(anchorEl);
Expand Down Expand Up @@ -141,6 +140,7 @@ export const FlowEditor = () => {
useEffect(() => {
if (flowName && flowName.flows.length > 0) {
setFlowId(flowName.flows[0].id);
setIsTemplate(flowName.flows[0].isTemplate);
}
}, [flowName]);

Expand Down
26 changes: 24 additions & 2 deletions src/containers/Flow/Flow.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,35 @@ const mocks = [
getFilterTagQuery,
getRoleNameQuery,
getOrganizationLanguagesQuery,
copyFlowQuery(),
copyFlowQuery(true),
copyFlowQuery({
isActive: true,
isPinned: false,
isBackground: false,
name: 'Copy of Help',
keywords: [],
description: '',
ignoreKeywords: false,
addRoleIds: [],
deleteRoleIds: [],
}),
copyFlowQuery({
isActive: true,
isPinned: false,
isBackground: false,
name: 'Copy of Help',
keywords: ['help', 'activity'],
description: 'Help flow',
ignoreKeywords: false,
addRoleIds: [],
deleteRoleIds: [],
tag_id: '1',
}),
createFlowQuery,
createTagQuery,
getFlowCountQuery({ isActive: true, isTemplate: false }),
releaseFlow,
getFilterTagQuery,
updateFlowQuery,
];

const mockUseLocationValue: any = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,19 +430,22 @@ export const OrganizationFlows = () => {
regxOpt: payload.regxFlowOpt,
};
}
let startTimeValue = dayjs(payload.startTime);
let endTimeValue = dayjs(payload.endTime);
object = {
outOfOffice: {
defaultFlowId: payload.defaultFlowId ? payload.defaultFlowId.id : null,
enabled: payload.hours,
enabledDays: assignDays(payload.enabledDays),
endTime: dayjs(payload.endTime).format(EXTENDED_TIME_FORMAT),
endTime: endTimeValue.isValid() ? endTimeValue.format(EXTENDED_TIME_FORMAT) : null,
flowId: payload.flowId ? payload.flowId.id : null,
startTime: dayjs(payload.startTime).format(EXTENDED_TIME_FORMAT),
startTime: startTimeValue.isValid() ? startTimeValue.format(EXTENDED_TIME_FORMAT) : null,
},
regxFlow: regxFlow,
newcontactFlowId: newContactFlowId,
optinFlowId,
};

return object;
};

Expand Down
18 changes: 1 addition & 17 deletions src/mocks/Flow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -663,23 +663,7 @@ export const exportFlowTranslationsWithErrors = {
},
};

export const copyFlowQuery = (template: boolean = false) => {
let input = {
isActive: true,
isPinned: false,
isBackground: false,
name: 'Copy of Help',
keywords: template ? [] : ['help', 'activity'],
description: template ? '' : 'Help flow',
ignoreKeywords: false,
addRoleIds: [],
deleteRoleIds: [],
};

if (!template) {
Object.assign(input, { tag_id: '1' });
}

export const copyFlowQuery = (input: any) => {
return {
request: {
query: CREATE_FLOW_COPY,
Expand Down

0 comments on commit 9986063

Please sign in to comment.