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W,IAC5C12D,OAAOowG,EAAqB15C,IAAW,IACvC12D,OAAOqwG,EAAiC35C,IAAW,IACxDglC,EAAWpyE,EAASre,YAAcymC,CACtC,CAEA,OADAgqD,GAAallB,EAAAA,EAAAA,IAAQvb,GAAKA,EAAE1pE,OAAS,GAAGmqG,GACjCA,CAAU,EAKf6U,GAA6BA,CAC/BlnF,EACAilF,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAzoB,EACA0oB,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,KAGA,IAAI3U,EAAa,CAAC,EAClB,IAAK,MAAMpyE,KAAYD,EAAW,CAE9B,GAAyB,GAArBC,EAAS2E,SACT,SAEJ,MAAMyoC,EAASptC,EAASre,WAElBymC,EAAa4+D,GAAiBhnF,GAC/BtpB,OAAOsuG,EAAiB53C,IAAW,IACnC12D,OAAOuuG,EAAgB73C,IAAW,IAClC12D,OAAOwuG,EAAe93C,IAAW,IACjC12D,OAAOyuG,EAAgB/3C,IAAW,IAClC12D,OAAO0uG,EAAiBh4C,IAAW,IACnC12D,OAAOgvG,EAAgBt4C,IAAW,IAClC12D,OAAO2uG,EAAuBj4C,IAAW,IACzC12D,OAAO4uG,EAAuBl4C,IAAW,IACzC12D,OAAO6uG,EAAoBn4C,IAAW,IACtC12D,OAAO8uG,EAAkBp4C,IAAW,IACpC12D,OAAOqmF,EAAmB3vB,IAAW,IACrC12D,OAAO+uG,EAAiBr4C,IAAW,IACnC12D,OAAOivG,EAAsBv4C,IAAW,IACxC12D,OAAOkvG,EAAgBx4C,IAAW,IAClC12D,OAAOmvG,EAAmBz4C,IAAW,IACrC12D,OAAOovG,EAAiB14C,IAAW,IACnC12D,OAAOqvG,EAAqB34C,IAAW,IACvC12D,OAAOsvG,EAAkB54C,IAAW,IACpC12D,OAAOuvG,EAAiB74C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ASw5C,GAA6Bx5C,KACtCA,IAASyjG,EAAAA,EAAAA,IAAyCzjG,KAClDA,GAASA,EAAMrG,QAAQy3G,QACvBpxG,GAASA,EAAMrG,QAAQkR,SACvB7K,IAASipG,EAAAA,EAAAA,IAAiCjpG,KAC1CA,IAAS2pG,EAAAA,EAAAA,IAA2B3pG,KACpCA,GAASA,EAAMrG,QAAQsL,kBACvB,CACIksB,EACAttB,EACA43G,EACAliE,EACAk9D,EACArF,EACAvmG,EACAmxG,EACAC,EACAh3G,IAEAo3G,GACIlrF,EACAttB,EACA43G,EACAliE,EACAk9D,EACArF,EACAvmG,EACAmxG,EACAC,EACAh3G,KAKCyoD,GAAkCA,KAC3C2tB,EAAAA,EAAAA,KACI,CAACC,EAAGC,IAAUA,EAAM5oE,aACpB3S,GAASA,EAAMkxB,UAAUntB,OACzB/D,GAASA,EAAM8D,MAAMC,KAAK/D,EAAMgE,SAASH,QACzC7D,GAASg1B,EAA4Bh1B,KACrCA,GAASw5C,GAA6Bx5C,KACtCA,IAASyjG,EAAAA,EAAAA,IAAyCzjG,KAClDA,GAASA,EAAMrG,QAAQy3G,QACvBpxG,GAASA,EAAMrG,QAAQkR,SACvB7K,IAASipG,EAAAA,EAAAA,IAAiCjpG,KAC1CA,IAAS2pG,EAAAA,EAAAA,IAA2B3pG,KACpCA,GAASA,EAAMrG,QAAQsL,kBACvB,CACI0N,EACAse,EACAptB,EACA43G,EACAliE,EACAk9D,EACArF,EACAvmG,EACAmxG,EACAC,EACAh3G,IAEAo3G,GACIprF,EAActe,GACd9O,EACA43G,EACAliE,EACAk9D,EACArF,EACAvmG,EACAmxG,EACAC,EACAh3G,KAIH42G,IAAqBxgC,EAAAA,EAAAA,KAC9Br7E,GAASA,EAAMkxB,UAAUntB,OACzB/D,GAAS85G,GAA+B95G,KACxC,CAACkxB,EAAqCqyE,KACtCA,GAAallB,EAAAA,EAAAA,IAAQvb,GAAKA,EAAE1pE,OAAS,GAAGmqG,GACxC,MAGMwY,EAHkB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AAOA,EAAU,GAAK,KAC1EgB,GAGiBl6E,EAAA,CACpB88B,OAAQ,cACRs9C,WAAY,OACZC,UAAW,aAAelB,EAAU,IACpCz/F,OAAQ,QArMe,CACvB4gG,WAAY,6CACZC,WAAY,MACZC,WAAY,UAiNqB1C,EAASsB,GAEzBtB,EAASsB,GAStBtB,EAASsB,GAETtB,EAASsB,GAETtB,EAASsB,GAMI,CACjBzzC,MAAOwzC,EAAU,GACjBsB,eAAgB,OAChBF,WAAY,MACZ39C,UAAW,OACX89C,aAAc,OACd3oC,UAAW,OACXuoC,WAAY,6CACZ,UAAW,CACP30C,MAAOwzC,EAAU,GACjBoB,WAAY,MACZC,WAAY,OAIEx6E,EAAAA,EAAA,GACfu9B,GAAK,IACRX,UAAW,IACX89C,aAAc,MACd3oC,UAAW,OACX,MAAK/xC,EAAAA,EAAA,GACEu9B,GAAK,IACRX,UAAW,UACX89C,aAAc,UACd3oC,UAAW,U","sources":["webpack:///./actions/actionCreators.js","webpack:///./actions/adminCompaniesActions.ts","webpack:///./actions/adminDesignerActions.ts","webpack:///./actions/audienceFolderActions.js","webpack:///./actions/awsActions.ts","webpack:///./actions/cannedReportActions.js","webpack:///./actions/clientVariableActions.ts","webpack:///./actions/companiesActions.ts","webpack:///./actions/dashboardWidgetActions.ts","webpack:///./actions/dataConnectActions.js","webpack:///./actions/exportLayoutActions2.js","webpack:///./actions/featuresActions.ts","webpack:///./actions/fieldLabelsActions.ts","webpack:///./actions/fieldTreeActions.js","webpack:///./actions/fileImportActions.js","webpack:///./actions/fileImportQueueActions.ts","webpack:///./actions/flowActions.js","webpack:///./actions/flowControlActions.ts","webpack:///./actions/flowExpressionActions.ts","webpack:///./actions/flowItemEditActions.js","webpack:///./actions/imageControlActions.ts","webpack:///./actions/loadingActions.ts","webpack:///./actions/notifyActions.ts","webpack:///./actions/scheduleActions.js","webpack:///./actions/searchActions.js","webpack:///./actions/sessionActions.js","webpack:///./actions/userActions.js","webpack:///./actions/userAdminActions.ts","webpack:///./components/flows/item/FlowControlItems/FlowControlInput.tsx","webpack:///./components/flows/item/FlowExportEdit.tsx","webpack:///./components/flows/item/FlowOfferMergeEdit.js","webpack:///./components/layouts-external-service/LayoutBuilder.tsx","webpack:///./components/loading/CircularLoading.tsx","webpack:///./components/material-components/Misc/TextFieldForTable.tsx","webpack:///./components/schedule/helpers/helpers.ts","webpack:///./components/tree-field/FieldDropTarget.tsx","webpack:///./enums/schedules.ts","webpack:///./helpers.js","webpack:///./helpers/constants.ts","webpack:///./helpers/loadResources.js","webpack:///./helpers/parseDate.ts","webpack:///./helpers/typedHelpers.ts","webpack:///./reducers/accountManage.ts","webpack:///./reducers/activationSchedules.ts","webpack:///./reducers/adminDesigner/adminDesigner.ts","webpack:///./reducers/cachedData.ts","webpack:///./reducers/deploymentDestination.ts","webpack:///./reducers/discoverySegment.ts","webpack:///./reducers/distributionList.ts","webpack:///./reducers/externalServiceLayoutData.ts","webpack:///./reducers/features.ts","webpack:///./reducers/featuresAuditLog.ts","webpack:///./reducers/fieldLabels.ts","webpack:///./reducers/fieldLabels3.ts","webpack:///./reducers/fileUploadSettings.ts","webpack:///./reducers/flowCannedReportDetail.ts","webpack:///./reducers/flowCannedReports.js","webpack:///./reducers/flowCases.js","webpack:///./reducers/flowControlData.ts","webpack:///./reducers/flowControlStatus.ts","webpack:///./reducers/flowDataLoadColumns.js","webpack:///./reducers/flowDataLoads.js","webpack:///./reducers/flowDescriptions.ts","webpack:///./reducers/flowDiscovery.js","webpack:///./reducers/flowExports.js","webpack:///./reducers/flowExpressionConstraints.ts","webpack:///./reducers/flowExpressions.ts","webpack:///./reducers/flowExternalServiceHardcodes.ts","webpack:///./reducers/flowExternalServices.ts","webpack:///./reducers/flowItemDescriptions.ts","webpack:///./reducers/flowItemEndpoints.js","webpack:///./reducers/flowItemResultTables.js","webpack:///./reducers/flowItems.js","webpack:///./reducers/flowModels.js","webpack:///./reducers/flowOffloadColumns.js","webpack:///./reducers/flowOffloads.js","webpack:///./reducers/flowOutputs.js","webpack:///./reducers/flowRelations.js","webpack:///./reducers/flowReports.js","webpack:///./reducers/flowScriptResults.js","webpack:///./reducers/flowScriptResultsHistory.js","webpack:///./reducers/flowSingleViews.js","webpack:///./reducers/flowSplits.js","webpack:///./reducers/makeAWish.ts","webpack:///./reducers/reports.js","webpack:///./reducers/roles.js","webpack:///./reducers/saaAdvertisers.ts","webpack:///./reducers/search.js","webpack:///./reducers/tableau.ts","webpack:///./reducers/umbrellaData.ts","webpack:///./reducers/updateExperianAssets.ts","webpack:///./reducers/userAdmin.ts","webpack:///./reducers/wiki.ts","webpack:///./reducers/workflowBillingData.ts","webpack:///./reducers/workflowClient.ts","webpack:///./styles/dashComponentStyles/myDashboard.js"],"sourcesContent":["import { push } from \"connected-react-router\";\r\nimport h from \"../helpers\";\r\nimport { requestClientVariables } from \"./clientVariableActions\";\r\nimport { getFlowModelsArray } from \"../reducers/flowModels\";\r\nimport { updateAttribute, requestFlows, requestFlowDeploymentQueue } from \"./flowActions\";\r\nimport { ToggleIsLayoutTreeLoading } from \"./treeBehaviorActions\";\r\nimport { ToggleIsFlowTreeLoading } from \"./treeBehaviorActions\";\r\nimport { loadFolders, requestLoadFlowFolders } from \"./audienceFolderActions\";\r\nimport { GetFieldLabelTypes } from \"./fieldLabelsActions\";\r\nimport { getAvailableFolders, getColumnsForTable, getImports, getJoins, getModes } from \"./fileImportActions\";\r\nimport { setAllSelectedLayoutObjects, requestAllLayoutObjects } from \"./exportLayoutActions2\";\r\nimport { notifyGreen } from \"./notifyActions\";\r\nimport { request } from \"../helpers/httpInterceptor\";\r\nimport { uniqArray } from \"../helpers/typedHelpers\";\r\nif (!top.RDX) {\r\n top.RDX = {};\r\n}\r\n\r\n// This is a generic action to call a given uri and expect a file in return\r\n// Used by resource center to download files and show the loading bar\r\nexport const requestDownload = (uri: string, fileName: string) => dispatch => {\r\n request(uri, { method: \"GET\", credentials: \"same-origin\", responseType: \"blob\" }, dispatch)\r\n .then(h.checkStatus)\r\n .then(response => response.blob())\r\n .then(blob => {\r\n // Create blob link to download\r\n const url = window.URL.createObjectURL(new Blob([blob]));\r\n const anchorLink = document.createElement(\"a\");\r\n anchorLink.href = url;\r\n if (!fileName.includes(\".pdf\")) fileName += \".xlsx\";\r\n anchorLink.setAttribute(\"download\", fileName);\r\n\r\n // Append to html anchorLink element page\r\n document.body.appendChild(anchorLink);\r\n\r\n // Start download\r\n anchorLink.click();\r\n\r\n // Clean up and remove the anchorLink\r\n anchorLink.parentNode?.removeChild(anchorLink);\r\n })\r\n .catch(error => {\r\n h.error(\"Error downloading file.\", error);\r\n });\r\n};\r\n\r\n// This is an action to run if the user decided to do whatever prompted\r\n// the loss of work dialog.\r\n// Put whatever the user was trying to do in the loss_of_work_queued_action variable\r\n// before showing the dialog.\r\nexport const lossOfWorkRunQueuedAction = () => (dispatch, getState) => {\r\n const nextAction = getState().vars.loss_of_work_queued_action;\r\n dispatch(setVar(\"loss_of_work_queued_action\", {}));\r\n if (nextAction && (nextAction.type || typeof nextAction == \"function\")) {\r\n dispatch(nextAction);\r\n }\r\n};\r\n\r\n// This is an action to run if the user decided not to go through with whatever change prompted\r\n// the loss of work dialog.\r\n// We use this for changing the company dropdown back to its original value if the user decides\r\n// not to change companies.\r\nexport const lossOfWorkRunCanceledQueuedAction = () => (dispatch, getState) => {\r\n const nextAction = getState().vars.loss_of_work_canceled_queued_action;\r\n dispatch(setVar(\"loss_of_work_canceled_queued_action\", {}));\r\n if (nextAction && (nextAction.type || typeof nextAction == \"function\")) {\r\n dispatch(nextAction);\r\n }\r\n};\r\n\r\nexport const setPage = (page = []) => ({\r\n type: \"SET_PAGE\",\r\n page,\r\n});\r\ntop.RDX.setPage = page => top.store.dispatch(setPage(page));\r\n\r\nexport const siteCustomization = (custName: string, defaultValue: string) => (dispatch, getState) => {\r\n const state = getState();\r\n let customizations = state.session.customizations;\r\n let output = defaultValue;\r\n let customValue = customizations.filter(x => x.Name == custName);\r\n if (customValue.length > 0 && customValue[0].Value != \"\") {\r\n output = customValue[0].Value;\r\n }\r\n return output;\r\n};\r\ntop.RDX.siteCustomization = (custName, defaultValue) => top.store.dispatch(siteCustomization((custName, defaultValue)));\r\n\r\nexport const dateDiffMinutes = (startDate, endDate) => {\r\n const diff = endDate.getTime() - startDate.getTime();\r\n return Math.abs(diff / 60000);\r\n};\r\n\r\nconst _premiumLastLoadedByCompany = {};\r\n\r\nexport const setPremiumFields = (premiumFields = {}) => ({\r\n type: \"SET_PREMIUMFIELDS\",\r\n premiumFields,\r\n});\r\ntop.RDX.setPremiumFields = premiumFields => top.store.dispatch(setPremiumFields(premiumFields));\r\n\r\n// Changes per company\r\nexport const requestPremiumFields = () => (dispatch, getState) => {\r\n const companyId = getState().session.companyId;\r\n if (\r\n _premiumLastLoadedByCompany[companyId] != null &&\r\n dateDiffMinutes(_premiumLastLoadedByCompany[companyId], new Date()) < 30\r\n ) {\r\n return;\r\n }\r\n\r\n dispatch(incAjaxCount());\r\n dispatch(ToggleIsLayoutTreeLoading(true));\r\n\r\n fetch(\"/Tree/Premium\", { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(setPremiumFields(data));\r\n top.premiumFields = data;\r\n dispatch(decAjaxCount());\r\n _premiumLastLoadedByCompany[companyId] = new Date();\r\n dispatch(ToggleIsLayoutTreeLoading(false));\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n dispatch(ToggleIsLayoutTreeLoading(false));\r\n h.error(\"Error loading premium fields.\", error);\r\n });\r\n};\r\ntop.RDX.requestPremiumFields = () => top.store.dispatch(requestPremiumFields());\r\n\r\nexport const setVar = (variable = \"\", value = null) => ({\r\n type: \"SET_VAR\",\r\n variable,\r\n value,\r\n});\r\ntop.RDX.setVar = (variable, value) => top.store.dispatch(setVar(variable, value));\r\n\r\nexport const setVarPersist = (variable = \"\", value = null) => ({\r\n type: \"SET_VAR_PERSIST\",\r\n variable,\r\n value,\r\n});\r\n\r\nSet.prototype.difference = function (setB) {\r\n // put this somewhere better?\r\n const difference = new Set(this);\r\n for (const elem of setB) {\r\n difference.delete(elem);\r\n }\r\n return difference;\r\n};\r\n\r\n//// SELECTED REPORT ////\r\nexport const setDataSource = dataSource => ({\r\n type: \"SET_SELECTED_DATASOURCE\",\r\n dataSource,\r\n});\r\ntop.RDX.setDataSource = dataSource => top.store.dispatch(setDataSource(dataSource));\r\n\r\nexport const clearDataSource = () => ({\r\n type: \"CLEAR_SELECTED_DATASOURCE\",\r\n});\r\ntop.RDX.clearDataSource = () => top.store.dispatch(clearDataSource());\r\n\r\nexport const requestQueryBuilderGroupList = (segmentKey, groupType) => dispatch => {\r\n request(\r\n \"/QueryBuilder/getQueryBuilderGroups?segmentKey=\" + segmentKey + \"&groupType=\" + groupType,\r\n {\r\n credentials: \"same-origin\",\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(updateQueryBuilderGroupList(data.queryBuilderGroups));\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading querybuilder group list.\", error);\r\n });\r\n};\r\ntop.RDX.requestQueryBuilderGroupList = (segmentKey, groupType) =>\r\n top.store.dispatch(requestQueryBuilderGroupList(segmentKey, groupType));\r\n\r\nexport const updateQueryBuilderGroupList = queryBuilderGroups => ({\r\n type: \"UPDATE_QUERYBUILDER_GROUP_LIST\",\r\n queryBuilderGroups,\r\n});\r\ntop.RDX.updateQueryBuilderGroupList = queryBuilderGroups =>\r\n top.store.dispatch(updateQueryBuilderGroupList(queryBuilderGroups));\r\n\r\nexport const requestUserNames =\r\n (userIds = [], mergeBehavior = \"merge\") =>\r\n (dispatch, getState) => {\r\n const userIdsSeen = new Set(userIds);\r\n\r\n let userIdsKnown;\r\n if (mergeBehavior == \"overwrite\") {\r\n userIdsKnown = new Set();\r\n } else {\r\n userIdsKnown = new Set(Object.keys(getState().varsPersist.userNameForId).map(x => parseInt(x)));\r\n }\r\n\r\n const userIdsToRequest = Array.from(userIdsSeen.difference(userIdsKnown));\r\n dispatch(getUserNames(userIdsToRequest));\r\n };\r\n\r\nexport const updateJSSourceLoadStatus = (source, status) => ({\r\n type: \"UPDATE_JSSOURCE_LOAD_STATUS\",\r\n source,\r\n status,\r\n});\r\n\r\n// Modals\r\n\r\nexport const showModal = (modalType, modalProps = {}) => ({\r\n type: \"SHOW_MODAL\",\r\n modalType,\r\n modalProps,\r\n});\r\ntop.RDX.showModal = (modalType, modalProps = {}) => top.store.dispatch(showModal(modalType, modalProps));\r\n\r\nexport const hideModal = modalType => ({\r\n type: \"HIDE_MODAL\",\r\n modalType,\r\n});\r\ntop.RDX.hideModal = modalType => top.store.dispatch(hideModal(modalType));\r\n\r\n// Flows Model Edit\r\n\r\nexport const requestModelFilenames = () => dispatch => {\r\n const getModelFilenamesUrl = `/AudienceModel/GetModelFilenames`;\r\n dispatch(incAjaxCount());\r\n return fetch(getModelFilenamesUrl, { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(modelFilenames => {\r\n dispatch({ type: \"SET_MODEL_FILENAMES\", modelFilenames });\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error getting Model Filenames.\", error);\r\n });\r\n};\r\n\r\nexport const setUpdatingModelBundles = updatingModelBundles => ({\r\n type: \"SET_UPDATING_MODEL_BUNDLES\",\r\n updatingModelBundles,\r\n});\r\n\r\nexport const requestModelBundles = () => dispatch => {\r\n const url = \"/AudienceModel/GetModelBundles\" + h.serialize({});\r\n return fetch(url, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const modelBundles = data.modelBundles.map(item => ({\r\n label: item.BundleName || \"None\",\r\n value: item.ModelBundleId,\r\n companyId: item.CompanyId,\r\n createdOn: item.CreatedOn,\r\n deletedOn: item.DeletedOn,\r\n CanDelete: item.CanDelete,\r\n }));\r\n\r\n dispatch({ type: \"SET_MODEL_BUNDLES\", modelBundles });\r\n dispatch(decAjaxCount());\r\n dispatch(setUpdatingModelBundles(false));\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading Model Bundles.\", error);\r\n });\r\n};\r\n\r\nexport const requestModelVariables = () => dispatch => {\r\n const url = \"/AudienceModel/GetModelVariables\" + h.serialize({});\r\n return fetch(url, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const modelVariables = data.modelVariables.map(item => ({\r\n label: item.FriendlyName || \"None\",\r\n value: item.VariableName,\r\n tooltip: item.Description,\r\n }));\r\n\r\n dispatch({ type: \"SET_MODEL_VARIABLES\", modelVariables });\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading Model Variables.\", error);\r\n });\r\n};\r\n\r\nexport const requestModelExcludedVariables = () => dispatch => {\r\n const url = \"/AudienceModel/GetModelExcludedVariables\" + h.serialize({});\r\n return fetch(url, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const modelExcludedVariables = data.modelExcludedVariables;\r\n\r\n dispatch({ type: \"SET_MODEL_VARIABLES_EXCLUDED\", modelExcludedVariables });\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading Model Variables.\", error);\r\n });\r\n};\r\n\r\nexport const saveModelBundle = (bundleName, excludedVariables, isSetGlobal) => dispatch => {\r\n const url = \"/AudienceModel/SaveModelBundle\";\r\n dispatch(incAjaxCount());\r\n dispatch(setUpdatingModelBundles(true));\r\n\r\n return fetch(url, {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n body: JSON.stringify({\r\n bundleName,\r\n excludedVariables,\r\n isSetGlobal,\r\n }),\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data.success) {\r\n dispatch(requestModelBundles());\r\n dispatch(requestModelExcludedVariables());\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error saving bundle.\", error);\r\n dispatch(decAjaxCount());\r\n dispatch(setUpdatingModelBundles(false));\r\n });\r\n};\r\n\r\nexport const deleteModelBundle = bundleId => (dispatch, getState) => {\r\n const state = getState();\r\n const url = \"/AudienceModel/DeleteModelBundle\";\r\n dispatch(incAjaxCount());\r\n dispatch(setUpdatingModelBundles(true));\r\n return fetch(url, {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n body: JSON.stringify({\r\n bundleId,\r\n }),\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data.success) {\r\n dispatch(requestModelBundles());\r\n dispatch(requestModelExcludedVariables());\r\n\r\n // Reset flowModles bundle values to 0 if it was deleted\r\n const flowModels = getFlowModelsArray(state);\r\n flowModels\r\n .filter(x => x.Bundle == bundleId)\r\n .forEach(model => {\r\n dispatch(updateAttribute(\"flowModels\", model.FlowModelId, \"Bundle\", 0));\r\n });\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error deleting bundle.\", error);\r\n dispatch(decAjaxCount());\r\n dispatch(setUpdatingModelBundles(false));\r\n });\r\n};\r\n\r\n// Migrations\r\n\r\nexport const setMigrationThinking = isthinking => ({\r\n type: \"SET_MIGRATION_THINKING\",\r\n isthinking,\r\n});\r\n\r\nexport const UpdateMigrationTables = () => dispatch => {\r\n const url = \"/Flows/UpdateMigrationTables\";\r\n dispatch(incAjaxCount());\r\n dispatch(setMigrationThinking(true));\r\n return fetch(url, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(() => {\r\n dispatch(decAjaxCount());\r\n dispatch(setMigrationThinking(false));\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n dispatch(setMigrationThinking(false));\r\n h.error(\"Error loading Model Bundles.\", error);\r\n });\r\n};\r\n\r\nexport const setUserNames = map => ({\r\n type: \"SET_USER_NAMES\",\r\n map,\r\n});\r\n\r\nexport const getUserNames =\r\n (userIds = []) =>\r\n dispatch => {\r\n if (userIds.length == 0) {\r\n return;\r\n }\r\n\r\n const url = \"/Main/GetUserNames\";\r\n dispatch(incAjaxCount());\r\n return fetch(url, {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n Accept: \"application/json\",\r\n \"Content-Type\": \"application/json\",\r\n },\r\n body: JSON.stringify({\r\n userIds,\r\n }),\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const missingIds = userIds.filter(x => !Object.keys(data).includes(x.toString())); // IDs we asked about but didn't get anything back\r\n for (const missingId of missingIds) {\r\n data[missingId] = null;\r\n }\r\n dispatch(setUserNames(data));\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error looking up user name.\", error);\r\n });\r\n };\r\n\r\n// Companies that my user has access to\r\n// Usually shouldn't be needed - the session sends this information automatically\r\n// on each page load. Maybe only needed when logging in via ajax?\r\nexport const requestMyCompanies = () => dispatch => {\r\n dispatch(incAjaxCount());\r\n fetch(\"/Account/GetCompanyList\", { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch({\r\n type: \"SET_SESSION_COMPANIES\",\r\n companies: data,\r\n });\r\n dispatch(setVar(\"companies\", data));\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error loading companies.\", error);\r\n });\r\n};\r\n\r\nexport const requestMyCompaniesAndAssets = () => dispatch => {\r\n dispatch(incAjaxCount());\r\n fetch(\"/Account/GetCompanyList\", { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch({\r\n type: \"SET_SESSION_COMPANIES\",\r\n companies: data,\r\n });\r\n dispatch(setVar(\"companies\", data));\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error loading companies.\", error);\r\n });\r\n};\r\n\r\nimport { setCompanyId, requestSessionInfo } from \"./sessionActions\";\r\nexport const requestChangeCompany = (newCompanyId, callbackAfterChangeCompany) => dispatch => {\r\n // Locally\r\n dispatch(setCompanyId(newCompanyId));\r\n\r\n const url = \"/Account/ChangeCompany\";\r\n dispatch(incAjaxCount());\r\n fetch(url, {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n Accept: \"application/json\",\r\n \"Content-Type\": \"application/json\",\r\n },\r\n body: JSON.stringify({\r\n newCompanyId,\r\n }),\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(() => {\r\n dispatch(requestSessionInfo());\r\n dispatch(decAjaxCount());\r\n if (callbackAfterChangeCompany != null && typeof callbackAfterChangeCompany == \"function\") {\r\n callbackAfterChangeCompany();\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error changing company.\", error);\r\n dispatch(requestSessionInfo());\r\n });\r\n};\r\n\r\nexport const requestUpdateUserSettings = userSettings => dispatch => {\r\n const url = \"/Manage/UpdateUserSettings\";\r\n dispatch(incAjaxCount());\r\n fetch(url, {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n Accept: \"application/json\",\r\n \"Content-Type\": \"application/json\",\r\n },\r\n body: JSON.stringify({\r\n userSettings,\r\n }),\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(() => {\r\n dispatch(requestSessionInfo());\r\n dispatch(notifyGreen(\"User settings updated.\"));\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error updating user settings.\", error);\r\n });\r\n};\r\n\r\nexport const flowRequests = (companyId: number) => dispatch => {\r\n const url = \"/flows/RequestAllFlowData\";\r\n dispatch(incAjaxCount());\r\n fetch(url, {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n Accept: \"application/json\",\r\n \"Content-Type\": \"application/json\",\r\n },\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data && data.success) {\r\n //GetFieldLabelTypes\r\n dispatch({ type: \"SET_FIELD_LABEL_TYPES\", labelTypes: data.fieldLabelTypes });\r\n //getAvailableFolders\r\n const availableFolders = {};\r\n\r\n $.each(data.availableFolders, (key, item) => {\r\n availableFolders[item.id] = item;\r\n });\r\n\r\n dispatch({\r\n type: \"GET_AVAILABLE_FOLDERS\",\r\n folders: availableFolders,\r\n });\r\n //loadFlowFolders\r\n if (data.userNames) {\r\n dispatch(setUserNames(data.userNames));\r\n }\r\n\r\n const types = uniqArray(data.flowFolders.map(x => x.Type));\r\n for (const folderType of types) {\r\n const filteredData = data.flowFolders.filter(x => x.Type == folderType);\r\n dispatch(loadFolders(folderType, filteredData));\r\n }\r\n dispatch(ToggleIsFlowTreeLoading(false));\r\n //premiumFields\r\n dispatch(setPremiumFields(data.premiumFields));\r\n top.premiumFields = data.premiumFields;\r\n dispatch(decAjaxCount());\r\n _premiumLastLoadedByCompany[companyId] = new Date();\r\n dispatch(ToggleIsLayoutTreeLoading(false));\r\n //requestAllLayoutObjects\r\n dispatch(setAllSelectedLayoutObjects(data.layoutAndObjects.items));\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error updating user settings.\", error);\r\n });\r\n};\r\n\r\nexport const manageFileRequests = () => dispatch => {\r\n const url = \"/manage/RequestManageData\";\r\n dispatch(incAjaxCount());\r\n fetch(url, {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n Accept: \"application/json\",\r\n \"Content-Type\": \"application/json\",\r\n },\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data && data.success) {\r\n // dispatch(getModes());\r\n dispatch({\r\n type: \"GET_MODES\",\r\n modes: data.modes,\r\n });\r\n // dispatch(getImports());\r\n const imports = {};\r\n\r\n $.each(data.imports, (key, item) => {\r\n imports[item.ImportId] = item;\r\n });\r\n\r\n dispatch({\r\n type: \"GET_IMPORTS\",\r\n files: imports,\r\n });\r\n // dispatch(getAvailableFolders());\r\n const results = {};\r\n\r\n $.each(data.folders, (key, item) => {\r\n results[item.id] = item;\r\n });\r\n\r\n dispatch({\r\n type: \"GET_AVAILABLE_FOLDERS\",\r\n folders: results,\r\n });\r\n // dispatch(getJoins());\r\n const joins = Object.keys(data.joins).map(item => ({\r\n label: data.joins[item].VisibleName,\r\n value: data.joins[item].Id,\r\n item: data.joins[item],\r\n }));\r\n\r\n dispatch({\r\n type: \"GET_JOINS\",\r\n joinToTables: joins,\r\n });\r\n // dispatch( ());\r\n dispatch({\r\n type: \"GET_COLUMNS_FOR_TABLE\",\r\n joinColumns: data.columns,\r\n });\r\n dispatch(decAjaxCount());\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error updating user settings.\", error);\r\n });\r\n};\r\n\r\n//// CHANGE COMPANY ////\r\nimport { deleteAllItemsInFlow, setSelectedFlow, setSelectedFlowNoUnsavedCheck } from \"./flowActions\";\r\n// Change company, but first look for unsaved changes and present 'loss of work' screen if we need to.\r\nexport const CAPageChangeCompany = (newCompanyId, oldCompanyId) => (dispatch, getState) => {\r\n // Look to see if unsaved changes\r\n const state = getState();\r\n const flow = state.flows.byId[state.selected.flow] || {};\r\n const location = state.router.location;\r\n\r\n if (flow.hasUnsavedChanges && location.pathname.includes(\"/flows\")) {\r\n dispatch(StartLossOfWork(newCompanyId, oldCompanyId, { flow }));\r\n } else {\r\n dispatch(setVar(\"loss_of_work_queued_action\", {}));\r\n dispatch(setVar(\"loss_of_work_canceled_queued_action\", {}));\r\n dispatch(CAPageChangeCompanyNoUnsavedCheck(newCompanyId));\r\n }\r\n};\r\n\r\nexport const StartLossOfWork = (newCompanyId, oldCompanyId, type) => dispatch => {\r\n dispatch(\r\n setVar(\"loss_of_work_queued_action\", () => {\r\n dispatch(setSelectedFlow(-1));\r\n dispatch(deleteAllItemsInFlow(-1));\r\n dispatch(CAPageChangeCompanyNoUnsavedCheck(newCompanyId));\r\n })\r\n );\r\n dispatch(setVar(\"loss_of_work_canceled_queued_action\", dispatch(setCompanyId(parseInt(oldCompanyId)))));\r\n dispatch(showModal(\"LOSS_OF_WORK\", type));\r\n};\r\ntop.RDX.CAPageChangeCompany = (newCompanyId, oldCompanyId) =>\r\n top.store.dispatch(CAPageChangeCompany(newCompanyId, oldCompanyId));\r\n\r\n// The user decided not to change companies after all. Move the dropdown back to what it should be.\r\nexport const changeCompanyCanceled = oldCompanyId => () => {\r\n // This works for audience engine, does not work for data engine (but the data engine doesn't have a company dropdown right now..)\r\n if (top.setCompanyDropdownWithoutTriggeringChange) {\r\n top.setCompanyDropdownWithoutTriggeringChange(oldCompanyId);\r\n }\r\n};\r\n\r\nimport { requestFieldTree, requestLayoutFieldTree } from \"./fieldTreeActions\";\r\nimport { requestEnabledFeatures } from \"./sessionActions\";\r\n// Change companies - does the work of changing companies. Perhaps should show a modal progress bar.\r\nexport const CAPageChangeCompanyNoUnsavedCheck =\r\n (newCompanyId, redirectToLayouts = false, redirectToRestrictedFields = false) =>\r\n (dispatch, getState) => {\r\n const hl = document.getElementById(\"react_header_logo\");\r\n if (hl) {\r\n hl.src = \"/Images/CompanyLogo/\" + newCompanyId;\r\n }\r\n\r\n const state = getState();\r\n const features = state.session.enabledFeatures || [];\r\n const callbackAfterChangeCompany = () => {\r\n if (redirectToLayouts) {\r\n window.location.href = \"/ae/tools/layouts\";\r\n } else if (redirectToRestrictedFields) {\r\n window.location.href = \"/ae/admin/restricted-fields\";\r\n } else {\r\n const location = state.router.location;\r\n const preventReload = features.includes(\"prevent-page-reload-company-change\");\r\n if (location.pathname.includes(\"/flows\") && preventReload) {\r\n dispatch(goToUrl(\"/flows/design\"));\r\n\r\n if (features.includes(\"company-switch-simplified\")) {\r\n dispatch(flowRequests(newCompanyId));\r\n } else {\r\n dispatch(GetFieldLabelTypes());\r\n dispatch(getAvailableFolders());\r\n dispatch(requestLoadFlowFolders());\r\n dispatch(requestPremiumFields());\r\n dispatch(requestAllLayoutObjects());\r\n }\r\n\r\n dispatch(requestEnabledFeatures());\r\n dispatch(requestFieldTree());\r\n dispatch(requestLayoutFieldTree());\r\n\r\n dispatch(requestClientVariables());\r\n dispatch(requestFlowDeploymentQueue(\"Active\", 0, 0));\r\n dispatch(requestFlows());\r\n } else if (location.pathname.includes(\"/manage-files\") && preventReload) {\r\n dispatch(goToUrl(\"/tools/manage-files\"));\r\n\r\n if (features.includes(\"company-switch-simplified\")) {\r\n dispatch(manageFileRequests());\r\n } else {\r\n dispatch(getModes());\r\n dispatch(getImports());\r\n dispatch(getAvailableFolders());\r\n dispatch(getJoins());\r\n dispatch(getColumnsForTable());\r\n }\r\n } else {\r\n // Lets force a reload for now\r\n // other React pages will need to be accounted for\r\n dispatch(setSelectedFlowNoUnsavedCheck(null));\r\n window.location.reload(true);\r\n }\r\n }\r\n };\r\n\r\n /////\r\n\r\n dispatch(setCompanyId(parseInt(newCompanyId, 10)));\r\n dispatch(requestChangeCompany(parseInt(newCompanyId, 10), callbackAfterChangeCompany));\r\n\r\n // In most cases, the dropdown is already set correctly, but just in case..\r\n // ([Change company -> Loss of work -> Save -> Finished saving] needs this)\r\n if (top.setCompanyDropdownWithoutTriggeringChange) {\r\n top.setCompanyDropdownWithoutTriggeringChange(newCompanyId);\r\n }\r\n };\r\ntop.RDX.CAPageChangeCompanyNoUnsavedCheck = (companyId, redirectToLayouts) =>\r\n top.store.dispatch(CAPageChangeCompanyNoUnsavedCheck(companyId, redirectToLayouts));\r\n\r\nexport const incAjaxCount = () => ({\r\n type: \"INC_AJAX_COUNT\",\r\n});\r\n\r\nexport const decAjaxCount = () => ({\r\n type: \"DEC_AJAX_COUNT\",\r\n});\r\n\r\nexport const tableReportSetTabKey = tabKey => ({\r\n type: \"TABLEREPORT_SET_TAB_KEY\",\r\n tabKey,\r\n});\r\ntop.RDX.tableReportSetTabKey = tabKey => top.store.dispatch(tableReportSetTabKey(tabKey));\r\n\r\nexport const requestCrosstabAggregationOperators = () => dispatch => {\r\n dispatch(incAjaxCount());\r\n\r\n return fetch(\"/TableReport/GetOperators\", {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n const { aggregationOperators, windowOperators } = data;\r\n dispatch({\r\n type: \"CROSSTAB_SET_AGGREGATION_OPERATORS\",\r\n aggregationOperators,\r\n });\r\n dispatch({\r\n type: \"CROSSTAB_SET_WINDOW_OPERATORS\",\r\n windowOperators,\r\n });\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error finding operators\", error);\r\n });\r\n};\r\n\r\nexport const requestMosaicGroups = () => dispatch => {\r\n dispatch(incAjaxCount());\r\n fetch(\"/Mosaic/Groups\", { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(setVar(\"mosaicGroups\", data));\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading mosaic groups\", error);\r\n dispatch(decAjaxCount());\r\n });\r\n};\r\n\r\nexport const goToUrl = url => dispatch => {\r\n if (window.location.href.includes(\"/ae/\") || window.location.href.includes(\"/de/\")) {\r\n dispatch(push(url));\r\n } else {\r\n window.location.assign(url);\r\n }\r\n};\r\n","import { Dispatch } from \"../types/types\";\r\nimport { Destination } from \"../types/types\";\r\nimport {\r\n IUserCompany,\r\n IGetUserCompanies,\r\n ISetSelectedCompany,\r\n ISetLoadingCompany,\r\n ISetCompanyDestinations,\r\n} from \"../types/stores/adminCompanies\";\r\nimport h from \"../helpers\";\r\nimport { request } from \"../helpers/httpInterceptor\";\r\nimport { notifyGreen } from \"./notifyActions\";\r\nimport {\r\n GET_USER_COMPANIES,\r\n EDIT_MAXIMUM_SEATS,\r\n SET_SELECTED_COMPANY,\r\n LOADING_COMPANIES,\r\n} from \"../reducers/adminCompanies\";\r\n\r\nexport const GetUserCompanies = (data: Array): IGetUserCompanies => ({\r\n type: GET_USER_COMPANIES,\r\n userCompanies: data,\r\n});\r\n\r\nexport const setSelectedCompany = (companyId: number): ISetSelectedCompany => ({\r\n type: SET_SELECTED_COMPANY,\r\n companyId,\r\n});\r\n\r\nexport const setLoadingCompany = (loading: boolean): ISetLoadingCompany => ({\r\n type: LOADING_COMPANIES,\r\n loading,\r\n});\r\n\r\nexport const getUserCompanies =\r\n () =>\r\n (dispatch: Dispatch): void => {\r\n dispatch(setLoadingCompany(true));\r\n return request(\"/Companies/GetUserCompanies\", { credentials: \"same-origin\" }, dispatch)\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(setLoadingCompany(false));\r\n dispatch(GetUserCompanies(data));\r\n })\r\n .catch(error => {\r\n dispatch(setLoadingCompany(false));\r\n h.error(\"Error getting user companies.\", error);\r\n });\r\n };\r\nexport const getUserCompaniesAndAssets =\r\n () =>\r\n (dispatch: Dispatch): void =>\r\n request(\"/Companies/GetUserCompanies?includeAssets=true\", { credentials: \"same-origin\" }, dispatch)\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(GetUserCompanies(data));\r\n })\r\n .catch(error => {\r\n h.error(\"Error getting user companies.\", error);\r\n });\r\n\r\nexport const editMaximumSeats =\r\n (companyId: number, maxSeats: number) =>\r\n (dispatch: Dispatch): void => {\r\n let token = \"\";\r\n if (document.getElementsByName(\"__RequestVerificationToken\").length > 0) {\r\n token = (document.getElementsByName(\"__RequestVerificationToken\")[0] as HTMLInputElement).value;\r\n }\r\n return request(\r\n \"/Companies/EditMaximumSeats\",\r\n {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n Accept: \"application/json\",\r\n \"Content-Type\": \"application/json\",\r\n __RequestVerificationToken: token,\r\n },\r\n body: JSON.stringify({\r\n companyId,\r\n maxSeats,\r\n }),\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(() => {\r\n dispatch({\r\n type: EDIT_MAXIMUM_SEATS,\r\n });\r\n })\r\n .catch(error => {\r\n h.error(\"Error editing maximum seats.\", error);\r\n });\r\n };\r\n\r\nexport const createTableauProject =\r\n (companyId: number) =>\r\n (dispatch: Dispatch): void => {\r\n request(\r\n `/Companies/TableauProject?companyId=${companyId}`,\r\n {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data.success) {\r\n dispatch(notifyGreen(\"Tableau project created successfully.\"));\r\n } else {\r\n h.error(\"Error creating Tableau project.\");\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error creating Tableau project.\", error);\r\n });\r\n };\r\n\r\nexport const setCompanyDestinations = (\r\n companyId: number,\r\n destinations: Array\r\n): ISetCompanyDestinations => ({\r\n type: \"SET_COMPANY_DESTINATIONS\",\r\n companyId,\r\n destinations,\r\n});\r\n\r\nexport const requestCompanyDestinations =\r\n (companyId: number) =>\r\n (dispatch: Dispatch): void => {\r\n request(\r\n `/ClientAccess/GetPartnersByCompanyId?companyId=${companyId}`,\r\n {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data.partners && data.partners.length > 0) {\r\n dispatch(setCompanyDestinations(companyId, data.partners));\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading partners.\", error);\r\n });\r\n };\r\n","import h from \"../helpers\";\r\nimport { request } from \"../helpers/httpInterceptor\";\r\nimport {\r\n TOGGLE_FIELD_EDIT_LISTING,\r\n TOGGLE_FIELD_EDIT_LISTING_PINNABLE,\r\n SET_PROPERTY,\r\n AdminDesignerProperties,\r\n} from \"../reducers/adminDesigner\";\r\nimport { notifyError, notifyGreen } from \"./notifyActions\";\r\nimport { requestEditFieldTree, requestEnabledFieldCompanies } from \"./fieldTreeActions\";\r\nimport { IAdminDesignerStore, SetProperty, IImportBulkField } from \"../types/stores/adminDesigner\";\r\nimport { Dispatch, GetState } from \"../types/types\";\r\n\r\nexport const ToggleFieldEditListing = (currentValue: boolean): any => ({\r\n type: TOGGLE_FIELD_EDIT_LISTING,\r\n isOpen: !currentValue,\r\n});\r\n\r\nexport const ToggleFieldEditPinnable = (currentValue: boolean): any => ({\r\n type: TOGGLE_FIELD_EDIT_LISTING_PINNABLE,\r\n isPinned: !currentValue,\r\n});\r\n\r\nexport const setProperty = (\r\n property: string,\r\n newValue: IAdminDesignerStore[keyof IAdminDesignerStore],\r\n index?: number\r\n): SetProperty => ({\r\n type: SET_PROPERTY,\r\n property,\r\n newValue,\r\n index,\r\n});\r\n\r\nexport const requestFieldVisibilityTypes =\r\n () =>\r\n (dispatch: Dispatch): void => {\r\n const url = \"/Field/GetFieldVisibilityTypes\";\r\n return (\r\n request(url, { credentials: \"same-origin\", method: \"POST\" }, dispatch)\r\n /* eslint-disable no-console */\r\n .then(h.checkStatus)\r\n .then(console.log(\"GetFieldVisibilityTypes:checkStatus\" + Date().toLocaleString() + \"\"))\r\n .then(h.toJson)\r\n .then(console.log(\"GetFieldVisibilityTypes:toJson\" + Date().toLocaleString() + \"\"))\r\n .then(data => {\r\n if (data) {\r\n dispatch(setProperty(AdminDesignerProperties.fieldVisibilityTypes, data));\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading field visibility types.\", error);\r\n })\r\n );\r\n };\r\n\r\nexport const requestFieldVisibilityTypesDefault =\r\n () =>\r\n (dispatch: Dispatch): void => {\r\n dispatch(setProperty(AdminDesignerProperties.isLoadingFieldVisibilityTypesDefault, true));\r\n\r\n const url = \"/Field/GetFieldVisibilityTypesDefault\";\r\n return (\r\n request(url, { credentials: \"same-origin\", method: \"POST\" }, dispatch)\r\n /* eslint-disable no-console */\r\n .then(h.checkStatus)\r\n .then(console.log(\"GetFieldVisibilityTypesDefault:checkStatus\" + Date().toLocaleString() + \"\"))\r\n .then(h.toJson)\r\n .then(console.log(\"GetFieldVisibilityTypesDefault:toJson\" + Date().toLocaleString() + \"\"))\r\n .then(data => {\r\n if (data) {\r\n dispatch(setProperty(AdminDesignerProperties.fieldVisibilityTypesDefault, data));\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading field visibility types by default.\", error);\r\n })\r\n .finally(() => {\r\n dispatch(setProperty(AdminDesignerProperties.isLoadingFieldVisibilityTypesDefault, false));\r\n })\r\n );\r\n };\r\n\r\nexport const requestFieldLabels =\r\n () =>\r\n (dispatch: Dispatch): void =>\r\n request(\"/Field/GetFieldLabels\", { credentials: \"same-origin\", method: \"POST\" }, dispatch)\r\n /* eslint-disable no-console */\r\n .then(h.checkStatus)\r\n .then(console.log(\"requestFieldLabels:checkStatus\" + Date().toLocaleString() + \"\"))\r\n .then(h.toJson)\r\n .then(console.log(\"requestFieldLabels:toJson\" + Date().toLocaleString() + \"\"))\r\n .then(data => {\r\n dispatch(setProperty(AdminDesignerProperties.fieldLabels, data.results));\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading field labels.\", error);\r\n });\r\n\r\nexport const requestFieldLabels3 =\r\n () =>\r\n (dispatch: Dispatch): void =>\r\n request(\"/Field/GetFieldLabels3\", { credentials: \"same-origin\", method: \"POST\" }, dispatch)\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(setProperty(AdminDesignerProperties.fieldLabels3, data.results));\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading field labels2.\", error);\r\n });\r\n\r\nexport const requestUmbrellaDataLevels =\r\n () =>\r\n (dispatch: Dispatch): void =>\r\n request(\"/Field/GetUmbrellaDataLevels\", { credentials: \"same-origin\", method: \"POST\" }, dispatch)\r\n /* eslint-disable no-console */\r\n .then(h.checkStatus)\r\n .then(console.log(\"GetUmbrellaDataLevels:checkStatus\" + Date().toLocaleString() + \"\"))\r\n .then(h.toJson)\r\n .then(console.log(\"GetUmbrellaDataLevels:toJson\" + Date().toLocaleString() + \"\"))\r\n .then(data => {\r\n dispatch(setProperty(AdminDesignerProperties.umbrellaDataLevels, data.results));\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading umbrella levels.\", error);\r\n });\r\n\r\nexport const requestUmbrellaDataTypes =\r\n () =>\r\n (dispatch: Dispatch): void =>\r\n request(\"/Field/GetUmbrellaDataTypes\", { credentials: \"same-origin\", method: \"POST\" }, dispatch)\r\n /* eslint-disable no-console */\r\n .then(h.checkStatus)\r\n .then(console.log(\"GetUmbrellaDataTypes:checkStatus\" + Date().toLocaleString() + \"\"))\r\n .then(h.toJson)\r\n .then(console.log(\"GetUmbrellaDataTypes:toJson\" + Date().toLocaleString() + \"\"))\r\n .then(data => {\r\n dispatch(setProperty(AdminDesignerProperties.umbrellaDataTypes, data.results));\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading umbrella types.\", error);\r\n });\r\n\r\nexport const requestUsersForCompany =\r\n (companyId?: number) =>\r\n (dispatch: Dispatch): Array =>\r\n request(\r\n `/UsersAdmin/GetUsersForCompany${companyId && companyId > 0 ? \"?companyId=\" + companyId : \"\"}`,\r\n { credentials: \"same-origin\", method: \"POST\" },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(setProperty(AdminDesignerProperties.companyUsers, data.users, companyId ?? 0));\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading users for company.\", error);\r\n });\r\n\r\nexport const requestSaveBulkSettings =\r\n (isBulkActions: boolean) =>\r\n (dispatch: Dispatch, getState: GetState): void => {\r\n const state = getState();\r\n const selectedFields = state.dataConnect.selectedFields || [];\r\n\r\n //button should be disabled so this shouldn't happen\r\n if (selectedFields.length <= 0) {\r\n return;\r\n }\r\n const overwriteTreeVisibility = state.adminDesigner.overwriteTreeVisibility;\r\n const setIsMetaDataRefresh = state.adminDesigner.setIsMetaDataRefresh;\r\n const overwriteFieldLabels = state.adminDesigner.overwriteFieldLabels;\r\n const overwriteUserVisibility = state.adminDesigner.overwriteUserVisibility;\r\n const visibleAllUsers = state.adminDesigner.visibleAllUsers[0];\r\n const selectedFieldVisibilityTypes = state.adminDesigner.selectedFieldVisibilityTypes[0];\r\n const selectedFieldLabels = state.adminDesigner.selectedFieldLabels;\r\n const selectedCompanyUsers = state.adminDesigner.selectedCompanyUsers[0];\r\n const selectedCompanies = state.adminDesigner.selectedCompanies;\r\n const restrictedField = state.adminDesigner.isRestrictedField;\r\n const isUpdateMetaData = state.adminDesigner.isUpdateMetaData;\r\n const isUpdateFieldClassification = state.adminDesigner.isUpdateFieldClassification;\r\n const setFieldDataType = state.adminDesigner.setFieldDataType;\r\n const setFieldClassification = state.adminDesigner.setFieldClassification;\r\n const setSubTypeDropDown = state.adminDesigner.setSubTypeDropDown;\r\n const setDecimals = state.adminDesigner.setDecimals;\r\n const setFieldMetaDataKey = state.adminDesigner.setFieldMetaDataKey;\r\n const cloneFieldLabels = state.adminDesigner.cloneFieldLabels;\r\n const toCompany = state.adminDesigner.toCompany;\r\n\r\n dispatch(setProperty(AdminDesignerProperties.isSaving, true));\r\n return request(\r\n \"/Field/SaveBulkSettings\",\r\n {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n Accept: \"application/json\",\r\n \"Content-Type\": \"application/json\",\r\n },\r\n\r\n body: JSON.stringify({\r\n SelectedFields: selectedFields,\r\n OverwriteTreeVisibility: overwriteTreeVisibility,\r\n SetIsMetaDataRefresh: setIsMetaDataRefresh,\r\n OverwriteFieldLabels: overwriteFieldLabels,\r\n OverwriteUserVisibility: overwriteUserVisibility,\r\n VisibleAllUsers: visibleAllUsers,\r\n SelectedFieldVisibilityTypes: selectedFieldVisibilityTypes,\r\n SelectedFieldLabels: selectedFieldLabels,\r\n SelectedCompanyUsers: selectedCompanyUsers,\r\n SelectedCompanies: selectedCompanies,\r\n isRestrictedField: restrictedField,\r\n IsUpdateMetaData: isUpdateMetaData,\r\n IsUpdateFieldClassification: isUpdateFieldClassification,\r\n SetFieldDataType: setFieldDataType,\r\n setFieldClassification,\r\n SetSubTypeDropDown: setSubTypeDropDown,\r\n SetDecimals: setDecimals,\r\n SetFieldMetaDataKey: setFieldMetaDataKey,\r\n CloneFieldLabels: cloneFieldLabels,\r\n toCompany,\r\n }),\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(setProperty(AdminDesignerProperties.isSaving, false));\r\n if (!data.success) {\r\n if (data.message) {\r\n dispatch(notifyError(data.message));\r\n } else {\r\n h.error(\"Error saving field bulk settings.\");\r\n }\r\n } else {\r\n dispatch(requestEditFieldTree(isBulkActions));\r\n dispatch(requestEnabledFieldCompanies());\r\n //#6359 just commented this two lines , I will left them here just in case we need to go back -Marco\r\n //dispatch(RemoveAllFromDataConnectSelectedFields());\r\n //dispatch(clearBulkOptions());\r\n dispatch(notifyGreen(\"Fields settings updated successfully.\"));\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(setProperty(AdminDesignerProperties.isSaving, false));\r\n h.error(\"Error saving field bulk settings.\", error);\r\n });\r\n };\r\n\r\nexport const downloadBulkSettings =\r\n () =>\r\n (dispatch: Dispatch, getState: GetState): void => {\r\n const state = getState();\r\n const selectedFields = state.dataConnect.selectedFields || [];\r\n const selectedFieldNames = state.dataConnect.selectedFieldNames || [];\r\n //button should be disabled so this shouldn't happen\r\n if (selectedFields.length <= 0) {\r\n return;\r\n }\r\n\r\n const selectedFieldVisibilityTypes = state.adminDesigner.selectedFieldVisibilityTypes[0];\r\n const selectedFieldVisibilityTypeNames = state.adminDesigner.selectedFieldVisibilityTypeNames[0];\r\n const selectedCompanies = state.adminDesigner.selectedCompanies;\r\n\r\n request(\r\n `/BulkSetting/ExportBulkSettings`,\r\n {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n body: JSON.stringify({\r\n SelectedCompanies: selectedCompanies,\r\n SelectedFields: selectedFields,\r\n SelectedFieldNames: selectedFieldNames,\r\n SelectedFieldVisibilityTypes: selectedFieldVisibilityTypes,\r\n SelectedFieldVisibilityTypeNames: selectedFieldVisibilityTypeNames,\r\n }),\r\n },\r\n dispatch\r\n )\r\n .then(response => response.blob())\r\n .then(blob => {\r\n // Create blob link to download\r\n const url = window.URL.createObjectURL(new Blob([blob]));\r\n const anchorLink = document.createElement(\"a\");\r\n anchorLink.href = url;\r\n anchorLink.setAttribute(\"download\", `Output Default BulkSettings.csv`);\r\n\r\n // Append to html anchorLink element page\r\n document.body.appendChild(anchorLink);\r\n\r\n // Start download\r\n anchorLink.click();\r\n\r\n // Clean up and remove the anchorLink\r\n anchorLink.parentNode?.removeChild(anchorLink);\r\n });\r\n };\r\n\r\nexport const requestAddBulkFields =\r\n (importedBulkFields: Array) =>\r\n (dispatch: Dispatch): void => {\r\n request(\r\n `/Field/ImportBulkSettings`,\r\n {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n Accept: \"application/json\",\r\n \"Content-Type\": \"application/json\",\r\n },\r\n body: JSON.stringify({\r\n SelectedFields: importedBulkFields,\r\n }),\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data && data.success) {\r\n dispatch(notifyGreen(\"Successfully saved your import.\" + data.message));\r\n } else if (data && !data.success) {\r\n h.error(\"Error saving your import.\", data.message);\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error saving your import.\", error);\r\n });\r\n };\r\n","import h from \"../helpers\";\r\nimport { request } from \"../helpers/httpInterceptor\";\r\nimport { flowRelatedRequestStart, flowRelatedRequestCompleted } from \"./loadingActions\";\r\nimport { ToggleIsFlowTreeLoading } from \"./treeBehaviorActions\";\r\nimport { folderReducerKeyForType } from \"../helpers/folder\";\r\nimport { uniqArray } from \"../helpers/typedHelpers\";\r\nimport { requestUserNames, setUserNames } from \"./actionCreators\";\r\nimport { findMinimumFolderId, pickNewFolderName, fixNameIfDuplicate } from \"../reducers/_folderGeneral\";\r\nimport { deleteUser } from \"./userActions\";\r\n\r\nif (!top.RDX) {\r\n top.RDX = {};\r\n}\r\n\r\nexport const loadFolders = (folderType, data) => ({\r\n type: \"LOAD_FOLDERS\",\r\n folderType,\r\n data,\r\n});\r\ntop.RDX.loadFolders = (folderType, data) => top.store.dispatch(loadFolders(folderType, data));\r\n\r\n// Ask server for folder data, then load it\r\n// Can be a CSV of folderTypes\r\nlet overwroteUserNamesOnce = false;\r\nexport const requestLoadFolders =\r\n (folderType = \"W,L\") =>\r\n dispatch => {\r\n const folderUrl = \"/Folders/GetRaw?\" + h.serialize({ typeCsv: folderType.toUpperCase() });\r\n dispatch(flowRelatedRequestStart());\r\n\r\n request(folderUrl, { credentials: \"same-origin\" }, dispatch)\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(flowRelatedRequestCompleted());\r\n const userIds = [...new Set(data.map(item => item.UserKey))];\r\n dispatch(requestUserNames(userIds, overwroteUserNamesOnce ? \"merge\" : \"overwrite\"));\r\n overwroteUserNamesOnce = true;\r\n\r\n const types = uniqArray(data.map(x => x.Type));\r\n for (const folderType of types) {\r\n const filteredData = data.filter(x => x.Type == folderType);\r\n dispatch(loadFolders(folderType, filteredData));\r\n }\r\n })\r\n .catch(() => {\r\n dispatch(flowRelatedRequestCompleted());\r\n });\r\n };\r\ntop.RDX.requestLoadFolders = (folderType = \"W,L\") => top.store.dispatch(requestLoadFolders(folderType));\r\n\r\nexport const requestAdminUsers = deleteduserId => dispatch => {\r\n dispatch(deleteUser(deleteduserId));\r\n};\r\ntop.RDX.requestAdminUsers = deleteduserId => top.store.dispatch(requestAdminUsers(deleteduserId));\r\n\r\nexport const requestLoadFlowFolders = () => dispatch => {\r\n const folderUrl = \"/FlowFolder/GetFolders\";\r\n dispatch(ToggleIsFlowTreeLoading(true));\r\n request(folderUrl, { method: \"POST\", credentials: \"same-origin\" }, dispatch)\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data.userNames) {\r\n dispatch(setUserNames(data.userNames));\r\n }\r\n\r\n const types = uniqArray(data.fullFolders.map(x => x.Type));\r\n for (const folderType of types) {\r\n const filteredData = data.fullFolders.filter(x => x.Type == folderType);\r\n dispatch(loadFolders(folderType, filteredData));\r\n }\r\n dispatch(ToggleIsFlowTreeLoading(false));\r\n })\r\n .catch(() => {\r\n dispatch(ToggleIsFlowTreeLoading(false));\r\n });\r\n};\r\ntop.RDX.requestLoadFlowFolders = () => top.store.dispatch(requestLoadFlowFolders());\r\n\r\n// Move Folder to Folder -- locally only\r\nexport const moveFolderToFolder = (folderType, folderId, parentFolderId) => ({\r\n type: \"MOVE_FOLDER_TO_FOLDER\",\r\n folderType,\r\n folderId,\r\n parentFolderId,\r\n});\r\n\r\n// Move Folder to Folder -- API request\r\nexport const requestMoveFolderToFolder =\r\n (folderType, folderId, parentFolderId, loadFlowFolders = false) =>\r\n (dispatch, getState) => {\r\n // Optimistic update, move folder on client side\r\n const oldState = JSON.stringify(getState());\r\n dispatch(moveFolderToFolder(folderType, folderId, parentFolderId));\r\n const newState = JSON.stringify(getState());\r\n\r\n // See if it changed anything, if no, the folder move wasn't allowed and we don't make API request\r\n if (oldState == newState) {\r\n return;\r\n }\r\n\r\n // Good to make API request\r\n const saveUrl =\r\n \"/Folders/MoveFolder?\" +\r\n h.serialize({\r\n folderId,\r\n newParentFolderId: parentFolderId,\r\n });\r\n return fetch(saveUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (!data || !data.result || data.result != 1) {\r\n throw new Error(\"Error moving folder.\");\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error moving folder\", error);\r\n if (loadFlowFolders) {\r\n dispatch(requestLoadFlowFolders());\r\n } else {\r\n dispatch(requestLoadFolders(folderType));\r\n }\r\n });\r\n };\r\n\r\n// In the UI, mark a folder as being renamed\r\nexport const startRenamingFolder = (folderType, folderId) => ({\r\n type: \"START_RENAMING_FOLDER\",\r\n folderType,\r\n folderId,\r\n});\r\n\r\n// Stop renaming any folder\r\nexport const stopRenamingFolder = folderType => ({\r\n type: \"STOP_RENAMING_FOLDER\",\r\n folderType,\r\n});\r\n\r\n// Rename a folder in the local store only\r\nexport const renameFolder = (folderType, folderId, folderNewName) => ({\r\n type: \"RENAME_FOLDER\",\r\n folderType,\r\n folderId,\r\n folderNewName,\r\n});\r\n\r\n// Send a request to the server to rename a folder\r\nexport const requestRenameFolder =\r\n (folderType, folderId, folderNewName, loadFlowFolders = false) =>\r\n (dispatch, getState) => {\r\n const folderReducerKey = folderReducerKeyForType(folderType);\r\n // Currently, we can't have duplicate folder names\r\n folderNewName = fixNameIfDuplicate(getState().folders[folderReducerKey], folderNewName, folderId);\r\n // Local\r\n dispatch(renameFolder(folderType, folderId, folderNewName));\r\n dispatch(stopRenamingFolder(folderType));\r\n\r\n // Skip API call if folderId is negative (this means the server doesn't know about it yet)\r\n if (folderId < 0) {\r\n return;\r\n }\r\n\r\n // Now API\r\n const saveUrl =\r\n \"/Folders/RenameFolder?\" +\r\n h.serialize({\r\n folderId,\r\n newFolderName: folderNewName,\r\n folderType,\r\n });\r\n return fetch(saveUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n // We actually expect the API to return [1] to mean success because of a bug\r\n if (data.result !== 1 && JSON.stringify(data.result) !== \"[1]\") {\r\n h.error(\"Error renaming folder.\");\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error renaming folder.\", error);\r\n if (loadFlowFolders) {\r\n dispatch(requestLoadFlowFolders());\r\n } else {\r\n dispatch(requestLoadFolders(folderType));\r\n }\r\n });\r\n };\r\n\r\n// Delete locally only\r\nexport const deleteFolder = (folderType, folderId) => ({\r\n type: \"DELETE_FOLDER\",\r\n folderType,\r\n folderId,\r\n});\r\n\r\n// Send request to the server to delete a folder\r\nexport const requestDeleteFolder = (folderType, folderId) => dispatch => {\r\n // Local\r\n dispatch(deleteFolder(folderType, folderId));\r\n\r\n // Now API\r\n const saveUrl =\r\n \"/Folders/DeleteFolder?\" +\r\n h.serialize({\r\n folderId,\r\n });\r\n return fetch(saveUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (!data || !data.result || data.result != 1) {\r\n throw new Error(\"Error deleting folder.\");\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error deleting folder.\", error);\r\n dispatch(requestLoadFolders);\r\n });\r\n};\r\n\r\n// newFolder just calls createFolder but looks in the store to find the current userId\r\nexport const newFolder = (folderType, parentFolderId, newFolderName) => (dispatch, getState) => {\r\n const { userId, companyId } = getState().session;\r\n dispatch(createFolder(folderType, parentFolderId, newFolderName, userId, companyId));\r\n};\r\n// Create a new folder, locally\r\nexport const createFolder = (folderType, parentFolderId, newFolderName, userId, companyId) => ({\r\n type: \"CREATE_FOLDER\",\r\n folderType,\r\n parentFolderId,\r\n newFolderName,\r\n userId,\r\n companyId,\r\n});\r\n\r\nexport const assignNewFolderId = (folderType, newFolderId) => ({\r\n type: \"ASSIGN_NEW_FOLDER_ID\",\r\n folderType,\r\n newFolderId,\r\n});\r\n\r\n// Send request to the server to create a new folder\r\nexport const requestNewFolder = (folderType, parentFolderId) => (dispatch, getState) => {\r\n const folderReducerKey = folderReducerKeyForType(folderType);\r\n // Locally\r\n const newFolderName = pickNewFolderName(getState().folders[folderReducerKey]);\r\n //let newFolderName = \"New Folder\" + Math.floor(Math.random() * 1000);\r\n dispatch(newFolder(folderType, parentFolderId, newFolderName));\r\n\r\n // Let the user start renaming it\r\n const tempFolderId = findMinimumFolderId(getState().folders[folderReducerKey]);\r\n\r\n dispatch(startRenamingFolder(folderType, tempFolderId));\r\n\r\n // API\r\n const saveUrl =\r\n \"/Folders/CreateFolder?\" +\r\n h.serialize({\r\n parentFolderId,\r\n folderName: newFolderName,\r\n folderType,\r\n });\r\n return fetch(saveUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (!data || !data.FolderId) {\r\n throw new Error(\"Error creating folder.\");\r\n }\r\n const newFolderId = data.FolderId;\r\n dispatch(assignNewFolderId(folderType, newFolderId));\r\n })\r\n .catch(error => {\r\n h.error(\"Error creating folder.\", error);\r\n });\r\n};\r\n","import { request } from \"../helpers/httpInterceptor\";\r\nimport h from \"../helpers\";\r\nimport { toJson } from \"../helpers/typedHelpers\";\r\nimport {\r\n SET_AWS_S3_FILE_LIST_LOADING,\r\n SET_AWS_S3_FILE_LIST,\r\n SET_AWS_S3_FILE_DOWNLOADING,\r\n SET_AWS_S3_FILE_LIST_ERROR,\r\n SET_AWS_S3_FILE_INFO,\r\n RESET_AWS_S3,\r\n SET_AWS_FLOW_CONTROL_FILES_INFO,\r\n} from \"../reducers/aws\";\r\nimport { Dispatch, GetState } from \"../types/types\";\r\nimport { IFileInfo } from \"../types/actions/fileInfo\";\r\nimport { ISetAwsFlowControlFilesInfo } from \"../types/actions/aws\";\r\n\r\nconst accessErrors = [\"Access Denied\", \"InvalidAccessKeyId\", \"SignatureDoesNotMatch\"];\r\nconst accessMessage = \"Access to the Amazon S3 was denied or is now invalid. Please contact your administrator.\";\r\n\r\nexport const GetS3FileList =\r\n () =>\r\n (dispatch: Dispatch): void => {\r\n dispatch({ type: SET_AWS_S3_FILE_LIST_LOADING, isLoading: true });\r\n return request(\r\n `/api/aws/list`,\r\n {\r\n method: \"GET\",\r\n credentials: \"same-origin\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n if (data.success) {\r\n dispatch({ type: SET_AWS_S3_FILE_LIST, files: data.files });\r\n dispatch({ type: SET_AWS_S3_FILE_LIST_LOADING, isLoading: false });\r\n return;\r\n }\r\n\r\n if (data.message) {\r\n dispatch({ type: SET_AWS_S3_FILE_LIST, files: [] });\r\n let errorMessage =\r\n \"An unexpected error has occurred in fetching your Amazon S3 files. Please contact your administrator.\";\r\n\r\n if (data.message && accessErrors.includes(data.message)) {\r\n errorMessage = accessMessage;\r\n }\r\n\r\n dispatch({ type: SET_AWS_S3_FILE_LIST_ERROR, error: errorMessage });\r\n dispatch({ type: SET_AWS_S3_FILE_LIST_LOADING, isLoading: false });\r\n return;\r\n }\r\n })\r\n .catch(() => {\r\n dispatch({ type: SET_AWS_S3_FILE_LIST_LOADING, isLoading: false });\r\n });\r\n };\r\n\r\nexport const GetS3FileInfo =\r\n (fileName: string) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch({ type: SET_AWS_S3_FILE_DOWNLOADING, isDownloading: true });\r\n return request(\r\n `/api/aws/file?fileName=${fileName}`,\r\n {\r\n method: \"GET\",\r\n credentials: \"same-origin\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n if (data.success) {\r\n dispatch({\r\n type: SET_AWS_S3_FILE_INFO,\r\n fileName,\r\n filePreview: data.preview,\r\n fileQuantity: data.fileQuantity,\r\n });\r\n dispatch(\r\n addFileInfo({\r\n fileName,\r\n filePreview: data.preview,\r\n fileQuantity: data.fileQuantity,\r\n } as IFileInfo)\r\n );\r\n dispatch({ type: SET_AWS_S3_FILE_DOWNLOADING, isDownloading: false });\r\n return;\r\n }\r\n\r\n if (data.message) {\r\n dispatch({ type: SET_AWS_S3_FILE_INFO, fileName: null, filePreview: null, fileQuantity: null });\r\n let errorMessage =\r\n \"An unexpected error has occurred in fetching your Amazon S3 file. Please contact your administrator.\";\r\n\r\n if (data.message && accessErrors.includes(data.message)) {\r\n errorMessage = accessMessage;\r\n }\r\n if (data.message == \"NoSuchKey\") {\r\n errorMessage = \"File Not Found\";\r\n }\r\n\r\n dispatch({ type: SET_AWS_S3_FILE_LIST_ERROR, error: errorMessage });\r\n dispatch({ type: SET_AWS_S3_FILE_DOWNLOADING, isDownloading: false });\r\n return;\r\n }\r\n })\r\n .catch(() => {\r\n dispatch({ type: SET_AWS_S3_FILE_DOWNLOADING, isDownloading: false });\r\n });\r\n };\r\n\r\nexport const ResetS3Data =\r\n () =>\r\n (dispatch: Dispatch): void => {\r\n dispatch({ type: RESET_AWS_S3 });\r\n };\r\n\r\nexport const SetAWSFlowControlFilesInfo = (files: Array): ISetAwsFlowControlFilesInfo => ({\r\n type: SET_AWS_FLOW_CONTROL_FILES_INFO,\r\n flowControlFilesInfo: files,\r\n});\r\n\r\nexport const addFileInfo =\r\n (newFileInfo: IFileInfo) =>\r\n (dispatch: Dispatch, getState: GetState): void => {\r\n const state = getState();\r\n const enabledFeatures: Array = state.session.enabledFeatures;\r\n\r\n if (enabledFeatures.includes(\"flow-control-multi-input\")) {\r\n const filesInfo: Array = state.aws.flowControlFilesInfo;\r\n\r\n let newFilesInfo = [...filesInfo];\r\n let currentFileInfo = newFilesInfo.find(x => x.fileName == newFileInfo.fileName);\r\n\r\n if (currentFileInfo) {\r\n currentFileInfo.filePreview = newFileInfo.filePreview;\r\n currentFileInfo.fileQuantity = newFileInfo.fileQuantity;\r\n } else {\r\n newFilesInfo.push(newFileInfo);\r\n }\r\n\r\n dispatch(SetAWSFlowControlFilesInfo(newFilesInfo));\r\n }\r\n };\r\n","if (!top.RDX) {\r\n top.RDX = {};\r\n}\r\n\r\nexport const setSelectedCannedReport = Id => ({\r\n type: \"SET_SELECTED_CANNEDREPORT\",\r\n Id,\r\n});\r\ntop.RDX.setSelectedCannedReport = Id => top.store.dispatch(setSelectedCannedReport(Id));\r\n\r\nexport const clearSelectedCannedReport = () => ({\r\n type: \"CLEAR_SELECTED_CANNEDREPORT\",\r\n});\r\ntop.RDX.clearSelectedCannedReport = () => top.store.dispatch(clearSelectedCannedReport());\r\n","import h from \"../helpers\";\r\nimport { toJson } from \"../helpers/typedHelpers\";\r\nimport { incAjaxCount, decAjaxCount } from \"./actionCreators\";\r\nimport { updateAttribute, updateMultipleAttribute, newFlowClientVariable, newFlowItemOfferCode } from \"./flowActions\";\r\nimport type { ThunkAction, Dispatch, GetState } from \"../types/types\";\r\nimport type {\r\n FlowSetClientVariableAction,\r\n FlowAddClientVariableAction,\r\n FlowItemSetClientVariableAction,\r\n FlowItemAddClientVariableAction,\r\n} from \"../types/actionTypes\";\r\nimport { getFlowItemClientVariablesArray } from \"../reducers/flowItemClientVariables\";\r\nimport { getFlowItemOfferCodesArray } from \"../reducers/flowItemOfferCodes\";\r\nimport { deleteFlowItemClientVariable, deleteFlowItemOfferCode } from \"./flowActions\";\r\nimport {\r\n ILoadVariablesAction,\r\n INormalizedClientVariableData,\r\n IClientVariable,\r\n ClientVariableKind,\r\n VariableValueType,\r\n IVariableDataType,\r\n IVariableSubType,\r\n IVariableGrouping,\r\n ISetVariableGroupings,\r\n} from \"../types/stores/vars\";\r\nimport { normalize, schema } from \"normalizr\";\r\nimport {\r\n ISetLoadingDestinationOrder,\r\n ISetVariableDataTypes,\r\n ISetVariableDataTypesFull,\r\n IVariableType,\r\n} from \"../types/stores/vars\";\r\nimport { IAppState } from \"../types/stores/index\";\r\n\r\nexport const loadClientVariables = (normalizedData: INormalizedClientVariableData): ILoadVariablesAction => ({\r\n type: \"LOAD_CLIENT_VARIABLES\",\r\n normalizedData,\r\n});\r\n\r\nexport const requestClientVariableGroupings =\r\n () =>\r\n (dispatch: Dispatch): void => {\r\n dispatch(incAjaxCount());\r\n fetch(\"/clientvariable/GetVariableGroupings\", { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n const response = data as unknown as { groupings: Array };\r\n dispatch(loadVariableGroupings(response.groupings));\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error loading client variables.\", error);\r\n });\r\n };\r\n\r\nexport const loadVariableGroupings = (variableGroupings: Array): ISetVariableGroupings => ({\r\n type: \"SET_VARIABLE_GROUPINGS\",\r\n variableGroupings,\r\n});\r\n\r\nexport const requestClientVariableDataTypes =\r\n () =>\r\n (dispatch: Dispatch): void => {\r\n dispatch(incAjaxCount());\r\n fetch(\"/clientvariable/GetVariableTypes\", { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n const response = data as unknown as { variableTypes: Array };\r\n dispatch(loadDataTypes(response.variableTypes));\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error loading client variables.\", error);\r\n });\r\n };\r\n\r\nexport const requestClientVariableDataTypesFull =\r\n () =>\r\n (dispatch: Dispatch): void => {\r\n const url = \"/clientvariable/GetVariableTypesFull\";\r\n dispatch(incAjaxCount());\r\n fetch(url, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n interface ITempData {\r\n variableDataTypes: Array;\r\n variableSubTypesArray: Array>;\r\n }\r\n const response = data as ITempData;\r\n if (response.variableSubTypesArray) {\r\n const transformedArray = response.variableSubTypesArray.map(\r\n (subTypesArray: Array<{ Key: string; Value: any }>) => {\r\n const transformedObject = {\r\n SubTypeId: subTypesArray.find(obj => obj.Key === \"SubTypeId\")?.Value || 0,\r\n VariableTypeId: subTypesArray.find(obj => obj.Key === \"VariableTypeId\")?.Value || 0,\r\n Regex: subTypesArray.find(obj => obj.Key === \"Regex\")?.Value || \"\",\r\n Description: subTypesArray.find(obj => obj.Key === \"Description\")?.Value || \"\",\r\n CompanyId: subTypesArray.find(obj => obj.Key === \"CompanyId\")?.Value || 0,\r\n DropdownValues: subTypesArray.find(obj => obj.Key === \"DropdownValues\")?.Value || \"\",\r\n Error: \"\",\r\n VariableTypeName:\r\n subTypesArray.find(obj => obj.Key === \"VariableTypeName\")?.Value || \"\",\r\n };\r\n return transformedObject;\r\n }\r\n );\r\n dispatch(loadDataTypesFull(response.variableDataTypes, transformedArray));\r\n dispatch(decAjaxCount());\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error loading client variables.\", error);\r\n });\r\n };\r\n\r\nexport const loadDataTypes = (variableTypes: Array): ISetVariableDataTypes => ({\r\n type: \"SET_VARIABLE_DATA_TYPES\",\r\n variableTypes,\r\n});\r\n\r\nexport const loadDataTypesFull = (\r\n variableDataTypes: Array,\r\n variableSubTypes: Array\r\n): ISetVariableDataTypesFull => ({\r\n type: \"SET_VARIABLE_DATA_TYPES_FULL\",\r\n variableDataTypes,\r\n variableSubTypes,\r\n});\r\n\r\nexport const requestClientVariables = (): ThunkAction => (dispatch: Dispatch) => {\r\n const url = \"/clientvariable/list\";\r\n dispatch(incAjaxCount());\r\n fetch(url, { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n const variableArray = data as unknown as Array;\r\n const normalizedData = normalizeVariableData(variableArray);\r\n dispatch(loadClientVariables(normalizedData));\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error loading client variables.\", error);\r\n });\r\n};\r\n\r\nexport const requestDeleteClientVariable =\r\n (id: number): ThunkAction =>\r\n (dispatch: Dispatch) => {\r\n const deleteUrl =\r\n \"/ClientVariable/Delete?\" +\r\n h.serialize({\r\n variableId: id,\r\n });\r\n\r\n dispatch(incAjaxCount());\r\n fetch(deleteUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n const response = data as unknown as { result: boolean; error: boolean };\r\n dispatch(decAjaxCount());\r\n if (response.error) {\r\n h.error(response.error);\r\n } else {\r\n dispatch(requestClientVariables());\r\n dispatch(offerCodeCleanup(id));\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error deleting client variable\", error);\r\n });\r\n };\r\n\r\nexport const requestDeleteClientGrouping =\r\n (id: number): ThunkAction =>\r\n (dispatch: Dispatch) => {\r\n const deleteUrl =\r\n \"/ClientVariable/DeleteGrouping?\" +\r\n h.serialize({\r\n id,\r\n });\r\n\r\n dispatch(incAjaxCount());\r\n fetch(deleteUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n const response = data as unknown as { result: boolean; error: boolean };\r\n dispatch(decAjaxCount());\r\n if (response.error) {\r\n h.error(response.error);\r\n } else {\r\n dispatch(requestClientVariableGroupings());\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error deleting client variable grouping\", error);\r\n });\r\n };\r\n\r\nconst offerCodeCleanup = (id: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state: IAppState = getState();\r\n const clientVariables = state.clientVariables ? state.clientVariables.byId : null;\r\n if (!clientVariables) {\r\n return;\r\n }\r\n const variable = clientVariables[id];\r\n if (!variable || variable.VariableScope == \"OfferCode\") {\r\n return;\r\n }\r\n\r\n const flowVariables = getFlowItemClientVariablesArray(state);\r\n if (flowVariables) {\r\n const variablesToDelete = flowVariables.filter(x => x.VariableId == id);\r\n for (const variable of variablesToDelete) {\r\n dispatch(deleteFlowItemClientVariable(variable.FlowItemClientVariableId));\r\n }\r\n }\r\n\r\n const flowOffers = getFlowItemOfferCodesArray(state);\r\n if (flowOffers) {\r\n const offersToDelete = flowOffers.filter(x => x.VariableId == id);\r\n for (const offer of offersToDelete) {\r\n dispatch(deleteFlowItemOfferCode(offer.FlowItemOfferCodeId));\r\n }\r\n }\r\n};\r\n\r\nconst normalizeVariableData = (variableData: Array): INormalizedClientVariableData => {\r\n const variable = new schema.Entity(\"variables\", {}, { idAttribute: \"Id\" });\r\n const mySchema = {\r\n variables: [variable],\r\n };\r\n return normalize({ variables: variableData }, mySchema);\r\n};\r\n\r\nexport const requestAddClientVariable =\r\n (\r\n variableName: string,\r\n variableKind: ClientVariableKind,\r\n variableScope: string,\r\n variableSubTypeId: number,\r\n variableGroupId: number | null,\r\n onAddCallback: () => void,\r\n onErrorCallback: () => void\r\n ) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch(incAjaxCount());\r\n const saveUrl =\r\n \"/ClientVariable/Add?\" +\r\n h.serialize({\r\n variableName,\r\n variableKind,\r\n variableScope,\r\n variableSubTypeId,\r\n variableGroupId,\r\n });\r\n fetch(saveUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(() => {\r\n dispatch(decAjaxCount());\r\n dispatch(requestClientVariables());\r\n if (typeof onAddCallback == \"function\") {\r\n onAddCallback();\r\n //onAddCallback(data.id);\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n if (typeof onErrorCallback == \"function\") {\r\n onErrorCallback();\r\n }\r\n h.error(\"Error adding client variable\", error);\r\n });\r\n };\r\n\r\nexport const requestAddClientVariableGrouping =\r\n (name: string, description: string, onAddCallback: () => void, onErrorCallback: () => void) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch(incAjaxCount());\r\n const saveUrl =\r\n \"/ClientVariable/AddGrouping?\" +\r\n h.serialize({\r\n name,\r\n description,\r\n });\r\n fetch(saveUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(() => {\r\n dispatch(decAjaxCount());\r\n dispatch(requestClientVariableGroupings());\r\n if (typeof onAddCallback == \"function\") {\r\n onAddCallback();\r\n //onAddCallback(data.id);\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n if (typeof onErrorCallback == \"function\") {\r\n onErrorCallback();\r\n }\r\n h.error(\"Error adding client variable groupings\", error);\r\n });\r\n };\r\n\r\nexport const updateDestinationOrder =\r\n (currentOrderNumber: number, currentPositionId: number, newOrderNumber: number, previousPositionId: number) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch(incAjaxCount());\r\n dispatch(setloadingListDestinationOrder(true));\r\n const saveUrl =\r\n \"/ClientVariable/UpdateOrder?\" +\r\n h.serialize({\r\n currentOrderNumber,\r\n currentPositionId,\r\n newOrderNumber,\r\n previousPositionId,\r\n });\r\n fetch(saveUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(() => {\r\n dispatch(decAjaxCount());\r\n dispatch(requestClientVariables());\r\n dispatch(setloadingListDestinationOrder(false));\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error updating client variable\", error);\r\n });\r\n };\r\n\r\nexport const flowSetClientVariable =\r\n (flowId: number, variableId: number, variableValue: VariableValueType, isVisible: boolean) =>\r\n (dispatch: Dispatch, getState: GetState): void => {\r\n const state = getState();\r\n\r\n // Look for the flowClientVariables matching\r\n const ccvById = state.flowClientVariables.byId;\r\n let ccvId: string | null = null; // Null if we don't find the flowClientVariableId, otherwise we'll put the found ID here\r\n\r\n const allCcvIds = Object.keys(ccvById);\r\n for (const id of allCcvIds) {\r\n if (ccvById[id].VariableId != variableId || ccvById[id].FlowId != flowId) {\r\n // Not a match\r\n continue;\r\n }\r\n // Found it\r\n ccvId = id;\r\n break;\r\n }\r\n\r\n if (ccvId == null) {\r\n dispatch(newFlowClientVariable(variableId, flowId, variableValue, isVisible));\r\n } else {\r\n const updatesToMake = { VariableValue: variableValue, IsVisible: isVisible };\r\n dispatch(updateMultipleAttribute(\"flowClientVariables\", ccvId, updatesToMake, true));\r\n }\r\n dispatch(updateAttribute(\"flows\", flowId, \"hasUnsavedChanges\", true));\r\n };\r\n\r\nexport const flowItemSetOfferCode =\r\n (flowId: number, flowItemId: number, variableId: number, isVisible: boolean, sortOrder: number | null) =>\r\n (dispatch: Dispatch, getState: GetState): void => {\r\n const state = getState();\r\n // Look for the flowItemOfferCodes matching\r\n const ccvById = state.flowItemOfferCodes.byId;\r\n let ccvId: string | null = null; // Null if we don't find the flowClientVariableId, otherwise we'll put the found ID here\r\n\r\n const allCcvIds = Object.keys(ccvById);\r\n for (const id of allCcvIds) {\r\n if (ccvById[id].VariableId != variableId || ccvById[id].FlowItemId != flowItemId) {\r\n // Not a match\r\n continue;\r\n }\r\n // Found it\r\n ccvId = id;\r\n break;\r\n }\r\n\r\n if (ccvId == null) {\r\n dispatch(newFlowItemOfferCode(flowItemId, variableId, isVisible, sortOrder));\r\n } else {\r\n dispatch(\r\n updateMultipleAttribute(\"flowItemOfferCodes\", ccvId, { IsVisible: isVisible, SortOrder: sortOrder })\r\n );\r\n }\r\n dispatch(updateAttribute(\"flows\", flowId, \"hasUnsavedChanges\", true));\r\n };\r\n\r\nexport const flowItemSetClientVariable =\r\n (flowId: number, flowItemId: number, variableId: number, variableValue: VariableValueType) =>\r\n (dispatch: Dispatch, getState: GetState): void => {\r\n const state = getState();\r\n\r\n // Look for the flowClientVariables matching\r\n const ccvById = state.flowItemClientVariables.byId;\r\n let ccvId: string | null = null; // Null if we don't find the flowItemClientVariableId, otherwise we'll put the found ID here\r\n\r\n const allCcvIds = Object.keys(ccvById);\r\n for (const id of allCcvIds) {\r\n if (\r\n ccvById[id].VariableId != variableId ||\r\n ccvById[id].FlowItemId != flowItemId ||\r\n ccvById[id].FlowId != flowId\r\n ) {\r\n // Not a match\r\n continue;\r\n }\r\n // Found it\r\n ccvId = id;\r\n break;\r\n }\r\n\r\n if (ccvId == null) {\r\n const newId =\r\n Math.min.apply(\r\n null,\r\n allCcvIds.concat([\"0\"]).map(x => parseInt(x))\r\n ) - 1;\r\n dispatch(_flowItemAddClientVariable(newId, flowId, flowItemId, variableId, variableValue));\r\n } else {\r\n dispatch(_flowItemSetClientVariable(parseInt(ccvId), variableValue, flowId, flowItemId));\r\n }\r\n };\r\n\r\nexport const setloadingListDestinationOrder = (loadingListDestinationOrder: boolean): ISetLoadingDestinationOrder => ({\r\n type: \"SET_LOADING_DESTINATION_ORDER\",\r\n loadingListDestinationOrder,\r\n});\r\n\r\nexport const _flowSetClientVariable = (\r\n flowClientVariableId: number,\r\n variableValue: VariableValueType,\r\n flowId: number\r\n): FlowSetClientVariableAction => ({\r\n type: \"FLOW_SET_CLIENT_VARIABLE\",\r\n flowId,\r\n flowClientVariableId,\r\n variableValue,\r\n meta: { doNotBatch: true },\r\n});\r\n\r\nexport const _flowItemSetClientVariable = (\r\n flowItemClientVariableId: number,\r\n variableValue: VariableValueType,\r\n flowId: number,\r\n flowItemId: number\r\n): FlowItemSetClientVariableAction => ({\r\n type: \"FLOW_ITEM_SET_CLIENT_VARIABLE\",\r\n flowId,\r\n flowItemId,\r\n flowItemClientVariableId,\r\n variableValue,\r\n meta: { doNotBatch: true },\r\n});\r\n\r\nexport const _flowAddClientVariable = (\r\n newId: number,\r\n flowId: number,\r\n variableId: number,\r\n variableValue: VariableValueType\r\n): FlowAddClientVariableAction => ({\r\n type: \"FLOW_ADD_CLIENT_VARIABLE\",\r\n newId,\r\n flowId,\r\n variableId,\r\n variableValue,\r\n meta: { doNotBatch: true },\r\n});\r\n\r\nexport const _flowItemAddClientVariable = (\r\n newId: number,\r\n flowId: number,\r\n flowItemId: number,\r\n variableId: number,\r\n variableValue: VariableValueType\r\n): FlowItemAddClientVariableAction => ({\r\n type: \"FLOW_ITEM_ADD_CLIENT_VARIABLE\",\r\n newId,\r\n flowId,\r\n flowItemId,\r\n variableId,\r\n variableValue,\r\n meta: { doNotBatch: true },\r\n});\r\n","import { request } from \"../helpers/httpInterceptor\";\r\nimport h from \"../helpers\";\r\nimport { notifyError, notifyGreen } from \"./notifyActions\";\r\nimport { requestSessionInfo, requestEnabledFeatures } from \"./sessionActions\";\r\nimport { Dispatch } from \"../types/types\";\r\nimport { IAppState } from \"../types/stores/index\";\r\nimport { ICompanyTapadDeliveryType } from \"../types/stores/companyTable\";\r\nimport { ICompanyDestinationDedupeSettings } from \"./../types/stores/companyTable\";\r\nimport { ISingleViewControl, ISVClientKeys } from \"../types/stores/singleView\";\r\nimport { ICompany, ICompanyView } from \"../types/stores/companyTable\";\r\nimport {\r\n ISetCompanyIsSaving,\r\n ISetCompanyIsLoading,\r\n ISetCompanyIsLoadingFolders,\r\n ISetCompanyIsLoadingParentFolders,\r\n ISetCompanyIsLoadingVerticals,\r\n ISetCompanyIsLoadingUsers,\r\n ISetCompanyByIdIsLoading,\r\n ISetCompanyIsLoadingDestinations,\r\n ISetCompanyIsLoadingFeatures,\r\n ISetCompanyIsLoadingSnowflakeSettings,\r\n IDeploySetting,\r\n} from \"../types/actions/companies\";\r\nimport {\r\n SAVING_COMPANY_DETAILS,\r\n LOADING_COMPANY_DETAILS,\r\n LOADING_COMPANY_FOLDERS,\r\n LOADING_COMPANY_PARENT_FOLDERS,\r\n LOADING_COMPANY_VERTICALS,\r\n LOADING_COMPANY_DESTINATIONS,\r\n LOADING_COMPANY_USERS,\r\n LOADING_COMPANY_BY_ID,\r\n LOADING_COMPANY_FEATURES,\r\n LOADING_COMPANY_ACTIVATION_SCHEDULES,\r\n SET_COMPANY_DETAILS,\r\n SET_COMPANY_CREATED_DATE,\r\n SET_COMPANY_UPDATED_DATE,\r\n SET_COMPANY_SV_CLIENT_KEYS,\r\n SET_COMPANY_SV_TABLES,\r\n SET_COMPANY_SV_CONTROL,\r\n SET_COMPANY_FOLDER_EXIST,\r\n SET_COMPANY_TAPAD_DELIVERY_TYPES,\r\n SET_COMPANY_DESTINATION_DEDUPE_SETTINGS,\r\n SET_COMPANY_VERTICALS,\r\n SET_COMPANY_DESTINATIONS,\r\n SET_SELECTED_COMPANY,\r\n SET_COMPANY_PDF_CONTENT,\r\n SET_COMPANY_PDF_FILENAME,\r\n SET_COMPANY_USERS,\r\n SET_COMPANY_BY_ID,\r\n SET_COMPANY_CURRENT_VERTICAL,\r\n SET_COMPANY_RESTRICTED_USERNAME,\r\n SET_COMPANY_RESTRICTED_PASSWORD,\r\n SET_COMPANY_SNOWFLAKE_SETTINGS,\r\n SET_DEPLOY_SETTINGS,\r\n SET_FLOW_CONTROL_DEPLOY_SETTINGS,\r\n LOADING_COMPANY_SNOWFLAKE_SETTINGS,\r\n SET_NOT_ALLOWED_DEPLOY_SNOWFLAKE_TABLES,\r\n} from \"../reducers/companies\";\r\n\r\nimport {\r\n SET_TAPAD_DELIVERY_TYPES,\r\n SET_DESTINATION_DEDUPE_SETTINGS,\r\n SET_ACTIVATION_DESTINATION_SCHEDULES,\r\n} from \"../reducers/vars\";\r\nimport { ISnowflakeSettings } from \"../types/stores/snowflakeSettings\";\r\nimport { ISetCompanyIsLoadingActivationSchedules } from \"../types/actions/companies\";\r\nimport { ISchedule } from \"../types/stores/schedules\";\r\nimport { requestFieldVisibilityTypesDefault } from \"./adminDesignerActions\";\r\nimport { GetCompanyFeatures } from \"./featuresActions\";\r\nimport { HangfireJobStatus } from \"../enums/hangfireJobStatus\";\r\n\r\nconst formatDate = (dateArg: string): string | undefined => {\r\n if (dateArg != null) {\r\n let MyDateStringValue = dateArg;\r\n let value = new Date(parseInt(MyDateStringValue.replace(/(^.*\\()|([+-].*$)/g, \"\")));\r\n let year = value.getFullYear();\r\n let month = value.getMonth() + 1;\r\n let date = value.getDate();\r\n let minutes = value.getMinutes() == 0 ? \"00\" : value.getMinutes();\r\n let hours = value.getHours();\r\n let formattedDate = `${year}/${month}/${date} ${hours}:${minutes}`;\r\n return formattedDate;\r\n }\r\n};\r\n\r\nexport const SetCompanyIsSaving = (newValue: boolean): ISetCompanyIsSaving => ({\r\n type: SAVING_COMPANY_DETAILS,\r\n isSaving: newValue,\r\n});\r\n\r\nexport const SetCompanyIsLoading = (newValue: boolean): ISetCompanyIsLoading => ({\r\n type: LOADING_COMPANY_DETAILS,\r\n isLoading: newValue,\r\n});\r\n\r\nexport const SetCompanyIsLoadingFolders = (newValue: boolean): ISetCompanyIsLoadingFolders => ({\r\n type: LOADING_COMPANY_FOLDERS,\r\n isLoadingFolders: newValue,\r\n});\r\n\r\nexport const SetCompanyIsLoadingParentFolders = (newValue: boolean): ISetCompanyIsLoadingParentFolders => ({\r\n type: LOADING_COMPANY_PARENT_FOLDERS,\r\n isLoadingParentFolders: newValue,\r\n});\r\n\r\nexport const SetCompanyIsLoadingVerticals = (newValue: boolean): ISetCompanyIsLoadingVerticals => ({\r\n type: LOADING_COMPANY_VERTICALS,\r\n isLoadingVerticals: newValue,\r\n});\r\n\r\nexport const SetCompanyIsLoadingUsers = (newValue: boolean): ISetCompanyIsLoadingUsers => ({\r\n type: LOADING_COMPANY_USERS,\r\n isLoadingUsers: newValue,\r\n});\r\n\r\nexport const SetCompanyByIdIsLoading = (newValue: boolean): ISetCompanyByIdIsLoading => ({\r\n type: LOADING_COMPANY_BY_ID,\r\n isLoadingCompanyById: newValue,\r\n});\r\n\r\nexport const SetCompanyIsLoadingDestinations = (newValue: boolean): ISetCompanyIsLoadingDestinations => ({\r\n type: LOADING_COMPANY_DESTINATIONS,\r\n isLoadingDestinations: newValue,\r\n});\r\n\r\nexport const SetCompanyIsLoadingFeatures = (newValue: boolean): ISetCompanyIsLoadingFeatures => ({\r\n type: LOADING_COMPANY_FEATURES,\r\n isLoadingFeatures: newValue,\r\n});\r\n\r\nexport const SetCompanyIsLoadingSnowflakeSettings = (newValue: boolean): ISetCompanyIsLoadingSnowflakeSettings => ({\r\n type: LOADING_COMPANY_SNOWFLAKE_SETTINGS,\r\n isLoadingSnowflakeSettings: newValue,\r\n});\r\n\r\nexport const SetCompanyIsLoadingActivationSchedules = (newValue: boolean): ISetCompanyIsLoadingActivationSchedules => ({\r\n type: LOADING_COMPANY_ACTIVATION_SCHEDULES,\r\n isLoadingActivationSchedules: newValue,\r\n});\r\n\r\nexport const SetCompanyDetails =\r\n (newCompanyDetails: ICompanyView) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch({\r\n type: SET_COMPANY_DETAILS,\r\n company: newCompanyDetails,\r\n });\r\n };\r\n\r\nexport const SetNewCompanyPdf =\r\n (newCompanyPdf: File) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch({\r\n type: SET_COMPANY_PDF_CONTENT,\r\n pdfContent: newCompanyPdf,\r\n });\r\n dispatch({\r\n type: SET_COMPANY_PDF_FILENAME,\r\n pdfFileName: newCompanyPdf.name,\r\n });\r\n };\r\n\r\nexport const SetSelectedCompany =\r\n (newSelectedCompany: number) =>\r\n (dispatch: Dispatch, getState: () => IAppState): void => {\r\n const state = getState();\r\n const currentSelectedCompany = state.companyEdit.selectedCompany\r\n ? parseInt(state.companyEdit.selectedCompany)\r\n : null;\r\n\r\n if (currentSelectedCompany !== newSelectedCompany) {\r\n dispatch({\r\n type: SET_SELECTED_COMPANY,\r\n selectedCompany: newSelectedCompany,\r\n });\r\n }\r\n };\r\n\r\nexport const SetCompanySingleViewControlSettings =\r\n (svControl: ISingleViewControl) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch({\r\n type: SET_COMPANY_SV_CONTROL,\r\n svControl,\r\n });\r\n };\r\n\r\nexport const SetCompanySingleViewClientKeys =\r\n (clientKeys: Array) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch({\r\n type: SET_COMPANY_SV_CLIENT_KEYS,\r\n svClientKeys: clientKeys,\r\n });\r\n };\r\n\r\nexport const SetCompanyCurrentVertical =\r\n (newVertical: number) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch({\r\n type: SET_COMPANY_CURRENT_VERTICAL,\r\n currentVertical: newVertical,\r\n });\r\n };\r\n\r\nexport const SetCompanyRestrictedUsername =\r\n (restrictedUsername: string) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch({\r\n type: SET_COMPANY_RESTRICTED_USERNAME,\r\n restrictedUsername,\r\n });\r\n };\r\n\r\nexport const SetCompanyRestrictedPassword =\r\n (restrictedPassword: string) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch({\r\n type: SET_COMPANY_RESTRICTED_PASSWORD,\r\n restrictedPassword,\r\n });\r\n };\r\n\r\nexport const SetCompanyTapadDeliveryTypes =\r\n (tapadDeliveryTypes: ICompanyTapadDeliveryType[]) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch({\r\n type: SET_COMPANY_TAPAD_DELIVERY_TYPES,\r\n tapadDeliveryTypes,\r\n });\r\n };\r\n\r\nexport const SetActivationDestinationSchedules =\r\n (activationDestinationSchedules: ISchedule[]) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch({\r\n type: SET_ACTIVATION_DESTINATION_SCHEDULES,\r\n activationDestinationSchedules,\r\n });\r\n };\r\n\r\nexport const SetCompanyDestinationDedupeSettings =\r\n (destinationDedupeSettings: ICompanyDestinationDedupeSettings[]) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch({\r\n type: SET_COMPANY_DESTINATION_DEDUPE_SETTINGS,\r\n destinationDedupeSettings,\r\n });\r\n };\r\n\r\nexport const SetCompanySnowflakeSettings =\r\n (snowflakeSettings: Array) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch({\r\n type: SET_COMPANY_SNOWFLAKE_SETTINGS,\r\n snowflakeSettings,\r\n });\r\n };\r\n\r\nexport const SetDeploySettings =\r\n (deploySettings: Array) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch({\r\n type: SET_DEPLOY_SETTINGS,\r\n deploySettings,\r\n });\r\n };\r\n\r\nexport const SetFlowControlDeploySettings =\r\n (flowControlDeploySettings: Array) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch({\r\n type: SET_FLOW_CONTROL_DEPLOY_SETTINGS,\r\n flowControlDeploySettings,\r\n });\r\n };\r\n\r\nexport const SaveCompanyDetails =\r\n (company: ICompany, currentVertical: number) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch(SetCompanyIsSaving(true));\r\n //This should be improve later\r\n company.DataProviderPDF = null;\r\n request(\r\n \"/Companies/EditCompanyDetailsSave\",\r\n {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n headers: { \"Content-Type\": \"application/json\" },\r\n body: JSON.stringify({ company, CompanyVertical: currentVertical }),\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(requestFieldVisibilityTypesDefault());\r\n\r\n const response = data as unknown as { success: boolean; hangfireJobStatus: HangfireJobStatus };\r\n dispatch(SetCompanyIsSaving(false));\r\n if (response.success) {\r\n if (response.hangfireJobStatus == HangfireJobStatus.Submitted) {\r\n dispatch(\r\n notifyGreen(\r\n \"Company details were saved successfully. Job submitted to update the destination visibility for all companies.\"\r\n )\r\n );\r\n } else if (response.hangfireJobStatus == HangfireJobStatus.ErrorOnSubmission) {\r\n dispatch(\r\n notifyGreen(\r\n \"Company details were saved successfully. There was an error submitting the job to change the destination visibility, try again or contact Support.\"\r\n )\r\n );\r\n } else {\r\n dispatch(notifyGreen(\"Company details were saved successfully.\"));\r\n }\r\n dispatch(requestSessionInfo());\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(SetCompanyIsSaving(false));\r\n\r\n h.error(\"Error saving company details\", error);\r\n });\r\n };\r\n\r\nexport const SaveCompanyPDF =\r\n (companyId: number, pdfContent: File) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch(SetCompanyIsSaving(true));\r\n let token = \"\";\r\n if (document.getElementsByName(\"__RequestVerificationToken\").length > 0) {\r\n token = (document.getElementsByName(\"__RequestVerificationToken\")[0] as HTMLInputElement).value;\r\n }\r\n\r\n let pdfData = new FormData();\r\n pdfData.append(\"PDF\", pdfContent);\r\n pdfData.append(\"CompanyId\", companyId.toString());\r\n pdfData.append(\"__RequestVerificationToken\", token);\r\n\r\n request(\r\n \"/Companies/UploadCompanyPDF\",\r\n {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n body: pdfData,\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const response = data as unknown as { success: boolean };\r\n dispatch(SetCompanyIsSaving(false));\r\n if (response.success) {\r\n dispatch(notifyGreen(\"Company PDF updated successfully.\"));\r\n dispatch({\r\n type: SET_COMPANY_PDF_FILENAME,\r\n pdfFileName: \"\",\r\n });\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(SetCompanyIsSaving(false));\r\n h.error(\"Error uploading content.\", error);\r\n });\r\n };\r\n\r\nexport const SaveCompanySingleView =\r\n (newSingleViewControl: ISingleViewControl) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch(SetCompanyIsSaving(true));\r\n request(\r\n \"/Companies/SaveSVTable\",\r\n {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n headers: { \"Content-Type\": \"application/json\" },\r\n body: JSON.stringify(newSingleViewControl),\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const response = data as unknown as { success: boolean };\r\n dispatch(SetCompanyIsSaving(false));\r\n if (response.success) {\r\n dispatch(notifyGreen(\"SingleView changes saved successfully.\"));\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(SetCompanyIsSaving(false));\r\n h.error(\"Error saving SingleView changes\", error);\r\n });\r\n };\r\n\r\nexport const DeleteCompany =\r\n (companyId: number, companyName: string) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch(SetCompanyIsSaving(true));\r\n\r\n request(\r\n `/Companies/DeleteWholeCompany?companyId=${companyId}&companyName=${companyName}`,\r\n {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(SetCompanyIsSaving(false));\r\n if (data.success) {\r\n dispatch(notifyGreen(\"Company deleted successfully.\"));\r\n window.location.assign(\"/ae/admin/companies\");\r\n } else {\r\n dispatch(notifyError(data.message));\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(SetCompanyIsSaving(false));\r\n\r\n h.error(\"Error deleting company\", error);\r\n window.location.assign(\"/ae/admin/companies\");\r\n });\r\n };\r\n\r\nexport const GetCompanyUsers =\r\n (companyId: number) =>\r\n (dispatch: Dispatch): Promise => {\r\n dispatch(SetCompanyIsLoadingUsers(true));\r\n\r\n return request(\r\n `/Companies/${companyId}/Users`,\r\n {\r\n credentials: \"same-origin\",\r\n method: \"GET\",\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(SetCompanyIsLoadingUsers(false));\r\n if (data && data.users) {\r\n dispatch({\r\n type: SET_COMPANY_USERS,\r\n companyUsers: data.users,\r\n });\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(SetCompanyIsLoadingUsers(false));\r\n\r\n h.error(\"Error getting company users.\", error);\r\n });\r\n };\r\n\r\nexport const GetCompanyById =\r\n (companyId: number) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch(SetCompanyByIdIsLoading(true));\r\n\r\n request(\r\n `/Companies/${companyId}/Details`,\r\n {\r\n credentials: \"same-origin\",\r\n method: \"GET\",\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const response = data as unknown as { company: ICompanyView };\r\n if (response && response.company) {\r\n dispatch({\r\n type: SET_COMPANY_BY_ID,\r\n companyById: response.company,\r\n });\r\n }\r\n dispatch(SetCompanyByIdIsLoading(false));\r\n })\r\n .catch(error => {\r\n dispatch(SetCompanyByIdIsLoading(false));\r\n\r\n h.error(\"Error getting company users.\", error);\r\n });\r\n };\r\n\r\nexport const GetDeploySettings =\r\n (isFlowControl = false) =>\r\n (dispatch: Dispatch): Promise =>\r\n request(\r\n `/Companies/GetDeploySettings?isFlowControl=${isFlowControl}`,\r\n {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then((data: { deploySettings: Array }) => {\r\n dispatch(SetCompanyIsLoading(false));\r\n if (data.deploySettings) {\r\n if (isFlowControl) {\r\n dispatch(SetFlowControlDeploySettings(data.deploySettings));\r\n } else {\r\n dispatch(SetDeploySettings(data.deploySettings));\r\n }\r\n }\r\n })\r\n .catch((error: any) => {\r\n dispatch(SetCompanyIsLoading(false));\r\n h.error(`Error getting ${isFlowControl ? \"flow control\" : \"\"} deploy settings`, error);\r\n });\r\n\r\nexport const GetCurrentCompanyDetails =\r\n (companyId: number) =>\r\n (dispatch: Dispatch): Promise => {\r\n dispatch(SetCompanyIsLoading(true));\r\n\r\n return request(\r\n `/Companies/GetCompanyValuesEdit?id=${companyId}`,\r\n {\r\n credentials: \"same-origin\",\r\n method: \"GET\",\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(SetCompanyIsLoading(false));\r\n if (data && data.model && data.model.Company) {\r\n dispatch({\r\n type: SET_COMPANY_DETAILS,\r\n company: {\r\n ...data.model.Company,\r\n UpdatedBy: data.model.UpdatedBy,\r\n CreatedBy: data.model.CreatedBy,\r\n IsAdmin: data.model.IsAdmin,\r\n DatabaseEnvironmentId: data.model.DatabaseEnvironmentId,\r\n },\r\n });\r\n dispatch({\r\n type: SET_COMPANY_CREATED_DATE,\r\n companyCreateDate: formatDate(data.model.Company.CompanyDateCreated),\r\n });\r\n dispatch({\r\n type: SET_COMPANY_UPDATED_DATE,\r\n companyUpdateDate: formatDate(data.model.Company.CompanyDateUpdated),\r\n });\r\n }\r\n\r\n if (data && data.model) {\r\n dispatch({\r\n type: SET_COMPANY_SV_CLIENT_KEYS,\r\n svClientKeys: data.model.SVClientKeys,\r\n });\r\n dispatch({\r\n type: SET_COMPANY_SV_TABLES,\r\n svTables: data.model.SVTables,\r\n });\r\n dispatch({\r\n type: SET_COMPANY_SV_CONTROL,\r\n svControl: data.model.SingleViewControl,\r\n });\r\n }\r\n\r\n dispatch(GetDeploySettings());\r\n })\r\n .catch(error => {\r\n dispatch(SetCompanyIsLoading(false));\r\n\r\n h.error(\"Error getting company details.\", error);\r\n });\r\n };\r\n\r\nexport const GetAvailableFolders =\r\n (companyId: number) =>\r\n (dispatch: Dispatch): Promise => {\r\n dispatch(SetCompanyIsLoadingFolders(true));\r\n\r\n return request(\r\n `/Company/GetAvailableFolder?companyId=${companyId}`,\r\n {\r\n credentials: \"same-origin\",\r\n method: \"GET\",\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(SetCompanyIsLoadingFolders(false));\r\n\r\n if (data.folderExist) {\r\n dispatch({\r\n type: SET_COMPANY_FOLDER_EXIST,\r\n doesFolderExist: true,\r\n });\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(SetCompanyIsLoadingFolders(false));\r\n h.error(\"Error getting available company folders\", error);\r\n });\r\n };\r\n\r\nexport const GetTapadDeliveryTemplates =\r\n (companyId: number, isEditCompany?: boolean) =>\r\n (dispatch: Dispatch): Promise => {\r\n dispatch(SetCompanyIsLoadingVerticals(true));\r\n\r\n return request(\r\n `/Companies/GetTapadDeliveryTemplates?companyId=${companyId}`,\r\n {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then((data: { tapadDeliveryTypes: any }) => {\r\n dispatch(SetCompanyIsLoadingVerticals(false));\r\n if (data.tapadDeliveryTypes) {\r\n let type = SET_TAPAD_DELIVERY_TYPES;\r\n\r\n if (isEditCompany) {\r\n type = SET_COMPANY_TAPAD_DELIVERY_TYPES;\r\n }\r\n\r\n dispatch({\r\n type,\r\n tapadDeliveryTypes: data.tapadDeliveryTypes,\r\n });\r\n }\r\n })\r\n .catch((error: any) => {\r\n dispatch(SetCompanyIsLoadingVerticals(false));\r\n h.error(\"Error getting available delivery types\", error);\r\n });\r\n };\r\n\r\nexport const GetActivationDestinationSchedules =\r\n (destinationId: number, flowId: number) =>\r\n (dispatch: Dispatch): Promise =>\r\n request(\r\n `/Schedule/GetActivationDestinationSchedules?destinationId=${destinationId}&flowId=${flowId}`,\r\n {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n let response = data as unknown as Array;\r\n if (response) {\r\n dispatch(SetActivationDestinationSchedules(response));\r\n }\r\n })\r\n .catch((error: any) => {\r\n h.error(\"Error getting activation destination schedules\", error);\r\n });\r\n\r\nexport const GetDestinationDedupeSettings =\r\n (companyId: number, isEditCompany?: boolean) =>\r\n (dispatch: Dispatch): Promise => {\r\n dispatch(SetCompanyIsLoadingVerticals(true));\r\n\r\n return request(\r\n `/Companies/GetDestinationDedupeSettings?companyId=${companyId}`,\r\n {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then((data: { destinationDedupeSettings: any }) => {\r\n dispatch(SetCompanyIsLoadingVerticals(false));\r\n if (data.destinationDedupeSettings) {\r\n let type = SET_DESTINATION_DEDUPE_SETTINGS;\r\n if (isEditCompany) {\r\n type = SET_COMPANY_DESTINATION_DEDUPE_SETTINGS;\r\n }\r\n\r\n dispatch({\r\n type,\r\n destinationDedupeSettings: data.destinationDedupeSettings,\r\n });\r\n }\r\n })\r\n .catch((error: any) => {\r\n dispatch(SetCompanyIsLoadingVerticals(false));\r\n h.error(\"Error getting destination dedupe settings\", error);\r\n });\r\n };\r\n\r\nexport const GetAvailableVerticals =\r\n (companyId: number) =>\r\n (dispatch: Dispatch): Promise => {\r\n dispatch(SetCompanyIsLoadingVerticals(true));\r\n\r\n return request(\r\n `/Companies/GetAvailableVerticals?companyId=${companyId}`,\r\n {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(SetCompanyIsLoadingVerticals(false));\r\n\r\n if (data.verticals) {\r\n dispatch({\r\n type: SET_COMPANY_VERTICALS,\r\n verticals: data.verticals,\r\n });\r\n\r\n if (data.currentVertical >= 0) {\r\n dispatch({\r\n type: SET_COMPANY_CURRENT_VERTICAL,\r\n currentVertical: data.currentVertical,\r\n });\r\n }\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(SetCompanyIsLoadingVerticals(false));\r\n h.error(\"Error getting available verticals\", error);\r\n });\r\n };\r\n\r\nexport const GetInstructionDestinations =\r\n (companyId: number) =>\r\n (dispatch: Dispatch): Promise => {\r\n dispatch(SetCompanyIsLoadingDestinations(true));\r\n\r\n return request(\r\n `/Companies/GetInstructionDestinations?companyId=${companyId}`,\r\n {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(SetCompanyIsLoadingDestinations(false));\r\n if (data.destinations) {\r\n dispatch({\r\n type: SET_COMPANY_DESTINATIONS,\r\n destinations: data.destinations,\r\n });\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(SetCompanyIsLoadingDestinations(false));\r\n h.error(\"Error getting company instruction destinations\", error);\r\n });\r\n };\r\n\r\nexport const GetSnowflakeSettings =\r\n (companyId: number) =>\r\n (dispatch: Dispatch): Promise => {\r\n dispatch(SetCompanyIsLoadingSnowflakeSettings(true));\r\n\r\n return request(\r\n `/Companies/GetSnowflakeSettings?companyId=${companyId}`,\r\n {\r\n method: \"GET\",\r\n credentials: \"same-origin\",\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then((data: { snowflakeSettings: any }) => {\r\n dispatch(SetCompanyIsLoadingSnowflakeSettings(false));\r\n if (data.snowflakeSettings) {\r\n dispatch({\r\n type: SET_COMPANY_SNOWFLAKE_SETTINGS,\r\n snowflakeSettings: data.snowflakeSettings,\r\n });\r\n }\r\n })\r\n .catch((error: any) => {\r\n dispatch(SetCompanyIsLoadingSnowflakeSettings(false));\r\n h.error(\"Error getting Snowflake settings\", error);\r\n });\r\n };\r\n\r\nexport const GetNotAllowedDeploySnowflakeTables =\r\n () =>\r\n (dispatch: Dispatch): Promise =>\r\n request(\r\n `/Companies/GetNotAllowedDeploySnowflakeTables`,\r\n {\r\n method: \"GET\",\r\n credentials: \"same-origin\",\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then((data: { notAllowedDeploySnowflakeTables: any }) => {\r\n if (data.notAllowedDeploySnowflakeTables) {\r\n dispatch({\r\n type: SET_NOT_ALLOWED_DEPLOY_SNOWFLAKE_TABLES,\r\n notAllowedDeploySnowflakeTables: data.notAllowedDeploySnowflakeTables,\r\n });\r\n }\r\n })\r\n .catch((error: any) => {\r\n h.error(\"Error getting not allowed deploy Snowflake tables\", error);\r\n });\r\n\r\nexport const SaveCompanyFeatures =\r\n (company: number = 0, copyFeaturesType: number = 0, isFromCopyFeatures: boolean = false) =>\r\n (dispatch: Dispatch, getState: () => IAppState): Promise => {\r\n const state = getState();\r\n const features = state.features.companyNewSelectedFeatures;\r\n\r\n return request(\r\n \"/Companies/FeaturesCurrCompany\",\r\n {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: { Accept: \"application/json\", \"Content-Type\": \"application/json\" },\r\n body: JSON.stringify({ features, company, copyFeaturesType }),\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(() => {\r\n dispatch(requestEnabledFeatures());\r\n dispatch(notifyGreen(\"Features saved successfully.\"));\r\n\r\n if (!isFromCopyFeatures) {\r\n dispatch(GetCompanyFeatures());\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error updating features.\", error);\r\n });\r\n };\r\n\r\nexport const GetCompanyRestrictedUser =\r\n (companyId: number) =>\r\n (dispatch: Dispatch): void => {\r\n fetch(`/api/companyrestricteduser/get/${companyId}`, {\r\n credentials: \"same-origin\",\r\n method: \"GET\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const response = data as unknown as { success: boolean; restrictedUserName: string };\r\n if (response) {\r\n if (response.success) {\r\n dispatch(SetCompanyRestrictedUsername(response.restrictedUserName));\r\n } else {\r\n h.error(\"Error getting restricted user information.\");\r\n }\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error getting restricted user information.\", error);\r\n });\r\n };\r\n\r\nexport const SaveCompanyRestrictedUser =\r\n (companyId: number, username: string, password: string) =>\r\n (dispatch: Dispatch): void => {\r\n if (!username || !password) {\r\n return;\r\n }\r\n\r\n let token = \"\";\r\n\r\n if (document.getElementsByName(\"__RequestVerificationToken\").length > 0) {\r\n token = (document.getElementsByName(\"__RequestVerificationToken\")[0] as HTMLInputElement).value;\r\n }\r\n\r\n fetch(\"/api/companyrestricteduser/save\", {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n headers: {\r\n \"Content-Type\": \"application/json\",\r\n Accept: \"application/json\",\r\n __RequestVerificationToken: token,\r\n },\r\n body: JSON.stringify({ companyId, username, password }),\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const response = data as unknown as { success: boolean };\r\n if (response) {\r\n if (response.success) {\r\n dispatch(notifyGreen(\"Restricted User saved successfully.\"));\r\n } else {\r\n h.error(\"Error updating restricted user information.\");\r\n }\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error updating restricted user information.\", error);\r\n });\r\n };\r\n","import h from \"../helpers\";\r\nimport { Dispatch } from \"redux\";\r\nimport { request } from \"../helpers/httpInterceptor\";\r\nimport { debounce } from \"lodash\";\r\nimport { IFileMasterLogEntry } from \"../types/stores/fileImportQueue\";\r\nimport { IModelEntry, IStatusEntry } from \"../types/stores/dashboardWidgets\";\r\nimport { GET_USER_COMPANY_RUNNING_FLOWS_STATUS } from \"../reducers/dashboardWidgets\";\r\nimport {\r\n UPDATING_WIDGETS,\r\n GET_USER_WIDGETS,\r\n TOGGLE_WIDGET,\r\n MOVE_WIDGET,\r\n GET_USER_COMPANY_FLOWS_STATUS,\r\n GET_USER_COMPANY_SCHEDULE_STATUS,\r\n GET_RECENT_FLOWS,\r\n GET_FILE_MASTER_LOG,\r\n GET_MODELS,\r\n REMOVE_USER_COMPANY_FLOWS_STATUS,\r\n GET_USER_COMPANY_COMPLETED_FLOWS_STATUS,\r\n} from \"../reducers/dashboardWidgets\";\r\nimport { FILES_WAITING_UPLOAD, GET_IMPORTS } from \"../actions/fileImportActions\";\r\nimport { GetState } from \"../types/types\";\r\nimport { incAjaxCount, decAjaxCount } from \"./actionCreators\";\r\n\r\nif (top && !top.RDX) {\r\n top.RDX = {};\r\n}\r\n\r\nexport const getUserWidgets =\r\n () =>\r\n (dispatch: Dispatch): Promise => {\r\n dispatch({ type: UPDATING_WIDGETS });\r\n return request(\"/Widget/GetWidgets\", { credentials: \"same-origin\" }, dispatch)\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch({\r\n type: GET_USER_WIDGETS,\r\n widgets: data,\r\n });\r\n })\r\n .catch(error => {\r\n h.error(\"Error getting Widgets.\", error);\r\n dispatch({\r\n type: GET_USER_WIDGETS,\r\n widgets: [],\r\n });\r\n });\r\n };\r\n\r\ntop!.RDX.getFileMasterLog = () => dispatchGetFileMasterLog(top!.store.dispatch);\r\n\r\nconst dispatchGetFileMasterLog = debounce(dispatch => {\r\n dispatch(getFileMasterLog(false));\r\n}, 2000);\r\n\r\nexport const getFileMasterLog =\r\n (isSetLoading = true, guid: string = \"\") =>\r\n (dispatch: Dispatch, getState: GetState): Promise => {\r\n dispatch(incAjaxCount());\r\n\r\n if (isSetLoading) {\r\n dispatch({ type: GET_FILE_MASTER_LOG, loading: true });\r\n }\r\n\r\n return fetch(`/FileImport/GetFileMasterLog${guid != \"\" ? \"?guid=\" + guid : \"\"}`, {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const result = data as unknown as { files: Array };\r\n dispatch({\r\n type: GET_FILE_MASTER_LOG,\r\n fileMasterLog: result.files,\r\n loading: false,\r\n });\r\n\r\n // Add or remove files from waiting upload list to know when get Existing Import list again\r\n // So, trigger Existing Import list getting when there isn't any file pending to upload\r\n const state = getState();\r\n const currentFilesWaitingUpload = state.fileImport.filesWaitingUpload || [];\r\n if (currentFilesWaitingUpload.length > 0) {\r\n const newFilesWaitingUpload = new Array();\r\n\r\n currentFilesWaitingUpload.forEach(file => {\r\n if (\r\n result.files.some(\r\n x => x.FolderName == file && Number.parseInt(x.PercentComplete?.toString() ?? \"\") < 100\r\n )\r\n ) {\r\n newFilesWaitingUpload.push(file);\r\n }\r\n });\r\n\r\n dispatch({\r\n type: FILES_WAITING_UPLOAD,\r\n filesWaitingUpload: newFilesWaitingUpload,\r\n });\r\n\r\n if (newFilesWaitingUpload.length == 0) {\r\n dispatch({ type: GET_IMPORTS, files: {} });\r\n }\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading FileMasterLog.\", error);\r\n dispatch({\r\n type: GET_FILE_MASTER_LOG,\r\n fileMasterLog: [],\r\n loading: false,\r\n });\r\n })\r\n .finally(() => {\r\n dispatch(decAjaxCount());\r\n });\r\n };\r\n\r\ninterface IModelContainer {\r\n Models: Array;\r\n StatusResults: Array;\r\n}\r\n\r\nexport const getModels =\r\n () =>\r\n (dispatch: Dispatch): Promise => {\r\n dispatch({ type: GET_MODELS, loading: true });\r\n return fetch(\"/AudienceModel/GetModels\", { credentials: \"same-origin\", method: \"POST\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const result = data as unknown as { modelContainer?: IModelContainer };\r\n if (result.modelContainer) {\r\n dispatch({\r\n type: GET_MODELS,\r\n models: result.modelContainer.Models,\r\n statuses: result.modelContainer.StatusResults,\r\n loading: false,\r\n });\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error getting Models.\", error);\r\n dispatch({\r\n type: GET_MODELS,\r\n models: [],\r\n statuses: [],\r\n loading: false,\r\n });\r\n });\r\n };\r\n\r\nexport const removeUserCompanyFlowsStatus =\r\n (flowIdToRemove: number) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch({ type: REMOVE_USER_COMPANY_FLOWS_STATUS, flowIdToRemove });\r\n };\r\n\r\nexport const getUserCompanyFlowsStatus =\r\n () =>\r\n (dispatch: Dispatch): Promise => {\r\n dispatch({ type: GET_USER_COMPANY_FLOWS_STATUS, loading: true });\r\n return request(\"/Widget/GetUserCompanyFlowsStatus\", { credentials: \"same-origin\" }, dispatch)\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch({\r\n type: GET_USER_COMPANY_FLOWS_STATUS,\r\n runningFlows: data.runningFlows || [],\r\n completedFlows: data.completedFlows || [],\r\n loading: false,\r\n });\r\n })\r\n .catch(error => {\r\n dispatch({\r\n type: GET_USER_COMPANY_FLOWS_STATUS,\r\n runningFlows: [],\r\n completedFlows: [],\r\n loading: false,\r\n });\r\n h.error(\"Error getting User Company Flows.\", error);\r\n });\r\n };\r\n\r\nexport const getUserCompanyRunningFlowsStatus =\r\n () =>\r\n (dispatch: Dispatch): Promise => {\r\n dispatch({ type: GET_USER_COMPANY_RUNNING_FLOWS_STATUS, loading: true });\r\n return request(\"/Widget/GetUserCompanyRunningFlowsStatus\", { credentials: \"same-origin\" }, dispatch)\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch({\r\n type: GET_USER_COMPANY_RUNNING_FLOWS_STATUS,\r\n runningFlows: data.runningFlows || [],\r\n loading: false,\r\n });\r\n })\r\n .catch(error => {\r\n dispatch({\r\n type: GET_USER_COMPANY_RUNNING_FLOWS_STATUS,\r\n runningFlows: [],\r\n loading: false,\r\n });\r\n h.error(\"Error getting User Company Running Flows.\", error);\r\n });\r\n };\r\n\r\nexport const getUserCompanyCompletedFlowsStatus =\r\n (start: string, stop: string, daysAgo: number, year: number) =>\r\n (dispatch: Dispatch): Promise =>\r\n request(\r\n \"/Widget/GetUserCompanyCompletedFlowsStatus\",\r\n {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json\",\r\n },\r\n body: JSON.stringify({\r\n start,\r\n stop,\r\n daysAgo,\r\n year,\r\n }),\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch({\r\n type: GET_USER_COMPANY_COMPLETED_FLOWS_STATUS,\r\n completedFlows: data || [],\r\n loading: false,\r\n });\r\n })\r\n .catch(error => {\r\n dispatch({\r\n type: GET_USER_COMPANY_COMPLETED_FLOWS_STATUS,\r\n completedFlows: [],\r\n loading: false,\r\n });\r\n h.error(\"Error getting User Company Completed Flows.\", error);\r\n });\r\n\r\nexport const getUserCompanyScheduleStatus =\r\n () =>\r\n (dispatch: Dispatch): Promise =>\r\n request(\"/Widget/GetUserCompanyScheduleStatus\", { credentials: \"same-origin\" }, dispatch)\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data.success) {\r\n dispatch({\r\n type: GET_USER_COMPANY_SCHEDULE_STATUS,\r\n scheduleStatus: data.schedules || [],\r\n loading: false,\r\n });\r\n } else {\r\n dispatch({ type: GET_USER_COMPANY_SCHEDULE_STATUS, loading: false });\r\n h.error(\"Error getting User Company Schedules.\");\r\n }\r\n })\r\n .catch(error => {\r\n dispatch({ type: GET_USER_COMPANY_SCHEDULE_STATUS, loading: false });\r\n h.error(\"Error getting User Company Schedules.\", error);\r\n });\r\n\r\nexport const getRecentFlows =\r\n () =>\r\n (dispatch: Dispatch): Promise => {\r\n dispatch({ type: GET_RECENT_FLOWS, loading: true });\r\n return fetch(\"/Widget/GetRecentFlows\", { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch({\r\n type: GET_RECENT_FLOWS,\r\n recentFlows: data,\r\n loading: false,\r\n });\r\n })\r\n .catch(error => {\r\n h.error(\"Error getting Recent Flows.\", error);\r\n dispatch({\r\n type: GET_RECENT_FLOWS,\r\n recentFlows: [],\r\n loading: false,\r\n });\r\n });\r\n };\r\n\r\n// When a widget is toggled on or off, the toggle is saved (if on) or removed (if off) from the database\r\nexport const toggleWidget =\r\n (WidgetName: string, WidgetIsVisible: boolean) =>\r\n (dispatch: Dispatch): Promise => {\r\n dispatch({ type: UPDATING_WIDGETS });\r\n return request(\r\n \"/Widget/SaveWidget\",\r\n {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n body: JSON.stringify({\r\n WidgetName,\r\n WidgetIsVisible,\r\n }),\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (!data.result) {\r\n throw new Error(\"Error saving widget toggle.\");\r\n } else {\r\n dispatch({\r\n type: TOGGLE_WIDGET,\r\n WidgetName,\r\n WidgetIsVisible,\r\n });\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error saving widget toggle.\", error);\r\n });\r\n };\r\n\r\n//Save the widget index/position on the dashboard\r\nexport const moveWidget =\r\n (WidgetName: string, WidgetIndex: number) =>\r\n (dispatch: Dispatch): Promise => {\r\n dispatch({ type: UPDATING_WIDGETS });\r\n return request(\r\n \"/Widget/MoveWidget\",\r\n {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n body: JSON.stringify({\r\n WidgetName,\r\n WidgetIndex,\r\n }),\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch({\r\n type: MOVE_WIDGET,\r\n widgets: data,\r\n });\r\n })\r\n .catch(error => {\r\n h.error(\"Error saving widget move.\", error);\r\n });\r\n };\r\n","import { goToUrl } from \"./actionCreators\";\r\nimport { FlowBaseTypes } from \"../helpers/constants\";\r\n\r\nimport {\r\n newFlow,\r\n newFlowItem,\r\n newFlowCase,\r\n newFlowRelation,\r\n updateMultipleAttribute,\r\n setSelectedFlowItemId,\r\n newFlowGuideSetting,\r\n deleteAllItemsInFlow,\r\n deleteFlow,\r\n} from \"./flowActions\";\r\nimport { push } from \"connected-react-router\";\r\nimport { genericQbAddField } from \"./fieldTreeActions\";\r\n\r\nexport const ADD_TO_DATACONNECT_SELECTED_FIELDS = \"ADD_TO_DATACONNECT_SELECTED_FIELDS\";\r\nexport const ADD_TO_DATACONNECT_SELECTED_FIELDNAMES = \"ADD_TO_DATACONNECT_SELECTED_FIELDNAMES\";\r\nexport const REMOVE_ALL_FROM_DATACONNECT_SELECTED_FIELDS = \"REMOVE_ALL_FROM_DATACONNECT_SELECTED_FIELDS\";\r\nexport const REMOVE_ALL_FROM_DATACONNECT_SELECTED_FIELDNAMES = \"REMOVE_ALL_FROM_DATACONNECT_SELECTED_FIELDNAMES\";\r\nexport const REMOVE_FROM_DATACONNECT_SELECTED_FIELDS = \"REMOVE_FROM_DATACONNECT_SELECTED_FIELDS\";\r\nexport const REMOVE_FROM_DATACONNECT_SELECTED_FIELDNAMES = \"REMOVE_FROM_DATACONNECT_SELECTED_FIELDNAMES\";\r\nexport const SET_SELECTED_DATACONNECT_FIELD_ID = \"SET_SELECTED_DATACONNECT_FIELD_ID\";\r\nexport const SET_SELECTED_DATACONNECT_FIELD_NAME = \"SET_SELECTED_DATACONNECT_FIELD_NAME\";\r\nexport const SET_QUICKSTART_MODEL = \"SET_QUICKSTART_MODEL\";\r\nexport const SET_PRESELECTED_FILTERS = \"SET_PRESELECTED_FILTERS\";\r\nexport const fieldsFetchInMinutes = 30;\r\n\r\nexport const CreateFlowAndCase = () => (dispatch, getState) => {\r\n const state = getState();\r\n const parentId = 0;\r\n let childId = 0;\r\n const x = 100;\r\n const y = 500;\r\n\r\n const selectedFields = state.dataConnect.selectedFields;\r\n if (state.flows.byId[-1] != null) {\r\n dispatch(\r\n updateMultipleAttribute(\"flows\", -1, {\r\n FlowName: \"New Audience\",\r\n FlowBaseType: FlowBaseTypes.Undecided,\r\n isSplitEnabled: false,\r\n })\r\n );\r\n } else {\r\n dispatch(newFlow(\"New Audience\", FlowBaseTypes.Undecided));\r\n }\r\n\r\n if (state.flowGuideSettings.byId[-1] != null) {\r\n dispatch(\r\n updateMultipleAttribute(\"flowGuideSettings\", -1, {\r\n FlowId: -1,\r\n IsSplitOn: false,\r\n })\r\n );\r\n } else {\r\n dispatch(newFlowGuideSetting(-1, false));\r\n }\r\n\r\n dispatch(newFlowItem((newId: number) => (childId = newId), \"New Audience\", \"case\", { x, y }));\r\n dispatch(newFlowCase(childId, false, false));\r\n dispatch(newFlowRelation(parentId, childId));\r\n\r\n dispatch(RemoveAllFromDataConnectSelectedFields());\r\n dispatch(setSelectedFlowItemId(-1));\r\n dispatch(push(`/flows/-1/item/-1`));\r\n for (const field of selectedFields) {\r\n dispatch(genericQbAddField(field.toString(), -1));\r\n // dispatch({\r\n // type: \"GENERIC_QB_ADD_FIELD\",\r\n // field,\r\n // fieldData,\r\n // 0,\r\n // 0,\r\n // });\r\n }\r\n};\r\nexport const CreateFlowAndFilter = () => (dispatch, getState) => {\r\n const state = getState();\r\n const parentId = 0;\r\n let childId = 0;\r\n const x = 100;\r\n const y = 500;\r\n\r\n const selectedFields = state.dataConnect.selectedFields;\r\n\r\n if (state.flows.byId[-1] != null) {\r\n dispatch(deleteAllItemsInFlow(-1));\r\n dispatch(deleteFlow(-1));\r\n }\r\n dispatch(newFlow(\"New Audience\", FlowBaseTypes.Undecided));\r\n\r\n if (state.flowGuideSettings.byId[-1] != null) {\r\n dispatch(\r\n updateMultipleAttribute(\"flowGuideSettings\", -1, {\r\n FlowId: -1,\r\n IsSplitOn: true,\r\n })\r\n );\r\n } else {\r\n dispatch(newFlowGuideSetting(-1, true));\r\n }\r\n\r\n for (const field of selectedFields) {\r\n dispatch(genericQbAddField(field.toString()));\r\n }\r\n dispatch(RemoveAllFromDataConnectSelectedFields());\r\n\r\n // NANI-83103 - Start a brand new simple flow\r\n setTimeout(() => {\r\n // Wait for dispatch(deleteAllItemsInFlow(-1));\r\n dispatch(newFlowItem((newId: number) => (childId = newId), \"New Audience\", \"filter\", { x, y }));\r\n dispatch(newFlowRelation(parentId, childId));\r\n\r\n dispatch(setSelectedFlowItemId(-1));\r\n dispatch(push(`/flows/-1/item/${childId}`));\r\n }, 100);\r\n};\r\n\r\nexport const QuickStartModel = data => (dispatch, getState) => {\r\n const state = getState();\r\n const fieldsByFolder = state.fields.byFolder || {};\r\n const filters = Object.values(fieldsByFolder).filter(x => !x.isLeaf);\r\n const companyId = state.session.companyId;\r\n\r\n const firstParty = filters\r\n .filter(x => x.parent == \"#\" && x.companyid == companyId && x.text == \"First-Party Data\")\r\n .map(s => s.id);\r\n const preselectedFilters = [];\r\n firstParty.forEach(id => {\r\n const models = filters.filter(x => x.parent == id && (x.companyid == companyId && x.text) == \"Models\");\r\n models.forEach(x => preselectedFilters.push(x));\r\n });\r\n\r\n dispatch(SetPreselectedFilters(preselectedFilters));\r\n dispatch(SetQuickStartModel(data)); //contains the selected model's row from model status\r\n dispatch(goToUrl(\"/connect\"));\r\n};\r\n\r\nexport const SetSelectedDataConnectFieldId = fieldId => ({\r\n type: SET_SELECTED_DATACONNECT_FIELD_ID,\r\n fieldId,\r\n});\r\n\r\nexport const SetSelectedDataConnectFieldName = fieldName => ({\r\n type: SET_SELECTED_DATACONNECT_FIELD_NAME,\r\n fieldName,\r\n});\r\n\r\nexport const AddToDataConnectSelectedFields = fieldIdToAdd => ({\r\n type: ADD_TO_DATACONNECT_SELECTED_FIELDS,\r\n fieldIdToAdd,\r\n});\r\n\r\nexport const AddToDataConnectSelectedFieldNames = fieldNameToAdd => ({\r\n type: ADD_TO_DATACONNECT_SELECTED_FIELDNAMES,\r\n fieldNameToAdd,\r\n});\r\n\r\nexport const RemoveAllFromDataConnectSelectedFields = () => ({\r\n type: REMOVE_ALL_FROM_DATACONNECT_SELECTED_FIELDS,\r\n});\r\n\r\nexport const RemoveAllFromDataConnectSelectedFieldNames = () => ({\r\n type: REMOVE_ALL_FROM_DATACONNECT_SELECTED_FIELDNAMES,\r\n});\r\n\r\nexport const RemoveFromDataConnectSelectedFields = fieldIdToRemove => ({\r\n type: REMOVE_FROM_DATACONNECT_SELECTED_FIELDS,\r\n fieldIdToRemove,\r\n});\r\n\r\nexport const RemoveFromDataConnectSelectedFieldNames = fieldNameToRemove => ({\r\n type: REMOVE_FROM_DATACONNECT_SELECTED_FIELDNAMES,\r\n fieldNameToRemove,\r\n});\r\n\r\nexport const SetQuickStartModel = model => ({\r\n type: SET_QUICKSTART_MODEL,\r\n model,\r\n});\r\n\r\nexport const SetPreselectedFilters = preselectedFilters => ({\r\n type: SET_PRESELECTED_FILTERS,\r\n preselectedFilters,\r\n});\r\n","import h from \"../helpers\";\r\nimport { ToggleIsLayoutTreeLoading } from \"./treeBehaviorActions\";\r\nimport { SET_DESTINATION_DEDUPE_SETTINGS } from \"../reducers/vars\";\r\n\r\nif (!top.RDX) {\r\n top.RDX = {};\r\n}\r\n\r\nexport const clearSelectedLayout = () => ({\r\n type: \"CLEAR_SELECTED_LAYOUT\",\r\n});\r\ntop.RDX.clearSelectedLayout = () => top.store.dispatch(clearSelectedLayout());\r\n\r\nexport const setSelectedLayout = Id => ({\r\n type: \"SET_SELECTED_LAYOUT\",\r\n Id,\r\n});\r\ntop.RDX.setSelectedLayout = Id => top.store.dispatch(setSelectedLayout(Id));\r\n\r\nexport const setSelectedGlobalVariable = Id => ({\r\n type: \"SET_SELECTED_GLOBAL_VARIABLE\",\r\n Id,\r\n});\r\ntop.RDX.setSelectedGlobalVariable = Id => top.store.dispatch(setSelectedGlobalVariable(Id));\r\n\r\n// export const setClientLayoutField = ()\r\n\r\nexport const setSelectedLayoutObjects = (objects = {}, loading = false) => ({\r\n type: \"SET_LAYOUT_SELECTED_OBJECTS\",\r\n loading,\r\n objects,\r\n});\r\ntop.RDX.setSelectedLayoutObjects = (objects, loading) => top.store.dispatch(setSelectedLayoutObjects(objects, loading));\r\n\r\nexport const setSelectedTaxonomyLayoutObjects = (taxonomyObjects = {}, loading = false) => ({\r\n type: \"SET_LAYOUT_SELECTED_TAXONOMY_OBJECTS\",\r\n loading,\r\n taxonomyObjects,\r\n});\r\ntop.RDX.setSelectedTaxonomyLayoutObjects = (taxonomyObjects, loading) =>\r\n top.store.dispatch(setSelectedTaxonomyLayoutObjects(taxonomyObjects, loading));\r\n\r\nexport const setAllSelectedLayoutObjects = (objects = {}) => ({\r\n type: \"SET_ALL_LAYOUT_OBJECTS\",\r\n objects,\r\n});\r\ntop.RDX.setAllSelectedLayoutObjects = objects => top.store.dispatch(setAllSelectedLayoutObjects(objects));\r\n\r\nexport const setClientField = field => ({\r\n type: \"SET_CLIENT_FIELD_OBJECT\",\r\n field,\r\n});\r\ntop.RDX.setClientField = field => top.store.dispatch(setClientField(field));\r\nexport const requestClientField = () => dispatch => {\r\n const url = \"/LayoutsMain/GetClientField\";\r\n fetch(url, {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data.success) {\r\n dispatch(setClientField(data.field));\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading client field.\" + error, error);\r\n });\r\n};\r\n\r\nexport const requestClientFieldByPartner = partnerId => dispatch => {\r\n const url = \"/LayoutsMain/GetClientFieldByPartner?PartnerId=\" + partnerId;\r\n fetch(url, {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data.success) {\r\n dispatch(setClientField(data.field));\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading client field.\" + error, error);\r\n });\r\n};\r\n\r\nexport const requestFileExtensions = () => dispatch => {\r\n const url = \"/LayoutsMain/GetFileExtensions\";\r\n fetch(url, {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data.success) {\r\n dispatch({ type: \"SET_FILE_EXTENSIONS\", fileExtensions: data.extensions });\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading client field.\" + error, error);\r\n });\r\n};\r\n\r\nexport const layoutClearButton = () => (dispatch, getState) => {\r\n // Look to see if unsaved changes\r\n const state = getState();\r\n const layout = state.layouts[state.selected.layout] || {};\r\n if (layout.hasUnsavedChanges) {\r\n dispatch(setVar(\"loss_of_work_queued_action\", clearSelectedLayout()));\r\n dispatch(setVar(\"loss_of_work_canceled_queued_action\", {}));\r\n dispatch(showModal(\"LOSS_OF_WORK\", { layout }));\r\n } else {\r\n dispatch(setVar(\"loss_of_work_queued_action\", {}));\r\n dispatch(setVar(\"loss_of_work_canceled_queued_action\", {}));\r\n dispatch(clearSelectedLayout());\r\n }\r\n};\r\n\r\nexport const setSelectedLayout2 = layoutId => (dispatch, getState) => {\r\n // Look to see if unsaved changes\r\n const state = getState();\r\n const layout = state.layouts[state.selected.layout] || {};\r\n if (layout.hasUnsavedChanges) {\r\n dispatch(\r\n setVar(\"loss_of_work_queued_action\", () => {\r\n dispatch(requestSelectedLayoutObjects(layoutId));\r\n dispatch(updateLayout(layout.LayoutID, false));\r\n })\r\n );\r\n dispatch(setVar(\"loss_of_work_canceled_queued_action\", {}));\r\n dispatch(showModal(\"LOSS_OF_WORK\", { layout }));\r\n } else {\r\n dispatch(setVar(\"loss_of_work_queued_action\", {}));\r\n dispatch(setVar(\"loss_of_work_canceled_queued_action\", {}));\r\n dispatch(requestSelectedLayoutObjects(layoutId));\r\n }\r\n};\r\n\r\nexport const updateLayoutAndPositions = selectedLayout => (dispatch, getState) => {\r\n const state = getState();\r\n let selectedLayoutObjects = state.layoutObjects.selectedLayoutObjects;\r\n let totalLength = 1;\r\n\r\n // Set width, start, end, order, sort order, and sort direction if it doesn't exits.\r\n selectedLayoutObjects.forEach(x => {\r\n x.Start = totalLength;\r\n totalLength += x.Width == \"\" ? 0 : parseInt(x.Width);\r\n x.End = totalLength - 1;\r\n });\r\n\r\n let selectedTaxonomyLayoutObjects = state.layoutObjects.selectedTaxonomyLayoutObjects;\r\n totalLength = 1;\r\n\r\n // Set width, start, end, order, sort order, and sort direction if it doesn't exits.\r\n selectedTaxonomyLayoutObjects.forEach(x => {\r\n x.Start = totalLength;\r\n totalLength += x.Width == \"\" ? 0 : parseInt(x.Width);\r\n x.End = totalLength - 1;\r\n });\r\n\r\n dispatch(updateLayout(selectedLayout, true));\r\n};\r\n\r\n///// MODALS ////\r\nimport { showModal, setVar, incAjaxCount, decAjaxCount } from \"./actionCreators\";\r\n\r\n// requestSelectedLayoutObjects\r\nexport const requestSelectedLayoutObjects = Id => dispatch => {\r\n dispatch(setSelectedLayoutObjects([], true));\r\n dispatch({ type: \"LOADING_LAYOUT_OBJECTS\", isLoading: true });\r\n\r\n const url = \"/LayoutsMain/GetAvailableObjectsForLayout\";\r\n dispatch(setSelectedLayout(parseInt(Id)));\r\n fetch(url, {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n body: JSON.stringify({\r\n layoutId: Id,\r\n }),\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data.success) {\r\n dispatch({ type: \"SET_LAYOUT_SELECTED_FILES\", selectedLayoutFiles: data.layoutFiles });\r\n dispatch(setSelectedLayoutObjects(data.objects, false));\r\n dispatch(setSelectedTaxonomyLayoutObjects(data.taxonomyObjects, false));\r\n }\r\n dispatch({ type: \"LOADING_LAYOUT_OBJECTS\", isLoading: false });\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading layout objects.\" + error, error);\r\n dispatch({ type: \"LOADING_LAYOUT_OBJECTS\", isLoading: false });\r\n });\r\n};\r\n\r\nimport { loadSingleViewDataVars } from \"./flowActions\";\r\nexport const requestDestinations = () => (dispatch, getState) => {\r\n //updates null to [] so that other components don't do the call while this one is running!\r\n const url = \"/ClientAccess/GetMyPartners\";\r\n const state = getState();\r\n dispatch(incAjaxCount());\r\n dispatch(setLoadingDestinations(true));\r\n return fetch(url, { credentials: \"same-origin\", method: \"POST\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n dispatch(setLoadingDestinations(false));\r\n if (data.partners && data.partners.length > 0) {\r\n dispatch(loadSingleViewDataVars(data.partners));\r\n if (data.partners.find(x => x.DeploySetting == DeploySettings.DeployXandrTemplate)) {\r\n // if there are any Xandr deployment destinations and rate categories are not loaded, trigger the request.\r\n if (!state.xandrRateCategories.categories || state.xandrRateCategories.categories.length <= 0) {\r\n dispatch(requestXandrRateCategories());\r\n }\r\n }\r\n }\r\n if (data.fieldRestrictions && data.fieldRestrictions.length > 0) {\r\n dispatch(loadFieldRestrictions(data.fieldRestrictions));\r\n }\r\n if (data.destinationDedupeSettings) {\r\n dispatch({\r\n type: SET_DESTINATION_DEDUPE_SETTINGS,\r\n destinationDedupeSettings: data.destinationDedupeSettings,\r\n });\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n dispatch(loadSingleViewDataVars(null));\r\n dispatch(setLoadingDestinations(false));\r\n h.error(\"Error loading partners.\", error);\r\n });\r\n};\r\n\r\nexport const requestDestinationsByAccess = () => dispatch => {\r\n const url = \"/ClientAccess/GetDestinationsByAccess\";\r\n dispatch(incAjaxCount());\r\n dispatch(setLoadingDestinations(true));\r\n fetch(url, { credentials: \"same-origin\", method: \"POST\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n dispatch(setLoadingDestinations(false));\r\n dispatch(setAvailableDestinations(data.availableDestinations || []));\r\n dispatch(setRequestableDestinations(data.requestableDestinations || []));\r\n dispatch(setTrackableDestinations(data.trackableDestinations || []));\r\n dispatch(setDestinationGroups(data.destinationGroups || []));\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n dispatch(setAvailableDestinations([]));\r\n dispatch(setRequestableDestinations([]));\r\n dispatch(setTrackableDestinations([]));\r\n dispatch(setDestinationGroups([]));\r\n dispatch(setLoadingDestinations(false));\r\n h.error(\"Error loading Destinations by Access.\", error);\r\n });\r\n};\r\n\r\nexport const setAvailableDestinations = (availableDestinations: boolean) => ({\r\n type: \"SET_AVAILABLE_DESTINATIONS\",\r\n availableDestinations,\r\n});\r\n\r\nexport const setRequestableDestinations = (requestableDestinations: boolean) => ({\r\n type: \"SET_REQUESTABLE_DESTINATIONS\",\r\n requestableDestinations,\r\n});\r\n\r\nexport const setTrackableDestinations = (trackableDestinations: boolean) => ({\r\n type: \"SET_TRACKABLE_DESTINATIONS\",\r\n trackableDestinations,\r\n});\r\n\r\nexport const setLoadingDestinations = (loadingDestinations: boolean) => ({\r\n type: \"SET_LOADING_DESTINATIONS\",\r\n loadingDestinations,\r\n});\r\n\r\nexport const setDestinationGroups = destinationGroups => ({\r\n type: \"SET_DESTINATION_GROUPS\",\r\n destinationGroups,\r\n});\r\n\r\nexport const loadFieldRestrictions = fieldRestrictions => ({\r\n type: \"LOAD_DESTINATION_FIELD_RESTRICTIONS\",\r\n fieldRestrictions,\r\n});\r\ntop.RDX.loadFieldRestrictions = fieldRestrictions => top.store.dispatch(loadFieldRestrictions(fieldRestrictions));\r\n\r\nimport { notifyGreen } from \"./notifyActions\";\r\nimport { DeploySettings } from \"../types/stores/companyTable\";\r\nimport { requestXandrRateCategories } from \"./xandrRateCategoryActions\";\r\nexport const deleteRestrictedField =\r\n (fieldKey, companyID = 0) =>\r\n dispatch => {\r\n let url = \"\";\r\n if (companyID == 0) {\r\n url = `/Field/DeleteRestrictedField?fieldKey=${fieldKey}`;\r\n } else {\r\n url = `/Field/DeleteRestrictedField?fieldKey=${fieldKey}&companyID=${companyID}`;\r\n }\r\n dispatch(incAjaxCount());\r\n fetch(url, { credentials: \"same-origin\", method: \"POST\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n if (data.success) {\r\n dispatch(requestDestinations());\r\n dispatch(notifyGreen(\"Restricted Field successfully removed.\"));\r\n } else {\r\n h.error(\"Error deleting restricted field1.\", data);\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error deleting restricted field.\", error);\r\n });\r\n };\r\n\r\nexport const addRestrictedField =\r\n (fieldKey, companyID = 0) =>\r\n (dispatch, getState) => {\r\n const state = getState();\r\n const companyId = companyID == 0 ? state.session.companyId : companyID;\r\n const restrictedFields = state.vars.destinationFieldRestrictions;\r\n if (!restrictedFields) {\r\n h.error(\"Error checking against existing restricted fields.\");\r\n return;\r\n }\r\n\r\n const exists = restrictedFields.filter(x => x.DestinationId == companyId && x.FieldKey == fieldKey).length > 0;\r\n if (exists) {\r\n h.error(\"Field already exists in the restricted list.\");\r\n } else {\r\n let url = \"\";\r\n if (companyID == 0) {\r\n url = `/Field/AddRestrictedField?fieldKey=${fieldKey}`;\r\n } else {\r\n url = `/Field/AddRestrictedField?fieldKey=${fieldKey}&companyID=${companyId}`;\r\n }\r\n dispatch(incAjaxCount());\r\n fetch(url, { credentials: \"same-origin\", method: \"POST\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n if (data.success) {\r\n dispatch(requestDestinations());\r\n dispatch(notifyGreen(\"Restricted Field successfully added.\"));\r\n } else {\r\n h.error(\"Error adding restricted field.\");\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error adding restricted field.\", error);\r\n });\r\n }\r\n };\r\n\r\n// POST Discrepancy\r\nexport const requestAllLayoutObjects = () => dispatch => {\r\n const url = \"/LayoutsMain/GetLayoutsAndObjects\";\r\n\r\n fetch(url, {\r\n credentials: \"same-origin\",\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data) {\r\n dispatch(setAllSelectedLayoutObjects(data.items));\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading layout objects.\" + error, error);\r\n });\r\n};\r\n\r\nexport const updateDestinationPrimaryIdObj = (layoutId, destinationId) => (dispatch, getState) => {\r\n const state = getState();\r\n const layouts = state.layoutObjects.objects;\r\n const url = \"/Layouts/GetDestinationMatchKey?destinationId=\" + destinationId;\r\n let objects = [];\r\n fetch(url, { credentials: \"same-origin\", method: \"POST\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (layouts != null) {\r\n let thisLayout = layouts.filter(x => x.Layout.LayoutID == layoutId);\r\n if (thisLayout.length > 0) {\r\n objects = thisLayout[0].LayoutObjects;\r\n objects.forEach(x => {\r\n if (x.ObjectType == 5) {\r\n //update exportname/displayname to data.destinationKey\r\n if (x.ExportName == \"Primary Id\") {\r\n dispatch(updateThisLayoutDestination(layoutId, data.destinationKey));\r\n } else {\r\n dispatch(updateThisLayoutDestination(layoutId, x.ExportName));\r\n }\r\n }\r\n });\r\n }\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error fetching destination match.\", error);\r\n });\r\n};\r\n\r\nexport const updateThisLayoutDestination = (LayoutId, ExportName) => ({\r\n type: \"UPDATE_THIS_LAYOUT_DESTINATION\",\r\n LayoutId,\r\n ExportName,\r\n});\r\ntop.RDX.updateThisLayoutDestination = (LayoutId, ExportName) =>\r\n top.store.dispatch(updateThisLayoutDestination(LayoutId, ExportName));\r\n\r\nexport const updateLayout = (Id, Unsaved) => ({\r\n type: \"UPDATE_LAYOUT\",\r\n Id,\r\n Unsaved,\r\n});\r\ntop.RDX.updateLayout = (Id, Unsaved) => top.store.dispatch(updateLayout(Id, Unsaved));\r\n\r\nexport const requestLayoutList =\r\n (mergeBehavior = \"merge\") =>\r\n dispatch => {\r\n const url = \"/LayoutsMain/GetLayoutsByCompany?\" + h.serialize({});\r\n\r\n dispatch(ToggleIsLayoutTreeLoading(true));\r\n return fetch(url, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const layoutList = {};\r\n if (data.layouts.length > 0) {\r\n $.each(data.layouts, (key, item) => {\r\n layoutList[item.LayoutID] = item;\r\n });\r\n dispatch(updateLayoutList(layoutList, mergeBehavior));\r\n }\r\n\r\n const typesList = data.LayoutTypes.map(item => ({ label: item.Type || \"None\", value: item.TypeId }));\r\n dispatch(setSingleViewFields(data.svFields));\r\n dispatch(setLayoutTypes(typesList, mergeBehavior));\r\n dispatch(requestCassReports());\r\n dispatch(ToggleIsLayoutTreeLoading(false));\r\n })\r\n .catch(error => {\r\n dispatch(ToggleIsLayoutTreeLoading(false));\r\n h.error(\"Error loading layouts.\", error);\r\n });\r\n };\r\ntop.RDX.requestLayoutList = (mergeBehavior = \"merge\") => top.store.dispatch(requestLayoutList(mergeBehavior));\r\n\r\nexport const requestLayoutTypes =\r\n (mergeBehavior = \"merge\") =>\r\n dispatch => {\r\n dispatch(incAjaxCount());\r\n fetch(\"/LayoutsMain/GetLayoutTypes\", { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const typesList = data.LayoutTypes.map(item => ({ label: item.Type || \"None\", value: item.TypeId }));\r\n dispatch(setLayoutTypes(typesList, mergeBehavior));\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading file types.\", error);\r\n dispatch(decAjaxCount());\r\n });\r\n };\r\n\r\nexport const requestCassReports =\r\n (mergeBehavior = \"merge\") =>\r\n dispatch => {\r\n dispatch(incAjaxCount());\r\n fetch(\"/LayoutsMain/GetCassReports\", { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const cassReportsList = data.CassReports.map(item => ({\r\n label: item.ReportName || \"None\",\r\n value: item.CassReportId,\r\n }));\r\n dispatch(setCassReports(cassReportsList, mergeBehavior));\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading Cass Reports.\", error);\r\n dispatch(decAjaxCount());\r\n });\r\n };\r\ntop.RDX.requestCassReports = () => top.store.dispatch(requestCassReports());\r\n\r\nexport const setSingleViewFields = (svFields = []) => ({\r\n type: \"SET_LAYOUT_SVFIELDS\",\r\n svFields,\r\n});\r\ntop.RDX.setSingleViewFields = svFields => top.store.dispatch(setSingleViewFields(svFields));\r\n\r\nexport const moveLayoutToFolder = (layoutId, folderId) => ({\r\n type: \"MOVE_LAYOUT_TO_FOLDER\",\r\n layoutId,\r\n folderId,\r\n});\r\n\r\nexport const requestMoveLayoutToFolder = (layoutId: number, folderId: number) => (dispatch, getState) => {\r\n const state = getState();\r\n if (state.session.companyId != state.layouts[layoutId].LayoutCompanyID) {\r\n h.error(\"Cannot move another company's layout.\");\r\n return;\r\n }\r\n\r\n dispatch(moveLayoutToFolder(layoutId, folderId));\r\n // Then make request to server\r\n dispatch(incAjaxCount());\r\n const moveUrl =\r\n \"/Layouts/MoveLayout?\" +\r\n h.serialize({\r\n layoutId,\r\n folderId,\r\n });\r\n fetch(moveUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(() => {\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error moving layout\", error);\r\n });\r\n};\r\n\r\nexport const requestGlobalVariables = () => dispatch => {\r\n const url = \"/LayoutsMain/GetGlobalVariables?\" + h.serialize({});\r\n return fetch(url, { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const variables = {};\r\n\r\n if (data.gVariables.length > 0) {\r\n $.each(data.gVariables, (key, item) => {\r\n variables[item.Id] = item;\r\n });\r\n dispatch({ type: \"SET_GLOBAL_VARIABLES\", variables });\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading global variables.\", error);\r\n });\r\n};\r\ntop.RDX.requestGlobalVariables = () => top.store.dispatch(requestGlobalVariables());\r\n\r\nexport const setIsDeploySeparateFiles = layouts => ({\r\n type: \"SET_LAYOUT_ISDEPLOYSEPARATEFILES\",\r\n layouts,\r\n});\r\ntop.RDX.setIsDeploySeparateFiles = layouts => top.store.dispatch(setIsDeploySeparateFiles(layouts));\r\n\r\nexport const setIsActiveDestination = layouts => ({\r\n type: \"SET_LAYOUT_ISACTIVEDESTINATION\",\r\n layouts,\r\n});\r\ntop.RDX.setIsActiveDestination = layouts => top.store.dispatch(setIsActiveDestination(layouts));\r\n\r\nexport const setIsDestination = layouts => ({\r\n type: \"SET_LAYOUT_ISDESTINATION\",\r\n layouts,\r\n});\r\ntop.RDX.setIsDestination = layouts => top.store.dispatch(setIsDestination(layouts));\r\n\r\nexport const setIsFixed = layouts => dispatch => {\r\n dispatch({\r\n type: \"SET_LAYOUT_ISFIXED\",\r\n layouts,\r\n });\r\n};\r\n\r\nexport const updateLayoutList = (layouts, mergeBehavior = \"merge\") => ({\r\n type: \"UPDATE_LAYOUT_LIST\",\r\n layouts,\r\n mergeBehavior,\r\n});\r\ntop.RDX.updateLayoutList = (layouts, mergeBehavior = \"merge\") =>\r\n top.store.dispatch(updateLayoutList(layouts, mergeBehavior));\r\n\r\nexport const setLayoutTypes = (layoutTypes = []) => ({\r\n type: \"SET_LAYOUT_TYPES\",\r\n layoutTypes,\r\n});\r\ntop.RDX.setLayoutTypes = layoutTypes => top.store.dispatch(setLayoutTypes(layoutTypes));\r\n\r\nexport const setCassReports = (cassReports = []) => ({\r\n type: \"SET_CASS_REPORTS\",\r\n cassReports,\r\n});\r\ntop.RDX.setCassReports = cassReports => top.store.dispatch(setCassReports(cassReports));\r\n\r\nexport const setCompressionTypes = (compressionTypes = {}) => ({\r\n type: \"SET_COMPRESSION_TYPES\",\r\n compressionTypes,\r\n});\r\ntop.RDX.setCompressionTypes = compressionTypes => top.store.dispatch(setCompressionTypes(compressionTypes));\r\n\r\nexport const newLayout = () => dispatch => {\r\n dispatch({ type: \"NEW_LAYOUT\" });\r\n // dispatch(requestClientField());\r\n dispatch(setSelectedLayoutObjects([], false));\r\n AddFieldToLayoutObjects(null, null);\r\n};\r\n\r\nexport const startNewLayout = name => dispatch => {\r\n dispatch({ type: \"NEW_LAYOUT_CREATE\", name });\r\n\r\n // nulls\r\n dispatch(setSelectedLayoutObjects([], false));\r\n dispatch(setSelectedLayout2(0));\r\n};\r\n\r\ntop.RDX.newLayout = () => top.store.dispatch(newLayout());\r\n\r\n// AddSegmentToLayoutObjects\r\n\r\nexport const AddFieldToLayoutObjects = (field, layoutId, isTaxonomy) => (dispatch, getState) => {\r\n let state = getState();\r\n const selectedLayout = state.selected.layout;\r\n let type = isTaxonomy ? \"ADD_TAXONOMY_LAYOUT_OBJECT\" : \"ADD_LAYOUT_OBJECT\";\r\n\r\n if (selectedLayout === null) {\r\n dispatch(newLayout());\r\n dispatch({\r\n type,\r\n object: {\r\n LayoutId: 0,\r\n ObjectType: 1,\r\n ObjectId: field,\r\n DisplayName: state.layoutfields.byId[field].text,\r\n ExportName: state.layoutfields.byId[field].text,\r\n Width:\r\n state.layoutfields.byId[field].FieldSubType == \"double\"\r\n ? state.layoutfields.byId[field].FieldSize == 0\r\n ? state.layoutfields.byId[field].FieldPrec\r\n : state.layoutfields.byId[field].FieldSize\r\n : state.layoutfields.byId[field].FieldSize,\r\n DefaultValue: \"\",\r\n IsValid: true,\r\n IsExternal: state.layoutfields.byId[field].IsPII,\r\n },\r\n });\r\n state = getState();\r\n } else {\r\n dispatch({\r\n type,\r\n object: {\r\n LayoutId: state.selected.layout,\r\n ObjectType: 1,\r\n ObjectId: field,\r\n DisplayName: state.layoutfields.byId[field].text,\r\n ExportName: state.layoutfields.byId[field].text,\r\n Width:\r\n state.layoutfields.byId[field].FieldSubType == \"double\"\r\n ? state.layoutfields.byId[field].FieldSize == 0\r\n ? state.layoutfields.byId[field].FieldPrec\r\n : state.layoutfields.byId[field].FieldSize\r\n : state.layoutfields.byId[field].FieldSize,\r\n DefaultValue: \"\",\r\n IsValid: true,\r\n IsExternal: state.layoutfields.byId[field].IsPII,\r\n },\r\n });\r\n\r\n dispatch({\r\n type: \"UPDATE_LAYOUT\",\r\n Id: layoutId == null ? 0 : layoutId,\r\n Unsaved: true,\r\n });\r\n }\r\n dispatch(updateLayoutAndPositions(layoutId));\r\n};\r\n\r\nexport const AddClientFieldToLayoutObjects = (layoutId, isTaxonomy) => (dispatch, getState) => {\r\n let state = getState();\r\n let type = isTaxonomy ? \"ADD_TAXONOMY_LAYOUT_OBJECT\" : \"ADD_LAYOUT_OBJECT\";\r\n const selectedLayout = state.selected.layout;\r\n if (selectedLayout === null) {\r\n dispatch(newLayout());\r\n dispatch({\r\n type,\r\n object: {\r\n LayoutId: 0,\r\n ObjectType: 5,\r\n ObjectId: state.layoutObjects.clientFieldObject.FieldUniqueKey,\r\n DisplayName: \"Primary Id\",\r\n ExportName: \"Primary Id\",\r\n Width:\r\n state.layoutObjects.clientFieldObject.FieldSize != null\r\n ? state.layoutObjects.clientFieldObject.FieldSize\r\n : 10,\r\n DefaultValue: \"\",\r\n IsValid: true,\r\n },\r\n });\r\n state = getState();\r\n } else {\r\n dispatch({\r\n type,\r\n object: {\r\n LayoutId: state.selected.layout,\r\n ObjectType: 5,\r\n ObjectId: state.layoutObjects.clientFieldObject.FieldUniqueKey,\r\n DisplayName: \"Primary Id\",\r\n ExportName: \"Primary Id\",\r\n Width:\r\n state.layoutObjects.clientFieldObject.FieldSize != null\r\n ? state.layoutObjects.clientFieldObject.FieldSize\r\n : 10,\r\n DefaultValue: \"\",\r\n IsValid: true,\r\n },\r\n });\r\n\r\n dispatch({\r\n type: \"UPDATE_LAYOUT\",\r\n Id: layoutId == null ? 0 : layoutId,\r\n Unsaved: true,\r\n });\r\n }\r\n};\r\n\r\nexport const AddSVFieldToLayoutObjects = (svField, layoutId, isTaxonomy) => (dispatch, getState) => {\r\n let state = getState();\r\n let type = isTaxonomy ? \"ADD_TAXONOMY_LAYOUT_OBJECT\" : \"ADD_LAYOUT_OBJECT\";\r\n const selectedLayout = state.selected.layout;\r\n if (selectedLayout === null) {\r\n dispatch(newLayout());\r\n dispatch({\r\n type,\r\n object: {\r\n LayoutId: 0,\r\n ObjectType: 11,\r\n ObjectId: null,\r\n DisplayName: svField,\r\n ExportName: svField,\r\n Width: 10,\r\n DefaultValue: \"\",\r\n IsValid: true,\r\n },\r\n });\r\n state = getState();\r\n } else {\r\n dispatch({\r\n type,\r\n object: {\r\n LayoutId: state.selected.layout,\r\n ObjectType: 11,\r\n ObjectId: null,\r\n DisplayName: svField,\r\n ExportName: svField,\r\n Width: 10,\r\n DefaultValue: \"\",\r\n IsValid: true,\r\n },\r\n });\r\n\r\n dispatch({\r\n type: \"UPDATE_LAYOUT\",\r\n Id: layoutId == null ? 0 : layoutId,\r\n Unsaved: true,\r\n });\r\n }\r\n dispatch(updateLayoutAndPositions(layoutId));\r\n};\r\n\r\nexport const AddGlobalVariableToLayoutObjects = (variableId, layoutId, scope, isTaxonomy) => (dispatch, getState) => {\r\n let state = getState();\r\n let type = isTaxonomy ? \"ADD_TAXONOMY_LAYOUT_OBJECT\" : \"ADD_LAYOUT_OBJECT\";\r\n let objectType = 0;\r\n switch (scope) {\r\n case \"OfferCode\":\r\n objectType = 9;\r\n break;\r\n case \"DestinationOffer\":\r\n objectType = 4;\r\n break;\r\n case \"CampaignFlow\":\r\n objectType = 3;\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n const selectedLayout = state.selected.layout;\r\n if (selectedLayout === null) {\r\n dispatch(newLayout());\r\n dispatch({\r\n type,\r\n object: {\r\n LayoutId: 0,\r\n ObjectType: objectType,\r\n ObjectId: variableId,\r\n DisplayName: state.clientVariables.byId[variableId].VariableName,\r\n ExportName: state.clientVariables.byId[variableId].VariableName,\r\n Width: 10,\r\n DefaultValue: \"\",\r\n IsValid: true,\r\n },\r\n });\r\n state = getState();\r\n } else {\r\n dispatch({\r\n type,\r\n object: {\r\n LayoutId: state.selected.layout,\r\n ObjectType: objectType,\r\n ObjectId: variableId,\r\n DisplayName: state.clientVariables.byId[variableId].VariableName,\r\n ExportName: state.clientVariables.byId[variableId].VariableName,\r\n Width: 10,\r\n DefaultValue: \"\",\r\n IsValid: true,\r\n },\r\n });\r\n\r\n dispatch({\r\n type: \"UPDATE_LAYOUT\",\r\n Id: layoutId == null ? 0 : layoutId,\r\n Unsaved: true,\r\n });\r\n }\r\n dispatch(updateLayoutAndPositions(layoutId));\r\n};\r\n\r\nexport const AddCampaignObjectToLayoutObjects = (objectType, layoutId, isTaxonomy) => (dispatch, getState) => {\r\n let state = getState();\r\n let displayName = \"\";\r\n\r\n switch (objectType) {\r\n case 6:\r\n displayName = \"Segment Code\";\r\n break;\r\n case 7:\r\n displayName = \"Test or Control Key\";\r\n break;\r\n case 12:\r\n displayName = \"Split Segment\";\r\n break;\r\n case 13:\r\n displayName = \"Sequence\";\r\n break;\r\n default:\r\n break;\r\n }\r\n let type = isTaxonomy ? \"ADD_TAXONOMY_LAYOUT_OBJECT\" : \"ADD_LAYOUT_OBJECT\";\r\n const selectedLayout = state.selected.layout;\r\n if (selectedLayout === null) {\r\n dispatch(newLayout());\r\n dispatch({\r\n type,\r\n object: {\r\n LayoutId: 0,\r\n ObjectType: objectType,\r\n ObjectId: null,\r\n DisplayName: displayName,\r\n ExportName: displayName,\r\n Width: 10,\r\n DefaultValue: \"\",\r\n IsValid: true,\r\n },\r\n });\r\n state = getState();\r\n } else {\r\n dispatch({\r\n type,\r\n object: {\r\n LayoutId: state.selected.layout,\r\n ObjectType: objectType,\r\n ObjectId: null,\r\n DisplayName: displayName,\r\n ExportName: displayName,\r\n Width: 10,\r\n DefaultValue: \"\",\r\n IsValid: true,\r\n },\r\n });\r\n\r\n dispatch({\r\n type: \"UPDATE_LAYOUT\",\r\n Id: layoutId == null ? 0 : layoutId,\r\n Unsaved: true,\r\n });\r\n }\r\n dispatch(updateLayoutAndPositions(layoutId));\r\n};\r\n\r\nexport const AddObjectToLayoutObjects = (objectType, layoutId, isTaxonomy) => (dispatch, getState) => {\r\n let state = getState();\r\n let displayName = \"\";\r\n let type = isTaxonomy ? \"ADD_TAXONOMY_LAYOUT_OBJECT\" : \"ADD_LAYOUT_OBJECT\";\r\n switch (objectType) {\r\n case 6:\r\n displayName = \"Segment Code\";\r\n break;\r\n case 7:\r\n displayName = \"Test or Control Key\";\r\n break;\r\n case 13:\r\n displayName = \"Sequence\";\r\n break;\r\n default:\r\n break;\r\n }\r\n const selectedLayout = state.selected.layout;\r\n if (selectedLayout === null) {\r\n dispatch(newLayout());\r\n dispatch({\r\n type,\r\n object: {\r\n LayoutId: 0,\r\n ObjectType: objectType,\r\n ObjectId: null,\r\n DisplayName: displayName,\r\n ExportName: displayName,\r\n Width: 10,\r\n DefaultValue: \"\",\r\n IsValid: true,\r\n },\r\n });\r\n state = getState();\r\n } else {\r\n dispatch({\r\n type,\r\n object: {\r\n LayoutId: state.selected.layout,\r\n ObjectType: objectType,\r\n ObjectId: null,\r\n DisplayName: displayName,\r\n ExportName: displayName,\r\n Width: 10,\r\n DefaultValue: \"\",\r\n IsValid: true,\r\n },\r\n });\r\n\r\n dispatch({\r\n type: \"UPDATE_LAYOUT\",\r\n Id: layoutId == null ? 0 : layoutId,\r\n Unsaved: true,\r\n });\r\n }\r\n dispatch(updateLayoutAndPositions(layoutId));\r\n};\r\n\r\nexport const AddPlaceholderToLayoutObjects = (counter, layoutId, isTaxonomy) => (dispatch, getState) => {\r\n let state = getState();\r\n let type = isTaxonomy ? \"ADD_TAXONOMY_LAYOUT_OBJECT\" : \"ADD_LAYOUT_OBJECT\";\r\n const selectedLayout = state.selected.layout;\r\n if (selectedLayout === null) {\r\n dispatch(newLayout());\r\n dispatch({\r\n type,\r\n object: {\r\n LayoutId: 0,\r\n ObjectType: 2,\r\n ObjectId: null,\r\n DisplayName: \"Placeholder\" + counter,\r\n ExportName: \"Placeholder\" + counter,\r\n Width: 100,\r\n DefaultValue: \"\",\r\n IsValid: true,\r\n },\r\n });\r\n state = getState();\r\n } else {\r\n dispatch({\r\n type,\r\n object: {\r\n LayoutId: state.selected.layout,\r\n ObjectType: 2,\r\n ObjectId: null,\r\n DisplayName: \"Placeholder\" + counter,\r\n ExportName: \"Placeholder\" + counter,\r\n Width: 100,\r\n DefaultValue: \"\",\r\n IsValid: true,\r\n },\r\n });\r\n\r\n dispatch({\r\n type: \"UPDATE_LAYOUT\",\r\n Id: layoutId == null ? 0 : layoutId,\r\n Unsaved: true,\r\n });\r\n }\r\n dispatch(updateLayoutAndPositions(layoutId));\r\n};\r\n\r\n// Archive Layout -- Locally only\r\nexport const archiveLayout = (layoutID, folderId) => ({\r\n type: \"ARCHIVE_LAYOUT\",\r\n layoutID,\r\n folderId,\r\n});\r\n\r\n// Archive Layout -- Does API request\r\nexport const requestArchiveLayout = (layoutID, folderId) => dispatch => {\r\n dispatch(archiveLayout(layoutID, folderId));\r\n dispatch(setSelectedLayoutObjects([], false));\r\n dispatch(setSelectedLayout(0));\r\n dispatch(newLayout());\r\n\r\n return fetch(\"/LayoutsMain/ArchiveLayout\", {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n headers: {\r\n Accept: \"application/json\",\r\n \"Content-Type\": \"application/json\",\r\n },\r\n body: JSON.stringify(h.addRequestVerificationToken({ layoutID })),\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (!data.success) {\r\n throw new Error(\"Error archiving layout.\");\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error archiving layout.\", error);\r\n });\r\n};\r\n\r\nexport const recoverLayout = (layoutID, folderId) => ({\r\n type: \"RECOVER_LAYOUT\",\r\n layoutID,\r\n folderId,\r\n});\r\n\r\nexport const recoverArchiveLayout = (layoutID, isDestination, folderId) => dispatch => {\r\n dispatch(recoverLayout(layoutID, folderId));\r\n dispatch(setSelectedLayoutObjects([], true));\r\n dispatch(setSelectedLayout(layoutID));\r\n\r\n return fetch(\"/LayoutsMain/RecoverLayout\", {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n headers: {\r\n Accept: \"application/json\",\r\n \"Content-Type\": \"application/json\",\r\n },\r\n body: JSON.stringify(h.addRequestVerificationToken({ layoutID, isDestination })),\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (!data.success) {\r\n throw new Error(\"Error restoring layout.\");\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error restoring layout.\", error);\r\n });\r\n};\r\n\r\n// Delete Layout -- Locally only\r\nexport const deleteLayout2 = layoutID => ({\r\n type: \"DELETE_LAYOUT\",\r\n layoutID,\r\n});\r\n\r\nexport const requestLayoutDelete2 = layoutID => dispatch => {\r\n dispatch(deleteLayout2(layoutID));\r\n dispatch(clearSelectedLayout());\r\n dispatch(setSelectedLayoutObjects([], false));\r\n\r\n return fetch(\"/LayoutsMain/DeleteLayout\", {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n headers: {\r\n Accept: \"application/json\",\r\n \"Content-Type\": \"application/json\",\r\n },\r\n body: JSON.stringify(h.addRequestVerificationToken({ layoutID })),\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (!data.success) {\r\n throw new Error(\"Error deleting layout.\");\r\n }\r\n });\r\n};\r\n\r\nexport const requestLayoutFields = layoutId => dispatch => {\r\n dispatch(incAjaxCount());\r\n fetch(\"/LayoutsMain/GetLayoutFields\", {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n headers: {\r\n Accept: \"application/json\",\r\n \"Content-Type\": \"application/json\",\r\n },\r\n body: JSON.stringify(h.addRequestVerificationToken({ layoutId })),\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n if (!data.success) {\r\n throw new Error(\"Error loading layout fields.\");\r\n }\r\n dispatch(updateLayoutFields(layoutId, data.layoutFields));\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error loading layout fields.\", error);\r\n });\r\n};\r\n\r\nexport const updateLayoutFields = (layoutId, layoutFields) => ({\r\n type: \"UPDATE_LAYOUT_FIELDS\",\r\n layoutId,\r\n layoutFields,\r\n});\r\n","import h from \"../helpers\";\r\nimport { request } from \"../helpers/httpInterceptor\";\r\nimport { Dispatch } from \"../types/types\";\r\nimport { IUser } from \"../types/stores/userAdmin\";\r\nimport {\r\n IFeature,\r\n IUpdateFeatureList,\r\n IFeatureListLoadStarted,\r\n IFeatureListLoadFinished,\r\n IUpdateFeaturesAppMode,\r\n IUpdateSelectedFeatureId,\r\n IFeatureUserListLoadStarted,\r\n IFeatureUserListLoadFinished,\r\n IUpdateFeatureUserList,\r\n IUpdateFeaturesTitle,\r\n IUpdateFeatureListUserSelection,\r\n ICompanyFeature,\r\n ISetCompanies,\r\n ISetCompanyFeatures,\r\n ISetFeatures,\r\n ISetCompanyNewSelectedFeatures,\r\n} from \"../types/stores/feature\";\r\nimport {\r\n UPDATE_FEATURES_TITLE,\r\n UPDATE_SELECTED_FEATURE_ID,\r\n UPDATE_FEATURES_APP_MODE,\r\n FEATURE_LIST_LOAD_STARTED,\r\n FEATURE_LIST_LOAD_FINISHED,\r\n UPDATE_FEATURE_LIST,\r\n FEATURE_USER_LIST_LOAD_STARTED,\r\n FEATURE_USER_LIST_LOAD_FINISHED,\r\n UPDATE_FEATURE_USER_LIST,\r\n UPDATE_FEATURE_LIST_USER_SELECTION,\r\n SET_COMPANIES,\r\n SET_COMPANY_FEATURES,\r\n SET_COMPANY_NEW_SELECTED_FEATURES,\r\n SET_FEATURES,\r\n} from \"../reducers/features\";\r\nimport { sortArrayBy } from \"../helpers/sorting\";\r\nimport { ICompany } from \"../types/stores/companyTable\";\r\nimport { notifyGreen } from \"./notifyActions\";\r\nimport { SetCompanyIsLoadingFeatures } from \"./companiesActions\";\r\n\r\nif (top && !top.RDX) {\r\n top.RDX = {};\r\n}\r\n\r\nexport const requestFeatureList =\r\n () =>\r\n (dispatch: Dispatch): void => {\r\n dispatch(featureListLoadStarted());\r\n\r\n fetch(\"/Features/GetFeatures/\", { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(response => {\r\n const data = response as unknown as Array;\r\n dispatch(updateFeatureList(data));\r\n dispatch(featureListLoadFinished());\r\n })\r\n .catch(error => {\r\n dispatch(featureListLoadFinished());\r\n h.error(\"Error loading feature list.\", error);\r\n });\r\n };\r\n\r\nexport const requestFeatureUserList =\r\n (featureId: number) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch(featureUserListLoadStarted());\r\n\r\n fetch(\"/features/GetUsers?\" + h.serialize({ featureId }), { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(response => {\r\n const data = response as unknown as Array;\r\n dispatch(updateFeatureUserList(data));\r\n dispatch(featureUserListLoadFinished());\r\n })\r\n .catch(error => {\r\n dispatch(featureUserListLoadFinished());\r\n h.error(\"Error loading user list.\", error);\r\n });\r\n };\r\n\r\nexport const updateUserSelection =\r\n (featureId: number, userId: number, hasFeature: boolean) =>\r\n (dispatch: Dispatch): void => {\r\n const url = \"/Features/UpdateUser?\" + h.serialize({ featureId, userId, hasFeature });\r\n fetch(url, {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(response => {\r\n const data = response as unknown as { result: string };\r\n if (data.result && data.result == \"success\") {\r\n dispatch(updateFeatureListUserSelection(userId, hasFeature));\r\n }\r\n });\r\n };\r\n\r\nexport const getAdminFeaturesData =\r\n () =>\r\n (dispatch: Dispatch): void => {\r\n dispatch(featureListLoadStarted());\r\n fetch(\"/Admin/Companies/FeaturesData\", { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const rawData = data as unknown as {\r\n companies: Array;\r\n featureCompanies: Array;\r\n features: Array;\r\n };\r\n\r\n dispatch(setCompanies(sortArrayBy(rawData.companies, \"CompanyName\")));\r\n dispatch(setFeatureCompanies(rawData.featureCompanies));\r\n dispatch(setFeatures(sortArrayBy(rawData.features, \"Name\")));\r\n dispatch(featureListLoadFinished());\r\n })\r\n .catch(error => {\r\n h.error(\"Couldn't load feature data.\", error);\r\n });\r\n };\r\n\r\nexport const saveCompaniesFeatures =\r\n (featureCompaniesClient: Array) =>\r\n (dispatch: Dispatch): void => {\r\n fetch(\"/Admin/Companies/PushFeatures\", {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: { Accept: \"application/json\", \"Content-Type\": \"application/json\" },\r\n body: JSON.stringify({ featureCompaniesClient }),\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const response = data as unknown as { result: boolean };\r\n if (response.result) {\r\n dispatch(notifyGreen(\"Features updated successfully.\"));\r\n }\r\n });\r\n };\r\n\r\nexport const GetCompanyFeatures =\r\n (companyId?: number) =>\r\n (dispatch: Dispatch): Promise => {\r\n dispatch(SetCompanyIsLoadingFeatures(true));\r\n\r\n return request(\r\n \"/Features/GetCompanyFeatures\" + (companyId ? `/${companyId}` : \"\"),\r\n { credentials: \"same-origin\" },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n let featuresData = [];\r\n if (data && data.allFeatures && data.allFeatures.length > 0) {\r\n featuresData = data.allFeatures.map(x => ({\r\n Name: x.Name,\r\n Description: x.Description,\r\n IsExternal: x.IsExternal,\r\n Selected: data.companyFeatures\r\n ? data.companyFeatures.filter(y => y.Name == x.Name).length > 0\r\n : false,\r\n IsUserOnly: x.IsUserOnly,\r\n }));\r\n }\r\n dispatch({\r\n type: SET_COMPANY_FEATURES,\r\n features: featuresData,\r\n });\r\n dispatch(SetCompanyIsLoadingFeatures(false));\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading Features.\", error);\r\n dispatch(SetCompanyIsLoadingFeatures(false));\r\n });\r\n };\r\n\r\nexport const setCompanies = (companies: Array): ISetCompanies => ({\r\n type: SET_COMPANIES,\r\n companies,\r\n});\r\n\r\nexport const setFeatureCompanies = (companyFeatures: Array): ISetCompanyFeatures => ({\r\n type: SET_COMPANY_FEATURES,\r\n companyFeatures,\r\n});\r\n\r\nexport const setCompanyNewSelectedFeatures = (\r\n companyNewSelectedFeatures: Array\r\n): ISetCompanyNewSelectedFeatures => ({\r\n type: SET_COMPANY_NEW_SELECTED_FEATURES,\r\n companyNewSelectedFeatures,\r\n});\r\n\r\nexport const setFeatures = (features: Array): ISetFeatures => ({\r\n type: SET_FEATURES,\r\n features,\r\n});\r\n\r\nexport const updateFeatureList = (featureList: Array): IUpdateFeatureList => ({\r\n type: UPDATE_FEATURE_LIST,\r\n featureList,\r\n});\r\n\r\nexport const featureListLoadStarted = (): IFeatureListLoadStarted => ({\r\n type: FEATURE_LIST_LOAD_STARTED,\r\n});\r\n\r\nexport const featureListLoadFinished = (): IFeatureListLoadFinished => ({\r\n type: FEATURE_LIST_LOAD_FINISHED,\r\n});\r\n\r\nexport const updateFeaturesAppMode = (mode: string): IUpdateFeaturesAppMode => ({\r\n type: UPDATE_FEATURES_APP_MODE,\r\n mode,\r\n});\r\n\r\nexport const updateSelectedFeatureId = (featureId: number | null): IUpdateSelectedFeatureId => ({\r\n type: UPDATE_SELECTED_FEATURE_ID,\r\n featureId,\r\n});\r\n\r\nexport const featureUserListLoadStarted = (): IFeatureUserListLoadStarted => ({\r\n type: FEATURE_USER_LIST_LOAD_STARTED,\r\n});\r\n\r\nexport const featureUserListLoadFinished = (): IFeatureUserListLoadFinished => ({\r\n type: FEATURE_USER_LIST_LOAD_FINISHED,\r\n});\r\n\r\nexport const updateFeatureUserList = (userList: Array): IUpdateFeatureUserList => ({\r\n type: UPDATE_FEATURE_USER_LIST,\r\n userList,\r\n});\r\n\r\nexport const updateFeaturesTitle = (title: string): IUpdateFeaturesTitle => ({\r\n type: UPDATE_FEATURES_TITLE,\r\n title,\r\n});\r\n\r\nexport const updateFeatureListUserSelection = (\r\n userId: number,\r\n hasFeature: boolean\r\n): IUpdateFeatureListUserSelection => ({\r\n type: UPDATE_FEATURE_LIST_USER_SELECTION,\r\n userId,\r\n hasFeature,\r\n});\r\n","import { Dispatch } from \"../types/types\";\r\nimport h from \"../helpers\";\r\nimport { notifyGreen, notifyError } from \"./notifyActions\";\r\nimport { showModal } from \"./actionCreators\";\r\nimport {\r\n ISetFieldLabelsIsLoading,\r\n ISetFieldLabelsIsSaving,\r\n ISetFieldLabelsSaveCompleted,\r\n IFieldLabelsWithProperties,\r\n} from \"../types/stores/fieldLabels\";\r\nimport { IFieldLabelType } from \"../types/stores/fieldTypes\";\r\n\r\nimport {\r\n SET_FIELD_LABELS_FIELDS,\r\n SET_FIELD_LABEL_TYPES,\r\n SET_LOADING_FIELD_LABELS,\r\n SET_IS_SAVING_FIELD_LABELS,\r\n SET_SAVE_COMPLETED_FIELD_LABELS,\r\n} from \"../reducers/fieldLabels\";\r\n\r\nexport const SetFieldLabelsIsLoading = (newValue: boolean): ISetFieldLabelsIsLoading => ({\r\n type: SET_LOADING_FIELD_LABELS,\r\n isLoading: newValue,\r\n});\r\n\r\nexport const SetFieldLabelsIsSaving = (newValue: boolean): ISetFieldLabelsIsSaving => ({\r\n type: SET_IS_SAVING_FIELD_LABELS,\r\n isSaving: newValue,\r\n});\r\n\r\nexport const SetFieldLabelsSaveCompleted = (newValue: boolean): ISetFieldLabelsSaveCompleted => ({\r\n type: SET_SAVE_COMPLETED_FIELD_LABELS,\r\n saveCompleted: newValue,\r\n});\r\n\r\nexport const GetFieldLabels =\r\n () =>\r\n (dispatch: Dispatch): Promise => {\r\n dispatch(SetFieldLabelsIsLoading(true));\r\n return fetch(\"/Field/GetFieldLabelswithProperties\", { credentials: \"same-origin\", method: \"POST\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const response = data as unknown as { success: boolean; results: Array };\r\n dispatch(SetFieldLabelsIsLoading(false));\r\n\r\n if (response && response.success) {\r\n dispatch({ type: SET_FIELD_LABELS_FIELDS, labels: response.results });\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(SetFieldLabelsIsLoading(false));\r\n h.error(\"Error getting field labels.\", error);\r\n });\r\n };\r\n\r\nexport const GetFieldLabelTypes =\r\n () =>\r\n (dispatch: Dispatch): Promise => {\r\n dispatch(SetFieldLabelsIsLoading(true));\r\n return fetch(\"/Field/GetFieldLabelTypes\", { credentials: \"same-origin\", method: \"POST\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const response = data as unknown as { success: boolean; results: Array };\r\n dispatch(SetFieldLabelsIsLoading(false));\r\n\r\n if (response && response.success) {\r\n dispatch({ type: SET_FIELD_LABEL_TYPES, labelTypes: response.results });\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(SetFieldLabelsIsLoading(false));\r\n h.error(\"Error getting field label types.\", error);\r\n });\r\n };\r\n\r\nexport const CallFieldLabelsActionForUpdate = (\r\n url: string,\r\n errorMessage: string,\r\n successMessage: string,\r\n dispatch: Dispatch\r\n): Promise =>\r\n fetch(url, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const response = data as unknown as {\r\n error: boolean;\r\n isApprovalDataAddRequired: boolean;\r\n fieldLabelId: number;\r\n labelName: string;\r\n };\r\n if (response.error) {\r\n h.error(response.error);\r\n } else {\r\n if (response.isApprovalDataAddRequired) {\r\n // If approval type was added or type updated to APPROVAL_FIELD, need to display modal to add approval data\r\n dispatch(\r\n showModal(\"FIELD_LABEL_APPROVAL\", {\r\n fieldLabelId: response.fieldLabelId,\r\n labelName: response.labelName,\r\n disableEscape: true,\r\n })\r\n );\r\n }\r\n\r\n dispatch(GetFieldLabels());\r\n dispatch(notifyGreen(successMessage));\r\n }\r\n })\r\n .catch(error => {\r\n h.error(errorMessage, error);\r\n });\r\n\r\nexport const AddFieldLabel =\r\n (labelName: string, labelType: number) =>\r\n (dispatch: Dispatch): Promise => {\r\n const url =\r\n \"/field/AddFieldLabel?\" +\r\n h.serialize({\r\n labelName,\r\n labelType,\r\n });\r\n\r\n const errorMessage = \"Error adding field label\";\r\n const successMessage = \"Successfully added field label.\";\r\n return CallFieldLabelsActionForUpdate(url, errorMessage, successMessage, dispatch);\r\n };\r\n\r\nexport const DeleteFieldLabel =\r\n (id: number) =>\r\n (dispatch: Dispatch): Promise => {\r\n const url =\r\n \"/field/deleteFieldLabel?\" +\r\n h.serialize({\r\n fieldLabelId: id,\r\n });\r\n const errorMessage = \"Error deleting field label\";\r\n const successMessage = \"Successfully deleted field label.\";\r\n return CallFieldLabelsActionForUpdate(url, errorMessage, successMessage, dispatch);\r\n };\r\n\r\nexport const EditFieldLabel =\r\n (fieldLabelId: number, newValue: string) =>\r\n (dispatch: Dispatch): Promise => {\r\n const url =\r\n \"/field/EditFieldLabel?\" +\r\n h.serialize({\r\n fieldLabelId,\r\n newValue,\r\n });\r\n const errorMessage = \"Error editing field label\";\r\n const successMessage = \"Successfully updated field label.\";\r\n return CallFieldLabelsActionForUpdate(url, errorMessage, successMessage, dispatch);\r\n };\r\n\r\nexport const EditFieldLabelType =\r\n (fieldLabelId: number, newValue: number) =>\r\n (dispatch: Dispatch): Promise => {\r\n const url =\r\n \"/field/EditFieldLabelType?\" +\r\n h.serialize({\r\n fieldLabelId,\r\n newValue,\r\n });\r\n const errorMessage = \"Error editing field label type\";\r\n const successMessage = \"Successfully updated field label.\";\r\n return CallFieldLabelsActionForUpdate(url, errorMessage, successMessage, dispatch);\r\n };\r\n\r\nexport const CloneFieldLabels =\r\n (fromCompanyId: number, toCompanyId: number, cloneOption: string) =>\r\n (dispatch: Dispatch): Promise => {\r\n const url =\r\n \"/field/CloneFieldLabels?\" +\r\n h.serialize({\r\n fromCompanyId,\r\n toCompanyId,\r\n cloneOption,\r\n });\r\n\r\n const errorMessage = \"There was an issue with cloning field labels.\";\r\n\r\n return fetch(url, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const response = data as unknown as { success: boolean; error: string };\r\n if (!response.success) {\r\n h.error(response.error);\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(notifyError(errorMessage));\r\n h.error(errorMessage, error);\r\n });\r\n };\r\n","import h from \"../helpers\";\r\nimport copy from \"copy-to-clipboard\";\r\nimport { setVar, setVarPersist } from \"./actionCreators\";\r\nimport {\r\n flowRelatedRequestStart,\r\n flowRelatedRequestCompleted,\r\n treeRequestStart,\r\n treeRequestCompleted,\r\n} from \"./loadingActions\";\r\nimport { ToggleIsLayoutTreeLoading } from \"./treeBehaviorActions\";\r\nimport { IScriptObject, ILoadScriptObjects, ILoadUIDBScriptObjects } from \"../types/stores/vars\";\r\nimport { request } from \"../helpers/httpInterceptor\";\r\nimport {\r\n FieldRateByFieldId,\r\n TaxmanFieldRateByFieldId,\r\n FieldDistributionCountsById,\r\n LoadEnabledFieldLabelsAction,\r\n LoadEnabledFieldLabelsAction3,\r\n LoadEnabledFieldVisibilityTypesAction,\r\n LoadFieldRatesAction,\r\n LoadTaxmanFieldRatesAction,\r\n LoadFieldDistributionCountsAction,\r\n LOAD_FIELD_RATES,\r\n LOAD_TAXMAN_FIELD_RATES,\r\n LOAD_DISTRIBUTION_COUNTS,\r\n} from \"../types/stores/fieldsByCompany\";\r\n\r\nif (!top.RDX) {\r\n top.RDX = {};\r\n}\r\n\r\nlet _fieldsLastLoadedByTable = {};\r\nlet _haveTablesChanged = true;\r\nlet _lastTablesChangedDate = Date.parse(\"2000-01-25T10:18:18Z\");\r\n\r\nexport const requestScriptObjects = scriptType => dispatch => {\r\n let url = `/Scripts/GetFullScriptAccess?scriptType=${scriptType}`;\r\n dispatch(incAjaxCount());\r\n dispatch(flowRelatedRequestStart());\r\n dispatch(treeRequestStart());\r\n dispatch(ToggleIsLayoutTreeLoading(true));\r\n return request(\r\n url,\r\n {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n dispatch(flowRelatedRequestCompleted());\r\n dispatch(treeRequestCompleted());\r\n dispatch(ToggleIsLayoutTreeLoading(false));\r\n\r\n if (data.results) {\r\n if (scriptType == 0) {\r\n dispatch(loadScriptObjects(data.results));\r\n } else {\r\n dispatch(loadUIDBScriptObjects(data.results));\r\n }\r\n } else {\r\n throw new Error(\"Couldn't load script objects.\");\r\n }\r\n\r\n //TODO123 checksum work\r\n // if (data.checksum) {\r\n // dispatch(setVarPersist(\"scriptObjsChecksum\", data.checksum));\r\n // } else {\r\n // throw new Error(\"Couldn't load script objects checksum.\");\r\n // }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n dispatch(flowRelatedRequestCompleted());\r\n dispatch(treeRequestCompleted());\r\n dispatch(ToggleIsLayoutTreeLoading(false));\r\n\r\n h.error(\"Error loading script objects.\", error);\r\n });\r\n};\r\ntop.RDX.requestScriptObjects = () => top.store.dispatch(requestScriptObjects());\r\n\r\nexport const searchColumns = filter => dispatch => {\r\n let url = `/Scripts/SearchColumns/${filter}`;\r\n\r\n dispatch(incAjaxCount());\r\n dispatch(flowRelatedRequestStart());\r\n dispatch(treeRequestStart());\r\n dispatch(ToggleIsLayoutTreeLoading(true));\r\n\r\n return request(\r\n url,\r\n {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n dispatch(flowRelatedRequestCompleted());\r\n dispatch(treeRequestCompleted());\r\n dispatch(ToggleIsLayoutTreeLoading(false));\r\n\r\n if (data.columns) {\r\n dispatch(loadScriptObjects(data.columns));\r\n } else {\r\n throw new Error(\"Couldn't load script objects.\");\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n dispatch(flowRelatedRequestCompleted());\r\n dispatch(treeRequestCompleted());\r\n dispatch(ToggleIsLayoutTreeLoading(false));\r\n\r\n h.error(\"Error loading script objects.\", error);\r\n });\r\n};\r\ntop.RDX.searchColumns = () => top.store.dispatch(searchColumns());\r\n\r\nexport const requestAudienceCounts = companyId => dispatch => {\r\n let url = \"/api/audiencecounts/GetAudienceCounts?companyId=\" + companyId;\r\n return request(url, { credentials: \"same-origin\" }, dispatch)\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data.audiencecounts) {\r\n dispatch(loadFieldDistributionCounts(data.audiencecounts));\r\n } else {\r\n throw new Error(\"Couldn't load Audience Counts.\");\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading Audience Counts.\", error);\r\n });\r\n};\r\ntop.RDX.requestAudienceCounts = companyId => top.store.dispatch(requestAudienceCounts(companyId));\r\n\r\nexport const requestFieldTreeLastUpdated = tableKey => async dispatch => {\r\n let urlDates = \"/Tree/FieldTablesLastUpdated\";\r\n try {\r\n const response = await request(urlDates, { credentials: \"same-origin\" }, dispatch);\r\n const response1 = await h.checkStatus(response);\r\n const data = await h.toJson(response1);\r\n if (data) {\r\n let highestDate = Date.parse(data[0].DateUpdated);\r\n if (highestDate > _lastTablesChangedDate) {\r\n _lastTablesChangedDate = highestDate;\r\n _haveTablesChanged = true;\r\n dispatch(requestFieldTree(tableKey));\r\n } else {\r\n _haveTablesChanged = false;\r\n }\r\n }\r\n } catch (error) {\r\n h.error(\"Error loading field tree Last Updated.\", error);\r\n }\r\n};\r\ntop.RDX.requestFieldTreeLastUpdated = tableKey => top.store.dispatch(requestFieldTreeLastUpdated(tableKey));\r\n\r\n// tableKey - an optional tableKey to load fields for\r\nexport const requestFieldTree =\r\n (tableKey, dontRequestAgainMinutes = 0) =>\r\n (dispatch, getState) => {\r\n const state = getState();\r\n const features = state.session.enabledFeatures || [];\r\n const enhancedFiledLoading = features.includes(\"use-enhanced-field-loading\");\r\n const useFieldTreeTabs = features.includes(\"field-tree-tabs\");\r\n if (enhancedFiledLoading) {\r\n dispatch(requestFieldTreeLastUpdated(tableKey));\r\n if (!_haveTablesChanged) {\r\n return;\r\n }\r\n }\r\n let url = \"/Tree/Combined\";\r\n if (tableKey) {\r\n url += \"/\" + tableKey;\r\n }\r\n tableKey = tableKey || 0;\r\n const lastLoadedTableKey = state.vars.fieldTreeLastTableKeyLoaded || 0;\r\n const companyId = getState().session.companyId;\r\n\r\n // Optional Parameter: If dontRequestAgainMinutes = 5, then don't do any requests if we\r\n // asked for the field tree in the last five minutes.\r\n // Also, if table key is changing, then ignore this.\r\n const localCachedValueExists =\r\n _fieldsLastLoadedByTable[tableKey] != null &&\r\n dateDiffMinutes(_fieldsLastLoadedByTable[tableKey], new Date()) < dontRequestAgainMinutes;\r\n const tableKeyChanged = tableKey != lastLoadedTableKey;\r\n if (!tableKeyChanged && localCachedValueExists) {\r\n return;\r\n }\r\n _fieldsLastLoadedByTable[tableKey] = new Date();\r\n\r\n dispatch(incAjaxCount());\r\n dispatch(flowRelatedRequestStart());\r\n dispatch(treeRequestStart());\r\n dispatch(ToggleIsLayoutTreeLoading(true));\r\n return request(url, { credentials: \"same-origin\" }, dispatch)\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n dispatch(flowRelatedRequestCompleted());\r\n dispatch(treeRequestCompleted());\r\n dispatch(ToggleIsLayoutTreeLoading(false));\r\n\r\n if (data.fields) {\r\n dispatch(loadFields(data.fields, tableKey));\r\n if (useFieldTreeTabs) {\r\n dispatch(setTreeTabs(data.fieldsExperian, data.fieldsMarketplace, data.fieldsMyData));\r\n }\r\n if (data.enabledFieldLabels) {\r\n dispatch(loadEnabledFieldLabels(data.enabledFieldLabels));\r\n }\r\n if (data.enabledFieldLabels3) {\r\n dispatch(loadEnabledFieldLabels3(data.enabledFieldLabels3));\r\n }\r\n if (data.enabledFieldVisibilityTypes) {\r\n dispatch(loadEnabledFieldVisibilityTypes(data.enabledFieldVisibilityTypes));\r\n }\r\n if (data.visibleFieldByCompanyUsers) {\r\n dispatch(loadVisibilityByCompanyUsers(data.visibleFieldByCompanyUsers));\r\n }\r\n if (data.fieldRates) {\r\n dispatch(loadFieldRates(data.fieldRates));\r\n }\r\n if (data.taxmanFieldRates) {\r\n dispatch(loadTaxmanFieldRates(data.taxmanFieldRates));\r\n }\r\n\r\n const getDistributionCounts = features.includes(\"display-distribution-counts\");\r\n\r\n if (getDistributionCounts) {\r\n dispatch(requestAudienceCounts(companyId));\r\n }\r\n } else {\r\n throw new Error(\"Couldn't load fields.\");\r\n }\r\n if (data.checksum) {\r\n dispatch(setVarPersist(\"fieldsChecksum\", data.checksum));\r\n } else {\r\n throw new Error(\"Couldn't load fields checksum.\");\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n dispatch(flowRelatedRequestCompleted());\r\n dispatch(treeRequestCompleted());\r\n dispatch(ToggleIsLayoutTreeLoading(false));\r\n\r\n h.error(\"Error loading field tree.\", error);\r\n });\r\n };\r\ntop.RDX.requestFieldTree = tableKey => top.store.dispatch(requestFieldTree(tableKey));\r\n\r\nexport const requestCompanyFieldTree = companyId => dispatch => {\r\n let url = \"/Tree/CompanyCombined/\" + companyId;\r\n dispatch(incAjaxCount());\r\n dispatch(treeRequestStart());\r\n\r\n return request(url, { credentials: \"same-origin\" }, dispatch)\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n dispatch(treeRequestCompleted());\r\n\r\n if (data.fields) {\r\n dispatch(loadFields(data.fields, 0));\r\n if (data.enabledFieldLabels) {\r\n dispatch(loadEnabledFieldLabels(data.enabledFieldLabels));\r\n }\r\n if (data.enabledFieldLabels3) {\r\n dispatch(loadEnabledFieldLabels3(data.enabledFieldLabels3));\r\n }\r\n if (data.enabledFieldVisibilityTypes) {\r\n dispatch(loadEnabledFieldVisibilityTypes(data.enabledFieldVisibilityTypes));\r\n }\r\n if (data.visibleFieldByCompanyUsers) {\r\n dispatch(loadVisibilityByCompanyUsers(data.visibleFieldByCompanyUsers));\r\n }\r\n if (data.fieldRates) {\r\n dispatch(loadFieldRates(data.fieldRates));\r\n }\r\n if (data.taxmanFieldRates) {\r\n dispatch(loadTaxmanFieldRates(data.taxmanFieldRates));\r\n }\r\n } else {\r\n throw new Error(\"Couldn't load fields.\");\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n dispatch(treeRequestCompleted());\r\n\r\n h.error(\"Error loading company field tree.\", error);\r\n });\r\n};\r\n\r\n// This is a way to use requestFieldTree(), but if we don't know which tableKey we 'should'\r\n// be looking at, we will use the last tableKey that was used for a fieldTree request\r\n// example:\r\n// User selects a table with - and we load fields for TableKey = 39\r\n// Server needs to tell the client to update Fields, but it can't run requestFieldTree,\r\n// because that would load fields for TableKey = 0.\r\n// Server calls this instead, which finds TableKey=39 in the state, automatically set by\r\n// the vars reducer, and updates fields for tablekey=39.\r\nexport const requestFieldTreeForLastTablekeyUsed = () => (dispatch, getState) => {\r\n const state = getState();\r\n const tableKey = state.vars.fieldTreeLastTableKeyLoaded || 0;\r\n dispatch(requestFieldTree(tableKey));\r\n};\r\ntop.RDX.requestFieldTreeForLastTablekeyUsed = () => top.store.dispatch(requestFieldTreeForLastTablekeyUsed());\r\n\r\nexport const requestFieldTreeSetTableImmediately = tableKey => dispatch => {\r\n dispatch(setTableKey(tableKey)); //Setting immediately prevents Tree/Combined from being called multiple times from CreateFlowApp\r\n dispatch(requestFieldTree(tableKey));\r\n};\r\ntop.RDX.requestFieldTreeSetTableImmediately = tableKey =>\r\n top.store.dispatch(requestFieldTreeSetTableImmediately(tableKey));\r\n\r\n// Special version of Tree for Edit Fields page\r\nexport const requestEditFieldTree =\r\n (isBulkAction = 0) =>\r\n (dispatch, getState) => {\r\n const url = `/Tree/Combined?editFields=1&isBulkAction=${isBulkAction}`;\r\n const state = getState();\r\n const features = state.session.enabledFeatures || [];\r\n const useFieldTreeTabs = features.includes(\"field-tree-tabs\");\r\n dispatch(incAjaxCount());\r\n return (\r\n request(url, { credentials: \"same-origin\" }, dispatch)\r\n /* eslint-disable no-console */\r\n .then(h.checkStatus)\r\n .then(console.log(\"Tree/Combined:checkStatus\" + Date().toLocaleString() + \"\"))\r\n .then(h.toJson)\r\n .then(console.log(\"Tree/Combined:toJson\" + Date().toLocaleString() + \"\"))\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n if (data.fields) {\r\n dispatch(loadFields(data.fields, 0));\r\n if (useFieldTreeTabs) {\r\n dispatch(\r\n setTreeTabs(\r\n data.fieldsExperian,\r\n data.fieldsMarketplace,\r\n data.fieldsMyData,\r\n data.fieldsOther\r\n )\r\n );\r\n }\r\n if (data.enabledFieldLabels) {\r\n dispatch(loadEnabledFieldLabels(data.enabledFieldLabels));\r\n }\r\n if (data.enabledFieldVisibilityTypes) {\r\n dispatch(loadEnabledFieldVisibilityTypes(data.enabledFieldVisibilityTypes));\r\n }\r\n if (data.visibleFieldByCompanyUsers) {\r\n dispatch(loadVisibilityByCompanyUsers(data.visibleFieldByCompanyUsers));\r\n }\r\n if (isBulkAction == 0) {\r\n if (data.enabledFieldLabels3) {\r\n dispatch(loadEnabledFieldLabels3(data.enabledFieldLabels3));\r\n }\r\n if (data.fieldRates) {\r\n dispatch(loadFieldRates(data.fieldRates));\r\n }\r\n if (data.taxmanFieldRates) {\r\n dispatch(loadTaxmanFieldRates(data.taxmanFieldRates));\r\n }\r\n }\r\n } else {\r\n throw new Error(\"Couldn't load fields.\");\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading field tree.\", error);\r\n dispatch(decAjaxCount());\r\n })\r\n );\r\n };\r\ntop.RDX.requestEditFieldTree = () => top.store.dispatch(requestEditFieldTree());\r\n\r\nexport const requestEditLayoutFieldTree = () => dispatch => {\r\n const url = \"/Tree/LayoutCombined?editFields=1\";\r\n return (\r\n request(url, { credentials: \"same-origin\" }, dispatch)\r\n /* eslint-disable no-console */\r\n .then(h.checkStatus)\r\n .then(console.log(\"LayoutCombined:checkStatus\" + Date().toLocaleString() + \"\"))\r\n .then(h.toJson)\r\n .then(console.log(\"LayoutCombined:toJson\" + Date().toLocaleString() + \"\"))\r\n .then(data => {\r\n if (data.fields) {\r\n dispatch(loadLayoutFields(data.fields));\r\n } else {\r\n throw new Error(\"Couldn't layout load fields.\");\r\n }\r\n if (data.enabledFieldVisibilityTypes) {\r\n dispatch(loadEnabledFieldVisibilityTypes(data.enabledFieldVisibilityTypes));\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading layout field tree.\", error);\r\n })\r\n );\r\n};\r\ntop.RDX.requestEditLayoutFieldTree = () => top.store.dispatch(requestEditLayoutFieldTree());\r\n\r\nexport const requestEditReportFieldTree = () => dispatch => {\r\n const url = \"/Tree/ReportCombined?editFields=1\";\r\n return request(url, { credentials: \"same-origin\" }, dispatch)\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data.fields) {\r\n dispatch(loadReportFields(data.fields));\r\n } else {\r\n throw new Error(\"Couldn't report load fields.\");\r\n }\r\n if (data.enabledFieldVisibilityTypes) {\r\n dispatch(loadEnabledFieldVisibilityTypes(data.enabledFieldVisibilityTypes));\r\n }\r\n if (data.fieldRates) {\r\n dispatch(loadFieldRates(data.fieldRates));\r\n }\r\n if (data.taxmanFieldRates) {\r\n dispatch(loadTaxmanFieldRates(data.taxmanFieldRates));\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading report field tree.\", error);\r\n });\r\n};\r\ntop.RDX.requestEditReportFieldTree = () => top.store.dispatch(requestEditReportFieldTree());\r\n\r\nexport const requestEnabledFieldCompanies = () => dispatch => {\r\n const url = \"/Field/GetEnabledFieldCompanies\";\r\n dispatch(incAjaxCount());\r\n return request(\r\n url,\r\n {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(loadEnabledFieldCompanies(data.fieldCompanies));\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading field companies.\", error);\r\n dispatch(decAjaxCount());\r\n });\r\n};\r\n\r\nexport const loadEnabledFieldLabels = (enabledFieldLabels): LoadEnabledFieldLabelsAction => ({\r\n type: \"LOAD_ENABLED_FIELD_LABELS\",\r\n enabledFieldLabels,\r\n});\r\n\r\nexport const loadEnabledFieldLabels3 = (enabledFieldLabels3): LoadEnabledFieldLabelsAction3 => ({\r\n type: \"LOAD_ENABLED_FIELD_LABELS3\",\r\n enabledFieldLabels3,\r\n});\r\n\r\nexport const loadEnabledFieldVisibilityTypes = (\r\n enabledFieldVisibilityTypes\r\n): LoadEnabledFieldVisibilityTypesAction => ({\r\n type: \"LOAD_ENABLED_FIELD_VISIBILITY_TYPES\",\r\n enabledFieldVisibilityTypes,\r\n});\r\n\r\nexport const loadEnabledFieldCompanies = enabledFieldCompanies => ({\r\n type: \"LOAD_ENABLED_FIELD_COMPANIES\",\r\n enabledFieldCompanies,\r\n});\r\n\r\nexport const loadVisibilityByCompanyUsers = visibilityByCompanyUsers => ({\r\n type: \"LOAD_VISIBILITY_COMPANY_USERS\",\r\n visibilityByCompanyUsers,\r\n});\r\n\r\nexport const loadFieldRates = (fieldRates: FieldRateByFieldId): LoadFieldRatesAction => ({\r\n type: LOAD_FIELD_RATES,\r\n fieldRates,\r\n});\r\n\r\nexport const loadTaxmanFieldRates = (taxmanFieldRates: TaxmanFieldRateByFieldId): LoadTaxmanFieldRatesAction => ({\r\n type: LOAD_TAXMAN_FIELD_RATES,\r\n taxmanFieldRates,\r\n});\r\n\r\nexport const loadFieldDistributionCounts = (\r\n fieldDistributionCounts: FieldDistributionCountsById\r\n): LoadFieldDistributionCountsAction => ({\r\n type: LOAD_DISTRIBUTION_COUNTS,\r\n fieldDistributionCounts,\r\n});\r\n\r\nexport const setTableKey = (tableKey = 0) => ({\r\n type: \"SET_LAST_TABLEKEY\",\r\n tableKey,\r\n});\r\ntop.RDX.setTableKey = tableKey => top.store.dispatch(setTableKey(tableKey));\r\n\r\nexport const requestFieldTreeIfNeeded = () => (dispatch, getState) => {\r\n const state = getState();\r\n if (state.fields == null || state.fields.byId == null || Object.keys(state.fields.byId).length == 0) {\r\n dispatch(requestFieldTreeForLastTablekeyUsed());\r\n }\r\n};\r\nexport const loadScriptObjects = (objects: Array): ILoadScriptObjects => ({\r\n type: \"LOAD_SCRIPT_OBJECTS\",\r\n objects,\r\n});\r\ntop.RDX.loadScriptObjects = objects => top.store.dispatch(loadScriptObjects(objects));\r\n\r\nexport const loadUIDBScriptObjects = (objects: Array): ILoadUIDBScriptObjects => ({\r\n type: \"LOAD_UIDB_SCRIPT_OBJECTS\",\r\n objects,\r\n});\r\ntop.RDX.loadUIDBScriptObjects = objects => top.store.dispatch(loadUIDBScriptObjects(objects));\r\n\r\nexport const loadFields =\r\n (fields, tableKey = 0) =>\r\n dispatch => {\r\n dispatch({\r\n type: \"LOAD_FIELDS\",\r\n fields,\r\n tableKey,\r\n });\r\n };\r\ntop.RDX.loadFields = (fields, tableKey) => top.store.dispatch(loadFields(fields, tableKey));\r\n\r\nexport const setTreeTabs =\r\n (fieldsExperian, fieldsMarketplace, fieldsMyData, fieldsOther = false) =>\r\n dispatch => {\r\n dispatch({\r\n type: \"SET_FIELD_TAB_PERMISSIONS\",\r\n fieldsExperian,\r\n fieldsMarketplace,\r\n fieldsMyData,\r\n fieldsOther,\r\n });\r\n };\r\ntop.RDX.setTreeTabs = (fieldsExperian, fieldsMarketplace, fieldsMyData, fieldsOther) =>\r\n top.store.dispatch(setTreeTabs(fieldsExperian, fieldsMarketplace, fieldsMyData, fieldsOther));\r\n\r\nexport const requestReportFieldTree = () => dispatch => {\r\n dispatch(ToggleIsLayoutTreeLoading(true));\r\n const url = \"/Tree/ReportCombined\";\r\n return fetch(url, { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(ToggleIsLayoutTreeLoading(false));\r\n\r\n if (data.fields) {\r\n dispatch(loadReportFields(data.fields));\r\n } else {\r\n throw new Error(\"Couldn't report load fields.\");\r\n }\r\n if (data.checksum) {\r\n dispatch(setVar(\"reportFieldsChecksum\", data.checksum));\r\n } else {\r\n throw new Error(\"Couldn't load report fields checksum.\");\r\n }\r\n if (data.enabledFieldVisibilityTypes) {\r\n dispatch(loadEnabledFieldVisibilityTypes(data.enabledFieldVisibilityTypes));\r\n }\r\n if (data.fieldRates) {\r\n dispatch(loadFieldRates(data.fieldRates));\r\n }\r\n if (data.taxmanFieldRates) {\r\n dispatch(loadTaxmanFieldRates(data.taxmanFieldRates));\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(ToggleIsLayoutTreeLoading(false));\r\n h.error(\"Error loading report field tree.\", error);\r\n });\r\n};\r\ntop.RDX.requestReportFieldTree = () => top.store.dispatch(requestReportFieldTree());\r\n\r\nexport const requestLayoutFieldTree =\r\n () =>\r\n dispatch => {\r\n dispatch(ToggleIsLayoutTreeLoading(true));\r\n const url = `/Tree/LayoutCombined?editFields=0&experianOnly=0`;\r\n return (\r\n fetch(url, { credentials: \"same-origin\" })\r\n /* eslint-disable no-console */\r\n .then(h.checkStatus)\r\n .then(\r\n console.log(\r\n \"LayoutCombinededitFields=0&experianOnly=0:checkStatus\" +\r\n Date().toLocaleString() +\r\n \"\"\r\n )\r\n )\r\n .then(h.toJson)\r\n .then(\r\n console.log(\r\n \"LayoutCombinededitFields=0&experianOnly=0:toJson\" + Date().toLocaleString() + \"\"\r\n )\r\n )\r\n .then(data => {\r\n dispatch(ToggleIsLayoutTreeLoading(false));\r\n\r\n if (data.fields) {\r\n dispatch(loadLayoutFields(data.fields));\r\n } else {\r\n throw new Error(\"Couldn't layout load fields.\");\r\n }\r\n if (data.checksum) {\r\n dispatch(setVar(\"layoutFieldsChecksum\", data.checksum));\r\n } else {\r\n throw new Error(\"Couldn't load layout fields checksum.\");\r\n }\r\n if (data.enabledFieldVisibilityTypes) {\r\n dispatch(loadEnabledFieldVisibilityTypes(data.enabledFieldVisibilityTypes));\r\n }\r\n if (data.fieldRates) {\r\n dispatch(loadFieldRates(data.fieldRates));\r\n }\r\n if (data.taxmanFieldRates) {\r\n dispatch(loadTaxmanFieldRates(data.taxmanFieldRates));\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(ToggleIsLayoutTreeLoading(false));\r\n h.error(\"Error loading layout field tree.\", error);\r\n })\r\n );\r\n };\r\ntop.RDX.requestLayoutFieldTree = () => top.store.dispatch(requestLayoutFieldTree());\r\n\r\nexport const requestLayoutExperianFieldTree = () => dispatch => {\r\n dispatch(ToggleIsLayoutTreeLoading(true));\r\n const url = \"/Tree/LayoutCombined?editFields=0&experianOnly=1\";\r\n return (\r\n fetch(url, { credentials: \"same-origin\" })\r\n /* eslint-disable no-console */\r\n .then(h.checkStatus)\r\n .then(console.log(\"LayoutCombinededitFields=0&experianOnly=1:checkStatus\" + Date().toLocaleString() + \"\"))\r\n .then(h.toJson)\r\n .then(console.log(\"LayoutCombinededitFields=0&experianOnly=1:toJson\" + Date().toLocaleString() + \"\"))\r\n .then(data => {\r\n dispatch(ToggleIsLayoutTreeLoading(false));\r\n\r\n if (data.fields) {\r\n dispatch(loadLayoutFields(data.fields));\r\n } else {\r\n throw new Error(\"Couldn't load Experian layout fields.\");\r\n }\r\n if (data.checksum) {\r\n dispatch(setVar(\"layoutFieldsChecksum\", data.checksum));\r\n } else {\r\n throw new Error(\"Couldn't load Experian layout fields checksum.\");\r\n }\r\n if (data.fieldRates) {\r\n dispatch(loadFieldRates(data.fieldRates));\r\n }\r\n if (data.taxmanFieldRates) {\r\n dispatch(loadTaxmanFieldRates(data.taxmanFieldRates));\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(ToggleIsLayoutTreeLoading(false));\r\n h.error(\"Error loading Experian layout field tree.\", error);\r\n })\r\n );\r\n};\r\ntop.RDX.requestLayoutExperianFieldTree = () => top.store.dispatch(requestLayoutExperianFieldTree());\r\n\r\nexport const requestFullFieldTree = () => dispatch => {\r\n dispatch(ToggleIsLayoutTreeLoading(true));\r\n const url = \"/Tree/FullFieldTree\";\r\n return fetch(url, { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(ToggleIsLayoutTreeLoading(false));\r\n if (data) {\r\n dispatch(loadFields(data, 0));\r\n } else {\r\n throw new Error(\"Couldn't load full field tree.\");\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(ToggleIsLayoutTreeLoading(false));\r\n h.error(\"Error loading full field tree.\", error);\r\n });\r\n};\r\ntop.RDX.requestFullFieldTree = () => top.store.dispatch(requestFullFieldTree());\r\n\r\nexport const loadLayoutFields = layoutfields => ({\r\n type: \"LOAD_LAYOUT_FIELDS\",\r\n layoutfields,\r\n});\r\ntop.RDX.loadLayoutFields = reportFields => top.store.dispatch(loadLayoutFields(reportFields));\r\n\r\nexport const loadReportFields = reportFields => ({\r\n type: \"LOAD_REPORT_FIELDS\",\r\n reportFields,\r\n});\r\ntop.RDX.loadReportFields = reportFields => top.store.dispatch(loadReportFields(reportFields));\r\n\r\nexport const copytoClip = fieldKey => (dispatch, getState) => {\r\n const state = getState();\r\n if (!state.fields || !state.fields.byId) {\r\n console.warn(\"copytoClip: Fields aren't loaded.\"); // eslint-disable-line no-console\r\n return;\r\n }\r\n let copytxt = state.fields.byId[fieldKey].text;\r\n if (state.fields.byId[fieldKey].leaf_description != null) {\r\n copytxt += \" - \" + state.fields.byId[fieldKey].leaf_description;\r\n }\r\n copy(copytxt);\r\n};\r\n\r\n// QueryBuilder specific - add a selected value to the \"fieldData\" from the fieldtree\r\nconst addSelectedValuesToFieldData = (fieldData: string, selectedValues: any) => {\r\n if (selectedValues == null) {\r\n return fieldData;\r\n }\r\n const parsedData = JSON.parse(fieldData.replace(/'/g, '\"'));\r\n const selected = { value: selectedValues };\r\n return JSON.stringify({ rules: [Object.assign(parsedData.rules[0], selected)] });\r\n};\r\n\r\n/*\r\nfield example:\r\ncompanyid : 0\r\ncreated_dt : \"2017-01-18T09:36:39.413\"\r\ndata : \"{'rules':[{'id':'10079','operator':'in'}]}\"\r\ndetail_description : null\r\nfieldkey : 10079\r\nid : 10079\r\nisLeaf : true\r\nleaf_description : \"Likelihood to purchase a new vehicle\"\r\nparent : \"14\"\r\nsort : 5\r\nsourcekey : 23\r\ntext : \"New Vehicle (A300)\"\r\ntype : \"detail\"\r\nviewid : 4\r\n*/\r\n\r\nexport const setSelectedField = fieldKey => ({\r\n type: \"SET_SELECTED_FIELD\",\r\n fieldKey,\r\n});\r\nexport const clearSelectedField = () => ({\r\n type: \"CLEAR_SELECTED_FIELD\",\r\n});\r\nexport const setSelectedFields = fieldKey => ({\r\n type: \"SET_SELECTED_FIELDS\",\r\n fieldKey,\r\n});\r\nexport const clearSelectedFields = () => ({\r\n type: \"CLEAR_SELECTED_FIELDS\",\r\n});\r\nexport const setEditFolder = isEditFolder => ({\r\n type: SET_PROPERTY,\r\n property: AdminDesignerProperties.isEditFolder,\r\n newValue: isEditFolder,\r\n});\r\n\r\nexport const setAddField = isAddField => ({\r\n type: SET_PROPERTY,\r\n property: AdminDesignerProperties.isAddField,\r\n newValue: isAddField,\r\n});\r\nexport const addTempField = field => ({\r\n type: \"ADD_TEMP_FIELD\",\r\n field,\r\n});\r\n\r\n// ========================================================\r\nconst _filtersLastLoadedByCompany = {};\r\nimport { dateDiffMinutes, incAjaxCount, decAjaxCount } from \"./actionCreators\";\r\n\r\nexport const requestFilterTree =\r\n (force: boolean = false) =>\r\n (dispatch, getState) => {\r\n const companyId = getState().session.companyId;\r\n if (\r\n !force &&\r\n _filtersLastLoadedByCompany[companyId] != null &&\r\n dateDiffMinutes(_filtersLastLoadedByCompany[companyId], new Date()) < 30\r\n ) {\r\n return;\r\n }\r\n\r\n const url = \"/Tree/Filters\";\r\n return fetch(url, { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data.filters) {\r\n dispatch(loadFilters(data.filters));\r\n _filtersLastLoadedByCompany[companyId] = new Date();\r\n } else {\r\n throw new Error(\"Couldn't load filters.\");\r\n }\r\n if (data.checksum) {\r\n dispatch(setVarPersist(\"filtersChecksum\", data.checksum));\r\n } else {\r\n throw new Error(\"Couldn't load filters checksum.\");\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading filters.\", error);\r\n });\r\n };\r\ntop.RDX.requestFilterTree = (force = false) => top.store.dispatch(requestFilterTree(force));\r\n\r\nexport const loadFilters = filters => ({\r\n type: \"LOAD_FILTERS\",\r\n filters,\r\n});\r\ntop.RDX.loadFilters = filters => top.store.dispatch(loadFilters(filters));\r\n\r\nexport const requestNewFieldFolder =\r\n (parentId, folderName = \"New Folder\") =>\r\n dispatch => {\r\n if (!parentId) {\r\n return;\r\n }\r\n\r\n // Update database\r\n const url = `/Field/CreateNewFieldFolder?parentId=${parentId}&folderName=${folderName}`;\r\n dispatch(incAjaxCount());\r\n return (\r\n fetch(url, {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n })\r\n /* eslint-disable no-console */\r\n .then(h.checkStatus)\r\n .then(console.log(\"CreateNewFieldFolder:checkStatus\" + Date().toLocaleString() + \"\"))\r\n .then(h.toJson)\r\n .then(console.log(\"CreateNewFieldFolder:toJson\" + Date().toLocaleString() + \"\"))\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n if (data.folderId > 0) {\r\n // Reload Fields\r\n dispatch(requestEditFieldTree());\r\n dispatch(requestEditLayoutFieldTree());\r\n // set the new folder to renaming state\r\n dispatch(startRenamingFieldFolder(data.folderId));\r\n } else {\r\n h.error(\"Error creating new folder.\");\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error creating new folder.\", error);\r\n })\r\n );\r\n };\r\ntop.RDX.requestNewFieldFolder = (parentId, folderName) =>\r\n top.store.dispatch(requestNewFieldFolder(parentId, folderName));\r\n\r\nexport const requestRenameFieldFolder = (folderId, newFolderName) => dispatch => {\r\n if (!folderId || !newFolderName || newFolderName == \"\") {\r\n return;\r\n }\r\n\r\n // Update database\r\n const url = `/Field/RenameFieldFolder?folderId=${folderId}&newFolderName=${newFolderName}`;\r\n dispatch(incAjaxCount());\r\n return (\r\n fetch(url, {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n })\r\n /* eslint-disable no-console */\r\n .then(h.checkStatus)\r\n .then(console.log(\"RenameFieldFolder:checkStatus\" + Date().toLocaleString() + \"\"))\r\n .then(h.toJson)\r\n .then(console.log(\"RenameFieldFolder:toJson\" + Date().toLocaleString() + \"\"))\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n if (data.success) {\r\n // Update state\r\n dispatch(renameFieldFolder(folderId, newFolderName));\r\n // clear renaming state\r\n dispatch(stopRenamingFieldFolder(folderId));\r\n } else {\r\n h.error(\"Error renaming folder.\");\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error renaming folder.\", error);\r\n dispatch(decAjaxCount());\r\n })\r\n );\r\n};\r\ntop.RDX.requestRenameFieldFolder = (folderId, newFolderName) =>\r\n top.store.dispatch(requestRenameFieldFolder(folderId, newFolderName));\r\n\r\nexport const requestDeleteFieldFolder = folderId => dispatch => {\r\n if (!folderId) {\r\n return;\r\n }\r\n\r\n // Update database\r\n const url = `/Field/DeleteFieldFolder?folderId=${folderId}`;\r\n dispatch(incAjaxCount());\r\n return (\r\n fetch(url, {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n })\r\n /* eslint-disable no-console */\r\n .then(h.checkStatus)\r\n .then(console.log(\"DeleteFieldFolder:checkStatus\" + Date().toLocaleString() + \"\"))\r\n .then(h.toJson)\r\n .then(console.log(\"DeleteFieldFolder:toJson\" + Date().toLocaleString() + \"\"))\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n if (data.success) {\r\n // Update state\r\n //dispatch(deleteFieldFolder(folderId));\r\n // Reload tree\r\n dispatch(requestEditFieldTree());\r\n dispatch(requestEditLayoutFieldTree());\r\n } else {\r\n h.error(\"Error deleting folder.\");\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error deleting folder.\", error);\r\n dispatch(decAjaxCount());\r\n })\r\n );\r\n};\r\ntop.RDX.requestDeleteFieldFolder = folderId => top.store.dispatch(requestDeleteFieldFolder(folderId));\r\n\r\nexport const requestMoveFieldToFolder = (fieldId, newFolderId) => dispatch => {\r\n if (!fieldId || !newFolderId) {\r\n return;\r\n }\r\n\r\n // Update database\r\n const url = `/Field/UpdateFieldParentFolder?fieldId=${fieldId}&newFolderId=${newFolderId}`;\r\n dispatch(incAjaxCount());\r\n return fetch(url, {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n if (data.success) {\r\n dispatch(requestEditFieldTree());\r\n dispatch(requestEditLayoutFieldTree());\r\n // Update state\r\n dispatch(moveFieldToFolder(fieldId, newFolderId));\r\n } else {\r\n h.error(\"Error moving field.\");\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error moving field.\", error);\r\n });\r\n};\r\ntop.RDX.requestMoveFieldToFolder = (fieldId, newFolderId) =>\r\n top.store.dispatch(requestMoveFieldToFolder(fieldId, newFolderId));\r\n\r\nexport const requestMoveFieldsToFolder = (selectedFields, newFolderId) => dispatch => {\r\n if (!selectedFields || selectedFields.length == 0 || !newFolderId) {\r\n return;\r\n }\r\n\r\n dispatch(incAjaxCount());\r\n return fetch(`/Field/UpdateFieldsParentFolder`, {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n body: JSON.stringify({ selectedFields, newFolderId }),\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n if (data.success) {\r\n dispatch(requestEditFieldTree());\r\n dispatch(requestEditLayoutFieldTree());\r\n // Update state\r\n dispatch(moveFieldsToFolder(selectedFields, newFolderId));\r\n } else {\r\n h.error(\"Error moving fields.\");\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error moving fields.\", error);\r\n });\r\n};\r\ntop.RDX.requestMoveFieldTsoFolder = (selectedFields, newFolderId) =>\r\n top.store.dispatch(requestMoveFieldsToFolder(selectedFields, newFolderId));\r\n\r\n// In the UI, mark a folder as being renamed\r\nexport const startRenamingFieldFolder = folderId => ({\r\n type: \"START_RENAMING_FIELD_FOLDER\",\r\n folderId,\r\n});\r\n\r\n// Stop renaming folder\r\nexport const stopRenamingFieldFolder = folderId => ({\r\n type: \"STOP_RENAMING_FIELD_FOLDER\",\r\n folderId,\r\n});\r\n\r\nexport const renameFieldFolder = (folderId, newFolderName) => ({\r\n type: \"RENAME_FIELD_FOLDER\",\r\n folderId,\r\n newFolderName,\r\n});\r\n\r\nexport const moveFieldToFolder = (fieldId, newFolderId) => ({\r\n type: \"MOVE_FIELD_TO_FOLDER\",\r\n fieldId,\r\n newFolderId,\r\n});\r\n\r\nexport const moveFieldsToFolder = (fieldIds, newFolderId) => ({\r\n type: \"MOVE_FIELDS_TO_FOLDER\",\r\n fieldIds,\r\n newFolderId,\r\n});\r\n\r\nexport const deleteFieldFolder = folderId => ({\r\n type: \"DELETE_FIELD_FOLDER\",\r\n folderId,\r\n});\r\n\r\n// Add measure field that is an actual field\r\nimport { SET_PROPERTY, AdminDesignerProperties } from \"../reducers/adminDesigner\";\r\n\r\n// BEGIN ===Generic QB Field To Add Queues===\r\n// Puts the queue in \"state.vars\"\r\n// Assumes there will only be one QueryBuilder on the screen at a time.\r\n// Only used by FlowItemEdit currently.\r\nexport const genericQbClearFieldToAdd = fieldKey => ({\r\n type: \"GENERIC_QB_CLEAR_FIELD\",\r\n fieldKey,\r\n});\r\n\r\nexport const genericQbAddField =\r\n (fieldKey, index, selectedValues, group = null) =>\r\n (dispatch, getState) => {\r\n const state = getState();\r\n if (!state.fields || !state.fields.byId) {\r\n console.warn(\"Fields aren't loaded.\"); // eslint-disable-line no-console\r\n return;\r\n }\r\n\r\n if (!state.fields.byId[fieldKey]) {\r\n /* eslint-disable no-console */\r\n console.warn(`I was told to add [${fieldKey}], but I can't find a field with that fieldKey.`);\r\n /* eslint-enable no-console */\r\n return;\r\n }\r\n\r\n let fieldData = state.fields.byId[fieldKey].data;\r\n fieldData = addSelectedValuesToFieldData(fieldData, selectedValues);\r\n\r\n dispatch({\r\n type: \"GENERIC_QB_ADD_FIELD\",\r\n fieldKey,\r\n fieldData,\r\n group,\r\n index,\r\n });\r\n };\r\nexport const genericQbAddFieldMulti =\r\n (selectedFields, index, selectedValues, group = null) =>\r\n (dispatch, getState) => {\r\n const state = getState();\r\n\r\n let fieldsWithKeyAndData = [];\r\n\r\n Array.prototype.forEach.call(selectedFields, field => {\r\n const fieldKey = parseInt(field);\r\n let data = state.fields.byId[fieldKey].data;\r\n const fieldData = addSelectedValuesToFieldData(data, selectedValues);\r\n fieldsWithKeyAndData.push({ fieldKey, fieldData });\r\n });\r\n\r\n dispatch({\r\n type: \"GENERIC_QB_ADD_FIELD_MULTI\",\r\n fieldsWithKeyAndData,\r\n group,\r\n index,\r\n });\r\n };\r\n// END ===Generic QB Field To Add Queues===\r\n\r\n//begin field-filters-on-demand\r\n\r\nexport const loadRequestedFilters = filters => ({\r\n type: \"LOAD_REQUESTED_FILTERS\",\r\n filters,\r\n});\r\n\r\nexport const removeRequestedFilter = filterId => ({\r\n type: \"REMOVE_REQUESTED_FILTER\",\r\n filterId,\r\n});\r\n\r\nexport const requestFieldFilters = fieldIds => dispatch => {\r\n dispatch(incAjaxCount());\r\n fetch(\"/Tree/FiltersForFields\", {\r\n method: \"POST\",\r\n headers: { Accept: \"application/json\", \"Content-Type\": \"application/json\" },\r\n body: JSON.stringify({ fieldIds }),\r\n credentials: \"same-origin\",\r\n })\r\n /* eslint-disable no-console */\r\n .then(h.checkStatus)\r\n .then(console.log(\"FiltersForFields:checkStatus\" + Date().toLocaleString() + \"\"))\r\n .then(h.toJson)\r\n .then(console.log(\"FiltersForFields:toJson\" + Date().toLocaleString() + \"\"))\r\n .then(data => {\r\n dispatch(loadRequestedFilters(data.filters));\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error loading filters\", error);\r\n });\r\n};\r\n\r\n//end field-filters-on-demand\r\n","import h from \"../helpers\";\r\nimport { getFileMasterLog } from \"../actions/dashboardWidgetActions\";\r\nimport { incAjaxCount, decAjaxCount } from \"./actionCreators\";\r\n\r\nexport const GET_MODES = \"GET_MODES\";\r\nexport const GET_COLUMNS_FOR_TABLE = \"GET_COLUMNS_FOR_TABLE\";\r\nexport const GET_AVAILABLE_TABLE = \"GET_AVAILABLE_TABLE\";\r\nexport const GET_COLUMNS_FOR_TABLE_KEY = \"GET_COLUMNS_FOR_TABLE_KEY\";\r\nexport const GET_AVAILABLE_MODELS = \"GET_AVAILABLE_MODELS\";\r\nexport const GET_JOINS = \"GET_JOINS\";\r\nexport const GET_AVAILABLE_FIELDS = \"GET_AVAILABLE_FIELDS\";\r\nexport const GET_AVAILABLE_FOLDERS = \"GET_AVAILABLE_FOLDERS\";\r\nexport const GET_IMPORTS = \"GET_IMPORTS\";\r\nexport const GET_TABLE_TABLES_FOR_DELETION = \"GET_TABLE_TABLES_FOR_DELETION\";\r\nexport const GET_EXPERIAN_TABLES_ASSETS = \"GET_EXPERIAN_TABLES_ASSETS\";\r\nexport const DELETE_IMPORT = \"DELETE_IMPORT\";\r\nexport const PROCESS_MODEL = \"PROCESS_MODEL\";\r\nexport const PROCESS_TABLE = \"PROCESS_TABLE\";\r\nexport const CHECK_COL_FOR_PII = \"CHECK_COL_FOR_PII\";\r\nexport const SET_TABLES_TO_SHARE = \"SET_TABLES_TO_SHARE\";\r\nexport const SET_ACTIVE_COMPANIES = \"SET_ACTIVE_COMPANIES\";\r\nexport const FILES_WAITING_UPLOAD = \"FILES_WAITING_UPLOAD\";\r\n\r\nexport const getModes = () => dispatch =>\r\n fetch(\"/FileImport/GetModes\", {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch({\r\n type: GET_MODES,\r\n modes: data.modes,\r\n });\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading modes.\", error);\r\n });\r\n\r\nexport const clearJoinColumns = () => dispatch => {\r\n dispatch({\r\n type: GET_COLUMNS_FOR_TABLE_KEY,\r\n joinColumns: [],\r\n });\r\n};\r\n\r\nexport const getColumnsForTable = () => dispatch => {\r\n dispatch(incAjaxCount());\r\n\r\n fetch(\"/FileImport/GetColumnsForTable\", {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch({\r\n type: GET_COLUMNS_FOR_TABLE,\r\n joinColumns: data.columns,\r\n });\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading table columns.\", error);\r\n })\r\n .finally(() => {\r\n dispatch(decAjaxCount());\r\n });\r\n};\r\n\r\nexport const getColumnsForTableKey = tableKey => dispatch => {\r\n dispatch(incAjaxCount());\r\n\r\n fetch(\"/FileImport/GetColumnsForTable?tableKey=\" + tableKey, {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch({\r\n type: GET_COLUMNS_FOR_TABLE_KEY,\r\n joinColumns: data.columns,\r\n });\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading table columns.\", error);\r\n })\r\n .finally(() => {\r\n dispatch(decAjaxCount());\r\n });\r\n};\r\n\r\nexport const getColumnsForDestinationTable = companyId => dispatch => {\r\n dispatch(incAjaxCount());\r\n\r\n fetch(\"/FileImport/GetColumnsForDestinationTable?companyId=\" + companyId, {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch({\r\n type: GET_COLUMNS_FOR_TABLE_KEY,\r\n joinColumns: data.columns,\r\n });\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading table columns.\", error);\r\n })\r\n .finally(() => {\r\n dispatch(decAjaxCount());\r\n });\r\n};\r\n\r\nexport const getAvailableTables = () => dispatch => {\r\n dispatch(incAjaxCount());\r\n\r\n fetch(\"/FileImport/GetAvailableTables\", {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch({\r\n type: GET_AVAILABLE_TABLE,\r\n processTables: data.tables,\r\n });\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading tables for process.\", error);\r\n })\r\n .finally(() => {\r\n dispatch(decAjaxCount());\r\n });\r\n};\r\n\r\nexport const getJoins = () => dispatch => {\r\n dispatch(incAjaxCount());\r\n\r\n fetch(\"/FileImport/GetJoins\", {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const joins = Object.keys(data.joins).map(item => ({\r\n label: data.joins[item].VisibleName,\r\n value: data.joins[item].Id,\r\n item: data.joins[item],\r\n }));\r\n\r\n dispatch({\r\n type: GET_JOINS,\r\n joinToTables: joins,\r\n });\r\n // dispatch({ joinToTables: data.joins, selectedJoinTo: data.crosswalk });\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading joins.\", error);\r\n })\r\n .finally(() => {\r\n dispatch(decAjaxCount());\r\n });\r\n};\r\n\r\nexport const getAvailableFields = (objectId, tableName, isReport) => dispatch =>\r\n fetch(\"/FileImport/GetAvailableFields\", {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n body: JSON.stringify({\r\n objectId,\r\n tableName,\r\n isReport,\r\n }),\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const newColumns = [];\r\n data.fields.forEach(col => {\r\n newColumns.push({\r\n ColumnName: col.label,\r\n });\r\n });\r\n dispatch({\r\n type: GET_AVAILABLE_FIELDS,\r\n processColumns: newColumns,\r\n });\r\n })\r\n .catch(error => {\r\n h.error(\"Error retrieving fields.\", error);\r\n });\r\n\r\nexport const getAvailableFolders = (companyid: ?number) => dispatch => {\r\n dispatch(incAjaxCount());\r\n\r\n fetch(\"/FileImport/GetAvailableFolders\", {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n body: JSON.stringify({\r\n companyid,\r\n }),\r\n })\r\n /* eslint-disable no-console */\r\n .then(h.checkStatus)\r\n .then(console.log(\"GetAvailableFolders:checkStatus\" + Date().toLocaleString() + \"\"))\r\n .then(h.toJson)\r\n .then(console.log(\"GetAvailableFolders:toJson\" + Date().toLocaleString() + \"\"))\r\n .then(data => {\r\n const results = {};\r\n\r\n $.each(data.results, (key, item) => {\r\n results[item.id] = item;\r\n });\r\n\r\n dispatch({\r\n type: GET_AVAILABLE_FOLDERS,\r\n folders: results,\r\n });\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading folders.\", error);\r\n })\r\n .finally(() => {\r\n dispatch(decAjaxCount());\r\n });\r\n};\r\n\r\nexport const getImports = () => dispatch => {\r\n dispatch(incAjaxCount());\r\n\r\n fetch(\"/FileImport/GetImports\", {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const imports = {};\r\n\r\n $.each(data.imports, (key, item) => {\r\n imports[item.ImportId] = item;\r\n });\r\n\r\n dispatch({\r\n type: GET_IMPORTS,\r\n files: imports,\r\n });\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading imports.\", error);\r\n })\r\n .then(() => {\r\n dispatch(decAjaxCount());\r\n });\r\n};\r\n\r\nexport const getTableTablesForDeletion = () => dispatch =>\r\n fetch(\"/FileImport/GetTableTablesForDeletion\", {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch({\r\n type: GET_TABLE_TABLES_FOR_DELETION,\r\n tabletables: data.tables,\r\n });\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading tables.\", error);\r\n });\r\n\r\nexport const getExperianTablesAssets = () => dispatch =>\r\n fetch(\"/FileImport/GetExperianTablesAssets\", {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch({\r\n type: GET_EXPERIAN_TABLES_ASSETS,\r\n experianTablesAssets: data.tables,\r\n });\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading Experian tables assets.\", error);\r\n });\r\n\r\nexport const deleteImport =\r\n (id, companyId, deletePhysicalTable, deleteFromTable = false) =>\r\n dispatch => {\r\n dispatch(incAjaxCount());\r\n dispatch({\r\n type: DELETE_IMPORT,\r\n deletingFile: true,\r\n });\r\n\r\n fetch(\"/FileImport/DeleteImport\", {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n body: JSON.stringify({\r\n //add type and compressionIDS\r\n id,\r\n companyId,\r\n deletePhysicalTable,\r\n }),\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data.success) {\r\n if (deleteFromTable) {\r\n if (companyId == 0) {\r\n dispatch(getExperianTablesAssets());\r\n } else {\r\n dispatch(getTableTablesForDeletion());\r\n }\r\n\r\n dispatch(getFileMasterLog());\r\n }\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error deleting.\", error);\r\n })\r\n .then(() => {\r\n dispatch({\r\n type: DELETE_IMPORT,\r\n deletingFile: false,\r\n });\r\n\r\n dispatch(decAjaxCount());\r\n });\r\n };\r\n\r\nexport const clearDataDashboardRow = fileId => dispatch => {\r\n dispatch({\r\n type: DELETE_IMPORT,\r\n deletingFile: true,\r\n });\r\n fetch(\"/FileImport/ClearDataDashboardRow\", {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n body: JSON.stringify({\r\n //add type and compressionIDS\r\n fileId,\r\n }),\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data.success) {\r\n dispatch({\r\n type: DELETE_IMPORT,\r\n deletingFile: false,\r\n });\r\n dispatch(getFileMasterLog());\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error deleting.\", error);\r\n });\r\n};\r\n\r\nexport const processTable =\r\n (\r\n folderId,\r\n folderName,\r\n newFolderName,\r\n companyId,\r\n columns,\r\n parentJoinId,\r\n masterTableKey,\r\n tableName,\r\n isReport,\r\n retentionDays,\r\n experianAssets,\r\n excludeBlankMetaData\r\n ) =>\r\n dispatch => {\r\n dispatch({\r\n type: PROCESS_TABLE,\r\n processingTable: true,\r\n });\r\n fetch(\"/FileImport/ProcessTable\", {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n body: JSON.stringify({\r\n folderId,\r\n folderName,\r\n newFolderName,\r\n companyId,\r\n columns,\r\n parentJoinId,\r\n masterTableKey,\r\n tableName,\r\n isReport,\r\n retentionDays,\r\n experianAssets,\r\n excludeBlankMetaData,\r\n }),\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(() => {\r\n dispatch({\r\n type: PROCESS_TABLE,\r\n processColumns: [],\r\n processingTable: false,\r\n });\r\n })\r\n .catch(error => {\r\n h.error(\"Error processing table.\", error);\r\n dispatch({\r\n type: PROCESS_TABLE,\r\n processColumns: [],\r\n processingTable: false,\r\n });\r\n });\r\n };\r\n\r\nexport const setForbidenColsForPII = invalidColumns => ({\r\n type: CHECK_COL_FOR_PII,\r\n forbiddenColumns: invalidColumns,\r\n});\r\n\r\nexport const checkColForPII = cols => dispatch =>\r\n fetch(\"/FileImport/CheckColForPII\", {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n body: JSON.stringify({\r\n //add type and compressionIDS\r\n cols,\r\n }),\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data.success) {\r\n if (Object.keys(data.invalidColumns).length != 0) {\r\n dispatch({\r\n type: CHECK_COL_FOR_PII,\r\n forbiddenColumns: data.invalidColumns,\r\n });\r\n } else {\r\n dispatch({\r\n type: CHECK_COL_FOR_PII,\r\n forbiddenColumns: [],\r\n });\r\n }\r\n }\r\n })\r\n .catch(() => {\r\n dispatch({\r\n type: CHECK_COL_FOR_PII,\r\n forbiddenColumns: null,\r\n });\r\n })\r\n .finally(() => {\r\n dispatch(decAjaxCount());\r\n });\r\n\r\nexport const requestTablesToShare = () => dispatch => {\r\n dispatch(incAjaxCount());\r\n fetch(\"/FileImport/GetTablesToShare\", {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data.tables) {\r\n dispatch({ type: SET_TABLES_TO_SHARE, tables: data.tables });\r\n }\r\n })\r\n .catch(() => {\r\n h.error(\"Error loading tables to share.\");\r\n })\r\n .finally(() => {\r\n dispatch(decAjaxCount());\r\n });\r\n};\r\n\r\nexport const requestActiveCompanies = () => dispatch => {\r\n dispatch(incAjaxCount());\r\n fetch(\"/FileImport/GetActiveCompanies\", {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data.companies) {\r\n dispatch({ type: SET_ACTIVE_COMPANIES, companies: data.companies });\r\n }\r\n })\r\n .catch(() => {\r\n h.error(\"Error loading active companies.\");\r\n })\r\n .finally(() => {\r\n dispatch(decAjaxCount());\r\n });\r\n};\r\n","import { Dispatch, GetState } from \"../types/types\";\r\nimport { IQueueFile, IFileChunk, FILE_UPLOAD_STATUS } from \"../types/stores/fileImportQueue\";\r\nimport {\r\n ADD_TO_QUEUE,\r\n UPDATE_FILE_CHUNK,\r\n INC_ACTIVE_CONNECTIONS,\r\n DEC_ACTIVE_CONNECTIONS,\r\n UPDATE_FILE_REQUESTS_FAILED,\r\n DELETE_FROM_QUEUE,\r\n} from \"../types/actions/fileImportQueue\";\r\nimport { IAppState } from \"../types/stores\";\r\nimport h from \"../helpers\";\r\nimport { toJson } from \"../helpers/typedHelpers\";\r\nimport { notifyGreen } from \"./notifyActions\";\r\nimport { extendSession } from \"./sessionActions\";\r\n\r\nconst BYTES_PER_CHUNK = 10485760; // UPDATED TO 10mb smaller chunks cause issues with FileMasterLog requests.\r\n\r\n// setting this to 5, if we get 5 consecutive requests failed, we won't send anymore chunks\r\nexport const MAX_CONSECUTIVE_REQUESTS_FAILED = 5;\r\n\r\nconst files: { string?: File } = {};\r\n\r\n// adds a file to the queue and triggers processNextChunk\r\nexport const queueUpFile =\r\n (guid: string, importName: string, file: File) =>\r\n (dispatch: Dispatch): void => {\r\n // this is the actual file, cant add it to redux so just put it in the object\r\n files[guid] = file;\r\n\r\n // this is just some metadata used by the queue\r\n const queueFile: IQueueFile = {\r\n guid,\r\n fileName: file.name,\r\n importName,\r\n size: file.size,\r\n requestsFailed: 0,\r\n chunks: [],\r\n };\r\n\r\n // lets add to the file queue all the chunks, splits the chunks into 50mb chunks\r\n const count =\r\n queueFile.size % BYTES_PER_CHUNK == 0\r\n ? queueFile.size / BYTES_PER_CHUNK\r\n : Math.floor(queueFile.size / BYTES_PER_CHUNK) + 1;\r\n const chunks: Array = [];\r\n\r\n // needs to start at 0!\r\n let chunkNumber = 0;\r\n while (chunkNumber < count) {\r\n chunks.push({\r\n chunkNumber: chunkNumber++,\r\n chunkStatus: FILE_UPLOAD_STATUS.PENDING,\r\n });\r\n }\r\n\r\n // adds the file to the redux state\r\n queueFile.chunks = chunks;\r\n dispatch({ type: ADD_TO_QUEUE, file: queueFile });\r\n\r\n // send the next chunk\r\n dispatch(processNextChunk());\r\n };\r\n\r\n// looks for files with pending chunks to send and sends the chunks\r\nconst processNextChunk = () => (dispatch: Dispatch, getState: GetState) => {\r\n const state: IAppState = getState();\r\n const activeConnections = state.fileImportQueue.activeConnections;\r\n const threadLimit = state.fileImportQueue.threadLimit;\r\n\r\n // check the maximum simultaneous connections\r\n if (activeConnections < threadLimit) {\r\n // update the number of active connections upfront\r\n dispatch(incActiveConnections());\r\n\r\n const files = state.fileImportQueue.files;\r\n // get the first file that doesn't have chunks in progress\r\n // users complained that files doesn't upload in parallel, only one shows progress at the same time\r\n let fileSearch = files.find(\r\n x =>\r\n x.chunks &&\r\n x.requestsFailed < MAX_CONSECUTIVE_REQUESTS_FAILED &&\r\n // doesn't have chunks in progress\r\n x.chunks.filter(y => y.chunkStatus == FILE_UPLOAD_STATUS.IN_PROGRESS).length <= 0 &&\r\n x.chunks.filter(\r\n y => y.chunkStatus == FILE_UPLOAD_STATUS.PENDING || y.chunkStatus == FILE_UPLOAD_STATUS.ERROR\r\n ).length > 0\r\n );\r\n\r\n // if all files in the queue have chunks in progress, then grab the first one with chunks pending\r\n if (!fileSearch) {\r\n // get the first file on the queue with chunks pending to send or that had an error\r\n fileSearch = files.find(\r\n x =>\r\n x.chunks &&\r\n x.requestsFailed < MAX_CONSECUTIVE_REQUESTS_FAILED &&\r\n x.chunks.filter(\r\n y =>\r\n y.chunkStatus != FILE_UPLOAD_STATUS.COMPLETED &&\r\n y.chunkStatus != FILE_UPLOAD_STATUS.IN_PROGRESS\r\n ).length > 0\r\n );\r\n }\r\n\r\n // need to use fileSearch first, if file is not declared as a constant, typescript errors\r\n const file = fileSearch;\r\n // just initializing an empty chunk so that ts is happy\r\n let chunk: IFileChunk | undefined;\r\n\r\n if (file) {\r\n chunk = file.chunks.find(\r\n y => y.chunkStatus != FILE_UPLOAD_STATUS.COMPLETED && y.chunkStatus != FILE_UPLOAD_STATUS.IN_PROGRESS\r\n );\r\n if (chunk) {\r\n // calling the extend session method to try and prevent session timeouts when uploading big files\r\n extendSession();\r\n\r\n const newChunk = { ...chunk };\r\n newChunk.chunkStatus = FILE_UPLOAD_STATUS.IN_PROGRESS;\r\n dispatch(updateFileChunk(file.guid, newChunk));\r\n sendChunk(file.guid, newChunk, file.chunks.length)\r\n .then(() => {\r\n // if a previous chunk failed and this completed, update the flag\r\n if (file.requestsFailed > 0) {\r\n const newRequestsFailed = file.requestsFailed - 1;\r\n dispatch(updateFileRequestsFailed(file.guid, newRequestsFailed));\r\n }\r\n\r\n // set the chunk to completed\r\n newChunk.chunkStatus = FILE_UPLOAD_STATUS.COMPLETED;\r\n dispatch(updateFileChunk(file.guid, newChunk));\r\n // check if this was the last chunk pending to send for this file\r\n dispatch(processChunkCompleted(file.guid, file.fileName));\r\n // free the active connection\r\n dispatch(decActiveConnections());\r\n // check if there is any more files with pending chunks\r\n dispatch(processNextChunk());\r\n })\r\n .catch(e => {\r\n const newRequestsFailed = file.requestsFailed + 1;\r\n // updating the number of requests failed\r\n dispatch(updateFileRequestsFailed(file.guid, newRequestsFailed));\r\n // update chunk status, can be retried later if hasn't reached the max retries\r\n newChunk.chunkStatus = FILE_UPLOAD_STATUS.ERROR;\r\n dispatch(updateFileChunk(file.guid, newChunk));\r\n // if more than 5 consecutive requests failed, attempt to update the status in the server\r\n if (newRequestsFailed == MAX_CONSECUTIVE_REQUESTS_FAILED) {\r\n dispatch(requestImportFailed(file.guid, file.fileName));\r\n }\r\n\r\n // free the active connection\r\n dispatch(decActiveConnections());\r\n // check if there is any more files with pending chunks\r\n dispatch(processNextChunk());\r\n\r\n h.errorSilent(\r\n `Send chunk failed for file: ${file.guid}, chunk number: ${newChunk.chunkNumber}, current status: ${newChunk.chunkStatus}`,\r\n e\r\n );\r\n });\r\n }\r\n }\r\n\r\n // check if there is any more files with pending chunks\r\n // this doesn't wait for the sendChunk, it will trigger the parallel uploads\r\n // if there are active connections available and chunks pending\r\n dispatch(processNextChunk());\r\n\r\n if (!file || !chunk) {\r\n dispatch(decActiveConnections());\r\n }\r\n }\r\n};\r\n\r\n// checks if the completed chunk was the last one pending for that file and completes the upload\r\nconst processChunkCompleted = (guid: string, fileName: string) => (dispatch: Dispatch, getState: GetState) => {\r\n const state: IAppState = getState();\r\n const file = state.fileImportQueue.files.find(x => x.guid == guid);\r\n if (file) {\r\n const pendingChunks = file.chunks.filter(x => x.chunkStatus != FILE_UPLOAD_STATUS.COMPLETED);\r\n if (pendingChunks.length <= 0) {\r\n const formData = new FormData();\r\n formData.append(\"guid\", guid);\r\n formData.append(\"fileName\", fileName);\r\n\r\n fetch(\"/FileImport/CompleteChunkUpload\", {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n body: formData,\r\n })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(() => {\r\n dispatch(notifyGreen(\"File upload is in progress.\"));\r\n })\r\n .catch(() => {\r\n h.error(`There was an error finalizing the file upload: ${guid}.`);\r\n });\r\n\r\n dispatch(clearFileChunks(guid));\r\n delete files[guid];\r\n }\r\n }\r\n};\r\n\r\nconst clearFileChunks = (guid: string) => ({\r\n type: DELETE_FROM_QUEUE,\r\n guid,\r\n});\r\n\r\nconst updateFileChunk = (guid: string, newChunk: IFileChunk) => ({\r\n type: UPDATE_FILE_CHUNK,\r\n guid,\r\n newChunk,\r\n});\r\n\r\nconst updateFileRequestsFailed = (guid: string, requestsFailed: number) => ({\r\n type: UPDATE_FILE_REQUESTS_FAILED,\r\n guid,\r\n requestsFailed,\r\n});\r\n\r\nconst decActiveConnections = () => ({\r\n type: DEC_ACTIVE_CONNECTIONS,\r\n});\r\n\r\nconst incActiveConnections = () => ({\r\n type: INC_ACTIVE_CONNECTIONS,\r\n});\r\n\r\n// sends the chunk to the server\r\nconst sendChunk = (guid: string, chunk: IFileChunk, totalChunks: number) =>\r\n new Promise((resolve, reject) => {\r\n // file object\r\n const file: File = files[guid];\r\n // calculating start and end based on the BYTES_PER_CHUNK constant\r\n // first chunk number should always be 0 so that it's not skipped!\r\n const start = chunk.chunkNumber * BYTES_PER_CHUNK;\r\n const end = start + BYTES_PER_CHUNK;\r\n\r\n let slice = file.slice(start, end);\r\n const formData = new FormData();\r\n formData.append(\"file\", slice);\r\n formData.append(\"guid\", guid);\r\n formData.append(\"chunkCounter\", `${chunk.chunkNumber + 1}`);\r\n formData.append(\"totalChunks\", `${totalChunks}`);\r\n\r\n fetch(\"/FileImport/UploadFileChunk\", {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n body: formData,\r\n })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n if (data && data.ok) {\r\n resolve();\r\n } else {\r\n reject();\r\n }\r\n })\r\n .catch(() => {\r\n reject();\r\n });\r\n });\r\n\r\n// request to update a file import to error, should be called when the max consecutive failed is reached.\r\nconst requestImportFailed = (guid: string, fileName: string) => (dispatch: Dispatch) => {\r\n // clearing the file chunks and deleting the file\r\n dispatch(clearFileChunks(guid));\r\n delete files[guid];\r\n\r\n const formData = new FormData();\r\n formData.append(\"guid\", guid);\r\n\r\n fetch(\"/FileImport/UpdateFileImportToError\", {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n body: formData,\r\n })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(() => {\r\n h.error(`There was an error uploading the file ${fileName}, the process has stopped.`);\r\n })\r\n .catch(() => {\r\n h.error(`Unable to update the status of the file ${fileName} in the server, the process has stopped.`);\r\n });\r\n};\r\n","import h from \"../helpers\";\r\nimport { toJson, uniqArray, titleCase, renderFlowItemType } from \"../helpers/typedHelpers\";\r\nimport { FlowIsRunning, FlowConstants, FlowProcessingTypes } from \"../helpers/constants\";\r\nimport clone from \"../helpers/clone\";\r\nimport { folderReducerKeyForType } from \"../helpers/folder\";\r\nimport { getSupportEmailAddress } from \"../helpers/siteCustomization\";\r\nimport { normalize, schema } from \"normalizr\";\r\nimport { push } from \"connected-react-router\";\r\nimport { incAjaxCount, decAjaxCount, lossOfWorkRunQueuedAction, setVar, showModal, goToUrl } from \"./actionCreators\";\r\nimport { flowRelatedRequestStart, flowRelatedRequestCompleted } from \"./loadingActions\";\r\nimport { requestFieldFilters } from \"./fieldTreeActions\";\r\nimport { ToggleIsFlowTreeLoading, SetIsFlowLoadingExcludes } from \"./treeBehaviorActions\";\r\nimport { notifyGreen, notifyBlack, notifyBlue } from \"./notifyActions\";\r\nimport { SetPreviouslyClosedFlow, SetPreviouslySelectedFolder } from \"./flowDesignerActions\";\r\nimport { requestDestinations, requestDestinationsByAccess } from \"./exportLayoutActions2\";\r\nimport { GetTapadDeliveryTemplates } from \"./companiesActions\";\r\nimport { newFlowExpression } from \"./flowExpressionActions\";\r\nimport { newFlowDescription } from \"./flowDescriptionActions\";\r\nimport { gzip } from \"node-gzip\";\r\n\r\nimport { request } from \"../helpers/httpInterceptor\";\r\nimport { FlowBaseTypes, validFilters } from \"../helpers/constants\";\r\nimport { formatName } from \"../helpers\";\r\nimport { DeliveryType } from \"../enums/company\";\r\n\r\nimport { searchTree, findFolderById } from \"../reducers/_folderGeneral\";\r\nimport { getClientVariablesWithValuesForSelectedFlow } from \"../reducers/clientVariables\";\r\nimport {\r\n getFlowItemsArray,\r\n getFlowItemsForSelectedFlow,\r\n editUrlForFlowItem,\r\n editUrlForFlow,\r\n calculateNewItemPosition,\r\n isAnyParentIncomplete,\r\n variablesUrlForFlow,\r\n reportsUrlForFlow,\r\n makeGetSelectedFlowPermissions,\r\n makeGetPermissionsItemFromProps,\r\n getItemErrorsForSelectedFlow,\r\n getFlowItemTypeLookupForSelectedFlow,\r\n} from \"../reducers/flowItems\";\r\nimport {\r\n getFlowRelationsForSelectedFlow,\r\n getFlowRelationsArray,\r\n getFlowItemChildrenIndex,\r\n isLoopDetected,\r\n validateFlowRelation,\r\n flowRelationExists,\r\n getExistingRelations,\r\n getFlowRelationsForAllFlows,\r\n ancestorHasThirdPartyData,\r\n ancestorhasOACData,\r\n} from \"../reducers/flowRelations\";\r\nimport { getFlowMultiExportsByFlowItemId, getFlowMultiExportForSelectedFlow } from \"../reducers/flowMultiExports\";\r\nimport { getFlowReportsForSelectedFlow, getFlowReportsByFlowItemId } from \"../reducers/flowReports\";\r\nimport { getFlowModelsForSelectedFlow, getFlowModelsByFlowItemId, getFlowModelsArray } from \"../reducers/flowModels\";\r\nimport { getFlowExportsByFlowItemId, getFlowExportsForSelectedFlow } from \"../reducers/flowExports\";\r\nimport { getFlowOutputsByFlowItemId, getFlowOutputsForSelectedFlow } from \"../reducers/flowOutputs\";\r\nimport { getFlowExportReportsForSelectedFlow, getFlowExportReportsArray } from \"../reducers/flowExportReports\";\r\nimport { getFlowCannedReportsForSelectedFlow, getFlowCannedReportsByFlowItemId } from \"../reducers/flowCannedReports\";\r\nimport { getFlowDescriptionsForSelectedFlow, getFlowDescriptionsByFlowItemId } from \"../reducers/flowDescriptions\";\r\nimport { getFlowFromCloudsByFlowItemId, getFlowFromCloudsForSelectedFlow } from \"../reducers/flowFromClouds\";\r\nimport { getFlowToCloudsByFlowItemId, getFlowToCloudsForSelectedFlow } from \"../reducers/flowToClouds\";\r\nimport { getFlowDataLoadsByFlowItemId, getFlowDataLoadsForSelectedFlow } from \"../reducers/flowDataLoads\";\r\nimport { getFlowDataLoadColumnsForSelectedFlow } from \"../reducers/flowDataLoadColumns\";\r\nimport {\r\n getFlowSVDedupesForSelectedFlow,\r\n getFlowSVDedupesByFlowItemId,\r\n getFlowSVDedupesArray,\r\n} from \"../reducers/flowSVDedupes\";\r\nimport { getFlowFiltersByFlowItemId, getFlowFiltersForSelectedFlow } from \"../reducers/flowFilters\";\r\nimport { getFlowScriptsByFlowItemId, getFlowScriptsForSelectedFlow } from \"../reducers/flowScripts\";\r\nimport { getFlowScriptsDBUIByFlowItemId, getFlowScriptsDBUIForSelectedFlow } from \"../reducers/flowScriptsDBUI\";\r\nimport { getFlowEmptiesByFlowItemId, getFlowEmptiesForSelectedFlow } from \"../reducers/flowEmpties\";\r\nimport { getFlowSingleViewsForSelectedFlow, getFlowSingleViewsByFlowItemId } from \"../reducers/flowSingleViews\";\r\nimport { getFlowSplitsForSelectedFlow, getFlowSplitsByFlowItemId } from \"../reducers/flowSplits\";\r\nimport { getFlowCasesForSelectedFlow, getFlowCasesByFlowItemId } from \"../reducers/flowCases\";\r\nimport { getFlowMergesArray, getFlowMergesForSelectedFlow, getFlowMergesByFlowItemId } from \"../reducers/flowMerges\";\r\nimport {\r\n getFlowOfferMergesArray,\r\n getFlowOfferMergesForSelectedFlow,\r\n getFlowOfferMergesByFlowItemId,\r\n} from \"../reducers/flowOfferMerges\";\r\nimport { getFlowClientVariablesForSelectedFlow } from \"../reducers/flowClientVariables\";\r\nimport {\r\n getFlowItemClientVariablesForSelectedFlow,\r\n getFlowItemClientVariablesArray,\r\n} from \"../reducers/flowItemClientVariables\";\r\nimport { getFlowEndpointsForSelectedFlow } from \"../reducers/flowItemEndpoints\";\r\nimport { getFlowItemOfferCodesForSelectedFlow } from \"../reducers/flowItemOfferCodes\";\r\nimport {\r\n getFlowExportDistributionPlatformsForSelectedFlow,\r\n getFlowExportDistributionPlatformsArray,\r\n} from \"../reducers/flowExportDistributionPlatforms\";\r\nimport {\r\n getFlowRelationParentLabelsForSelectedFlow,\r\n getFlowRelationsParentLabelsArray,\r\n} from \"../reducers/flowRelationParentLabels\";\r\n\r\nimport { getFlowOffloadsByFlowItemId, getFlowOffloadsForSelectedFlow } from \"../reducers/flowOffloads\";\r\nimport {\r\n getFlowExternalServicesByFlowItemId,\r\n getFlowExternalServicesForSelectedFlow,\r\n} from \"../reducers/flowExternalServices\";\r\nimport {\r\n getFlowOffloadColumnsByFlowItemId,\r\n getFlowOffloadColumnsForSelectedFlow,\r\n} from \"../reducers/flowOffloadColumns\";\r\nimport { getFlowGuideSettingsForSelectedFlow } from \"../reducers/flowGuideSettings\";\r\nimport {\r\n getFlowExportTemplateFieldsForSelectedFlow,\r\n getFlowExportTemplateFieldsArray,\r\n getFlowExportTemplateFieldsByFlowItemId,\r\n} from \"../reducers/flowExportTemplateFields\";\r\nimport {\r\n getFlowExportPinterestTemplateFieldsForSelectedFlow,\r\n getFlowExportPinterestTemplateFieldsArray,\r\n getFlowExportPinterestTemplateFieldsByFlowItemId,\r\n} from \"../reducers/flowExportPinterestTemplateFields\";\r\nimport {\r\n getFlowExportTikTokTemplateFieldsForSelectedFlow,\r\n getFlowExportTikTokTemplateFieldsArray,\r\n getFlowExportTikTokTemplateFieldsByFlowItemId,\r\n} from \"../reducers/flowExportTikTokTemplateFields\";\r\nimport {\r\n getFlowExportTradeDeskTemplateFieldsForSelectedFlow,\r\n getFlowExportTradeDeskTemplateFieldsArray,\r\n getFlowExportTradeDeskTemplateFieldsByFlowItemId,\r\n} from \"../reducers/flowExportTradeDeskTemplateFields\";\r\nimport {\r\n getFlowExportPubmaticTemplateFieldsForSelectedFlow,\r\n getFlowExportPubmaticTemplateFieldsArray,\r\n getFlowExportPubmaticTemplateFieldsByFlowItemId,\r\n} from \"../reducers/flowExportPubmaticTemplateFields\";\r\nimport {\r\n getFlowExportFreewheelDriverFileFieldsForSelectedFlow,\r\n getFlowExportFreewheelDriverFileFieldsArray,\r\n getFlowExportFreewheelDriverFileFieldsByFlowItemId,\r\n FREEWHEEL_DRIVER_FILE_FIELDS,\r\n} from \"../reducers/freewheel\";\r\n\r\nimport {\r\n getFlowExportTaxonomyFileFieldsForSelectedFlow,\r\n getFlowExportTaxonomyFileFieldsArray,\r\n} from \"../reducers/taxonomyLayout\";\r\nimport FlowExportFreewheelDriverFileFields from \"../types/stores/freewheel\";\r\nimport { getFlowExpressionsByFlowItemId, getFlowExpressionsForSelectedFlow } from \"../reducers/flowExpressions\";\r\n\r\nimport wrap from \"lodash/wrap\";\r\nimport memoize from \"lodash/memoize\";\r\nimport debounce from \"lodash/debounce\";\r\n\r\nimport type { Dispatch, GetState, MergeBehavior, ThunkAction, Destination } from \"../types/types\";\r\nimport { VariableValueType, IFlowItemLayoutError } from \"../types/stores/vars\";\r\nimport { SET_FLOWITEM_LAYOUT_ERRORS } from \"../reducers/vars\";\r\nimport type { ActionTypeUFL } from \"../types/actionTypes\";\r\nimport type {\r\n Flow,\r\n FlowItem,\r\n FlowRelation,\r\n FlowFilter,\r\n FlowSplit,\r\n FlowCase,\r\n FlowEmpty,\r\n FlowCaseAndEmpty,\r\n FlowMerge,\r\n FlowOfferMerge,\r\n FlowReport,\r\n FlowModel,\r\n FlowExport,\r\n FlowMultiExport,\r\n FlowOutput,\r\n FlowExportReport,\r\n FlowCannedReport,\r\n FlowFromCloud,\r\n FlowToCloud,\r\n FlowSVDedupe,\r\n FlowSVDedupeD,\r\n FlowSingleView,\r\n FlowClientVariable,\r\n FlowClientVariableD,\r\n FlowItemClientVariable,\r\n FlowItemClientVariableD,\r\n FlowScript,\r\n FlowScriptDBUI,\r\n FlowScriptResult,\r\n FlowDataLoad,\r\n NormalizedFlowData,\r\n NewFlowLocation,\r\n FlowDataLoadColumn,\r\n EntityPluralName,\r\n FlowThings,\r\n FlowUserConfig,\r\n FlowPermissions,\r\n FlowAndItemPermissions,\r\n FlowItemEndpoint,\r\n FlowItemOfferCode,\r\n FlowExportDistributionPlatform,\r\n FlowExportTemplateFields,\r\n FlowExportPinterestTemplateFields,\r\n FlowExportTradeDeskTemplateFields,\r\n FlowExportPubmaticTemplateFields,\r\n FlowExportTaxonomyFileFields,\r\n FlowRelationParentLabel,\r\n RequestFlowSave,\r\n FlowOffload,\r\n FlowOffloadColumn,\r\n FlowGuideSetting,\r\n FlowSegmentSplit,\r\n FlowSegmentSplitOffer,\r\n FlowExternalService,\r\n FlowExternalServiceParameter,\r\n FlowExternalServiceInput,\r\n FlowExternalServiceHardcode,\r\n FlowExportTikTokTemplateFields,\r\n FlowExportXandrDriverFields,\r\n} from \"../types/flowTypes\";\r\nimport { getFlowSegmentSplitsByFlowItemId, getFlowSegmentSplitsForSelectedFlow } from \"../reducers/flowSegmentSplits\";\r\nimport {\r\n getFlowSegmentSplitOffersByFlowItemId,\r\n getFlowSegmentSplitOffersForSelectedFlow,\r\n} from \"../reducers/flowSegmentSplitOffers\";\r\nimport { getFlowExternalServiceParametersForSelectedFlow } from \"../reducers/flowExternalServiceParameters\";\r\nimport { getFlowExternalServiceInputsForSelectedFlow } from \"../reducers/flowExternalServiceInputs\";\r\nimport { getFlowExternalServiceHardcodesForSelectedFlow } from \"../reducers/flowExternalServiceHardcodes\";\r\nimport { getFlowExpressionsConstraintsForSelectedFlow } from \"../reducers/flowExpressionConstraints\";\r\nimport { requestExternalServiceLayoutData } from \"./flowControlActions\";\r\nimport { clearSelectedCannedReport } from \"./cannedReportActions\";\r\nimport { DeploySettings } from \"../types/stores/companyTable\";\r\nimport {\r\n deleteFlowExportXandrDriverFields,\r\n newFlowExportXandrDriverFields,\r\n xandrDriverFieldsPrefixAndEntity,\r\n} from \"./flowExportXandrDriverFieldActions\";\r\nimport {\r\n getFlowExportXandrDriverFieldsForSelectedFlow,\r\n getFlowExportXandrDriverFieldsArray,\r\n getFlowExportXandrDriverFieldsByFlowItemId,\r\n} from \"../reducers/flowExportXandrDriverFields\";\r\nimport { getAncestorFilterFieldIdsForFlowItemId } from \"../helpers/flowItems\";\r\nimport { getFieldRatesByParentFlowItemId } from \"../reducers/fieldsByCompany\";\r\n\r\nimport React from \"react\";\r\nif (!top.RDX) {\r\n top.RDX = {};\r\n}\r\n\r\nexport const updateFlowList = (\r\n normalizedData: NormalizedFlowData,\r\n mergeBehavior: MergeBehavior = \"replace\",\r\n flowClientVariableIdsToDelete: ?Array = null\r\n): ActionTypeUFL => ({\r\n type: \"UPDATE_FLOW_LIST\",\r\n normalizedData,\r\n mergeBehavior,\r\n flowClientVariableIdsToDelete,\r\n});\r\ntop.RDX.updateFlowList = flows => top.store.dispatch(updateFlowList(flows));\r\n\r\nexport const clearSelectedFlow = () => ({\r\n type: \"CLEAR_SELECTED_FLOW\",\r\n});\r\ntop.RDX.clearSelectedFlow = () => top.store.dispatch(clearSelectedFlow());\r\n\r\nconst ucFirst = string => string.charAt(0).toUpperCase() + string.slice(1);\r\n\r\nlet updatedNodeIDs = [\r\n {\r\n oldId: 0,\r\n newId: 0,\r\n },\r\n];\r\n\r\nexport const goEditFlowItem =\r\n (flowItemId: number, isResetFlowControlTab: boolean = true) =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const flowItemsById = state.flowItems.byId;\r\n let flowItem: FlowItem = flowItemsById[flowItemId];\r\n let flowItemEditId: number = flowItemId;\r\n\r\n if (flowItem == null) {\r\n return;\r\n }\r\n\r\n if (flowItem.FlowItemType == \"empty\") {\r\n const flowRelations = Object.values(state.flowRelations.byId);\r\n const parentRelation = flowRelations.find(\r\n x => x.ChildFlowItemId == flowItem.FlowItemId && x.ParentFlowItemId != 0\r\n );\r\n if (parentRelation && flowItemsById[parentRelation.ParentFlowItemId]) {\r\n flowItem = flowItemsById[parentRelation.ParentFlowItemId];\r\n flowItemEditId = flowItem.FlowItemId;\r\n }\r\n }\r\n\r\n if (isResetFlowControlTab) {\r\n dispatch(setNewTabValue(0));\r\n }\r\n\r\n dispatch(setSelectedFlowItemId(flowItemEditId)); // This makes FlowItemEdit load faster\r\n dispatch(goToUrl(editUrlForFlowItem(flowItem.FlowId, flowItemEditId)));\r\n };\r\n\r\nexport const goEditFlow = (flowId: number) => (dispatch: Dispatch) => {\r\n dispatch(goToUrl(editUrlForFlow(flowId)));\r\n dispatch(requestFlow(flowId));\r\n};\r\n\r\nexport const goVariablesFlow = (flowId: number) => (dispatch: Dispatch) => {\r\n dispatch(goToUrl(variablesUrlForFlow(flowId)));\r\n};\r\n\r\nexport const goReportsFlow = (flowId: number) => (dispatch: Dispatch) => {\r\n dispatch(goToUrl(reportsUrlForFlow(flowId)));\r\n};\r\n\r\nexport const newFlow = (flowName?: string, baseType?: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const userId = state.session.userId;\r\n const companyId = state.session.companyId;\r\n\r\n //Getting top level folder Id #1483\r\n const topLevelFolderId = findTopLevelFlowFolderForUser(state, userId);\r\n const newFlow: Flow = {\r\n FlowId: 0,\r\n FlowName: flowName || \"New Flow\", // 150\r\n FlowDescription: baseType ? \"New Campaign\" : \"New Description\", // 200\r\n FlowIsActive: true,\r\n FlowCompanyId: companyId,\r\n FlowFolderId: topLevelFolderId,\r\n FlowDateCreated: \"\", // timestamp\r\n FlowCreatedBy: userId,\r\n FlowDateUpdated: \"\", // timestamp\r\n FlowUpdatedBy: userId,\r\n FlowUniverse: 1,\r\n IsLocked: false,\r\n IsLockedPermanently: false,\r\n FlowLastCalculated: null,\r\n FlowBaseType: baseType ? baseType : FlowBaseTypes.Default,\r\n hasUnsavedChanges: false, // Local only\r\n isSaving: 0, // Local only\r\n isRenaming: false, // Local only\r\n shouldValidate: false,\r\n flowItemsRunning: 0, // Calculated, based on flow items IsRunning state\r\n isLoadingFlowData: false, // Local only\r\n isSplitEnabled: true, // Should we control this through a flow guide settings? in the db?\r\n hasUnsavedLayoutChanges: false,\r\n };\r\n const callback = id => dispatch(setSelectedFlowNoUnsavedCheck(id));\r\n return dispatch(addThing(\"flows\", newFlow, callback, false));\r\n};\r\n\r\n// controls the local shouldValidate flag in the store _only_ validate when needed\r\nexport const updateFlowShouldValidate =\r\n (flowId: number, shouldValidate: boolean) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const flow: ?Flow = state.flows.byId[state.selected.flow];\r\n\r\n if (flow == null) return;\r\n dispatch(updateAttribute(\"flows\", flowId, \"shouldValidate\", shouldValidate));\r\n };\r\n\r\nexport const newFlowEmpty =\r\n (flowItemId: number, idCallback?: number => any, criteria: ?string) => (dispatch: Dispatch) => {\r\n const thing: FlowEmpty = {\r\n FlowEmptyId: 0,\r\n FlowItemId: flowItemId,\r\n FlowEmptyCriteria: criteria,\r\n };\r\n dispatch(addThing(\"flowEmpties\", thing, idCallback));\r\n // Automatically change the name on the associated flowItem to criteria.\r\n dispatch(updateAttribute(\"flowItems\", flowItemId, \"FlowItemName\", criteria));\r\n };\r\n\r\n// When making a new node, a user can pass in a location through either a\r\n// direct X+Y coordinate, or a parentId for us to put the node under\r\nconst newFlowLocationToXY = (state: any, newFlowLocation: ?NewFlowLocation) => {\r\n const defaultLocation = { x: 10, y: 10 };\r\n // They passed us nothing, default to above coordinates\r\n if (newFlowLocation == null) {\r\n return defaultLocation;\r\n }\r\n // They passed us a parent ID, compute where the node should be\r\n if (newFlowLocation != null && newFlowLocation.getLocationFromThisParent != null) {\r\n return calculateNewItemPosition(state, newFlowLocation.getLocationFromThisParent);\r\n }\r\n // They passed us X+Y coords, just pass through\r\n if (newFlowLocation != null && newFlowLocation.x != null && newFlowLocation.y != null) {\r\n if (newFlowLocation.x) {\r\n newFlowLocation.x = Math.round(newFlowLocation.x);\r\n }\r\n if (newFlowLocation.y) {\r\n newFlowLocation.y = Math.round(newFlowLocation.y);\r\n }\r\n\r\n return {\r\n x: newFlowLocation.x,\r\n y: newFlowLocation.y,\r\n };\r\n }\r\n return defaultLocation;\r\n};\r\n\r\n// Function to open the modal and return a promise\r\nconst openModal = () => (dispatch: Dispatch) => \r\n new Promise((resolve) => {\r\n dispatch(showModal(\"SIMPLE_TO_LEGACY\", {\r\n closeModal: (value) => resolve(value),\r\n }));\r\n });\r\n\r\nexport const newFlowItem =\r\n (idCallback?: number => any, flowItemName?: string, flowItemType?: string, newFlowLocation?: NewFlowLocation) =>\r\n async (dispatch: Dispatch, getState: GetState) => {\r\n \r\n const state = getState();\r\n const userId = state.session.userId;\r\n const flowId: number = state.selected.flow;\r\n const flowItems = getFlowItemsForSelectedFlow(state);\r\n const flow: ?Flow = state.flows.byId[state.selected.flow];\r\n const flowFilter = flowItems.filter(x => x.FlowItemType === \"filter\" && x.FlowId == flowId);\r\n const flowMultiExport = flowItems.filter(x => x.FlowItemType === \"multiexport\" && x.FlowId == flowId);\r\n const filterException = flowItemType == \"filter\" ? flowFilter.length > 0 : true;\r\n const multiexportException = flowItemType == \"multiexport\" ? flowMultiExport.length == 1 : true;\r\n const exportNodeException = flowItemType == \"export\";\r\n if(state.session.enabledFeatures.includes(\"simple-flow\") && flow && flow.FlowBaseType != FlowBaseTypes.Default && multiexportException && !exportNodeException && filterException){\r\n // Open the modal and wait for the user's response\r\n const userConfirmed = await dispatch(openModal());\r\n // If the user did not confirm, exit the function\r\n if (!userConfirmed) {\r\n return;\r\n } \r\n }\r\n\r\n // Look for location specified by either parent ID or exact x+y, otherwise default\r\n const newPosition = newFlowLocationToXY(state, newFlowLocation);\r\n const thing: FlowItem = {\r\n FlowItemId: 0,\r\n FlowId: flowId,\r\n FlowItemType: flowItemType || \"\", // 80\r\n FlowItemName: flowItemName || \"\", // 150\r\n IsActive: true,\r\n IsValid: true,\r\n HasResultTable: false,\r\n HasQATable: false,\r\n IsRunning: 0,\r\n IsError: false,\r\n FlowItemCreatedDate: \"\", // timestamp\r\n FlowItemCreatedBy: userId,\r\n FlowItemUpdatedDate: \"\", // timestamp\r\n FlowItemUpdatedBy: userId,\r\n FlowItemStart: \"\",\r\n FlowItemEnd: \"\",\r\n FlowItemQty: 0,\r\n SysDescription: \"\",\r\n x: newPosition.x,\r\n y: newPosition.y,\r\n requestId: null,\r\n SubmittedProcessId: null,\r\n SubmittedProcessName: \"\",\r\n IsCancelled: false,\r\n IsComputeQA: false,\r\n width: null,\r\n height: null,\r\n SortByFieldsJSON: null,\r\n IsRandom: true,\r\n IsLoading: false,\r\n isRenaming: false, // Local only\r\n OverlapQuantity: 0,\r\n IsIncomplete: false,\r\n };\r\n dispatch(addThing(\"flowItems\", thing, idCallback));\r\n dispatch(flowEnsureItemDetailsExist());\r\n };\r\n\r\nexport const newFlowRelation = (parentId: number, childId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const relations = getFlowRelationsArray(state);\r\n const alreadyExists =\r\n relations.filter(x => x.ParentFlowItemId == parentId && x.ChildFlowItemId == childId).length > 0;\r\n if (alreadyExists) {\r\n return;\r\n }\r\n\r\n const thing: FlowRelation = {\r\n FlowRelationId: 0,\r\n ParentFlowItemId: parentId,\r\n ChildFlowItemId: childId,\r\n };\r\n dispatch(addThing(\"flowRelations\", thing));\r\n // Invalidate Child Items\r\n dispatch(invalidateItemAndChildren(childId));\r\n};\r\n\r\n// I think we need to brainstorm a differenct approach to turning off `SimpleFlow`\r\n// as we expand more and more 'types' of simple flow this is going to get messy.\r\n//\r\n// Especially when we expand to allow MANY filters\r\n//\r\nexport const stillSimpleFlow = () => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const flow: ?Flow = state.flows.byId[state.selected.flow];\r\n if (!flow || (flow && !flow.FlowBaseType) || (flow && flow.FlowBaseType == FlowBaseTypes.Default)) {\r\n return false;\r\n }\r\n const flowItems = getFlowItemsForSelectedFlow(state);\r\n const flowMultiExport = flowItems.filter(x => x.FlowItemType === \"multiexport\"); //Simple-Flow Multi Export to keep it simple flow\r\n if (flow.FlowBaseType == FlowBaseTypes.Campaign) {\r\n const flowFilters = flowItems.filter(x => x.FlowItemType === \"filter\")\r\n const flowSplits = flowItems.filter(x => x.FlowItemType === \"split\");\r\n //const flowExport = flowItems.filter(x => x.FlowItemType === \"export\");\r\n const flowCases = flowItems.filter(x => x.FlowItemType === \"case\");\r\n \r\n if (flowFilters.length > 1 && state.session.enabledFeatures.includes(\"simple-flow\")){\r\n dispatch(updateAttribute(\"flows\", state.selected.flow, \"FlowBaseType\", 0));\r\n return false;\r\n }\r\n if (flowCases.length > 1) {\r\n dispatch(updateAttribute(\"flows\", state.selected.flow, \"FlowBaseType\", 0));\r\n return false;\r\n }\r\n if (flowSplits.length > 1) {\r\n dispatch(updateAttribute(\"flows\", state.selected.flow, \"FlowBaseType\", 0));\r\n return false;\r\n }\r\n if (flowMultiExport.length > 1 && state.session.enabledFeatures.includes(\"simple-flow\")) {\r\n dispatch(updateAttribute(\"flows\", state.selected.flow, \"FlowBaseType\", 0));\r\n return false;\r\n }\r\n if (flowItems.filter(x => !validFilters.includes(x.FlowItemType)).length > 0) {\r\n dispatch(updateAttribute(\"flows\", state.selected.flow, \"FlowBaseType\", 0));\r\n return false;\r\n }\r\n } else if (flow.FlowBaseType == FlowBaseTypes.Model) {\r\n const flowModels = flowItems.filter(x => x.FlowItemType === \"model\");\r\n\r\n if (flowModels.length > 1) {\r\n dispatch(updateAttribute(\"flows\", state.selected.flow, \"FlowBaseType\", 0));\r\n return false;\r\n }\r\n } else if (flow.FlowBaseType == FlowBaseTypes.Undecided) {\r\n if (flowMultiExport.length == 1) {\r\n dispatch(updateAttribute(\"flows\", state.selected.flow, \"FlowBaseType\", 1));\r\n return true;\r\n }\r\n // if there's anything other than a filter, flip it to regular flow\r\n if (\r\n (flowItems.filter(x => ![\"filter\"].includes(x.FlowItemType)).length > 0 ||\r\n flowItems.filter(x => [\"filter\"].includes(x.FlowItemType)).length > 1) &&\r\n flowItems.filter(x => ![\"case\", \"empty\", \"export\"].includes(x.FlowItemType)).length > 0\r\n ) {\r\n dispatch(updateAttribute(\"flows\", state.selected.flow, \"FlowBaseType\", 0));\r\n return false;\r\n }\r\n } else {\r\n return false;\r\n }\r\n return true;\r\n};\r\n\r\nexport const updateTikTokTemplateFieldName = (flowItem, itemName, flowTikTokTemplateFields) => {\r\n const updateTikTokTemplates = Object.values(flowTikTokTemplateFields);\r\n const tikTokTemplatesToUpdate = updateTikTokTemplates\r\n .filter(x => x.ParentFlowItemId == flowItem.FlowItemId)\r\n .map(x => x.FlowExportTemplateId);\r\n return tikTokTemplatesToUpdate;\r\n};\r\n\r\n// Special Case: Update a FlowFilter if you don't have its id and only have the flowItemId\r\n// used by FlowBrowserTest.js\r\nexport const updateFilterCriteriaByItemId =\r\n (flowItemId: number, jsonCriteria: string) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const flowFilters = getFlowFiltersForSelectedFlow(state);\r\n const theseFilters = flowFilters.filter(x => x.FlowItemId == flowItemId);\r\n if (theseFilters.length == 0) {\r\n return;\r\n }\r\n const thisFilter = theseFilters[0];\r\n dispatch(updateAttribute(\"flowFilters\", thisFilter.FlowFilterId, \"FlowFilterCriteria\", jsonCriteria));\r\n };\r\n\r\nexport const newFlowFilter = (flowItemId: number) => (dispatch: Dispatch) => {\r\n const thing: FlowFilter = {\r\n FlowFilterId: 0,\r\n FlowItemId: flowItemId,\r\n FlowFilterCriteria: '{\"condition\": \"AND\",\"rules\": [],\"description\": \"\",\"valid\": true}', // Max\r\n FlowFilterCriteriaText: \"\",\r\n };\r\n dispatch(addThing(\"flowFilters\", thing));\r\n};\r\n\r\nexport const newFlowMultiExport = (flowItemId: number) => (dispatch: Dispatch) => {\r\n const thing: FlowMultiExport = {\r\n FlowMultiExportId: 0,\r\n FlowItemId: flowItemId,\r\n };\r\n dispatch(addThing(\"flowMultiExports\", thing));\r\n};\r\n\r\nexport const newFlowScript = (flowItemId: number) => (dispatch: Dispatch) => {\r\n const thing: FlowScript = {\r\n FlowScriptId: 0,\r\n FlowItemId: flowItemId,\r\n Script: \"\",\r\n SelectedScript: \"\",\r\n };\r\n dispatch(addThing(\"flowScripts\", thing));\r\n};\r\n\r\nexport const newFlowScriptDBUI = (flowItemId: number) => (dispatch: Dispatch) => {\r\n const thing: FlowScriptDBUI = {\r\n FlowScriptDBUIId: 0,\r\n FlowItemId: flowItemId,\r\n Script: \"\",\r\n SelectedScript: \"\",\r\n };\r\n dispatch(addThing(\"flowScriptsDBUI\", thing));\r\n};\r\n\r\nexport const newFlowScriptResult = (flowItemId: number) => (dispatch: Dispatch) => {\r\n const thing: FlowScriptResult = {\r\n FlowScriptResultId: 0,\r\n FlowItemId: flowItemId,\r\n ScriptId: 0,\r\n Sql: \"\",\r\n IsValid: true,\r\n InvalidReason: null,\r\n RowsAffected: 0,\r\n Preview: null,\r\n };\r\n dispatch(addThing(\"flowScriptResults\", thing));\r\n};\r\n\r\nexport const newFlowSingleView =\r\n (flowItemId: number, partnerId: number, isSelected: boolean) => (dispatch: Dispatch) => {\r\n const thing: FlowSingleView = {\r\n FlowSingleViewId: 0,\r\n FlowItemId: flowItemId,\r\n PartnerId: partnerId,\r\n FlowSingleViewQuantity: 0,\r\n Counted: false,\r\n IsSelected: isSelected,\r\n HouseholdQuantity: 0,\r\n IndividualQuantity: 0,\r\n DedupedHouseholdQuantity: 0,\r\n DedupedIndividualQuantity: 0,\r\n IsApprovalRequired: false,\r\n IsCountApproved: false,\r\n MeetsMinimumThreshold: false,\r\n StatusText: \"\",\r\n SingleViewKeyword: \"\",\r\n };\r\n dispatch(addThing(\"flowSingleViews\", thing));\r\n };\r\n\r\nexport const newFlowExport = (flowItemId: number) => (dispatch: Dispatch) => {\r\n const thing: FlowExport = {\r\n FlowExportId: 0,\r\n FlowItemId: flowItemId,\r\n ExportId: null,\r\n HasPII: false,\r\n ExportOnCalculate: false,\r\n DestinationId: 0,\r\n ShouldDeploy: true,\r\n CustomDedupe: false,\r\n IsMaxQtyOn: false,\r\n IsSplitOn: false,\r\n SelectedOfferId: null,\r\n IsApprovalRequired: false,\r\n IsCountApproved: false,\r\n MeetsMinimumThreshold: false,\r\n StatusText: \"\",\r\n IsDedupeSaved: false,\r\n IsCustomDedupeSaved: false,\r\n DeliveryTypeId: null,\r\n ScheduleId: null,\r\n SnowflakeSettingsId: 0,\r\n SnowflakeTable: \"\",\r\n AppendToExistingTable: false,\r\n };\r\n dispatch(addThing(\"flowExports\", thing));\r\n};\r\n\r\nexport const newBaseFlowExport =\r\n (multiId: number, destinationId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n let newItemId = 0;\r\n multiId = Number(multiId); // Convert multiId to a number\r\n dispatch(\r\n newFlowItem(id => (newItemId = id), \"New Item\", \"export\", {\r\n getLocationFromThisParent: multiId,\r\n })\r\n );\r\n\r\n dispatch(newFlowRelation(multiId, newItemId));\r\n // flowEnsureItemDetailsExist adds flowexport automatically so we have to update it afterwards\r\n const state = getState();\r\n const flowExports = getFlowExportsForSelectedFlow(state);\r\n const flowExport = flowExports.find(x => x.FlowItemId == newItemId);\r\n dispatch(updateAttribute(\"flowExports\", flowExport.FlowExportId, \"DestinationId\", destinationId));\r\n };\r\n\r\nexport const newFlowOutput = (flowItemId: number) => (dispatch: Dispatch) => {\r\n const thing: FlowOutput = {\r\n FlowOutputId: 0,\r\n FlowItemId: flowItemId,\r\n LayoutId: null,\r\n HasPII: false,\r\n ExportOnCalculate: false,\r\n DestinationId: 0,\r\n ShouldDeploy: true,\r\n IsApprovalRequired: false, // Local only\r\n IsCountApproved: false, // Local only\r\n MeetsMinimumThreshold: false, // Local only\r\n StatusText: \"\", // Local only\r\n };\r\n dispatch(addThing(\"flowOutputs\", thing));\r\n};\r\n\r\nexport const newFlowFromCloud = (flowItemId: number) => (dispatch: Dispatch) => {\r\n const thing: FlowFromCloud = {\r\n FlowFromCloudId: 0,\r\n FlowItemId: flowItemId,\r\n FromCompanyId: 0,\r\n FromUserId: 0,\r\n FromFlowId: 0,\r\n FromFlowItemId: 0,\r\n };\r\n dispatch(addThing(\"flowFromClouds\", thing));\r\n};\r\n\r\nexport const newFlowToCloud = (flowItemId: number) => (dispatch: Dispatch) => {\r\n const thing: FlowToCloud = {\r\n FlowToCloudId: 0,\r\n FlowItemId: flowItemId,\r\n ExpireDays: 30,\r\n TableResultCreationDate: \"\",\r\n };\r\n dispatch(addThing(\"flowToClouds\", thing));\r\n};\r\n\r\nexport const newFlowClientVariable =\r\n (variableId: number, flowId: number, variableValue: VariableValueType, isVisible: boolean) =>\r\n (dispatch: Dispatch) => {\r\n const thing: FlowClientVariableD = {\r\n Id: 0,\r\n VariableId: variableId,\r\n FlowId: flowId,\r\n VariableValue: variableValue,\r\n IsVisible: isVisible,\r\n };\r\n dispatch(addThing(\"flowClientVariables\", thing));\r\n };\r\n\r\nexport const newFlowItemOfferCode =\r\n (flowItemId: number, variableId: number, isVisible: boolean, sortOrder: number | null) => (dispatch: Dispatch) => {\r\n const thing: FlowItemOfferCode = {\r\n FlowItemOfferCodeId: 0,\r\n FlowItemId: flowItemId,\r\n VariableId: variableId,\r\n IsVisible: isVisible,\r\n SortOrder: sortOrder,\r\n };\r\n dispatch(addThing(\"flowItemOfferCodes\", thing));\r\n };\r\n\r\nexport const newFlowItemClientVariable =\r\n (\r\n variableId: number,\r\n flowId: number,\r\n flowItemId: number,\r\n childFlowItemId: number,\r\n variableValue: VariableValueType\r\n ) =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const flowItemCVs = getFlowItemClientVariablesForSelectedFlow(state);\r\n const flowItemClientVariables = flowItemCVs \r\n .filter(x => x.FlowItemId == flowItemId && x.ChildFlowItemId == childFlowItemId && x.VariableId == variableId);\r\n if (flowItemClientVariables.length == 0) {\r\n const thing: FlowItemClientVariableD = {\r\n FlowItemClientVariableId: 0,\r\n VariableId: variableId,\r\n FlowId: flowId,\r\n FlowItemId: flowItemId,\r\n ChildFlowItemId: childFlowItemId,\r\n VariableValue: variableValue,\r\n };\r\n dispatch(addThing(\"flowItemClientVariables\", thing));\r\n }\r\n };\r\n\r\nexport const newFlowSVDedupe =\r\n (flowItemId: number, dedupeKey: string = \"\", sortByFields: string = \"\") =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const defaultDedupeKey = dedupeKey || state.session.defaultDedupeKey;\r\n const dedupeSortByFields = sortByFields || state.session.dedupeSortByFields;\r\n const thing: FlowSVDedupeD = {\r\n FlowSVDedupeId: 0,\r\n FlowItemId: flowItemId,\r\n SVField: defaultDedupeKey || null,\r\n SortByFields: dedupeSortByFields && dedupeSortByFields.length > 0 ? JSON.parse(dedupeSortByFields) : [],\r\n };\r\n dispatch(addThing(\"flowSVDedupes\", thing));\r\n };\r\n\r\nexport const newFlowSVDedupeByDestination =\r\n (flowItemId: number, defaultDedupeKey: string, dedupeSortByFields: string) => (dispatch: Dispatch) => {\r\n const thing: FlowSVDedupeD = {\r\n FlowSVDedupeId: 0,\r\n FlowItemId: flowItemId,\r\n SVField: defaultDedupeKey || null,\r\n SortByFields: dedupeSortByFields && dedupeSortByFields.length > 0 ? JSON.parse(dedupeSortByFields) : [],\r\n };\r\n dispatch(addThing(\"flowSVDedupes\", thing));\r\n };\r\n\r\nexport const newFlowMerge = (flowItemId: number, parentId: number) => (dispatch: Dispatch) => {\r\n const thing: FlowMerge = {\r\n FlowMergeId: 0,\r\n FlowItemId: flowItemId,\r\n ParentFlowItemId: parentId,\r\n FlowMergeIsSuppresion: false,\r\n DupesQty: 0,\r\n UniquesQty: 0,\r\n FlowMergeIsInnerJoin: false,\r\n WillTrackDuplicates: false,\r\n };\r\n dispatch(addThing(\"flowMerges\", thing));\r\n};\r\n\r\nexport const newFlowOfferMerge = (flowItemId: number, parentId: number) => (dispatch: Dispatch) => {\r\n const thing: FlowOfferMerge = {\r\n FlowOfferMergeId: 0,\r\n FlowItemId: flowItemId,\r\n ParentFlowItemId: parentId,\r\n FlowOfferMergeIsSuppresion: false,\r\n DupesQty: 0,\r\n UniquesQty: 0,\r\n FlowOfferPriority: 0,\r\n MaxQty: 0,\r\n OutputQty: 0,\r\n FinalQty: 0,\r\n Deploy: true,\r\n };\r\n dispatch(addThing(\"flowOfferMerges\", thing));\r\n};\r\n\r\nexport const updateFlowOfferMerge = (flowOfferMergeId: number, flowOfferPriority: number) => (dispatch: Dispatch) => {\r\n dispatch(updateAttribute(\"flowOfferMerges\", flowOfferMergeId, \"FlowOfferPriority\", flowOfferPriority));\r\n};\r\n\r\nexport const newFlowReport = (flowItemId: number) => (dispatch: Dispatch) => {\r\n const thing: FlowReport = {\r\n FlowReportId: 0,\r\n FlowItemId: flowItemId,\r\n DimensionFieldKeys: \"\",\r\n MeasureFieldKeys: \"\",\r\n UniverseTableKey: 0,\r\n TransformMetadata: true,\r\n PivotConfig: null,\r\n FlowReportCriteria: null,\r\n };\r\n dispatch(addThing(\"flowReports\", thing));\r\n};\r\n\r\nexport const newFlowModel = (flowItemId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const thing: FlowModel = {\r\n FlowModelId: 0,\r\n FlowItemId: flowItemId,\r\n DesiredHHQuantity: null,\r\n ModelFilename: \"Default 500k sample\",\r\n TargetFlowItemId: null,\r\n BaseFlowItemId: null,\r\n BaseFilename: \"\",\r\n DestinationCompanyId: state.session.companyId,\r\n ModelStatus: \"\",\r\n BaseLuidQty: null,\r\n TargetLuidQty: null,\r\n Bundle: 1,\r\n };\r\n dispatch(addThing(\"flowModels\", thing));\r\n};\r\n\r\nexport const newFlowExportReport = (parentFlowItemId: number, LayoutId: number) => (dispatch: Dispatch) => {\r\n let newItemId = 0;\r\n dispatch(\r\n newFlowItem(id => (newItemId = id), \"New Item\", \"exportreport\", {\r\n getLocationFromThisParent: parentFlowItemId,\r\n })\r\n );\r\n const thing: FlowExportReport = {\r\n FlowExportReportId: 0,\r\n FlowItemId: newItemId,\r\n ParentFlowItemId: parentFlowItemId,\r\n DimensionFieldKeys: \"\",\r\n MeasureFieldKeys: \"\",\r\n LayoutId,\r\n TransformMetadata: true,\r\n PivotConfig: null,\r\n };\r\n dispatch(addThing(\"flowExportReports\", thing));\r\n\r\n dispatch(newFlowRelation(parentFlowItemId, newItemId));\r\n};\r\n\r\nexport const newFlowCannedReport = (flowItemId: number) => (dispatch: Dispatch) => {\r\n const thing: FlowCannedReport = {\r\n FlowCannedReportId: 0,\r\n FlowItemId: flowItemId,\r\n DimensionFieldKeys: \"\",\r\n MeasureFieldKeys: \"\",\r\n StoredProcedureID: 0,\r\n DatabaseIn: \"\",\r\n SchemaIn: \"\",\r\n TableIn: \"\",\r\n DatabaseOut: \"\",\r\n SchemaOut: \"\",\r\n TableOut: \"\",\r\n SortByColumns: null,\r\n };\r\n\r\n dispatch(addThing(\"flowCannedReports\", thing));\r\n};\r\n\r\nexport const duplicatedFlowExportReport =\r\n (parentFlowItemId: number, LayoutId: number, childrenId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n let newItemId = 0;\r\n let value = [];\r\n let dimensionFieldKeys = \"\";\r\n let measureFieldKeys = \"\";\r\n const state = getState();\r\n const flowExportReportDuplicated = state.flowExportReports.byId;\r\n for (const key in flowExportReportDuplicated) {\r\n if (flowExportReportDuplicated[key].FlowItemId == childrenId) {\r\n value = flowExportReportDuplicated[key];\r\n dimensionFieldKeys = value.DimensionFieldKeys;\r\n measureFieldKeys = value.MeasureFieldKeys;\r\n }\r\n }\r\n dispatch(\r\n newFlowItem(id => (newItemId = id), state.flowItems.byId[childrenId].FlowItemName, \"exportreport\", {\r\n getLocationFromThisParent: parentFlowItemId,\r\n })\r\n );\r\n const thing: FlowExportReport = {\r\n FlowExportReportId: 0,\r\n FlowItemId: newItemId,\r\n ParentFlowItemId: parentFlowItemId,\r\n DimensionFieldKeys: dimensionFieldKeys,\r\n MeasureFieldKeys: measureFieldKeys,\r\n LayoutId,\r\n TransformMetadata: true,\r\n PivotConfig: null,\r\n };\r\n dispatch(addThing(\"flowExportReports\", thing));\r\n\r\n dispatch(newFlowRelation(parentFlowItemId, newItemId));\r\n };\r\n\r\nexport const newFlowSplit =\r\n (\r\n flowItemId: number,\r\n absoluteOrRelative: \"absolute\" | \"relative\",\r\n isDefault: boolean,\r\n flowItemHasBalance: boolean\r\n ) =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n const flowSplitsByItemId = getFlowSplitsByFlowItemId(getState());\r\n let numSplits = 0;\r\n\r\n if (flowSplitsByItemId[flowItemId] != null) {\r\n if (flowSplitsByItemId[flowItemId].filter(x => !x.IsBalance) != null) {\r\n numSplits = flowSplitsByItemId[flowItemId].filter(x => !x.IsBalance).length;\r\n }\r\n numSplits++;\r\n }\r\n if (numSplits == 0 && !isDefault && flowItemHasBalance) {\r\n numSplits = 1;\r\n dispatch(newFlowSplit(flowItemId, absoluteOrRelative, true, true)); // creates default first\r\n }\r\n if (numSplits == 0) {\r\n numSplits = 1;\r\n }\r\n\r\n const newLetter = String.fromCharCode(\"A\".charCodeAt(0) + ((numSplits % 26) - 1));\r\n // Add Split Row\r\n let newSplitId = 0;\r\n const thing: FlowSplit = {\r\n FlowSplitId: 0,\r\n FlowItemId: flowItemId,\r\n AbsoluteOrRelative: absoluteOrRelative,\r\n FlowSplitQty: 0,\r\n ChildFlowItemId: 0,\r\n FlowSplitSort: \"\", // 1\r\n FlowSplitQuantile: 0,\r\n AbsoluteNumRows: 0,\r\n IsBalance: isDefault,\r\n RelativePercentRows: 0,\r\n FlowItemHasBalance: flowItemHasBalance,\r\n };\r\n dispatch(addThing(\"flowSplits\", thing, id => (newSplitId = id)));\r\n\r\n // Add FlowItem to hold the empty\r\n let newEmptyItemId = 0;\r\n dispatch(\r\n newFlowItem(id => (newEmptyItemId = id), \"AutoGenEmpty\", \"empty\", { getLocationFromThisParent: flowItemId })\r\n );\r\n\r\n const criteria = isDefault ? \"Balance\" : newLetter;\r\n // Add FlowEmpty Row\r\n dispatch(newFlowEmpty(newEmptyItemId, () => false, criteria));\r\n\r\n // Update FlowSplit to point to the new empty row\r\n dispatch(updateAttribute(\"flowSplits\", newSplitId, \"ChildFlowItemId\", newEmptyItemId));\r\n // Also Add Relation\r\n dispatch(newFlowRelation(flowItemId, newEmptyItemId));\r\n };\r\n\r\nexport const cloneCase = (flowCase: FlowCaseAndEmpty) => (dispatch: Dispatch, getState: GetState) => {\r\n const flowCasesByItemId = getFlowCasesByFlowItemId(getState());\r\n let numCases = 0;\r\n let flowItemId = flowCase.FlowItemId;\r\n\r\n if (flowCasesByItemId[flowItemId] != null) {\r\n numCases = flowCasesByItemId[flowItemId][0].FlowItemHasBalance\r\n ? flowCasesByItemId[flowItemId].length\r\n : flowCasesByItemId[flowItemId].length + 1;\r\n }\r\n\r\n const newLetter = String.fromCharCode(\"A\".charCodeAt(0) + ((numCases % 26) - 1));\r\n\r\n let newCaseId = 0;\r\n const thing: FlowCase = {\r\n FlowCaseId: 0,\r\n FlowItemId: flowItemId,\r\n FlowCaseCriteria: flowCase.FlowCaseCriteria,\r\n FlowCasePriority: numCases,\r\n ChildFlowItemId: 0,\r\n FlowCaseLabel: newLetter,\r\n IsBalance: false,\r\n FlowItemHasBalance: flowCase.FlowItemHasBalance,\r\n };\r\n dispatch(addThing(\"flowCases\", thing, id => (newCaseId = id)));\r\n\r\n // Add FlowItem to hold the empty\r\n let newEmptyItemId = 0;\r\n dispatch(\r\n newFlowItem(id => (newEmptyItemId = id), \"AutoGenEmpty\", \"empty\", { getLocationFromThisParent: flowItemId })\r\n );\r\n\r\n // Add FlowEmpty Row\r\n const criteria = newLetter;\r\n dispatch(newFlowEmpty(newEmptyItemId, () => false, criteria));\r\n\r\n // Update FlowSplit to point to the new empty row\r\n dispatch(updateAttribute(\"flowCases\", newCaseId, \"ChildFlowItemId\", newEmptyItemId));\r\n // Also Add Relation\r\n dispatch(newFlowRelation(flowItemId, newEmptyItemId));\r\n};\r\n\r\nexport const newFlowDataLoad = (flowItemId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n\r\n const thing: FlowDataLoad = {\r\n FlowDataLoadId: 0,\r\n FlowItemId: flowItemId,\r\n FlowTableToLoad: null,\r\n ParentFolderId: null,\r\n FolderName: null,\r\n RetentionDays: state.session.DataRetentionDaysDefault,\r\n RefreshMetadata: true,\r\n };\r\n dispatch(addThing(\"flowDataLoads\", thing));\r\n};\r\n\r\nexport const newFlowDataLoadColumn =\r\n (flowItemId: number, columnName: string, isDefault: boolean = false) =>\r\n (dispatch: Dispatch) => {\r\n const thing: FlowDataLoadColumn = {\r\n FlowDataLoadColumnId: 0,\r\n FlowItemId: flowItemId,\r\n ColumnName: columnName,\r\n Invisible: false,\r\n JoinColumn: null,\r\n IsDefault: isDefault,\r\n };\r\n dispatch(addThing(\"flowDataLoadColumns\", thing));\r\n };\r\n\r\nexport const newFlowOffload = (flowItemId: number) => (dispatch: Dispatch) => {\r\n const thing: FlowOffload = {\r\n FlowOffloadId: 0,\r\n FlowItemId: flowItemId,\r\n TableName: null,\r\n DestinationId: 0,\r\n FileName: null,\r\n FileExtension: 0,\r\n FileDelimiter: null,\r\n IsFixedFile: true,\r\n IncludeLayoutFile: false,\r\n AutoRefreshColums: false,\r\n };\r\n dispatch(addThing(\"flowOffloads\", thing));\r\n};\r\n\r\nexport const newFlowOffloadColumn =\r\n (\r\n flowItemId: number,\r\n columnName: string,\r\n order: number,\r\n columnLength: number,\r\n deployColumn: boolean = true,\r\n sortOrder: number = 0\r\n ) =>\r\n (dispatch: Dispatch) => {\r\n const thing: FlowOffloadColumn = {\r\n FlowOffloadColumnId: 0,\r\n FlowItemId: flowItemId,\r\n ColumnName: columnName,\r\n DeployColumn: deployColumn,\r\n ColumnLength: columnLength > 0 ? columnLength : 10,\r\n Order: order,\r\n SortOrdinance: sortOrder,\r\n };\r\n dispatch(addThing(\"flowOffloadColumns\", thing));\r\n };\r\n\r\nexport const newFlowExternalService = (flowItemId: number) => (dispatch: Dispatch) => {\r\n const thing: FlowExternalService = {\r\n FlowExternalServiceId: 0,\r\n FlowItemId: flowItemId,\r\n ServiceModelId: 0,\r\n ServicesJSON: [],\r\n FileLocationId: 0,\r\n FileName: null,\r\n OutputLocationId: 0,\r\n InputHeaderRow: false,\r\n AdditionalPersons: \"none\",\r\n DeploySettingId: 0,\r\n SnowflakeSettingsId: 0,\r\n SnowflakeTable: \"\",\r\n AppendToExistingTable: false,\r\n };\r\n dispatch(addThing(\"flowExternalServices\", thing));\r\n};\r\n\r\nexport const newFlowExternalServiceParameter =\r\n (flowItemId: number, serviceId: number, parameterId: number, value: string) => (dispatch: Dispatch) => {\r\n const thing: FlowExternalServiceParameter = {\r\n FlowServiceParameterId: 0,\r\n FlowItemId: flowItemId,\r\n ServiceId: serviceId,\r\n ParameterId: parameterId,\r\n Value: value,\r\n };\r\n dispatch(addThing(\"flowExternalServiceParameters\", thing));\r\n };\r\n\r\nexport const newFlowExternalServiceInput =\r\n (flowItemId: number, number: number, name: string, quantity: number, nasServerId: number = 0) =>\r\n (dispatch: Dispatch) => {\r\n const thing: FlowExternalServiceInput = {\r\n InputId: 0,\r\n FlowItemId: flowItemId,\r\n InputNumber: number,\r\n InputName: name,\r\n InputQuantity: quantity,\r\n NasServerId: nasServerId,\r\n };\r\n dispatch(addThing(\"flowExternalServiceInputs\", thing));\r\n };\r\n\r\nexport const newFlowExternalServiceHardcode =\r\n (flowItemId: number, name: string, value: string) => (dispatch: Dispatch) => {\r\n const thing: FlowExternalServiceHardcode = {\r\n HardcodeId: 0,\r\n FlowItemId: flowItemId,\r\n HardcodeName: name,\r\n HardcodeValue: value,\r\n };\r\n dispatch(addThing(\"flowExternalServiceHardcodes\", thing));\r\n };\r\n\r\nexport const newFlowGuideSetting =\r\n (flowId: number, isSplitOn: boolean = false) =>\r\n (dispatch: Dispatch) => {\r\n const thing: FlowGuideSetting = {\r\n FlowGuideId: 0,\r\n FlowId: flowId,\r\n IsSplitOn: isSplitOn,\r\n };\r\n dispatch(addThing(\"flowGuideSettings\", thing));\r\n };\r\n\r\nexport const newFlowExportTemplateFields =\r\n (flowItemId: number, parentId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const newMetaTemplate = state.session.enabledFeatures.includes(\"new-metadata-driver-field\");\r\n const thing: FlowExportTemplateFields = {\r\n FlowExportTemplateId: 0,\r\n FlowItemId: flowItemId,\r\n ParentFlowItemId: parentId,\r\n Description: null,\r\n AdAccountIds: null,\r\n CustomerFileSource: newMetaTemplate ? \"PARTNER_PROVIDED_ONLY\" : null,\r\n EmailAddress: null,\r\n };\r\n dispatch(addThing(\"flowExportTemplateFields\", thing));\r\n };\r\n\r\nexport const getDefaultDate = () => {\r\n const defaultDate = new Date();\r\n defaultDate.setMonth(defaultDate.getMonth() + 6);\r\n return defaultDate;\r\n};\r\n\r\nexport const newFlowExportPinterestTemplateFields =\r\n (flowItemId: number, parentId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const parent: ?FlowItem = state.flowItems.byId[parentId];\r\n\r\n const thing: FlowExportPinterestTemplateFields = {\r\n TargetingAudienceName: parent.FlowItemName,\r\n FlowExportTemplateId: 0,\r\n FlowItemId: flowItemId,\r\n ParentFlowItemId: parentId,\r\n PinterestAccountID: null,\r\n OldAudienceID: null,\r\n NotificationEmails: null,\r\n };\r\n dispatch(addThing(\"flowExportPinterestTemplateFields\", thing));\r\n };\r\n\r\nexport const newFlowExportTikTokTemplateFields =\r\n (flowItemId: number, parentId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const parent: ?FlowItem = state.flowItems.byId[parentId];\r\n\r\n const thing: FlowExportTikTokTemplateFields = {\r\n TargetingAudienceName: parent.FlowItemName,\r\n FlowExportTemplateId: 0,\r\n FlowItemId: flowItemId,\r\n ParentFlowItemId: parentId,\r\n AdvertiserID: null,\r\n };\r\n dispatch(addThing(\"flowExportTikTokTemplateFields\", thing));\r\n };\r\n\r\nexport const newFlowExportFreewheelDriverFileFields =\r\n (flowItemId: number, parentId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const parent: ?FlowItem = state.flowItems.byId[parentId];\r\n const ratesByFlowItemId = getFieldRatesByParentFlowItemId(state);\r\n const fieldRate = ratesByFlowItemId[parentId];\r\n const hasFieldRatePricing = state.session.enabledFeatures.includes(\"display-field-rates\");\r\n const maxCPM = hasFieldRatePricing ? fieldRate : null;\r\n\r\n const thing: FlowExportFreewheelDriverFileFields = {\r\n FlowExportFreewheelDriverFileFieldId: 0,\r\n FlowItemId: flowItemId,\r\n ParentFlowItemId: parentId,\r\n IdTypes: null,\r\n SegmentName: formatName(parent.FlowItemName).substring(0, 25),\r\n NetworkId: \"\",\r\n CategoryName: \"\",\r\n SegmentDescription: \"\",\r\n SubGroupDescription: \"\",\r\n Custom: true,\r\n Price: maxCPM,\r\n CompanyName: \"\",\r\n };\r\n\r\n dispatch(addThing(\"flowExportFreewheelDriverFileFields\", thing));\r\n };\r\n\r\nexport const updateFlowExportMagniteDriverFileCPMFields =\r\n (ratesByFlowItem: { [key: number]: number }) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n\r\n const flowExportFreewheelDriverFileFields = getFlowExportFreewheelDriverFileFieldsForSelectedFlow(state);\r\n\r\n for (const item of flowExportFreewheelDriverFileFields) {\r\n const cpm = ratesByFlowItem[item.ParentFlowItemId] || null;\r\n\r\n if (item.Price != cpm) {\r\n dispatch(\r\n updateAttribute(\r\n \"flowExportFreewheelDriverFileFields\",\r\n item.FlowExportFreewheelDriverFileFieldId,\r\n \"Price\",\r\n cpm\r\n )\r\n );\r\n }\r\n }\r\n };\r\n\r\nexport const newFlowExportTaxonomyFileFields =\r\n (flowItemId: number, parentId: number, values: string) => (dispatch: Dispatch) => {\r\n // const state = getState();\r\n // const parent: ?FlowItem = state.flowItems.byId[parentId];\r\n\r\n const thing: FlowExportTaxonomyFileFields = {\r\n FlowExportTaxonomyFileFieldId: 0,\r\n FlowItemId: flowItemId,\r\n ParentFlowItemId: parentId,\r\n ValueJSON: JSON.stringify(values),\r\n };\r\n dispatch(addThing(\"flowExportTaxonomyFileFields\", thing));\r\n };\r\n\r\nexport const newFlowExportTradeDeskTemplateFields =\r\n (flowItemId: number, parentId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const parent: ?FlowItem = state.flowItems.byId[parentId];\r\n const hasFieldRatePricing = state.session.enabledFeatures.includes(\"display-field-rates\");\r\n\r\n const thing: FlowExportTradeDeskTemplateFields = {\r\n AudienceName: parent.FlowItemName,\r\n FlowExportTemplateId: 0,\r\n FlowItemId: flowItemId,\r\n ParentFlowItemId: parentId,\r\n Description: null,\r\n ExpansionType: \"HOUSEHOLD\",\r\n RateType: \"CPM\",\r\n CostPerMillion: newCPMandPOM(state, parent, flowItemId, parentId, hasFieldRatePricing, 1, true),\r\n PercentOfMediaCost: newCPMandPOM(state, parent, flowItemId, parentId, hasFieldRatePricing, 2, true),\r\n TTL: 30,\r\n ParentElementId: null,\r\n ParentElementName: null,\r\n ExpirationDate: getDefaultDate(),\r\n IsAutoGeneratedCPM: hasFieldRatePricing ? true : false,\r\n IsAutoGeneratedPOM: hasFieldRatePricing ? true : false,\r\n };\r\n dispatch(addThing(\"flowExportTradeDeskTemplateFields\", thing));\r\n };\r\n\r\n export const newFlowExportPubmaticTemplateFields =\r\n (flowItemId: number, parentId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const parent: ?FlowItem = state.flowItems.byId[parentId];\r\n const hasFieldRatePricing = state.session.enabledFeatures.includes(\"display-field-rates\");\r\n\r\n const thing: FlowExportPubmaticTemplateFields = {\r\n AudienceName: parent.FlowItemName,\r\n FlowExportTemplateId: 0,\r\n FlowItemId: flowItemId,\r\n ParentFlowItemId: parentId,\r\n Description: null,\r\n ExpansionType: \"HOUSEHOLD\",\r\n RateType: \"CPM\",\r\n CostPerMillion: newCPMandPOM(state, parent, flowItemId, parentId, hasFieldRatePricing, 1, true),\r\n PercentOfMediaCost:0,\r\n TTL: 30,\r\n ParentElementId: null,\r\n ParentElementName: null,\r\n ExpirationDate: getDefaultDate(),\r\n IsAutoGeneratedCPM: hasFieldRatePricing ? true : false,\r\n IsAutoGeneratedPOM: hasFieldRatePricing ? true : false,\r\n };\r\n dispatch(addThing(\"flowExportPubmaticTemplateFields\", thing));\r\n };\r\n\r\nexport const getUpdatedCPMandPOM =\r\n (parent, flowItemId, parentId, hasFieldRatePricing, cpmOrPom) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n let returnValue = newCPMandPOM(state, parent, flowItemId, parentId, hasFieldRatePricing, cpmOrPom, true);\r\n return returnValue;\r\n };\r\n\r\nfunction getAllIdValues(obj, idValues) {\r\n for (const [key, value] of Object.entries(obj)) {\r\n if (value && typeof value === \"object\") {\r\n getAllIdValues(value, idValues);\r\n } else if (key == \"id\") {\r\n idValues.push(value);\r\n }\r\n }\r\n}\r\n\r\nconst newCPMandPOM = (state, parent, flowItemId, parentId, hasFieldRatePricing, cpmOrPom, hasTTDPricing) => {\r\n let returnCPMvalue = 0;\r\n let returnPOMvalue = 0;\r\n const flowFiltersByFlowItemId = getFlowFiltersByFlowItemId(state);\r\n const fields = state.fields;\r\n const fieldRatesById = state.fieldsByCompany.fieldRates;\r\n const taxFieldRatesById = state.fieldsByCompany.taxmanFieldRates;\r\n\r\n if (hasFieldRatePricing) {\r\n // let cpmValue = 0.0;\r\n // let pomValue = 0.0;\r\n let cpmFRValue = 0.0;\r\n let pomFRValue = 0.0;\r\n\r\n // const flowItemsArray = Object.values(flowItems);\r\n const FlowItem = parent; // flowItemsArray.find(x => x.FlowItemId == cellInfo.ParentFlowItemId);\r\n if (!FlowItem || !(FlowItem.FlowItemType == \"filter\" || FlowItem.FlowItemType == \"empty\")) {\r\n return returnCPMvalue;\r\n }\r\n if (FlowItem.FlowItemType == \"filter\") {\r\n const flowFiltersArray = Object.values(flowFiltersByFlowItemId);\r\n const FlowFilter = flowFiltersArray.find(x => x.FlowItemId == parentId);\r\n const conditions = FlowFilter.FlowFilterCriteria;\r\n\r\n if (!conditions) {\r\n return returnCPMvalue;\r\n }\r\n\r\n const conditionsJSON = JSON.parse(conditions);\r\n const ids = [];\r\n\r\n getAllIdValues(conditionsJSON, ids);\r\n\r\n if (fields && ids) {\r\n ids.map(id => {\r\n const fieldINeed = fields.byId[id];\r\n if (hasFieldRatePricing) {\r\n let fieldRatetoUse = fieldRatesById[fieldINeed.UmbrellaFieldId];\r\n let taxmanFieldRatetoUse = taxFieldRatesById[id || 0];\r\n if (fieldRatetoUse) {\r\n let cpmValueForCurrentFieldId = hasTTDPricing\r\n ? fieldRatetoUse.CPMCapTTD\r\n : fieldRatetoUse.CPM;\r\n let pomValueForCurrentFieldId = hasTTDPricing\r\n ? fieldRatetoUse.PercentOfMediaTTD\r\n : fieldRatetoUse.PercentOfMedia;\r\n if (cpmValueForCurrentFieldId > cpmFRValue) {\r\n cpmFRValue = cpmValueForCurrentFieldId;\r\n }\r\n if (pomValueForCurrentFieldId > pomFRValue) {\r\n pomFRValue = pomValueForCurrentFieldId;\r\n }\r\n } else if (taxmanFieldRatetoUse) {\r\n let cpmValueForCurrentFieldId = hasTTDPricing\r\n ? taxmanFieldRatetoUse.CPMCapTTD\r\n : taxmanFieldRatetoUse.CPM;\r\n let pomValueForCurrentFieldId = hasTTDPricing\r\n ? taxmanFieldRatetoUse.PercentOfMediaTTD\r\n : taxmanFieldRatetoUse.PercentOfMedia;\r\n if (cpmValueForCurrentFieldId > cpmFRValue) {\r\n cpmFRValue = cpmValueForCurrentFieldId;\r\n }\r\n if (pomValueForCurrentFieldId > pomFRValue) {\r\n pomFRValue = pomValueForCurrentFieldId;\r\n }\r\n }\r\n }\r\n });\r\n }\r\n }\r\n\r\n if (FlowItem.FlowItemType == \"empty\") {\r\n const ids = GetFieldsIds(parentId, state);\r\n if (fields && ids) {\r\n ids.map(id => {\r\n const fieldINeed = fields.byId[id];\r\n\r\n if (hasFieldRatePricing) {\r\n let fieldRatetoUse = fieldRatesById[fieldINeed.id];\r\n let taxmanFieldRatetoUse = taxFieldRatesById[id || 0];\r\n if (fieldRatetoUse) {\r\n let cpmValueForCurrentFieldId = hasTTDPricing\r\n ? fieldRatetoUse.CPMCapTTD\r\n : fieldRatetoUse.CPM;\r\n let pomValueForCurrentFieldId = hasTTDPricing\r\n ? fieldRatetoUse.PercentOfMediaTTD\r\n : fieldRatetoUse.PercentOfMedia;\r\n if (cpmValueForCurrentFieldId > cpmFRValue) {\r\n cpmFRValue = cpmValueForCurrentFieldId;\r\n }\r\n if (pomValueForCurrentFieldId > pomFRValue) {\r\n pomFRValue = pomValueForCurrentFieldId;\r\n }\r\n } else if (taxmanFieldRatetoUse) {\r\n let cpmValueForCurrentFieldId = hasTTDPricing\r\n ? taxmanFieldRatetoUse.CPMCapTTD\r\n : taxmanFieldRatetoUse.CPM;\r\n let pomValueForCurrentFieldId = hasTTDPricing\r\n ? taxmanFieldRatetoUse.PercentOfMediaTTD\r\n : taxmanFieldRatetoUse.PercentOfMedia;\r\n if (cpmValueForCurrentFieldId > cpmFRValue) {\r\n cpmFRValue = cpmValueForCurrentFieldId;\r\n }\r\n if (pomValueForCurrentFieldId > pomFRValue) {\r\n pomFRValue = pomValueForCurrentFieldId;\r\n }\r\n }\r\n }\r\n });\r\n }\r\n }\r\n\r\n if (hasFieldRatePricing) {\r\n returnCPMvalue = cpmFRValue;\r\n returnPOMvalue = pomFRValue;\r\n }\r\n }\r\n if (cpmOrPom == 1) {\r\n return returnCPMvalue;\r\n } else {\r\n return returnPOMvalue;\r\n }\r\n};\r\n\r\nconst GetFieldsIds = (parentId, state) => {\r\n let ids;\r\n\r\n // Looking into Case nodes\r\n const flowCases = getFlowCasesForSelectedFlow(state);\r\n const flowCasesArray = Object.values(flowCases);\r\n const flowCase = flowCasesArray.find(x => x.ChildFlowItemId == parentId);\r\n const flowRelations = Object.values(state.flowRelations.byId);\r\n const flowSplits = getFlowSplitsForSelectedFlow(state);\r\n const flowFilters = getFlowFiltersForSelectedFlow(state);\r\n\r\n if (flowCase) {\r\n const conditions = flowCase.FlowCaseCriteria;\r\n\r\n if (!conditions) {\r\n return ids;\r\n }\r\n\r\n const conditionsJSON = JSON.parse(conditions);\r\n const rules = conditionsJSON.rules;\r\n\r\n ids = rules.map(rule => rule.id);\r\n } else {\r\n // Looking into Split nodes because the flow item isn't from Case node\r\n const flowSplitsArray = Object.values(flowSplits);\r\n const flowSplit = flowSplitsArray.find(x => x.ChildFlowItemId == parentId);\r\n\r\n if (flowSplit) {\r\n ids = getAncestorFilterFieldIdsForFlowItemId(\r\n flowSplit.FlowItemId,\r\n Object.values(flowRelations),\r\n Object.values(flowFilters)\r\n );\r\n }\r\n }\r\n\r\n return ids;\r\n};\r\n\r\nexport const newFlowCase =\r\n (flowItemId: number, isDefault: boolean, flowItemHasBalance: boolean) =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n // Add Case Row\r\n const flowCasesByItemId = getFlowCasesByFlowItemId(getState());\r\n let numCases = 0;\r\n\r\n if (flowCasesByItemId[flowItemId] != null) {\r\n if (flowCasesByItemId[flowItemId].filter(x => !x.IsBalance) != null) {\r\n numCases = flowCasesByItemId[flowItemId].filter(x => !x.IsBalance).length;\r\n }\r\n numCases++;\r\n }\r\n if (numCases == 0 && !isDefault && flowItemHasBalance) {\r\n numCases = 1;\r\n dispatch(newFlowCase(flowItemId, true, true)); // creates default first\r\n }\r\n\r\n if (numCases == 0) {\r\n numCases = 1;\r\n }\r\n\r\n const newLetter = String.fromCharCode(\"A\".charCodeAt(0) + ((numCases % 26) - 1));\r\n\r\n let newCaseId = 0;\r\n const thing: FlowCase = isDefault\r\n ? {\r\n FlowCaseId: 0,\r\n FlowItemId: flowItemId,\r\n FlowCaseCriteria: null,\r\n FlowCasePriority: 0,\r\n ChildFlowItemId: 0,\r\n FlowCaseLabel: \"Balance\",\r\n IsBalance: true,\r\n FlowItemHasBalance: flowItemHasBalance,\r\n }\r\n : {\r\n FlowCaseId: 0,\r\n FlowItemId: flowItemId,\r\n FlowCaseCriteria: null,\r\n FlowCasePriority: numCases,\r\n ChildFlowItemId: 0,\r\n FlowCaseLabel: newLetter,\r\n IsBalance: false,\r\n FlowItemHasBalance: flowItemHasBalance,\r\n };\r\n dispatch(addThing(\"flowCases\", thing, id => (newCaseId = id)));\r\n\r\n // Add FlowItem to hold the empty\r\n let newEmptyItemId = 0;\r\n dispatch(\r\n newFlowItem(id => (newEmptyItemId = id), \"AutoGenEmpty\", \"empty\", { getLocationFromThisParent: flowItemId })\r\n );\r\n\r\n // Add FlowEmpty Row\r\n const criteria = isDefault ? \"Balance\" : newLetter;\r\n dispatch(newFlowEmpty(newEmptyItemId, () => false, criteria));\r\n\r\n // Update FlowSplit to point to the new empty row\r\n dispatch(updateAttribute(\"flowCases\", newCaseId, \"ChildFlowItemId\", newEmptyItemId));\r\n // Also Add Relation\r\n dispatch(newFlowRelation(flowItemId, newEmptyItemId));\r\n };\r\n\r\nexport const newFlowSegmentSplit =\r\n (flowItemId: number, parentFlowItemId: number, absoluteOrRelative: string) =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const segmentSplitsByItemId = getFlowSegmentSplitsByFlowItemId(state);\r\n const thisItemSplits = segmentSplitsByItemId[flowItemId] || [];\r\n const parentSplits = thisItemSplits.filter(x => x.ParentFlowItemId == parentFlowItemId);\r\n\r\n // using the same logic used in flowSplits\r\n const numSplits = parentSplits.length == 0 ? 1 : parentSplits.length + 1;\r\n const newLetter = String.fromCharCode(\"A\".charCodeAt(0) + ((numSplits % 26) - 1));\r\n const thing: FlowSegmentSplit = {\r\n SegmentSplitId: 0,\r\n SegmentName: newLetter,\r\n FlowItemId: flowItemId,\r\n ParentFlowItemId: parentFlowItemId,\r\n AbsoluteOrRelative: absoluteOrRelative,\r\n AbsoluteNumRows: 0,\r\n RelativePercentRows: 0,\r\n SplitQuantity: 0,\r\n IsIncludeInDeploy: true,\r\n };\r\n\r\n dispatch(addThing(\"flowSegmentSplits\", thing));\r\n };\r\n\r\nexport const newFlowSegmentSplitAndOffers =\r\n (\r\n flowItemId: number,\r\n parentFlowItemId: number,\r\n absoluteOrRelative: string,\r\n requiredOfferCodes: Array\r\n ) =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const segmentSplitsByItemId = getFlowSegmentSplitsByFlowItemId(state);\r\n const thisItemSplits = segmentSplitsByItemId[flowItemId] || [];\r\n const parentSplits = thisItemSplits.filter(x => x.ParentFlowItemId == parentFlowItemId);\r\n\r\n // using the same logic used in flowSplits\r\n const numSplits = parentSplits.length == 0 ? 1 : parentSplits.length + 1;\r\n const newLetter = String.fromCharCode(\"A\".charCodeAt(0) + ((numSplits % 26) - 1));\r\n const thing: FlowSegmentSplit = {\r\n SegmentSplitId: 0,\r\n SegmentName: newLetter,\r\n FlowItemId: flowItemId,\r\n ParentFlowItemId: parentFlowItemId,\r\n AbsoluteOrRelative: absoluteOrRelative,\r\n AbsoluteNumRows: 0,\r\n RelativePercentRows: 0,\r\n SplitQuantity: 0,\r\n IsIncludeInDeploy: true,\r\n };\r\n\r\n let newSplitId = 0;\r\n\r\n dispatch(addThing(\"flowSegmentSplits\", thing, id => (newSplitId = id)));\r\n\r\n requiredOfferCodes.forEach(element => {\r\n const offer: FlowSegmentSplitOffer = {\r\n SegmentSplitOfferId: 0,\r\n SegmentSplitId: newSplitId,\r\n DestinationOfferId: element.Id,\r\n Value: \"\",\r\n FlowItemId: flowItemId,\r\n };\r\n dispatch(addThing(\"flowSegmentSplitOffers\", offer));\r\n });\r\n };\r\n\r\nexport const newFlowSegmentSplitOffers =\r\n (flowItemId: number, segmentSplitId: number, requiredOfferCodes: Array) =>\r\n (dispatch: Dispatch) => {\r\n requiredOfferCodes.forEach(element => {\r\n const offer: FlowSegmentSplitOffer = {\r\n SegmentSplitOfferId: 0,\r\n SegmentSplitId: segmentSplitId,\r\n DestinationOfferId: element.Id,\r\n Value: \"\",\r\n FlowItemId: flowItemId,\r\n };\r\n dispatch(addThing(\"flowSegmentSplitOffers\", offer));\r\n });\r\n };\r\n\r\nexport const newFlowSegmentSplitOverWrite =\r\n (flowItemId: number, parentFlowItemId: number, absoluteOrRelative: string) =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const thisFlowParentItem: FlowItem = state.flowItems.byId[parentFlowItemId];\r\n if (thisFlowParentItem) {\r\n // Added to prevent blank screen when no parent exists. #44922\r\n // using the same logic used in flowSplits\r\n const thing: FlowSegmentSplit = {\r\n SegmentSplitId: 0,\r\n SegmentName: thisFlowParentItem.FlowItemName,\r\n FlowItemId: flowItemId,\r\n ParentFlowItemId: parentFlowItemId,\r\n AbsoluteOrRelative: absoluteOrRelative,\r\n AbsoluteNumRows: 0,\r\n RelativePercentRows: 100,\r\n SplitQuantity: 0,\r\n IsIncludeInDeploy: true,\r\n };\r\n\r\n dispatch(addThing(\"flowSegmentSplits\", thing));\r\n }\r\n };\r\n\r\nexport const newFlowSegmentSplitAndOffersOverWrite =\r\n (\r\n flowItemId: number,\r\n //parentFlowItemId: number,\r\n segmentSplits: Array,\r\n requiredOfferCodes: Array,\r\n segmentSplitOffers: Array\r\n ) =>\r\n (dispatch: Dispatch) => {\r\n for (const split of segmentSplits) {\r\n const existSegmentSplitOffers = segmentSplitOffers.filter(x => x.SegmentSplitId == split.SegmentSplitId);\r\n if (existSegmentSplitOffers != null && existSegmentSplitOffers.length == 0) {\r\n requiredOfferCodes.forEach(element => {\r\n const offer: FlowSegmentSplitOffer = {\r\n SegmentSplitOfferId: 0,\r\n SegmentSplitId: split.SegmentSplitId,\r\n DestinationOfferId: element.Id,\r\n Value: \"\",\r\n FlowItemId: flowItemId,\r\n };\r\n dispatch(addThing(\"flowSegmentSplitOffers\", offer));\r\n });\r\n }\r\n }\r\n };\r\n\r\nexport const clearAndRedirect = () => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const flowFolderId = state.flows.byId[state.selected.flow].FlowFolderId;\r\n dispatch(SetPreviouslyClosedFlow(true));\r\n dispatch(SetPreviouslySelectedFolder(flowFolderId));\r\n dispatch(clearSelectedFlow());\r\n dispatch(goToUrl(\"/flows/design\"));\r\n};\r\n\r\nexport const closeFlow = (flowId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const flow: ?Flow = state.flows.byId[flowId];\r\n if (flow && flow.FlowId > 0 && flow.hasUnsavedChanges) {\r\n dispatch(setVar(\"loss_of_work_queued_action\", clearAndRedirect()));\r\n dispatch(setVar(\"loss_of_work_canceled_queued_action\", {}));\r\n dispatch(showModal(\"LOSS_OF_WORK\", { flow }));\r\n } else {\r\n dispatch(setVar(\"loss_of_work_queued_action\", {}));\r\n dispatch(setVar(\"loss_of_work_canceled_queued_action\", {}));\r\n dispatch(clearAndRedirect());\r\n }\r\n};\r\n\r\nexport const setSelectedFlow = (flowId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const flow: ?Flow = state.flows.byId[state.selected.flow];\r\n if (flow != null && flow.FlowId > 0 && flow.hasUnsavedChanges == true) {\r\n // Has HasUnsavedChanges\r\n dispatch(setVar(\"loss_of_work_queued_action\", setSelectedFlowNoUnsavedCheck(flowId)));\r\n dispatch(setVar(\"loss_of_work_canceled_queued_action\", {}));\r\n dispatch(showModal(\"LOSS_OF_WORK\", { flow }));\r\n } else {\r\n dispatch(setVar(\"loss_of_work_queued_action\", {}));\r\n dispatch(setVar(\"loss_of_work_canceled_queued_action\", {}));\r\n dispatch(flowEnsureItemDetailsExist());\r\n dispatch(setSelectedFlowNoUnsavedCheck(flowId));\r\n dispatch(flowRemoveUnsavedItems());\r\n }\r\n};\r\n\r\nexport const setSelectedFlowItemId = (flowItemId: number) => (dispatch: Dispatch) => {\r\n dispatch({ type: \"SET_SELECTED_FLOW_ITEM\", flowItemId });\r\n};\r\n\r\nexport const setSimpleFlowGuideActiveStep = (newStep: number) => (dispatch: Dispatch) => {\r\n dispatch({ type: \"SET_SIMPLE_FLOW_GUIDE_ACTIVE_STEP\", newStep });\r\n};\r\n\r\nexport const setNewTabValue = (newTabValue: number) => (dispatch: Dispatch) => {\r\n dispatch({ type: \"SET_FLOW_CONTROL_TAB_VALUE\", newTabValue });\r\n};\r\n\r\nexport const setSelectedFlowItems = (flowItems: Array) => (dispatch: Dispatch) => {\r\n dispatch({ type: \"SET_SELECTED_FLOW_ITEMS\", flowItems });\r\n};\r\n\r\nexport const setSelectedFlowRelations = (flowRelations: Array) => (dispatch: Dispatch) => {\r\n dispatch({ type: \"SET_SELECTED_FLOW_RELATIONS\", flowRelations });\r\n};\r\n\r\nexport const setFlowItemLocation = (flowItemId: number, x: any, y: any) => (dispatch: Dispatch) => {\r\n dispatch(\r\n updateMultipleAttribute(\"flowItems\", flowItemId, {\r\n x,\r\n y,\r\n })\r\n );\r\n};\r\n\r\nexport const setSelectedFlowNoUnsavedCheck = (flowId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n dispatch({ type: \"SET_SELECTED_FLOW\", flowId, meta: { doNotBatch: true } });\r\n const state = getState();\r\n const flow: ?Flow = state.flows.byId[state.selected.flow];\r\n\r\n if (!state.router || !state.router.location) {\r\n return;\r\n }\r\n\r\n // For some pages, update the url to include the flowId in it. Possibly need a better solution\r\n // if we get more of these?\r\n const location = state.router.location;\r\n\r\n //If I am already on the page I am supposed to be on, don't do a redirect\r\n const onFlowsLandingRefresh = !flowId && location.pathname === \"/flows/design\";\r\n const onOpenFlowRefresh = location.pathname === `/flows/${flowId}/design`;\r\n if (onFlowsLandingRefresh || onOpenFlowRefresh) return;\r\n\r\n if (flowId == null) {\r\n if (location.pathname.includes(\"/flows\")) {\r\n dispatch(push(\"/flows/design\"));\r\n } else {\r\n return;\r\n }\r\n }\r\n if (location.pathname.includes(\"/flows\") && location.pathname.includes(\"/design\") && flowId) {\r\n if (flow && flow.FlowBaseType && flow.FlowBaseType != 0) {\r\n let flowItems = getFlowItemsForSelectedFlow(state);\r\n const filterItem = flowItems.find(x => x.FlowItemType == \"filter\");\r\n\r\n if (filterItem) {\r\n dispatch(push(`/flows/${flowId}/item/${filterItem.FlowItemId}`));\r\n } else {\r\n dispatch(push(`/flows/${flowId}/item`));\r\n }\r\n } else {\r\n dispatch(push(`/flows/${flowId}/design`));\r\n }\r\n }\r\n};\r\n\r\n// Careful: This actually mutates the given argument.\r\nconst parseJsonInsideFlowData = flowData => {\r\n if (Array.isArray(flowData.flowClientVariables)) {\r\n flowData.flowClientVariables = flowData.flowClientVariables.map(x => ({\r\n Id: x.Id,\r\n VariableId: x.VariableId,\r\n FlowId: x.FlowId,\r\n VariableValue: JSON.parse(x.VariableValueJSON),\r\n IsVisible: x.IsVisible,\r\n }));\r\n }\r\n\r\n if (Array.isArray(flowData.flowItemClientVariables)) {\r\n flowData.flowItemClientVariables = flowData.flowItemClientVariables.map(x => ({\r\n FlowItemClientVariableId: x.FlowItemClientVariableId,\r\n VariableId: x.VariableId,\r\n FlowId: x.FlowId,\r\n FlowItemId: x.FlowItemId,\r\n ChildFlowItemId: x.ChildFlowItemId,\r\n VariableValue: JSON.parse(x.VariableValueJSON),\r\n }));\r\n }\r\n\r\n if (Array.isArray(flowData.flowExportTaxonomyFileFields)) {\r\n flowData.flowExportTaxonomyFileFields = flowData.flowExportTaxonomyFileFields.map(x => ({\r\n FlowExportTaxonomyFileFieldId: x.FlowExportTaxonomyFileFieldId,\r\n FlowItemId: x.FlowItemId,\r\n ParentFlowItemId: x.ParentFlowItemId,\r\n ValueJSON: x.ValueJSON,\r\n }));\r\n }\r\n\r\n if (Array.isArray(flowData.flowSVDedupes)) {\r\n flowData.flowSVDedupes = flowData.flowSVDedupes.map(x => ({\r\n FlowSVDedupeId: x.FlowSVDedupeId,\r\n FlowItemId: x.FlowItemId,\r\n SVField: x.SVField,\r\n SortByFields: JSON.parse(x.SortByFieldsJSON),\r\n }));\r\n }\r\n\r\n if (Array.isArray(flowData.flowExternalServices)) {\r\n flowData.flowExternalServices = flowData.flowExternalServices.map(x => ({\r\n ...x,\r\n ServicesJSON: JSON.parse(x.ServicesJSON),\r\n InputTableColumns: JSON.parse(x.InputTableColumns),\r\n }));\r\n }\r\n return flowData;\r\n};\r\n\r\nconst normalizeFlowData = flowData => {\r\n const flow = new schema.Entity(\"flows\", {}, { idAttribute: \"FlowId\" });\r\n const flowItem = new schema.Entity(\"flowItems\", {}, { idAttribute: \"FlowItemId\" });\r\n const flowRelation = new schema.Entity(\"flowRelations\", {}, { idAttribute: \"FlowRelationId\" });\r\n const flowFilter = new schema.Entity(\"flowFilters\", {}, { idAttribute: \"FlowFilterId\" });\r\n const flowScript = new schema.Entity(\"flowScripts\", {}, { idAttribute: \"FlowScriptId\" });\r\n const flowScriptDBUI = new schema.Entity(\"flowScriptsDBUI\", {}, { idAttribute: \"FlowScriptDBUIId\" });\r\n const flowMultiExport = new schema.Entity(\"flowMultiExports\", {}, { idAttribute: \"FlowMultiExportId\" });\r\n const flowOutput = new schema.Entity(\"flowOutputs\", {}, { idAttribute: \"FlowOutputId\" });\r\n const flowScriptResult = new schema.Entity(\"flowScriptResults\", {}, { idAttribute: \"FlowScriptResultId\" });\r\n const flowScriptResultsHistory = new schema.Entity(\r\n \"flowScriptResultsHistory\",\r\n {},\r\n { idAttribute: \"FlowScriptResultId\" }\r\n );\r\n const flowSingleView = new schema.Entity(\"flowSingleViews\", {}, { idAttribute: \"FlowSingleViewId\" });\r\n const flowSplit = new schema.Entity(\"flowSplits\", {}, { idAttribute: \"FlowSplitId\" });\r\n const flowCase = new schema.Entity(\"flowCases\", {}, { idAttribute: \"FlowCaseId\" });\r\n const flowMerge = new schema.Entity(\"flowMerges\", {}, { idAttribute: \"FlowMergeId\" });\r\n const flowOfferMerge = new schema.Entity(\"flowOfferMerges\", {}, { idAttribute: \"FlowOfferMergeId\" });\r\n const flowReports = new schema.Entity(\"flowReports\", {}, { idAttribute: \"FlowReportId\" });\r\n const flowModels = new schema.Entity(\"flowModels\", {}, { idAttribute: \"FlowModelId\" });\r\n const flowExportReport = new schema.Entity(\"flowExportReports\", {}, { idAttribute: \"FlowExportReportId\" });\r\n const flowCannedReport = new schema.Entity(\"flowCannedReports\", {}, { idAttribute: \"FlowCannedReportId\" });\r\n const flowFromCloud = new schema.Entity(\"flowFromClouds\", {}, { idAttribute: \"FlowFromCloudId\" });\r\n const flowToCloud = new schema.Entity(\"flowToClouds\", {}, { idAttribute: \"FlowToCloudId\" });\r\n const flowEmpty = new schema.Entity(\"flowEmpties\", {}, { idAttribute: \"FlowEmptyId\" });\r\n const flowClientVariable = new schema.Entity(\"flowClientVariables\", {}, { idAttribute: \"Id\" });\r\n const flowExport = new schema.Entity(\"flowExports\", {}, { idAttribute: \"FlowExportId\" });\r\n const flowSVDedupe = new schema.Entity(\"flowSVDedupes\", {}, { idAttribute: \"FlowSVDedupeId\" });\r\n const flowDataLoads = new schema.Entity(\"flowDataLoads\", {}, { idAttribute: \"FlowDataLoadId\" });\r\n const flowDataLoadColumns = new schema.Entity(\"flowDataLoadColumns\", {}, { idAttribute: \"FlowDataLoadColumnId\" });\r\n const flowOffloads = new schema.Entity(\"flowOffloads\", {}, { idAttribute: \"FlowOffloadId\" });\r\n const flowOffloadColumns = new schema.Entity(\"flowOffloadColumns\", {}, { idAttribute: \"FlowOffloadColumnId\" });\r\n const flowGuideSettings = new schema.Entity(\"flowGuideSettings\", {}, { idAttribute: \"FlowGuideId\" });\r\n const flowSegmentSplits = new schema.Entity(\"flowSegmentSplits\", {}, { idAttribute: \"SegmentSplitId\" });\r\n const flowSegmentSplitOffers = new schema.Entity(\r\n \"flowSegmentSplitOffers\",\r\n {},\r\n { idAttribute: \"SegmentSplitOfferId\" }\r\n );\r\n const flowExternalServices = new schema.Entity(\r\n \"flowExternalServices\",\r\n {},\r\n { idAttribute: \"FlowExternalServiceId\" }\r\n );\r\n const flowExternalServiceParameters = new schema.Entity(\r\n \"flowExternalServiceParameters\",\r\n {},\r\n { idAttribute: \"FlowServiceParameterId\" }\r\n );\r\n const flowExternalServiceInputs = new schema.Entity(\"flowExternalServiceInputs\", {}, { idAttribute: \"InputId\" });\r\n const flowExternalServiceHardcodes = new schema.Entity(\r\n \"flowExternalServiceHardcodes\",\r\n {},\r\n { idAttribute: \"HardcodeId\" }\r\n );\r\n\r\n const flowItemClientVariable = new schema.Entity(\r\n \"flowItemClientVariables\",\r\n {},\r\n { idAttribute: \"FlowItemClientVariableId\" }\r\n );\r\n const flowItemEndpoint = new schema.Entity(\"flowItemEndpoints\", {}, { idAttribute: \"Id\" });\r\n const flowItemOfferCode = new schema.Entity(\"flowItemOfferCodes\", {}, { idAttribute: \"FlowItemOfferCodeId\" });\r\n const flowExportDistributionPlatform = new schema.Entity(\r\n \"flowExportDistributionPlatforms\",\r\n {},\r\n { idAttribute: \"FlowExportDistributionPlatformId\" }\r\n );\r\n const flowRelationParentLabel = new schema.Entity(\r\n \"flowRelationParentLabels\",\r\n {},\r\n { idAttribute: \"FlowRelationParentLabelId\" }\r\n );\r\n const flowExportTemplateField = new schema.Entity(\r\n \"flowExportTemplateFields\",\r\n {},\r\n { idAttribute: \"FlowExportTemplateId\" }\r\n );\r\n\r\n const flowExportPinterestTemplateField = new schema.Entity(\r\n \"flowExportPinterestTemplateFields\",\r\n {},\r\n { idAttribute: \"FlowExportTemplateId\" }\r\n );\r\n\r\n const flowExportTikTokTemplateField = new schema.Entity(\r\n \"flowExportTikTokTemplateFields\",\r\n {},\r\n { idAttribute: \"FlowExportTemplateId\" }\r\n );\r\n\r\n const flowExportFreewheelDriverFileField = new schema.Entity(\r\n \"flowExportFreewheelDriverFileFields\",\r\n {},\r\n { idAttribute: \"FlowExportFreewheelDriverFileFieldId\" }\r\n );\r\n\r\n const flowExportTaxonomyFileFields = new schema.Entity(\r\n \"flowExportTaxonomyFileFields\",\r\n {},\r\n { idAttribute: \"FlowExportTaxonomyFileFieldId\" }\r\n );\r\n\r\n const flowExportTradeDeskTemplateField = new schema.Entity(\r\n \"flowExportTradeDeskTemplateFields\",\r\n {},\r\n { idAttribute: \"FlowExportTemplateId\" }\r\n );\r\n const flowExportPubmaticTemplateField = new schema.Entity(\r\n \"flowExportPubmaticTemplateFields\",\r\n {},\r\n { idAttribute: \"FlowExportTemplateId\" }\r\n );\r\n const flowExportXanderDriverField = new schema.Entity(\r\n \"flowExportXandrDriverFields\",\r\n {},\r\n { idAttribute: \"XandrDriverFieldId\" }\r\n );\r\n const flowExpressions = new schema.Entity(\"flowExpressions\", {}, { idAttribute: \"FlowExpressionId\" });\r\n const flowExpressionConstraints = new schema.Entity(\r\n \"flowExpressionConstraints\",\r\n {},\r\n { idAttribute: \"FlowExpressionConstraintId\" }\r\n );\r\n const flowDescriptions = new schema.Entity(\"flowDescriptions\", {}, { idAttribute: \"FlowDescriptionId\" });\r\n\r\n const mySchema = {\r\n flows: [flow],\r\n flowItems: [flowItem],\r\n flowRelations: [flowRelation],\r\n flowFilters: [flowFilter],\r\n flowScripts: [flowScript],\r\n flowScriptsDBUI: [flowScriptDBUI],\r\n flowScriptResults: [flowScriptResult],\r\n flowScriptResultsHistory: [flowScriptResultsHistory],\r\n flowSplits: [flowSplit],\r\n flowCases: [flowCase],\r\n flowMerges: [flowMerge],\r\n flowOfferMerges: [flowOfferMerge],\r\n flowReports: [flowReports],\r\n flowSingleViews: [flowSingleView],\r\n flowModels: [flowModels],\r\n flowOutputs: [flowOutput],\r\n flowMultiExports: [flowMultiExport],\r\n flowExports: [flowExport],\r\n flowExportReports: [flowExportReport],\r\n flowCannedReports: [flowCannedReport],\r\n flowFromClouds: [flowFromCloud],\r\n flowToClouds: [flowToCloud],\r\n flowEmpties: [flowEmpty],\r\n flowClientVariables: [flowClientVariable],\r\n flowItemClientVariables: [flowItemClientVariable],\r\n flowSVDedupes: [flowSVDedupe],\r\n flowItemEndpoints: [flowItemEndpoint],\r\n flowItemOfferCodes: [flowItemOfferCode],\r\n flowExportDistributionPlatforms: [flowExportDistributionPlatform],\r\n flowRelationParentLabels: [flowRelationParentLabel],\r\n flowDataLoads: [flowDataLoads],\r\n flowDataLoadColumns: [flowDataLoadColumns],\r\n flowOffloads: [flowOffloads],\r\n flowOffloadColumns: [flowOffloadColumns],\r\n flowGuideSettings: [flowGuideSettings],\r\n flowExportTemplateFields: [flowExportTemplateField],\r\n flowExportPinterestTemplateFields: [flowExportPinterestTemplateField],\r\n flowExportTikTokTemplateFields: [flowExportTikTokTemplateField],\r\n flowExportTradeDeskTemplateFields: [flowExportTradeDeskTemplateField],\r\n flowExportPubmaticTemplateFields: [flowExportPubmaticTemplateField],\r\n flowExportFreewheelDriverFileFields: [flowExportFreewheelDriverFileField],\r\n flowExportTaxonomyFileFields: [flowExportTaxonomyFileFields],\r\n flowExportXandrDriverFields: [flowExportXanderDriverField],\r\n flowSegmentSplits: [flowSegmentSplits],\r\n flowSegmentSplitOffers: [flowSegmentSplitOffers],\r\n flowExternalServices: [flowExternalServices],\r\n flowExternalServiceParameters: [flowExternalServiceParameters],\r\n flowExternalServiceInputs: [flowExternalServiceInputs],\r\n flowExternalServiceHardcodes: [flowExternalServiceHardcodes],\r\n flowExpressions: [flowExpressions],\r\n flowDescriptions: [flowDescriptions],\r\n flowExpressionConstraints: [flowExpressionConstraints],\r\n };\r\n\r\n return normalize(flowData, mySchema);\r\n};\r\n\r\nexport const getScriptColumnsForTable =\r\n (table: string, db: string, schema: string, dbEnv: number) => (dispatch: Dispatch) => {\r\n dispatch(incAjaxCount());\r\n fetch(`/Flows/GetTableColumns`, {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n headers: {\r\n Accept: \"application/json\",\r\n \"Content-Type\": \"application/json\",\r\n },\r\n body: JSON.stringify({\r\n table,\r\n db,\r\n schema,\r\n dbEnv,\r\n }),\r\n })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n if (data.columns) {\r\n if (dbEnv == 2) {\r\n dispatch({\r\n type: \"UPDATE_SCRIPT_OBJECTS\",\r\n catalog: db,\r\n schema,\r\n table,\r\n columns: data.columns,\r\n });\r\n } else if (dbEnv == 1) {\r\n dispatch({\r\n type: \"UPDATE_UIDB_SCRIPT_OBJECTS\",\r\n catalog: db,\r\n schema,\r\n table,\r\n columns: data.columns,\r\n });\r\n }\r\n }\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error accessing columns for script table.\", error);\r\n });\r\n };\r\n\r\nexport const getFlowBackup = (flowId: number) => (dispatch: Dispatch) => {\r\n if (flowId != null) {\r\n dispatch(incAjaxCount());\r\n request(\r\n `/Flows/GetFlowBackup/` + flowId,\r\n {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n dispatch(setBackupList(data.backupList));\r\n dispatch(decAjaxCount());\r\n return;\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error getting flow backup.\", error);\r\n });\r\n }\r\n};\r\n\r\nexport const restoreFlowBackup = (flowId: number, flowBackupValue: string) => (dispatch: Dispatch) => {\r\n dispatch(incAjaxCount());\r\n dispatch(deleteAllItemsInFlow(flowId));\r\n dispatch(notifyBlue(\"Flow is being restored to a previous backup, please wait...\"));\r\n let backupData = new FormData();\r\n backupData.append(\"value\", flowBackupValue);\r\n fetch(`/Flows/RestoreBackup`, {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n body: backupData,\r\n })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(() => {\r\n dispatch(notifyGreen(\"Flow backup successfully restored.\"));\r\n dispatch(decAjaxCount());\r\n dispatch(requestFlow(flowId));\r\n dispatch(setHasUnsavedChanges(false));\r\n return;\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n dispatch(requestFlow(flowId));\r\n h.error(\"Error restoring flow backup.\", error);\r\n });\r\n};\r\n\r\nexport const requestFlowProcess =\r\n (flowId: number, isSimpleFlowDeploy: boolean = false) =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const processType = state.flowDesigner.processType;\r\n\r\n // cynical check to stop and check if there are any before we get started\r\n if (processType == FlowProcessingTypes.withoutQuantities) {\r\n const flowItems = getFlowItemsArray(state);\r\n const itemsWithoutQuantities = flowItems\r\n .filter(x => x.FlowId == flowId && x.IsActive == true && (x.FlowItemQty == null || x.FlowItemQty == 0))\r\n .map(x => x.FlowItemId);\r\n\r\n if (!itemsWithoutQuantities || itemsWithoutQuantities.length == 0) {\r\n dispatch(notifyBlue(\"There are no qualified items to execute with this option.\"));\r\n return;\r\n }\r\n }\r\n\r\n dispatch(setFlowItemsIsRunning(flowId, FlowIsRunning.CLIENTSUBMITTED));\r\n\r\n dispatch(incAjaxCount());\r\n request(\r\n `/Flows/ClearAndProcessEntireFlow?FlowId=${flowId}&processType=${processType}&isSimpleFlowDeploy=${isSimpleFlowDeploy}`,\r\n {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n if (!data.result) {\r\n dispatch(setFlowItemsIsRunning(flowId, FlowIsRunning.IDLE));\r\n if (data.error) {\r\n h.error(data.error);\r\n } else {\r\n throw new Error(\"Error calculating flow.\");\r\n }\r\n }\r\n\r\n const flowItems = getFlowItemsArray(getState());\r\n const checkToCloud = flowItems.filter(x => x.FlowId == flowId && x.FlowItemType == \"toCloud\");\r\n if (checkToCloud.length > 0) {\r\n dispatch(resetCloudFlowObjects());\r\n }\r\n\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n dispatch(setFlowItemsIsRunning(flowId, FlowIsRunning.IDLE));\r\n h.error(\"Error calculating flow.\", error);\r\n });\r\n };\r\n\r\nexport const setFlowItemsIsRunning =\r\n (flowId: number, newIsRunning: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const processType = state.flowDesigner.processType;\r\n\r\n const flowItems = getFlowItemsArray(state);\r\n let flowItemIds = [];\r\n switch (processType) {\r\n case FlowProcessingTypes.execute:\r\n flowItemIds = flowItems.filter(x => x.FlowId == flowId && x.IsActive == true).map(x => x.FlowItemId);\r\n break;\r\n case FlowProcessingTypes.withoutQuantities:\r\n flowItemIds = flowItems\r\n .filter(\r\n x => x.FlowId == flowId && x.IsActive == true && (x.FlowItemQty == null || x.FlowItemQty == 0)\r\n )\r\n .map(x => x.FlowItemId);\r\n break;\r\n default:\r\n flowItemIds = flowItems.filter(x => x.FlowId == flowId && x.IsActive == true).map(x => x.FlowItemId);\r\n break;\r\n }\r\n\r\n for (const id of flowItemIds) {\r\n dispatch(updateAttribute(\"flowItems\", id, \"IsRunning\", newIsRunning));\r\n }\r\n };\r\n\r\nexport const requestFlowItemProcess =\r\n (flowItemId: number, isRunChildren: boolean = false) =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const anyParentIncomplete = isAnyParentIncomplete(state, flowItemId);\r\n if (anyParentIncomplete) {\r\n const thisFlowItem: FlowItem = state.flowItems.byId[flowItemId];\r\n dispatch(\r\n notifyBlack(\r\n \"The flow item \" +\r\n thisFlowItem.FlowItemName +\r\n \" cannot be calculated because at least one of the parents is incomplete.\"\r\n )\r\n );\r\n return;\r\n }\r\n\r\n const flowTypeCheck: FlowItem = state.flowItems.byId[flowItemId];\r\n if (flowTypeCheck.FlowItemType == \"toCloud\") {\r\n dispatch(resetCloudFlowObjects());\r\n }\r\n\r\n dispatch(updateAttribute(\"flowItems\", flowItemId, \"IsRunning\", FlowIsRunning.CLIENTSUBMITTED));\r\n\r\n dispatch(incAjaxCount());\r\n fetch(`/Flows/ProcessFlowItem?FlowItemId=${flowItemId}&runChildren=${isRunChildren ? \"true\" : \"false\"}`, {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n if (!data.result) {\r\n if (data.error) {\r\n h.error(data.error);\r\n } else {\r\n dispatch(updateAttribute(\"flowItems\", flowItemId, \"IsRunning\", FlowIsRunning.IDLE));\r\n throw new Error(\"Error calculating flow.\");\r\n }\r\n }\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n dispatch(updateAttribute(\"flowItems\", flowItemId, \"IsRunning\", FlowIsRunning.IDLE));\r\n h.error(\"Error calculating flow.\", error);\r\n });\r\n };\r\n\r\nexport const requestCancelEntireFlow = (flowId: number) => (dispatch: Dispatch) => {\r\n dispatch(incAjaxCount());\r\n dispatch(setFlowItemsIsRunning(flowId, FlowIsRunning.CANCELLING));\r\n fetch(`/Flows/CancelEntireFlow?FlowId=${flowId}`, {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n if (!data.result) {\r\n if (data.error) {\r\n h.error(data.error);\r\n } else {\r\n throw new Error(\"Error cancelling flow.\");\r\n }\r\n }\r\n dispatch(decAjaxCount());\r\n dispatch(requestFlow(flowId));\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error cancelling flow.\", error);\r\n });\r\n};\r\n\r\nexport const requestCancelFlowItem = (flowId: number, flowItemId: number) => (dispatch: Dispatch) => {\r\n dispatch(incAjaxCount());\r\n dispatch(setFlowItemsIsRunning(flowId, FlowIsRunning.CANCELLING));\r\n fetch(`/Flows/CancelFlowItem?FlowId=${flowId}&FlowItemId=${flowItemId}`, {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n if (!data.result) {\r\n if (data.error) {\r\n h.error(data.error);\r\n } else {\r\n throw new Error(\"Error cancelling flow item.\");\r\n }\r\n }\r\n dispatch(decAjaxCount());\r\n dispatch(requestFlow(flowId));\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error cancelling flow item.\", error);\r\n });\r\n};\r\n\r\nexport const requestCancelDeployment = (flowId: number) => (dispatch: Dispatch) => {\r\n dispatch(incAjaxCount());\r\n dispatch(setFlowItemsIsRunning(flowId, FlowIsRunning.CANCELDEPLOYING));\r\n fetch(`/Flows/CancelDeployExport?FlowId=${flowId}`, {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n if (!data.result) {\r\n if (data.error) {\r\n h.error(data.error);\r\n } else {\r\n throw new Error(\"Error cancelling flow.\");\r\n }\r\n }\r\n dispatch(decAjaxCount());\r\n // dispatch(requestFlow(flowId));\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error cancelling flow.\", error);\r\n });\r\n};\r\n\r\ntype IdChange = Array>;\r\ntype IdChanges = {|\r\n Flows: IdChange,\r\n FlowItems: IdChange,\r\n FlowRelations: IdChange,\r\n FlowFilters: IdChange,\r\n FlowSplits: IdChange,\r\n FlowEmpties: IdChange,\r\n|};\r\nexport const changeFlowUrlAfterIdChanges = (idChanges: IdChanges) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const location = state.router.location;\r\n\r\n if (location.pathname.includes(\"/flows\")) {\r\n let matchingChanges = idChanges.Flows.filter(x => x[0] == state.selected.flow);\r\n\r\n // go back to item\r\n if (location.pathname.includes(\"/item\")) {\r\n matchingChanges = idChanges.FlowItems.filter(x => x[0] == state.selected.flowItem);\r\n\r\n let flowItemId =\r\n matchingChanges && matchingChanges[0] && matchingChanges[0][1]\r\n ? matchingChanges[0][1]\r\n : state.selected.flowItem;\r\n\r\n if (state.selected.flowItem != flowItemId) {\r\n dispatch(goEditFlowItem(flowItemId, false));\r\n }\r\n\r\n return;\r\n }\r\n\r\n // go back to flow\r\n if (matchingChanges.length > 0) {\r\n dispatch(goEditFlow(matchingChanges[0][1]));\r\n }\r\n }\r\n};\r\n\r\nexport const removeAnyDuplicateRelations = () => (dispatch: Dispatch, getState: GetState) => {\r\n let state = getState();\r\n let relations = getFlowRelationsArray(state);\r\n const links = relations.map(x => x.ParentFlowItemId + \"-\" + x.ChildFlowItemId);\r\n\r\n const count = things => things.reduce((a, b) => Object.assign(a, { [b]: (a[b] || 0) + 1 }), {});\r\n const duplicates = dict => Object.keys(dict).filter(a => dict[a] > 1);\r\n\r\n const duplicateLinks = duplicates(count(links));\r\n for (const duplicateLink of duplicateLinks) {\r\n const [parent, child] = duplicateLink.split(\"-\").map(x => parseInt(x, 10));\r\n const idsToDelete = relations\r\n .filter(x => x.ParentFlowItemId == parent && x.ChildFlowItemId == child)\r\n .map(x => x.FlowRelationId)\r\n .slice(1);\r\n for (const id of idsToDelete) {\r\n dispatch(deleteFlowRelation(id));\r\n }\r\n\r\n state = getState();\r\n relations = getFlowRelationsArray(state);\r\n }\r\n};\r\n\r\nimport { makeGetFlowExportTaxonomyFields } from \"../components/flows/item/FlowExportItems/FlowExportOfferEdit\";\r\n\r\nexport const processDragAndDrop = (parentId: number, childId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const parent: ?FlowItem = state.flowItems.byId[parentId];\r\n const child: ?FlowItem = state.flowItems.byId[childId];\r\n\r\n if (parent == null || child == null || parentId == childId) {\r\n return;\r\n }\r\n\r\n dispatch(updateFlowShouldValidate(state.selected.flow, true));\r\n\r\n // Already Exists\r\n const relationAlreadyExists = flowRelationExists(state, parentId, childId);\r\n if (relationAlreadyExists) {\r\n return;\r\n }\r\n\r\n // Loop\r\n const loopDetected = isLoopDetected(state, childId, parentId);\r\n if (loopDetected) {\r\n dispatch(notifyBlack(\"This link cannot be added because it would introduce a loop.\"));\r\n return;\r\n }\r\n\r\n // Not Allowed\r\n const isRelationAllowed = validateFlowRelation(state, parentId, parent.FlowItemType, childId, child.FlowItemType);\r\n if (!isRelationAllowed) {\r\n return; // validateFlowRelation() sent a message to the user for us\r\n }\r\n\r\n // We're going to make it - let's see if there's an invisible link to 0 we have to move\r\n const flowRelationParentZeroExists = flowRelationExists(state, 0, childId);\r\n const flowRelations = getFlowRelationsArray(state);\r\n\r\n if (flowRelationParentZeroExists) {\r\n const relationIdsToUpdate = flowRelations\r\n .filter(x => x.ParentFlowItemId == 0 && x.ChildFlowItemId == childId)\r\n .map(x => x.FlowRelationId);\r\n\r\n for (const flowRelationId of relationIdsToUpdate) {\r\n dispatch(updateAttribute(\"flowRelations\", flowRelationId, \"ParentFlowItemId\", parentId));\r\n }\r\n\r\n // Invalidate Child Items\r\n dispatch(invalidateItemAndChildren(childId));\r\n } else {\r\n dispatch(newFlowRelation(parentId, childId));\r\n }\r\n\r\n if (child.FlowItemType == \"merge\") {\r\n // Create a flow merge\r\n dispatch(newFlowMerge(childId, parentId));\r\n } else if (child.FlowItemType == \"offerMerge\" || child.FlowItemType == \"export\") {\r\n dispatch(newFlowOfferMerge(childId, parentId));\r\n\r\n if (child.FlowItemType == \"export\") {\r\n if (state.vars.destinations && state.vars.destinations.length > 0) {\r\n const flowExports = getFlowExportsForSelectedFlow(state);\r\n const flowExport = flowExports.find(x => x.FlowItemId == child.FlowItemId);\r\n const destination = state.vars.destinations.find(x => x.PartnerAccessId == flowExport.DestinationId);\r\n const getFlowExportTaxonomyFields = makeGetFlowExportTaxonomyFields();\r\n const flowExportTaxonomyFileFields = getFlowExportTaxonomyFields(state, { flowItemId: childId }) || [];\r\n const layouts = state.layoutObjects.objects;\r\n const layout = layouts && layouts.filter(x => x.Layout.LayoutID == flowExport?.ExportId)[0];\r\n\r\n if (destination) {\r\n if (\r\n state.session.enabledFeatures.includes(\"flow-export-template-fields\") &&\r\n destination.DeploySetting == DeploySettings.DeployAdditionalFacebookTemplate\r\n ) {\r\n dispatch(newFlowExportTemplateFields(childId, parentId));\r\n }\r\n\r\n if (destination.DeploySetting == DeploySettings.DeployPinterestAutomationTemplate) {\r\n dispatch(newFlowExportPinterestTemplateFields(childId, parentId));\r\n }\r\n\r\n if (destination.DeploySetting == DeploySettings.DeployTikTokDriverFile) {\r\n dispatch(newFlowExportTikTokTemplateFields(childId, parentId));\r\n }\r\n\r\n if (destination.DeploySetting == DeploySettings.DeployTradedeskTemplate) {\r\n dispatch(newFlowExportTradeDeskTemplateFields(childId, parentId));\r\n }\r\n if (destination.DeploySetting == DeploySettings.DeployPubmaticTemplate) {\r\n dispatch(newFlowExportPubmaticTemplateFields(childId, parentId));\r\n }\r\n //\r\n if (layout && layout.LayoutTaxonomyObjects.length > 0) {\r\n // dispatch(newFlowExportTradeDeskTemplateFields(childId, parentId));\r\n const taxonomyField = flowExportTaxonomyFileFields.find(\r\n x => x.FlowItemId == childId && x.ParentFlowItemId == parentId\r\n );\r\n\r\n let taxonomyValues = {};\r\n\r\n layout.LayoutTaxonomyObjects.forEach(x => {\r\n taxonomyValues[x.ExportName] = \"\";\r\n });\r\n\r\n if (!taxonomyField) {\r\n newFlowExportTaxonomyFileFields(childId, parentId, taxonomyValues);\r\n }\r\n }\r\n\r\n if (\r\n destination.DeploySetting == DeploySettings.DeployFreewheelDriverFile ||\r\n destination.DeploySetting == DeploySettings.DeployMagniteDriverFile\r\n ) {\r\n dispatch(newFlowExportFreewheelDriverFileFields(childId, parentId));\r\n }\r\n\r\n if (destination.DeploySetting == DeploySettings.DeployXandrTemplate) {\r\n dispatch(newFlowExportXandrDriverFields(childId, parentId));\r\n }\r\n }\r\n }\r\n }\r\n } else if (child.FlowItemType == \"insights\" || child.FlowItemType == \"discovery\") {\r\n dispatch(validateInsightNodeLinks(child.FlowItemId, child.FlowItemType));\r\n } else if (child.FlowItemType == \"model\") {\r\n dispatch(validateModelNodeLinks(child.FlowItemId));\r\n }\r\n\r\n dispatch(updateFlowShouldValidate(state.selected.flow, false));\r\n};\r\n\r\nexport const validateInsightNodeLinks =\r\n (flowItemId: number, flowItemType: string) => (dispatch: Dispatch, getState: GetState) => {\r\n let state = getState();\r\n\r\n const hasThirdParty = ancestorHasThirdPartyData(state, flowItemId);\r\n const hasOACData = ancestorhasOACData(state, flowItemId);\r\n\r\n if (hasThirdParty || hasOACData) {\r\n const flowRelations = getFlowRelationsForSelectedFlow(state);\r\n const relation = flowRelations.find(x => x.ChildFlowItemId === flowItemId);\r\n\r\n if (relation) {\r\n // Delete the relationship\r\n dispatch(_deleteThing(\"flowRelations\", relation.FlowRelationId));\r\n\r\n // Display a Modal notifying the user\r\n // Passing hasThirdParty as the same Modal is used for both checks.\r\n // If true, the modal shows \"Third Party data cannot be linked to Insights nodes\".\r\n // If false, the modal shows \"OAC data cannot be linked to Insights nodes\".\r\n const supportEmailAddress = getSupportEmailAddress(state.session.customizations);\r\n dispatch(showModal(\"INSIGHTS_INVALID_LINK\", { nodeType: flowItemType, hasThirdParty, supportEmailAddress }));\r\n }\r\n }\r\n };\r\n\r\nexport const validateModelNodeLinks =\r\n (flowItemId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n let state = getState();\r\n\r\n const hasThirdParty = ancestorHasThirdPartyData(state, flowItemId);\r\n\r\n if (hasThirdParty) {\r\n const flowRelations = getFlowRelationsForSelectedFlow(state);\r\n const relation = flowRelations.find(x => x.ChildFlowItemId === flowItemId);\r\n\r\n if (relation) {\r\n // Delete the relationship\r\n dispatch(_deleteThing(\"flowRelations\", relation.FlowRelationId));\r\n\r\n // Display a Modal notifying the user\r\n const supportEmailAddress = getSupportEmailAddress(state.session.customizations);\r\n dispatch(showModal(\"MODEL_INVALID_LINK_3P\", { supportEmailAddress }));\r\n }\r\n }\r\n };\r\n\r\nexport const saveFlowBackup = (flowId: number) => async (dispatch: Dispatch) => {\r\n let url = \"/flows/SaveFlowBackup/\" + flowId;\r\n dispatch(incAjaxCount());\r\n return fetch(url, { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(() => {\r\n dispatch(decAjaxCount());\r\n dispatch(notifyGreen(\"Flow backup successfully created.\"));\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error creating flow backup\", error);\r\n });\r\n};\r\n\r\nexport const updateFlowItemIsIncomplete = (flowItems: Array) => (dispatch: Dispatch, getState: GetState) => {\r\n let state = getState();\r\n const itemErrors = getItemErrorsForSelectedFlow(state);\r\n for (const item of flowItems) {\r\n let checkItem = itemErrors[item.FlowItemId];\r\n // No Errors found\r\n if (!checkItem || typeof checkItem == \"undefined\") {\r\n if (item.IsIncomplete) {\r\n dispatch(updateAttribute(\"flowItems\", item.FlowItemId, \"IsIncomplete\", false));\r\n }\r\n } else if (!item.IsIncomplete) {\r\n // Errors\r\n dispatch(updateAttribute(\"flowItems\", item.FlowItemId, \"IsIncomplete\", true));\r\n }\r\n }\r\n};\r\n\r\nexport const requestFlowSave = (params: RequestFlowSave, simpleFlow: Boolean = false) => async (dispatch: Dispatch, getState: GetState) => {\r\n \r\n const {\r\n overwrite,\r\n flowItemId,\r\n copyOfferCodes,\r\n copyVariables,\r\n selectedCompany,\r\n isRunChildren,\r\n processEntireFlow,\r\n isSimpleFlowDeploy,\r\n isSaveAs,\r\n deployFlowExportAfterSave,\r\n tableKey,\r\n } = params;\r\n\r\n dispatch(removeAnyDuplicateRelations());\r\n\r\n let state = getState();\r\n let flowId: number = state.selected.flow;\r\n let flow: ?Flow = state.flows.byId[flowId];\r\n if (flow == null) {\r\n h.error(\"Error saving flow [2901a].\");\r\n throw new Error(\"Error saving flow [2901a].\");\r\n }\r\n dispatch(updateFlowShouldValidate(flowId, true));\r\n\r\n // FlowItems marked Incomplete for validation errors\r\n const updateItems = getFlowItemsForSelectedFlow(state);\r\n dispatch(updateFlowItemIsIncomplete(updateItems));\r\n\r\n // If SaveAs from Historical need to reset top level folder\r\n let resetFolder = false;\r\n if (isSaveAs) {\r\n const folderReducerKey = folderReducerKeyForType(\"W\");\r\n const folder = findFolderById(state.folders[folderReducerKey], flow.FlowFolderId);\r\n\r\n resetFolder = !folder || folder.isHistorical;\r\n }\r\n\r\n if (flow.FlowFolderId <= 0 || resetFolder) {\r\n const folderId = findTopLevelFlowFolderForUser(state, state.session.userId);\r\n if (folderId > 0) {\r\n dispatch(updateAttribute(\"flows\", flow.FlowId, \"FlowFolderId\", folderId));\r\n state = getState();\r\n flow = state.flows.byId[flowId];\r\n }\r\n }\r\n\r\n let originalFlowId;\r\n if (!overwrite && flowId != 0) {\r\n // We copy it to flowId = 0 locally, then let the save code act like it's saving a new flow\r\n originalFlowId = flowId;\r\n //Responsible for creating the new flow items with negative ids\r\n dispatch(flowCopyToIdZero(flowId, state.session.userId, copyOfferCodes, copyVariables));\r\n flowId = 0;\r\n\r\n dispatch({ type: \"SET_SELECTED_FLOW\", flowId, meta: { doNotBatch: true } });\r\n\r\n // Load in new info\r\n state = getState();\r\n flow = state.flows.byId[flowId];\r\n if (flow == null) {\r\n h.error(\"Error saving flow [2901b].\");\r\n throw new Error(\"Error saving flow [2901b].\");\r\n }\r\n }\r\n\r\n state = getState();\r\n let flowItems = getFlowItemsForSelectedFlow(state);\r\n\r\n if (flowItemId != -1) {\r\n /*Set isRunning right after getting the current state. Lets ui respond immediately.\r\n Don't want to save isRunning, engine must set that itself or things will get stuck in a loop*/\r\n dispatch(updateAttribute(\"flowItems\", flowItemId, \"IsRunning\", true));\r\n }\r\n\r\n const flowRelations = getFlowRelationsForSelectedFlow(state);\r\n const flowFilters = getFlowFiltersForSelectedFlow(state);\r\n const flowScripts = getFlowScriptsForSelectedFlow(state);\r\n const flowScriptsDBUI = getFlowScriptsDBUIForSelectedFlow(state);\r\n const flowSplits = getFlowSplitsForSelectedFlow(state);\r\n const flowEmpties = getFlowEmptiesForSelectedFlow(state);\r\n const flowCases = getFlowCasesForSelectedFlow(state);\r\n let flowMerges = getFlowMergesForSelectedFlow(state);\r\n let flowOfferMerges = getFlowOfferMergesForSelectedFlow(state);\r\n let flowReports = getFlowReportsForSelectedFlow(state);\r\n let flowSingleViews = getFlowSingleViewsForSelectedFlow(state);\r\n const flowModels = getFlowModelsForSelectedFlow(state);\r\n const flowMultiExports = getFlowMultiExportForSelectedFlow(state);\r\n const flowExports = getFlowExportsForSelectedFlow(state);\r\n const flowOutputs = getFlowOutputsForSelectedFlow(state);\r\n const flowExportReports = getFlowExportReportsForSelectedFlow(state);\r\n const flowCannedReports = getFlowCannedReportsForSelectedFlow(state);\r\n const flowFromClouds = getFlowFromCloudsForSelectedFlow(state);\r\n const flowToClouds = getFlowToCloudsForSelectedFlow(state);\r\n const flowDataLoads = getFlowDataLoadsForSelectedFlow(state);\r\n const flowDataLoadColumns = getFlowDataLoadColumnsForSelectedFlow(state);\r\n const flowSVDedupes = getFlowSVDedupesForSelectedFlow(state, false);\r\n const flowClientVariablesById = getFlowClientVariablesForSelectedFlow(state);\r\n const flowItemClientVariablesById = getFlowItemClientVariablesForSelectedFlow(state);\r\n const flowItemEndpoints = getFlowEndpointsForSelectedFlow(state);\r\n const flowItemOfferCodes = getFlowItemOfferCodesForSelectedFlow(state);\r\n //flow-export-distribution-platforms\r\n const flowExportDistributionPlatforms = getFlowExportDistributionPlatformsForSelectedFlow(state);\r\n //pivot-layout-parent-labels\r\n const flowRelationParentLabels = getFlowRelationParentLabelsForSelectedFlow(state);\r\n //flow-tool-offload\r\n const flowOffloads = getFlowOffloadsForSelectedFlow(state);\r\n const flowOffloadColumns = getFlowOffloadColumnsForSelectedFlow(state);\r\n const flowGuideSettings = getFlowGuideSettingsForSelectedFlow(state);\r\n const flowExportTemplateFields = getFlowExportTemplateFieldsForSelectedFlow(state);\r\n const flowExportPinterestTemplateFields = getFlowExportPinterestTemplateFieldsForSelectedFlow(state);\r\n const flowExportTikTokTemplateFields = getFlowExportTikTokTemplateFieldsForSelectedFlow(state);\r\n const flowExportTradeDeskTemplateFields = getFlowExportTradeDeskTemplateFieldsForSelectedFlow(state);\r\n const flowExportPubmaticTemplateFields = getFlowExportPubmaticTemplateFieldsForSelectedFlow(state);\r\n const flowExportTaxonomyFileFields = getFlowExportTaxonomyFileFieldsForSelectedFlow(state);\r\n const flowExportFreewheelDriverFileFields = getFlowExportFreewheelDriverFileFieldsForSelectedFlow(state);\r\n const flowExportXandrDriverFields = getFlowExportXandrDriverFieldsForSelectedFlow(state);\r\n const flowSegmentSplits = getFlowSegmentSplitsForSelectedFlow(state);\r\n const flowSegmentSplitOffers = getFlowSegmentSplitOffersForSelectedFlow(state);\r\n\r\n //flow-control\r\n const flowExternalServices = getFlowExternalServicesForSelectedFlow(state);\r\n\r\n if (isSaveAs)\r\n flowExternalServices.forEach(x => {\r\n x.WFJobNumber = null;\r\n x.WFBillingDivCode = null;\r\n x.WFIFRSCode = null;\r\n });\r\n\r\n const flowExternalServiceParameters = getFlowExternalServiceParametersForSelectedFlow(state);\r\n const flowExternalServiceInputs = getFlowExternalServiceInputsForSelectedFlow(state);\r\n const flowExternalServiceHardcodes = getFlowExternalServiceHardcodesForSelectedFlow(state);\r\n const flowExternalServicesFormat = flowExternalServices.map(x => ({\r\n ...x,\r\n ServicesJSON: JSON.stringify(x.ServicesJSON),\r\n InputTableColumns:\r\n x.InputTableColumns && x.InputTableColumns.length > 0 ? JSON.stringify(x.InputTableColumns) : null,\r\n }));\r\n\r\n //flow-expression\r\n const flowExpressions = getFlowExpressionsForSelectedFlow(state);\r\n const flowExpressionConstraints = getFlowExpressionsConstraintsForSelectedFlow(state);\r\n\r\n const flowDescriptions = getFlowDescriptionsForSelectedFlow(state);\r\n\r\n // Check if any flowRelation would add Loops\r\n for (const flowRelation of flowRelations) {\r\n const loopDetected = isLoopDetected(state, flowRelation.ChildFlowItemId, flowRelation.ParentFlowItemId);\r\n if (loopDetected) {\r\n h.error(\"Error saving flow. [2902c]\"); // loop detected\r\n throw new Error(\"Error saving flow [2902c].\");\r\n }\r\n }\r\n\r\n const flowClientVariables = (Object.values(flowClientVariablesById): Array);\r\n const flowClientVariablesServerFormat: Array = flowClientVariables\r\n .filter(x => x.VariableValue.ValueString || x.VariableValue.FieldId || !x.IsVisible)\r\n .map(x => ({\r\n Id: x.Id,\r\n VariableId: x.VariableId,\r\n FlowId: x.FlowId,\r\n VariableValueJSON: JSON.stringify(x.VariableValue),\r\n IsVisible: x.IsVisible,\r\n }));\r\n\r\n const flowItemClientVariables = (Object.values(flowItemClientVariablesById): Array);\r\n const flowItemClientVariablesServerFormat: Array = flowItemClientVariables\r\n .filter(x => x.VariableValue.ValueString || x.VariableValue.FieldId)\r\n .map(x => ({\r\n FlowItemClientVariableId: x.FlowItemClientVariableId,\r\n VariableId: x.VariableId,\r\n FlowId: x.FlowId,\r\n FlowItemId: x.FlowItemId,\r\n ChildFlowItemId: x.ChildFlowItemId,\r\n VariableValueJSON: JSON.stringify(x.VariableValue),\r\n }));\r\n\r\n const flowSVDedupesServerFormat: Array = flowSVDedupes.map(x => ({\r\n FlowSVDedupeId: x.FlowSVDedupeId,\r\n FlowItemId: x.FlowItemId,\r\n SVField: x.SVField,\r\n SortByFieldsJSON: JSON.stringify(x.SortByFields),\r\n }));\r\n\r\n const companyIdChanged = selectedCompany != 0 && flow.FlowCompanyId != selectedCompany;\r\n\r\n // Remove the HasResultTable from all FlowItems on Save As\r\n if (!overwrite) {\r\n if (companyIdChanged) {\r\n flow.FlowCompanyId = selectedCompany;\r\n if (flowReports.length > 0 && tableKey != 0) {\r\n flowReports = flowReports.map(x => ({ ...x, UniverseTableKey: tableKey }));\r\n }\r\n }\r\n flowItems = flowItems.map(x => ({\r\n ...x,\r\n HasResultTable: false,\r\n HasQATable: false,\r\n IsError: false,\r\n IsCancelled: false,\r\n IsRunning: 0,\r\n FlowItemStart: \"\",\r\n FlowItemEnd: \"\",\r\n }));\r\n flowMerges = flowMerges.map(x => ({ ...x, DupesQty: 0, UniquesQty: 0 }));\r\n flowOfferMerges = flowOfferMerges.map(x => ({ ...x, DupesQty: 0, UniquesQty: 0 }));\r\n flowSingleViews = flowSingleViews.map(x => ({\r\n ...x,\r\n FlowSingleViewQuantity: 0,\r\n Counted: false,\r\n IndividualQuantity: 0,\r\n HouseholdQuantity: 0,\r\n DedupedHouseholdQuantity: 0,\r\n DedupedIndividualQuantity: 0,\r\n }));\r\n } else {\r\n flowSingleViews = flowSingleViews.map(x => ({\r\n ...x,\r\n FlowSingleViewQuantity: x.IsSelected ? x.FlowSingleViewQuantity : 0,\r\n Counted: x.IsSelected ? x.Counted : false,\r\n IndividualQuantity: x.IsSelected ? x.IndividualQuantity : 0,\r\n HouseholdQuantity: x.IsSelected ? x.HouseholdQuantity : 0,\r\n DedupedIndividualQuantity: x.IsSelected ? x.DedupedIndividualQuantity : 0,\r\n DedupedHouseholdQuantity: x.IsSelected ? x.DedupedHouseholdQuantity : 0,\r\n }));\r\n }\r\n\r\n // If save or execute flow, remove all SelectedScript\r\n if (flowItemId == -1 || processEntireFlow) {\r\n for (const item of flowScripts) {\r\n item.SelectedScript = \"\";\r\n }\r\n\r\n for (const item of flowScriptsDBUI) {\r\n item.SelectedScript = \"\";\r\n }\r\n }\r\n\r\n dispatch(updateAttribute(\"flows\", flow.FlowId, \"isSaving\", 1));\r\n \r\n if (flow.FlowBaseType > 0) {\r\n flowItems = flowItems.map(x => ({\r\n ...x,\r\n FlowItemName:\r\n (x.FlowItemType == \"export\" || x.FlowItemType == \"multiexport\") && simpleFlow ? flow.FlowDescription : x.FlowItemName,\r\n }));\r\n }\r\n\r\n const dataToSave = {\r\n Flow: flow,\r\n FlowItems: flowItems,\r\n FlowRelations: flowRelations,\r\n FlowFilters: flowFilters,\r\n FlowScripts: flowScripts,\r\n FlowScriptsDBUI: flowScriptsDBUI,\r\n FlowSplits: flowSplits,\r\n FlowEmpties: flowEmpties,\r\n FlowMerges: flowMerges,\r\n FlowOfferMerges: flowOfferMerges,\r\n FlowCases: flowCases,\r\n FlowReports: flowReports,\r\n FlowModels: flowModels,\r\n FlowMultiExports: flowMultiExports,\r\n FlowExports: flowExports,\r\n FlowOutputs: flowOutputs,\r\n FlowExportReports: flowExportReports,\r\n FlowCannedReports: flowCannedReports,\r\n FlowFromClouds: flowFromClouds,\r\n FlowToClouds: flowToClouds,\r\n FlowClientVariables: flowClientVariablesServerFormat,\r\n FlowItemClientVariables: flowItemClientVariablesServerFormat,\r\n FlowSVDedupes: flowSVDedupesServerFormat,\r\n FlowItemEndpoints: flowItemEndpoints,\r\n FlowItemOfferCodes: flowItemOfferCodes,\r\n FlowSingleViews: flowSingleViews,\r\n FlowDataLoads: flowDataLoads,\r\n FlowDataLoadColumns: flowDataLoadColumns,\r\n //flow-export-distribution-platforms\r\n FlowExportDistributionPlatforms: flowExportDistributionPlatforms,\r\n //pivot-layout-parent-labels\r\n FlowRelationParentLabels: flowRelationParentLabels,\r\n //flow-tool-offload\r\n FlowOffloads: flowOffloads,\r\n FlowOffloadColumns: flowOffloadColumns,\r\n FlowGuideSettings: flowGuideSettings,\r\n FlowExportTemplateFields: flowExportTemplateFields,\r\n FlowExportPinterestTemplateFields: flowExportPinterestTemplateFields,\r\n FlowExportTikTokTemplateFields: flowExportTikTokTemplateFields,\r\n FlowExportTradeDeskTemplateFields: flowExportTradeDeskTemplateFields,\r\n FlowExportPubmaticTemplateFields: flowExportPubmaticTemplateFields,\r\n FlowExportTaxonomyFileFields: flowExportTaxonomyFileFields,\r\n FlowExportFreewheelDriverFileFields: flowExportFreewheelDriverFileFields,\r\n FlowExportXandrDriverFields: flowExportXandrDriverFields,\r\n SegmentSplits: flowSegmentSplits,\r\n SegmentSplitOffers: flowSegmentSplitOffers,\r\n //flow-control\r\n FlowExternalServices: flowExternalServicesFormat,\r\n FlowExternalServiceParameters: flowExternalServiceParameters,\r\n FlowExternalServiceInputs: flowExternalServiceInputs,\r\n FlowExternalServiceHardcodes: flowExternalServiceHardcodes,\r\n FlowExpressions: flowExpressions,\r\n FlowDescriptions: flowDescriptions,\r\n FlowExpressionConstraints: flowExpressionConstraints,\r\n OriginalFlowId: originalFlowId,\r\n };\r\n\r\n // If we made a copy of an existing flow, then revert it\r\n if (!overwrite && originalFlowId != null) {\r\n dispatch(requestFlows(originalFlowId, \"merge-overwrite\"));\r\n }\r\n\r\n let body = await gzip(JSON.stringify(dataToSave)); \r\n return request(\r\n \"/flows/SaveFlowCompressed\",\r\n {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n Accept: \"application/json\",\r\n \"Content-Type\": \"application/json\",\r\n },\r\n body,\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n if (!data.result) {\r\n if (flow != null) {\r\n dispatch(updateAttribute(\"flows\", flow.FlowId, \"isSaving\", 0));\r\n }\r\n if (flowItemId != -1) {\r\n /*Set isRunning right after getting the current state. Lets ui respond immediately.\r\n Don't want to save isRunning, engine must set that itself or things will get stuck in a loop*/\r\n dispatch(updateAttribute(\"flowItems\", flowItemId, \"IsRunning\", false));\r\n }\r\n if (data.error) {\r\n h.error(data.error);\r\n dispatch(decAjaxCount());\r\n throw new Error(data.error);\r\n } else {\r\n throw new Error(\"Error saving flow.\");\r\n }\r\n }\r\n\r\n dispatch(notifyGreen(\"Flow saved successfully.\"));\r\n\r\n if (data.flowDateCreated && flow != null) {\r\n dispatch(updateAttribute(\"flows\", flow.FlowId, \"FlowDateCreated\", data.flowDateCreated));\r\n }\r\n\r\n for (const row of prefixesAndEntities) {\r\n const prefix = row.actionPrefix;\r\n const entity = row.stateKey;\r\n const idChanges = data.idChanges[ucFirst(entity)];\r\n if (idChanges != null) {\r\n dispatch({\r\n type: `${prefix}_ID_CHANGE`,\r\n idChanges,\r\n });\r\n }\r\n }\r\n\r\n if (companyIdChanged) {\r\n top.RDX.CAPageChangeCompanyNoUnsavedCheck(selectedCompany, false);\r\n }\r\n\r\n dispatch(updateFlowShouldValidate(flowId, false));\r\n dispatch(changeFlowUrlAfterIdChanges(data.idChanges));\r\n dispatch(setHasUnsavedChanges(false));\r\n\r\n if (processEntireFlow) {\r\n // #NANI-47710 The flow id is being refreshed for the calculate process on simple flow right after save\r\n let stateToProcess = getState();\r\n let flowIdToProcess: number = stateToProcess.selected.flow;\r\n if (isSimpleFlowDeploy) {\r\n flowIdToProcess = flowId;\r\n }\r\n dispatch(requestFlowProcess(flowIdToProcess, isSimpleFlowDeploy));\r\n } else if (flowItemId > -1) {\r\n dispatch(requestFlowItemProcess(flowItemId, isRunChildren));\r\n } else {\r\n const flowinsightsTmp = flowItems.filter(\r\n x => x.FlowItemId == flowItemId && x.FlowItemType == \"insights\"\r\n );\r\n let flowinsightId = -1;\r\n if (flowinsightsTmp != null && flowinsightsTmp.length > 0) {\r\n const parentIds = flowRelations\r\n .filter(x => x.ChildFlowItemId == flowItemId)\r\n .map(x => x.ParentFlowItemId);\r\n const parentFilters = flowItems.filter(\r\n x => parentIds.includes(x.FlowItemId) && x.FlowItemQty != null\r\n );\r\n if (parentFilters != null && parentFilters.length > 0) {\r\n if (data.idChanges && data.idChanges.FlowItems.length > 0) {\r\n for (let val of data.idChanges.FlowItems) {\r\n if (val[0] == flowItemId) {\r\n flowinsightId = val[1];\r\n }\r\n }\r\n }\r\n if (flowinsightId > -1) {\r\n dispatch(requestFlowItemProcess(flowinsightId, false));\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (deployFlowExportAfterSave && !isSimpleFlowDeploy) {\r\n dispatch(deployFlowExport(flowId));\r\n }\r\n\r\n // Sometimes someone tried to do something, like, switch flows or clear flows, but they\r\n // were prompted to save first. In this case, this will run their original intent after saving.\r\n // If not, does nothing...\r\n dispatch(lossOfWorkRunQueuedAction());\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n if (flow != null) {\r\n dispatch(updateAttribute(\"flows\", flow.FlowId, \"isSaving\", 0));\r\n }\r\n dispatch(decAjaxCount());\r\n dispatch(updateFlowShouldValidate(flowId, false));\r\n h.error(\"Error saving flow.\", error);\r\n throw new Error(\"Error saving flow.\");\r\n });\r\n};\r\n\r\nexport const setFlowUserConfig = (flowUserConfig: FlowUserConfig) => (dispatch: Dispatch, getState: GetState) => {\r\n let state = getState();\r\n let newVal: { [flowId: number]: FlowUserConfig } = clone(state.vars[\"flowUserConfigsCyclone\"] || {});\r\n newVal[flowUserConfig.FlowId] = flowUserConfig;\r\n\r\n dispatch({ type: `SET_FLOW_USER_CONFIGS`, newVal });\r\n};\r\n\r\n// This must be idempotent.\r\nexport const flowEnsureItemDetailsExist = () => (dispatch: Dispatch, getState: GetState) => {\r\n let state = getState();\r\n\r\n const flowItems = getFlowItemsForSelectedFlow(state);\r\n const flowFiltersByFlowItemId = getFlowFiltersByFlowItemId(state);\r\n const flowScriptsByFlowItemId = getFlowScriptsByFlowItemId(state);\r\n const flowScriptsDBUIByFlowItemId = getFlowScriptsDBUIByFlowItemId(state);\r\n const flowMultiExportsByFlowItemId = getFlowMultiExportsByFlowItemId(state);\r\n const flowExportsByFlowItemId = getFlowExportsByFlowItemId(state);\r\n const flowOutputsByFlowItemId = getFlowOutputsByFlowItemId(state);\r\n const flowFromCloudsByFlowItemId = getFlowFromCloudsByFlowItemId(state);\r\n const flowToCloudsByFlowItemId = getFlowToCloudsByFlowItemId(state);\r\n const flowDataLoadsByFlowItemId = getFlowDataLoadsByFlowItemId(state);\r\n const flowReportsByFlowItemId = getFlowReportsByFlowItemId(state);\r\n const flowModelsByFlowItemId = getFlowModelsByFlowItemId(state);\r\n const flowSVDedupesByFlowItemId = getFlowSVDedupesByFlowItemId(state);\r\n const flowSingleViewsByFlowItemId = getFlowSingleViewsByFlowItemId(state);\r\n const flowOffloadByFlowItemId = getFlowOffloadsByFlowItemId(state);\r\n const flowExternalServicesByFlowItemId = getFlowExternalServicesByFlowItemId(state);\r\n const flowExpressionsByFlowItemId = getFlowExpressionsByFlowItemId(state);\r\n const flowCannedReportsByFlowItemId = getFlowCannedReportsByFlowItemId(state);\r\n const flowDescriptionsByFlowItemId = getFlowDescriptionsByFlowItemId(state);\r\n const flowItemSubEntities = prefixesAndEntities.filter(x => x.flowItemType != \"\" && x.flowItemType != null); // Split, Filter, Merge, etc...\r\n\r\n for (const flowItem of flowItems) {\r\n // Add rows if needed - Filter\r\n if (flowItem.FlowItemType.toLowerCase() == \"filter\") {\r\n // Look for a filter entry - if one is missing, add it\r\n const existingFilter = flowFiltersByFlowItemId[flowItem.FlowItemId];\r\n if (existingFilter == null) {\r\n dispatch(newFlowFilter(flowItem.FlowItemId));\r\n }\r\n }\r\n if (flowItem.FlowItemType.toLowerCase() == \"script\") {\r\n // Look for a filter entry - if one is missing, add it\r\n const existingScript = flowScriptsByFlowItemId[flowItem.FlowItemId];\r\n if (existingScript == null) {\r\n dispatch(newFlowScript(flowItem.FlowItemId));\r\n }\r\n }\r\n if (flowItem.FlowItemType.toLowerCase() == \"scriptdbui\") {\r\n // Look for a filter entry - if one is missing, add it\r\n const existingScriptDBUI = flowScriptsDBUIByFlowItemId[flowItem.FlowItemId];\r\n if (existingScriptDBUI == null) {\r\n dispatch(newFlowScriptDBUI(flowItem.FlowItemId));\r\n }\r\n }\r\n if (flowItem.FlowItemType.toLowerCase() == \"singleview\") {\r\n // Look for a filter entry - if one is missing, add it\r\n const existingSingleView = flowSingleViewsByFlowItemId[flowItem.FlowItemId];\r\n if (existingSingleView == null) {\r\n // dispatch(newFlowSingleView(flowItem.FlowItemId));\r\n }\r\n }\r\n if (flowItem.FlowItemType.toLowerCase() == \"export\") {\r\n const existingExport = flowExportsByFlowItemId[flowItem.FlowItemId];\r\n if (existingExport == null) {\r\n dispatch(newFlowExport(flowItem.FlowItemId));\r\n }\r\n }\r\n if (flowItem.FlowItemType.toLowerCase() == \"multiexport\") {\r\n const existingMultiExport = flowMultiExportsByFlowItemId[flowItem.FlowItemId];\r\n if (existingMultiExport == null) {\r\n dispatch(newFlowMultiExport(flowItem.FlowItemId));\r\n }\r\n }\r\n if (flowItem.FlowItemType.toLowerCase() == \"output\") {\r\n const existingOutput = flowOutputsByFlowItemId[flowItem.FlowItemId];\r\n if (existingOutput == null) {\r\n dispatch(newFlowOutput(flowItem.FlowItemId));\r\n }\r\n }\r\n if (flowItem.FlowItemType.toLowerCase() == \"fromcloud\") {\r\n const existingFromCloud = flowFromCloudsByFlowItemId[flowItem.FlowItemId];\r\n if (existingFromCloud == null) {\r\n dispatch(newFlowFromCloud(flowItem.FlowItemId));\r\n }\r\n }\r\n if (flowItem.FlowItemType.toLowerCase() == \"tocloud\") {\r\n const existingToCloud = flowToCloudsByFlowItemId[flowItem.FlowItemId];\r\n if (existingToCloud == null) {\r\n dispatch(newFlowToCloud(flowItem.FlowItemId));\r\n }\r\n }\r\n if (flowItem.FlowItemType.toLowerCase() == \"report\") {\r\n const existingReport = flowReportsByFlowItemId[flowItem.FlowItemId];\r\n if (existingReport == null) {\r\n dispatch(newFlowReport(flowItem.FlowItemId));\r\n }\r\n }\r\n if (flowItem.FlowItemType.toLowerCase() == \"model\") {\r\n const existingModel = flowModelsByFlowItemId[flowItem.FlowItemId];\r\n if (existingModel == null) {\r\n dispatch(newFlowModel(flowItem.FlowItemId));\r\n }\r\n }\r\n // if (flowItem.FlowItemType.toLowerCase() == \"exportreport\") {\r\n // const existingExportReport = flowExportReportsByFlowItemId[flowItem.FlowItemId];\r\n // if (existingExportReport == null) {\r\n // dispatch(newFlowExportReport(flowItem.FlowItemId, 0));\r\n // }\r\n // }\r\n if (flowItem.FlowItemType.toLowerCase() == \"svdedupe\") {\r\n const existingSVDedupe = flowSVDedupesByFlowItemId[flowItem.FlowItemId];\r\n if (existingSVDedupe == null) {\r\n dispatch(newFlowSVDedupe(flowItem.FlowItemId));\r\n }\r\n }\r\n if (flowItem.FlowItemType.toLowerCase() == \"dataload\") {\r\n const existingDataLoad = flowDataLoadsByFlowItemId[flowItem.FlowItemId];\r\n if (existingDataLoad == null) {\r\n dispatch(newFlowDataLoad(flowItem.FlowItemId));\r\n }\r\n }\r\n\r\n if (flowItem.FlowItemType.toLowerCase() == \"offload\") {\r\n const existingOffload = flowOffloadByFlowItemId[flowItem.FlowItemId];\r\n if (!existingOffload) {\r\n dispatch(newFlowOffload(flowItem.FlowItemId));\r\n }\r\n }\r\n\r\n if (flowItem.FlowItemType.toLowerCase() == \"flowcontrol\") {\r\n const existingExternalService = flowExternalServicesByFlowItemId[flowItem.FlowItemId];\r\n if (!existingExternalService) {\r\n dispatch(newFlowExternalService(flowItem.FlowItemId));\r\n }\r\n }\r\n\r\n if (flowItem.FlowItemType.toLowerCase() == \"flowexpression\") {\r\n const existingFlowExpression = flowExpressionsByFlowItemId[flowItem.FlowItemId];\r\n if (!existingFlowExpression) {\r\n dispatch(newFlowExpression(flowItem.FlowItemId));\r\n }\r\n }\r\n\r\n if (flowItem.FlowItemType.toLowerCase() == \"cannedreport\") {\r\n const existingFlowCannedReport = flowCannedReportsByFlowItemId[flowItem.FlowItemId];\r\n if (existingFlowCannedReport == null) {\r\n dispatch(newFlowCannedReport(flowItem.FlowItemId));\r\n }\r\n }\r\n\r\n if (flowItem.FlowItemType.toLowerCase() == \"flowdescription\") {\r\n const existingFlowDescription = flowDescriptionsByFlowItemId[flowItem.FlowItemId];\r\n if (existingFlowDescription == null) {\r\n dispatch(newFlowDescription(flowItem.FlowItemId));\r\n }\r\n }\r\n\r\n // Add rows if needed - Split - 0 rows is ok, do nothing. (Should we generalize all types somehow?)\r\n\r\n // Delete things that aren't my type -- generalized to all type\r\n // Example: If FlowItem1234 is type FILTER, then any SPLIT rows with FlowItemId=1234 should be deleted.\r\n const subEntitiesDeleteExceptionTypes = [\r\n \"FlowItemClientVariableD\",\r\n \"FlowItemEndpoint\",\r\n \"FlowItemOfferCode\",\r\n \"svDedupe\",\r\n \"offerMerge\",\r\n \"FlowDataLoadColumn\",\r\n \"ScriptResult\",\r\n //flow-export-distribution-platforms\r\n \"FlowExportDistributionPlatform\",\r\n // flow-tool-offload\r\n \"FlowOffloadColumn\",\r\n \"FlowExportTemplateFields\",\r\n \"FlowExportPinterestTemplateFields\",\r\n \"FlowExportTikTokTemplateFields\",\r\n \"FlowExportTradeDeskTemplateFields\",\r\n \"FlowExportPubmaticTemplateFields\",\r\n \"FlowExportTaxonomyFileFields\",\r\n \"FlowExportFreewheelDriverFileFields\",\r\n \"FlowExportXanderDriverFields\",\r\n \"FlowSegmentSplit\",\r\n \"FlowSegmentSplitOffer\",\r\n \"FlowExternalServiceParameter\",\r\n \"FlowExpression\",\r\n \"FlowExpressionConstraint\",\r\n \"FlowDescription\",\r\n \"FlowExternalServiceInput\",\r\n \"FlowExternalServiceHardcode\",\r\n ];\r\n\r\n const otherSubEntities = flowItemSubEntities.filter(\r\n x => !subEntitiesDeleteExceptionTypes.includes(x.flowItemType) && x.flowItemType != flowItem.FlowItemType\r\n );\r\n\r\n for (const entityRow of otherSubEntities) {\r\n const { stateKey, id: idName, deleteAc } = entityRow;\r\n\r\n if (typeof deleteAc === 'function') {\r\n const theseThings: Array = Object.values(state[stateKey].byId);\r\n const theseIdsToDelete = theseThings.filter(x => x.FlowItemId == flowItem.FlowItemId).map(x => x[idName]);\r\n\r\n for (const id of theseIdsToDelete) {\r\n dispatch(deleteAc(id));\r\n }\r\n }\r\n }\r\n\r\n state = getState();\r\n }\r\n};\r\n\r\nexport const flowRemoveUnsavedItems = () => (dispatch: Dispatch, getState: GetState) => {\r\n let state = getState();\r\n\r\n const flowItems = getFlowItemsForSelectedFlow(state);\r\n const flowRelations = getFlowRelationsForSelectedFlow(state);\r\n\r\n const flowItemSubEntities = prefixesAndEntities.filter(x => x.flowItemType != \"\" && x.flowItemType != null); // Split, Filter, Merge, etc...\r\n\r\n for (const flowItem of flowItems) {\r\n if (flowItem.FlowId > 0) {\r\n if (flowItem.FlowItemId < 0) {\r\n dispatch(deleteFlowItem(flowItem.FlowItemId));\r\n\r\n const otherSubEntities = flowItemSubEntities.filter(x => x.flowItemType != flowItem.FlowItemType);\r\n for (const entityRow of otherSubEntities) {\r\n const { stateKey, id: idName, deleteAc } = entityRow;\r\n\r\n const theseThings: Array = Object.values(state[stateKey].byId);\r\n const theseIdsToDelete = theseThings.filter(x => x.FlowItemId < 0).map(x => x[idName]);\r\n for (const id of theseIdsToDelete) {\r\n dispatch(deleteAc(id));\r\n }\r\n }\r\n }\r\n\r\n const relationIdsToDelete = flowRelations\r\n .filter(\r\n x =>\r\n x.FlowRelationId < 0 &&\r\n (x.ParentFlowItemId == flowItem.FlowItemId || x.ChildFlowItemId == flowItem.FlowItemId)\r\n )\r\n .map(x => x.FlowRelationId);\r\n\r\n for (const flowRelationId of relationIdsToDelete) {\r\n dispatch(deleteFlowRelation(flowRelationId));\r\n }\r\n }\r\n state = getState();\r\n }\r\n\r\n const flowId = state.selected.flow;\r\n const flowEndpoints = getFlowEndpointsForSelectedFlow(state);\r\n const endpointsToDelete = flowEndpoints.filter(x => x.FlowId == flowId && x.EndpointId == 0).map(x => x.Id);\r\n for (const endpointId of endpointsToDelete) {\r\n dispatch(deleteFlowItemEndpoint(endpointId));\r\n }\r\n\r\n const flowClientVariables = getFlowClientVariablesForSelectedFlow(state);\r\n const variablesToDelete = flowClientVariables.filter(x => x.FlowId == flowId && x.Id < 0).map(x => x.Id);\r\n for (const variableId of variablesToDelete) {\r\n dispatch(deleteFlowClientVariable(variableId));\r\n }\r\n\r\n const flowItemOffers = getFlowItemOfferCodesForSelectedFlow(state);\r\n const offersToDelete = flowItemOffers.filter(x => x.FlowItemOfferCodeId < 0).map(x => x.FlowItemOfferCodeId);\r\n for (const offerId of offersToDelete) {\r\n dispatch(deleteFlowItemOfferCode(offerId));\r\n }\r\n\r\n dispatch(setHasUnsavedChanges(false));\r\n};\r\n\r\nexport const copySelectedNodesToClipboard = () => (dispatch: Dispatch, getState: GetState) => {\r\n let state = getState();\r\n const flowItemTypeLookup = getFlowItemTypeLookupForSelectedFlow(state);\r\n const selectedNodes = state.selected.flowItems;\r\n const selectedNodeLinks = state.selected.flowRelations;\r\n\r\n const nodesToCopy = selectedNodes.filter(x => flowItemTypeLookup[x] != null);\r\n const showDisclaimer = false;\r\n\r\n const excludedNodes = selectedNodes.filter(x => !nodesToCopy.includes(x));\r\n const excludedTypes = uniqArray(\r\n excludedNodes\r\n .map(x => flowItemTypeLookup[x] || \"\")\r\n .filter(x => x != \"\")\r\n .map(x => titleCase(renderFlowItemType(x)))\r\n );\r\n dispatch(updateClipboardNodes(nodesToCopy));\r\n dispatch(updateClipboardRelations(selectedNodeLinks));\r\n const num = nodesToCopy.length;\r\n let message = num == 0 ? \"Cleared clipboard.\" : `Copied ${num} flow item${num > 1 ? \"s\" : \"\"} to clipboard.`;\r\n if (showDisclaimer) {\r\n message = (\r\n
\r\n {message}\r\n
\r\n \r\n (Flow Item Type\r\n {excludedNodes.length > 1 ? \"s\" : \"\"} {excludedTypes.join(\", \")} cannot be copy\r\n pasted.)\r\n \r\n
\r\n );\r\n }\r\n dispatch(notifyBlue(message));\r\n};\r\n// For the selected flow, set all flowitems to be not renaming.\r\nexport const clearAllRenamingFlowItems = () => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const flowItems = getFlowItemsForSelectedFlow(state);\r\n const renamingFlowItems = flowItems.filter(x => x.isRenaming).map(x => x.FlowItemId);\r\n if (renamingFlowItems.length == 0) {\r\n return;\r\n }\r\n for (const id of renamingFlowItems) {\r\n dispatch(updateAttribute(\"flowItems\", id, \"isRenaming\", false));\r\n }\r\n};\r\n\r\nexport const commitAllFlowItemRenames = () => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const flowItems = getFlowItemsForSelectedFlow(state);\r\n const renamingFlowItems = flowItems.filter(x => x.isRenaming).map(x => x.FlowItemId);\r\n if (renamingFlowItems.length == 0) {\r\n return;\r\n }\r\n for (const id of renamingFlowItems) {\r\n const newName = state.flowVars.flowItemRenamingNames[id];\r\n const updatesToMake: { [string]: any } = { isRenaming: false };\r\n if (newName != null && newName != \"\") {\r\n updatesToMake.FlowItemName = newName;\r\n }\r\n dispatch(updateMultipleAttribute(\"flowItems\", id, updatesToMake, true));\r\n }\r\n};\r\n\r\n// For the selected flow, save the new renamed FlowItem name\r\nexport const saveAllRenamingFlowAndFlowItems =\r\n (flowId: number, model: any /* FlowDiagramModel: Make a jest type for me */) =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n const nodes = (Object.values(model.getNodes()): Array); // Array : Make a jest type for me\r\n for (const node of nodes.filter(x => x.isRenaming == true)) {\r\n const flowItem = node.flowItem;\r\n if (flowItem) {\r\n if (node.newName != node.name) {\r\n let itemName = node.newName;\r\n\r\n if (flowItem.FlowItemType == \"export\") {\r\n // #6800 - Export Nodes cannot have a pipe in the item name due to Freewheel Driver File\r\n itemName = itemName.replace(\"|\", \"\");\r\n }\r\n\r\n dispatch(updateAttribute(\"flowItems\", flowItem.FlowItemId, \"FlowItemName\", itemName));\r\n }\r\n dispatch(updateAttribute(\"flowItems\", flowItem.FlowItemId, \"isRenaming\", false));\r\n }\r\n }\r\n\r\n // Clear isRenaming if set - not clear why\r\n const state = getState();\r\n const flow = state.flows.byId[flowId];\r\n if (flow != null && flow.isRenaming) {\r\n dispatch(updateAttribute(\"flows\", flowId, \"isRenaming\", false));\r\n }\r\n };\r\n\r\n///////////////////// DYNAMIC ACTIONS BELOW ////////////////////////////////////\r\n// See \"prefixesAndEntities\" at the bottom of this file\r\nconst _mergeBehaviorToVerb = (mergeBehavior: MergeBehavior): string => {\r\n if (mergeBehavior == \"replace\") {\r\n return \"REPLACE\";\r\n }\r\n if (mergeBehavior == \"merge-overwrite\") {\r\n return \"MERGEOVERWRITE\";\r\n }\r\n if (mergeBehavior == \"merge\") {\r\n return \"MERGE\";\r\n }\r\n return \"MERGE\";\r\n};\r\n\r\nconst _entityPluralNameToPrefix = (entityPluralName: EntityPluralName) => {\r\n const rowMatches = prefixesAndEntities.filter(x => x.stateKey == entityPluralName);\r\n if (rowMatches.length == 0) {\r\n h.error(`entityPluralNameToPrefix: Couldn't find an entity named [${entityPluralName}]`);\r\n return \"\";\r\n }\r\n const row = rowMatches[0];\r\n const prefix = row.actionPrefix;\r\n return prefix;\r\n};\r\n\r\nconst _entityPluralNameToIdColumn = (entityPluralName: EntityPluralName) => {\r\n const rowMatches = prefixesAndEntities.filter(x => x.stateKey == entityPluralName);\r\n if (rowMatches.length == 0) {\r\n h.error(`entityPluralNameToColumn: Couldn't find an entity named [${entityPluralName}]`);\r\n return \"Id\";\r\n }\r\n const row = rowMatches[0];\r\n const idColumn = row.id;\r\n if (idColumn == null) {\r\n h.error(`entityPluralNameToColumn: Couldn't find an ID column for an entity named [${entityPluralName}]`);\r\n return \"Id\";\r\n }\r\n return idColumn;\r\n};\r\n\r\nexport const clearFlowOutputOfferMerges = (flowItemId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const flowOfferMergesArray = getFlowOfferMergesArray(state);\r\n const flowItemOfferMerges = flowOfferMergesArray.filter(x => x.FlowItemId == flowItemId);\r\n for (const offerMerge of flowItemOfferMerges) {\r\n dispatch(deleteFlowOfferMerge(offerMerge.FlowOfferMergeId, false));\r\n }\r\n};\r\n\r\n// Finds the next \"new\" id. Ids for new items will be -1, then -2, then -3, then -4, etc.\r\nconst _makeNewId = (state: any, entityPluralName: EntityPluralName): number => {\r\n if (state[entityPluralName] == null || state[entityPluralName].byId == null) {\r\n h.errorSilent(`makeNewId: Couldn't find ${entityPluralName} byId in state.`);\r\n return 0;\r\n }\r\n\r\n const ids: Array = Object.keys(state[entityPluralName].byId).map(x => parseInt(x, 10));\r\n return Math.min.apply(null, ids.concat(0)) - 1;\r\n};\r\n///////////////////// DYNAMIC ACTIONS BELOW ////////////////////////////////////\r\n// These attributes don't cause unsaved changes, removed \"x\", \"y\" for #2560\r\nconst attributesDontCauseUnsaved = [\r\n \"isSaving\",\r\n \"hasUnsavedChanges\",\r\n \"FlowFolderId\",\r\n \"isRenaming\",\r\n \"IsRunning\",\r\n \"IsValid\",\r\n \"FlowFilterCriteriaText\",\r\n \"width\",\r\n \"height\",\r\n \"flowItemsRunning\",\r\n \"IsError\",\r\n \"IsCancelled\",\r\n \"shouldValidate\",\r\n \"isLoadingFlowData\",\r\n \"WFJobClientKey\",\r\n \"FlowBaseType\",\r\n];\r\n\r\n// Use \"updateImmediately\" when the user is typing, and each keystroke sends a redux update.\r\n// Otherwise, we shouldn't use it. Actions will be batched and subscription update notifications\r\n// will be debounced at ~8ms.\r\nexport const updateMultipleAttribute =\r\n (\r\n entityPluralName: EntityPluralName,\r\n id: number,\r\n updates: { [string]: any },\r\n updateImmediately: boolean = false,\r\n triggerLossOfWork: boolean = true\r\n ): ThunkAction =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n const prefix = _entityPluralNameToPrefix(entityPluralName);\r\n\r\n // updates = {x: 100, y: 200} --> actionUpdates = [ {attribute: x, value: 100}, {attribute: y, value: 200} ]\r\n const actionUpdates = Object.entries(updates).map(x => ({ attribute: x[0], value: x[1] }));\r\n dispatch({\r\n type: `${prefix}_CHANGE_MULTIPLE_ATTRIBUTE`,\r\n id,\r\n updates: actionUpdates,\r\n meta: { doNotBatch: updateImmediately },\r\n });\r\n\r\n ////// Smart actions after the actual update //////\r\n\r\n // If we're changing a FlowItem's type, then make sure the subitems exist.\r\n if (Object.keys(updates).includes(\"FlowItemType\")) {\r\n dispatch(flowEnsureItemDetailsExist());\r\n }\r\n\r\n const state = getState();\r\n // Updating a flowEmpty's FlowEmptyCriteria automatically changes the associated FlowItem's FlowItemName.\r\n if (entityPluralName == \"flowEmpties\" && Object.keys(updates).includes(\"FlowEmptyCriteria\")) {\r\n const flowEmpty = state[entityPluralName].byId[id];\r\n if (flowEmpty != null) {\r\n dispatch(updateAttribute(\"flowItems\", flowEmpty.FlowItemId, \"FlowItemName\", updates.FlowEmptyCriteria));\r\n }\r\n }\r\n // Set unsaved changes, unless every attribute changed doesn't cause unsaved changes\r\n // This can be optimized, since a lot of times we end up doing another round trip :(\r\n if (!Object.keys(updates).every(x => attributesDontCauseUnsaved.includes(x)) && triggerLossOfWork) {\r\n dispatch(setHasUnsavedChanges());\r\n }\r\n\r\n if (\r\n entityPluralName == \"flowItems\" &&\r\n Object.keys(updates).includes(\"FlowItemName\") &&\r\n state.flowItems &&\r\n state.flowItems.byId[id] &&\r\n state.flowItems.byId[id].FlowItemType == \"multiexport\"\r\n ) {\r\n const flowRelations = getFlowRelationsArray(state);\r\n const childRelations = flowRelations.filter(x => x.ParentFlowItemId == id && x.ChildFlowItemId != 0);\r\n\r\n for (const childRelation of childRelations) {\r\n dispatch(\r\n updateAttribute(\r\n entityPluralName,\r\n childRelation.ChildFlowItemId,\r\n \"FlowItemName\",\r\n updates.FlowItemName,\r\n updateImmediately,\r\n triggerLossOfWork\r\n )\r\n );\r\n }\r\n }\r\n };\r\n\r\n// Use \"updateImmediately\" when the user is typing, and each keystroke sends a redux update.\r\n// Otherwise, we shouldn't use it. Actions will be batched and subscription update notifications\r\n// will be debounced at ~8ms.\r\nexport const updateAttribute =\r\n (\r\n entityPluralName: EntityPluralName,\r\n id: number,\r\n attribute: string,\r\n value: any,\r\n updateImmediately: boolean = false,\r\n triggerLossOfWork: boolean = true\r\n ): ThunkAction =>\r\n (dispatch: Dispatch) => {\r\n if (top.AE) {\r\n top.AE.Push.consoleLogWithGroupCollapsed(\r\n {\r\n entityPluralName,\r\n id,\r\n attribute,\r\n value,\r\n updateImmediately,\r\n },\r\n \"Flow Update Attribute\"\r\n );\r\n }\r\n dispatch(\r\n updateMultipleAttribute(entityPluralName, id, { [attribute]: value }, updateImmediately, triggerLossOfWork)\r\n );\r\n };\r\n\r\nexport const addThing =\r\n (\r\n entityPluralName: EntityPluralName,\r\n thing: FlowThings,\r\n idCallback?: number => any,\r\n isSetUnsaved?: boolean = true\r\n ) =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const id = _makeNewId(state, entityPluralName);\r\n const prefix = _entityPluralNameToPrefix(entityPluralName);\r\n const idColumn = _entityPluralNameToIdColumn(entityPluralName);\r\n thing[idColumn] = id;\r\n dispatch({\r\n type: `${prefix}_ADD`,\r\n id,\r\n thing,\r\n });\r\n if (idCallback != null && typeof idCallback == \"function\") {\r\n idCallback(id);\r\n }\r\n\r\n if (isSetUnsaved) {\r\n dispatch(setHasUnsavedChanges());\r\n }\r\n };\r\n\r\nexport const clearAllFlowData = () => (dispatch: Dispatch) => {\r\n const mergeBehavior = \"replace\";\r\n for (const row of prefixesAndEntities) {\r\n const prefix = row.actionPrefix;\r\n dispatch({\r\n type: `${prefix}_${_mergeBehaviorToVerb(mergeBehavior)}_LIST`,\r\n things: [],\r\n });\r\n dispatch({\r\n type: `${prefix}_${_mergeBehaviorToVerb(mergeBehavior)}_LIST`,\r\n things: [],\r\n });\r\n }\r\n};\r\n\r\n// Not an action creator. Helper function for requestFlow/requestFlows.\r\nconst loadFlowData = (data, dispatch, getState, mergeBehavior, getAllFlowEntities: boolean = true) => {\r\n data = parseJsonInsideFlowData(data);\r\n const normalizedData = normalizeFlowData(data);\r\n let flowClientVariableIdsToDelete: ?Array = null;\r\n for (const row of prefixesAndEntities) {\r\n const prefix = row.actionPrefix;\r\n const entity = row.stateKey;\r\n if (entity == \"flows\" || getAllFlowEntities == true) {\r\n dispatch({\r\n type: `${prefix}_${_mergeBehaviorToVerb(mergeBehavior)}_LIST`,\r\n things: normalizedData.entities[entity] || [],\r\n });\r\n }\r\n }\r\n\r\n if (normalizedData.entities.flowClientVariables != null) {\r\n const flowClientVariablesFromServer: Array = Object.values(\r\n normalizedData.entities.flowClientVariables\r\n );\r\n let flowIdsSeen: Array = flowClientVariablesFromServer.map(x => x.FlowId);\r\n flowIdsSeen = [...new Set(flowIdsSeen)]; // uniq\r\n const state = getState();\r\n\r\n const flowClientVariablesInState: Array = Object.values(state.flowClientVariables.byId);\r\n flowClientVariableIdsToDelete = flowClientVariablesInState\r\n .filter(x => flowIdsSeen.includes(x.FlowId))\r\n .map(x => x.Id);\r\n }\r\n\r\n // Remove existing ScriptResults from redux. Have to check both from server and state to make it work correctly.\r\n const state = getState();\r\n\r\n const flowScriptResultsInState: Array = Object.values(state.flowScriptResults.byId);\r\n if (flowScriptResultsInState.length > 0 && normalizedData.entities.flowScriptResults != null) {\r\n const flowScriptResultFromServer: Array = Object.values(\r\n normalizedData.entities.flowScriptResults\r\n );\r\n const newIds = flowScriptResultFromServer.map(x => x.FlowScriptResultId);\r\n const flowItemIds = flowScriptResultFromServer.map(x => x.FlowItemId);\r\n\r\n const flowScriptResultsToDelete = flowScriptResultsInState\r\n .filter(x => flowItemIds.includes(x.FlowItemId))\r\n .map(x => x.FlowScriptResultId)\r\n .filter(x => !newIds.includes(x));\r\n\r\n for (const id of flowScriptResultsToDelete) {\r\n dispatch(deleteFlowScriptResult(id));\r\n dispatch(setHasUnsavedChanges(false));\r\n }\r\n }\r\n\r\n if (normalizedData.entities.flowItems) {\r\n const flowItemsFromServer: Array = Object.values(normalizedData.entities.flowItems);\r\n const flowItemsIdsAffected = flowItemsFromServer\r\n .filter(x => x.FlowItemType == \"dataload\")\r\n .map(x => x.FlowItemId);\r\n\r\n const flowDataLoadColumnsInState: Array = Object.values(state.flowDataLoadColumns.byId);\r\n const affectedDataLoadColumns = flowDataLoadColumnsInState.filter(x =>\r\n flowItemsIdsAffected.includes(x.FlowItemId)\r\n );\r\n\r\n if (affectedDataLoadColumns.length > 0) {\r\n const flowDataLoadColumnsFromServer: Array = normalizedData.entities.flowDataLoadColumns\r\n ? Object.values(normalizedData.entities.flowDataLoadColumns)\r\n : [];\r\n const dataLoadColumnIdsFromServer = flowDataLoadColumnsFromServer.map(x => x.FlowDataLoadColumnId);\r\n const dataLoadColumnsToDelete = affectedDataLoadColumns.filter(\r\n x => !dataLoadColumnIdsFromServer.includes(x.FlowDataLoadColumnId)\r\n );\r\n for (const dataLoadColumn of dataLoadColumnsToDelete) {\r\n dispatch(deleteFlowDataLoadColumn(dataLoadColumn.FlowDataLoadColumnId));\r\n }\r\n dispatch(setHasUnsavedChanges(false));\r\n }\r\n }\r\n\r\n // To go directly to audiences when a flow is a Simple Flows\r\n if (\r\n data.flowItems &&\r\n data.flows &&\r\n data.flows.length == 1 &&\r\n data.flows[0].FlowBaseType &&\r\n data.flows[0].FlowBaseType != 0\r\n ) {\r\n if (state.vars.previousUrlIdForSimpleFlow != data.flows[0].FlowId) {\r\n const flowItemId = data.flowItems.filter(\r\n x => x.FlowId == data.flows[0].FlowId && (x.FlowItemType == \"filter\" || x.FlowItemType == \"case\")\r\n );\r\n dispatch(setSelectedFlowItemId(flowItemId[0].FlowItemId)); //Changes faster the selected flowItemId, avoiding errors\r\n dispatch(UrlIdForSimpleFlow(data.flows[0].FlowId)); // If the ID is the same don't reload, to avoid loops\r\n }\r\n }\r\n dispatch(updateFlowList(normalizedData, \"replace\", flowClientVariableIdsToDelete));\r\n dispatch(decAjaxCount());\r\n};\r\n\r\nexport const loadSingleViewDataVars = (destinations: Array) => (dispatch: Dispatch) => {\r\n dispatch({\r\n type: \"LOAD_SINGLE_VIEW_DESTINATIONS\",\r\n destinations,\r\n });\r\n};\r\nexport const loadDataloadPartners = (destinations: Array) => (dispatch: Dispatch) => {\r\n dispatch({\r\n type: \"LOAD_DATALOAD_DESTINATIONS\",\r\n destinations,\r\n });\r\n};\r\n\r\n// requestFlowItem(flowItemId): Get the information about one flow item from the database.\r\nexport const requestFlowItem =\r\n (flowItemId: number): ThunkAction =>\r\n (dispatch: Dispatch) => {\r\n let url = \"/flows/GetFlowItem/\" + flowItemId;\r\n dispatch(incAjaxCount());\r\n return fetch(url, { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n const normalizedData = normalizeFlowData({ flowItems: data });\r\n dispatch({\r\n type: \"FLOW_ITEM_MERGE_LIST\",\r\n things: normalizedData.entities.flowItems,\r\n });\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error\", error);\r\n });\r\n };\r\ntop.RDX.requestFlowItem = flowItemId => top.store.dispatch(requestFlowItem(flowItemId));\r\n\r\nimport { requestUserNames } from \"./actionCreators\";\r\nexport const requestFlows =\r\n (\r\n flowId: ?number = null,\r\n mergeBehavior: MergeBehavior = \"replace\",\r\n getAllFlowEntities: boolean = true\r\n ): ThunkAction =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n let url = \"/flows/getflows\";\r\n const state = getState();\r\n\r\n if (flowId != null) {\r\n url += \"/\" + flowId;\r\n if (mergeBehavior == \"replace\") {\r\n mergeBehavior = \"merge\";\r\n }\r\n }\r\n\r\n dispatch(incAjaxCount());\r\n\r\n if (!state.treeBehaviors.isFlowTreeLoadingExclude) {\r\n dispatch(ToggleIsFlowTreeLoading(true));\r\n }\r\n\r\n if (state.session.isAuthenticated) {\r\n return request(url, { credentials: \"same-origin\" }, dispatch)\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n // Net to load user names for ALL flow owners\r\n const userIds = [...new Set(data.flows.map(item => item.FlowCreatedBy))];\r\n dispatch(requestUserNames(userIds, \"merge\"));\r\n loadFlowData(data, dispatch, getState, mergeBehavior, getAllFlowEntities);\r\n dispatch(ToggleIsFlowTreeLoading(false));\r\n if (state.treeBehaviors.isFlowTreeLoadingExclude) {\r\n dispatch(SetIsFlowLoadingExcludes(false));\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n dispatch(ToggleIsFlowTreeLoading(false));\r\n if (state.treeBehaviors.isFlowTreeLoadingExclude) {\r\n dispatch(SetIsFlowLoadingExcludes(false));\r\n }\r\n h.error(\"Error loading flows.\", error);\r\n });\r\n }\r\n };\r\n\r\n// Special case for RDX.requestFlows. Because this is called whenever a flowItem completes (via NotifyChange in C#),\r\n// and often, several flowItems finish right after each other (splits, for example), we will debounce this quite heavily\r\n// in order to reduce the amount of needless http requests and processing done on the client.\r\nconst RDXRequestFlows = (flowId, mergeBehavior) => {\r\n top.store.dispatch(requestFlows(flowId, mergeBehavior));\r\n};\r\ntop.RDX.requestFlows = wrap(\r\n memoize(\r\n () => debounce(RDXRequestFlows, 1100),\r\n flowId => flowId\r\n ),\r\n (func, flowId, mergeBehavior) => func(flowId)(flowId, mergeBehavior)\r\n);\r\n\r\nexport const checkFlowSaveStatus =\r\n (flowId: number): ThunkAction =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n let flow = getState().flows.byId[flowId];\r\n if (flow != null) {\r\n if (flow.isSaving != null && flow.isSaving != 0) {\r\n dispatch(updateAttribute(\"flows\", flowId, \"isSaving\", 2)); // Show success icon for a few seconds\r\n setTimeout(() => {\r\n if (flow != null && flowId > 0) {\r\n // Flow might have been deleted within 5 seconds(Browser Tests)\r\n dispatch(updateAttribute(\"flows\", flowId, \"isSaving\", 0));\r\n }\r\n }, 3500);\r\n }\r\n }\r\n };\r\n\r\nexport const checkFlowPermission = (flowId: number) => (dispatch: Dispatch) => {\r\n request(`/flows/CheckFlowCompanyAccess/${flowId}`, { method: \"POST\", credentials: \"same-origin\" }, dispatch)\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n if (data.canSwitch) {\r\n window.location.reload();\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error checking flow company.\", error);\r\n });\r\n};\r\ntop.RDX.checkFlowPermission = flowId => top.store.dispatch(checkFlowPermission(flowId));\r\nexport const requestFlow =\r\n (flowId: number, mergeBehavior: MergeBehavior = \"replace\"): ThunkAction =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n //If we switch companies to one that doesn't have flows after executing\r\n //This makes sure that we don't request the information\r\n //Since the mew current company doesn't have the feature\r\n const state = getState();\r\n if (!state.session.enabledFeatures.includes(\"flow\")) {\r\n return;\r\n }\r\n\r\n if (mergeBehavior == \"replace\") {\r\n mergeBehavior = \"merge\";\r\n }\r\n dispatch(incAjaxCount());\r\n dispatch(updateFlowShouldValidate(flowId, true));\r\n\r\n // only show loading in designer when we're on the flow, else loadin the background\r\n if (state.selected.flow && state.selected.flow == flowId) {\r\n dispatch(flowRelatedRequestStart());\r\n }\r\n\r\n dispatch(updateIsLoadingFlowData(flowId, true));\r\n\r\n dispatch(requestExternalServiceLayoutData(state.session.companyId));\r\n\r\n return request(`/flows/getflow/${flowId}`, { credentials: \"same-origin\" }, dispatch)\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(res => {\r\n loadFlowData(res, dispatch, getState, mergeBehavior);\r\n if (!state.vars.destinations || (state.vars.destinations && state.vars.destinations.length == 0)) {\r\n dispatch(requestDestinations());\r\n }\r\n if (\r\n state.session.enabledFeatures.includes(\"export-destination-ui-redesign\") &&\r\n (!state.vars.availableDestinations || !state.vars.requestableDestinations)\r\n ) {\r\n dispatch(requestDestinationsByAccess());\r\n }\r\n dispatch(GetTapadDeliveryTemplates(state.session.companyId));\r\n dispatch(requestFlowFieldFilters(flowId));\r\n dispatch(checkFlowSaveStatus(flowId));\r\n dispatch(updateFlowItemsRunning(flowId));\r\n dispatch(updateFlowShouldValidate(flowId, false));\r\n dispatch(updateIsLoadingFlowData(flowId, false));\r\n dispatch(flowRelatedRequestCompleted());\r\n if (state.session.enabledFeatures.includes(\"export-unknown-field-validation\")) {\r\n dispatch(requestFlowLayoutErrors(flowId));\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error loading flow.\", error);\r\n dispatch(updateIsLoadingFlowData(flowId, false));\r\n dispatch(updateAttribute(\"flows\", flowId, \"isLoadingFlowData\", false));\r\n dispatch(flowRelatedRequestCompleted());\r\n });\r\n };\r\ntop.RDX.requestFlow = (flowId, mergeBehavior) => top.store.dispatch(requestFlow(flowId, mergeBehavior));\r\n\r\nconst updateFlowItemsRunning = (flowId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const flow = state.flows.byId[flowId];\r\n if (flow) {\r\n const allFlowItems = getFlowItemsArray(state);\r\n const flowItemsRunning = allFlowItems.filter(x => x.FlowId == flowId && x.IsRunning);\r\n dispatch(updateAttribute(\"flows\", flowId, \"flowItemsRunning\", flowItemsRunning.length));\r\n }\r\n};\r\n\r\nconst RDXRequestFlow = (flowId, mergeBehavior) => {\r\n top.store.dispatch(requestFlow(flowId, mergeBehavior));\r\n};\r\ntop.RDX.requestFlow = wrap(\r\n memoize(\r\n () => debounce(RDXRequestFlow, 1100),\r\n flowId => flowId\r\n ),\r\n (func, flowId, mergeBehavior) => func(flowId)(flowId, mergeBehavior)\r\n);\r\n\r\nexport const updateFlowDeploymentQueueItem =\r\n (flowLogType: string, workFlowId: number, newStatus: number) => (dispatch: Dispatch) => {\r\n dispatch({\r\n type: \"UPDATE_FLOWDEPLOYMENTQUEUE_STATUS\",\r\n flowLogType,\r\n workFlowId,\r\n newStatus,\r\n });\r\n };\r\n\r\nexport const getFlowItemDeployStatuses =\r\n (flowItemId: number, companyId: number, workflowId: number) => (dispatch: Dispatch) => {\r\n dispatch(incAjaxCount());\r\n dispatch({ type: \"SET_FLOW_DEPLOY_STATUSES\", audienceStatuses: [], loading: true });\r\n\r\n return fetch(\r\n \"/Flows/GetFlowItemDeployStatuses?\" +\r\n h.serialize({\r\n flowItemId,\r\n companyId,\r\n workflowId,\r\n }),\r\n { credentials: \"same-origin\" }\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch({ type: \"SET_FLOW_DEPLOY_STATUSES\", audienceStatuses: data.audienceStatus, loading: false });\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n\r\n dispatch({ type: \"SET_FLOW_DEPLOY_STATUSES\", audienceStatuses: [], loading: false });\r\n h.error(\"Error getting Audience statuses.\", error);\r\n });\r\n };\r\ntop.RDX.getFlowItemDeployStatuses = (flowItemId: number, companyId: number) =>\r\n top.store.dispatch(getFlowItemDeployStatuses(flowItemId, companyId));\r\n\r\nexport const requestFlowDeploymentQueue =\r\n (flowLogType: string, flowId: number, companyId: number) => (dispatch: Dispatch) => {\r\n const getFlowLogUrl = \"/Flows/GetFlowLogs?\" + h.serialize({ flowLogType, flowId, companyId });\r\n dispatch(incAjaxCount());\r\n\r\n if (flowLogType == \"\" || flowLogType == \"Active\") {\r\n dispatch({ type: \"SET_FLOW_DEPLOYMENT_QUEUE_ACTIVE_LIST\", activeList: [], loading: false });\r\n }\r\n if (flowLogType == \"\" || flowLogType == \"Historical\") {\r\n dispatch({ type: \"SET_FLOW_DEPLOYMENT_QUEUE_HISTORICAL_LIST\", historicalList: [], loading: false });\r\n }\r\n return fetch(getFlowLogUrl, { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(flowLogsList => {\r\n if (flowLogType == \"\" || flowLogType == \"Active\") {\r\n const activeList = flowLogsList.filter(\r\n x => x.WorkflowStatusId == 7 || x.WorkflowStatusId == 8 || x.WorkflowStatusId == 11\r\n );\r\n dispatch({ type: \"SET_FLOW_DEPLOYMENT_QUEUE_ACTIVE_LIST\", activeList, loading: false });\r\n }\r\n if (flowLogType == \"\" || flowLogType == \"Historical\") {\r\n const historicalList = flowLogsList.filter(\r\n x => x.WorkflowStatusId != 7 && x.WorkflowStatusId != 8 && x.WorkflowStatusId != 11\r\n );\r\n dispatch({ type: \"SET_FLOW_DEPLOYMENT_QUEUE_HISTORICAL_LIST\", historicalList, loading: false });\r\n }\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error getting Flow Logs List.\", error);\r\n });\r\n };\r\ntop.RDX.requestFlowDeploymentQueue = (flowLogType: string, flowId: number, companyId: number) =>\r\n top.store.dispatch(requestFlowDeploymentQueue(flowLogType, flowId, companyId));\r\n\r\nexport const requestFlowCountLog = (flowLogType: string) => (dispatch: Dispatch) => {\r\n const getFlowLogUrl = \"/Flows/GetCountLog?\" + h.serialize({ flowLogType });\r\n dispatch(incAjaxCount());\r\n if (flowLogType == \"\" || flowLogType == \"Active\") {\r\n dispatch({ type: \"SET_COUNT_LOG_ACTIVE_LIST\", activeList: [], loading: false });\r\n }\r\n if (flowLogType == \"\" || flowLogType == \"Historical\") {\r\n dispatch({ type: \"SET_COUNT_LOG_HISTORICAL_LIST\", historicalList: [], loading: false });\r\n }\r\n return fetch(getFlowLogUrl, { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(flowCountsList => {\r\n if (flowLogType == \"\" || flowLogType == \"Active\") {\r\n const activeList = flowCountsList.filter(x => x.WorkflowStatusId == 1);\r\n dispatch({ type: \"SET_COUNT_LOG_ACTIVE_LIST\", activeList, loading: false });\r\n }\r\n if (flowLogType == \"\" || flowLogType == \"Historical\") {\r\n const historicalList = flowCountsList.filter(x => x.WorkflowStatusId != 1);\r\n dispatch({ type: \"SET_COUNT_LOG_HISTORICAL_LIST\", historicalList, loading: false });\r\n }\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error getting Count Logs List.\", error);\r\n });\r\n};\r\ntop.RDX.requestFlowCountLog = (flowLogType: string) => top.store.dispatch(requestFlowCountLog((flowLogType: string)));\r\n\r\nexport const resetCloudFlowObjects = () => (dispatch: Dispatch) => {\r\n dispatch({\r\n type: \"RESET_CLOUD_FLOWS\",\r\n });\r\n};\r\n\r\nexport const requestFlowObjectsFromCloud = () => (dispatch: Dispatch) => {\r\n const getFlowLogUrl = \"/Flows/GetFlowObjectsFromCloud\";\r\n dispatch(incAjaxCount());\r\n fetch(getFlowLogUrl, { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(flowCloud => {\r\n dispatch({ type: \"SET_FLOW_CLOUD_OBJECTS\", flowCloud });\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error getting flow objects from cloud.\", error);\r\n });\r\n};\r\ntop.RDX.requestFlowObjectsFromCloud = () => top.store.dispatch(requestFlowObjectsFromCloud());\r\n\r\nexport const requestFlowExportApproval = (flowId: number) => (dispatch: Dispatch) => {\r\n const apiUrl = \"/Flows/RequestExportApproval?\" + h.serialize({ flowId });\r\n dispatch(incAjaxCount());\r\n fetch(apiUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n if (!data.result) {\r\n if (data.error) {\r\n h.error(data.error);\r\n return;\r\n } else {\r\n throw new Error(\"Error requesting flow export approval.\");\r\n }\r\n } else {\r\n dispatch(updateAttribute(\"flows\", flowId, \"IsLocked\", true));\r\n dispatch(flowRemoveUnsavedItems());\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"There was an issue with requesting flow export approval.\", error);\r\n });\r\n};\r\ntop.RDX.requestFlowExportApproval = (flowId: number) => top.store.dispatch(requestFlowExportApproval((flowId: number)));\r\n\r\nexport const requestFlowCountApproval = (flowId: number) => (dispatch: Dispatch) => {\r\n const apiUrl = \"/Flows/RequestCountApproval?\" + h.serialize({ flowId });\r\n dispatch(incAjaxCount());\r\n fetch(apiUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n if (!data.result) {\r\n if (data.error) {\r\n h.error(data.error);\r\n return;\r\n } else {\r\n throw new Error(\"Error requesting flow count log.\");\r\n }\r\n } else {\r\n dispatch(updateAttribute(\"flows\", flowId, \"IsLocked\", true));\r\n dispatch(flowRemoveUnsavedItems());\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error requesting flow count log.\", error);\r\n });\r\n};\r\ntop.RDX.requestFlowCountApproval = (flowId: number) => top.store.dispatch(requestFlowCountApproval((flowId: number)));\r\n\r\nexport const requestFlowLayoutErrors = (flowId: number) => (dispatch: Dispatch) => {\r\n const apiUrl = \"/Flows/ValidateFlowDestinationLayouts?\" + h.serialize({ flowId });\r\n dispatch(incAjaxCount());\r\n fetch(apiUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n if (data.itemLayoutErrors) {\r\n dispatch(setFlowItemLayoutErrors(data.itemLayoutErrors));\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error checking Flow layout errors.\", error);\r\n });\r\n};\r\ntop.RDX.requestFlowExportApproval = (flowId: number) => top.store.dispatch(requestFlowExportApproval((flowId: number)));\r\n\r\nexport const deployFlowExport = (flowId: number) => (dispatch: Dispatch) => {\r\n const apiUrl = \"/Flows/DeployExport?\" + h.serialize({ flowId });\r\n dispatch(incAjaxCount());\r\n fetch(apiUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n if (!data.result) {\r\n if (data.error) {\r\n h.error(data.error);\r\n return;\r\n } else {\r\n throw new Error(\"Error deploying flow export.\");\r\n }\r\n } else {\r\n dispatch(updateAttribute(\"flows\", flowId, \"IsLocked\", true));\r\n dispatch(flowRemoveUnsavedItems());\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error deploying flow export.\", error);\r\n });\r\n};\r\ntop.RDX.deployFlowExport = (flowId: number) => top.store.dispatch(deployFlowExport((flowId: number)));\r\n\r\nexport const cancelFlowExportRequest = (flowId: number) => (dispatch: Dispatch) => {\r\n const apiUrl = \"/Flows/CancelFlowExportRequest?\" + h.serialize({ flowId });\r\n dispatch(incAjaxCount());\r\n fetch(apiUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n if (!data.result) {\r\n if (data.error) {\r\n h.error(data.error);\r\n dispatch(decAjaxCount());\r\n return;\r\n } else {\r\n throw new Error(\"Error cancelling flow approval request.\");\r\n }\r\n } else if (data && data.result && !data.IsLockedPermanently) {\r\n dispatch(updateAttribute(\"flows\", flowId, \"IsLocked\", false));\r\n }\r\n\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error cancelling flow approval request.\", error);\r\n });\r\n};\r\ntop.RDX.cancelFlowExportRequest = (flowId: number) => top.store.dispatch(cancelFlowExportRequest((flowId: number)));\r\n\r\nexport const decideFlowExport = (workflowId: number, actionName: string, reason: string) => (dispatch: Dispatch) => {\r\n const apiUrl = \"/Flows/DecideExportRequestAsync?\" + h.serialize({ workflowId, actionName, reason });\r\n fetch(apiUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n dispatch(requestFlowDeploymentQueue(\"\", 0));\r\n dispatch(decAjaxCount());\r\n if (data.error) {\r\n h.error(data.error);\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error deciding Flow Export (action \" + actionName + \").\", error);\r\n });\r\n};\r\ntop.RDX.decideFlowExport = (workflowId, actionName, reason) =>\r\n top.store.dispatch(decideFlowExport(workflowId, actionName, reason));\r\n\r\nexport const decideCountApproval =\r\n (workflowId: number, actionName: string, flowItemId: number, flowItemType: string) => (dispatch: Dispatch) => {\r\n const apiUrl =\r\n \"/Flows/DecideCountApproval?\" + h.serialize({ workflowId, actionName, flowItemId, flowItemType });\r\n fetch(apiUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n dispatch(requestFlowCountLog(\"\"));\r\n dispatch(decAjaxCount());\r\n if (data.error) {\r\n h.error(data.error);\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error deciding Count Log (action \" + actionName + \").\", error);\r\n });\r\n };\r\ntop.RDX.decideCountApproval = (workflowId, actionName, flowItemId, flowItemType) =>\r\n top.store.dispatch(decideCountApproval(workflowId, actionName, flowItemId, flowItemType));\r\n\r\nexport const requestFinalizeDiscoveries = (flowId: number) => (dispatch: Dispatch) => {\r\n const apiUrl = \"/Flows/FinalizeFlowDiscoveries?\" + h.serialize({ flowId });\r\n dispatch(incAjaxCount());\r\n fetch(apiUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n if (!data.result) {\r\n if (data.error) {\r\n h.error(data.error);\r\n return;\r\n } else {\r\n throw new Error(\"Error finalizing Flow Discoveries.\");\r\n }\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error finalizing Flow Discoveries.\", error);\r\n });\r\n};\r\ntop.RDX.requestFinalizeDiscoveries = (flowId: number) =>\r\n top.store.dispatch(requestFinalizeDiscoveries((flowId: number)));\r\n\r\n////////////////// BEGIN DELETE SECTION //////////////////////\r\n// Simply delete a thing with no checks or cascading deletes\r\n// We should probably build 'smarter' deletes on top of this one.\r\nexport const _deleteThing = (entityPluralName: EntityPluralName, id: number) => (dispatch: Dispatch) => {\r\n const prefix = _entityPluralNameToPrefix(entityPluralName);\r\n dispatch({\r\n type: `${prefix}_DELETE`,\r\n id,\r\n });\r\n dispatch(setHasUnsavedChanges());\r\n};\r\n\r\nexport const deleteAllItemsInFlow = (flowId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const items = getFlowItemsArray(state);\r\n const myItemIds = items.filter(x => x.FlowId == flowId).map(x => x.FlowItemId);\r\n for (const id of myItemIds) {\r\n dispatch(deleteFlowItem(id));\r\n }\r\n};\r\n\r\nexport const requestDeleteFlow = (flowId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n dispatch(incAjaxCount());\r\n dispatch(updateAttribute(\"flows\", flowId, \"hasUnsavedChanges\", false));\r\n\r\n const deleteResultsDbUrl =\r\n \"/Flows/DeleteFlow?\" +\r\n h.serialize({\r\n flowId,\r\n });\r\n\r\n // Local updates\r\n if (getState().selected.flow == flowId) {\r\n dispatch(setSelectedFlowNoUnsavedCheck(-1));\r\n }\r\n dispatch(deleteFlow(flowId));\r\n\r\n // Server request\r\n return request(deleteResultsDbUrl, { method: \"POST\", credentials: \"same-origin\" }, dispatch)\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n if (!data.result) {\r\n if (data.error) {\r\n h.error(data.error);\r\n throw new Error(data.error);\r\n } else {\r\n throw new Error(\"Error deleting flow.\");\r\n }\r\n }\r\n dispatch(notifyGreen(\"Flow deleted successfully.\"));\r\n dispatch(SetIsFlowLoadingExcludes(true));\r\n dispatch(requestFlows());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n dispatch(SetIsFlowLoadingExcludes(false));\r\n\r\n h.error(\"Error deleting flow\", error);\r\n throw new Error(\"Error deleting flow.\");\r\n });\r\n};\r\n\r\n// Delete an array of flowItemIds, but only if permissions allow. Assumes currently selected flow.\r\nexport const deleteFlowItemsCheckPerms = (ids: Array) => (dispatch: Dispatch, getState: GetState) => {\r\n // We are assuming the flowItems belong to the currently selected flow.\r\n const getPermissions = makeGetPermissionsItemFromProps();\r\n for (const id of ids) {\r\n const state = getState();\r\n const permissions: FlowAndItemPermissions = getPermissions(state, { flowItemId: id });\r\n if (permissions.item.canRemove) {\r\n dispatch(deleteFlowItem(id));\r\n }\r\n }\r\n};\r\n\r\n// Delete an array of flowRelationIds, but only if permissions allow. Assumes currently selected flow.\r\nexport const deleteFlowRelationsCheckPerms = (ids: Array) => (dispatch: Dispatch, getState: GetState) => {\r\n // We are assuming the relations belong to the currently selected flow.\r\n const state = getState();\r\n const getPermissions = makeGetSelectedFlowPermissions();\r\n\r\n const flowPermissions: FlowPermissions = getPermissions(state);\r\n if (!flowPermissions.canEdit) {\r\n return;\r\n }\r\n\r\n for (const id of ids) {\r\n dispatch(deleteFlowRelation(id));\r\n }\r\n};\r\n\r\n//TODO will likely need to add flowSingleViews here\r\n// Delete a flow item, and also all relations and subtypes involving it\r\nexport const deleteFlowItem = (id: number) => (dispatch: Dispatch, getState: GetState) => {\r\n let state = getState();\r\n const thisFlowItem: ?FlowItem = state.flowItems.byId[id];\r\n if (thisFlowItem == null) {\r\n return;\r\n }\r\n dispatch(updateFlowShouldValidate(state.selected.flow, true));\r\n dispatch(invalidateItemAndChildren(id));\r\n\r\n let allRelations = getFlowRelationsArray(state);\r\n\r\n const relationIdsToUpdate = allRelations.filter(x => x.ParentFlowItemId == id).map(x => x.FlowRelationId);\r\n const relationIdsToDelete = allRelations.filter(x => x.ChildFlowItemId == id).map(x => x.FlowRelationId);\r\n\r\n // Deleting the FlowItem itself\r\n dispatch(_deleteThing(\"flowItems\", id));\r\n\r\n const merges = getFlowMergesArray(state);\r\n const offerMerges = getFlowOfferMergesArray(state);\r\n // Moving relations to 0\r\n for (const relativeId of relationIdsToUpdate) {\r\n // Moving the relation to 0, but check that that link doesn't already exist first\r\n\r\n const thisRelation = state.flowRelations.byId[relativeId];\r\n if (thisRelation == null) {\r\n continue;\r\n }\r\n\r\n const mergeEntryExists =\r\n merges.filter(\r\n x => x.FlowItemId == thisRelation.ChildFlowItemId && x.ParentFlowItemId == thisRelation.ParentFlowItemId\r\n ).length > 0;\r\n\r\n const offerMergeEntryExists =\r\n offerMerges.filter(\r\n x => x.FlowItemId == thisRelation.ChildFlowItemId && x.ParentFlowItemId == thisRelation.ParentFlowItemId\r\n ).length > 0;\r\n\r\n const linkToZeroAlreadyExists =\r\n allRelations.filter(x => x.ParentFlowItemId == 0 && x.ChildFlowItemId == thisRelation.ChildFlowItemId)\r\n .length > 0;\r\n\r\n if (mergeEntryExists || offerMergeEntryExists || linkToZeroAlreadyExists) {\r\n dispatch(deleteFlowRelation(relativeId));\r\n } else {\r\n dispatch(updateAttribute(\"flowRelations\", relativeId, \"ParentFlowItemId\", 0));\r\n }\r\n\r\n state = getState();\r\n allRelations = getFlowRelationsArray(state);\r\n }\r\n\r\n // Delete relations\r\n for (const relativeId of relationIdsToDelete) {\r\n dispatch(deleteFlowRelation(relativeId));\r\n }\r\n // Delete SubType (If this Item = filter, delete the filter. If item = split, delete the split.)\r\n const flowItemSubEntities = prefixesAndEntities.filter(x => x.flowItemType != \"\" && x.flowItemType != null); // Split, Filter, Merge, etc...\r\n for (const entityRow of flowItemSubEntities) {\r\n const { stateKey, id: idName, deleteAc } = entityRow;\r\n\r\n const theseThings: Array = Object.values(state[stateKey].byId);\r\n const theseIdsToDelete = theseThings\r\n .filter(x => x.FlowItemId == id || x.ChildFlowItemId == id || x.ParentFlowItemId == id)\r\n .map(x => x[idName]);\r\n\r\n for (const id of theseIdsToDelete) {\r\n dispatch(deleteAc(id));\r\n }\r\n }\r\n\r\n //delete flowItemClientVariables - #928\r\n if (thisFlowItem.FlowItemType == \"offerMerge\") {\r\n //get all the flow item variables\r\n const flowItemClientVariables = getFlowItemClientVariablesForSelectedFlow(state);\r\n\r\n const flowItemCVs: Array = Object.values(flowItemClientVariables);\r\n\r\n //variables are tied to the offer merge parent\r\n const allParentRelations = allRelations.filter(x => x.ChildFlowItemId == thisFlowItem.FlowItemId);\r\n\r\n // get only client variables that are offer codes\r\n const flowItemCVOfferCodes = [];\r\n\r\n const filterOfferCodes = getClientVariablesWithValuesForSelectedFlow(state).filter(\r\n x => x.VariableScope == \"OfferCode\" && x.IsVisible\r\n );\r\n\r\n flowItemCVs.forEach(fi => {\r\n filterOfferCodes.forEach(oc => {\r\n if (fi.VariableId == oc.Id) {\r\n flowItemCVOfferCodes.push(fi);\r\n }\r\n });\r\n });\r\n\r\n //delete paren client variables\r\n for (const parent of allParentRelations) {\r\n const flowItemClientVariablesToDelete = flowItemCVOfferCodes.filter(\r\n x => x.FlowItemId == parent.ParentFlowItemId\r\n );\r\n\r\n if (flowItemClientVariablesToDelete.length > 0) {\r\n for (const flowItemCV of flowItemClientVariablesToDelete) {\r\n dispatch({\r\n type: \"FLOW_ITEM_CLIENT_VARIABLE_DELETE\",\r\n id: flowItemCV.FlowItemClientVariableId,\r\n });\r\n }\r\n }\r\n }\r\n dispatch(updateFlowShouldValidate(state.selected.flow, false));\r\n }\r\n\r\n //code added for flow-export-distribution-platforms\r\n if (thisFlowItem.FlowItemType == \"export\") {\r\n const allDistributionPlatforms = getFlowExportDistributionPlatformsArray(state);\r\n const flowExportDistributionPlatforms = allDistributionPlatforms.filter(\r\n x => x.FlowItemId == thisFlowItem.FlowItemId\r\n );\r\n\r\n for (const distributionPlatform of flowExportDistributionPlatforms) {\r\n dispatch(deleteFlowExportDistributionPlatform(distributionPlatform.FlowExportDistributionPlatformId));\r\n }\r\n }\r\n\r\n dispatch(setHasUnsavedChanges());\r\n};\r\n\r\nexport const deleteFlowSplit = (id: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const thisFlowSplit: ?FlowSplit = state.flowSplits.byId[id];\r\n if (thisFlowSplit == null) {\r\n return;\r\n }\r\n\r\n // Find the Child FlowItem\r\n const childFlowItemId = thisFlowSplit.ChildFlowItemId;\r\n\r\n // Delete the FlowEmpty belonging to the Child FlowItem\r\n const flowEmptiesByFlowItemId = getFlowEmptiesByFlowItemId(state);\r\n const flowEmpty = flowEmptiesByFlowItemId[childFlowItemId];\r\n if (flowEmpty != null) {\r\n // Realign children according to the item to delete\r\n dispatch(realignChildren(thisFlowSplit.FlowItemId, childFlowItemId));\r\n\r\n dispatch(deleteFlowEmpty(flowEmpty.FlowEmptyId));\r\n }\r\n\r\n // Delete the Child FlowItem (type=empty)\r\n dispatch(deleteFlowItem(childFlowItemId));\r\n\r\n // Delete the split row\r\n dispatch(_deleteThing(\"flowSplits\", id));\r\n};\r\n\r\nexport const deleteFlowCase = (id: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const thisFlowCase: ?FlowCase = state.flowCases.byId[id];\r\n if (thisFlowCase == null) {\r\n return;\r\n }\r\n\r\n // Find the Child FlowItem\r\n const childFlowItemId = thisFlowCase.ChildFlowItemId;\r\n\r\n // Delete the FlowEmpty belonging to the Child FlowItem\r\n const flowEmptiesByFlowItemId = getFlowEmptiesByFlowItemId(state);\r\n const flowEmpty = flowEmptiesByFlowItemId[childFlowItemId];\r\n if (flowEmpty != null) {\r\n // Realign children according to the item to delete\r\n dispatch(realignChildren(thisFlowCase.FlowItemId, childFlowItemId));\r\n\r\n dispatch(deleteFlowEmpty(flowEmpty.FlowEmptyId));\r\n }\r\n\r\n // Delete the Child FlowItem (type=empty)\r\n dispatch(deleteFlowItem(childFlowItemId));\r\n\r\n // Delete the case row\r\n dispatch(_deleteThing(\"flowCases\", id));\r\n};\r\n\r\nexport const realignChildren =\r\n (flowItemId: number, childFlowItemId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const itemsById = state.flowItems.byId;\r\n const item: ?FlowItem = itemsById[flowItemId];\r\n let childItem: FlowItem = itemsById[childFlowItemId];\r\n\r\n if (item && childItem) {\r\n const position = {\r\n x: childItem.x,\r\n y: childItem.y,\r\n };\r\n\r\n if (item.FlowItemType == \"split\") {\r\n const flowSplitsByItemId = getFlowSplitsByFlowItemId(state);\r\n const splitEmpties = flowSplitsByItemId[flowItemId] || [];\r\n const startIndex = splitEmpties.findIndex(x => x.ChildFlowItemId == childFlowItemId) + 1;\r\n\r\n splitEmpties.slice(startIndex, splitEmpties.length).forEach(emptyItem => {\r\n const newPosition = { ...position };\r\n\r\n // Position for the next item\r\n childItem = itemsById[emptyItem.ChildFlowItemId];\r\n position.x = childItem.x;\r\n position.y = childItem.y;\r\n\r\n dispatch(\r\n updateMultipleAttribute(\"flowItems\", emptyItem.ChildFlowItemId, {\r\n x: newPosition.x,\r\n y: newPosition.y,\r\n })\r\n );\r\n });\r\n }\r\n\r\n if (item.FlowItemType == \"case\") {\r\n const flowCasesByItemId = getFlowCasesByFlowItemId(state);\r\n const caseEmpties = flowCasesByItemId[flowItemId] || [];\r\n const startIndex = caseEmpties.findIndex(x => x.ChildFlowItemId == childFlowItemId) + 1;\r\n\r\n caseEmpties.slice(startIndex, caseEmpties.length).forEach(emptyItem => {\r\n const newPosition = { ...position };\r\n\r\n // Position for the next item\r\n childItem = itemsById[emptyItem.ChildFlowItemId];\r\n position.x = childItem.x;\r\n position.y = childItem.y;\r\n\r\n dispatch(\r\n updateMultipleAttribute(\"flowItems\", emptyItem.ChildFlowItemId, {\r\n x: newPosition.x,\r\n y: newPosition.y,\r\n })\r\n );\r\n });\r\n }\r\n }\r\n };\r\n\r\nexport const deleteFlowReport = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowReports\", id));\r\n};\r\nexport const deleteFlowModel = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowModels\", id));\r\n};\r\nexport const deleteFlowExportReport = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowExportReports\", id));\r\n};\r\nexport const deleteFlowCannedReport = (id: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const selectedCannedReport = state.selected.flowCannedReport;\r\n if (id == selectedCannedReport) {\r\n dispatch(clearSelectedCannedReport());\r\n }\r\n dispatch(_deleteThing(\"flowCannedReports\", id));\r\n};\r\nexport const deleteFlowMerge = (id: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const merge = state.flowMerges.byId[id];\r\n if (!merge) {\r\n return;\r\n }\r\n const relations = getFlowRelationsArray(state);\r\n const relationIdsToDelete = merge\r\n ? relations\r\n .filter(x => x.ParentFlowItemId == merge.ParentFlowItemId && x.ChildFlowItemId == merge.FlowItemId)\r\n .map(x => x.FlowRelationId)\r\n : null;\r\n\r\n for (const relationId of relationIdsToDelete) {\r\n dispatch(_deleteThing(\"flowRelations\", relationId));\r\n }\r\n dispatch(_deleteThing(\"flowMerges\", id));\r\n};\r\nexport const deleteFlowOfferMerge =\r\n (id: number, deleteRelations: boolean = true) =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const merge = state.flowOfferMerges.byId[id];\r\n if (merge == null) {\r\n return;\r\n }\r\n\r\n if (deleteRelations) {\r\n const relations = getFlowRelationsArray(state);\r\n const relationIdsToDelete = relations\r\n .filter(x => x.ParentFlowItemId == merge.ParentFlowItemId && x.ChildFlowItemId == merge.FlowItemId)\r\n .map(x => x.FlowRelationId);\r\n\r\n for (const relationId of relationIdsToDelete) {\r\n dispatch(_deleteThing(\"flowRelations\", relationId));\r\n }\r\n }\r\n dispatch(_deleteThing(\"flowOfferMerges\", id));\r\n };\r\n\r\nexport const disableFlowReportTabs = (flowItemId: number) => (dispatch: Dispatch) => {\r\n dispatch(updateAttribute(\"flowItems\", flowItemId, \"HasResultTable\", false));\r\n dispatch(updateAttribute(\"flowItems\", flowItemId, \"FlowItemQty\", \"\"));\r\n};\r\n\r\nexport const deleteFlowFilter = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowFilters\", id));\r\n};\r\nexport const deleteFlowScript = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowScripts\", id));\r\n};\r\nexport const deleteFlowScriptDBUI = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowScriptsDBUI\", id));\r\n};\r\nexport const deleteFlowScriptResult = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowScriptResults\", id));\r\n};\r\nexport const deleteFlowDataLoad = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowDataLoads\", id));\r\n};\r\nexport const deleteFlowDataLoadColumn = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowDataLoadColumns\", id));\r\n};\r\nexport const deleteFlowMultiExport = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowMultiExports\", id));\r\n};\r\nexport const deleteFlowExport = (id: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const thisExport: FlowExport = state.flowExports.byId[id];\r\n const reports: Array = getFlowExportReportsArray(state).filter(\r\n x => x.ParentFlowItemId == thisExport.FlowItemId\r\n );\r\n\r\n dispatch(_deleteThing(\"flowExports\", id));\r\n reports.forEach(x => {\r\n dispatch(_deleteThing(\"flowExportReports\", x.FlowExportReportId));\r\n dispatch(deleteFlowItem(x.FlowItemId));\r\n });\r\n};\r\nexport const deleteFlowFromCloud = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowFromClouds\", id));\r\n};\r\nexport const deleteFlowToCloud = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(resetCloudFlowObjects());\r\n dispatch(_deleteThing(\"flowToClouds\", id));\r\n};\r\nexport const deleteFlowSingleView = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowSingleViews\", id));\r\n};\r\nexport const deleteFlowOutput = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowOutputs\", id));\r\n};\r\nexport const deleteFlowSVDedupe = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowSVDedupes\", id));\r\n};\r\nexport const deleteFlowRelation = (id: number) =>\r\n async (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const flow: ?Flow = state.flows.byId[state.selected.flow];\r\n if(state.session.enabledFeatures.includes(\"simple-flow\") && flow && flow.FlowBaseType != FlowBaseTypes.Default){\r\n // Open the modal and wait for the user's response\r\n const userConfirmed = await dispatch(openModal());\r\n // If the user did not confirm, exit the function\r\n if (!userConfirmed) {\r\n return;\r\n } \r\n }\r\n dispatch(updateAttribute(\"flows\", state.selected.flow, \"FlowBaseType\", 0));\r\n const relation: ?FlowRelation = state.flowRelations.byId[id];\r\n if (relation == null) {\r\n return;\r\n }\r\n dispatch(updateFlowShouldValidate(state.selected.flow, true));\r\n dispatch(_deleteThing(\"flowRelations\", id));\r\n\r\n // Invalidate Child Items\r\n dispatch(invalidateItemAndChildren(relation.ChildFlowItemId));\r\n\r\n // Check for corresponding merges or offermerges that should also be deleted.\r\n const stateOfNow = getState();\r\n const merges = getFlowMergesArray(stateOfNow);\r\n const mergesToDelete = merges\r\n .filter(x => x.FlowItemId == relation.ChildFlowItemId && x.ParentFlowItemId == relation.ParentFlowItemId)\r\n .map(x => x.FlowMergeId);\r\n for (const id of mergesToDelete) {\r\n dispatch(deleteFlowMerge(id));\r\n }\r\n\r\n const offers = getFlowOfferMergesArray(stateOfNow);\r\n const offersToDelete = offers\r\n .filter(x => x.FlowItemId == relation.ChildFlowItemId && x.ParentFlowItemId == relation.ParentFlowItemId)\r\n .map(x => x.FlowOfferMergeId);\r\n for (const id of offersToDelete) {\r\n dispatch(deleteFlowOfferMerge(id));\r\n }\r\n\r\n if (state.session.enabledFeatures.includes(\"flow-export-template-fields\")) {\r\n const exportTemplates = getFlowExportTemplateFieldsArray(state);\r\n const templatesToDelete = exportTemplates\r\n .filter(x => x.FlowItemId == relation.ChildFlowItemId && x.ParentFlowItemId == relation.ParentFlowItemId)\r\n .map(x => x.FlowExportTemplateId);\r\n for (const id of templatesToDelete) {\r\n dispatch(deleteFlowExportTemplateFields(id));\r\n }\r\n }\r\n\r\n const exportPinterestTemplates = getFlowExportPinterestTemplateFieldsArray(state);\r\n const pinterestTemplatesToDelete = exportPinterestTemplates\r\n .filter(x => x.FlowItemId == relation.ChildFlowItemId && x.ParentFlowItemId == relation.ParentFlowItemId)\r\n .map(x => x.FlowExportTemplateId);\r\n for (const id of pinterestTemplatesToDelete) {\r\n dispatch(deleteFlowExportPinterestTemplateFields(id));\r\n }\r\n\r\n const exportTikTokTemplates = getFlowExportTikTokTemplateFieldsArray(state);\r\n const tikTokTemplatesToDelete = exportTikTokTemplates\r\n .filter(x => x.FlowItemId == relation.ChildFlowItemId && x.ParentFlowItemId == relation.ParentFlowItemId)\r\n .map(x => x.FlowExportTemplateId);\r\n for (const id of tikTokTemplatesToDelete) {\r\n dispatch(deleteFlowExportTikTokTemplateFields(id));\r\n }\r\n\r\n const exportTradeDeskTemplates = getFlowExportTradeDeskTemplateFieldsArray(state);\r\n const tradeDeskTemplatesToDelete = exportTradeDeskTemplates\r\n .filter(x => x.FlowItemId == relation.ChildFlowItemId && x.ParentFlowItemId == relation.ParentFlowItemId)\r\n .map(x => x.FlowExportTemplateId);\r\n for (const id of tradeDeskTemplatesToDelete) {\r\n dispatch(deleteFlowExportTradeDeskTemplateFields(id));\r\n }\r\n\r\n const exportPubmaticTemplates = getFlowExportPubmaticTemplateFieldsArray(state);\r\n const pubmaticTemplatesToDelete = exportPubmaticTemplates\r\n .filter(x => x.FlowItemId == relation.ChildFlowItemId && x.ParentFlowItemId == relation.ParentFlowItemId)\r\n .map(x => x.FlowExportTemplateId);\r\n for (const id of pubmaticTemplatesToDelete) {\r\n dispatch(deleteFlowExportPubmaticTemplateFields(id));\r\n }\r\n\r\n const exportTaxonomyTemplates = getFlowExportTaxonomyFileFieldsArray(state);\r\n const taxonomyToDelete = exportTaxonomyTemplates\r\n .filter(x => x.FlowItemId == relation.ChildFlowItemId && x.ParentFlowItemId == relation.ParentFlowItemId)\r\n .map(x => x.FlowExportTaxonomyFileFieldId);\r\n for (const id of taxonomyToDelete) {\r\n dispatch(deleteFlowExportTaxonomyFileFields(id));\r\n }\r\n\r\n const freewheelDriverFileFields = getFlowExportFreewheelDriverFileFieldsArray(state);\r\n const freewheelDriverFileFieldsToDelete = freewheelDriverFileFields\r\n .filter(x => x.FlowItemId == relation.ChildFlowItemId && x.ParentFlowItemId == relation.ParentFlowItemId)\r\n .map(x => x.FlowExportFreewheelDriverFileFieldId);\r\n for (const id of freewheelDriverFileFieldsToDelete) {\r\n dispatch(deleteFlowExportFreewheelDriverFileFields(id));\r\n }\r\n\r\n const xandrDriverFields = getFlowExportXandrDriverFieldsArray(state);\r\n const xandrDriverFieldsToDelete = xandrDriverFields\r\n .filter(x => x.FlowItemId == relation.ChildFlowItemId && x.ParentFlowItemId == relation.ParentFlowItemId)\r\n .map(x => x.XandrDriverFieldId);\r\n for (const id of xandrDriverFieldsToDelete) {\r\n dispatch(deleteFlowExportXandrDriverFields(id));\r\n }\r\n\r\n //begin flow-export-pivot-labels\r\n // Check for flow relation parent labels that need to be deleted\r\n const parentLabelsArray = getFlowRelationsParentLabelsArray(state);\r\n const relationParentLabels = parentLabelsArray.filter(x => x.FlowRelationId == id);\r\n for (const parentLabel of relationParentLabels) {\r\n dispatch(deleteFlowRelationParentLabel(parentLabel.FlowRelationParentLabelId));\r\n }\r\n //check if child item was an export report and delete - #2616\r\n const childFlowItem = state.flowItems.byId[relation.ChildFlowItemId];\r\n if (childFlowItem && childFlowItem.FlowItemType == \"exportreport\") {\r\n dispatch(deleteFlowItem(childFlowItem.FlowItemId));\r\n }\r\n //end flow-export-pivot-labels\r\n dispatch(updateFlowShouldValidate(state.selected.flow, false));\r\n};\r\nexport const deleteFlowEmpty = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowEmpties\", id));\r\n};\r\nexport const deleteFlowClientVariable = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowClientVariables\", id));\r\n};\r\nexport const deleteFlowItemClientVariable = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowItemClientVariables\", id));\r\n};\r\nexport const deleteFlowItemEndpoint = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowItemEndpoints\", id));\r\n};\r\nexport const deleteFlowItemOfferCode = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowItemOfferCodes\", id));\r\n};\r\nexport const deleteFlow = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flows\", id));\r\n};\r\n\r\nexport const deleteFlowOffload = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowOffloads\", id));\r\n};\r\n\r\nexport const deleteFlowOffloadColumn = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowOffloadColumns\", id));\r\n};\r\n\r\nexport const deleteFlowExportTemplateFields = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowExportTemplateFields\", id));\r\n};\r\n\r\nexport const deleteFlowExportPinterestTemplateFields = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowExportPinterestTemplateFields\", id));\r\n};\r\n\r\nexport const deleteFlowExportTikTokTemplateFields = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowExportTikTokTemplateFields\", id));\r\n};\r\n\r\nexport const deleteFlowExportTradeDeskTemplateFields = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowExportTradeDeskTemplateFields\", id));\r\n};\r\n\r\nexport const deleteFlowExportPubmaticTemplateFields = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowExportPubmaticTemplateFields\", id));\r\n};\r\n\r\nexport const deleteFlowExportTaxonomyFileFields = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowExportTaxonomyFileFields\", id));\r\n};\r\n\r\nexport const deleteFlowExportFreewheelDriverFileFields = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowExportFreewheelDriverFileFields\", id));\r\n};\r\n\r\nexport const deleteFlowSegmentSplit = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowSegmentSplits\", id));\r\n};\r\n\r\nexport const deleteFlowSegmentSplitOffer = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowSegmentSplitOffers\", id));\r\n};\r\n\r\nexport const deleteFlowExternalService = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowExternalServices\", id));\r\n};\r\n\r\nexport const deleteFlowExternalServiceParameter = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowExternalServiceParameters\", id));\r\n};\r\n\r\nexport const deleteFlowExternalServiceInput = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowExternalServiceInputs\", id));\r\n};\r\n\r\nexport const deleteFlowExternalServiceHardcode = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowExternalServiceHardcodes\", id));\r\n};\r\n\r\nexport const deleteFlowExpression = (id: number) => (dispatch: Dispatch) =>\r\n dispatch(_deleteThing(\"flowExpressions\", id));\r\nexport const deleteFlowExpressionConstraint = (id: number) => (dispatch: Dispatch) =>\r\n dispatch(_deleteThing(\"flowExpressionConstraints\", id));\r\n\r\nexport const deleteFlowDescription = (id: number) => (dispatch: Dispatch) =>\r\n dispatch(_deleteThing(\"flowDescriptions\", id));\r\n\r\nexport const clearFlowOffloadColumnsForFlowItem = (id: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const offloadColumns = getFlowOffloadColumnsByFlowItemId(state);\r\n const columnsToDelete = offloadColumns[id];\r\n if (!columnsToDelete) {\r\n return;\r\n }\r\n for (const column of columnsToDelete) {\r\n dispatch(deleteFlowOffloadColumn(column.FlowOffloadColumnId));\r\n }\r\n};\r\n\r\n// Helper to delete relations without knowing the ID of the relation to delete\r\nexport const deleteFlowRelationBetween =\r\n (parentId: number, childId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n let state = getState();\r\n let flowRelations = getFlowRelationsForSelectedFlow(state);\r\n dispatch(updateFlowShouldValidate(state.selected.flow, true));\r\n\r\n const relationIdsToDelete = flowRelations\r\n .filter(x => x.ParentFlowItemId == parentId && x.ChildFlowItemId == childId)\r\n .map(x => x.FlowRelationId);\r\n\r\n // We'll actually only delete 1 at most.\r\n // This is because SRD sometimes deletes duplicate relations and wants to keep the other.\r\n if (relationIdsToDelete.length > 0) {\r\n const id = relationIdsToDelete[0];\r\n dispatch(deleteFlowRelation(id));\r\n }\r\n\r\n // After we have deleted the relation, add a new relation from the child to Zero if the child has no relations.\r\n dispatch(add0AsParentIfNoParents(childId));\r\n dispatch(updateFlowShouldValidate(state.selected.flow, false));\r\n };\r\n\r\nexport const add0AsParentIfNoParents = (flowItemId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const flowRelations = getFlowRelationsForSelectedFlow(state);\r\n const existingCount = flowRelations.filter(x => x.ChildFlowItemId == flowItemId).length;\r\n if (existingCount == 0) {\r\n dispatch(newFlowRelation(0, flowItemId));\r\n }\r\n};\r\n////////////////// END DELETE SECTION //////////////////////\r\n\r\n///////////////// BEGIN OVERWRITE=OFF SECTION //////////////////////////\r\nconst _copyThingToNewId =\r\n (entityPluralName: EntityPluralName, oldId: number, newId: number) => (dispatch: Dispatch) => {\r\n const prefix = _entityPluralNameToPrefix(entityPluralName);\r\n dispatch({\r\n type: `${prefix}_COPY_TO_NEW_ID`,\r\n oldId,\r\n newId,\r\n });\r\n };\r\n\r\nexport const removeErrorOnFlowItem = (flowItemId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const itemsById = state.flowItems.byId;\r\n\r\n const item: ?FlowItem = itemsById[flowItemId];\r\n if (item != null) {\r\n dispatch(\r\n updateMultipleAttribute(\"flowItems\", flowItemId, {\r\n IsError: false,\r\n IsCancelled: false,\r\n })\r\n );\r\n\r\n // Case and Split need to clear error on child Empties\r\n if (item.FlowItemType == \"split\") {\r\n const flowSplitsByItemId = getFlowSplitsByFlowItemId(state);\r\n const splitEmpties = flowSplitsByItemId[flowItemId] || [];\r\n splitEmpties.forEach(x => {\r\n dispatch(\r\n updateMultipleAttribute(\"flowItems\", x.ChildFlowItemId, {\r\n IsError: false,\r\n IsCancelled: false,\r\n })\r\n );\r\n });\r\n }\r\n if (item.FlowItemType == \"case\") {\r\n const flowCasesByItemId = getFlowCasesByFlowItemId(state);\r\n const caseEmpties = flowCasesByItemId[flowItemId] || [];\r\n caseEmpties.forEach(x => {\r\n dispatch(\r\n updateMultipleAttribute(\"flowItems\", x.ChildFlowItemId, {\r\n IsError: false,\r\n IsCancelled: false,\r\n })\r\n );\r\n });\r\n }\r\n }\r\n};\r\n\r\nexport const flowCritriaChanged = (flowItemId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const parent: ?FlowItem = state.flowItems.byId[flowItemId];\r\n const exportTradeDeskTemplates = getFlowExportTradeDeskTemplateFieldsArray(state);\r\n const exportTradeDeskTemplateINeed = exportTradeDeskTemplates.filter(x => x.ParentFlowItemId == flowItemId);\r\n const hasFieldRatePricing = state.session.enabledFeatures.includes(\"display-field-rates\");\r\n const flowExportsByFlowItemId = getFlowExportsByFlowItemId(state);\r\n const flowExportsArray = Object.values(flowExportsByFlowItemId);\r\n\r\n if (exportTradeDeskTemplateINeed) {\r\n for (let i = 0; i < exportTradeDeskTemplateINeed.length; i++) {\r\n const idToUpdate = exportTradeDeskTemplateINeed[i].FlowExportTemplateId;\r\n const childId = exportTradeDeskTemplateINeed[i].FlowItemId;\r\n const parentId = flowItemId;\r\n const FlowExport = flowExportsArray.find(x => x.FlowItemId == childId);\r\n const tapadDeliveryTypeId = FlowExport.DeliveryTypeId;\r\n const tapadDeliveryTypes = state.vars.tapadDeliveryTypes;\r\n const thisDeliveryType = tapadDeliveryTypes.find(x => x.TapadDeliveryTypeId == tapadDeliveryTypeId);\r\n if (thisDeliveryType && DeliveryType.ThirdPartyCustom == thisDeliveryType.DeliveryType) {\r\n let newCPM = newCPMandPOM(state, parent, childId, parentId, hasFieldRatePricing, 1, true);\r\n let newPOM = newCPMandPOM(state, parent, childId, parentId, hasFieldRatePricing, 2, true);\r\n dispatch(updateAttribute(\"flowExportTradeDeskTemplateFields\", idToUpdate, \"CostPerMillion\", newCPM));\r\n dispatch(\r\n updateAttribute(\"flowExportTradeDeskTemplateFields\", idToUpdate, \"PercentOfMediaCost\", newPOM)\r\n );\r\n }\r\n }\r\n }\r\n};\r\n\r\n\r\n// Set an item's HasQATable, HasResultTable to false, and FlowItemQty to null.\r\n// Also does the same to its children (recursively).\r\n// This is done when changing the item such that its results are no longer valid.\r\n// Need to call this manually when making relevant changes - attaching this to updateAttribute wouldn't make sense.\r\nexport const invalidateItemAndChildren = (flowItemId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const childrenIndex = getFlowItemChildrenIndex(state);\r\n const itemsById = state.flowItems.byId;\r\n const flowSingleViewsByFlowItemId = getFlowSingleViewsByFlowItemId(state);\r\n const flowRelations = getFlowRelationsForAllFlows(state);\r\n const allFlowModels = getFlowModelsArray(state);\r\n\r\n const flowItem = itemsById[flowItemId];\r\n if (flowItemId > 0 && flowItem) {\r\n dispatch(updateAttribute(\"flowItems\", flowItemId, \"IsError\", false));\r\n }\r\n\r\n const invalidate = (flowItemId, visitedNodes = []) => {\r\n if (visitedNodes.includes(flowItemId)) {\r\n return visitedNodes;\r\n }\r\n\r\n visitedNodes.push(flowItemId);\r\n // Return early if item is already invalidated\r\n const item: ?FlowItem = itemsById[flowItemId];\r\n if (item == null) {\r\n return visitedNodes;\r\n }\r\n if (item.FlowItemType.toLowerCase() == \"singleview\") {\r\n const existingSingleView = flowSingleViewsByFlowItemId[item.FlowItemId];\r\n if (existingSingleView != null) {\r\n existingSingleView.forEach(x => {\r\n dispatch(updateAttribute(\"flowSingleViews\", x.FlowSingleViewId, \"FlowSingleViewQuantity\", 0));\r\n dispatch(updateAttribute(\"flowSingleViews\", x.FlowSingleViewId, \"IndividualQuantity\", 0));\r\n dispatch(updateAttribute(\"flowSingleViews\", x.FlowSingleViewId, \"HouseholdQuantity\", 0));\r\n dispatch(updateAttribute(\"flowSingleViews\", x.FlowSingleViewId, \"Counted\", false));\r\n });\r\n }\r\n }\r\n\r\n if (item.FlowItemType.toLowerCase() == \"model\") {\r\n const fm = allFlowModels.find(x => x.FlowItemId == item.FlowItemId);\r\n const parentFlowItemIds = getExistingRelations(flowRelations, null, item.FlowItemId).map(\r\n x => x.ParentFlowItemId\r\n );\r\n if (parentFlowItemIds.length == 2 && fm) {\r\n if (!parentFlowItemIds.includes(fm.TargetFlowItemId)) {\r\n dispatch(updateAttribute(\"flowModels\", fm.FlowModelId, \"TargetFlowItemId\", null));\r\n }\r\n if (!parentFlowItemIds.includes(fm.BaseFlowItemId)) {\r\n dispatch(updateAttribute(\"flowModels\", fm.FlowModelId, \"BaseFlowItemId\", null));\r\n }\r\n }\r\n }\r\n\r\n const itemIsAlreadyInvalid =\r\n !item.HasQATable && !item.HasResultTable && item.FlowItemQty == null && !item.IsCancelled;\r\n if (itemIsAlreadyInvalid) {\r\n return visitedNodes;\r\n }\r\n\r\n // Invalidate the item\r\n dispatch(\r\n updateMultipleAttribute(\"flowItems\", flowItemId, {\r\n HasQATable: false,\r\n HasResultTable: false,\r\n FlowItemQty: null,\r\n IsCancelled: false,\r\n CustomText: null,\r\n AudienceID: null,\r\n })\r\n );\r\n\r\n // Invalidate all my children recursively\r\n const childrenIds = childrenIndex[flowItemId] || [];\r\n for (const childId of childrenIds) {\r\n visitedNodes = invalidate(childId, visitedNodes);\r\n }\r\n return visitedNodes;\r\n };\r\n invalidate(flowItemId);\r\n};\r\n\r\n// Set the \"hasUnsavedChanges\" flag for the currently selected flow to a value.\r\n// Note that, a lot of times, we assume that actions are being fired off for the currently selected flow,\r\n// which may not be right. For example, if I run updateAttribute on any random flowItem, it\r\n// sets unsaved changes on the currently selected flow, even if that item doesn't belong to that flow.\r\nexport const setHasUnsavedChanges =\r\n (newHasUnsavedChanges: boolean = true) =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const flowId: number = state.selected.flow;\r\n const flow: ?Flow = state.flows.byId[flowId];\r\n if (flow != null && flow.hasUnsavedChanges != newHasUnsavedChanges) {\r\n dispatch(updateAttribute(\"flows\", flowId, \"hasUnsavedChanges\", newHasUnsavedChanges));\r\n }\r\n };\r\n\r\nexport const pasteFlowItems =\r\n (\r\n flowItemIds: Array,\r\n relationIds: Array,\r\n offsetX: number,\r\n offsetY: number,\r\n selectedNodeLinks: Array\r\n ) =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n updatedNodeIDs = [\r\n {\r\n oldId: 0,\r\n newId: 0,\r\n },\r\n ];\r\n const state = getState();\r\n let newSelectedNodeLinks = selectedNodeLinks;\r\n for (const flowItemId of flowItemIds) {\r\n const flowItem = state.flowItems.byId[flowItemId];\r\n if (flowItem == null || !FlowConstants.allowsCopy.includes(flowItem.FlowItemType)) {\r\n continue;\r\n }\r\n let newFlowItemIDForCopiedItem = dispatch(\r\n duplicateFlowItem(\r\n flowItemId,\r\n flowItem.x + offsetX,\r\n flowItem.y + offsetY,\r\n flowItemIds,\r\n selectedNodeLinks,\r\n true\r\n )\r\n );\r\n updatedNodeIDs.push({\r\n oldId: flowItemId,\r\n newId: newFlowItemIDForCopiedItem,\r\n });\r\n }\r\n // here we want to make a new array of the selectedNodeLinks where the old ids are replaced with the new ids\r\n for (const idToUpdate of updatedNodeIDs) {\r\n const selectedNodeLinksWithNewIDs = newSelectedNodeLinks.map(links => {\r\n if (links.ParentFlowItemId == idToUpdate.oldId) {\r\n return {\r\n ...links,\r\n ParentFlowItemId: idToUpdate.newId,\r\n };\r\n } else if (links.ChildFlowItemId == idToUpdate.oldId) {\r\n return {\r\n ...links,\r\n ChildFlowItemId: idToUpdate.newId,\r\n };\r\n } else {\r\n return links;\r\n }\r\n });\r\n newSelectedNodeLinks = selectedNodeLinksWithNewIDs;\r\n }\r\n let state2 = getState();\r\n const flowItemTypeLookup2 = getFlowItemTypeLookupForSelectedFlow(state2);\r\n newSelectedNodeLinks.forEach(x => {\r\n if (flowItemTypeLookup2[x.ChildFlowItemId] != \"empty\") {\r\n // look to seeif there is an existing flow relation with a zero for a parent and a matching child ID\r\n // if so then update it\r\n // if not then create one.\r\n let state3 = getState();\r\n const flowRelations = getFlowRelationsForAllFlows(state3);\r\n\r\n const possibleZeroRelationDup = flowRelations.filter(\r\n rel => rel.ParentFlowItemId == 0 && rel.ChildFlowItemId == x.ChildFlowItemId\r\n );\r\n if (possibleZeroRelationDup.length > 0) {\r\n // update the relation\r\n dispatch(\r\n updateAttribute(\r\n \"flowRelations\",\r\n possibleZeroRelationDup[0].FlowRelationId,\r\n \"ParentFlowItemId\",\r\n x.ParentFlowItemId\r\n )\r\n );\r\n } else {\r\n // create one\r\n dispatch(newFlowRelation(x.ParentFlowItemId, x.ChildFlowItemId));\r\n }\r\n }\r\n });\r\n // Now iterate through each Pasted flow Item and copy the insides\r\n for (const flowItemId of flowItemIds) {\r\n let stateNow = getState();\r\n let currentFlowItemType = flowItemTypeLookup2[flowItemId];\r\n const merges = getFlowMergesByFlowItemId(state);\r\n const mergeArray = merges[flowItemId];\r\n const flowOfferMerges = getFlowOfferMergesByFlowItemId(stateNow);\r\n const flowOfferMerge = flowOfferMerges[flowItemId];\r\n const flowModelsByFlowItemId = getFlowModelsByFlowItemId(state);\r\n const exportTradeDeskTemplates = getFlowExportTradeDeskTemplateFieldsByFlowItemId(stateNow);\r\n const exportTradeDeskTemplateForFlowItem = exportTradeDeskTemplates[flowItemId];\r\n const exportPubmaticTemplates = getFlowExportPubmaticTemplateFieldsByFlowItemId(stateNow);\r\n const exportPubmaticTemplateForFlowItem = exportPubmaticTemplates[flowItemId];\r\n const segmentSplitsByItemId = getFlowSegmentSplitsByFlowItemId(stateNow);\r\n const freeWheelDriverFieldsByFlowItemId = getFlowExportFreewheelDriverFileFieldsByFlowItemId(state);\r\n const freewheelDriverFileFields = freeWheelDriverFieldsByFlowItemId[flowItemId];\r\n const exportTikTokTemplatesbyId = getFlowExportTikTokTemplateFieldsByFlowItemId(state);\r\n const exportTikTokTemplates = exportTikTokTemplatesbyId[flowItemId];\r\n const xandrDriverFieldsbyId = getFlowExportXandrDriverFieldsByFlowItemId(stateNow);\r\n const xandrDriverFields = xandrDriverFieldsbyId[flowItemId];\r\n const exportPinterestTemplatesByFlowItemId = getFlowExportPinterestTemplateFieldsByFlowItemId(stateNow);\r\n const exportPinterestTemplates = exportPinterestTemplatesByFlowItemId[flowItemId];\r\n const flowItemCVs = getFlowItemClientVariablesArray(state);\r\n const exportTemplates = getFlowExportTemplateFieldsByFlowItemId(stateNow);\r\n const flowSVDedupesByFlowItemId = getFlowSVDedupesByFlowItemId(stateNow);\r\n const flowSVDedupes = flowSVDedupesByFlowItemId[flowItemId];\r\n const flowSegmentSplitOffers = getFlowSegmentSplitOffersByFlowItemId(state);\r\n const flowSegmentSplitOffersArray = flowSegmentSplitOffers[flowItemId];\r\n\r\n // I need a switch with a case for currentFlowItemType\r\n\r\n switch (currentFlowItemType) {\r\n case \"merge\":\r\n for (let i = 0; i < mergeArray.length; i++) {\r\n const merge = mergeArray[i];\r\n const newFlowMergeItemID = updatedNodeIDs.filter(upid => upid.oldId == merge.FlowItemId);\r\n const newFlowMergeParentItemID = updatedNodeIDs.filter(\r\n upid => upid.oldId == merge.ParentFlowItemId\r\n );\r\n\r\n const thing: FlowMerge = {\r\n FlowMergeId: 0,\r\n FlowItemId: newFlowMergeItemID[0].newId,\r\n ParentFlowItemId: newFlowMergeParentItemID[0].newId,\r\n FlowMergeIsSuppresion: merge.FlowMergeIsSuppresion,\r\n DupesQty: merge.DupesQty,\r\n UniquesQty: merge.UniquesQty,\r\n FlowMergeIsInnerJoin: merge.FlowMergeIsInnerJoin,\r\n WillTrackDuplicates: merge.WillTrackDuplicates,\r\n };\r\n dispatch(addThing(\"flowMerges\", thing));\r\n }\r\n break;\r\n\r\n // add a model if one does not exist.\r\n case \"model\":\r\n {\r\n // for (let i = 0; i < flowModelArray.length; i++) {\r\n const model = flowModelsByFlowItemId[flowItemId];\r\n const newModelItemID = updatedNodeIDs.filter(upid => upid.oldId == model.FlowItemId);\r\n const newTargetItemID = updatedNodeIDs.filter(upid => upid.oldId == model.TargetFlowItemId);\r\n const newBaseItemID = updatedNodeIDs.filter(upid => upid.oldId == model.BaseFlowItemId);\r\n const thing: FlowModel = {\r\n FlowModelId: 0,\r\n FlowItemId: newModelItemID[0].newId,\r\n DesiredHHQuantity: model.DesiredHHQuantity,\r\n ModelFilename: model.ModelFilename,\r\n TargetFlowItemId: newTargetItemID[0].newId,\r\n BaseFlowItemId: newBaseItemID[0].newId,\r\n BaseFilename: model.BaseFilename,\r\n DestinationCompanyId: model.DestinationCompanyId,\r\n ModelStatus: model.ModelStatus,\r\n BaseLuidQty: model.BaseLuidQty,\r\n TargetLuidQty: model.TargetLuidQty,\r\n Bundle: model.Bundle,\r\n };\r\n dispatch(addThing(\"flowModels\", thing));\r\n // }\r\n }\r\n break;\r\n\r\n case \"export\":\r\n {\r\n if (flowOfferMerge) {\r\n for (let i = 0; i < flowOfferMerge.length; i++) {\r\n const flowOfferMergeTemplate = flowOfferMerge[i];\r\n const newTemplateID = updatedNodeIDs.filter(\r\n upid => upid.oldId == flowOfferMergeTemplate.FlowItemId\r\n );\r\n const newTemplateParentItemID = updatedNodeIDs.filter(\r\n upid => upid.oldId == flowOfferMergeTemplate.ParentFlowItemId\r\n ); // if none exists then add it.\r\n // if so then updateit\r\n if (newTemplateID.length > 0 && newTemplateParentItemID.length > 0) {\r\n const thing: FlowOfferMerge = {\r\n FlowOfferMergeId: 0,\r\n FlowItemId: newTemplateID[0].newId,\r\n ParentFlowItemId: newTemplateParentItemID[0].newId,\r\n FlowOfferMergeIsSuppresion: flowOfferMergeTemplate.FlowOfferMergeIsSuppresion,\r\n DupesQty: flowOfferMergeTemplate.DupesQty,\r\n UniquesQty: flowOfferMergeTemplate.UniquesQty,\r\n FlowOfferPriority: flowOfferMergeTemplate.FlowOfferPriority,\r\n MaxQty: flowOfferMergeTemplate.MaxQty,\r\n OutputQty: flowOfferMergeTemplate.OutputQty,\r\n FinalQty: flowOfferMergeTemplate.FinalQty,\r\n Deploy: true,\r\n };\r\n dispatch(addThing(\"flowOfferMerges\", thing));\r\n }\r\n }\r\n }\r\n\r\n if (exportTradeDeskTemplateForFlowItem) {\r\n for (let i = 0; i < exportTradeDeskTemplateForFlowItem.length; i++) {\r\n const exportTradeDeskTemplate = exportTradeDeskTemplateForFlowItem[i];\r\n const newTemplateID = updatedNodeIDs.filter(\r\n upid => upid.oldId == exportTradeDeskTemplate.FlowItemId\r\n );\r\n const newTemplateParentItemID = updatedNodeIDs.filter(\r\n upid => upid.oldId == exportTradeDeskTemplate.ParentFlowItemId\r\n ); // if none exists then add it.\r\n // if so then updateit\r\n if (newTemplateID.length > 0 && newTemplateParentItemID.length > 0) {\r\n const thing: FlowExportTradeDeskTemplateFields = {\r\n AudienceName: exportTradeDeskTemplate.AudienceName,\r\n FlowExportTemplateId: 0,\r\n FlowItemId: newTemplateID[0].newId,\r\n ParentFlowItemId: newTemplateParentItemID[0].newId,\r\n Description: exportTradeDeskTemplate.Description,\r\n ExpansionType: exportTradeDeskTemplate.ExpansionType,\r\n RateType: exportTradeDeskTemplate.RateType,\r\n CostPerMillion: exportTradeDeskTemplate.CostPerMillion,\r\n PercentOfMediaCost: exportTradeDeskTemplate.PercentOfMediaCost,\r\n TTL: exportTradeDeskTemplate.TTL,\r\n ParentElementId: exportTradeDeskTemplate.ParentElementId,\r\n ParentElementName: exportTradeDeskTemplate.ParentElementName,\r\n ExpirationDate: exportTradeDeskTemplate.ExpirationDate,\r\n IsAutoGeneratedCPM: exportTradeDeskTemplate.IsAutoGeneratedCPM,\r\n IsAutoGeneratedPOM: exportTradeDeskTemplate.IsAutoGeneratedPOM,\r\n };\r\n dispatch(addThing(\"flowExportTradeDeskTemplateFields\", thing));\r\n }\r\n }\r\n }\r\n\r\n if (exportPubmaticTemplateForFlowItem) {\r\n for (let i = 0; i < exportPubmaticTemplateForFlowItem.length; i++) {\r\n const exportPubmaticTemplate = exportPubmaticTemplateForFlowItem[i];\r\n const newTemplateID = updatedNodeIDs.filter(\r\n upid => upid.oldId == exportPubmaticTemplate.FlowItemId\r\n );\r\n const newTemplateParentItemID = updatedNodeIDs.filter(\r\n upid => upid.oldId == exportPubmaticTemplate.ParentFlowItemId\r\n ); // if none exists then add it.\r\n // if so then updateit\r\n if (newTemplateID.length > 0 && newTemplateParentItemID.length > 0) {\r\n const thing: FlowExportPubmaticTemplateFields = {\r\n AudienceName: exportPubmaticTemplate.AudienceName,\r\n FlowExportTemplateId: 0,\r\n FlowItemId: newTemplateID[0].newId,\r\n ParentFlowItemId: newTemplateParentItemID[0].newId,\r\n Description: exportPubmaticTemplate.Description,\r\n ExpansionType: exportPubmaticTemplate.ExpansionType,\r\n RateType: exportPubmaticTemplate.RateType,\r\n CostPerMillion: exportPubmaticTemplate.CostPerMillion,\r\n PercentOfMediaCost: 0,\r\n TTL: exportPubmaticTemplate.TTL,\r\n ParentElementId: exportPubmaticTemplate.ParentElementId,\r\n ParentElementName: exportPubmaticTemplate.ParentElementName,\r\n ExpirationDate: exportPubmaticTemplate.ExpirationDate,\r\n IsAutoGeneratedCPM: exportPubmaticTemplate.IsAutoGeneratedCPM,\r\n IsAutoGeneratedPOM: exportPubmaticTemplate.IsAutoGeneratedPOM,\r\n };\r\n dispatch(addThing(\"flowExportPubmaticTemplateFields\", thing));\r\n }\r\n }\r\n }\r\n\r\n // flowSVDedupes\r\n if (flowSVDedupes) {\r\n // for (let i = 0; i < flowSVDedupes.length; i++) {\r\n const flowSVDedupe = flowSVDedupes;\r\n const newTemplateID = updatedNodeIDs.filter(upid => upid.oldId == flowSVDedupe.FlowItemId);\r\n if (newTemplateID.length > 0) {\r\n const thing: FlowSVDedupeD = {\r\n FlowSVDedupeId: 0,\r\n FlowItemId: newTemplateID[0].newId,\r\n SVField: flowSVDedupe.SVField,\r\n SortByFields: flowSVDedupe.SortByFields,\r\n };\r\n dispatch(addThing(\"flowSVDedupes\", thing));\r\n }\r\n }\r\n\r\n // copy the segmentsplits\r\n const splitsINeed = segmentSplitsByItemId[flowItemId];\r\n if (splitsINeed) {\r\n for (let i = 0; i < splitsINeed.length; i++) {\r\n const segmentSplit = splitsINeed[i];\r\n const newTemplateID = updatedNodeIDs.filter(\r\n upid => upid.oldId == segmentSplit.FlowItemId\r\n );\r\n const newTemplateParentItemID = updatedNodeIDs.filter(\r\n upid => upid.oldId == segmentSplit.ParentFlowItemId\r\n ); // if none exists then add it.\r\n if (newTemplateID.length > 0 && newTemplateParentItemID.length > 0) {\r\n const thing: FlowSegmentSplit = {\r\n SegmentSplitId: 0,\r\n SegmentName: segmentSplit.SegmentName,\r\n FlowItemId: newTemplateID[0].newId,\r\n ParentFlowItemId: newTemplateParentItemID[0].newId,\r\n AbsoluteOrRelative: segmentSplit.AbsoluteOrRelative,\r\n AbsoluteNumRows: segmentSplit.AbsoluteNumRows,\r\n RelativePercentRows: segmentSplit.RelativePercentRows,\r\n SplitQuantity: segmentSplit.SplitQuantity,\r\n IsIncludeInDeploy: segmentSplit.IsIncludeInDeploy,\r\n };\r\n\r\n dispatch(addThing(\"flowSegmentSplits\", thing));\r\n // lookup the flowSegmentSplitOffers that have the segmentSplit.SegmentSplitId and the flowItemID\r\n // add a record with the new thing.SegmentSplitId copied over with the newTemplateId[0].newId\r\n if (flowSegmentSplitOffersArray) {\r\n const flowSegmentSplitOffersINeed = flowSegmentSplitOffersArray.filter(\r\n x => x.SegmentSplitId == segmentSplit.SegmentSplitId\r\n );\r\n if (flowSegmentSplitOffersINeed) {\r\n for (let i = 0; i < flowSegmentSplitOffersINeed.length; i++) {\r\n const flowSegmentSplitOffer = flowSegmentSplitOffersINeed[i];\r\n const newTemplateID = updatedNodeIDs.filter(\r\n upid => upid.oldId == flowSegmentSplitOffer.FlowItemId\r\n );\r\n const offer: FlowSegmentSplitOffer = {\r\n SegmentSplitOfferId: 0,\r\n SegmentSplitId: thing.SegmentSplitId,\r\n DestinationOfferId: flowSegmentSplitOffer.DestinationOfferId,\r\n Value: flowSegmentSplitOffer.Value,\r\n FlowItemId: newTemplateID[0].newId,\r\n };\r\n dispatch(addThing(\"flowSegmentSplitOffers\", offer));\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (freewheelDriverFileFields) {\r\n for (let i = 0; i < freewheelDriverFileFields.length; i++) {\r\n const freewheelSplit = freewheelDriverFileFields[i];\r\n const newTemplateID = updatedNodeIDs.filter(\r\n upid => upid.oldId == freewheelSplit.FlowItemId\r\n );\r\n const newTemplateParentItemID = updatedNodeIDs.filter(\r\n upid => upid.oldId == freewheelSplit.ParentFlowItemId\r\n ); // if none exists then add it.\r\n if (newTemplateID.length > 0) {\r\n const thing: FlowExportFreewheelDriverFileFields = {\r\n FlowExportFreewheelDriverFileFieldId: 0,\r\n FlowItemId: newTemplateID[0].newId,\r\n ParentFlowItemId: newTemplateParentItemID[0].newId,\r\n IdTypes: freewheelSplit.IdTypes,\r\n SegmentName: freewheelSplit.SegmentName,\r\n NetworkId: freewheelSplit.NetworkId,\r\n CategoryName: freewheelSplit.CategoryName,\r\n SegmentDescription: freewheelSplit.SegmentDescription,\r\n SubGroupDescription: freewheelSplit.SubGroupDescription,\r\n Custom: freewheelSplit.Custom,\r\n Price: freewheelSplit.Price,\r\n CompanyName: freewheelSplit.CompanyName,\r\n };\r\n\r\n dispatch(addThing(\"flowExportFreewheelDriverFileFields\", thing));\r\n }\r\n }\r\n }\r\n\r\n if (exportTikTokTemplates) {\r\n for (let i = 0; i < exportTikTokTemplates.length; i++) {\r\n const tikTokSplit = exportTikTokTemplates[i];\r\n const newTemplateID = updatedNodeIDs.filter(\r\n upid => upid.oldId == tikTokSplit.FlowItemId\r\n );\r\n const newTemplateParentItemID = updatedNodeIDs.filter(\r\n upid => upid.oldId == tikTokSplit.ParentFlowItemId\r\n ); // if none exists then add it.\r\n if (newTemplateID.length > 0 && newTemplateParentItemID.length > 0) {\r\n const thing: FlowExportTikTokTemplateFields = {\r\n TargetingAudienceName: tikTokSplit.TargetingAudienceName,\r\n FlowExportTemplateId: 0,\r\n FlowItemId: newTemplateID[0].newId,\r\n ParentFlowItemId: newTemplateParentItemID[0].newId,\r\n AdvertiserID: tikTokSplit.AdvertiserID,\r\n };\r\n dispatch(addThing(\"flowExportTikTokTemplateFields\", thing));\r\n }\r\n }\r\n }\r\n // xandrDriverFields\r\n\r\n if (xandrDriverFields) {\r\n for (let i = 0; i < xandrDriverFields.length; i++) {\r\n const xandrSplit = xandrDriverFields[i];\r\n const newTemplateID = updatedNodeIDs.filter(\r\n upid => upid.oldId == xandrSplit.FlowItemId\r\n );\r\n const newTemplateParentItemID = updatedNodeIDs.filter(\r\n upid => upid.oldId == xandrSplit.ParentFlowItemId\r\n ); // if none exists then add it.\r\n if (newTemplateID.length > 0 && newTemplateParentItemID.length > 0) {\r\n const thing: FlowExportXandrDriverFields = {\r\n XandrDriverFieldId: 0,\r\n FlowItemId: newTemplateID[0].newId,\r\n ParentFlowItemId: newTemplateParentItemID[0].newId,\r\n AudienceName: xandrSplit.AudienceName,\r\n Description: xandrSplit.Description,\r\n ExpansionType: xandrSplit.ExpansionType,\r\n TTL: xandrSplit.TTL,\r\n ExpirationDate: xandrSplit.ExpirationDate,\r\n BillingCategoryId: xandrSplit.BillingCategoryId,\r\n DataSegementTypeId: xandrSplit.DataSegementTypeId,\r\n };\r\n dispatch(addThing(\"flowExportXandrDriverFields\", thing));\r\n }\r\n }\r\n }\r\n // exportPinterestTemplates\r\n\r\n if (exportPinterestTemplates) {\r\n for (let i = 0; i < exportPinterestTemplates.length; i++) {\r\n const pintrestSplit = exportPinterestTemplates[i];\r\n const newTemplateID = updatedNodeIDs.filter(\r\n upid => upid.oldId == pintrestSplit.FlowItemId\r\n );\r\n const newTemplateParentItemID = updatedNodeIDs.filter(\r\n upid => upid.oldId == pintrestSplit.ParentFlowItemId\r\n ); // if none exists then add it.\r\n if (newTemplateID.length > 0 && newTemplateParentItemID.length > 0) {\r\n const thing: FlowExportPinterestTemplateFields = {\r\n TargetingAudienceName: pintrestSplit.TargetingAudienceName,\r\n FlowExportTemplateId: 0,\r\n FlowItemId: newTemplateID[0].newId,\r\n ParentFlowItemId: newTemplateParentItemID[0].newId,\r\n PinterestAccountID: pintrestSplit.PinterestAccountID,\r\n OldAudienceID: pintrestSplit.OldAudienceID,\r\n NotificationEmails: pintrestSplit.NotificationEmails,\r\n };\r\n dispatch(addThing(\"flowExportPinterestTemplateFields\", thing));\r\n }\r\n }\r\n }\r\n\r\n if (exportTemplates) {\r\n const exportTemplatesINeed = exportTemplates[flowItemId];\r\n if (exportTemplatesINeed) {\r\n for (let i = 0; i < exportTemplatesINeed.length; i++) {\r\n const exportSplit = exportTemplatesINeed[i];\r\n const newTemplateID = updatedNodeIDs.filter(\r\n upid => upid.oldId == exportSplit.FlowItemId\r\n );\r\n const newTemplateParentItemID = updatedNodeIDs.filter(\r\n upid => upid.oldId == exportSplit.ParentFlowItemId\r\n ); // if none exists then add it.\r\n if (newTemplateID.length > 0 && newTemplateParentItemID.length > 0) {\r\n const thing: FlowExportTemplateFields = {\r\n FlowExportTemplateId: 0,\r\n FlowItemId: newTemplateID[0].newId,\r\n ParentFlowItemId: newTemplateParentItemID[0].newId,\r\n Description: exportSplit.Description,\r\n AdAccountIds: exportSplit.AdAccountIds,\r\n CustomerFileSource: exportSplit.CustomerFileSource,\r\n EmailAddress: exportSplit.EmailAddress,\r\n };\r\n dispatch(addThing(\"flowExportTemplateFields\", thing));\r\n }\r\n }\r\n }\r\n }\r\n\r\n //\r\n\r\n if (flowItemCVs) {\r\n const flowItemCVsINeed = flowItemCVs.filter(x => x.ChildFlowItemId == flowItemId);\r\n for (let i = 0; i < flowItemCVsINeed.length; i++) {\r\n const flowItemCV = flowItemCVsINeed[i];\r\n if (flowItemCV.ChildFlowItemId == flowItemId) {\r\n const newTemplateID = updatedNodeIDs.filter(\r\n upid => upid.oldId == flowItemCV.FlowItemId\r\n );\r\n const newTemplateChildItemID = updatedNodeIDs.filter(\r\n upid => upid.oldId == flowItemCV.ChildFlowItemId\r\n ); // if none exists then add it.\r\n if (newTemplateID.length > 0 && newTemplateChildItemID.length > 0) {\r\n const thing: FlowItemClientVariableD = {\r\n FlowItemClientVariableId: 0,\r\n VariableId: flowItemCV.VariableId,\r\n FlowId: stateNow.selected.flow,\r\n FlowItemId: newTemplateID[0].newId,\r\n ChildFlowItemId: newTemplateChildItemID[0].newId,\r\n VariableValue: flowItemCV.VariableValue,\r\n };\r\n dispatch(addThing(\"flowItemClientVariables\", thing));\r\n }\r\n }\r\n }\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n dispatch(updateFlowShouldValidate(state.selected.flow, true));\r\n };\r\n\r\nexport const canPlaceFlowItem = (x: number, y: number) => (dispatch: Dispatch, getState: GetState) => {\r\n let state = getState();\r\n const flowItems = getFlowItemsForSelectedFlow(state);\r\n const nodeSize = 80;\r\n return !flowItems.find(\r\n item =>\r\n item.x != null &&\r\n item.y != null &&\r\n ((item.x == x && item.y == y) ||\r\n (item.x - 80 <= x && item.x + nodeSize >= x && item.y - nodeSize <= y && item.y + nodeSize >= y))\r\n );\r\n};\r\n\r\nexport const canPlaceInRow = (x: number, y: number) => (dispatch: Dispatch, getState: GetState) => {\r\n let state = getState();\r\n const flowItems = getFlowItemsForSelectedFlow(state);\r\n const nodeSize = 80;\r\n return (\r\n flowItems.filter(\r\n item =>\r\n item.x != null &&\r\n item.y != null &&\r\n ((item.x == x && item.y == y) || (item.y - nodeSize <= y && item.y + nodeSize >= y))\r\n ).length < 10\r\n );\r\n};\r\n\r\nexport const duplicateFlowItem =\r\n (\r\n flowItemId: number,\r\n newX: ?number,\r\n newY: ?number,\r\n flowItemIds: Array,\r\n selectedNodeLinks: Array,\r\n updateFlowIdToSelectedFlow: ?boolean\r\n ) =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n let state = getState();\r\n const flowItem = state.flowItems.byId[flowItemId];\r\n if (flowItem == null) {\r\n return;\r\n }\r\n\r\n let x = newX == null ? Math.round(flowItem.x + 100) : Math.round(newX);\r\n let y = newY == null ? Math.round(flowItem.y) : Math.round(newY);\r\n\r\n while (!canPlaceFlowItem(x, y)) {\r\n x = x + 100;\r\n }\r\n\r\n dispatch(updateFlowShouldValidate(updateFlowIdToSelectedFlow ? state.selected.flow : flowItem.FlowId, true));\r\n\r\n // Copy the Item and set its parent to 0.\r\n const newFlowItemId = dispatch(flowItemCopyToIdZero(flowItemId));\r\n\r\n dispatch(newFlowRelation(0, newFlowItemId));\r\n\r\n // Various updates, clearing stuff out and positioning\r\n const updates = {\r\n FlowItemName: flowItem.FlowItemName,\r\n HasResultTable: false,\r\n HasQATable: false,\r\n FlowItemQty: null,\r\n FlowItemStart: null,\r\n FlowItemEnd: null,\r\n IsRunning: 0,\r\n IsError: false,\r\n x,\r\n y,\r\n FlowId: updateFlowIdToSelectedFlow ? state.selected.flow : flowItem.FlowId,\r\n };\r\n const xDifference = Math.round(updates.x - flowItem.x);\r\n const yDifference = Math.round(updates.y - flowItem.y);\r\n dispatch(updateMultipleAttribute(\"flowItems\", newFlowItemId, updates));\r\n\r\n // Merges: Stop additional steps\r\n if (flowItem.FlowItemType == \"merge\" || flowItem.FlowItemType == \"offerMerge\") {\r\n return newFlowItemId;\r\n }\r\n\r\n const prefixAndEntity = prefixesAndEntities.filter(x => x.flowItemType == flowItem.FlowItemType)[0];\r\n const { stateKey, id: idName } = prefixAndEntity;\r\n\r\n const theseThings: Array = Object.values(state[stateKey].byId);\r\n const arrEntities = theseThings\r\n .filter(x => x.FlowItemId == flowItemId)\r\n .map(x => ({\r\n EntityId: x[idName],\r\n FlowItemId: x.FlowItemId,\r\n ChildFlowItemId: x.ChildFlowItemId || null,\r\n }));\r\n\r\n let newEntityId;\r\n for (const entity of arrEntities) {\r\n const currentEntityId = entity.EntityId;\r\n newEntityId = _makeNewId(state, stateKey);\r\n dispatch(_copyThingToNewId(stateKey, currentEntityId, newEntityId));\r\n\r\n // Check for FlowEmpties\r\n if (entity.ChildFlowItemId) {\r\n const childItem = state.flowItems.byId[entity.ChildFlowItemId];\r\n let newChildX = childItem.x + xDifference;\r\n let newChildY = childItem.y + yDifference;\r\n if (newChildX) {\r\n newChildX = Math.round(newChildX);\r\n }\r\n if (newChildY) {\r\n newChildY = Math.round(newChildY);\r\n }\r\n const newChildFlowItemId = dispatch(\r\n duplicateFlowItem(entity.ChildFlowItemId, newChildX, newChildY, flowItemIds, selectedNodeLinks)\r\n );\r\n dispatch(updateAttribute(stateKey, newEntityId, \"ChildFlowItemId\", newChildFlowItemId));\r\n if (updateFlowIdToSelectedFlow) {\r\n dispatch(updateAttribute(\"flowItems\", newChildFlowItemId, \"FlowId\", state.selected.flow));\r\n }\r\n\r\n state = getState();\r\n\r\n const flowRelations = getFlowRelationsForAllFlows(state);\r\n const relationIdsToUpdate = flowRelations\r\n .filter(x => x.ParentFlowItemId == 0 && x.ChildFlowItemId == newChildFlowItemId)\r\n .map(x => x.FlowRelationId);\r\n\r\n for (const flowRelationId of relationIdsToUpdate) {\r\n dispatch(updateAttribute(\"flowRelations\", flowRelationId, \"ParentFlowItemId\", newFlowItemId));\r\n updatedNodeIDs.push({\r\n oldId: entity.ChildFlowItemId,\r\n newId: newChildFlowItemId,\r\n });\r\n }\r\n }\r\n\r\n const endLoopUpdates = {\r\n [prefixAndEntity.id]: newEntityId,\r\n FlowItemId: newFlowItemId,\r\n };\r\n dispatch(updateMultipleAttribute(stateKey, newEntityId, endLoopUpdates));\r\n\r\n state = getState();\r\n }\r\n //For FlowControl Duplications\r\n if (flowItem.FlowItemType == \"flowControl\") {\r\n // Service Paramters\r\n const prefixAndParameterEntity = prefixesAndEntities.filter(\r\n x => x.flowItemType == \"FlowExternalServiceParameter\"\r\n )[0];\r\n\r\n const { stateKey: parameterStateKey, id: parameterIdName } = prefixAndParameterEntity;\r\n const theseParameterThings: Array = Object.values(state[parameterStateKey].byId);\r\n\r\n const arrParameterEntities = theseParameterThings\r\n .filter(x => x.FlowItemId == flowItemId)\r\n .map(x => ({\r\n EntityId: x[parameterIdName],\r\n FlowItemId: x.FlowItemId,\r\n ChildFlowItemId: x.ChildFlowItemId || null,\r\n }));\r\n let newParameterEntityId;\r\n for (const entity of arrParameterEntities) {\r\n const currentEntityId = entity.EntityId;\r\n newParameterEntityId = _makeNewId(state, parameterStateKey);\r\n dispatch(_copyThingToNewId(parameterStateKey, currentEntityId, newParameterEntityId));\r\n const endParameterLoopUpdates = {\r\n [prefixAndParameterEntity.id]: newParameterEntityId,\r\n FlowItemId: newFlowItemId,\r\n };\r\n dispatch(updateMultipleAttribute(parameterStateKey, newParameterEntityId, endParameterLoopUpdates));\r\n state = getState();\r\n }\r\n\r\n // Input Files\r\n const prefixAndInputEntity = prefixesAndEntities.filter(\r\n x => x.flowItemType == \"FlowExternalServiceInput\"\r\n )[0];\r\n\r\n const { stateKey: inputStateKey, id: inputIdName } = prefixAndInputEntity;\r\n const theseInputThings: Array = Object.values(state[inputStateKey].byId);\r\n\r\n const arrInputEntities = theseInputThings\r\n .filter(x => x.FlowItemId == flowItemId)\r\n .map(x => ({\r\n EntityId: x[inputIdName],\r\n FlowItemId: x.FlowItemId,\r\n ChildFlowItemId: x.ChildFlowItemId || null,\r\n }));\r\n let newInputEntityId;\r\n for (const entity of arrInputEntities) {\r\n const currentEntityId = entity.EntityId;\r\n newInputEntityId = _makeNewId(state, inputStateKey);\r\n dispatch(_copyThingToNewId(inputStateKey, currentEntityId, newInputEntityId));\r\n const endInputLoopUpdates = {\r\n [prefixAndInputEntity.id]: newInputEntityId,\r\n FlowItemId: newFlowItemId,\r\n };\r\n dispatch(updateMultipleAttribute(inputStateKey, newInputEntityId, endInputLoopUpdates));\r\n state = getState();\r\n }\r\n\r\n // Hardcodes\r\n const prefixAndHardcodeEntity = prefixesAndEntities.filter(\r\n x => x.flowItemType == \"FlowExternalServiceHardcode\"\r\n )[0];\r\n\r\n const { stateKey: hardcodeStateKey, id: hardcodeIdName } = prefixAndHardcodeEntity;\r\n const theseHardcodeThings: Array = Object.values(state[hardcodeStateKey].byId);\r\n\r\n const arrHardcodeEntities = theseHardcodeThings\r\n .filter(x => x.FlowItemId == flowItemId)\r\n .map(x => ({\r\n EntityId: x[hardcodeIdName],\r\n FlowItemId: x.FlowItemId,\r\n ChildFlowItemId: x.ChildFlowItemId || null,\r\n }));\r\n let newHardcodeEntityId;\r\n for (const entity of arrHardcodeEntities) {\r\n const currentEntityId = entity.EntityId;\r\n newHardcodeEntityId = _makeNewId(state, hardcodeStateKey);\r\n dispatch(_copyThingToNewId(hardcodeStateKey, currentEntityId, newHardcodeEntityId));\r\n const endHardcodeLoopUpdates = {\r\n [prefixAndHardcodeEntity.id]: newHardcodeEntityId,\r\n FlowItemId: newFlowItemId,\r\n };\r\n dispatch(updateMultipleAttribute(hardcodeStateKey, newHardcodeEntityId, endHardcodeLoopUpdates));\r\n state = getState();\r\n }\r\n }\r\n //For Export Duplications\r\n if (flowItem.FlowItemType == \"export\") {\r\n let exportId = 0;\r\n const exportIdList = state.flowExports.byId;\r\n for (const key in exportIdList) {\r\n if (exportIdList[key].FlowItemId == flowItemId) {\r\n exportId = exportIdList[key].ExportId;\r\n }\r\n }\r\n const flowRelations = [];\r\n const allFlowRelations = state.flowRelations.byId;\r\n for (const keys in allFlowRelations) {\r\n const thisFlowItem: ?FlowItem = state.flowItems.byId[allFlowRelations[keys].ChildFlowItemId];\r\n if (\r\n allFlowRelations[keys].ParentFlowItemId == flowItemId &&\r\n thisFlowItem != null &&\r\n thisFlowItem.FlowItemType == \"exportreport\"\r\n ) {\r\n flowRelations.push(allFlowRelations[keys].ChildFlowItemId);\r\n }\r\n }\r\n for (const childId of flowRelations) {\r\n dispatch(duplicatedFlowExportReport(newFlowItemId, exportId, childId));\r\n }\r\n }\r\n dispatch(updateFlowShouldValidate(updateFlowIdToSelectedFlow ? state.selected.flow : flowItem.FlowId, false));\r\n\r\n return newFlowItemId;\r\n };\r\ntop.RDX.duplicateFlowItem = (flowItemId, newX, newY) => top.store.dispatch(duplicateFlowItem(flowItemId, newX, newY));\r\n\r\n// This method is almost identical to below \"flowItemCopyToIdZeroBuffer\"\r\n// Only difference is setting FlowItemQty to \"0\" vs \"null\"\r\n// This is called on Duplicate node\r\nexport const flowItemCopyToIdZero =\r\n (flowItemId: number, newflowId: ?number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n\r\n // Make new ID and record it\r\n const newFlowItemId = _makeNewId(state, \"flowItems\");\r\n\r\n // Make a copy of the FlowItem and update its FlowItemId and FlowId fields\r\n dispatch(_copyThingToNewId(\"flowItems\", flowItemId, newFlowItemId));\r\n\r\n const updates: { [string]: any } = {\r\n FlowItemId: newFlowItemId,\r\n };\r\n\r\n // Update FlowItem values\r\n // Always clear out Tracking ID fields on a copy\r\n updates.CustomText = null;\r\n updates.AudienceID = null;\r\n if (newflowId != null) {\r\n updates.FlowId = newflowId;\r\n updates.FlowItemQty = 0;\r\n updates.IsRunning = 0;\r\n }\r\n dispatch(updateMultipleAttribute(\"flowItems\", newFlowItemId, updates));\r\n\r\n return newFlowItemId;\r\n };\r\ntop.RDX.flowItemCopyToIdZero = (flowItemId, newFlowId) =>\r\n top.store.dispatch(flowItemCopyToIdZero(flowItemId, newFlowId));\r\n\r\n// This method is almost identical to above \"flowItemCopyToIdZero\"\r\n// Only difference is setting FlowItemQty to \"null\" vs \"0\"\r\n// This is called on Copy/Paste a node\r\nexport const flowItemCopyToIdZeroBuffer =\r\n (flowItemId: number, newflowId: ?number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n\r\n // Make new ID and record it\r\n const newFlowItemId = _makeNewId(state, \"flowItems\");\r\n\r\n // Make a copy of the FlowItem and update its FlowItemId and FlowId fields\r\n dispatch(_copyThingToNewId(\"flowItems\", flowItemId, newFlowItemId));\r\n\r\n const updates: { [string]: any } = {\r\n FlowItemId: newFlowItemId,\r\n };\r\n\r\n // Update FlowItem values\r\n // Always clear out Tracking ID fields on a copy\r\n updates.CustomText = null;\r\n updates.AudienceID = null;\r\n if (newflowId != null) {\r\n updates.FlowId = newflowId;\r\n updates.FlowItemQty = null;\r\n updates.IsRunning = 0;\r\n }\r\n dispatch(updateMultipleAttribute(\"flowItems\", newFlowItemId, updates));\r\n\r\n return newFlowItemId;\r\n };\r\ntop.RDX.flowItemCopyToIdZeroBuffer = (flowItemId, newFlowId) =>\r\n top.store.dispatch(flowItemCopyToIdZeroBuffer(flowItemId, newFlowId));\r\n\r\nimport {\r\n crosstabFieldKeysStringToArray,\r\n crosstabFieldKeysArrayToString,\r\n measureFieldsArrayToString,\r\n measureFieldsStringToArray,\r\n} from \"../helpers/crosstabHelper\";\r\n\r\nexport const removeFlowDimensionField =\r\n (fieldKey: number, flowReportId: number, isExportReport: boolean) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n let report = isExportReport ? state.flowExportReports.byId[flowReportId] : state.flowReports.byId[flowReportId];\r\n const oldString = report.DimensionFieldKeys;\r\n const oldArray = crosstabFieldKeysStringToArray(oldString);\r\n const newArray = oldArray.filter(x => x != fieldKey);\r\n const newString = crosstabFieldKeysArrayToString(newArray);\r\n if (isExportReport) {\r\n dispatch(updateAttribute(\"flowExportReports\", flowReportId, \"DimensionFieldKeys\", newString));\r\n } else {\r\n dispatch(updateAttribute(\"flowReports\", flowReportId, \"DimensionFieldKeys\", newString));\r\n }\r\n };\r\ntop.RDX.removeFlowDimensionField = (fieldKey, flowReportId, isExportReport) =>\r\n top.store.dispatch(removeFlowDimensionField(fieldKey, flowReportId, isExportReport));\r\n\r\nexport const removeFlowDimensionMeasureField =\r\n (fieldKey: number, flowReportId: number, isExportReport: boolean, flowItemId: number) =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n let report = isExportReport ? state.flowExportReports.byId[flowReportId] : state.flowReports.byId[flowReportId];\r\n const oldString = report.DimensionFieldKeys;\r\n const oldArray = measureFieldsStringToArray(oldString);\r\n const newArray = oldArray.filter(x => x.fieldKey != fieldKey);\r\n const newString = measureFieldsArrayToString(newArray);\r\n if (flowItemId) {\r\n dispatch(disableFlowReportTabs(flowItemId));\r\n }\r\n if (isExportReport) {\r\n dispatch(updateAttribute(\"flowExportReports\", flowReportId, \"DimensionFieldKeys\", newString));\r\n } else {\r\n dispatch(updateAttribute(\"flowReports\", flowReportId, \"DimensionFieldKeys\", newString));\r\n }\r\n };\r\ntop.RDX.removeFlowDimensionMeasureField = (fieldKey, flowReportId, isExportReport, flowItemId) =>\r\n top.store.dispatch(removeFlowDimensionMeasureField(fieldKey, flowReportId, isExportReport, flowItemId));\r\n\r\nexport const removeFlowDimensionFromCannedReport =\r\n (fieldKey: string, flowReportId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n let report = state.flowCannedReports.byId[flowReportId];\r\n const oldString = report.DimensionFieldKeys;\r\n const oldArray = measureFieldsStringToArray(oldString);\r\n const newArray = oldArray.filter(x => x.columnalias != fieldKey);\r\n const newString = measureFieldsArrayToString(newArray);\r\n dispatch(updateAttribute(\"flowCannedReports\", flowReportId, \"DimensionFieldKeys\", newString));\r\n };\r\ntop.RDX.removeFlowDimensionFromCannedReport = (fieldKey, flowReportId) =>\r\n top.store.dispatch(removeFlowDimensionFromCannedReport(fieldKey, flowReportId));\r\n\r\nexport const removeFlowMeasureField =\r\n (fieldKey: number, flowReportId: number, isExportReport: boolean) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n let report = isExportReport ? state.flowExportReports.byId[flowReportId] : state.flowReports.byId[flowReportId];\r\n const oldString = report.MeasureFieldKeys;\r\n const oldArray = measureFieldsStringToArray(oldString);\r\n const newArray = oldArray.filter(x => x.fieldKey != fieldKey);\r\n const newString = measureFieldsArrayToString(newArray);\r\n if (isExportReport) {\r\n dispatch(updateAttribute(\"flowExportReports\", flowReportId, \"MeasureFieldKeys\", newString));\r\n } else {\r\n dispatch(updateAttribute(\"flowReports\", flowReportId, \"MeasureFieldKeys\", newString));\r\n }\r\n };\r\ntop.RDX.removeFlowMeasureField = (fieldKey, flowReportId, isExportReport) =>\r\n top.store.dispatch(removeFlowMeasureField(fieldKey, flowReportId, isExportReport));\r\n\r\nexport const removeFlowMeasureFieldByIndex =\r\n (index: number, flowReportId: number, isExportReport: boolean, flowItemId: number) =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n let report = isExportReport ? state.flowExportReports.byId[flowReportId] : state.flowReports.byId[flowReportId];\r\n const oldString = report.MeasureFieldKeys;\r\n const oldArray = measureFieldsStringToArray(oldString);\r\n if (flowItemId) {\r\n dispatch(disableFlowReportTabs(flowItemId));\r\n }\r\n // Delete at most 1 element that matches the action's index\r\n const newArray = clone(oldArray);\r\n if (index > -1) {\r\n newArray.splice(index, 1);\r\n }\r\n\r\n const newString = measureFieldsArrayToString(newArray);\r\n if (isExportReport) {\r\n dispatch(updateAttribute(\"flowExportReports\", flowReportId, \"MeasureFieldKeys\", newString));\r\n } else {\r\n dispatch(updateAttribute(\"flowReports\", flowReportId, \"MeasureFieldKeys\", newString));\r\n }\r\n };\r\ntop.RDX.removeFlowMeasureFieldByIndex = (fieldKey, flowReportId, isExportReport, flowItemId) =>\r\n top.store.dispatch(removeFlowMeasureFieldByIndex(fieldKey, flowReportId, isExportReport, flowItemId));\r\n\r\nexport const addFlowDimensionField =\r\n (fieldKey: number, flowReportId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n let report = state.flowReports.byId[flowReportId];\r\n const oldString = report.DimensionFieldKeys;\r\n const oldArray = crosstabFieldKeysStringToArray(oldString);\r\n\r\n // Don't add if it's already there\r\n if (oldArray.includes(fieldKey) || oldArray.includes(parseInt(fieldKey))) {\r\n return state;\r\n }\r\n\r\n const newArray = oldArray.concat([fieldKey]);\r\n const newString = crosstabFieldKeysArrayToString(newArray);\r\n dispatch(updateAttribute(\"flowReports\", flowReportId, \"DimensionFieldKeys\", newString));\r\n };\r\ntop.RDX.addFlowDimensionField = (fieldKey, flowReportId) =>\r\n top.store.dispatch(addFlowDimensionField(fieldKey, flowReportId));\r\n\r\nexport const addFlowDimensionObject =\r\n (objectId: number, flowExportReportId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n let report = state.flowExportReports.byId[flowExportReportId];\r\n const oldString = report.DimensionFieldKeys;\r\n const oldArray = crosstabFieldKeysStringToArray(oldString);\r\n\r\n // Don't add if it's already there\r\n if (oldArray.includes(objectId) || oldArray.includes(parseInt(objectId))) {\r\n return state;\r\n }\r\n\r\n const newArray = oldArray.concat([objectId]);\r\n const newString = crosstabFieldKeysArrayToString(newArray);\r\n dispatch(updateAttribute(\"flowExportReports\", flowExportReportId, \"DimensionFieldKeys\", newString));\r\n };\r\ntop.RDX.addFlowDimensionObject = (fieldKey, flowExportReportId) =>\r\n top.store.dispatch(addFlowDimensionObject(fieldKey, flowExportReportId));\r\n\r\n// Add measure field that is an actual fieldd\r\nimport { CrosstabMeasureType } from \"../types/types\";\r\nexport const flowReportAddMeasureField =\r\n (fieldKey: number, itemId: number, isExportReport: boolean, flowItemId: number) =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n let report = isExportReport ? state.flowExportReports.byId[itemId] : state.flowReports.byId[itemId];\r\n const measureFieldsString = report.MeasureFieldKeys;\r\n const measureFields = measureFieldsStringToArray(measureFieldsString);\r\n // CalculatedFieldType FieldEquality can have two fields\r\n const measureTypeFieldEquality =\r\n measureFields.filter(x => x.measureType == CrosstabMeasureType.FIELD_EQUALITY).length > 0;\r\n\r\n const measureTypeDateDiff =\r\n !measureTypeFieldEquality &&\r\n measureFields.filter(x => x.measureType == CrosstabMeasureType.FIELD_DIFF).length > 0;\r\n\r\n const fields = state.fields;\r\n const fieldToAdd = fields.byId[fieldKey];\r\n // we already have a field so need to compare the field types\r\n if (measureTypeFieldEquality || measureTypeDateDiff) {\r\n if (measureTypeDateDiff && fieldToAdd.fieldDataType != \"D\" && fieldToAdd.fieldDataType != \"N\") {\r\n h.error(\"Compare options is for date/numeric fields only.\");\r\n return;\r\n }\r\n if (measureFields.length == 2) {\r\n const fieldA = fields.byId[measureFields[1].fieldKey];\r\n\r\n if (fieldA.fieldDataType != fieldToAdd.fieldDataType) {\r\n h.error(\"Can't compare fields with different data types.\");\r\n return;\r\n }\r\n if (fieldA.id == fieldToAdd.id) {\r\n h.error(\"Field already selected, choose another field to compare.\");\r\n return;\r\n }\r\n } else if (measureFields.length > 2) {\r\n h.error(\"Can't compare more than two fields.\");\r\n return;\r\n }\r\n }\r\n dispatch(disableFlowReportTabs(flowItemId));\r\n\r\n if (measureTypeDateDiff) {\r\n const oldString = report.MeasureFieldKeys;\r\n const oldArray = measureFieldsStringToArray(oldString);\r\n\r\n const newArray = clone(oldArray);\r\n if (!newArray[0].dateDiffOptions) {\r\n newArray[0].dateDiffOptions = {\r\n fieldDataType: fieldToAdd.fieldDataType,\r\n };\r\n } else {\r\n newArray[0].dateDiffOptions.fieldDataType = fieldToAdd.fieldDataType;\r\n }\r\n\r\n const newString = measureFieldsArrayToString(newArray);\r\n if (isExportReport) {\r\n dispatch(updateAttribute(\"flowExportReports\", itemId, \"MeasureFieldKeys\", newString));\r\n } else {\r\n dispatch(updateAttribute(\"flowReports\", itemId, \"MeasureFieldKeys\", newString));\r\n }\r\n }\r\n\r\n const oldString = report.MeasureFieldKeys;\r\n const oldArray = measureFieldsStringToArray(oldString);\r\n\r\n const newArray = oldArray.concat([{ fieldKey, aggregationOperator: null }]);\r\n\r\n const newString = measureFieldsArrayToString(newArray);\r\n if (isExportReport) {\r\n dispatch(updateAttribute(\"flowExportReports\", itemId, \"MeasureFieldKeys\", newString));\r\n } else {\r\n dispatch(updateAttribute(\"flowReports\", itemId, \"MeasureFieldKeys\", newString));\r\n }\r\n };\r\ntop.RDX.flowReportAddMeasureField = (fieldKey, flowReportId, isExportReport, flowitemId) =>\r\n top.store.dispatch(flowReportAddMeasureField(fieldKey, flowReportId, isExportReport, flowitemId));\r\n\r\nexport const addFlowDimensionMeasureField =\r\n (fieldKey: number, itemId: number, isExportReport: boolean, flowItemId: number) =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n let report = isExportReport ? state.flowExportReports.byId[itemId] : state.flowReports.byId[itemId];\r\n const measureFieldsString = report.DimensionFieldKeys;\r\n const measureFields = measureFieldsStringToArray(measureFieldsString);\r\n let canAdd = true;\r\n measureFields.forEach(x => {\r\n if (x.fieldKey == fieldKey) {\r\n h.error(\"This field has already been added.\");\r\n canAdd = false;\r\n }\r\n });\r\n if (!canAdd) {\r\n return;\r\n }\r\n // CalculatedFieldType FieldEquality can have two fields\r\n const measureTypeFieldEquality =\r\n measureFields.filter(x => x.measureType == CrosstabMeasureType.FIELD_EQUALITY).length > 0;\r\n\r\n const measureTypeDateDiff =\r\n !measureTypeFieldEquality &&\r\n measureFields.filter(x => x.measureType == CrosstabMeasureType.FIELD_DIFF).length > 0;\r\n\r\n const fields = state.fields;\r\n const fieldToAdd = fields.byId[fieldKey];\r\n // we already have a field so need to compare the field types\r\n if (measureTypeFieldEquality || measureTypeDateDiff) {\r\n if (measureTypeDateDiff && fieldToAdd.fieldDataType != \"D\" && fieldToAdd.fieldDataType != \"N\") {\r\n h.error(\"Compare options is for date/numeric fields only.\");\r\n return;\r\n }\r\n if (measureFields.length == 2) {\r\n const fieldA = fields.byId[measureFields[1].fieldKey];\r\n\r\n if (fieldA.fieldDataType != fieldToAdd.fieldDataType) {\r\n h.error(\"Can't compare fields with different data types.\");\r\n return;\r\n }\r\n if (fieldA.id == fieldToAdd.id) {\r\n h.error(\"Field already selected, choose another field to compare.\");\r\n return;\r\n }\r\n } else if (measureFields.length > 2) {\r\n h.error(\"Can't compare more than two fields.\");\r\n return;\r\n }\r\n }\r\n dispatch(disableFlowReportTabs(flowItemId));\r\n\r\n if (measureTypeDateDiff) {\r\n const oldString = report.DimensionFieldKeys;\r\n const oldArray = measureFieldsStringToArray(oldString);\r\n\r\n const newArray = clone(oldArray);\r\n if (!newArray[0].dateDiffOptions) {\r\n newArray[0].dateDiffOptions = {\r\n fieldDataType: fieldToAdd.fieldDataType,\r\n };\r\n } else {\r\n newArray[0].dateDiffOptions.fieldDataType = fieldToAdd.fieldDataType;\r\n }\r\n\r\n const newString = measureFieldsArrayToString(newArray);\r\n if (isExportReport) {\r\n dispatch(updateAttribute(\"flowExportReports\", itemId, \"DimensionFieldKeys\", newString));\r\n } else {\r\n dispatch(updateAttribute(\"flowReports\", itemId, \"DimensionFieldKeys\", newString));\r\n }\r\n }\r\n\r\n const oldString = report.DimensionFieldKeys;\r\n const oldArray = measureFieldsStringToArray(oldString);\r\n\r\n const newArray = oldArray.concat([{ fieldKey, windowOperator: null }]);\r\n\r\n const newString = measureFieldsArrayToString(newArray);\r\n if (isExportReport) {\r\n dispatch(updateAttribute(\"flowExportReports\", itemId, \"DimensionFieldKeys\", newString));\r\n } else {\r\n dispatch(updateAttribute(\"flowReports\", itemId, \"DimensionFieldKeys\", newString));\r\n }\r\n };\r\ntop.RDX.addFlowDimensionMeasureField = (fieldKey, flowReportId, isExportReport, flowitemId) =>\r\n top.store.dispatch(addFlowDimensionMeasureField(fieldKey, flowReportId, isExportReport, flowitemId));\r\n\r\n// export const addFlowDimensionToCannedReport =\r\n// (fieldKey: number, itemId: number, flowItemId: number) =>\r\nexport const addFlowDimensionToCannedReport =\r\n (field: any, itemId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n let report = state.flowCannedReports.byId[itemId];\r\n const measureFieldsString = report.DimensionFieldKeys;\r\n\r\n let measureFields = [];\r\n if (measureFieldsString != \"\") {\r\n measureFields = JSON.parse(measureFieldsString);\r\n }\r\n let canAdd = true;\r\n\r\n if (!Array.isArray(measureFields)) {\r\n Object.values(measureFields);\r\n }\r\n\r\n if (Array.isArray(measureFields)) {\r\n measureFields.forEach(x => {\r\n if (x.columnname == field.ColumnName) {\r\n h.error(\"This field has already been added.\");\r\n canAdd = false;\r\n }\r\n });\r\n }\r\n\r\n if (!canAdd) {\r\n return;\r\n }\r\n\r\n if (Array.isArray(measureFields)) {\r\n measureFields.push({\r\n columnname: field.ColumnName,\r\n columnalias: field.ColumnAlias,\r\n });\r\n } else {\r\n measureFields = {\r\n columnname: field.ColumnName,\r\n columnalias: field.ColumnAlias,\r\n };\r\n }\r\n const newString = JSON.stringify(measureFields);\r\n dispatch(updateAttribute(\"flowCannedReports\", itemId, \"DimensionFieldKeys\", newString));\r\n };\r\ntop.RDX.addFlowDimensionToCannedReport = (field, flowReportId, flowitemId) =>\r\n top.store.dispatch(addFlowDimensionToCannedReport(field, flowReportId, flowitemId));\r\n// top.RDX.addFlowDimensionToCannedReport = (fieldKey, flowReportId, flowitemId) =>\r\n// top.store.dispatch(addFlowDimensionToCannedReport(fieldKey, flowReportId, flowitemId));\r\n\r\nconst findTopLevelFlowFolderForUser = (state: any, userId: number) => {\r\n let folderId = 0;\r\n const folders: any = Object.values(state.folders.flowFolders);\r\n const myTopLevelFolders = folders.filter(x => x.userId == userId && x.folderType == \"W\");\r\n const companyFolders = folders.filter(x => x.userId == 0 && x.folderType == \"W\");\r\n if (myTopLevelFolders.length > 0) {\r\n return myTopLevelFolders[0].id;\r\n }\r\n if (companyFolders.length > 0) {\r\n companyFolders.forEach(x => {\r\n x.children.forEach(z => {\r\n if (z.userId == userId) {\r\n folderId = z.id;\r\n return folderId;\r\n }\r\n });\r\n });\r\n }\r\n return folderId;\r\n};\r\n\r\nexport const flowCopyToIdZero =\r\n (flowId: number, newOwnerId: number = 0, copyOfferCodes: boolean = false, copyVariables: boolean = false) =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n let state = getState();\r\n const flow: ?Flow = state.flows.byId[flowId];\r\n\r\n if (flow == null) {\r\n return;\r\n }\r\n\r\n // (1) Copy Flow\r\n const newFlowId = 0;\r\n dispatch(_copyThingToNewId(\"flows\", flowId, newFlowId));\r\n\r\n // (1.05) Set ID Unlock the new flow\r\n const updates: { [string]: any } = {\r\n FlowId: newFlowId,\r\n IsLocked: false,\r\n IsLockedPermanently: false,\r\n FlowLastCalculated: null,\r\n FlowStart: null,\r\n FlowStop: null,\r\n ScheduleId: null,\r\n };\r\n\r\n // (1.1) Change the owner info and put the flow in the new owner's folder, if the owner is different\r\n if (newOwnerId > 0 && newOwnerId != flow.FlowCreatedBy) {\r\n updates[\"FlowCreatedBy\"] = newOwnerId;\r\n updates[\"FlowUpdatedByBy\"] = newOwnerId;\r\n\r\n const folderId = findTopLevelFlowFolderForUser(state, newOwnerId);\r\n if (folderId > 0) {\r\n updates[\"FlowFolderId\"] = folderId;\r\n }\r\n }\r\n\r\n // (1.9) Send out updates\r\n dispatch(updateMultipleAttribute(\"flows\", newFlowId, updates));\r\n\r\n // (2) Copy FlowItems, which depend on Flows\r\n // except for SegmentSplits\r\n const newItemIdFor = {};\r\n\r\n const flowItems: Array = Object.values(state.flowItems.byId);\r\n const theseFlowItemIds = flowItems.filter(x => x.FlowId == flowId).map(x => x.FlowItemId);\r\n for (const flowItemId of theseFlowItemIds) {\r\n const newFlowItemId = dispatch(flowItemCopyToIdZero(flowItemId, newFlowId));\r\n newItemIdFor[flowItemId] = newFlowItemId;\r\n }\r\n\r\n // (3) Copy FlowRelations, which depend on FlowItems and are special because they contain two FlowItems\r\n const flowRelationParentLabels: Array = Object.values(state.flowRelationParentLabels.byId);\r\n\r\n const flowRelations: Array = Object.values(state.flowRelations.byId);\r\n const theseFlowRelationIds = flowRelations\r\n .filter(x => theseFlowItemIds.includes(x.ParentFlowItemId) || theseFlowItemIds.includes(x.ChildFlowItemId))\r\n .map(x => x.FlowRelationId);\r\n for (const flowRelationId of theseFlowRelationIds) {\r\n // Make new ID\r\n state = getState();\r\n const newFlowRelationId = _makeNewId(state, \"flowRelations\");\r\n\r\n // Find the relation\r\n const relation = state.flowRelations.byId[flowRelationId];\r\n if (relation == null) {\r\n continue;\r\n }\r\n const newParentId = newItemIdFor[relation.ParentFlowItemId] || relation.ParentFlowItemId;\r\n const newChildId = newItemIdFor[relation.ChildFlowItemId] || relation.ChildFlowItemId;\r\n\r\n if (flowRelationParentLabels.length > 0) {\r\n if (flowRelationParentLabels.filter(x => x.FlowRelationId == flowRelationId).length > 0) {\r\n let parentLabel = flowRelationParentLabels.filter(x => x.FlowRelationId == flowRelationId)[0];\r\n const newFlowRelationParentLabelId = _makeNewId(state, \"flowRelationParentLabels\");\r\n dispatch(\r\n _copyThingToNewId(\r\n \"flowRelationParentLabels\",\r\n parentLabel.FlowRelationParentLabelId,\r\n newFlowRelationParentLabelId\r\n )\r\n );\r\n dispatch(\r\n updateAttribute(\r\n \"flowRelationParentLabels\",\r\n newFlowRelationParentLabelId,\r\n \"FlowRelationParentLabelId\",\r\n newFlowRelationParentLabelId\r\n )\r\n );\r\n dispatch(\r\n updateAttribute(\r\n \"flowRelationParentLabels\",\r\n newFlowRelationParentLabelId,\r\n \"FlowRelationId\",\r\n newFlowRelationId\r\n )\r\n );\r\n }\r\n }\r\n\r\n // Copy and make the updates\r\n dispatch(_copyThingToNewId(\"flowRelations\", flowRelationId, newFlowRelationId));\r\n dispatch(updateAttribute(\"flowRelations\", newFlowRelationId, \"FlowRelationId\", newFlowRelationId));\r\n dispatch(updateAttribute(\"flowRelations\", newFlowRelationId, \"ParentFlowItemId\", newParentId));\r\n dispatch(updateAttribute(\"flowRelations\", newFlowRelationId, \"ChildFlowItemId\", newChildId));\r\n }\r\n\r\n // (4) Copy all others, which depend on FlowItems, things like FlowSplit and FlowFilter\r\n // Assuming it has a \"FlowItemId\" or a \"FlowId\"\r\n const alreadyDone = [\"flows\", \"flowItems\", \"flowRelations\"];\r\n const otherEntities = prefixesAndEntities.filter(\r\n x => !alreadyDone.includes(x.stateKey) && x.flowItemType != null\r\n );\r\n for (const entityRow of otherEntities) {\r\n const stateKey = entityRow.stateKey;\r\n\r\n const idName = entityRow.id;\r\n\r\n const theseThings: Array = Object.values(state[stateKey].byId);\r\n const theseIds = theseThings\r\n .filter(x => theseFlowItemIds.includes(x.FlowItemId) || x.FlowId == flowId)\r\n .map(x => x[idName]);\r\n\r\n for (const thisId of theseIds) {\r\n // Make new ID\r\n state = getState();\r\n const newFlowThingId = _makeNewId(state, stateKey);\r\n\r\n // Find the thing\r\n const thing = state[stateKey].byId[thisId];\r\n const newFlowItemId = newItemIdFor[thing.FlowItemId] || thing.FlowItemId;\r\n\r\n let shouldCopyThing = true;\r\n if (\r\n (stateKey == \"flowClientVariables\" && !copyVariables) ||\r\n (stateKey == \"flowItemClientVariables\" && !copyOfferCodes) ||\r\n stateKey == \"flowSegmentSplitOffers\" ||\r\n stateKey == \"flowScriptResults\"\r\n ) {\r\n shouldCopyThing = false;\r\n }\r\n\r\n if (shouldCopyThing) {\r\n // Copy and make updates\r\n if (stateKey == \"flowSegmentSplits\") {\r\n const theseSplitOfferCodeThings: Array = Object.values(\r\n state[\"flowSegmentSplitOffers\"].byId\r\n );\r\n const theseSplitOfferCodeIds = theseSplitOfferCodeThings.filter(\r\n x => x.SegmentSplitId == thisId\r\n );\r\n for (const thisOfferCodeID of theseSplitOfferCodeIds) {\r\n state = getState();\r\n const newSSOId = _makeNewId(state, \"flowSegmentSplitOffers\");\r\n const oldSSOId = thisOfferCodeID.SegmentSplitOfferId;\r\n dispatch(_copyThingToNewId(\"flowSegmentSplitOffers\", oldSSOId, newSSOId));\r\n dispatch(\r\n updateAttribute(\"flowSegmentSplitOffers\", newSSOId, \"SegmentSplitId\", newFlowThingId)\r\n );\r\n dispatch(\r\n updateAttribute(\r\n \"flowSegmentSplitOffers\",\r\n newSSOId,\r\n \"SegmentSplitOfferId\",\r\n newFlowThingId\r\n )\r\n );\r\n dispatch(updateAttribute(\"flowSegmentSplitOffers\", newSSOId, \"FlowItemId\", newFlowItemId));\r\n }\r\n }\r\n\r\n dispatch(_copyThingToNewId(stateKey, thisId, newFlowThingId));\r\n\r\n dispatch(updateAttribute(stateKey, newFlowThingId, idName, newFlowThingId));\r\n\r\n if (thing.FlowItemId) {\r\n dispatch(updateAttribute(stateKey, newFlowThingId, \"FlowItemId\", newFlowItemId));\r\n\r\n // For trace\r\n dispatch(updateAttribute(\"flowItems\", newFlowItemId, \"OldFlowItemId\", thing.FlowItemId));\r\n }\r\n if (thing.FlowId) {\r\n dispatch(updateAttribute(stateKey, newFlowThingId, \"FlowId\", newFlowId));\r\n }\r\n\r\n state = getState();\r\n if (thing.ParentFlowItemId) {\r\n const newParentFlowItemId = newItemIdFor[thing.ParentFlowItemId];\r\n dispatch(updateAttribute(stateKey, newFlowThingId, \"ParentFlowItemId\", newParentFlowItemId));\r\n }\r\n if (thing.ChildFlowItemId) {\r\n const newChildFlowItemId = newItemIdFor[thing.ChildFlowItemId];\r\n dispatch(updateAttribute(stateKey, newFlowThingId, \"ChildFlowItemId\", newChildFlowItemId));\r\n }\r\n }\r\n }\r\n }\r\n };\r\ntop.RDX.flowCopyToIdZero = (flowId, newOwnerId, copyOfferCodes, copyVariables) =>\r\n top.store.dispatch(flowCopyToIdZero(flowId, newOwnerId, copyOfferCodes, copyVariables));\r\n// See git history for comments showing how the negative ids are applied to both flows and flowItems when copying an entire flow.\r\n///////////////// END OVERWRITE=OFF SECTION //////////////////////////\r\n\r\nexport const flowCopyToIdZeroFromBuffer =\r\n (\r\n currentFlowId: number,\r\n newFlowId: number,\r\n clipboardNodes: Array,\r\n clipboardRelations: Array,\r\n pasteOffsetX: number,\r\n pasteOffsetY: number\r\n ) =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n // do we need to pass the selected nodes? is that in state?\r\n // do we care about the relations?\r\n\r\n let flowId = currentFlowId;\r\n let state = getState();\r\n const flow: ?Flow = state.flows.byId[flowId];\r\n\r\n if (flow == null) {\r\n return;\r\n }\r\n const newItemIdFor = {};\r\n const flowItemsRaw: Array = Object.values(state.flowItems.byId);\r\n const flowItems = flowItemsRaw.filter(item => clipboardNodes.includes(item.FlowItemId));\r\n flowId = flowItems[0].FlowId;\r\n const theseFlowItemIds = flowItems.filter(x => x.FlowId == flowId).map(x => x.FlowItemId);\r\n for (const flowItemId of theseFlowItemIds) {\r\n const newFlowItemId = dispatch(flowItemCopyToIdZeroBuffer(flowItemId, newFlowId));\r\n newItemIdFor[flowItemId] = newFlowItemId;\r\n const flowItemINeed = state.flowItems.byId[flowItemId];\r\n let newX = flowItemINeed.x + pasteOffsetX;\r\n let newY = flowItemINeed.y + pasteOffsetY;\r\n dispatch(updateAttribute(\"flowItems\", newFlowItemId, \"x\", newX));\r\n dispatch(updateAttribute(\"flowItems\", newFlowItemId, \"y\", newY));\r\n dispatch(updateAttribute(\"flowItems\", newFlowItemId, \"HasResultTable\", false));\r\n }\r\n\r\n const flowRelationParentLabels: Array = Object.values(state.flowRelationParentLabels.byId);\r\n const flowRelations: Array = Object.values(state.flowRelations.byId);\r\n const theseFlowRelationIds = flowRelations\r\n .filter(x => clipboardRelations.includes(x.FlowRelationId))\r\n .map(x => x.FlowRelationId);\r\n for (const flowRelationId of theseFlowRelationIds) {\r\n // Make new ID\r\n state = getState();\r\n const newFlowRelationId = _makeNewId(state, \"flowRelations\");\r\n\r\n // Find the relation\r\n const relation = state.flowRelations.byId[flowRelationId];\r\n if (relation == null) {\r\n continue;\r\n }\r\n const newParentId = newItemIdFor[relation.ParentFlowItemId] || relation.ParentFlowItemId;\r\n const newChildId = newItemIdFor[relation.ChildFlowItemId] || relation.ChildFlowItemId;\r\n\r\n if (flowRelationParentLabels.length > 0) {\r\n if (flowRelationParentLabels.filter(x => x.FlowRelationId == flowRelationId).length > 0) {\r\n let parentLabel = flowRelationParentLabels.filter(x => x.FlowRelationId == flowRelationId)[0];\r\n const newFlowRelationParentLabelId = _makeNewId(state, \"flowRelationParentLabels\");\r\n dispatch(\r\n _copyThingToNewId(\r\n \"flowRelationParentLabels\",\r\n parentLabel.FlowRelationParentLabelId,\r\n newFlowRelationParentLabelId\r\n )\r\n );\r\n dispatch(\r\n updateAttribute(\r\n \"flowRelationParentLabels\",\r\n newFlowRelationParentLabelId,\r\n \"FlowRelationParentLabelId\",\r\n newFlowRelationParentLabelId\r\n )\r\n );\r\n dispatch(\r\n updateAttribute(\r\n \"flowRelationParentLabels\",\r\n newFlowRelationParentLabelId,\r\n \"FlowRelationId\",\r\n newFlowRelationId\r\n )\r\n );\r\n }\r\n }\r\n\r\n // Copy and make the updates\r\n dispatch(_copyThingToNewId(\"flowRelations\", flowRelationId, newFlowRelationId));\r\n dispatch(updateAttribute(\"flowRelations\", newFlowRelationId, \"FlowRelationId\", newFlowRelationId));\r\n dispatch(updateAttribute(\"flowRelations\", newFlowRelationId, \"ParentFlowItemId\", newParentId));\r\n dispatch(updateAttribute(\"flowRelations\", newFlowRelationId, \"ChildFlowItemId\", newChildId));\r\n }\r\n\r\n const alreadyDone = [\"flows\", \"flowItems\", \"flowRelations\"];\r\n const otherEntities = prefixesAndEntities.filter(\r\n x => !alreadyDone.includes(x.stateKey) && x.flowItemType != null\r\n );\r\n for (const entityRow of otherEntities) {\r\n const stateKey = entityRow.stateKey;\r\n\r\n const idName = entityRow.id;\r\n\r\n const theseThingsRaw: Array = Object.values(state[stateKey].byId);\r\n const theseThings: Array = theseThingsRaw.filter(item => clipboardNodes.includes(item.FlowItemId));\r\n const theseIds = theseThings\r\n .filter(x => theseFlowItemIds.includes(x.FlowItemId) || x.FlowId == flowId)\r\n .map(x => x[idName]);\r\n\r\n for (const thisId of theseIds) {\r\n // Make new ID\r\n state = getState();\r\n const newFlowThingId = _makeNewId(state, stateKey);\r\n\r\n // Find the thing\r\n const thing = state[stateKey].byId[thisId];\r\n const newFlowItemId = newItemIdFor[thing.FlowItemId] || thing.FlowItemId;\r\n\r\n const mustHaveParent = [\"flowMerges\", \"flowOfferMerges\", \"flowExportTradeDeskTemplateFields\", \"flowExportPubmaticTemplateFields\"].includes(\r\n stateKey\r\n );\r\n const parentIsBeingCopied = clipboardNodes.includes(thing.ParentFlowItemId);\r\n\r\n let shouldCopyThing = true;\r\n if (stateKey == \"flowSegmentSplitOffers\" || stateKey == \"flowScriptResults\") {\r\n shouldCopyThing = false;\r\n }\r\n if (mustHaveParent && !parentIsBeingCopied) {\r\n shouldCopyThing = false;\r\n }\r\n\r\n if (shouldCopyThing) {\r\n // Copy and make updates\r\n if (stateKey == \"flowSegmentSplits\") {\r\n const theseSplitOfferCodeThings: Array = Object.values(\r\n state[\"flowSegmentSplitOffers\"].byId\r\n );\r\n const theseSplitOfferCodeIds = theseSplitOfferCodeThings.filter(\r\n x => x.SegmentSplitId == thisId\r\n );\r\n for (const thisOfferCodeID of theseSplitOfferCodeIds) {\r\n let state2 = getState();\r\n const newSSOId = _makeNewId(state2, \"flowSegmentSplitOffers\");\r\n const oldSSOId = thisOfferCodeID.SegmentSplitOfferId;\r\n dispatch(_copyThingToNewId(\"flowSegmentSplitOffers\", oldSSOId, newSSOId));\r\n dispatch(\r\n updateAttribute(\"flowSegmentSplitOffers\", newSSOId, \"SegmentSplitId\", newFlowThingId)\r\n );\r\n dispatch(\r\n updateAttribute(\"flowSegmentSplitOffers\", newSSOId, \"SegmentSplitOfferId\", newSSOId)\r\n );\r\n\r\n dispatch(updateAttribute(\"flowSegmentSplitOffers\", newSSOId, \"FlowItemId\", newFlowItemId));\r\n }\r\n }\r\n\r\n dispatch(_copyThingToNewId(stateKey, thisId, newFlowThingId));\r\n\r\n dispatch(updateAttribute(stateKey, newFlowThingId, idName, newFlowThingId));\r\n\r\n if (thing.FlowItemId) {\r\n dispatch(updateAttribute(stateKey, newFlowThingId, \"FlowItemId\", newFlowItemId));\r\n\r\n // For trace\r\n dispatch(updateAttribute(\"flowItems\", newFlowItemId, \"OldFlowItemId\", thing.FlowItemId));\r\n }\r\n if (thing.FlowId) {\r\n dispatch(updateAttribute(stateKey, newFlowThingId, \"FlowId\", newFlowId));\r\n }\r\n\r\n if (thing.ParentFlowItemId) {\r\n const newParentFlowItemId = newItemIdFor[thing.ParentFlowItemId];\r\n dispatch(updateAttribute(stateKey, newFlowThingId, \"ParentFlowItemId\", newParentFlowItemId));\r\n }\r\n if (thing.ChildFlowItemId) {\r\n const newChildFlowItemId = newItemIdFor[thing.ChildFlowItemId];\r\n dispatch(updateAttribute(stateKey, newFlowThingId, \"ChildFlowItemId\", newChildFlowItemId));\r\n }\r\n }\r\n }\r\n }\r\n };\r\ntop.RDX.flowCopyToIdZeroFromBuffer = (\r\n flowId,\r\n newOwnerId,\r\n clipboardNodes,\r\n clipboardRelations,\r\n pasteOffsetX,\r\n pasteOffsetY\r\n) =>\r\n top.store.dispatch(\r\n flowCopyToIdZeroFromBuffer(flowId, newOwnerId, clipboardNodes, clipboardRelations, pasteOffsetX, pasteOffsetY)\r\n );\r\n// See git history for comments showing how the negative ids are applied to both flows and flowItems when copying an entire flow.\r\n///////////////// END OVERWRITE=OFF SECTION //////////////////////////\r\n\r\nexport const requestMoveFlowToFolder =\r\n (flowId: number, folderId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n // Optimistic update, first update client side only\r\n const state = getState();\r\n\r\n if (\r\n state.session.userId != state.flows.byId[flowId].FlowCreatedBy &&\r\n !state.flows.byId[flowId].IsLockedPermanently\r\n ) {\r\n h.error(\"Cannot move another user's flow.\");\r\n return;\r\n }\r\n dispatch(updateAttribute(\"flows\", flowId, \"FlowFolderId\", folderId));\r\n // Then make request to server\r\n dispatch(incAjaxCount());\r\n const moveUrl =\r\n \"/Flows/MoveFlow?\" +\r\n h.serialize({\r\n flowId,\r\n folderId,\r\n });\r\n\r\n fetch(moveUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(() => {\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error moving flow\", error);\r\n });\r\n };\r\n\r\nexport const addItemEndpoint = (flowId: number, flowItemId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n let state = getState();\r\n const thisFlowItem: ?FlowItem = state.flowItems.byId[flowItemId];\r\n if (thisFlowItem == null) {\r\n return;\r\n }\r\n\r\n const thing: FlowItemEndpoint = {\r\n Id: 0,\r\n FlowId: flowId,\r\n FlowItemId: flowItemId,\r\n EndpointId: 0,\r\n };\r\n dispatch(addThing(\"flowItemEndpoints\", thing));\r\n dispatch(setHasUnsavedChanges());\r\n};\r\n\r\n// Disable and re-enable flow items and their children if requested\r\nexport const disableEnableItemAndChildren =\r\n (flowItemId: number, enable: boolean, children: boolean = true) =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const childrenIndex = getFlowItemChildrenIndex(state);\r\n const itemsById = state.flowItems.byId;\r\n dispatch(updateFlowShouldValidate(state.selected.flow, true));\r\n\r\n const disableEnable = flowItemId => {\r\n // Return early if item not found\r\n const item: ?FlowItem = itemsById[flowItemId];\r\n if (item == null) {\r\n h.error(\"There was an error disabling the node.\");\r\n return;\r\n }\r\n\r\n // Update Parent\r\n dispatch(updateAttribute(\"flowItems\", flowItemId, \"IsActive\", enable));\r\n\r\n // Update Children if requested\r\n if (children) {\r\n // Update all my children recursively\r\n const childrenIds = childrenIndex[flowItemId] || [];\r\n for (const childId of childrenIds) {\r\n disableEnable(childId);\r\n }\r\n }\r\n };\r\n disableEnable(flowItemId);\r\n dispatch(updateFlowShouldValidate(state.selected.flow, false));\r\n };\r\n\r\n//begin - flow-export-distribution-platforms\r\nexport const requestFlowExportDestinationPartners = (destinationId: number) => (dispatch: Dispatch) => {\r\n const url = \"/SingleView2/GetFlowExportDestinationPartners?destinationId=\" + destinationId;\r\n\r\n dispatch(incAjaxCount());\r\n fetch(url, { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n dispatch({\r\n type: \"UPDATE_DESTINATION_PARTNERS\",\r\n destinationId,\r\n destinationPartners: data.partners,\r\n });\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error\", error);\r\n });\r\n};\r\n\r\nexport const addExportDistributionPlatform = (flowItemId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const thisFlowItem: ?FlowItem = state.flowItems.byId[flowItemId];\r\n if (thisFlowItem == null) {\r\n return;\r\n }\r\n\r\n const thing: FlowExportDistributionPlatform = {\r\n FlowExportDistributionPlatformId: 0,\r\n FlowItemId: flowItemId,\r\n ContactName: \"\",\r\n ContactEmail: \"\",\r\n DestinationID: \"\",\r\n CPM: \"\",\r\n PartnerId: 0,\r\n };\r\n dispatch(addThing(\"flowExportDistributionPlatforms\", thing));\r\n dispatch(setHasUnsavedChanges());\r\n};\r\n\r\nexport const deleteFlowExportDistributionPlatform = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowExportDistributionPlatforms\", id));\r\n};\r\n\r\nexport const clearFlowExportDistributionPlatforms =\r\n (flowItemId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const allDistributionPlatforms = getFlowExportDistributionPlatformsArray(state);\r\n const distributionPlatforms = allDistributionPlatforms.filter(x => x.FlowItemId == flowItemId);\r\n for (const distributionPlatform of distributionPlatforms) {\r\n dispatch(deleteFlowExportDistributionPlatform(distributionPlatform.FlowExportDistributionPlatformId));\r\n }\r\n };\r\n//end flow-export-distribution-platforms\r\n\r\nexport const clearFlowExportDestinationVariables =\r\n (flowItemId: number, destinationId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState(); //const flowItemClientVariables = getFlowItemClientVariablesForSelectedFlow(state);\r\n const flowItemCVs = getFlowItemClientVariablesForSelectedFlow(state);\r\n const flowItemClientVariables = flowItemCVs\r\n .filter((value, index, self) => self.findIndex(v => v.VariableId === value.VariableId) === index)\r\n //.filter(x => x.FlowItemId == parentRelation.ParentFlowItemId)\r\n .map(item => {\r\n const container = {};\r\n container.FlowItemClientVariableId = 0;\r\n container.VariableId = item.VariableId;\r\n container.FlowId = item.FlowId;\r\n container.FlowItemId = item.FlowItemId;\r\n container.ChildFlowItemId = null;\r\n return container;\r\n });\r\n if (!state.flowExportObjects.destinationVariables[destinationId]) {\r\n return;\r\n }\r\n const destinationVariableIds = state.flowExportObjects.destinationVariables[destinationId].map(\r\n x => x.VariableId\r\n );\r\n\r\n for (const id of destinationVariableIds) {\r\n const destClientVariables = flowItemClientVariables.filter(\r\n x => x.FlowItemId == flowItemId && x.VariableId == id\r\n );\r\n for (const clientVariable of destClientVariables) {\r\n dispatch(deleteFlowItemClientVariable(clientVariable.FlowItemClientVariableId));\r\n }\r\n }\r\n };\r\n\r\nexport const requestAllFlowExportDestinationOffers = (flowId: number) => (dispatch: Dispatch) => {\r\n const url = \"/ClientVariable/GetAllDestinationOfferCodes?flowId=\" + flowId;\r\n dispatch(incAjaxCount());\r\n request(url, { credentials: \"same-origin\" }, dispatch)\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n if (data) {\r\n if (data.destinationOffers) {\r\n data.destinationOffers.forEach(x => {\r\n dispatch({\r\n type: \"UPDATE_DESTINATION_OFFERS\",\r\n destinationId: x.DestinationId,\r\n destinationOffers: x.offers,\r\n });\r\n });\r\n }\r\n\r\n if (data.destinationVariables) {\r\n data.destinationVariables.forEach(x => {\r\n dispatch({\r\n type: \"UPDATE_DESTINATION_VARIABLES\",\r\n destinationId: x.DestinationId,\r\n destinationVariables: x.variables,\r\n });\r\n });\r\n }\r\n }\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error\", error);\r\n });\r\n};\r\nexport const requestFlowExportDestinationOffers = (destinationId: number) => (dispatch: Dispatch) => {\r\n const url = \"/ClientVariable/GetDestinationOfferCodes?destinationId=\" + destinationId;\r\n dispatch(incAjaxCount());\r\n fetch(url, { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n dispatch({\r\n type: \"UPDATE_DESTINATION_OFFERS\",\r\n destinationId,\r\n destinationOffers: data.destinationOffers,\r\n });\r\n dispatch({\r\n type: \"UPDATE_DESTINATION_VARIABLES\",\r\n destinationId,\r\n destinationVariables: data.destinationVariables,\r\n });\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error\", error);\r\n });\r\n};\r\n\r\nexport const clearFlowItemSVDedupes = (flowItemId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const flowSVDedupesArray = getFlowSVDedupesArray(state);\r\n const flowItemSVDedupes = flowSVDedupesArray.filter(x => x.FlowItemId == flowItemId);\r\n for (const flowSVDedupe of flowItemSVDedupes) {\r\n dispatch(deleteFlowSVDedupe(flowSVDedupe.FlowSVDedupeId));\r\n }\r\n};\r\n\r\nexport const clearFlowExportOfferMerges = (flowItemId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const flowOfferMergesArray = getFlowOfferMergesArray(state);\r\n const flowItemOfferMerges = flowOfferMergesArray.filter(x => x.FlowItemId == flowItemId);\r\n for (const offerMerge of flowItemOfferMerges) {\r\n dispatch(deleteFlowOfferMerge(offerMerge.FlowOfferMergeId, false));\r\n }\r\n};\r\n\r\nexport const updateFlowScriptAppendText = (appendText: string) => ({\r\n type: \"UPDATE_FLOW_SCRIPT_APPEND_TEXT\",\r\n appendText,\r\n});\r\n\r\n//begin flow-export-pivot-labels\r\n\r\nexport const addFlowRelationParentLabel = (flowRelationId: number, parentLabel: string) => (dispatch: Dispatch) => {\r\n const thing: FlowRelationParentLabel = {\r\n FlowRelationParentLabelId: 0,\r\n FlowRelationId: flowRelationId,\r\n ParentLabel: parentLabel,\r\n };\r\n dispatch(addThing(\"flowRelationParentLabels\", thing));\r\n dispatch(setHasUnsavedChanges());\r\n};\r\n\r\nexport const deleteFlowRelationParentLabel = (id: number) => (dispatch: Dispatch) => {\r\n dispatch(_deleteThing(\"flowRelationParentLabels\", id));\r\n};\r\n\r\nexport const clearFlowRelationParentLabels = (flowItemId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const allFlowRelations = getFlowRelationsArray(state);\r\n const flowRelationParentLabels = getFlowRelationsParentLabelsArray(state);\r\n\r\n const parentRelationsIds = allFlowRelations.filter(x => x.ChildFlowItemId == flowItemId).map(x => x.FlowRelationId);\r\n const flowRelationParentLabelsToDelete = flowRelationParentLabels.filter(x =>\r\n parentRelationsIds.includes(x.FlowRelationId)\r\n );\r\n for (const parentLabel of flowRelationParentLabelsToDelete) {\r\n dispatch(deleteFlowRelationParentLabel(parentLabel.FlowRelationParentLabelId));\r\n }\r\n};\r\n\r\n//end flow-export-pivot-labels\r\n\r\n//begin field-filters-on-demand\r\nimport tryParseJSON from \"../helpers/tryParseJSON\";\r\nimport getFieldIdsFromRules from \"../helpers/getFieldIdsFromRules\";\r\nexport const requestFlowFieldFilters = (flowId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const fieldFilters = state.filters;\r\n const existingFilters = fieldFilters.map(f => f.id);\r\n\r\n let flowFieldIds = getFlowFieldIds(flowId, state);\r\n const fieldIdsNeeded = flowFieldIds.filter(x => !existingFilters.includes(x));\r\n\r\n //request any missing filter\r\n if (fieldIdsNeeded.length > 0) {\r\n dispatch(requestFieldFilters(fieldIdsNeeded));\r\n }\r\n};\r\n\r\nexport const getFlowFieldIds = (flowId: number, state: any) => {\r\n const flowItems = getFlowItemsArray(state);\r\n const thisFlowItems = flowItems.filter(f => f.FlowId == flowId);\r\n\r\n let fieldIds: Array = [];\r\n //flow items that contain query builder\r\n const filters = thisFlowItems.filter(f => f.FlowItemType == \"filter\");\r\n const cases = thisFlowItems.filter(f => f.FlowItemType == \"case\");\r\n const reports = thisFlowItems.filter(f => f.FlowItemType == \"report\");\r\n\r\n const flowFiltersById = getFlowFiltersByFlowItemId(state);\r\n for (const filter of filters) {\r\n const filterItem = flowFiltersById[filter.FlowItemId];\r\n const filterFields = getFlowFilterFieldIds(filterItem);\r\n if (filterFields.length > 0) {\r\n fieldIds = fieldIds.concat(filterFields);\r\n }\r\n }\r\n const flowCasesByItemId = getFlowCasesByFlowItemId(state);\r\n for (const flowCase of cases) {\r\n const caseItems = flowCasesByItemId[flowCase.FlowItemId];\r\n const caseFields = getFlowCaseFieldIds(caseItems);\r\n if (caseFields.length > 0) {\r\n fieldIds = fieldIds.concat(caseFields);\r\n }\r\n }\r\n const flowReportsByFlowItemId = getFlowReportsByFlowItemId(state);\r\n for (const report of reports) {\r\n const reportItem = flowReportsByFlowItemId[report.FlowItemId];\r\n const reportFields = getFlowReportFieldIds(reportItem);\r\n if (reportFields.length > 0) {\r\n fieldIds = fieldIds.concat(reportFields);\r\n }\r\n }\r\n if (fieldIds.length > 0) {\r\n //removes duplicates\r\n fieldIds = Array.from(new Set(fieldIds));\r\n }\r\n return fieldIds;\r\n};\r\n\r\nexport const getFlowFilterFieldIds = (filterItem: FlowFilter): Array => {\r\n if (filterItem && filterItem.FlowFilterCriteria) {\r\n //parse the criteria rules and get the field ids\r\n const rules = tryParseJSON(filterItem.FlowFilterCriteria);\r\n return getFieldIdsFromRules(rules);\r\n } else {\r\n return [];\r\n }\r\n};\r\n\r\nexport const getFlowReportFieldIds = (reportItem: FlowReport): Array => {\r\n if (reportItem && reportItem.FlowReportCriteria) {\r\n //parse the criteria rules and get the field ids\r\n const rules = tryParseJSON(reportItem.FlowReportCriteria);\r\n return getFieldIdsFromRules(rules);\r\n } else {\r\n return [];\r\n }\r\n};\r\n\r\nexport const getFlowCaseFieldIds = (caseItems: Array): Array => {\r\n let caseFields: Array = [];\r\n if (caseItems) {\r\n for (const caseItem of caseItems) {\r\n if (!caseItem.IsBalance && caseItem.FlowCaseCriteria) {\r\n //parse the criteria rules and get the field ids\r\n const rules = tryParseJSON(caseItem.FlowCaseCriteria);\r\n caseFields = caseFields.concat(getFieldIdsFromRules(rules));\r\n }\r\n }\r\n }\r\n return caseFields;\r\n};\r\n//end field-filters-on-demand\r\n\r\n//Copy/Paste a node\r\nexport const updateClipboardNodes = (clipboardNodes: Array) => ({\r\n type: \"SET_CLIPBOARD_NODES\",\r\n clipboardNodes,\r\n});\r\n//Selection Mode on Flow Canvas\r\nexport const toggleSelectionMode = (selectionMode: boolean) => ({\r\n type: \"SET_SELECTION_MODE\",\r\n selectionMode,\r\n});\r\n\r\nexport const updateClipboardRelations = (clipboardRelations: Array) => ({\r\n type: \"SET_CLIPBOARD_RELATIONS\",\r\n clipboardRelations,\r\n});\r\n\r\nexport const nextMultiDestinationTab = (multiDestinationTab: number) => ({\r\n type: \"SET_MULTI_DESTINATION_TAB\",\r\n multiDestinationTab,\r\n});\r\n\r\nexport const setBackupList = (backupList: Array) => ({\r\n type: \"SET_BACKUP_LIST\",\r\n backupList,\r\n});\r\n\r\nexport const UrlIdForSimpleFlow = (previousUrlIdForSimpleFlow: number) => ({\r\n type: \"SET_PREVIOUS_URL_ID_SIMPLE_FLOW\",\r\n previousUrlIdForSimpleFlow,\r\n});\r\n\r\nexport const returnToDashboardForSimpleFlow = (returnToDashboard: number) => ({\r\n type: \"SET_DASHBOARD_STATUS\",\r\n returnToDashboard,\r\n});\r\n\r\nexport const simpleFlowOverrideToDesign = (willOverride: boolean) => ({\r\n type: \"SET_REDIRECT_OVERRIDE_SIMPLE_FLOW\",\r\n overrideSimpleFlowRedirect: willOverride,\r\n});\r\n\r\n//start flow-bulk-actions\r\nexport const flowMultiSelectionAdd = (flowId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n //check if flow has already been loaded, if not, load it, needed for execute validation!\r\n const flowItems = getFlowItemsArray(state);\r\n if (flowId > 0 && flowItems.filter(x => x.FlowId == flowId).length <= 0) {\r\n dispatch(requestFlow(flowId));\r\n }\r\n\r\n dispatch({\r\n type: \"FLOW_MULTI_SELECTION_ADD\",\r\n flowId,\r\n });\r\n};\r\n\r\nexport const flowMultiSelectToggle = (isMultiSelectOn: boolean) => ({\r\n type: \"FLOW_MULTI_SELECTION_TOGGLE\",\r\n isMultiSelectOn,\r\n});\r\n\r\nexport const flowMultiSelectionRemove = (flowId: number) => ({\r\n type: \"FLOW_MULTI_SELECTION_REMOVE\",\r\n flowId,\r\n});\r\n\r\nexport const flowMultiSelectionClear = () => ({\r\n type: \"FLOW_MULTI_SELECTION_CLEAR\",\r\n});\r\n\r\nexport const requestMoveFlowsToFolder =\r\n (flowIds: Array, folderId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const userId = state.session.userId;\r\n const folders = state.folders.flowFolders;\r\n const flowsById = state.flows.byId;\r\n\r\n const flowsArray: Array = Object.values(flowsById);\r\n const selectedFlows = flowsArray.filter(x => flowIds.includes(x.FlowId));\r\n const folder = searchTree(folders, folderId);\r\n if (!folder || !selectedFlows) {\r\n return;\r\n }\r\n\r\n if (folder.isHistorical) {\r\n if (folder.userId != 0 || selectedFlows.filter(x => !x.IsLockedPermanently).length > 0) {\r\n h.error(\"Cannot move flows not locked into a historical folder.\");\r\n return;\r\n }\r\n } else if (selectedFlows.filter(x => x.FlowCreatedBy != userId || x.IsLockedPermanently).length) {\r\n h.error(\"Cannot move another user's flows.\");\r\n return;\r\n }\r\n\r\n // Optimistic update, first update client side only\r\n for (const flow of selectedFlows) {\r\n dispatch(updateAttribute(\"flows\", flow.FlowId, \"FlowFolderId\", folderId));\r\n }\r\n // do the request only for ids that exist in the db\r\n const idsToUpdate = flowIds.filter(x => x > 0);\r\n\r\n if (idsToUpdate.length <= 0) {\r\n return;\r\n }\r\n dispatch(flowMultiSelectionClear());\r\n\r\n // Then make request to server\r\n dispatch(incAjaxCount());\r\n const moveUrl = \"/Flows/MoveFlows\";\r\n\r\n fetch(moveUrl, {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n headers: {\r\n Accept: \"application/json\",\r\n \"Content-Type\": \"application/json\",\r\n },\r\n body: JSON.stringify({\r\n flowIds: idsToUpdate,\r\n folderId,\r\n }),\r\n })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(() => {\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error moving flows\", error);\r\n });\r\n };\r\n\r\nexport const requestProcessSelectedFlows = () => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const selectedFlows = state.flowMultiSelection.selectedFlowIds;\r\n const flowIds = selectedFlows.filter(x => x > 0);\r\n for (const flowId of flowIds) {\r\n dispatch(setFlowItemsIsRunning(flowId, FlowIsRunning.CLIENTSUBMITTED));\r\n }\r\n dispatch(flowMultiSelectionClear());\r\n\r\n dispatch(incAjaxCount());\r\n fetch(`/Flows/ClearAndProcessMultipleFlows`, {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n headers: {\r\n Accept: \"application/json\",\r\n \"Content-Type\": \"application/json\",\r\n },\r\n body: JSON.stringify({\r\n flowIds,\r\n }),\r\n })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n if (!data.result) {\r\n for (const flowId of flowIds) {\r\n dispatch(setFlowItemsIsRunning(flowId, FlowIsRunning.IDLE));\r\n }\r\n if (data.error) {\r\n h.error(data.error);\r\n } else {\r\n throw new Error(\"Error calculating flows.\");\r\n }\r\n } else {\r\n dispatch(notifyGreen(\"Flows submitted successfully.\"));\r\n }\r\n\r\n const flowItems = getFlowItemsArray(getState());\r\n const checkToCloud = flowItems.filter(x => flowIds.includes(x.FlowId) && x.FlowItemType == \"toCloud\");\r\n if (checkToCloud.length > 0) {\r\n dispatch(resetCloudFlowObjects());\r\n }\r\n\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error calculating flows.\", error);\r\n });\r\n};\r\n\r\nexport const requestDeleteSelectedFlows = () => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const selectedFlow = state.selected.flow;\r\n const selectedFlows = state.flowMultiSelection.selectedFlowIds;\r\n const flowIds = selectedFlows.filter(x => x > 0);\r\n\r\n dispatch(incAjaxCount());\r\n // Local updates\r\n if (flowIds.includes(selectedFlow)) {\r\n dispatch(setSelectedFlowNoUnsavedCheck(-1));\r\n }\r\n //not sure why this is needed, just replicating what we currently do for a single delete\r\n dispatch(flowMultiSelectionClear());\r\n for (const flowId of flowIds) {\r\n dispatch(updateAttribute(\"flows\", flowId, \"hasUnsavedChanges\", false));\r\n dispatch(deleteFlow(flowId));\r\n }\r\n\r\n // Server request\r\n return fetch(\"/Flows/DeleteFlows\", {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n headers: {\r\n Accept: \"application/json\",\r\n \"Content-Type\": \"application/json\",\r\n },\r\n body: JSON.stringify({\r\n flowIds,\r\n }),\r\n })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n if (!data.result) {\r\n if (data.error) {\r\n h.error(data.error);\r\n throw new Error(data.error);\r\n } else {\r\n throw new Error(\"Error deleting flows.\");\r\n }\r\n }\r\n dispatch(notifyGreen(\"Flows have been subbmitted to delete.\"));\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error deleting flows\", error);\r\n throw new Error(\"Error deleting flows.\");\r\n });\r\n};\r\n\r\nexport const finalizeFlowDataLoads = (flowId: number) => (dispatch: Dispatch) => {\r\n dispatch(incAjaxCount());\r\n dispatch(updateAttribute(\"flows\", flowId, \"isSaving\", true));\r\n // Server request\r\n return fetch(\"/Flows/ProcessFlowDataLoads\", {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n headers: {\r\n Accept: \"application/json\",\r\n \"Content-Type\": \"application/json\",\r\n },\r\n body: JSON.stringify({\r\n flowId,\r\n }),\r\n })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n dispatch(updateAttribute(\"flows\", flowId, \"isSaving\", false));\r\n if (!data.success) {\r\n if (data.error) {\r\n h.error(data.error);\r\n throw new Error(data.error);\r\n } else {\r\n throw new Error(\"Error finalizing dataloads.\");\r\n }\r\n }\r\n dispatch(notifyGreen(\"Data loads are being processed.\"));\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n dispatch(updateAttribute(\"flows\", flowId, \"isSaving\", false));\r\n h.error(\"Error finalizing dataloads.\", error);\r\n throw new Error(\"Error finalizing dataloads.\");\r\n });\r\n};\r\n\r\n//end flow-bulk-actions\r\n\r\nexport const requestSubmitModels = (flowId: number) => (dispatch: Dispatch) => {\r\n const url = \"/Flows/SubmitModels\";\r\n dispatch(updateAttribute(\"flows\", flowId, \"isSaving\", true));\r\n\r\n fetch(url, {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n body: JSON.stringify({\r\n flowId,\r\n }),\r\n })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n dispatch(updateAttribute(\"flows\", flowId, \"isSaving\", false));\r\n if (data.result) {\r\n dispatch(notifyGreen(\"Models have been requested successfully.\"));\r\n } else {\r\n h.error(\"Error submitting flow models.\");\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(updateAttribute(\"flows\", flowId, \"isSaving\", false));\r\n h.error(\"Error submitting flow models.\", error);\r\n });\r\n};\r\n\r\n//update local status for isLoadingFlowData only if the flow exists in state!!\r\nexport const updateIsLoadingFlowData =\r\n (flowId: number, isLoadingFlowData: boolean) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const flow: ?Flow = state.flows.byId[flowId];\r\n\r\n if (flow == null) return;\r\n dispatch(updateAttribute(\"flows\", flowId, \"isLoadingFlowData\", isLoadingFlowData));\r\n };\r\n\r\nexport const requestFlowScriptKeywords = () => (dispatch: Dispatch) => {\r\n dispatch({ type: \"LOAD_FLOW_SCRIPT_KEYWORDS\", keywords: [] });\r\n\r\n fetch(\"/Scripts/GetScriptKeywords\", {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n dispatch({ type: \"LOAD_FLOW_SCRIPT_KEYWORDS\", keywords: data.keywords });\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading autocomplete keywords.\", error);\r\n });\r\n};\r\n\r\nexport const syncFlowOffloadColumns =\r\n (flowItemId: number, tableName: string) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const offloadColumnsByItemId = getFlowOffloadColumnsByFlowItemId(state);\r\n const tableColumns = state.flowItemResultTables.tableColumns[tableName] || [];\r\n const columnNames = tableColumns.map(x => x.ColumnName);\r\n const currentColumns = offloadColumnsByItemId[flowItemId] || [];\r\n let currentColumns2 = [...currentColumns];\r\n let needToChange = false;\r\n let nOrder = 1;\r\n let chgType = 0;\r\n\r\n tableColumns.forEach((element, index) => {\r\n let isDeployed = true;\r\n let nLength = 0;\r\n let nSortOrder = 0;\r\n if (index + 1 <= currentColumns2.length) {\r\n if (element.ColumnName != currentColumns2[index].ColumnName) {\r\n needToChange = true;\r\n chgType = 3;\r\n if (currentColumns2.find(y => y.ColumnName == element.ColumnName)) {\r\n const tmpColumn = currentColumns2.filter(x => x.ColumnName == element.ColumnName)[0];\r\n isDeployed = tmpColumn.DeployColumn;\r\n nLength = tmpColumn.ColumnLength;\r\n nSortOrder = tmpColumn.SortOrdinance > 0 ? tmpColumn.SortOrdinance : 0;\r\n }\r\n\r\n const thing = {\r\n FlowOffloadColumnId: 0,\r\n FlowItemId: flowItemId,\r\n FlowItem: null,\r\n ColumnName: element.ColumnName,\r\n DeployColumn: isDeployed,\r\n ColumnLength: nLength > 0 ? nLength : element.MaxLength > 0 ? element.MaxLength : 10,\r\n Order: nOrder,\r\n SortOrdinance: nSortOrder,\r\n };\r\n currentColumns2.splice(nOrder - 1, 0, thing);\r\n } else if (currentColumns2[index].Order != nOrder) {\r\n needToChange = true;\r\n chgType = 3;\r\n currentColumns2[index].Order = nOrder;\r\n }\r\n } else {\r\n const thing = {\r\n FlowOffloadColumnId: 0,\r\n FlowItemId: flowItemId,\r\n FlowItem: null,\r\n ColumnName: element.ColumnName,\r\n DeployColumn: isDeployed,\r\n ColumnLength: element.MaxLength > 0 ? element.MaxLength : 10,\r\n Order: nOrder,\r\n SortOrdinance: 0,\r\n };\r\n currentColumns2.splice(nOrder - 1, 0, thing);\r\n needToChange = true;\r\n chgType = 2;\r\n }\r\n nOrder++;\r\n });\r\n\r\n if (currentColumns2.length <= tableColumns.length) {\r\n currentColumns2.splice(nOrder - 1, tableColumns.length);\r\n } else {\r\n needToChange = true;\r\n if (chgType >= 2) {\r\n chgType = 3;\r\n } else {\r\n chgType = 1;\r\n }\r\n currentColumns2.splice(nOrder - 1, currentColumns2.length - tableColumns.length);\r\n }\r\n\r\n if (needToChange) {\r\n if (chgType == 3) {\r\n for (const col of currentColumns) {\r\n dispatch(deleteFlowOffloadColumn(col.FlowOffloadColumnId));\r\n }\r\n nOrder = 1;\r\n for (const col of currentColumns2) {\r\n dispatch(\r\n newFlowOffloadColumn(\r\n flowItemId,\r\n col.ColumnName,\r\n nOrder++,\r\n col.ColumnLength,\r\n col.DeployColumn,\r\n col.SortOrdinance\r\n )\r\n );\r\n }\r\n } else if (chgType == 2) {\r\n const columnsToAdd = tableColumns.filter(x => !currentColumns.find(y => y.ColumnName == x.ColumnName));\r\n if (columnsToAdd.length > 0) {\r\n let order =\r\n currentColumns && currentColumns.length > 0\r\n ? currentColumns[currentColumns.length - 1].Order + 1\r\n : 1;\r\n\r\n for (const col of columnsToAdd) {\r\n dispatch(newFlowOffloadColumn(flowItemId, col.ColumnName, order++, col.MaxLength));\r\n }\r\n }\r\n } else if (chgType == 1) {\r\n const columnsToDelete = currentColumns.filter(x => !columnNames.includes(x.ColumnName));\r\n\r\n if (columnsToDelete.length > 0) {\r\n for (const col of columnsToDelete) {\r\n dispatch(deleteFlowOffloadColumn(col.FlowOffloadColumnId));\r\n }\r\n }\r\n }\r\n }\r\n };\r\n\r\nexport const setHasUnsavedLayoutChanges =\r\n (newHasUnsavedLayoutChanges: boolean = true) =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const flowId: number = state.selected.flow;\r\n const flow: ?Flow = state.flows.byId[flowId];\r\n if (flow != null && flow.hasUnsavedLayoutChanges != newHasUnsavedLayoutChanges) {\r\n dispatch(updateAttribute(\"flows\", flowId, \"hasUnsavedLayoutChanges\", newHasUnsavedLayoutChanges));\r\n }\r\n };\r\n\r\n// General list of prefixesAndEntities, used in generic flowtype functions.\r\n// Keep this at the bottom so the references to the deleteAc functions are defined.\r\nconst prefixesAndEntities = [\r\n {\r\n actionPrefix: \"FLOW\",\r\n stateKey: \"flows\",\r\n id: \"FlowId\",\r\n flowItemType: \"\",\r\n deleteAc: id => {\r\n console.error(\"There's no AC to delete a flow\"); // eslint-disable-line no-console\r\n return { type: \"CANNOT_DELETE_FLOW_\" + id };\r\n }, // lol. Don't use this!\r\n },\r\n { actionPrefix: \"FLOW_ITEM\", stateKey: \"flowItems\", id: \"FlowItemId\", flowItemType: \"\", deleteAc: deleteFlowItem },\r\n {\r\n actionPrefix: \"FLOW_RELATION\",\r\n stateKey: \"flowRelations\",\r\n id: \"FlowRelationId\",\r\n flowItemType: \"\",\r\n deleteAc: deleteFlowRelation,\r\n },\r\n {\r\n actionPrefix: \"FLOW_FILTER\",\r\n stateKey: \"flowFilters\",\r\n id: \"FlowFilterId\",\r\n flowItemType: \"filter\",\r\n deleteAc: deleteFlowFilter,\r\n },\r\n {\r\n actionPrefix: \"FLOW_SCRIPT\",\r\n stateKey: \"flowScripts\",\r\n id: \"FlowScriptId\",\r\n flowItemType: \"script\",\r\n deleteAc: deleteFlowScript,\r\n },\r\n {\r\n actionPrefix: \"FLOW_SCRIPT_DBUI\",\r\n stateKey: \"flowScriptsDBUI\",\r\n id: \"FlowScriptDBUIId\",\r\n flowItemType: \"scriptdbui\",\r\n deleteAc: deleteFlowScriptDBUI,\r\n },\r\n {\r\n actionPrefix: \"FLOW_SCRIPT_RESULT\",\r\n stateKey: \"flowScriptResults\",\r\n id: \"FlowScriptResultId\",\r\n flowItemType: \"ScriptResult\",\r\n deleteAc: deleteFlowScriptResult,\r\n },\r\n {\r\n actionPrefix: \"FLOW_SCRIPT_RESULTS_HISTORY\",\r\n stateKey: \"flowScriptResultsHistory\",\r\n id: \"FlowScriptResultId\",\r\n flowItemType: \"ScriptResultsHistory\",\r\n deleteAc: null,\r\n },\r\n {\r\n actionPrefix: \"FLOW_DATA_LOAD\",\r\n stateKey: \"flowDataLoads\",\r\n id: \"FlowDataLoadId\",\r\n flowItemType: \"dataload\",\r\n deleteAc: deleteFlowDataLoad,\r\n },\r\n {\r\n actionPrefix: \"FLOW_DATA_LOAD_COLUMN\",\r\n stateKey: \"flowDataLoadColumns\",\r\n id: \"FlowDataLoadColumnId\",\r\n flowItemType: \"FlowDataLoadColumn\",\r\n deleteAc: deleteFlowDataLoadColumn,\r\n },\r\n {\r\n actionPrefix: \"FLOW_MULTI_EXPORT\",\r\n stateKey: \"flowMultiExports\",\r\n id: \"FlowMultiExportId\",\r\n flowItemType: \"multiexport\",\r\n deleteAc: deleteFlowMultiExport,\r\n },\r\n {\r\n actionPrefix: \"FLOW_EXPORT\",\r\n stateKey: \"flowExports\",\r\n id: \"FlowExportId\",\r\n flowItemType: \"export\",\r\n deleteAc: deleteFlowExport,\r\n },\r\n {\r\n actionPrefix: \"FLOW_OUTPUT\",\r\n stateKey: \"flowOutputs\",\r\n id: \"FlowOutputId\",\r\n flowItemType: \"output\",\r\n deleteAc: deleteFlowOutput,\r\n },\r\n {\r\n actionPrefix: \"FLOW_SINGLE_VIEW\",\r\n stateKey: \"flowSingleViews\",\r\n id: \"FlowSingleViewId\",\r\n flowItemType: \"singleview\",\r\n deleteAc: deleteFlowSingleView,\r\n },\r\n {\r\n actionPrefix: \"FLOW_FROM_CLOUD\",\r\n stateKey: \"flowFromClouds\",\r\n id: \"FlowFromCloudId\",\r\n flowItemType: \"fromCloud\",\r\n deleteAc: deleteFlowFromCloud,\r\n },\r\n {\r\n actionPrefix: \"FLOW_TO_CLOUD\",\r\n stateKey: \"flowToClouds\",\r\n id: \"FlowToCloudId\",\r\n flowItemType: \"toCloud\",\r\n deleteAc: deleteFlowToCloud,\r\n },\r\n {\r\n actionPrefix: \"FLOW_SVDEDUPE\",\r\n stateKey: \"flowSVDedupes\",\r\n id: \"FlowSVDedupeId\",\r\n flowItemType: \"svDedupe\",\r\n deleteAc: deleteFlowSVDedupe,\r\n },\r\n {\r\n actionPrefix: \"FLOW_MERGE\",\r\n stateKey: \"flowMerges\",\r\n id: \"FlowMergeId\",\r\n flowItemType: \"merge\",\r\n deleteAc: deleteFlowMerge,\r\n },\r\n {\r\n actionPrefix: \"FLOW_OFFER_MERGE\",\r\n stateKey: \"flowOfferMerges\",\r\n id: \"FlowOfferMergeId\",\r\n flowItemType: \"offerMerge\",\r\n deleteAc: deleteFlowOfferMerge,\r\n },\r\n {\r\n actionPrefix: \"FLOW_REPORT\",\r\n stateKey: \"flowReports\",\r\n id: \"FlowReportId\",\r\n flowItemType: \"report\",\r\n deleteAc: deleteFlowReport,\r\n },\r\n {\r\n actionPrefix: \"FLOW_MODEL\",\r\n stateKey: \"flowModels\",\r\n id: \"FlowModelId\",\r\n flowItemType: \"model\",\r\n deleteAc: deleteFlowModel,\r\n },\r\n {\r\n actionPrefix: \"FLOW_EXPORT_REPORT\",\r\n stateKey: \"flowExportReports\",\r\n id: \"FlowExportReportId\",\r\n flowItemType: \"exportreport\",\r\n deleteAc: deleteFlowExportReport,\r\n },\r\n {\r\n actionPrefix: \"FLOW_CANNED_REPORT\",\r\n stateKey: \"flowCannedReports\",\r\n id: \"FlowCannedReportId\",\r\n flowItemType: \"cannedreport\",\r\n deleteAc: deleteFlowCannedReport,\r\n },\r\n {\r\n actionPrefix: \"FLOW_SPLIT\",\r\n stateKey: \"flowSplits\",\r\n id: \"FlowSplitId\",\r\n flowItemType: \"split\",\r\n deleteAc: deleteFlowSplit,\r\n },\r\n {\r\n actionPrefix: \"FLOW_CASE\",\r\n stateKey: \"flowCases\",\r\n id: \"FlowCaseId\",\r\n flowItemType: \"case\",\r\n deleteAc: deleteFlowCase,\r\n },\r\n {\r\n actionPrefix: \"FLOW_EMPTY\",\r\n stateKey: \"flowEmpties\",\r\n id: \"FlowEmptyId\",\r\n flowItemType: \"empty\",\r\n deleteAc: deleteFlowEmpty,\r\n },\r\n {\r\n actionPrefix: \"FLOW_CLIENT_VARIABLE\",\r\n stateKey: \"flowClientVariables\",\r\n id: \"Id\",\r\n flowItemType: \"FlowClientVariableD\",\r\n deleteAc: deleteFlowClientVariable,\r\n },\r\n {\r\n actionPrefix: \"FLOW_ITEM_CLIENT_VARIABLE\",\r\n stateKey: \"flowItemClientVariables\",\r\n id: \"FlowItemClientVariableId\",\r\n flowItemType: \"FlowItemClientVariableD\",\r\n deleteAc: deleteFlowItemClientVariable,\r\n },\r\n {\r\n actionPrefix: \"FLOW_ENDPOINT\",\r\n stateKey: \"flowItemEndpoints\",\r\n id: \"Id\",\r\n flowItemType: \"FlowItemEndpoint\",\r\n deleteAc: deleteFlowItemEndpoint,\r\n },\r\n {\r\n actionPrefix: \"FLOW_ITEM_OFFER_CODE\",\r\n stateKey: \"flowItemOfferCodes\",\r\n id: \"FlowItemOfferCodeId\",\r\n flowItemType: \"FlowItemOfferCode\",\r\n deleteAc: deleteFlowItemOfferCode,\r\n },\r\n //begin - flow-export-distribution-platforms\r\n {\r\n actionPrefix: \"FLOW_EXPORT_DISTRIBUTION_PLATFORM\",\r\n stateKey: \"flowExportDistributionPlatforms\",\r\n id: \"FlowExportDistributionPlatformId\",\r\n flowItemType: \"FlowExportDistributionPlatform\",\r\n deleteAc: deleteFlowExportDistributionPlatform,\r\n },\r\n //end - flow-export-distribution-platforms\r\n //\r\n //begin flow-export-pivot-labels\r\n {\r\n actionPrefix: \"FLOW_RELATION_PARENT_LABEL\",\r\n stateKey: \"flowRelationParentLabels\",\r\n id: \"FlowRelationParentLabelId\",\r\n flowItemType: \"\",\r\n deleteAc: deleteFlowRelationParentLabel,\r\n },\r\n //end flow-export-pivot-labels\r\n //\r\n // begin - flow-tool-offload\r\n {\r\n actionPrefix: \"FLOW_OFFLOAD\",\r\n stateKey: \"flowOffloads\",\r\n id: \"FlowOffloadId\",\r\n flowItemType: \"offload\",\r\n deleteAc: deleteFlowOffload,\r\n },\r\n {\r\n actionPrefix: \"FLOW_OFFLOAD_COLUMN\",\r\n stateKey: \"flowOffloadColumns\",\r\n id: \"FlowOffloadColumnId\",\r\n flowItemType: \"FlowOffloadColumn\",\r\n deleteAc: deleteFlowOffloadColumn,\r\n },\r\n // end - flow-tool-offload\r\n {\r\n actionPrefix: \"FLOW_GUIDE_SETTINGS\",\r\n stateKey: \"flowGuideSettings\",\r\n id: \"FlowGuideId\",\r\n flowItemType: \"FlowGuideSetting\",\r\n deleteAc: id => {\r\n console.error(\"There's no AC to delete a flow guide setting\"); // eslint-disable-line no-console\r\n return { type: \"CANNOT_DELETE_FLOW_GUIDE_SETTING\" + id };\r\n }, // should not need a delete\r\n },\r\n {\r\n actionPrefix: \"FLOW_SEGMENT_SPLIT\",\r\n stateKey: \"flowSegmentSplits\",\r\n id: \"SegmentSplitId\",\r\n flowItemType: \"FlowSegmentSplit\",\r\n deleteAc: deleteFlowSegmentSplit,\r\n },\r\n {\r\n actionPrefix: \"FLOW_SEGMENT_SPLIT_OFFER\",\r\n stateKey: \"flowSegmentSplitOffers\",\r\n id: \"SegmentSplitOfferId\",\r\n flowItemType: \"FlowSegmentSplitOffer\",\r\n deleteAc: deleteFlowSegmentSplitOffer,\r\n },\r\n {\r\n actionPrefix: \"FLOW_EXPORT_TEMPLATE_FIELDS\",\r\n stateKey: \"flowExportTemplateFields\",\r\n id: \"FlowExportTemplateId\",\r\n flowItemType: \"FlowExportTemplateFields\",\r\n deleteAc: deleteFlowExportTemplateFields,\r\n },\r\n {\r\n actionPrefix: \"FLOW_EXPORT_PINTEREST_TEMPLATE_FIELDS\",\r\n stateKey: \"flowExportPinterestTemplateFields\",\r\n id: \"FlowExportTemplateId\",\r\n flowItemType: \"FlowExportPinterestTemplateFields\",\r\n deleteAc: deleteFlowExportPinterestTemplateFields,\r\n },\r\n {\r\n actionPrefix: \"FLOW_EXPORT_TIKTOK_TEMPLATE_FIELDS\",\r\n stateKey: \"flowExportTikTokTemplateFields\",\r\n id: \"FlowExportTemplateId\",\r\n flowItemType: \"FlowExportTikTokTemplateFields\",\r\n deleteAc: deleteFlowExportTikTokTemplateFields,\r\n },\r\n {\r\n actionPrefix: \"FLOW_EXPORT_TRADE_DESK_TEMPLATE_FIELDS\",\r\n stateKey: \"flowExportTradeDeskTemplateFields\",\r\n id: \"FlowExportTemplateId\",\r\n flowItemType: \"FlowExportTradeDeskTemplateFields\",\r\n deleteAc: deleteFlowExportTradeDeskTemplateFields,\r\n },\r\n {\r\n actionPrefix: \"FLOW_EXPORT_PUBMATIC_TEMPLATE_FIELDS\",\r\n stateKey: \"flowExportPubmaticTemplateFields\",\r\n id: \"FlowExportTemplateId\",\r\n flowItemType: \"FlowExportPubmaticTemplateFields\",\r\n deleteAc: deleteFlowExportPubmaticTemplateFields,\r\n },\r\n {\r\n actionPrefix: FREEWHEEL_DRIVER_FILE_FIELDS,\r\n stateKey: \"flowExportFreewheelDriverFileFields\",\r\n id: \"FlowExportFreewheelDriverFileFieldId\",\r\n flowItemType: \"FlowExportFreewheelDriverFileFields\",\r\n deleteAc: deleteFlowExportFreewheelDriverFileFields,\r\n },\r\n {\r\n actionPrefix: \"FLOW_EXPORT_TAXONOMY_FIELDS\",\r\n stateKey: \"flowExportTaxonomyFileFields\",\r\n // id: \"FlowExportTemplateId\",\r\n id: \"FlowExportTaxonomyFileFieldId\",\r\n flowItemType: \"FlowExportTaxonomyFileFields\",\r\n deleteAc: deleteFlowExportTaxonomyFileFields,\r\n },\r\n {\r\n ...xandrDriverFieldsPrefixAndEntity,\r\n },\r\n {\r\n actionPrefix: \"FLOW_EXTERNAL_SERVICE\",\r\n stateKey: \"flowExternalServices\",\r\n id: \"FlowExternalServiceId\",\r\n flowItemType: \"flowControl\",\r\n deleteAc: deleteFlowExternalService,\r\n },\r\n {\r\n actionPrefix: \"FLOW_EXTERNAL_SERVICE_PARAMETER\",\r\n stateKey: \"flowExternalServiceParameters\",\r\n id: \"FlowServiceParameterId\",\r\n flowItemType: \"FlowExternalServiceParameter\",\r\n deleteAc: deleteFlowExternalServiceParameter,\r\n },\r\n {\r\n actionPrefix: \"FLOW_EXPRESSION\",\r\n stateKey: \"flowExpressions\",\r\n id: \"FlowExpressionId\",\r\n flowItemType: \"FlowExpression\",\r\n deleteAc: deleteFlowExpression,\r\n },\r\n {\r\n actionPrefix: \"FLOW_EXPRESSION_CONSTRAINT\",\r\n stateKey: \"flowExpressionConstraints\",\r\n id: \"FlowExpressionConstraintId\",\r\n flowItemType: \"FlowExpressionConstraint\",\r\n deleteAc: deleteFlowExpressionConstraint,\r\n },\r\n {\r\n actionPrefix: \"FLOW_DESCRIPTION\",\r\n stateKey: \"flowDescriptions\",\r\n id: \"FlowDescriptionId\",\r\n flowItemType: \"FlowDescription\",\r\n deleteAc: deleteFlowDescription,\r\n },\r\n {\r\n actionPrefix: \"FLOW_EXTERNAL_SERVICE_INPUT\",\r\n stateKey: \"flowExternalServiceInputs\",\r\n id: \"InputId\",\r\n flowItemType: \"FlowExternalServiceInput\",\r\n deleteAc: deleteFlowExternalServiceInput,\r\n },\r\n {\r\n actionPrefix: \"FLOW_EXTERNAL_SERVICE_HARDCODE\",\r\n stateKey: \"flowExternalServiceHardcodes\",\r\n id: \"HardcodeId\",\r\n flowItemType: \"FlowExternalServiceHardcode\",\r\n deleteAc: deleteFlowExternalServiceHardcode,\r\n },\r\n];\r\n\r\nexport const setCanvasInfo = (width: number, height: number, scrollLeft: number, scrollTop: number) => ({\r\n type: \"CYCLONE_SET_CANVAS_INFO\",\r\n width,\r\n height,\r\n scrollLeft,\r\n scrollTop,\r\n});\r\n\r\nexport const setFlowItemRenamingName = (flowItemId: number, renamingName: string) => ({\r\n type: \"SET_FLOW_ITEM_RENAMING_NAME\",\r\n flowItemId,\r\n renamingName,\r\n});\r\n\r\nexport const setFlowItemLayoutErrors = (flowItemLayoutErrors: Array) => ({\r\n type: SET_FLOWITEM_LAYOUT_ERRORS,\r\n flowItemLayoutErrors,\r\n});\r\n","import { Dispatch } from \"../types/types\";\r\nimport { request } from \"../helpers/httpInterceptor\";\r\nimport h from \"../helpers\";\r\nimport { notifyGreen, notifyError } from \"./notifyActions\";\r\nimport { updateAttribute } from \"./flowActions\";\r\nimport {\r\n ISetExternalParameterValues,\r\n ISetFlowControlData,\r\n SET_EXTERNAL_PARAMETER_VALUES,\r\n SET_FLOW_CONTROL_DATA,\r\n} from \"../reducers/flowControlData\";\r\nimport { SET_FLOW_CONTROL_STATUS } from \"../reducers/flowControlStatus\";\r\nimport {\r\n SET_SERVICE_LAYOUT_DATA,\r\n SET_SERVICE_LAYOUT_SAVING,\r\n SET_SERVICE_LAYOUT_SAVING_AS_NEW,\r\n SET_SERVICE_SELECTED_LAYOUT,\r\n SET_IMPORT_LAYOUT_FIELDS,\r\n SET_IMPORT_LAYOUT_IS_FIXED,\r\n SET_EXTERNAL_SERVICE_FIELDS_USED,\r\n SET_EXPORT_LOCKED_OUT,\r\n} from \"../reducers/externalServiceLayoutData\";\r\nimport {\r\n IFlowControlStatus,\r\n IGetFlowControlStatus,\r\n IUEComplianceRequestResult,\r\n ISaveExternalServiceLayoutData,\r\n IFlowControlDataResult,\r\n IExternalServiceLayoutDataResult,\r\n IFieldPerson,\r\n IExternalParameterValue,\r\n} from \"../types/stores/flowControlData\";\r\nimport {\r\n IExternalServiceField,\r\n IExternalServiceLayoutField,\r\n IImportLayoutField,\r\n ISetExternalServiceLayoutData,\r\n ISetExternalServiceLayoutSaving,\r\n ISetExternalServiceLayoutSavingAsNew,\r\n ISetExternalServiceSelectedLayout,\r\n ISetImportLayoutFields,\r\n ISetImportLayoutIsFixed,\r\n ISetExternalServiceFieldsUsed,\r\n ISetExportLockedOut,\r\n} from \"../types/stores/externalServiceLayoutData\";\r\nimport {\r\n IEnrichmentField,\r\n IEnrichmentFieldsItem,\r\n ISetEnrichmentFields,\r\n ISetCurrEnrichmentFields,\r\n ISetSelectedFieldsItem,\r\n ISetIsSearching,\r\n ISetIsLoading,\r\n ISetIsValidating,\r\n IEnrichmentFieldImport,\r\n ISetValidatedFields,\r\n IEnrichmentImportField,\r\n ISetSelectedItemId,\r\n} from \"../types/stores/umbrellaData\";\r\nimport {\r\n SET_ENRICHMENT_FIELDS,\r\n SET_CURR_ENRICHMENT_FIELDS,\r\n SET_SELECTED_FIELDS_ITEM,\r\n SET_IS_SEARCHING,\r\n SET_IS_LOADING,\r\n SET_IS_VALIDATING,\r\n SET_VALIDATED_FIELDS,\r\n SET_SELECTED_ITEMID,\r\n} from \"../reducers/umbrellaData\";\r\nimport { LayoutTypes } from \"../components/layouts-external-service/LayoutBuilder\";\r\nimport { IAppState } from \"../types/stores\";\r\nimport { getFlowExternalServiceForSelectedFlowItem } from \"../reducers/flowExternalServices\";\r\nimport { UEFieldParms } from \"../helpers/constants\";\r\nimport { getFlowExternalServiceParametersForSelectedFlowItem } from \"../reducers/flowExternalServiceParameters\";\r\n\r\nexport const requestFlowControlData =\r\n () =>\r\n (dispatch: Dispatch): void => {\r\n request(\"/FlowControl/GetAllFlowControlData\", { credentials: \"same-origin\" }, dispatch)\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(setFlowControlData(data.flowControlData));\r\n })\r\n .catch(error => {\r\n h.error(\"Error getting flow control data.\", error);\r\n });\r\n };\r\n\r\nexport const requestFlowControlStatusData =\r\n () =>\r\n (dispatch: Dispatch): void => {\r\n dispatch(setFlowControlStatus([], [], [], true));\r\n request(\r\n `/FlowControl/GetFlowControlStatus`,\r\n {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(setFlowControlStatus(data.running, data.completed, data.failed, false));\r\n })\r\n .catch(error => {\r\n h.error(\"Error getting flow control status data.\", error);\r\n });\r\n };\r\n\r\nexport const requestExternalServiceLayoutData =\r\n (companyId: number) =>\r\n (dispatch: Dispatch): void => {\r\n request(\r\n `/FlowControl/GetExternalServiceLayouts?companyId=${companyId}`,\r\n { method: \"POST\", credentials: \"same-origin\" },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(setExternalServiceLayoutData(data.serviceLayouts));\r\n })\r\n .catch(error => {\r\n h.error(\"Error getting service layout data.\", error);\r\n });\r\n };\r\n\r\nexport const requestAddExternalServiceLayout =\r\n (layoutToAdd: ISaveExternalServiceLayoutData, isSaveAsNew: boolean, WFClientCode: string) =>\r\n (dispatch: Dispatch): void => {\r\n if (isSaveAsNew) dispatch(setExternalServiceLayoutSavingAsNew(true));\r\n else dispatch(setExternalServiceLayoutSaving(true));\r\n\r\n const Layout = layoutToAdd.Layout;\r\n const Fields = layoutToAdd.Fields;\r\n\r\n request(\r\n `/FlowControl/SaveLayout`,\r\n {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n body: JSON.stringify({\r\n Layout,\r\n Fields,\r\n WFClientCode,\r\n }),\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data && data.Success) {\r\n dispatch(notifyGreen(\"Successfully saved your layout.\"));\r\n dispatch(requestExternalServiceLayoutData(Layout.CompanyId));\r\n if (layoutToAdd.flowExternalServiceId) {\r\n dispatch(\r\n updateAttribute(\r\n \"flowExternalServices\",\r\n layoutToAdd.flowExternalServiceId,\r\n Layout.LayoutType == LayoutTypes.Input ? \"InputLayoutId\" : \"OutputLayoutId\",\r\n data.LayoutId\r\n )\r\n );\r\n }\r\n dispatch(setServiceSelectedLayout(0));\r\n dispatch(changeExternalServiceFieldsUsed(data.LayoutId, Fields));\r\n } else if (data && !data.Success) {\r\n h.error(\"Error saving layout.\", data.Message);\r\n }\r\n\r\n if (isSaveAsNew) dispatch(setExternalServiceLayoutSavingAsNew(false));\r\n else dispatch(setExternalServiceLayoutSaving(false));\r\n })\r\n .catch(error => {\r\n h.error(\"Error saving layout.\", error);\r\n\r\n if (isSaveAsNew) dispatch(setExternalServiceLayoutSavingAsNew(false));\r\n else dispatch(setExternalServiceLayoutSaving(false));\r\n });\r\n };\r\n\r\nexport const requestEnrichmentFields =\r\n (flowItemId: number) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch(setLoadingEnrichmentFields(true));\r\n request(\"/FlowControl/GetEnrichmentFields?flowItemId=\" + flowItemId, { credentials: \"same-origin\" }, dispatch)\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data.fields) {\r\n dispatch(setSelectedEnrichmentFieldsItem(data.fields));\r\n } else {\r\n h.error(\"No selected enrichment fields found.\");\r\n dispatch(setSelectedEnrichmentFieldsItem([]));\r\n }\r\n dispatch(setSelectedEnrichmentItemId(flowItemId));\r\n dispatch(setLoadingEnrichmentFields(false));\r\n })\r\n .catch(error => {\r\n h.error(\"Error getting selected enrichment fields.\", error);\r\n dispatch(setLoadingEnrichmentFields(false));\r\n dispatch(setSelectedEnrichmentFieldsItem([]));\r\n });\r\n };\r\n\r\nexport const getEnrichmentFieldListByIdAsync =\r\n (fieldIds: Array) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch(setLoadingEnrichmentFields(true));\r\n request(\r\n \"/FlowControl/GetEnrichmentFieldListByIdAsync\",\r\n {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n body: fieldIds,\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data.fields) {\r\n dispatch(setCurrEnrichmentFields(data.fields));\r\n } else {\r\n h.error(\"No current enrichment fields found.\");\r\n }\r\n dispatch(setLoadingEnrichmentFields(false));\r\n })\r\n .catch(error => {\r\n h.error(\"Error getting current enrichment fields by id.\", error);\r\n dispatch(setLoadingEnrichmentFields(false));\r\n });\r\n };\r\n\r\nexport const searchEnrichmentFields =\r\n (text: string) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch(setSearchingEnrichmentFields(true));\r\n request(\"/FlowControl/SearchEnrichmentFields?searchText=\" + text, { credentials: \"same-origin\" }, dispatch)\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data.fields) {\r\n dispatch(setEnrichmentFields(data.fields));\r\n } else {\r\n h.error(\"No available enrichment fields returned.\");\r\n }\r\n dispatch(setSearchingEnrichmentFields(false));\r\n })\r\n .catch(error => {\r\n h.error(\"Error getting available enrichment fields.\", error);\r\n dispatch(setSearchingEnrichmentFields(false));\r\n });\r\n };\r\n\r\nexport const setFlowControlData = (data: IFlowControlDataResult): ISetFlowControlData => ({\r\n type: SET_FLOW_CONTROL_DATA,\r\n externalServices: data.ExternalServices,\r\n externalParameters: data.ExternalParameters,\r\n externalParameterValues: data.ExternalParameterValues,\r\n externalServiceParameters: data.ExternalServiceParameters,\r\n externalFileLocation: data.ExternalFileLocationOutputTrue,\r\n externalInputFileLocation: data.ExternalFileLocationInputTrue,\r\n externalServiceDefaultFields: data.ExternalServiceDefaultFields,\r\n});\r\n\r\nexport const setExternalParameterValues = (data: Array): ISetExternalParameterValues => ({\r\n type: SET_EXTERNAL_PARAMETER_VALUES,\r\n externalParameterValues: data,\r\n});\r\n\r\nexport const setFlowControlStatus = (\r\n running: Array,\r\n completed: Array,\r\n failed: Array,\r\n loading: boolean\r\n): IGetFlowControlStatus => ({\r\n type: SET_FLOW_CONTROL_STATUS,\r\n running,\r\n completed,\r\n failed,\r\n loading,\r\n});\r\n\r\nexport const setExternalServiceLayoutData = (\r\n data: IExternalServiceLayoutDataResult\r\n): ISetExternalServiceLayoutData => ({\r\n type: SET_SERVICE_LAYOUT_DATA,\r\n externalServiceFields: data.ExternalServiceFields,\r\n externalServiceLayouts: data.ExternalServiceLayouts,\r\n externalServiceLayoutFields: data.ExternalServiceLayoutFields,\r\n externalServiceClientFieldAlias: data.ExternalServiceClientFieldAlias,\r\n});\r\n\r\nexport const setExternalServiceLayoutSaving = (layoutIsSaving: boolean): ISetExternalServiceLayoutSaving => ({\r\n type: SET_SERVICE_LAYOUT_SAVING,\r\n layoutIsSaving,\r\n});\r\n\r\nexport const setExternalServiceLayoutSavingAsNew = (\r\n layoutIsSavingAsNew: boolean\r\n): ISetExternalServiceLayoutSavingAsNew => ({\r\n type: SET_SERVICE_LAYOUT_SAVING_AS_NEW,\r\n layoutIsSavingAsNew,\r\n});\r\n\r\nexport const setServiceSelectedLayout = (selectedLayout: number): ISetExternalServiceSelectedLayout => ({\r\n type: SET_SERVICE_SELECTED_LAYOUT,\r\n selectedLayout,\r\n});\r\n\r\nexport const setEnrichmentFields = (fields: Array): ISetEnrichmentFields => ({\r\n type: SET_ENRICHMENT_FIELDS,\r\n enrichmentFields: fields,\r\n});\r\n\r\nexport const setCurrEnrichmentFields = (fields: Array): ISetCurrEnrichmentFields => ({\r\n type: SET_CURR_ENRICHMENT_FIELDS,\r\n currEnrichmentFields: fields,\r\n});\r\n\r\nexport const setSelectedEnrichmentFieldsItem = (fields: Array): ISetSelectedFieldsItem => ({\r\n type: SET_SELECTED_FIELDS_ITEM,\r\n selectedFieldsItem: fields,\r\n});\r\n\r\nexport const setSelectedEnrichmentItemId = (itemId: number): ISetSelectedItemId => ({\r\n type: SET_SELECTED_ITEMID,\r\n selectedItemId: itemId,\r\n});\r\n\r\nexport const setSearchingEnrichmentFields = (searching: boolean): ISetIsSearching => ({\r\n type: SET_IS_SEARCHING,\r\n isSearching: searching,\r\n});\r\n\r\nexport const setLoadingEnrichmentFields = (loading: boolean): ISetIsLoading => ({\r\n type: SET_IS_LOADING,\r\n isLoading: loading,\r\n});\r\n\r\nexport const setIsValidatingEnrichment = (isValidating: boolean): ISetIsValidating => ({\r\n type: SET_IS_VALIDATING,\r\n isValidating,\r\n});\r\n\r\nexport const setValidatedImportFields = (fields: Array): ISetValidatedFields => ({\r\n type: SET_VALIDATED_FIELDS,\r\n validatedFields: fields,\r\n});\r\n\r\nexport const setImportedLayoutFields = (importedFields: Array): ISetImportLayoutFields => ({\r\n type: SET_IMPORT_LAYOUT_FIELDS,\r\n importedFields,\r\n});\r\n\r\nexport const setImportedLayoutIsFixed = (importedIsFixed: boolean): ISetImportLayoutIsFixed => ({\r\n type: SET_IMPORT_LAYOUT_IS_FIXED,\r\n importedIsFixed,\r\n});\r\n\r\nexport const setExternalServiceFieldsUsed = (\r\n externalServiceFieldsUsed: Array\r\n): ISetExternalServiceFieldsUsed => ({\r\n type: SET_EXTERNAL_SERVICE_FIELDS_USED,\r\n externalServiceFieldsUsed,\r\n});\r\n\r\nexport const setExportLockedOut = (isLockedOut: boolean): ISetExportLockedOut => ({\r\n type: SET_EXPORT_LOCKED_OUT,\r\n isLockedOut,\r\n});\r\n\r\nexport const getExportOutputLayoutColumns =\r\n (outputColumnNameOpt: number, outputLayoutId: number, altUENames: boolean, clientCode: string) =>\r\n (dispatch: Dispatch): void => {\r\n setExportLockedOut(true);\r\n const url = `/FlowControl/ExportOutputLayoutColumns?outputColumnNameOpt=${outputColumnNameOpt}&outputlayoutId=${outputLayoutId}&alternateUENames=${altUENames}&clientCode=${clientCode}`;\r\n request(\r\n url,\r\n {\r\n credentials: \"same-origin\",\r\n method: \"GET\",\r\n },\r\n dispatch\r\n )\r\n .then(response => response.blob())\r\n .then(blob => {\r\n setTimeout(() => {\r\n setExportLockedOut(false);\r\n }, 3000);\r\n // Create blob link to download\r\n const url = window.URL.createObjectURL(new Blob([blob]));\r\n const anchorLink = document.createElement(\"a\");\r\n anchorLink.href = url;\r\n anchorLink.setAttribute(\"download\", `Output Layout Column Format.csv`);\r\n\r\n // Append to html anchorLink element page\r\n document.body.appendChild(anchorLink);\r\n\r\n // Start download\r\n anchorLink.click();\r\n\r\n // Clean up and remove the anchorLink\r\n anchorLink.parentNode?.removeChild(anchorLink);\r\n })\r\n .catch(error => {\r\n setTimeout(() => {\r\n setExportLockedOut(false);\r\n }, 3000);\r\n h.error(\"Error downloading file.\", error);\r\n });\r\n };\r\n\r\nexport const requestFCLayoutDelete =\r\n (layoutId: number, companyId: number) =>\r\n (dispatch: Dispatch): void => {\r\n request(\r\n `/FlowControl/RemoveLayout`,\r\n {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n body: JSON.stringify({\r\n layoutId,\r\n }),\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (!data.success) {\r\n const existerrorcode = \"EXIST_RELATIONSHIP\";\r\n const existerror = \"You can't delete the layout, checking if it's being used.\";\r\n if (data.message === existerrorcode) {\r\n dispatch(notifyError(existerror));\r\n } else {\r\n throw new Error(\"Error deleting layout.\");\r\n }\r\n } else {\r\n dispatch(notifyGreen(\"Successfully deleted your layout.\"));\r\n dispatch(requestExternalServiceLayoutData(companyId));\r\n }\r\n });\r\n };\r\n\r\nexport const validateUEFieldsCompliance =\r\n (isManualRefresh: boolean = false) =>\r\n (dispatch: Dispatch, getState: () => IAppState): void => {\r\n const state = getState();\r\n const companyId = state.session.companyId;\r\n const selectedFields = state.umbrellaData.selectedFieldsItem;\r\n const flowExternalService = getFlowExternalServiceForSelectedFlowItem(state);\r\n if (\r\n companyId &&\r\n flowExternalService &&\r\n (!flowExternalService.UECompliancePassed || isManualRefresh) &&\r\n selectedFields.length > 0\r\n ) {\r\n dispatch(\r\n requestUEFieldsCompliance(\r\n companyId,\r\n selectedFields.map(x => x.FieldId),\r\n flowExternalService.FlowExternalServiceId,\r\n flowExternalService.WFClientKey\r\n )\r\n );\r\n }\r\n };\r\n\r\nexport const requestUEFieldsCompliance =\r\n (companyId: number, fieldIds: Array, flowExternalServiceId: number, wfClientKey: number) =>\r\n (dispatch: Dispatch): void => {\r\n const url = `/FlowControl/GetFieldsCompliance`;\r\n dispatch(updateAttribute(\"flowExternalServices\", flowExternalServiceId, \"UECompliancePassed\", false));\r\n dispatch(setIsValidatingEnrichment(true));\r\n\r\n request(\r\n url,\r\n {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n body: JSON.stringify({\r\n companyId,\r\n fieldIds,\r\n wfClientKey,\r\n }),\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data && data.result) {\r\n const result = data.result as IUEComplianceRequestResult;\r\n const complianceStatus = result.compliance_status.toUpperCase() == \"PASS\";\r\n const fieldsFailintCompliance = result.fields_fail_compliance;\r\n\r\n dispatch(\r\n updateAttribute(\r\n \"flowExternalServices\",\r\n flowExternalServiceId,\r\n \"UECompliancePassed\",\r\n complianceStatus\r\n )\r\n );\r\n dispatch(\r\n updateAttribute(\r\n \"flowExternalServices\",\r\n flowExternalServiceId,\r\n \"FieldsFailingCompliance\",\r\n fieldsFailintCompliance\r\n )\r\n );\r\n\r\n if (complianceStatus) {\r\n dispatch(notifyGreen(\"Compliance status passed for current fields.\"));\r\n } else {\r\n h.error(\"Some of the fields selected don't pass Universal Enrichment compliance.\");\r\n }\r\n dispatch(setIsValidatingEnrichment(false));\r\n } else {\r\n dispatch(setIsValidatingEnrichment(false));\r\n h.error(\r\n \"There was an error validating universal enrichment compliance.\",\r\n \"Data couldn't be parsed.\"\r\n );\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(setIsValidatingEnrichment(false));\r\n h.error(\"There was an error validating universal enrichment compliance.\", error);\r\n dispatch(updateAttribute(\"flowExternalServices\", flowExternalServiceId, \"UECompliancePassed\", false));\r\n });\r\n };\r\n\r\nexport const validateImportedEnrichmentFields =\r\n (flowItemId: number, importFields: Array) =>\r\n (dispatch: Dispatch): void => {\r\n dispatch(setIsValidatingEnrichment(true));\r\n request(\r\n `/FlowControl/ValidateUEImport`,\r\n {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n body: JSON.stringify({\r\n flowItemId,\r\n importFields,\r\n }),\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data.validatedFields) {\r\n dispatch(setValidatedImportFields(data.validatedFields));\r\n } else {\r\n h.error(\"No validated enrichment fields returned.\");\r\n dispatch(setValidatedImportFields([]));\r\n }\r\n dispatch(setIsValidatingEnrichment(false));\r\n })\r\n .catch(error => {\r\n h.error(\"Error validating enrichment fields.\", error);\r\n dispatch(setIsValidatingEnrichment(false));\r\n dispatch(setValidatedImportFields([]));\r\n });\r\n };\r\n\r\nexport const changeExternalServiceFieldsUsed =\r\n (layoutId: number | undefined | null, _currentFields?: Array | undefined | null) =>\r\n (dispatch: Dispatch, getState: () => IAppState): void => {\r\n if (layoutId) {\r\n const state = getState();\r\n const currentFields =\r\n _currentFields == null\r\n ? state.externalServiceLayoutData.externalServiceLayoutFields.filter(x => x.LayoutId == layoutId)\r\n : [..._currentFields];\r\n const serviceFields = state.externalServiceLayoutData.externalServiceFields;\r\n\r\n const serviceFieldsUsed =\r\n currentFields?.length > 0\r\n ? serviceFields.filter(f => currentFields.some(x => x.ServiceFieldId == f.ServiceFieldId))\r\n : [];\r\n\r\n dispatch(setExternalServiceFieldsUsed(serviceFieldsUsed));\r\n } else {\r\n dispatch(setExternalServiceFieldsUsed([]));\r\n }\r\n };\r\n\r\nexport const AddAdditionalPersons =\r\n (persons: Array, fieldId: number) =>\r\n (dispatch: Dispatch, getState: () => IAppState): void => {\r\n const state = getState();\r\n const externalParameters = state.flowControlData.externalParameters;\r\n\r\n const personIndex = persons.findIndex(x => x.FieldId == fieldId);\r\n if (personIndex >= 0) {\r\n const personNumber = parseInt(persons[personIndex].PersonNumber);\r\n const parmNames = UEFieldParms.filter(x => x.substring(0, 5) == \"adult\");\r\n const adultParms = externalParameters.filter(x => parmNames.includes(x.ParameterName));\r\n\r\n dispatch(UpdateServiceParameter(fieldId, \"Field_List\"));\r\n for (let i = personNumber; i >= 2; i--) {\r\n const thisParm = adultParms!.find(x => x.ParameterName.endsWith(i.toString()));\r\n dispatch(UpdateServiceParameter(fieldId, thisParm?.ParameterName));\r\n }\r\n }\r\n };\r\n\r\nexport const UpdateServiceParameter =\r\n (fieldId: number, parameterName: string | undefined) =>\r\n (dispatch: Dispatch, getState: () => IAppState): void => {\r\n const state = getState();\r\n const externalParameters = state.flowControlData.externalParameters;\r\n const flowServiceParameters = getFlowExternalServiceParametersForSelectedFlowItem(state);\r\n\r\n const fieldList = externalParameters.find(x => x.ParameterName == parameterName);\r\n const itemParameter = flowServiceParameters.find(x => x.ParameterId == fieldList?.ParameterId);\r\n let fieldValues: Array = [];\r\n\r\n if (itemParameter!.Value.length > 0) {\r\n fieldValues = itemParameter!.Value.split(\",\");\r\n }\r\n\r\n if (!fieldValues.includes(fieldId.toString())) {\r\n fieldValues.push(fieldId.toString());\r\n }\r\n\r\n let sortedValues = fieldValues.map(x => parseInt(x));\r\n\r\n dispatch(\r\n updateAttribute(\r\n \"flowExternalServiceParameters\",\r\n itemParameter!.FlowServiceParameterId,\r\n \"Value\",\r\n sortedValues.length == 1 ? sortedValues[0].toString() : sortedValues.join(\",\")\r\n )\r\n );\r\n };\r\n","import { Dispatch } from \"redux\";\r\nimport { FlowExpression, FlowExpressionConstraint } from \"../types/stores/flowTypes\";\r\nimport { addThing } from \"./flowActions\";\r\n\r\nexport const newFlowExpression =\r\n (flowItemId: number) =>\r\n (dispatch: Dispatch): void => {\r\n const thing: FlowExpression = {\r\n FlowExpressionId: 0,\r\n ExpressionName: null,\r\n ExpressionQuery: \"\",\r\n ExpressionResult: null,\r\n IsValid: null,\r\n InvalidReason: null,\r\n FlowItemId: flowItemId,\r\n };\r\n\r\n dispatch(addThing(\"flowExpressions\", thing));\r\n };\r\n\r\nexport const newFlowExpressionConstraint =\r\n (flowItemId: number) =>\r\n (dispatch: Dispatch): void => {\r\n const thing: FlowExpressionConstraint = {\r\n FlowExpressionConstraintId: 0,\r\n ChildFlowItemId: 0,\r\n ConstraintCondition: null,\r\n ConstraintStatus: false,\r\n ConstraintValue: null,\r\n FlowItemId: flowItemId,\r\n };\r\n\r\n dispatch(addThing(\"flowExpressionConstraints\", thing));\r\n };\r\n","import { incAjaxCount, decAjaxCount } from \"./actionCreators\";\r\nimport h from \"../helpers\";\r\nimport {\r\n SET_FLOW_ITEM_RESULT_TABLES,\r\n SET_FLOW_ITEM_TABLE_COLUMNS,\r\n SET_FLOW_ITEM_DATALOAD_TABLE_COLUMNS,\r\n SET_IS_LOADING_TABLES,\r\n SET_IS_LOADING_COLUMNS,\r\n} from \"../reducers/flowItemResultTables\";\r\n// import {\r\n// SET_CANNEDREPORT_COLUMNS,\r\n// } from \"../reducers/flowCannedReportColumns\";\r\nimport { updateAttribute } from \"./flowActions\";\r\nif (!top.RDX) {\r\n top.RDX = {};\r\n}\r\n\r\nconst TOGGLE_FLOW_EDIT_LISTING = \"TOGGLE_FLOW_EDIT_LISTING\";\r\nconst TOGGLE_FLOW_EDIT_LISTING_PINNABLE = \"TOGGLE_FLOW_EDIT_LISTING_PINNABLE\";\r\n\r\n// export const setCannedReportColumns = (flowItemId, columns) => ({\r\n// type: \"SET_CANNEDREPORT_COLUMNS\",\r\n// flowItemId,\r\n// columns,\r\n// });\r\n// top.RDX.setCannedReportColumns = (flowItemId, columns) =>\r\n// top.store.dispatch(setCannedReportColumns(flowItemId, columns));\r\n\r\nexport const ToggleFlowEditListing = currentValue => ({\r\n type: TOGGLE_FLOW_EDIT_LISTING,\r\n isOpen: !currentValue,\r\n});\r\n\r\nexport const ToggleFlowEditListingPinnable = currentValue => ({\r\n type: TOGGLE_FLOW_EDIT_LISTING_PINNABLE,\r\n isPinned: !currentValue,\r\n});\r\n\r\nexport const setFlowItemResultTables = (flowItemId, resultTables) => ({\r\n type: SET_FLOW_ITEM_RESULT_TABLES,\r\n flowItemId,\r\n resultTables,\r\n});\r\n\r\nexport const requestFlowItemResultTables = flowItemId => dispatch => {\r\n const url = `/Flows/GetFlowItemResultTables?flowItemId=${flowItemId}`;\r\n dispatch(incAjaxCount());\r\n dispatch(setIsLoadingResultTables(true));\r\n fetch(url, { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(setFlowItemResultTables(flowItemId, data));\r\n dispatch(setIsLoadingResultTables(false));\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(setIsLoadingResultTables(false));\r\n dispatch(decAjaxCount());\r\n h.error(\"Error loading tables.\", error);\r\n });\r\n};\r\n\r\nexport const requestFlowItemResultTablesForColumns = parentIemId => dispatch => {\r\n const url = `/Flows/GetResultTablesFromCannedReport?flowItemId=${parentIemId}`;\r\n dispatch(incAjaxCount());\r\n dispatch(setIsLoadingResultTables(true));\r\n fetch(url, { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n let resultTable = [];\r\n if (data && data.length > 0) {\r\n const unique = [...new Set(data.map(item => item.TABLE_NAME))];\r\n if (unique.length > 1) {\r\n unique.forEach(x => {\r\n const tmpData = data.filter(y => y.TABLE_NAME == x);\r\n const tableName = x;\r\n\r\n dispatch({\r\n type: SET_FLOW_ITEM_TABLE_COLUMNS,\r\n tableName,\r\n tableColumns: tmpData,\r\n });\r\n resultTable.push({\r\n TableName: tableName,\r\n Count: tmpData.length,\r\n });\r\n });\r\n } else {\r\n const tableName = data[0].TABLE_NAME;\r\n\r\n dispatch({\r\n type: SET_FLOW_ITEM_TABLE_COLUMNS,\r\n tableName,\r\n tableColumns: data,\r\n });\r\n resultTable.push({\r\n TableName: tableName,\r\n Count: data.length,\r\n });\r\n }\r\n }\r\n dispatch({\r\n type: SET_FLOW_ITEM_RESULT_TABLES,\r\n flowItemId: parentIemId,\r\n resultTables: resultTable,\r\n });\r\n dispatch(setIsLoadingResultTables(false));\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(setIsLoadingResultTables(false));\r\n dispatch(decAjaxCount());\r\n h.error(\"Error loading columns from parent node.\", error);\r\n });\r\n};\r\n\r\nexport const requestFlowItemTableColumns = (flowId, tableName, flowItemId) => dispatch => {\r\n const url = `/Flows/GetResultTableColumns?flowId=${flowId}&tableName=${tableName}`;\r\n dispatch(incAjaxCount());\r\n dispatch(setIsLoadingTableColumns(true));\r\n fetch(url, { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data && data.columns) {\r\n dispatch({\r\n type: SET_FLOW_ITEM_TABLE_COLUMNS,\r\n tableName,\r\n tableColumns: data.columns,\r\n });\r\n } else if (data.error) {\r\n h.error(`Error loading table columns. ${data.error}`, data.error, true);\r\n }\r\n\r\n if (flowItemId != null) {\r\n dispatch(updateAttribute(\"flowItems\", flowItemId, \"IsLoading\", false));\r\n }\r\n })\r\n .catch(error => {\r\n if (flowItemId != null) {\r\n dispatch(updateAttribute(\"flowItems\", flowItemId, \"IsLoading\", false));\r\n }\r\n h.error(\"Error loading table columns.\", error);\r\n })\r\n .finally(() => {\r\n dispatch(setIsLoadingTableColumns(false));\r\n dispatch(decAjaxCount());\r\n });\r\n};\r\n\r\nexport const requestFlowItemDataLoadTableColumns = (flowId, tableName) => dispatch => {\r\n const url = `/Flows/GetResultTableColumns?flowId=${flowId}&tableName=${tableName}`;\r\n dispatch(incAjaxCount());\r\n dispatch(setIsLoadingTableColumns(true));\r\n fetch(url, { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data && data.columns) {\r\n dispatch({\r\n type: SET_FLOW_ITEM_DATALOAD_TABLE_COLUMNS,\r\n tableName,\r\n tableColumns: data.columns,\r\n });\r\n } else if (data.error) {\r\n h.error(`Error loading table columns. ${data.error}`, data.error, true);\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error loading table columns.\", error);\r\n })\r\n .finally(() => {\r\n dispatch(setIsLoadingTableColumns(false));\r\n dispatch(decAjaxCount());\r\n });\r\n};\r\n\r\nimport { loadDataloadPartners } from \"./flowActions\";\r\nexport const requestDataloadDestinations = () => dispatch => {\r\n //updates null to [] so that other components don't do the call while this one is running!\r\n dispatch(loadDataloadPartners([]));\r\n const url = \"/ClientAccess/GetMyDataloadPartners\";\r\n dispatch(incAjaxCount());\r\n return fetch(url, { credentials: \"same-origin\", method: \"POST\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n if (data.partners && data.partners.length > 0) {\r\n dispatch(loadDataloadPartners(data.partners));\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n dispatch(loadDataloadPartners(null));\r\n h.error(\"Error loading dataload partners.\", error);\r\n });\r\n};\r\n\r\nexport const setIsLoadingResultTables = isLoadingTables => ({\r\n type: SET_IS_LOADING_TABLES,\r\n isLoadingTables,\r\n});\r\n\r\nexport const setIsLoadingTableColumns = isLoadingColumns => ({\r\n type: SET_IS_LOADING_COLUMNS,\r\n isLoadingColumns,\r\n});\r\n","export const UPDATE_COMPANY_IMAGES = \"UPDATE_COMPANY_IMAGES\";\r\nexport const GET_COMPANY_LOGO = \"GET_COMPANY_LOGO\";\r\n\r\nexport type UpdateCompanyImagesAction = {\r\n type: typeof UPDATE_COMPANY_IMAGES;\r\n hasUpdated: boolean;\r\n};\r\n\r\nexport type GetCompanyLogoAction = {\r\n type: typeof GET_COMPANY_LOGO;\r\n logo: string;\r\n};\r\n\r\nexport type ActionType = UpdateCompanyImagesAction | GetCompanyLogoAction;\r\n\r\nexport const NotifyUpdateCompanyImages = (hasUpdatedNew: boolean): UpdateCompanyImagesAction => ({\r\n type: UPDATE_COMPANY_IMAGES,\r\n hasUpdated: hasUpdatedNew,\r\n});\r\nexport const GetCompanyLogo = (companyId: number): GetCompanyLogoAction => ({\r\n type: GET_COMPANY_LOGO,\r\n logo: `/Images/CompanyLogo/${companyId}`,\r\n});\r\n","import {\r\n IStartRequestProgress,\r\n IUpdateRequestProgress,\r\n IEndRequestProgress,\r\n IFlowRelatedRequestStart,\r\n IFlowRelatedRequestCompleted,\r\n ITreeRequestStart,\r\n ITreeRequestCompleted,\r\n} from \"../types/stores/loading\";\r\nimport {\r\n START_REQUEST_PROGRESS,\r\n UPDATE_REQUEST_PROGRESS,\r\n END_REQUEST_PROGRESS,\r\n SHOW_FLOW_LOADING,\r\n HIDE_FLOW_LOADING,\r\n START_TREE_REQUEST_PROGRESS,\r\n END_TREE_REQUEST_PROGRESS,\r\n} from \"../reducers/loadingStates\";\r\n\r\nexport const startRequestProgress = (): IStartRequestProgress => ({\r\n type: START_REQUEST_PROGRESS,\r\n});\r\n\r\nexport const updateRequestProgress = (progress: number): IUpdateRequestProgress => ({\r\n type: UPDATE_REQUEST_PROGRESS,\r\n progress,\r\n});\r\n\r\nexport const endRequestProgress = (): IEndRequestProgress => ({\r\n type: END_REQUEST_PROGRESS,\r\n});\r\n\r\nexport const flowRelatedRequestStart = (): IFlowRelatedRequestStart => ({\r\n type: SHOW_FLOW_LOADING,\r\n});\r\n\r\nexport const flowRelatedRequestCompleted = (): IFlowRelatedRequestCompleted => ({\r\n type: HIDE_FLOW_LOADING,\r\n});\r\n\r\nexport const treeRequestStart = (): ITreeRequestStart => ({\r\n type: START_TREE_REQUEST_PROGRESS,\r\n});\r\n\r\nexport const treeRequestCompleted = (): ITreeRequestCompleted => ({\r\n type: END_TREE_REQUEST_PROGRESS,\r\n});\r\n","/*\r\n Notifications - These are ephemeral messages that appear in the top right, such as \"soandso count completed.\"\r\n\r\n Main, easy to use functions:\r\n\r\n notifyBlack(text | react node)\r\n notifyGreen(text | react node)\r\n notifyBlue(text | react node)\r\n\r\n Low level, specify class names and everything: addNotificationMessage(text | react node, options)\r\n\r\n We have an optional grouping function which allows messages to be updated instead of displaying new ones.\r\n For example, imagine a flow that has 10 items complete, each one second after the last. Instead of displaying 10\r\n notifications, we will display 1 notification and add the items to it as it completes. It will time out 5 seconds\r\n after the last one is displayed. See note (gp1) lower in this file.\r\n*/\r\nimport React from \"react\";\r\nimport { debounce } from \"lodash\";\r\nimport { GetNotificationsCount } from \"./userNotificationActions\";\r\nimport { getUserCompanyFlowsStatus } from \"./dashboardWidgetActions\";\r\nimport { Dispatch } from \"redux\";\r\nimport {\r\n Notification,\r\n UpdatableFields,\r\n MessageGroupOptions,\r\n DismissNotification,\r\n AddNotification,\r\n UpdateNotification,\r\n} from \"../types/stores/notifications\";\r\nimport { DISMISS_NOTIFICATION, ADD_NOTIFICATION, UPDATE_NOTIFICATION } from \"../reducers/notifications\";\r\nimport { IAppState } from \"../types/stores/index\";\r\n\r\n// Notifications //\r\nif (top && !top.RDX) {\r\n top.RDX = {};\r\n}\r\n\r\nlet nextNotifyId = 0;\r\n\r\nconst getCount = () => {\r\n top!.store.dispatch(GetNotificationsCount());\r\n};\r\n\r\nconst getCountDebounced = debounce(getCount, 2000);\r\n\r\n// AddNotifyMessage: This is a \"low level\" AC to add a notification. It allows you to specify everything about the\r\n// notification. If you just want to display simple text, use something like notifyBlack() or notifyGreen() instead.\r\n//\r\n// (1). You may pass \"text\" (simple case) or \"componentName\" (more complex). If passed a componentName,\r\n// we ignore the text and render .\r\n// The componentName must also be added to the lookup table in Notification.js -> renderInner.\r\n// You can put extra information used in the render in the groupArgsList.\r\n// This may be slightly awkward if you aren't using the grouping functionality, and perhaps a \".extra\" field should be added.\r\nexport const addNotifyMessage = (text: string | React.ReactNode, options: UpdatableFields): AddNotification => ({\r\n type: ADD_NOTIFICATION,\r\n id: nextNotifyId++,\r\n text, // Text of the notification\r\n componentName: options.componentName != null ? options.componentName : \"\", // Optionally, a react Component Name used to register the message. See (1) above.\r\n width: options.width || \"auto\", // CSS Width. Usually you want \"auto\".\r\n className: options.className || \"\", // Class Names to apply to the message div.\r\n delay: options.delay || (typeof text == \"string\" ? calculateDelay(text) : 6000), // How long in milliseconds to display\r\n groupName: options.groupName || \"\", // See grouping note (gp1)\r\n groupArgsList: options.groupArgs != null ? [options.groupArgs] : [], // See grouping note (gp1)\r\n variant: options.variant || \"info\", // snackbar variant\r\n});\r\n\r\nexport const addNotifyMessageTop = (text: string, options: UpdatableFields): void => {\r\n if (text.includes(\"notification-count-update\")) {\r\n switch (text) {\r\n case \"notification-count-update-force\":\r\n getCount();\r\n break;\r\n default: {\r\n getCountDebounced();\r\n break;\r\n }\r\n }\r\n } else if (text.includes(\"flow-running-updated\")) {\r\n if (window.location.href.includes(\"dashboard\") || window.location.href.includes(\"flow-status\")) {\r\n top!.store.dispatch(getUserCompanyFlowsStatus());\r\n }\r\n } else if (text.includes(\"STATEMENT_ERROR\")) {\r\n top!.store.dispatch(notifyError(\"Please, select countable columns!!!\"));\r\n } else {\r\n top!.store.dispatch(addNotifyMessage(text, options));\r\n }\r\n};\r\n\r\ntop!.RDX.addNotifyMessage = addNotifyMessageTop;\r\n\r\nexport const updateNotifyMessage = (id: number, updates: UpdatableFields): UpdateNotification => ({\r\n type: UPDATE_NOTIFICATION,\r\n id,\r\n updates,\r\n});\r\n\r\nexport const dismissNotifyMessage = (id: number): DismissNotification => ({\r\n type: DISMISS_NOTIFICATION,\r\n id,\r\n});\r\n\r\nexport const notifyBlack =\r\n (text: string) =>\r\n (dispatch: Dispatch): void => {\r\n const delay = typeof text == \"string\" ? calculateDelay(text) : 6000;\r\n dispatch(\r\n addNotifyMessage(text, {\r\n width: \"auto\",\r\n className: \"alert-gloss alert-gloss-black\",\r\n delay,\r\n variant: \"info\",\r\n })\r\n );\r\n };\r\ntop!.RDX.notifyBlack = text => top!.store.dispatch(notifyBlack(text));\r\n\r\nexport const notifyBlue =\r\n (text: string | React.ReactNode) =>\r\n (dispatch: Dispatch): void => {\r\n const delay = typeof text == \"string\" ? calculateDelay(text) : 7000;\r\n dispatch(\r\n addNotifyMessage(text, {\r\n width: \"auto\",\r\n className: \"alert-gloss alert-gloss-info\",\r\n delay,\r\n variant: \"info\",\r\n })\r\n );\r\n };\r\n\r\nexport const notifyGreen =\r\n (text: string) =>\r\n (dispatch: Dispatch): AddNotification =>\r\n dispatch(\r\n addNotifyMessage(text, {\r\n width: \"auto\",\r\n className: \"alert-gloss alert-gloss-success\",\r\n delay: typeof text == \"string\" ? calculateDelay(text) : 7000,\r\n variant: \"success\",\r\n })\r\n );\r\n\r\nexport const notifyError =\r\n (text: string, keepDisplayed: boolean = false) =>\r\n (dispatch: Dispatch): void => {\r\n if (keepDisplayed) {\r\n dispatch(\r\n addNotifyMessage(text, {\r\n width: \"auto\",\r\n className: \"alert-gloss alert-gloss-black\",\r\n variant: \"error\",\r\n })\r\n );\r\n } else {\r\n const delay = typeof text == \"string\" ? calculateDelay(text) : 7000;\r\n dispatch(\r\n addNotifyMessage(text, {\r\n width: \"auto\",\r\n className: \"alert-gloss alert-gloss-black\",\r\n delay,\r\n variant: \"error\",\r\n })\r\n );\r\n }\r\n };\r\n\r\nconst safeStrLen = (text: string) => text.replace(/(<([^>]+)>)/gi, \"\").length;\r\nconst calculateDelay = (text: string) => Math.min(Math.max(safeStrLen(text) * 62, 3000), 8000);\r\n\r\n/* Grouping Function (gp1) - Send a notification that can be updated later in lieu of sending additional notifications.\r\n These types of messages must be rendered with a custom component instead of a simple text string.\r\n Call this function with a groupName (string) and groupArgs (object containing whatever info you want).\r\n If there is already a message out with the same group, we will update its args, allowing the message to update instead\r\n of sending a new message.\r\n\r\n Example: Many flow items completing in the same few seconds will all go to one notification instead of several.\r\n Let's go through an example of two calls.\r\n\r\n (1st message) Call notifyMessageGrouping with this:\r\n {\r\n \"groupName\": \"flowItemComplete\",\r\n \"componentName\": \"NotifyFlowItemFinished\",\r\n \"groupArgs\": {\r\n \"flowName\": \"acura\",\r\n \"flowItemName\": \"simple item 1\",\r\n \"qty\": 1234\r\n }\r\n }\r\n There is no notification with groupName=\"flowItemComplete\" yet, so we render it. The content of the message is\r\n .\r\n -- this.props.notification.groupArgsList = [ {flowName: \"acura\", \"flowItemName\": \"simple item 1\", \"qty\": 1234 } ]\r\n It can use that to render the text in the notification.\r\n\r\n (2nd message, one second later) Call notifyMessageGrouping with this:\r\n {\r\n \"groupName\": \"flowItemComplete\",\r\n \"componentName\": \"NotifyFlowItemFinished\",\r\n \"groupArgs\": {\r\n \"flowName\": \"acura\",\r\n \"flowItemName\": \"complex item credit score\",\r\n \"qty\": 4567\r\n }\r\n }\r\n There is already a notification displaying with groupName=\"flowItemComplete\", so we update it instead of adding a new message.\r\n We change the notification.groupArgsList that is being sent to the component doing the rendering, which is:\r\n .\r\n But now:\r\n -- this.props.notification.groupArgsList = [\r\n {flowName: \"acura\", \"flowItemName\": \"simple item 1\", \"qty\": 1234 },\r\n {flowName: \"acura\", \"flowItemName\": \"complex item credit score\", \"qty\": 4567 },\r\n ]\r\n It should use the updated props to update the message text.\r\n*/\r\nexport const notifyMessageGrouping =\r\n (messageGroupOptions: MessageGroupOptions) =>\r\n (dispatch: Dispatch, getState: () => IAppState): void => {\r\n // Look in store for an active notification belonging to the same group\r\n\r\n const notifications: Array = Object.values(getState().notifications);\r\n const notificationSameGroupShowing = notifications.filter(\r\n x => !x.dismissed && x.groupName == messageGroupOptions.groupName\r\n );\r\n\r\n if (notificationSameGroupShowing.length == 0) {\r\n // No messages with the same group - send new message\r\n dispatch(\r\n addNotifyMessage(\"\", {\r\n width: \"auto\",\r\n className:\r\n messageGroupOptions.className != null\r\n ? messageGroupOptions.className\r\n : \"alert-gloss alert-gloss-success\",\r\n delay: messageGroupOptions.delay != null ? messageGroupOptions.delay : 5000,\r\n groupName: messageGroupOptions.groupName,\r\n groupArgs: messageGroupOptions.groupArgs,\r\n componentName: messageGroupOptions.componentName,\r\n variant: messageGroupOptions.variant || \"info\",\r\n })\r\n );\r\n return;\r\n }\r\n\r\n // There is a message with the same group, update it. We always append the groupArgs to the groupArgsList.\r\n const notificationToUpdate = notificationSameGroupShowing[0];\r\n const newGroupArgs = notificationToUpdate.groupArgsList.concat(messageGroupOptions.groupArgs);\r\n\r\n dispatch(\r\n updateNotifyMessage(notificationToUpdate.id, {\r\n delay: notificationToUpdate.delay + 251, // Causes delay to reset\r\n groupArgsList: newGroupArgs, // Add new args to update message\r\n })\r\n );\r\n };\r\ntop!.RDX.notifyMessageGrouping = messageGroupOptions => top!.store.dispatch(notifyMessageGrouping(messageGroupOptions));\r\n","import h from \"../helpers\";\r\nimport { push } from \"connected-react-router\";\r\nimport { incAjaxCount, decAjaxCount } from \"./actionCreators\";\r\nimport { notifyBlack, notifyGreen } from \"./notifyActions\";\r\nif (!top.RDX) {\r\n top.RDX = {};\r\n}\r\n\r\n// Set MODE - See ScheduleMain //\r\n\r\nexport const setScheduleMode = mode => ({\r\n type: \"SET_SCHEDULE_MODE\",\r\n mode,\r\n});\r\n\r\nexport const setScheduleModeAndEditId = (mode, editId, isScheduleTemplate) => dispatch => {\r\n dispatch({\r\n type: \"SET_SCHEDULE_EDITID\",\r\n editId,\r\n });\r\n dispatch({\r\n type: \"SET_SCHEDULE_MODE\",\r\n mode,\r\n });\r\n\r\n if (!isScheduleTemplate) {\r\n if (editId) {\r\n dispatch(push(\"/tools/schedules/\" + mode + \"/\" + editId));\r\n } else {\r\n dispatch(push(\"/tools/schedules/\" + mode));\r\n }\r\n }\r\n};\r\nexport const setScheduleEditId = editId => ({\r\n type: \"SET_SCHEDULE_EDITID\",\r\n editId,\r\n});\r\n\r\n// Load Schedules //\r\n\r\nexport const requestScheduleList =\r\n (companyId = null) =>\r\n dispatch => {\r\n dispatch(incAjaxCount());\r\n dispatch(scheduleLoadStart());\r\n fetch(`/schedule/list?companyId=${companyId}`, { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(updateScheduleList(data));\r\n dispatch(decAjaxCount());\r\n dispatch(scheduleLoadFinish());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n dispatch(scheduleLoadFinish());\r\n h.error(\"Error loading schedules.\", error);\r\n });\r\n };\r\n\r\nexport const scheduleLoadStart = () => ({\r\n type: \"SCHEDULE_LOAD_START\",\r\n});\r\n\r\nexport const scheduleLoadFinish = () => ({\r\n type: \"SCHEDULE_LOAD_FINISH\",\r\n});\r\n\r\nexport const updateScheduleList = schedules => ({\r\n type: \"UPDATE_SCHEDULE_LIST\",\r\n schedules,\r\n});\r\n\r\n// Load Triggers //\r\n\r\nexport const requestScheduleTriggerList = scheduleId => dispatch => {\r\n dispatch(incAjaxCount());\r\n //dispatch(scheduleLoadStart());\r\n const listUrl = \"/ScheduleTrigger/list?\" + h.serialize({ scheduleId });\r\n fetch(listUrl, { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(updateScheduleTriggerList(scheduleId, data));\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error loading schedule triggers.\", error);\r\n });\r\n};\r\n\r\nexport const updateScheduleTriggerList = (scheduleId, triggers) => ({\r\n type: \"UPDATE_SCHEDULE_TRIGGER_LIST\",\r\n scheduleId,\r\n triggers,\r\n});\r\n\r\nexport const requestDeleteScheduleTrigger = triggerId => dispatch => {\r\n const deleteUrl = \"/ScheduleTrigger/Delete?\" + h.serialize({ id: triggerId });\r\n dispatch(notifyGreen(\"Delete trigger submitted.\"));\r\n return fetch(deleteUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (!data || !data.result || data.result != \"success\") {\r\n throw new Error(\"Unable to delete trigger.\");\r\n }\r\n\r\n const scheduleId = data.scheduleId;\r\n dispatch(requestScheduleTriggerList(scheduleId));\r\n dispatch(notifyBlack(\"Deleted trigger.\"));\r\n })\r\n .catch(error => {\r\n h.error(\"Unable to delete trigger\", error);\r\n });\r\n};\r\n\r\nexport const requestDeleteSchedule =\r\n (scheduleId, companyId = null) =>\r\n dispatch => {\r\n dispatch(notifyGreen(\"Delete schedule submitted.\"));\r\n const deleteUrl = \"/Schedule/Delete?\" + h.serialize({ id: scheduleId, companyId });\r\n return fetch(deleteUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (!data || !data.result || data.result != \"success\") {\r\n throw new Error(\"Unable to delete schedule.\");\r\n }\r\n dispatch(notifyBlack(\"Deleted schedule.\"));\r\n dispatch(requestScheduleList(companyId));\r\n })\r\n .catch(error => {\r\n h.error(\"Unable to delete schedule\", error);\r\n });\r\n };\r\n\r\n// Set a specific schedule Active/Inactive locally\r\nexport const setScheduleActive = (scheduleId, isActive) => ({\r\n type: \"SET_SCHEDULE_ACTIVE\",\r\n scheduleId,\r\n isActive,\r\n});\r\n\r\n// Set a specific schedule Consecutive/not Consecutive locally\r\nexport const setScheduleConsecutive = (scheduleId, isConsecutive) => ({\r\n type: \"SET_SCHEDULE_CONSECUTIVE\",\r\n scheduleId,\r\n isConsecutive,\r\n});\r\n\r\n// Save a schedule's active status\r\nexport const requestEditScheduleActive =\r\n (id, isActive, beQuiet = false, companyId = null) =>\r\n dispatch => {\r\n const editUrl =\r\n \"/Schedule/EditActive?\" +\r\n h.serialize({\r\n id,\r\n isActive,\r\n companyId,\r\n });\r\n\r\n dispatch(scheduleSaveStart());\r\n return fetch(editUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (!data || !data.result || data.result != \"success\") {\r\n throw new Error(\"Error editing schedule.\");\r\n }\r\n if (!beQuiet) {\r\n debouncedAlertUpdatedSchedule(dispatch);\r\n }\r\n dispatch(scheduleSaveFinish());\r\n // Debouncing the remote update stops weird looking behavior where\r\n // active switches quickly switch back and forth when updating several of them\r\n // in a row.\r\n debouncedRequestScheduleList(dispatch, companyId);\r\n })\r\n .catch(error => {\r\n dispatch(scheduleSaveFinish());\r\n h.error(\"Error editing schedule.\", error);\r\n });\r\n };\r\n\r\nimport debounce from \"debounce\";\r\nconst debouncedRequestScheduleList = debounce((dispatch, companyId = null) => {\r\n dispatch(requestScheduleList(companyId));\r\n}, 2200);\r\nconst debouncedRequestScheduleTriggerList = debounce((dispatch, scheduleId) => {\r\n dispatch(requestScheduleTriggerList(scheduleId));\r\n}, 2200);\r\n\r\nconst debouncedAlertUpdatedSchedule = debounce(dispatch => {\r\n dispatch(notifyGreen(\"Updated schedule(s).\"));\r\n}, 800);\r\n\r\nconst debouncedAlertUpdatedTrigger = debounce(dispatch => {\r\n dispatch(notifyGreen(\"Updated trigger(s).\"));\r\n}, 800);\r\n\r\n/*\r\n */\r\n\r\n// Save New Schedule //\r\n\r\n/*\r\n Schedule Types:\r\n\r\n Recurring = 0,\r\n OneTime = 1,\r\n NumberOfOccurrences = 2,\r\n EndDate = 3\r\n*/\r\n\r\nexport const requestEditSchedule =\r\n (\r\n id,\r\n name, // Name of schedule, required.\r\n cronString, // Cron string of when to run the schedule. Is ignored for OneTime.(?)\r\n timezone, // String representing timezone that the cronString is applicable to. Unsure of format.\r\n scheduleType = \"0\", // String containing a number. See above for list of types.\r\n runDate = \"\", // String containing a date. Must be provided if scheduleType is OneTime.\r\n endDate = \"\", // String containing a date. Must be provided if scheduleType is EndDate.\r\n nOccurrences = null, // int?. Must be >0 if scheduleType is NumberOfOccurrences\r\n automationIdSelected,\r\n isConsecutive,\r\n continueOnError,\r\n isActive,\r\n isScheduleTemplate, // is an activation destination template or not\r\n companyId = null, // used in edit companies\r\n defaultTriggerType = null, // used for activation destination schedules\r\n emails = null,\r\n flowId = null, // used in the export edit schedule modal\r\n TimeType = null,\r\n TimeCount = null,\r\n onSaveCallback = null // Optional Function to run when adding is done, can be null.\r\n ) =>\r\n (dispatch /*, getState*/) => {\r\n const saveUrl =\r\n \"/Schedule/Save?\" +\r\n h.serialize({\r\n id,\r\n name,\r\n cronString,\r\n timezone,\r\n scheduleType,\r\n runDate,\r\n endDate,\r\n nOccurrences,\r\n automationIdSelected,\r\n isConsecutive,\r\n continueOnError,\r\n isActive,\r\n isScheduleTemplate,\r\n companyId,\r\n defaultTriggerType,\r\n emails,\r\n flowId,\r\n TimeType,\r\n TimeCount,\r\n });\r\n\r\n dispatch(scheduleSaveStart());\r\n return fetch(saveUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (!data || !data.success) {\r\n throw new Error(\"Error saving schedule.\");\r\n } else {\r\n dispatch(notifyGreen('Saved schedule \"' + name + '\".'));\r\n\r\n if (onSaveCallback) {\r\n onSaveCallback(data.id);\r\n } else {\r\n dispatch(setScheduleModeAndEditId(\"list\", null, isScheduleTemplate));\r\n dispatch(requestScheduleList(companyId));\r\n }\r\n }\r\n dispatch(scheduleSaveFinish());\r\n })\r\n .catch(error => {\r\n dispatch(scheduleSaveFinish());\r\n h.error(\"Error saving schedule.\", error);\r\n });\r\n };\r\n\r\n// Are we saving? Not very sophisticated\r\n\r\nexport const scheduleSaveStart = () => ({\r\n type: \"SCHEDULE_SAVE_START\",\r\n});\r\n\r\nexport const scheduleSaveFinish = () => ({\r\n type: \"SCHEDULE_SAVE_FINISH\",\r\n});\r\n\r\n// Triggers\r\nexport const requestNewScheduleTrigger =\r\n (scheduleId, actionName, argument1, argument2, argument3, sort, onAddCallback) => (dispatch /*, getState*/) => {\r\n const saveUrl =\r\n \"/ScheduleTrigger/Add?\" + h.serialize({ scheduleId, actionName, argument1, argument2, argument3, sort });\r\n\r\n dispatch(scheduleSaveStart());\r\n return fetch(saveUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (!data || !data.id) {\r\n throw new Error(\"Error creating trigger.\");\r\n }\r\n\r\n dispatch(notifyGreen(\"Saved new trigger\"));\r\n\r\n dispatch(requestScheduleTriggerList(scheduleId));\r\n dispatch(scheduleSaveFinish());\r\n\r\n if (typeof onAddCallback == \"function\") {\r\n onAddCallback(data.id);\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(scheduleSaveFinish());\r\n h.error(\"Error creating trigger.\", error);\r\n });\r\n };\r\n\r\nexport const requestEditScheduleTrigger =\r\n (id, scheduleId, actionName, argument1, argument2, argument3, sort, isActive, dateUpdated, companyId = null) =>\r\n (dispatch /*, getState*/) => {\r\n const saveUrl =\r\n \"/ScheduleTrigger/Edit?\" +\r\n h.serialize({ id, scheduleId, actionName, argument1, argument2, argument3, sort, isActive, dateUpdated });\r\n\r\n dispatch(scheduleSaveStart());\r\n return fetch(saveUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (!data || !data.result || data.result != \"success\") {\r\n throw new Error(\"Error editing trigger.\");\r\n }\r\n debouncedAlertUpdatedTrigger(dispatch);\r\n debouncedRequestScheduleList(dispatch, companyId);\r\n debouncedRequestScheduleTriggerList(dispatch, scheduleId);\r\n dispatch(scheduleSaveFinish());\r\n })\r\n .catch(error => {\r\n dispatch(scheduleSaveFinish());\r\n h.error(\"Error editing trigger.\", error);\r\n });\r\n };\r\n\r\nexport const executeScheduleNow = id => dispatch => {\r\n dispatch(notifyGreen(\"Execute schedule submitted.\"));\r\n\r\n fetch(\"/Schedule/RunScheduleNow?\" + h.serialize({ id }), { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (!data || !data.result || data.result != \"success\") {\r\n throw new Error(\"Error executing schedule.\");\r\n }\r\n dispatch(notifyGreen(\"Schedule executed successfully.\"));\r\n })\r\n .catch(error => {\r\n dispatch(scheduleSaveFinish());\r\n h.error(\"Error executing schedule.\", error);\r\n });\r\n};\r\n\r\nexport const scheduleSetUnsavedChanges = value => ({\r\n type: \"SCHEDULE_SET_UNSAVED_CHANGES\",\r\n value,\r\n});\r\n","/// TREESEARCH ///\r\nexport const treeSearchUserTyped = (text, isModal = false, enhancedSearch = false, conceptualOn = true) => ({\r\n type: \"TREESEARCH_USER_TYPED\",\r\n text,\r\n isModal,\r\n enhancedSearch,\r\n conceptualOn,\r\n});\r\n\r\n// Don't call this directly\r\nexport const setTreeSearch = text => ({\r\n type: \"SET_TREESEARCH\",\r\n text,\r\n});\r\n\r\nexport const setEnhancedTreeSearch = () => ({\r\n type: \"SET_ENHANCED_TREESEARCH\",\r\n});\r\n\r\nexport const clearTreeSearch = () => ({\r\n type: \"CLEAR_TREESEARCH\",\r\n});\r\n\r\nexport const clearModalTreeSearch = () => ({\r\n type: \"CLEAR_MODAL_TREESEARCH\",\r\n});\r\n\r\nexport const requestClearSearch = () => ({\r\n type: \"CLEAR_SEARCH_REQUEST\",\r\n});\r\n\r\nexport const toggleConceptual = () => ({\r\n type: \"CONCEPTUAL_TOGGLE\",\r\n});\r\n\r\nexport const toggleModalConceptual = () => ({\r\n type: \"MODAL_CONCEPTUAL_TOGGLE\",\r\n});\r\n\r\n// DISCOVERY (the data engine search) //\r\nimport { requestFieldTreeIfNeeded } from \"./fieldTreeActions\";\r\nexport const setDiscoverySearch = text => ({\r\n type: \"SET_DISCOVERYSEARCH\",\r\n text,\r\n});\r\nexport const submitDiscoverySearch = text => dispatch => {\r\n dispatch({\r\n type: \"SUBMIT_DISCOVERYSEARCH\",\r\n text,\r\n });\r\n dispatch(requestFieldTreeIfNeeded());\r\n};\r\nexport const submitDiscoveryBundleOnlySearch = bundles => ({\r\n type: \"SUBMIT_DISCOVERY_BUNDLE_ONLY_SEARCH\",\r\n bundles,\r\n});\r\n\r\n// DISCOVERY SELECTIONS //\r\n\r\nexport const toggleSelectedDiscoveryResult = id => ({\r\n type: \"TOGGLE_SELECTED_DISCOVERY_RESULT\",\r\n id,\r\n});\r\nexport const clearSelectedDiscoveryResult = () => ({\r\n type: \"CLEAR_SELECTED_DISCOVERY_RESULT\",\r\n});\r\nexport const unselectedDiscoveryResultSet = setOfIdsToRemove => ({\r\n type: \"UNSELECT_DISCOVERY_RESULT_SET\",\r\n setOfIdsToRemove,\r\n});\r\n\r\n// DISCOVERY CONCEPTUAL //\r\nexport const setDiscoveryConceptualScore = value => ({\r\n type: \"SET_DISCOVERY_CONCEPTUAL_SCORE\",\r\n value,\r\n});\r\n\r\nexport const setDiscoveryConceptualMaxMatches = value => ({\r\n type: \"SET_DISCOVERY_CONCEPTUAL_MAX_MATCHES\",\r\n value,\r\n});\r\n\r\n// DISCOVERY FILTERS //\r\nexport const setDiscoveryFlagFilter = (flagName, value) => ({\r\n type: \"SET_DISCOVERY_FLAG_FILTER\",\r\n flagName,\r\n value,\r\n});\r\nexport const setDiscoveryBundleFilter = value => ({\r\n type: \"SET_DISCOVERY_BUNDLE_FILTER\",\r\n value,\r\n});\r\n\r\nexport const clearSearchAndSelection = () => dispatch => {\r\n dispatch(clearSelectedDiscoveryResult());\r\n dispatch(setDiscoverySearch(\"\"));\r\n};\r\n\r\nexport const setSearchLabels = newValue => ({\r\n type: \"SET_SEARCH_LABELS\",\r\n newValue,\r\n});\r\n\r\nexport const setSearchLabels2 = newValue => ({\r\n type: \"SET_SEARCH_LABELS2\",\r\n newValue,\r\n});\r\n\r\nexport const setSearchLabels3 = newValue => ({\r\n type: \"SET_SEARCH_LABELS3\",\r\n newValue,\r\n});\r\n","import h from \"../helpers\";\r\nimport { notifyBlack } from \"../actions/notifyActions\";\r\n\r\nif (!top.RDX) {\r\n top.RDX = {};\r\n}\r\n\r\n//// ALL SESSION INFO ////\r\nexport const setSessionInfo = sessionInfo => ({\r\n type: \"SET_SESSION\",\r\n sessionInfo,\r\n});\r\ntop.RDX.setSessionInfo = sessionInfo => top.store.dispatch(setSessionInfo(sessionInfo));\r\n\r\nexport const requestSessionInfo = () => dispatch =>\r\n fetch(\"/Account/GetSessionInfo\", { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n dispatch(setSessionInfo(data));\r\n });\r\ntop.RDX.requestSessionInfo = () => top.store.dispatch(requestSessionInfo());\r\n\r\n//// SELECTED USER ////\r\nexport const setUserId = userId => ({\r\n type: \"SET_USERID\",\r\n userId,\r\n});\r\ntop.RDX.setUserId = userId => top.store.dispatch(setUserId(userId));\r\n\r\n//// SELECTED COMPANY ////\r\nexport const setCompanyId = companyId => ({\r\n type: \"SET_COMPANYID\",\r\n companyId,\r\n});\r\ntop.RDX.setCompanyId = companyId => top.store.dispatch(setCompanyId(companyId));\r\n\r\n//// FEATURES ////\r\nexport const setEnabledFeatures = (enabledFeatures = []) => ({\r\n type: \"SET_ENABLED_FEATURES\",\r\n enabledFeatures,\r\n});\r\ntop.RDX.setEnabledFeatures = enabledFeatures => top.store.dispatch(setEnabledFeatures(enabledFeatures));\r\n\r\nexport const requestEnabledFeatures = () => dispatch =>\r\n fetch(\"/Main/MyFeatures\", { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (Array.isArray(data) && data.length) {\r\n top.enabledFeatures = data;\r\n dispatch(setEnabledFeatures(data));\r\n }\r\n });\r\ntop.RDX.requestEnabledFeatures = () => top.store.dispatch(requestEnabledFeatures());\r\n\r\n//// ISINTERNAL ////\r\n// Am I logged in as an internal user? Bool\r\nexport const setIsInternal = isInternal => ({\r\n type: \"SET_ISINTERNAL\",\r\n isInternal,\r\n});\r\ntop.RDX.setIsInternal = isInternal => top.store.dispatch(setIsInternal(isInternal));\r\n\r\nexport const requestIsInternal = () => dispatch =>\r\n fetch(\"/ReportsView/IsInternal\", { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const isInternal = data.result;\r\n dispatch(setIsInternal(isInternal));\r\n })\r\n .catch(error => {\r\n h.error(\"Error setting internal status.\", error);\r\n });\r\ntop.RDX.requestIsInternal = () => top.store.dispatch(requestIsInternal());\r\n\r\n/// LOGOUT ///\r\n\r\nexport const requestLogout = messageOverride => (dispatch, getState) => {\r\n const isOnNotAuthorizedSitePage = window.location.href.match(/account\\/notauthorizedsite/);\r\n const { isOnSPA } = getState().vars;\r\n //This was causing the logout error that we keep seeing. No clue why\r\n // dispatch(push(pushUrl));\r\n\r\n let token = \"\";\r\n if (document.getElementsByName(\"__RequestVerificationToken\").length > 0) {\r\n token = document.getElementsByName(\"__RequestVerificationToken\")[0].value;\r\n }\r\n fetch(\"/Account/LogOffJSON\", {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n Accept: \"application/json\",\r\n \"Content-Type\": \"application/json\",\r\n __RequestVerificationToken: token,\r\n },\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n if (data && data.success) {\r\n const message = messageOverride || \"Logged Off.\";\r\n dispatch(notifyBlack(message));\r\n top._loggedIn = false;\r\n\r\n if (isOnNotAuthorizedSitePage || !isOnSPA) {\r\n // This is a special page that doesn't use SPA/Router, so we need to manually send them off the error page.\r\n location.href = \"/Account/Login/\";\r\n }\r\n sessionStorage.removeItem(\"showPasswordExpiredNotification\");\r\n localStorage.setItem(\"logged_off\", \"true\");\r\n localStorage.removeItem(\"logged_off\");\r\n\r\n location.href = \"/Account/Login/\";\r\n }\r\n })\r\n .catch(error => {\r\n h.error(\"Error logging off.\", error);\r\n });\r\n};\r\ntop.RDX.requestLogout = messageOverride => top.store.dispatch(requestLogout(messageOverride));\r\n\r\n// Logs off without actually logging out - C# sends us this after it has destroyed our session.\r\nexport const logoutForcedByOtherSession = () => (dispatch, getState) => {\r\n const isOnNotAuthorizedSitePage = window.location.href.match(/account\\/notauthorizedsite/);\r\n const { isOnSPA } = getState().vars;\r\n\r\n top._loggedIn = false;\r\n if (isOnNotAuthorizedSitePage || !isOnSPA) {\r\n // This is a special page that doesn't use SPA/Router, so we need to manually send them off the error page.\r\n location.href = \"/Account/Login/\";\r\n }\r\n\r\n localStorage.setItem(\"logged_off\", \"true\");\r\n localStorage.removeItem(\"logged_off\");\r\n //dispatch(requestSessionInfo());\r\n};\r\ntop.RDX.logoutForcedByOtherSession = () => top.store.dispatch(logoutForcedByOtherSession());\r\n\r\nexport const extendSession = () => {\r\n try {\r\n if (top.AE && top.AE.sessionMonitorInstance) {\r\n top.AE.sessionMonitorInstance.extendSession(null, false, false);\r\n }\r\n } catch (error) {\r\n // eslint-disable-next-line no-console\r\n console.log(error);\r\n }\r\n};\r\n\r\nexport const stayLoggedIn = () => {\r\n try {\r\n if (top.AE && top.AE.sessionMonitorInstance) {\r\n top.AE.sessionMonitorInstance.stayLoggedIn(true);\r\n top.RDX.hideModal(\"TIMEOUT_SESSION_WARNING\");\r\n }\r\n } catch (error) {\r\n // eslint-disable-next-line no-console\r\n console.log(error);\r\n }\r\n};\r\n\r\nexport const logOff = () => {\r\n try {\r\n if (top.AE && top.AE.sessionMonitorInstance) {\r\n top.RDX.hideModal(\"TIMEOUT_SESSION_WARNING\");\r\n top.RDX.requestLogout();\r\n top.AE.sessionMonitorInstance.unload();\r\n }\r\n } catch (error) {\r\n // eslint-disable-next-line no-console\r\n console.log(error);\r\n }\r\n};\r\n","import { normalize, schema } from \"normalizr\";\r\nimport { push } from \"connected-react-router\";\r\n\r\nimport { incAjaxCount, decAjaxCount } from \"./actionCreators\";\r\nimport { toJson } from \"../helpers/typedHelpers\";\r\nimport h, { makeNewId } from \"../helpers\";\r\nimport { requestSessionInfo, requestEnabledFeatures } from \"./sessionActions\";\r\nimport { notifyGreen } from \"./notifyActions\";\r\nimport { SetUsersIsLoading, SetUserIsSaving, SetUserRoles } from \"./userAdminActions\";\r\nimport { SetReassignItemsToUser } from \"../actions/reassignedItemsToActions\";\r\n\r\nimport type {\r\n Dispatch,\r\n GetState,\r\n User,\r\n Company,\r\n UserCompany,\r\n NormalizedUserData,\r\n NormalizedCompanyData,\r\n NormalizedUserCompanyData,\r\n Site,\r\n Role,\r\n Features,\r\n} from \"../types/types\";\r\n\r\nif (!top.RDX) {\r\n top.RDX = {};\r\n}\r\n\r\nexport const requestUser = (userId: number) => (dispatch: Dispatch) => {\r\n const getUserListUrl = \"/UsersAdmin/GetUsers?\" + h.serialize({ userId });\r\n dispatch(incAjaxCount());\r\n fetch(getUserListUrl, { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n const normalizedUserData = normalizeUserData(data.users);\r\n dispatch({ type: \"USER_MERGEOVERWRITE_LIST\", things: normalizedUserData.entities[\"users\"] || [] });\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error getting user.\", error);\r\n });\r\n};\r\n\r\nexport const requestUserList = () => (dispatch: Dispatch) => {\r\n const getUserListUrl = \"/UsersAdmin/GetUsers\";\r\n dispatch(SetUsersIsLoading(true));\r\n dispatch(incAjaxCount());\r\n fetch(getUserListUrl, { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n const normalizedUserData = normalizeUserData(data.users);\r\n dispatch({ type: \"USER_REPLACE_LIST\", things: normalizedUserData.entities[\"users\"] || [] });\r\n dispatch(SetUsersIsLoading(false));\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error getting Users.\", error);\r\n });\r\n};\r\n\r\n// All companies that exist in the system\r\nexport const requestCompanies = () => (dispatch: Dispatch) => {\r\n const getCompaniesUrl = \"/UsersAdmin/GetCompanies\";\r\n dispatch(incAjaxCount());\r\n fetch(getCompaniesUrl, { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n const normalizedCompanyData = normalizeCompanyData(data.companies);\r\n dispatch({ type: \"COMPANY_REPLACE_LIST\", things: normalizedCompanyData.entities[\"companies\"] || [] });\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error getting Companies.\", error);\r\n });\r\n};\r\n\r\n// Companies that users has access to\r\nexport const requestAllUserCompanies = () => (dispatch: Dispatch) => {\r\n const getUserCompaniesUrl = \"/UsersAdmin/GetAllUserCompanies\";\r\n dispatch(incAjaxCount());\r\n fetch(getUserCompaniesUrl, { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n const normalizedUserCompaniesData = normalizeUserCompaniesData(data.userCompanies);\r\n dispatch({\r\n type: \"USERCOMPANY_REPLACE_LIST\",\r\n things: normalizedUserCompaniesData.entities[\"userCompanies\"] || [],\r\n });\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error getting users companies.\", error);\r\n });\r\n};\r\n\r\n// Companies that a particular user has access to\r\nexport const requestUserCompanies = (userId: number) => (dispatch: Dispatch) => {\r\n const getUserCompaniesUrl = \"/UsersAdmin/GetUserCompanies?\" + h.serialize({ userId });\r\n dispatch(incAjaxCount());\r\n fetch(getUserCompaniesUrl, { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n dispatch(cleanUpAllUserCompanies(userId));\r\n const normalizedUserCompaniesData = normalizeUserCompaniesData(data.userCompanies);\r\n dispatch({\r\n type: \"USERCOMPANY_MERGEOVERWRITE_LIST\",\r\n things: normalizedUserCompaniesData.entities[\"userCompanies\"] || [],\r\n });\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error getting users companies.\", error);\r\n });\r\n};\r\n\r\nexport const getUserRoles = () => (dispatch: Dispatch) => {\r\n const getUsersRolesUrl = \"/UsersAdmin/GetAllUserRoles\";\r\n dispatch(incAjaxCount());\r\n fetch(getUsersRolesUrl, { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n dispatch(SetUserRoles(data.roles));\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error getting user roles.\", error);\r\n });\r\n};\r\n\r\nexport const requestUserActiveUpdate = (userId: number, newStatus: boolean) => (dispatch: Dispatch) => {\r\n const toggleUserActiveUrl =\r\n \"/UsersAdmin/UpdateActiveStatus?\" +\r\n h.serialize({\r\n userId,\r\n newStatus,\r\n });\r\n dispatch(incAjaxCount());\r\n fetch(toggleUserActiveUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(() => {\r\n dispatch({\r\n type: \"USER_CHANGE_ATTRIBUTE\",\r\n id: userId,\r\n attribute: \"UserActive\",\r\n value: newStatus,\r\n meta: { doNotBatch: false },\r\n });\r\n dispatch(decAjaxCount());\r\n dispatch(requestReloadUser(userId));\r\n dispatch(notifyGreen(`User successfully set to ${newStatus ? \"Active\" : \"Inactive\"}.`));\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n if (error.message && error.message.includes(\"No seats available\")) {\r\n h.error(error.message);\r\n } else {\r\n h.error(\"Error updating user. Please contact your admin for assistance.\", error);\r\n }\r\n });\r\n};\r\n\r\nexport const requestClearUserLockout = (userId: number) => (dispatch: Dispatch) => {\r\n const clearLockoutUrl = \"/UsersAdmin/ClearUserLockout?\" + h.serialize({ userId });\r\n\r\n dispatch(incAjaxCount());\r\n fetch(clearLockoutUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(() => {\r\n dispatch({\r\n type: \"USER_CHANGE_ATTRIBUTE\",\r\n id: userId,\r\n attribute: \"LockoutEndDateUtc\",\r\n value: null,\r\n meta: { doNotBatch: false },\r\n });\r\n dispatch(decAjaxCount());\r\n dispatch(notifyGreen(\"User successfully unlocked.\"));\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error updating user. Please contact your admin for assistance.\", error);\r\n });\r\n};\r\n\r\nexport const setSelectedUser = (userId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n dispatch({\r\n type: \"SET_SELECTED_USER\",\r\n userId,\r\n });\r\n const state = getState();\r\n if (!state.router || !state.router.location) {\r\n return;\r\n }\r\n\r\n if (userId == 0) {\r\n dispatch(push(\"/admin/users\"));\r\n } else {\r\n dispatch(push(\"/admin/users/edit/\" + userId));\r\n }\r\n};\r\n\r\nexport const setSelectedReassignTo = (reassiendUserId: number) => (dispatch: Dispatch) => {\r\n dispatch({\r\n type: \"SET_SELECTED_REASSIGN_TO\",\r\n reassiendUserId,\r\n });\r\n};\r\n\r\nexport const requestSites = () => (dispatch: Dispatch) => {\r\n const getSitesUrl = \"/UsersAdmin/GetSites\";\r\n dispatch(incAjaxCount());\r\n fetch(getSitesUrl, { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n dispatch({ type: \"SITE_REPLACE_LIST\", sites: data.sites });\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error getting Sites.\", error);\r\n });\r\n};\r\n\r\nexport const requestCompanySeats = () => (dispatch: Dispatch) => {\r\n const getSeatsUrl = \"/UsersAdmin/GetCompanySeats\";\r\n dispatch(incAjaxCount());\r\n fetch(getSeatsUrl, { credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n dispatch({ type: \"COMPANYSEAT_REPLACE_LIST\", companySeats: data.companySeats });\r\n dispatch(decAjaxCount());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error getting Company Seats.\", error);\r\n });\r\n};\r\n\r\nexport const updateUserAttribute = (userId: number, attribute: string, value: any) => (dispatch: Dispatch) => {\r\n dispatch({\r\n type: \"USER_CHANGE_ATTRIBUTE\",\r\n id: userId,\r\n attribute,\r\n value,\r\n meta: { doNotBatch: true },\r\n });\r\n dispatch(setUserHasUnsavedChanges(userId, true));\r\n};\r\n\r\nexport const setUserHasUnsavedChanges = (userId: number, value: any) => ({\r\n type: \"USER_CHANGE_ATTRIBUTE\",\r\n id: userId,\r\n attribute: \"hasUnsavedChanges\",\r\n value,\r\n});\r\n\r\nexport const addUserCompany = (userId: number, companyId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const newId = makeNewId(state.userCompanies.byId);\r\n\r\n const newUserCompany: UserCompany = {\r\n CompanyID: companyId,\r\n UserKey: userId,\r\n UserSecurityLevelKey: null,\r\n ID: newId,\r\n TableauAccess: null,\r\n };\r\n\r\n dispatch({\r\n type: \"USERCOMPANY_ADD\",\r\n id: newId,\r\n thing: newUserCompany,\r\n });\r\n};\r\n\r\nimport { getAllUserCompanies } from \"../reducers/userCompanies\";\r\nexport const removeUserCompany = (userId: number, companyId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const userCompanies = getAllUserCompanies(state);\r\n\r\n const users = state.users.byId;\r\n const user = users[userId];\r\n //user access to its current company was removed\r\n if (user.CurrentCompanyID == companyId) {\r\n dispatch(updateUserAttribute(userId, \"CurrentCompanyID\", null));\r\n }\r\n const userCompany = userCompanies.filter(x => x.UserKey == userId && x.CompanyID == companyId)[0];\r\n if (userCompany) {\r\n dispatch({\r\n type: \"USERCOMPANY_DELETE\",\r\n id: userCompany.ID,\r\n });\r\n }\r\n};\r\n\r\nexport const addNewUser = () => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n\r\n const newId = makeNewId(state.users.byId);\r\n let newUser: User = {\r\n Id: newId,\r\n OriginalKey: null,\r\n Email: \"\",\r\n EmailConfirmed: false,\r\n PhoneNumber: null,\r\n PhoneNumberConfirmed: false,\r\n TwoFactorEnabled: false,\r\n LockOutEndDateUtc: null,\r\n LockOutEnabled: true,\r\n AccessFailedCount: 0,\r\n UserName: \"\",\r\n FirstName: \"\",\r\n LastName: \"\",\r\n PasswordLastChanged: null,\r\n UserActive: true,\r\n LastLoginTime: null,\r\n RegistrationDate: null,\r\n CurrentCompanyID: null,\r\n IsInternal: false,\r\n IsSSO: false,\r\n IsSSOB2B: false,\r\n IsSendWelcomeEmail: true,\r\n ExpireDate: null,\r\n LogonId: \"\",\r\n errors: null,\r\n };\r\n\r\n dispatch({\r\n type: \"USER_ADD\",\r\n id: newId,\r\n thing: newUser,\r\n });\r\n dispatch(setSelectedUser(newId));\r\n};\r\n\r\nexport const addNewReassignedUser =\r\n (newEmail: string, newFirstName: string, newLastName: string, companyId: number) => (dispatch: Dispatch) => {\r\n const newId = makeNewId(null);\r\n let newUser: User = {\r\n Id: newId,\r\n OriginalKey: null,\r\n Email: newEmail,\r\n EmailConfirmed: true,\r\n PhoneNumber: null,\r\n PhoneNumberConfirmed: false,\r\n TwoFactorEnabled: false,\r\n LockOutEndDateUtc: null,\r\n LockOutEnabled: true,\r\n AccessFailedCount: 0,\r\n UserName: newEmail,\r\n FirstName: newFirstName,\r\n LastName: newLastName,\r\n PasswordLastChanged: null,\r\n UserActive: true,\r\n LastLoginTime: null,\r\n RegistrationDate: null,\r\n CurrentCompanyID: companyId,\r\n IsInternal: true,\r\n IsSSO: false,\r\n IsSSOB2B: false,\r\n IsSendWelcomeEmail: true,\r\n ExpireDate: null,\r\n LogonId: \"\",\r\n errors: null,\r\n };\r\n\r\n dispatch({\r\n type: \"USER_ADD\",\r\n id: newId,\r\n thing: newUser,\r\n });\r\n //dispatch(setSelectedReassignTo(newId));\r\n dispatch(SetReassignItemsToUser(newId));\r\n };\r\n\r\nexport const requestSendWelcomeEmail = (userId: number) => (dispatch: Dispatch) => {\r\n if (userId > 0) {\r\n const deleteUserUrl = \"/UsersAdmin/SendWelcomeEmail?\" + h.serialize({ userId });\r\n dispatch(incAjaxCount());\r\n fetch(deleteUserUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n if (data.success) {\r\n dispatch(notifyGreen(\"Welcome email was sent.\"));\r\n } else {\r\n h.error(\"Error sending email.\");\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error sending email.\", error);\r\n });\r\n }\r\n};\r\n\r\nexport const requestDeleteUser = (userId: number) => (dispatch: Dispatch) => {\r\n if (userId <= 0) {\r\n dispatch(deleteUser(userId));\r\n } else {\r\n const deleteUserUrl = \"/UsersAdmin/DeleteUser?\" + h.serialize({ userId });\r\n dispatch(incAjaxCount());\r\n fetch(deleteUserUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n if (data.success) {\r\n dispatch(deleteUser(userId));\r\n } else {\r\n h.error(\"Error deleting user.\");\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error deleting user.\", error);\r\n });\r\n }\r\n};\r\n\r\nexport const deleteUser = (userId: number) => (dispatch: Dispatch) => {\r\n dispatch(cleanUpAllUserCompanies(userId));\r\n dispatch({\r\n type: \"USER_DELETE\",\r\n id: userId,\r\n });\r\n};\r\n\r\nexport const requestReloadUser = (userId: number) => (dispatch: Dispatch) => {\r\n dispatch(requestUser(userId));\r\n dispatch(requestUserCompanies(userId));\r\n};\r\n\r\nexport const requestUserSave =\r\n (\r\n userId: number,\r\n //things kept in component state only\r\n userSites: Array,\r\n userRoles: Array,\r\n userFeatures: Array,\r\n temporaryAccount: boolean\r\n ) =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const currentUser = state.session.userId;\r\n const users = state.users.byId;\r\n const user = users[userId];\r\n const allUserCompanies = getAllUserCompanies(state);\r\n const userCompanies = allUserCompanies.filter(c => c.UserKey == userId);\r\n\r\n const dataToSave = {\r\n user,\r\n userSites: userSites.map(s => s.Id),\r\n userRoles: userRoles.map(r => r.Id),\r\n userFeatures: userFeatures.map(f => f.Id),\r\n userCompanies: userCompanies.map(c => c.CompanyID),\r\n temporaryAccount,\r\n };\r\n\r\n dispatch(incAjaxCount());\r\n dispatch(updateUserAttribute(userId, \"isSaving\", true));\r\n dispatch(SetUserIsSaving(true));\r\n\r\n // Get the Anti-forgery Token to pass in the headers\r\n let token = \"\";\r\n if (document.getElementsByName(\"__RequestVerificationToken\").length > 0) {\r\n let element = document.getElementsByName(\"__RequestVerificationToken\")[0];\r\n if (element instanceof HTMLInputElement) {\r\n token = element.value;\r\n }\r\n }\r\n\r\n fetch(\"/UsersAdmin/SaveUser\", {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n Accept: \"application/json\",\r\n \"Content-Type\": \"application/json\",\r\n __RequestVerificationToken: token,\r\n },\r\n body: JSON.stringify(dataToSave),\r\n })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n dispatch(updateUserAttribute(userId, \"isSaving\", false));\r\n dispatch(SetUserIsSaving(false));\r\n\r\n if (data.userId != userId) {\r\n dispatch({\r\n type: \"USER_ID_CHANGE\",\r\n idChanges: [[userId, data.userId]],\r\n });\r\n dispatch(setSelectedUser(data.userId));\r\n }\r\n\r\n if (data.userId > 0) {\r\n //update data from server, properties may have changed\r\n if (!data.errors) {\r\n dispatch(requestUser(data.userId));\r\n }\r\n if (userId != data.userId) {\r\n //need to user userId instead of data.userId in case it was a new user\r\n dispatch(cleanUpAllUserCompanies(userId));\r\n }\r\n\r\n dispatch(requestUserCompanies(data.userId));\r\n //if user being edited is the current user in session\r\n if (currentUser == userId) {\r\n dispatch(requestSessionInfo());\r\n dispatch(requestUserList());\r\n }\r\n }\r\n\r\n if (data.success) {\r\n dispatch(notifyGreen(\"User saved successfully.\"));\r\n dispatch(setSelectedUser(0));\r\n dispatch(requestReloadUser(user.Id));\r\n } else {\r\n if (data.errors && data.errors.companiesWithNoSeats) {\r\n h.error(\"User was saved but some companies could not be added.\");\r\n } else {\r\n h.error(\"Error saving user.\");\r\n }\r\n dispatch(updateUserAttribute(data.userId || userId, \"errors\", data.errors || {}));\r\n }\r\n dispatch(requestCompanySeats());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n dispatch(updateUserAttribute(userId, \"isSaving\", false));\r\n dispatch(SetUserIsSaving(false));\r\n h.error(\"Error saving user.\", error);\r\n });\r\n };\r\n\r\nexport const requestNewUserBeforeReassign =\r\n (\r\n userId: number,\r\n //things kept in component state only\r\n userSites: Array,\r\n userRoles: Array,\r\n userFeatures: Array\r\n ) =>\r\n (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n\r\n const currentReassignedUserId = state.reassignedItemsTo.reassiendUserId;\r\n // const currentUser = state.session.userId;\r\n const users = state.users.byId;\r\n const user = users[currentReassignedUserId];\r\n const allUserCompanies = getAllUserCompanies(state);\r\n const userCompanies = allUserCompanies.filter(c => c.UserKey == userId);\r\n\r\n const dataToSave = {\r\n user,\r\n userSites: userSites.map(s => s.Id),\r\n userRoles: userRoles.map(r => r.Id),\r\n userFeatures: userFeatures.map(f => f.Id),\r\n userCompanies: userCompanies.map(c => c.CompanyID),\r\n temporaryAccount: false,\r\n };\r\n\r\n dispatch(incAjaxCount());\r\n dispatch(updateUserAttribute(userId, \"isSaving\", true));\r\n dispatch(SetUserIsSaving(true));\r\n\r\n // Get the Anti-forgery Token to pass in the headers\r\n let token = \"\";\r\n if (document.getElementsByName(\"__RequestVerificationToken\").length > 0) {\r\n let element = document.getElementsByName(\"__RequestVerificationToken\")[0];\r\n if (element instanceof HTMLInputElement) {\r\n token = element.value;\r\n }\r\n }\r\n\r\n fetch(\"/UsersAdmin/SaveUser\", {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: {\r\n Accept: \"application/json\",\r\n \"Content-Type\": \"application/json\",\r\n __RequestVerificationToken: token,\r\n },\r\n body: JSON.stringify(dataToSave),\r\n })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n dispatch(updateUserAttribute(userId, \"isSaving\", false));\r\n dispatch(SetUserIsSaving(false));\r\n\r\n if (data.userId != currentReassignedUserId) {\r\n dispatch({\r\n type: \"USER_ID_CHANGE\",\r\n idChanges: [[currentReassignedUserId, data.userId]],\r\n });\r\n //dispatch(setSelectedReassignTo(data.userId));\r\n dispatch(SetReassignItemsToUser(data.userId));\r\n }\r\n\r\n if (data.success) {\r\n dispatch(notifyGreen(\"User saved successfully.\"));\r\n } else {\r\n if (data.errors && data.errors.companiesWithNoSeats) {\r\n h.error(\"User was saved but some companies could not be added.\");\r\n } else {\r\n h.error(\"Error saving user.\");\r\n }\r\n dispatch(updateUserAttribute(data.userId || currentReassignedUserId, \"errors\", data.errors || {}));\r\n }\r\n dispatch(requestCompanySeats());\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n dispatch(updateUserAttribute(userId, \"isSaving\", false));\r\n dispatch(SetUserIsSaving(false));\r\n h.error(\"Error saving user.\", error);\r\n });\r\n };\r\n\r\nexport const SaveUserFeatures = (selectedFeatures: Array) => (dispatch: Dispatch) => {\r\n dispatch(incAjaxCount());\r\n\r\n fetch(\r\n \"/UsersAdmin/SaveUserFeatures\",\r\n {\r\n credentials: \"same-origin\",\r\n method: \"POST\",\r\n headers: { Accept: \"application/json\", \"Content-Type\": \"application/json\" },\r\n body: JSON.stringify(selectedFeatures),\r\n },\r\n dispatch\r\n )\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(() => {\r\n dispatch(decAjaxCount());\r\n dispatch(requestEnabledFeatures());\r\n dispatch(notifyGreen(\"User features saved successfully.\"));\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error saving user features.\", error);\r\n });\r\n};\r\n\r\n//deletes all user companies from state\r\nexport const cleanUpAllUserCompanies = (userId: number) => (dispatch: Dispatch, getState: GetState) => {\r\n const state = getState();\r\n const allUserCompanies = getAllUserCompanies(state);\r\n const userCompanies = allUserCompanies.filter(c => c.UserKey == userId);\r\n\r\n for (const userCompany of userCompanies) {\r\n dispatch({\r\n type: \"USERCOMPANY_DELETE\",\r\n id: userCompany.ID,\r\n });\r\n }\r\n};\r\n\r\nexport const requestReassignUserItems = (fromUser: number, toUser: number) => (dispatch: Dispatch) => {\r\n const reassignUserItemsUrl = \"/UsersAdmin/ReassignUserItems\";\r\n\r\n const data = {\r\n fromUser,\r\n toUser,\r\n };\r\n\r\n dispatch(incAjaxCount());\r\n fetch(reassignUserItemsUrl, {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n headers: { Accept: \"application/json\", \"Content-Type\": \"application/json\" },\r\n body: JSON.stringify(data),\r\n })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(() => {\r\n dispatch(decAjaxCount());\r\n dispatch(notifyGreen(\"Reassignment processing...\"));\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error reassigning user items.\", error);\r\n });\r\n};\r\n\r\nexport const requestReassignUserItemsThenDelete =\r\n (fromUser: number, toUser: number, folderName: string) => (dispatch: Dispatch) => {\r\n const reassignUserItemsUrl = \"/UsersAdmin/ReassignUserItemsThenDelete\";\r\n\r\n const data = {\r\n fromUser,\r\n toUser,\r\n folderName,\r\n };\r\n\r\n dispatch(incAjaxCount());\r\n fetch(reassignUserItemsUrl, {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n headers: { Accept: \"application/json\", \"Content-Type\": \"application/json\" },\r\n body: JSON.stringify(data),\r\n })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(() => {\r\n dispatch(decAjaxCount());\r\n dispatch(notifyGreen(\"Reassignment then deleting user processing...\"));\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error reassigning user items.\", error);\r\n });\r\n };\r\n\r\nexport const requestUpdateUserTableauAccess =\r\n (userId: number, userCompanyId: number, companyId: number, oldValue: ?string, newVal: ?string) =>\r\n (dispatch: Dispatch) => {\r\n const updateTableauAccessUrl = \"/UsersAdmin/UpdateUserTableauAccess\";\r\n\r\n const data = {\r\n userId,\r\n companyId,\r\n newVal,\r\n };\r\n\r\n dispatch(incAjaxCount());\r\n //optimistic update\r\n dispatch({\r\n type: \"USERCOMPANY_CHANGE_ATTRIBUTE\",\r\n id: userCompanyId,\r\n attribute: \"TableauAccess\",\r\n value: newVal,\r\n });\r\n\r\n fetch(updateTableauAccessUrl, {\r\n method: \"POST\",\r\n credentials: \"same-origin\",\r\n headers: { Accept: \"application/json\", \"Content-Type\": \"application/json\" },\r\n body: JSON.stringify(data),\r\n })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(() => {\r\n dispatch(decAjaxCount());\r\n dispatch(notifyGreen(\"Tableau access updated.\"));\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n //rollback the update\r\n dispatch({\r\n type: \"USERCOMPANY_CHANGE_ATTRIBUTE\",\r\n id: userCompanyId,\r\n attribute: \"TableauAccess\",\r\n value: oldValue,\r\n });\r\n h.error(\"Error updating tableau access.\", error);\r\n });\r\n };\r\n\r\nexport const requestResetUserPassword = (userId: number) => (dispatch: Dispatch) => {\r\n const resetUserPasswordUrl = \"/UsersAdmin/ResetUserPassword?\" + h.serialize({ userId });\r\n dispatch(incAjaxCount());\r\n fetch(resetUserPasswordUrl, { method: \"POST\", credentials: \"same-origin\" })\r\n .then(h.checkStatus)\r\n .then(toJson)\r\n .then(data => {\r\n dispatch(decAjaxCount());\r\n if (data.success) {\r\n dispatch(notifyGreen(\"User password reset submitted.\"));\r\n } else {\r\n h.error(\"Error resetting user password.\");\r\n }\r\n })\r\n .catch(error => {\r\n dispatch(decAjaxCount());\r\n h.error(\"Error resetting user password.\", error);\r\n });\r\n};\r\n\r\nexport const setLoadingCompany = (loadingCompanies: boolean) => ({\r\n type: \"SET_LOADING_COMPANY\",\r\n loadingCompanies,\r\n});\r\n\r\nconst normalizeUserData = (userData: Array): NormalizedUserData => {\r\n const user = new schema.Entity(\"users\", {}, { idAttribute: \"Id\" });\r\n const mySchema = {\r\n users: [user],\r\n };\r\n return normalize({ users: userData }, mySchema);\r\n};\r\n\r\nconst normalizeCompanyData = (companyData: Array): NormalizedCompanyData => {\r\n const company = new schema.Entity(\"companies\", {}, { idAttribute: \"CompanyID\" });\r\n const mySchema = {\r\n companies: [company],\r\n };\r\n return normalize({ companies: companyData }, mySchema);\r\n};\r\nconst normalizeUserCompaniesData = (userCompaniesData: Array): NormalizedUserCompanyData => {\r\n const userCompany = new schema.Entity(\"userCompanies\", {}, { idAttribute: \"ID\" });\r\n const mySchema = {\r\n userCompanies: [userCompany],\r\n };\r\n return normalize({ userCompanies: userCompaniesData }, mySchema);\r\n};\r\n","import {\r\n ISetLoadingUsers,\r\n ISetUserIsSaving,\r\n IUpdateUserAdminShowInternal,\r\n IUpdateUserAdminCompanyIDFilter,\r\n IUpdateRoleListFilter,\r\n IGetUserRoles,\r\n IUserRole,\r\n IUpdateUserListFilter,\r\n} from \"../types/stores/userAdmin\";\r\nimport {\r\n SET_IS_LOADING_USERS,\r\n SET_IS_SAVING_USER,\r\n UPDATE_USER_ADMIN_SHOW_INTERNAL,\r\n UPDATE_USER_ADMIN_COMPANYID_FILTER,\r\n UPDATE_ROLE_LIST_FILTER,\r\n GET_USER_ROLES,\r\n UPDATE_USER_LIST_FILTER,\r\n} from \"../reducers/userAdmin\";\r\n\r\nexport const SetUsersIsLoading = (newValue: boolean): ISetLoadingUsers => ({\r\n type: SET_IS_LOADING_USERS,\r\n isLoading: newValue,\r\n});\r\n\r\nexport const SetUserIsSaving = (newValue: boolean): ISetUserIsSaving => ({\r\n type: SET_IS_SAVING_USER,\r\n isSaving: newValue,\r\n});\r\n\r\nexport const updateUserAdminShowInternal = (newValue: boolean): IUpdateUserAdminShowInternal => ({\r\n type: UPDATE_USER_ADMIN_SHOW_INTERNAL,\r\n showInternal: newValue,\r\n});\r\n\r\nexport const updateUserAdminCompanyIdFilter = (newValue: number): IUpdateUserAdminCompanyIDFilter => ({\r\n type: UPDATE_USER_ADMIN_COMPANYID_FILTER,\r\n companyId: newValue,\r\n});\r\n\r\nexport const updateRoleListFilter = (newValue: string): IUpdateRoleListFilter => ({\r\n type: UPDATE_ROLE_LIST_FILTER,\r\n role: newValue,\r\n});\r\n\r\nexport const SetUserRoles = (newValue: Array): IGetUserRoles => ({\r\n type: GET_USER_ROLES,\r\n userRoles: newValue,\r\n});\r\n\r\nexport const updateUserListFilter = (newValue: Array): IUpdateUserListFilter => ({\r\n type: UPDATE_USER_LIST_FILTER,\r\n filter: newValue,\r\n});\r\n","import React, { useEffect, useState } from \"react\";\r\nimport { useSelector, useDispatch } from \"react-redux\";\r\nimport h from \"../../../../helpers\";\r\n\r\n// components\r\nimport {\r\n Paper,\r\n TextField,\r\n Button,\r\n TextareaAutosize,\r\n FormLabel,\r\n Select,\r\n MenuItem,\r\n Checkbox,\r\n FormControlLabel,\r\n InputLabel,\r\n Table,\r\n TableHead,\r\n TableBody,\r\n TableRow,\r\n TableCell,\r\n Divider,\r\n Tooltip,\r\n} from \"@material-ui/core\";\r\nimport Alert from \"@material-ui/lab/Alert\";\r\nimport BouncingDots from \"../../../loading/BouncingDots\";\r\nimport IconSwitch from \"../../../material-components/Misc/IconSwitch\";\r\nimport FlowControlInputFiles from \"./FlowControlInputFiles\";\r\n\r\n// reducers\r\nimport { getSelectedFlowPermissions, getFlowItemsForSelectedFlow } from \"../../../../reducers/flowItems\";\r\nimport {\r\n getFlowExternalServiceForSelectedFlowItem,\r\n getFilteredInputFileLocations,\r\n} from \"../../../../reducers/flowExternalServices\";\r\nimport { getFlowExternalServiceInputsForSelectedFlowItem } from \"../../../../reducers/flowExternalServiceInputs\";\r\nimport { getFlowRelationsForSelectedFlow } from \"../../../../reducers/flowRelations\";\r\n\r\n// actions\r\nimport { GetS3FileInfo, ResetS3Data } from \"../../../../actions/awsActions\";\r\nimport { showModal } from \"../../../../actions/actionCreators\";\r\nimport {\r\n updateMultipleAttribute,\r\n invalidateItemAndChildren,\r\n newFlowExternalServiceInput,\r\n deleteFlowExternalServiceInput,\r\n} from \"../../../../actions/flowActions\";\r\nimport { requestFlowItemResultTables } from \"../../../../actions/flowItemEditActions\";\r\n\r\n// types\r\nimport { IAppState } from \"../../../../types/stores\";\r\nimport {\r\n FlowExternalServiceParameter,\r\n FlowItem,\r\n FlowPermissions,\r\n FlowRelation,\r\n SnowflakeSelectedColumn,\r\n} from \"../../../../types/stores/flowTypes\";\r\nimport { LayoutTypes } from \"../../../layouts-external-service/LayoutBuilder\";\r\nimport FlowControlLayoutPicker from \"./FlowControlLayoutPicker\";\r\nimport NumericalTextField from \"../../../material-components/Misc/NumericalTextField\";\r\n\r\nimport { SortableContainer, SortableElement } from \"react-sortable-hoc\";\r\nimport { arrayMoveImmutable } from \"array-move\";\r\nimport { SortableHandle } from \"react-sortable-hoc\";\r\nimport { Autocomplete } from \"@material-ui/lab\";\r\nimport { IExternalServiceParameter } from \"../../../../types/stores/flowControlData\";\r\nimport { getFlowExternalServiceParametersForSelectedFlowItem } from \"../../../../reducers/flowExternalServiceParameters\";\r\nimport { BrowseFileIntegrations } from \"../../../../helpers/constants\";\r\n\r\nconst DragHandle = SortableHandle(() => drag_handle);\r\n\r\nconst SortableItem = SortableElement(({ colIndex, disabled, col, externalService }) => {\r\n const dispatch = useDispatch();\r\n\r\n return (\r\n
\r\n
\r\n \r\n
\r\n
{col.ColumnName}
\r\n
\r\n {\r\n const newColumns = [...externalService.InputTableColumns];\r\n\r\n newColumns[colIndex].Include = e.target.checked;\r\n dispatch(\r\n updateMultipleAttribute(\r\n \"flowExternalServices\",\r\n externalService.FlowExternalServiceId,\r\n {\r\n InputTableColumns: newColumns,\r\n }\r\n )\r\n );\r\n }}\r\n checked={col.Include}\r\n disabled={disabled}\r\n />\r\n }\r\n label={\r\n \r\n
\r\n Include Column \r\n \r\n info\r\n \r\n
\r\n
\r\n }\r\n />\r\n
\r\n
\r\n );\r\n});\r\n\r\nconst SortableList = SortableContainer(({ externalService, permissions }) => (\r\n
\r\n {externalService.InputTableColumns.map((col, index) => (\r\n \r\n ))}\r\n
\r\n));\r\n\r\nexport enum BrowseFileLocations {\r\n S3 = \"S3\",\r\n PLEX5 = \"PLEX5\",\r\n SF = \"SNOWFLAKE\",\r\n SERVER = \"Server\",\r\n}\r\n\r\nconst bouncingLayout = {\r\n marginTop: \"-390px\",\r\n marginLeft: \"-350px\",\r\n};\r\n\r\nconst bouncingNoLayout = {\r\n marginTop: \"40px\",\r\n marginLeft: \"-350px\",\r\n};\r\n\r\nconst FlowControlInput: React.FC = () => {\r\n const propertyName = \"InputLayoutId\";\r\n const dispatch = useDispatch();\r\n\r\n // State\r\n const [fileLocationId, setFileLocationId] = useState(0);\r\n const [selectedFile, setSelectedFile] = useState(\"\");\r\n const [filePreview, setFilePreview] = useState(\"\");\r\n const [isInputRelativePosition, setIsInputRelativePosition] = useState(false);\r\n const [canRetainInput, setCanRetainInput] = useState(false);\r\n const [isLoading, setIsLoading] = useState(false);\r\n const [databases, setDatabases] = useState>();\r\n const [selectedDatabase, setSelectedDatabase] = useState(\"\");\r\n const [schemas, setSchemas] = useState>([]);\r\n const [selectedSchema, setSelectedSchema] = useState(\"\");\r\n const [tables, setTables] = useState>([]);\r\n const [selectedTable, setSelectedTable] = useState(\"\");\r\n const [isS3Input, setIsS3Input] = useState(false);\r\n const [isServerInput, setIsServerInput] = useState(false);\r\n const [isSnowflakeInput, setIsSnowflakeInput] = useState(false);\r\n const [isPLEX5Input, setIsPLEX5Input] = useState(false);\r\n const [previewColumns, setPreviewColumns] = useState>([]);\r\n const [previewRows, setPreviewRows] = useState>([]);\r\n const [includeAllColumns, setIncludeAllColumns] = useState(true);\r\n const [hasRestrictedUser, setHasRestrictedUser] = useState(false);\r\n const [isParentNodeScript, setIsParentNodeScript] = useState(false);\r\n const [parentTableName, setParentTableName] = useState(\"\");\r\n const [parentTables, setParentTables] = useState>([]);\r\n const [parentFlowItemId, setParentFlowItemId] = useState(0);\r\n const [isTestMode, setIsTestMode] = useState(false);\r\n const [testLimitValue, setTestLimitValue] = useState(0);\r\n\r\n // Redux\r\n const flowExternalService = useSelector((state: IAppState) => getFlowExternalServiceForSelectedFlowItem(state));\r\n const flowExternalServiceInputs = useSelector((state: IAppState) =>\r\n getFlowExternalServiceInputsForSelectedFlowItem(state)\r\n );\r\n const flowPermissions = useSelector(state => getSelectedFlowPermissions(state));\r\n const awsIsDownloading = useSelector(state => state.aws.isDownloading);\r\n const awsFileName = useSelector(state => state.aws.fileName);\r\n const awsFilePreview = useSelector(state => state.aws.filePreview || \"\");\r\n const awsError = useSelector((state: IAppState) => state.aws.error);\r\n const externalInputFileLocation = useSelector((state: IAppState) => getFilteredInputFileLocations(state));\r\n const layouts = useSelector((state: IAppState) => state.externalServiceLayoutData.externalServiceLayouts);\r\n const layout = layouts.find(l => l.LayoutId == flowExternalService[propertyName]);\r\n const enabledFeatures = useSelector((state: IAppState) => state.session.enabledFeatures);\r\n const roles = useSelector((state: IAppState) => state.session.roles);\r\n const isSuperAdmin = roles.includes(\"Super Admin\");\r\n const flowRelations = useSelector>(state => getFlowRelationsForSelectedFlow(state));\r\n const flowItems = useSelector>(state => getFlowItemsForSelectedFlow(state));\r\n const resultTables = useSelector((state: IAppState) => state.flowItemResultTables.resultTables);\r\n const flowServiceParameters = useSelector>(state =>\r\n getFlowExternalServiceParametersForSelectedFlowItem(state)\r\n );\r\n const testSwitchParam = useSelector(state =>\r\n state.flowControlData.externalServiceParameters.find(x => x.ExternalParameter.ParameterName == \"Test_Switch\")\r\n );\r\n const testLimitValueParam = useSelector(state =>\r\n state.flowControlData.externalServiceParameters.find(\r\n x => x.ExternalParameter.ParameterName == \"Test_Limit_Value\"\r\n )\r\n );\r\n\r\n // Input locations\r\n const s3FileLocation = externalInputFileLocation.find(x => x.FileLocationName == BrowseFileLocations.S3);\r\n const snowflakeLocation = externalInputFileLocation.find(x => x.FileLocationName == BrowseFileLocations.SF);\r\n const serverFileLocation = externalInputFileLocation.find(x => x.FileLocationName == BrowseFileLocations.SERVER);\r\n const plex5FileLocation = externalInputFileLocation.find(x => x.FileLocationName == BrowseFileLocations.PLEX5);\r\n\r\n // Features\r\n const isMultiInputFeature = enabledFeatures.includes(\"flow-control-multi-input\");\r\n const autopopulateSnowflateQuantityFeature = enabledFeatures.includes(\"auto-populate-snowflake-table-quantity\");\r\n const isServerFileImportFeature = enabledFeatures.includes(\"flow-control-server-input\");\r\n const isFlowcontrolSnowflakeInputFeature = enabledFeatures.includes(\"flowcontrol-snowflake-input\");\r\n\r\n const handleFocus = event => event.target.select();\r\n\r\n // Setup flags base on features and remove Input locations in case there aren't the features\r\n useEffect(() => {\r\n setCanRetainInput(enabledFeatures.includes(\"flow-control-retain-input\") && isSuperAdmin);\r\n\r\n // Force to use Snowflake Input Table if parent node is Script\r\n if (isFlowcontrolSnowflakeInputFeature) {\r\n const parentFlowRelation = flowRelations.find(x => x.ChildFlowItemId == flowExternalService.FlowItemId);\r\n if (\r\n parentFlowRelation &&\r\n flowItems.some(x => x.FlowItemId == parentFlowRelation.ParentFlowItemId && x.FlowItemType == \"script\")\r\n ) {\r\n setIsParentNodeScript(true);\r\n setParentTableName(flowExternalService.InputTableName);\r\n\r\n if (parentFlowItemId != parentFlowRelation.ParentFlowItemId) {\r\n setParentFlowItemId(parentFlowRelation.ParentFlowItemId);\r\n dispatch(requestFlowItemResultTables(parentFlowRelation.ParentFlowItemId));\r\n }\r\n\r\n handleFileLocation(snowflakeLocation?.FileLocationId);\r\n } else {\r\n setIsParentNodeScript(false);\r\n }\r\n }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [dispatch, enabledFeatures, isSuperAdmin, externalInputFileLocation, flowRelations]);\r\n\r\n // Setup Input locations flags\r\n useEffect(() => {\r\n if (externalInputFileLocation.length > 0) {\r\n switch (flowExternalService.FileLocationId) {\r\n case s3FileLocation?.FileLocationId: // S3\r\n setIsS3Input(true);\r\n\r\n setIsServerInput(false);\r\n setIsSnowflakeInput(false);\r\n setIsPLEX5Input(false);\r\n\r\n break;\r\n case serverFileLocation?.FileLocationId: // SERVER\r\n setIsServerInput(isServerFileImportFeature);\r\n\r\n setIsS3Input(false);\r\n setIsSnowflakeInput(false);\r\n setIsPLEX5Input(false);\r\n\r\n break;\r\n case snowflakeLocation?.FileLocationId: //SNOWFLAKE\r\n setIsSnowflakeInput(isFlowcontrolSnowflakeInputFeature);\r\n\r\n setIsS3Input(false);\r\n setIsServerInput(false);\r\n setIsPLEX5Input(false);\r\n\r\n if (isFlowcontrolSnowflakeInputFeature && !isParentNodeScript) {\r\n getDatabases();\r\n }\r\n\r\n break;\r\n case plex5FileLocation?.FileLocationId: // PLEX5\r\n setIsPLEX5Input(true);\r\n\r\n setIsS3Input(false);\r\n setIsServerInput(false);\r\n setIsSnowflakeInput(false);\r\n\r\n break;\r\n default: // Anything selected\r\n setIsS3Input(false);\r\n setIsServerInput(false);\r\n setIsSnowflakeInput(false);\r\n setIsPLEX5Input(false);\r\n }\r\n }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [externalInputFileLocation, flowExternalService.FileLocationId]);\r\n\r\n // Get tables created by Script node as parent flow item\r\n useEffect(() => {\r\n if (isParentNodeScript && resultTables && resultTables[parentFlowItemId]) {\r\n setParentTables(resultTables[parentFlowItemId]);\r\n }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [dispatch, resultTables]);\r\n\r\n useEffect(() => {\r\n setIsInputRelativePosition(layout?.RelativePositions ?? false);\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [dispatch, layout]);\r\n\r\n // Clean Snowflake selected information when the input location isn't Snowflake\r\n useEffect(() => {\r\n if (snowflakeLocation?.FileLocationId != flowExternalService.FileLocationId) {\r\n if (\r\n (flowExternalService.InputTableName != null && flowExternalService.InputTableName != \"\") ||\r\n (flowExternalService.InputTableColumns != null && flowExternalService.InputTableColumns.length > 0)\r\n ) {\r\n cleanSnowflakeDataSelected();\r\n }\r\n }\r\n\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [flowExternalService.FileLocationId]);\r\n\r\n const cleanSnowflakeDataSelected = () => {\r\n setSelectedDatabase(\"\");\r\n setSelectedSchema(\"\");\r\n setSelectedTable(\"\");\r\n dispatch(\r\n updateMultipleAttribute(\"flowExternalServices\", flowExternalService.FlowExternalServiceId, {\r\n InputTableName: null,\r\n InputTableColumns: null,\r\n })\r\n );\r\n };\r\n\r\n // Get the file preview\r\n useEffect(() => {\r\n if (flowExternalService) {\r\n if (flowExternalService.FileName) {\r\n setSelectedFile(flowExternalService.FileName);\r\n\r\n // S3\r\n if (isS3Input) {\r\n if (filePreview) {\r\n if (flowExternalService.FileName == awsFileName && filePreview != awsFilePreview) {\r\n dispatch(GetS3FileInfo(flowExternalService.FileName));\r\n }\r\n } else if (flowExternalService.FileName == awsFileName) {\r\n setFilePreview(awsFilePreview);\r\n dispatch(ResetS3Data());\r\n } else if (!awsIsDownloading) {\r\n dispatch(GetS3FileInfo(flowExternalService.FileName));\r\n }\r\n }\r\n } else {\r\n setSelectedFile(\"\");\r\n }\r\n }\r\n }, [\r\n dispatch,\r\n flowExternalService,\r\n filePreview,\r\n isS3Input,\r\n awsIsDownloading,\r\n awsFilePreview,\r\n awsFileName,\r\n fileLocationId,\r\n selectedFile,\r\n ]);\r\n\r\n // Getting preview table data when there isn't parent node script\r\n useEffect(() => {\r\n if (!isParentNodeScript) {\r\n if (selectedDatabase != \"\" && selectedSchema != \"\" && selectedTable != \"\" && hasRestrictedUser) {\r\n getPreview();\r\n } else {\r\n setPreviewColumns([]);\r\n setPreviewRows([]);\r\n }\r\n }\r\n\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [selectedTable, hasRestrictedUser]);\r\n\r\n // Getting preview table data when there is parent node script\r\n useEffect(() => {\r\n if (isParentNodeScript) {\r\n if (\r\n parentTableName &&\r\n parentTableName != \"\" &&\r\n flowExternalService.InputTableName &&\r\n flowExternalService.InputTableName != \"\"\r\n ) {\r\n getPreview();\r\n } else {\r\n setPreviewColumns([]);\r\n setPreviewRows([]);\r\n }\r\n }\r\n\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [parentTableName]);\r\n\r\n const createColumnsJSON = () => {\r\n let newColumns: Array = [];\r\n previewColumns.forEach((col, index) => {\r\n newColumns.push({\r\n ColumnName: col.trim(),\r\n Include: true,\r\n Order: index + 1,\r\n });\r\n });\r\n dispatch(\r\n updateMultipleAttribute(\"flowExternalServices\", flowExternalService.FlowExternalServiceId, {\r\n InputTableColumns: newColumns,\r\n })\r\n );\r\n };\r\n\r\n useEffect(() => {\r\n if (previewColumns.length > 0 && !flowExternalService.InputTableColumns) {\r\n createColumnsJSON();\r\n }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [previewColumns]);\r\n\r\n useEffect(() => {\r\n if (!isParentNodeScript && flowExternalService.InputTableName && flowExternalService.InputTableName != \"\") {\r\n const tableParts = flowExternalService.InputTableName?.split(\".\");\r\n if (tableParts.length > 0) {\r\n if (tableParts[0].length > 0) {\r\n setSelectedDatabase(tableParts[0].trim());\r\n }\r\n if (tableParts[1] && tableParts[1].length > 0) {\r\n setSelectedSchema(tableParts[1].trim());\r\n }\r\n if (tableParts[2] && tableParts[2].length > 0) {\r\n setSelectedTable(tableParts[2].trim());\r\n }\r\n }\r\n }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [flowExternalService.InputTableName, isParentNodeScript]);\r\n\r\n useEffect(() => {\r\n if (!isParentNodeScript && selectedDatabase != \"\" && hasRestrictedUser) {\r\n getSchemas(selectedDatabase);\r\n }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [selectedDatabase, hasRestrictedUser]);\r\n\r\n useEffect(() => {\r\n if (!isParentNodeScript && selectedSchema != \"\" && hasRestrictedUser) {\r\n getTables(selectedSchema);\r\n }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [selectedSchema, hasRestrictedUser]);\r\n\r\n useEffect(() => {\r\n if (\r\n !isParentNodeScript &&\r\n databases &&\r\n !databases.some(x => x == flowExternalService.InputTableName?.split(\".\")[0]?.trim())\r\n ) {\r\n cleanSnowflakeDataSelected();\r\n }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [databases]);\r\n\r\n // Manage TEST Mode service parameter\r\n useEffect(() => {\r\n if (flowServiceParameters && testSwitchParam && testLimitValueParam) {\r\n const testSwitchParamValue = flowServiceParameters?.find(\r\n x => x.ParameterId == testSwitchParam?.ParameterId\r\n )?.Value;\r\n\r\n if (testSwitchParamValue == \"TEST\") {\r\n setIsTestMode(true);\r\n\r\n const testLimitValueParamValue = parseInt(\r\n flowServiceParameters?.find(x => x.ParameterId == testLimitValueParam?.ParameterId)?.Value ?? \"0\"\r\n );\r\n setTestLimitValue(testLimitValueParamValue);\r\n } else {\r\n setIsTestMode(false);\r\n }\r\n }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [flowServiceParameters, testSwitchParam, testLimitValueParam]);\r\n\r\n useEffect(() => {\r\n if (isS3Input) {\r\n setIsLoading(awsIsDownloading);\r\n } else if (isServerInput) {\r\n setIsLoading(awsIsDownloading);\r\n }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [awsIsDownloading]);\r\n\r\n const getDatabases = () => {\r\n setIsLoading(true);\r\n\r\n fetch(`/FlowControl/AvailableSnowflakeDatabases`, {\r\n method: \"GET\",\r\n credentials: \"same-origin\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const response = data as unknown as { success: boolean; databases: Array };\r\n if (response.success) {\r\n setDatabases(response.databases);\r\n }\r\n setHasRestrictedUser(response.success);\r\n setIsLoading(false);\r\n })\r\n .catch(error => {\r\n setIsLoading(false);\r\n h.error(\"Error getting available Snowflake databases.\", error);\r\n });\r\n };\r\n\r\n const getSchemas = database => {\r\n setIsLoading(true);\r\n\r\n fetch(`/FlowControl/AvailableSnowflakeSchemas?database=${database}`, {\r\n method: \"GET\",\r\n credentials: \"same-origin\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const response = data as unknown as { schemas: Array };\r\n setSchemas(response.schemas);\r\n setIsLoading(false);\r\n })\r\n .catch(error => {\r\n setIsLoading(false);\r\n h.error(\"Error getting available Snowflake database schemas.\", error);\r\n });\r\n };\r\n\r\n const getTables = schema => {\r\n setIsLoading(true);\r\n\r\n fetch(`/FlowControl/AvailableSnowflakeTables?database=${selectedDatabase}&schema=${schema}`, {\r\n method: \"GET\",\r\n credentials: \"same-origin\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const response = data as unknown as { tables: Array };\r\n setTables(response.tables);\r\n setIsLoading(false);\r\n })\r\n .catch(error => {\r\n setIsLoading(false);\r\n h.error(\"Error getting available Snowflake database tables.\", error);\r\n });\r\n };\r\n\r\n const getPreview = () => {\r\n setIsLoading(true);\r\n\r\n const tableName = isParentNodeScript\r\n ? flowExternalService.InputTableName\r\n : selectedDatabase + \".\" + selectedSchema + \".\" + selectedTable;\r\n\r\n fetch(`/FlowControl/SnowflakeTablePreview?tableName=${tableName}`, {\r\n method: \"GET\",\r\n credentials: \"same-origin\",\r\n headers: {\r\n \"Content-Type\": \"application/json; charset=utf-8\",\r\n },\r\n })\r\n .then(h.checkStatus)\r\n .then(h.toJson)\r\n .then(data => {\r\n const response = data as unknown as { columns: Array; rows: Array; quantity: number };\r\n setPreviewColumns(response.columns || []);\r\n setPreviewRows(response.rows || []);\r\n\r\n if (autopopulateSnowflateQuantityFeature) {\r\n handleQuantity(response.quantity || 0);\r\n }\r\n\r\n setIsLoading(false);\r\n })\r\n .catch(error => {\r\n setIsLoading(false);\r\n h.error(\"Error getting Snowflake table preview.\", error);\r\n });\r\n };\r\n\r\n const renderPreviewTable = () => {\r\n if (previewColumns.length == 0 || previewRows.length == 0) {\r\n return null;\r\n }\r\n\r\n return (\r\n \r\n \r\n \r\n {previewColumns.map((x, index) => (\r\n \r\n {x}\r\n \r\n ))}\r\n \r\n \r\n \r\n {previewRows.map((r, index) => (\r\n \r\n {previewColumns.map(c => (\r\n \r\n {r[c]}\r\n \r\n ))}\r\n \r\n ))}\r\n \r\n
\r\n );\r\n };\r\n\r\n const handleModalFile = (_source, file, filePreview, fileQuantity, nasServerId: number = 0) => {\r\n handleFileName(isServerInput ? file : file.name);\r\n setFilePreview(filePreview);\r\n\r\n if (isS3Input || isServerInput) {\r\n handleQuantity(fileQuantity);\r\n }\r\n\r\n if (isServerInput) {\r\n handleNasServerId(nasServerId);\r\n }\r\n };\r\n\r\n const removeSelectedFile = () => {\r\n dispatch(\r\n updateMultipleAttribute(\"flowExternalServices\", flowExternalService.FlowExternalServiceId, {\r\n FileName: null,\r\n InputQuantity: 0,\r\n })\r\n );\r\n\r\n flowExternalServiceInputs.forEach(x => {\r\n dispatch(deleteFlowExternalServiceInput(x.InputId));\r\n });\r\n\r\n setFilePreview(\"\");\r\n dispatch(ResetS3Data());\r\n\r\n dispatch(invalidateItemAndChildren(flowExternalService.FlowItemId));\r\n };\r\n\r\n const buildFullTable = (database, schema, table) => {\r\n if (database == \"\") {\r\n return null;\r\n }\r\n\r\n let fullName = database;\r\n if (schema != \"\") {\r\n fullName += \".\" + schema;\r\n if (table != \"\") {\r\n fullName += \".\" + table;\r\n }\r\n }\r\n return fullName;\r\n };\r\n\r\n const handleFileLocation = newValue => {\r\n setFileLocationId(newValue);\r\n dispatch(\r\n updateMultipleAttribute(\"flowExternalServices\", flowExternalService.FlowExternalServiceId, {\r\n FileLocationId: newValue,\r\n })\r\n );\r\n\r\n flowExternalServiceInputs.forEach(x => {\r\n dispatch(deleteFlowExternalServiceInput(x.InputId));\r\n });\r\n\r\n if (!isMultiInputFeature) {\r\n handleFileName(\"\");\r\n setFilePreview(\"\");\r\n handleQuantity(0);\r\n }\r\n\r\n if (isS3Input) {\r\n handleDeleteS3(false);\r\n }\r\n\r\n dispatch(invalidateItemAndChildren(flowExternalService.FlowItemId));\r\n };\r\n\r\n const handleFileName = (newValue: string) => {\r\n if (isMultiInputFeature) {\r\n // Keep Multi-input table in-sync\r\n const serviceInput = flowExternalServiceInputs.find(\r\n x => x.FlowItemId == flowExternalService.FlowItemId && x.InputNumber == 1\r\n );\r\n if (serviceInput) {\r\n dispatch(\r\n updateMultipleAttribute(\"flowExternalServiceInputs\", serviceInput.InputId, {\r\n InputName: newValue,\r\n })\r\n );\r\n } else if (isPLEX5Input || isS3Input || isServerInput) {\r\n dispatch(\r\n newFlowExternalServiceInput(\r\n flowExternalService.FlowItemId,\r\n 1,\r\n newValue,\r\n flowExternalService.InputQuantity || 0\r\n )\r\n );\r\n }\r\n } else {\r\n setSelectedFile(newValue);\r\n dispatch(\r\n updateMultipleAttribute(\"flowExternalServices\", flowExternalService.FlowExternalServiceId, {\r\n FileName: newValue,\r\n })\r\n );\r\n }\r\n\r\n dispatch(invalidateItemAndChildren(flowExternalService.FlowItemId));\r\n };\r\n\r\n const handleNasServerId = (nasServerId: number) => {\r\n if (isMultiInputFeature) {\r\n // Keep Multi-input table in-sync\r\n const serviceInput = flowExternalServiceInputs.find(\r\n x => x.FlowItemId == flowExternalService.FlowItemId && x.InputNumber == 1\r\n );\r\n if (serviceInput) {\r\n dispatch(\r\n updateMultipleAttribute(\"flowExternalServiceInputs\", serviceInput.InputId, {\r\n NasServerId: nasServerId,\r\n })\r\n );\r\n } else {\r\n dispatch(\r\n newFlowExternalServiceInput(\r\n flowExternalService.FlowItemId,\r\n 1,\r\n flowExternalService.FileName,\r\n flowExternalService.InputQuantity || 0,\r\n nasServerId\r\n )\r\n );\r\n }\r\n } else {\r\n dispatch(\r\n updateMultipleAttribute(\"flowExternalServices\", flowExternalService.FlowExternalServiceId, {\r\n NasServerId: nasServerId,\r\n })\r\n );\r\n }\r\n\r\n dispatch(invalidateItemAndChildren(flowExternalService.FlowItemId));\r\n };\r\n\r\n const handleQuantity = (newValue: string | number) => {\r\n let quantity = newValue == \"\" ? 0 : parseInt(newValue.toString());\r\n if (quantity < 0) {\r\n quantity = 0;\r\n }\r\n\r\n dispatch(\r\n updateMultipleAttribute(\"flowExternalServices\", flowExternalService.FlowExternalServiceId, {\r\n InputQuantity: quantity,\r\n })\r\n );\r\n\r\n if (isMultiInputFeature) {\r\n // Keep Multi-input table in-sync\r\n const serviceInput = flowExternalServiceInputs.find(\r\n x => x.FlowItemId == flowExternalService.FlowItemId && x.InputNumber == 1\r\n );\r\n if (serviceInput) {\r\n dispatch(\r\n updateMultipleAttribute(\"flowExternalServiceInputs\", serviceInput.InputId, {\r\n InputQuantity: quantity,\r\n })\r\n );\r\n } else if (isPLEX5Input || isS3Input || isServerInput) {\r\n dispatch(\r\n newFlowExternalServiceInput(\r\n flowExternalService.FlowItemId,\r\n 1,\r\n flowExternalService.FileName,\r\n quantity\r\n )\r\n );\r\n }\r\n }\r\n\r\n dispatch(invalidateItemAndChildren(flowExternalService.FlowItemId));\r\n };\r\n\r\n const handleInputHeaderRow = value => {\r\n dispatch(\r\n updateMultipleAttribute(\"flowExternalServices\", flowExternalService.FlowExternalServiceId, {\r\n InputHeaderRow: value,\r\n })\r\n );\r\n\r\n dispatch(invalidateItemAndChildren(flowExternalService.FlowItemId));\r\n };\r\n\r\n const handleRetainInput = value => {\r\n dispatch(\r\n updateMultipleAttribute(\"flowExternalServices\", flowExternalService.FlowExternalServiceId, {\r\n RetainInputFile: value,\r\n })\r\n );\r\n\r\n dispatch(invalidateItemAndChildren(flowExternalService.FlowItemId));\r\n };\r\n\r\n const handleDeleteS3 = value => {\r\n dispatch(\r\n updateMultipleAttribute(\"flowExternalServices\", flowExternalService.FlowExternalServiceId, {\r\n DeleteS3Input: value,\r\n })\r\n );\r\n\r\n dispatch(invalidateItemAndChildren(flowExternalService.FlowItemId));\r\n };\r\n\r\n const handleDatabase = value => {\r\n setSelectedDatabase(value);\r\n setSelectedSchema(\"\");\r\n setSchemas([]);\r\n setSelectedTable(\"\");\r\n setTables([]);\r\n dispatch(\r\n updateMultipleAttribute(\"flowExternalServices\", flowExternalService.FlowExternalServiceId, {\r\n InputTableColumns: null,\r\n InputTableName: buildFullTable(value, \"\", \"\"),\r\n })\r\n );\r\n };\r\n\r\n const handleSchema = value => {\r\n setSelectedSchema(value);\r\n setSelectedTable(\"\");\r\n dispatch(\r\n updateMultipleAttribute(\"flowExternalServices\", flowExternalService.FlowExternalServiceId, {\r\n InputTableColumns: null,\r\n InputTableName: buildFullTable(selectedDatabase, value, \"\"),\r\n })\r\n );\r\n };\r\n\r\n const handleSnowflakeTableNameChange = value => {\r\n setSelectedTable(value);\r\n handleQuantity(0);\r\n\r\n dispatch(\r\n updateMultipleAttribute(\"flowExternalServices\", flowExternalService.FlowExternalServiceId, {\r\n InputTableColumns: null,\r\n InputTableName: buildFullTable(selectedDatabase, selectedSchema, value),\r\n })\r\n );\r\n };\r\n\r\n const handleSnowflakeParentTableNameChange = value => {\r\n setParentTableName(value);\r\n let inputTableName = null;\r\n const tableInfo = parentTables.find(x => x.TableName == value);\r\n\r\n if (tableInfo) {\r\n inputTableName = buildFullTable(tableInfo.Db, tableInfo.Schema, value);\r\n } else {\r\n const tableInfoSplitted = value.split(\".\");\r\n\r\n if (tableInfoSplitted.length == 3) {\r\n inputTableName = buildFullTable(tableInfoSplitted[0], tableInfoSplitted[1], tableInfoSplitted[2]);\r\n }\r\n }\r\n\r\n if (flowExternalService.InputTableName != inputTableName) {\r\n dispatch(\r\n updateMultipleAttribute(\"flowExternalServices\", flowExternalService.FlowExternalServiceId, {\r\n InputTableColumns: null,\r\n InputTableName: inputTableName,\r\n })\r\n );\r\n }\r\n };\r\n\r\n const handleIncludeAll = value => {\r\n const newColumns = [...flowExternalService.InputTableColumns];\r\n\r\n newColumns.forEach(col => {\r\n col.Include = value;\r\n });\r\n dispatch(\r\n updateMultipleAttribute(\"flowExternalServices\", flowExternalService.FlowExternalServiceId, {\r\n InputTableColumns: newColumns,\r\n })\r\n );\r\n setIncludeAllColumns(value);\r\n };\r\n\r\n const onSortEnd = ({ oldIndex, newIndex }) => {\r\n const newColumns = [...flowExternalService.InputTableColumns];\r\n\r\n let updateColumns = arrayMoveImmutable(newColumns, oldIndex, newIndex);\r\n updateColumns.forEach((col, index) => {\r\n col.Order = index + 1;\r\n });\r\n\r\n dispatch(\r\n updateMultipleAttribute(\"flowExternalServices\", flowExternalService.FlowExternalServiceId, {\r\n InputTableColumns: updateColumns,\r\n })\r\n );\r\n };\r\n\r\n return (\r\n <>\r\n
\r\n \r\n File Location\r\n
\r\n
\r\n handleFileLocation(e.target.value)}\r\n value={\r\n flowExternalService.FileLocationId <= 0\r\n ? fileLocationId <= 0\r\n ? \"\"\r\n : fileLocationId\r\n : flowExternalService.FileLocationId\r\n }\r\n disabled={isParentNodeScript}\r\n >\r\n {externalInputFileLocation.length == 0 ? (\r\n Loading File Locations...\r\n ) : null}\r\n {externalInputFileLocation.map(option => (\r\n \r\n {option.FileLocationDescription}\r\n \r\n ))}\r\n \r\n
\r\n {isS3Input && (\r\n
\r\n handleDeleteS3(!flowExternalService.DeleteS3Input)}\r\n color=\"primary\"\r\n />\r\n }\r\n label=\"Delete file from AWS after deployment\"\r\n labelPlacement=\"end\"\r\n />\r\n
\r\n )}\r\n {!isLoading && isSnowflakeInput && !isParentNodeScript && !hasRestrictedUser && (\r\n
\r\n \r\n Company Restricted User is not configured.\r\n \r\n
\r\n )}\r\n
\r\n {flowExternalService && flowExternalService.FileLocationId > 0 && (\r\n <>\r\n {isSnowflakeInput ? (\r\n <>\r\n {isLoading && (\r\n \r\n \r\n
\r\n )}\r\n
\r\n {isParentNodeScript ? (\r\n
\r\n option.TableName)}\r\n onInputChange={(_, value) =>\r\n handleSnowflakeParentTableNameChange(value)\r\n }\r\n renderInput={params => (\r\n \r\n )}\r\n />\r\n
\r\n ) : (\r\n <>\r\n
\r\n Database\r\n {\r\n handleDatabase(e.target.value as string);\r\n }}\r\n value={selectedDatabase}\r\n disabled={isLoading || !hasRestrictedUser}\r\n >\r\n {databases?.map((option, index) => (\r\n \r\n {option}\r\n \r\n ))}\r\n \r\n
\r\n
\r\n Schema\r\n {\r\n handleSchema(e.target.value as string);\r\n }}\r\n value={selectedSchema}\r\n disabled={!selectedDatabase || isLoading || !hasRestrictedUser}\r\n >\r\n {schemas.map((option, index) => (\r\n \r\n {option}\r\n \r\n ))}\r\n \r\n
\r\n
\r\n Table Name\r\n \r\n handleSnowflakeTableNameChange(e.target.value as string)\r\n }\r\n value={selectedTable}\r\n disabled={!selectedSchema || isLoading || !hasRestrictedUser}\r\n >\r\n {tables.map((option, index) => (\r\n \r\n {option}\r\n \r\n ))}\r\n \r\n
\r\n \r\n )}\r\n {!isLoading && previewRows.length > 0 && (\r\n
\r\n
\r\n Table Preview\r\n
\r\n
\r\n {renderPreviewTable()}\r\n
\r\n
\r\n )}\r\n {!isLoading &&\r\n ((isParentNodeScript && parentTableName != \"\") ||\r\n (!isParentNodeScript && selectedTable != \"\" && hasRestrictedUser)) && (\r\n
\r\n
\r\n Select Columns\r\n
\r\n
\r\n \r\n \r\n \r\n Column Name\r\n
\r\n
\r\n \r\n handleIncludeAll(e.target.checked)\r\n }\r\n checked={includeAllColumns}\r\n disabled={!flowPermissions.canEdit}\r\n />\r\n }\r\n label={\r\n \r\n
\r\n Include Columns \r\n \r\n info\r\n \r\n
\r\n
\r\n }\r\n />\r\n
\r\n
\r\n \r\n {!isLoading && flowExternalService.InputTableColumns && (\r\n \r\n \r\n document.getElementById(\r\n \"sortable-list-container\"\r\n )!\r\n }\r\n />\r\n \r\n )}\r\n
\r\n \r\n )}\r\n \r\n \r\n ) : (\r\n <>\r\n {isMultiInputFeature ? (\r\n
\r\n \r\n
\r\n ) : (\r\n
\r\n \r\n Input File\r\n
\r\n
\r\n handleFileName(e.target.value)}\r\n inputProps={\r\n isS3Input || isServerInput\r\n ? { readOnly: true }\r\n : { maxLength: 44 }\r\n }\r\n helperText=\"\"\r\n />\r\n {(isS3Input || isServerInput) && (\r\n
\r\n add}\r\n onClick={() =>\r\n dispatch(\r\n showModal(\"BROWSE_FILES\", {\r\n handleModalFile,\r\n requestor: \"flow\",\r\n browseFileAllowed: isS3Input\r\n ? BrowseFileIntegrations.S3\r\n : BrowseFileIntegrations.SERVER,\r\n })\r\n )\r\n }\r\n disabled={!flowPermissions.canEdit || isLoading}\r\n >\r\n Add File\r\n \r\n remove}\r\n onClick={removeSelectedFile}\r\n disabled={\r\n !flowPermissions.canEdit || !selectedFile || isLoading\r\n }\r\n >\r\n Remove File\r\n \r\n
\r\n )}\r\n
\r\n {(isS3Input || isServerInput) && (\r\n
\r\n
\r\n File Preview\r\n {isLoading && filePreview == \"\" ? (\r\n \r\n \r\n
\r\n ) : (\r\n <>\r\n {awsError && (\r\n \r\n {awsError}\r\n \r\n )}\r\n \r\n \r\n )}\r\n
\r\n \r\n )}\r\n \r\n )}\r\n \r\n )}\r\n {(isSnowflakeInput || !isMultiInputFeature) && (\r\n
\r\n Input Quantity {isTestMode ? (TEST Mode) : null}\r\n
\r\n handleQuantity(e.target.value)}\r\n onFocus={handleFocus}\r\n style={{ width: \"20%\", resize: \"none\", fontSize: \"15px\" }}\r\n id=\"input-qty\"\r\n disabled={\r\n isTestMode || (isSnowflakeInput && autopopulateSnowflateQuantityFeature)\r\n }\r\n helperText=\"File input quantity\"\r\n />\r\n
\r\n
\r\n )}\r\n {isInputRelativePosition && !isSnowflakeInput && (\r\n
\r\n \r\n handleInputHeaderRow(!flowExternalService.InputHeaderRow)\r\n }\r\n color=\"primary\"\r\n />\r\n }\r\n label=\"Has a Header Row\"\r\n labelPlacement=\"end\"\r\n />\r\n
\r\n )}\r\n {canRetainInput && (\r\n
\r\n handleRetainInput(!flowExternalService.RetainInputFile)}\r\n color=\"primary\"\r\n />\r\n }\r\n label=\"Do Not Delete Input File (skips file/table copy on reruns)\"\r\n labelPlacement=\"end\"\r\n />\r\n
\r\n )}\r\n \r\n )}\r\n \r\n \r\n \r\n \r\n );\r\n};\r\n\r\nexport default FlowControlInput;\r\n","import React, { useState, useCallback, useEffect } from \"react\";\r\nimport ofilter from \"../../../helpers/ofilter\";\r\nimport { labelCompare } from \"../../../helpers/selectHelper\";\r\nimport { useDispatch, useSelector } from \"react-redux\";\r\nimport {\r\n requestDestinations,\r\n requestSelectedLayoutObjects,\r\n requestLayoutList,\r\n} from \"../../../actions/exportLayoutActions2\";\r\nimport {\r\n updateAttribute,\r\n invalidateItemAndChildren,\r\n clearFlowExportDistributionPlatforms,\r\n clearFlowItemSVDedupes,\r\n clearFlowExportOfferMerges,\r\n clearFlowRelationParentLabels,\r\n clearFlowExportDestinationVariables,\r\n newFlowSVDedupe,\r\n deleteFlowSVDedupe,\r\n} from \"../../../actions/flowActions\";\r\nimport { requestLayoutFieldTree } from \"../../../actions/fieldTreeActions\";\r\nimport FlowItemDeployToggle from \"./FlowExportItems/FlowItemDeployToggle\";\r\nimport { showModal } from \"../../../actions/actionCreators\";\r\nimport { createSelector } from \"reselect\";\r\nimport { getFlowExportsByFlowItemId } from \"../../../reducers/flowExports\";\r\nimport { getFlowExportReportsArray } from \"../../../reducers/flowExportReports\";\r\nimport { getAncestorsFields, getFlowRelationsForSelectedFlow } from \"../../../reducers/flowRelations\";\r\nimport { getSelectedFlowAndItemPermissions } from \"../../../reducers/flowItems\";\r\n\r\nimport FlowExportDistributionPlatforms from \"./FlowExportItems/FlowExportDistributionPlatforms\";\r\nimport FlowExportOfferEdit from \"./FlowExportItems/FlowExportOfferEdit\";\r\nimport FlowExportVariableEdit from \"./FlowExportItems/FlowExportVariableEdit\";\r\nimport { makeGetFlowSVDedupe } from \"./FlowSVDedupeEdit\";\r\nimport { requestClientVariableGroupings } from \"../../../actions/clientVariableActions\";\r\nimport { DeploySettings } from \"../../../types/stores/companyTable\";\r\nimport { anyParentFlowItemsWithFirstPartyOnly } from \"../../../reducers/flowExports\";\r\nimport type { FlowExportsByItemId } from \"../../../reducers/flowExports\";\r\nimport { FormControl, Grid, Divider, Button, TextField, Icon, Tooltip } from \"@material-ui/core\";\r\nimport Autocomplete from \"@material-ui/lab/Autocomplete\";\r\nimport TradedeskDeliveryTypes from \"./FlowExportItems/TradedeskDeliveryTypes\";\r\nimport PubmaticDeliveryTypes from \"./FlowExportItems/PubmaticDeliveryTypes\";\r\nimport ActivationDestinationSchedules from \"./FlowExportItems/ActivationDestinationSchedules\";\r\nimport FlowExportReportsTable from \"./FlowExportItems/FlowExportReportsTable\";\r\nimport RestrictedFieldsTable from \"./FlowExportItems/RestrictedFieldsTable\";\r\nimport { IAppState } from \"../../../types/stores/index\";\r\nimport { FlowExport, FlowExportReport, FlowItemFieldsUsed, FlowRelation } from \"../../../types/stores/flowTypes\";\r\nimport { IAdvertisersByCompany } from \"../../../types/stores/vars\";\r\nimport ExportDestinationSquare from \"./FlowExportItems/ExportDestinationSquare\";\r\nimport FlowTaxonomyFieldEdit from \"./FlowExportItems/FlowTaxonomyFieldEdit\";\r\n// import FlowTaxonomyFieldEdit from \"./FlowExportItems/FlowTaxonomyFieldEdit\";\r\n\r\ntype Props = {\r\n flowItemId: number;\r\n isModal: boolean;\r\n hideExtra: boolean;\r\n};\r\n\r\nconst FlowExportEdit: React.FC = (props: Props) => {\r\n const dispatch = useDispatch();\r\n\r\n const [hasFieldRestrictions, setHasFieldRestrictions] = useState(false);\r\n const [fieldRestrictions, setFieldRestrictions] = useState>([]);\r\n const [isLayoutChanged, setIsLayoutChanged] = useState(false);\r\n\r\n const getExportDestinations = makeGetExportDestinations();\r\n const getFlowExport = makeGetFlowExport();\r\n const getFlowExportReports = makeGetFlowExportReport();\r\n const getFlowSVDedupe = makeGetFlowSVDedupe();\r\n\r\n const PartnerList = useSelector((state: IAppState) => getExportDestinations(state));\r\n const destinationFieldRestrictions = useSelector((state: IAppState) => state.vars.destinationFieldRestrictions);\r\n const enabledFeatures = useSelector((state: IAppState) => state.session.enabledFeatures || []);\r\n const layouts = useSelector((state: IAppState) => state.layoutObjects.objects);\r\n const flowExport = useSelector((state: IAppState) => getFlowExport(state, props));\r\n const companyId = useSelector((state: IAppState) => state.session.companyId);\r\n const reports = useSelector((state: IAppState) => getFlowExportReports(state, props));\r\n const ancestorsFields = useSelector>(state => getAncestorsFields(state));\r\n const destinationDedupeSettings = useSelector((state: IAppState) => state.vars.destinationDedupeSettings);\r\n const flowSVDedupe = useSelector((state: IAppState) => getFlowSVDedupe(state, props));\r\n const environment = useSelector((state: IAppState) => state.session.environment);\r\n const isInternal = useSelector((state: IAppState) => state.session.isInternal);\r\n const flow = useSelector((state: IAppState) => state.flows.byId[state.selected.flow]);\r\n const canEdit = useSelector((state: IAppState) => getSelectedFlowAndItemPermissions(state).item.canEdit);\r\n const layoutFields = useSelector((state: IAppState) => state.layoutfields.byId);\r\n const layoutTypes = useSelector((state: IAppState) => state.vars.layoutTypes);\r\n const flowItemsById = useSelector((state: IAppState) => state.flowItems.byId);\r\n const variableGroups = useSelector((state: IAppState) => state.vars.variableGroupings || []);\r\n const destinationPartners = useSelector((state: IAppState) => state.vars.destinations);\r\n const flowRelations = useSelector>(state => getFlowRelationsForSelectedFlow(state));\r\n\r\n const resetIsLayoutChanged = () => {\r\n setIsLayoutChanged(false);\r\n };\r\n\r\n // flowItemsById[z.value].FlowItemQty\r\n const processLayoutChanged = useCallback(\r\n layoutId => {\r\n if (flowExport != null) {\r\n const layout = layouts.filter(x => x.Layout.LayoutID == layoutId)[0];\r\n\r\n //if the new layout is pivot, offer merges and sv dedupes are not needed any more\r\n if (layout && layout.Layout && layout.Layout.IsPivot) {\r\n dispatch(clearFlowItemSVDedupes(flowExport.FlowItemId));\r\n dispatch(clearFlowExportOfferMerges(flowExport.FlowItemId));\r\n } else if (layout && layout.Layout && !layout.Layout.IsPivot) {\r\n //not pivot, clear the parent labels\r\n dispatch(clearFlowRelationParentLabels(flowExport.FlowItemId));\r\n }\r\n\r\n dispatch(updateAttribute(\"flowExports\", flowExport.FlowExportId, \"ExportId\", layoutId));\r\n dispatch(invalidateItemAndChildren(flowExport.FlowItemId));\r\n if (reports.length > 0) {\r\n reports.forEach(x => {\r\n dispatch(updateAttribute(\"flowExportReports\", x.FlowExportReportId, \"DimensionFieldKeys\", \"\"));\r\n dispatch(updateAttribute(\"flowExportReports\", x.FlowExportReportId, \"MeasureFieldKeys\", \"\"));\r\n dispatch(updateAttribute(\"flowExportReports\", x.FlowExportReportId, \"LayoutId\", layoutId));\r\n });\r\n }\r\n\r\n setIsLayoutChanged(true);\r\n }\r\n },\r\n [dispatch, flowExport, reports, layouts]\r\n );\r\n useEffect(() => {\r\n if (!variableGroups || variableGroups.length == 0) {\r\n dispatch(requestClientVariableGroupings());\r\n }\r\n }, [dispatch, variableGroups]);\r\n\r\n const checkFieldRestrictions = useCallback(\r\n destinationId => {\r\n if (\r\n !destinationFieldRestrictions ||\r\n destinationFieldRestrictions.length == 0 ||\r\n !ancestorsFields ||\r\n ancestorsFields.length == 0 ||\r\n destinationFieldRestrictions.filter(x => x.DestinationId == destinationId).length == 0\r\n ) {\r\n setHasFieldRestrictions(false);\r\n setFieldRestrictions([]);\r\n dispatch(updateAttribute(\"flowItems\", props.flowItemId, \"IsValid\", true));\r\n return;\r\n }\r\n\r\n const restrictedIds = destinationFieldRestrictions\r\n .filter(x => x.DestinationId == destinationId)\r\n .map(x => x.FieldKey);\r\n\r\n const fieldRestrictions = ancestorsFields.filter(x => restrictedIds.includes(x.FieldId));\r\n\r\n if (fieldRestrictions.length > 0) {\r\n setHasFieldRestrictions(true);\r\n setFieldRestrictions(fieldRestrictions);\r\n dispatch(updateAttribute(\"flowItems\", props.flowItemId, \"IsValid\", false));\r\n } else {\r\n setHasFieldRestrictions(false);\r\n setFieldRestrictions([]);\r\n dispatch(updateAttribute(\"flowItems\", props.flowItemId, \"IsValid\", true));\r\n }\r\n },\r\n [ancestorsFields, destinationFieldRestrictions, props.flowItemId, dispatch]\r\n );\r\n\r\n useEffect(() => {\r\n if (!props.hideExtra && (!PartnerList || PartnerList.length == 0 || !destinationFieldRestrictions)) {\r\n dispatch(requestDestinations());\r\n }\r\n }, [dispatch, PartnerList, destinationFieldRestrictions, props]);\r\n\r\n useEffect(() => {\r\n if (!layoutFields) {\r\n dispatch(requestLayoutFieldTree());\r\n }\r\n }, [dispatch, layoutFields]);\r\n\r\n useEffect(() => {\r\n if (!layoutTypes) {\r\n dispatch(requestLayoutList(\"replace\"));\r\n }\r\n }, [dispatch, layoutTypes]);\r\n\r\n useEffect(() => {\r\n if (!enabledFeatures.includes(\"destination-company-layouts\")) {\r\n //check if there is a new destination layout for\r\n const destinationId = flowExport ? flowExport.DestinationId : null;\r\n const exportId = flowExport ? flowExport.ExportId : null;\r\n const destinationLayout = (layouts || {}).find(\r\n x =>\r\n x.Layout.LayoutID != null &&\r\n x.Layout.LayoutCompanyID == destinationId &&\r\n x.Layout.LayoutCompanyID != companyId &&\r\n x.Layout.IsActiveDestinationLayout\r\n );\r\n\r\n let destinationLayoutId = null;\r\n if (destinationLayout && destinationLayout.Layout) {\r\n destinationLayoutId = destinationLayout.Layout.LayoutID;\r\n }\r\n\r\n //if there is a destination layout for the selected destination\r\n //and is not the currently saved in the export, trigger the change\r\n if (destinationLayoutId && exportId != destinationLayoutId) {\r\n processLayoutChanged(destinationLayoutId);\r\n }\r\n }\r\n }, [flowExport, enabledFeatures, layouts, companyId, processLayoutChanged]);\r\n\r\n useEffect(() => {\r\n if (\r\n flowExport &&\r\n flowExport.DestinationId &&\r\n flowExport.DestinationId > 0 &&\r\n destinationFieldRestrictions &&\r\n destinationFieldRestrictions.filter(x => x.DestinationId == flowExport.DestinationId).length > 0\r\n ) {\r\n checkFieldRestrictions(flowExport.DestinationId);\r\n }\r\n }, [flowExport, destinationFieldRestrictions, checkFieldRestrictions]);\r\n\r\n const layoutChanged = (_, e) => processLayoutChanged(e && e.value ? e.value : null);\r\n\r\n const setDefaultDedupeSetting = (destinationId: number | undefined) => {\r\n let setting = destinationDedupeSettings.find(x => x.CompanyID == companyId && x.DestinationID == destinationId);\r\n\r\n // Id = 0 always contains the current company default settings.\r\n if (!setting) {\r\n setting = destinationDedupeSettings.find(x => x.Id == 0);\r\n }\r\n\r\n // the destination default is dedupe on.\r\n if (setting && setting.IsDedupeDefault) {\r\n // dedupe was off\r\n if (!flowSVDedupe) {\r\n dispatch(newFlowSVDedupe(flowExport?.FlowItemId, setting.DefaultDedupeKey, setting.DedupeSortByFields));\r\n dispatch(\r\n updateAttribute(\r\n \"flowExports\",\r\n flowExport?.FlowExportId,\r\n \"CustomDedupe\",\r\n setting.IsCustomDedupeDefault\r\n )\r\n );\r\n } else {\r\n const jsonSortByFields =\r\n setting.DedupeSortByFields && setting.DedupeSortByFields.length > 0\r\n ? JSON.parse(setting.DedupeSortByFields)\r\n : [];\r\n dispatch(\r\n updateAttribute(\"flowSVDedupes\", flowSVDedupe.FlowSVDedupeId, \"SVField\", setting.DefaultDedupeKey)\r\n );\r\n dispatch(\r\n updateAttribute(\"flowSVDedupes\", flowSVDedupe.FlowSVDedupeId, \"SortByFields\", jsonSortByFields)\r\n );\r\n dispatch(\r\n updateAttribute(\r\n \"flowExports\",\r\n flowExport?.FlowExportId,\r\n \"CustomDedupe\",\r\n setting.IsCustomDedupeDefault,\r\n true\r\n )\r\n );\r\n }\r\n } else if (flowSVDedupe) {\r\n dispatch(deleteFlowSVDedupe(flowSVDedupe.FlowSVDedupeId));\r\n }\r\n };\r\n\r\n const setPartner = (newValue: number | undefined) => {\r\n const destination = (PartnerList || []).find(x => x.PartnerAccessId == newValue);\r\n\r\n if (\r\n destination?.IsIndirectDestination &&\r\n anyParentFlowItemsWithFirstPartyOnly(props.flowItemId, ancestorsFields, flowRelations)\r\n ) {\r\n showFirstPartyDataWarningModal();\r\n return;\r\n }\r\n\r\n // Updating the export to the default destination dedupe settings.\r\n setDefaultDedupeSetting(newValue);\r\n\r\n if (flowExport != null) {\r\n dispatch(clearFlowExportDestinationVariables(flowExport.FlowItemId, flowExport.DestinationId));\r\n dispatch(clearFlowExportDistributionPlatforms(flowExport.FlowItemId));\r\n\r\n dispatch(updateAttribute(\"flowExports\", flowExport.FlowExportId, \"DestinationId\", newValue));\r\n // Reset DeliveryTypeId\r\n dispatch(updateAttribute(\"flowExports\", flowExport.FlowExportId, \"DeliveryTypeId\", null));\r\n\r\n // set destination layout\r\n if (destination && destination.DestinationLayoutId) {\r\n //begin flow-export-pivot-labels\r\n dispatch(clearFlowRelationParentLabels(flowExport.FlowItemId));\r\n //end flow-export-pivot-labels\r\n\r\n dispatch(\r\n updateAttribute(\"flowExports\", flowExport.FlowExportId, \"ExportId\", destination.DestinationLayoutId)\r\n );\r\n setIsLayoutChanged(true);\r\n\r\n dispatch(invalidateItemAndChildren(flowExport.FlowItemId));\r\n if (reports.length > 0) {\r\n reports.forEach(x => {\r\n dispatch(updateAttribute(\"flowExportReports\", x.FlowExportReportId, \"DimensionFieldKeys\", \"\"));\r\n dispatch(updateAttribute(\"flowExportReports\", x.FlowExportReportId, \"MeasureFieldKeys\", \"\"));\r\n dispatch(\r\n updateAttribute(\r\n \"flowExportReports\",\r\n x.FlowExportReportId,\r\n \"LayoutId\",\r\n destination.DestinationLayoutId\r\n )\r\n );\r\n });\r\n }\r\n } else {\r\n //If layout saved was a dif company destinationid and the user changes destinations, clear out the selected layout\r\n const theseLayouts = ofilter(\r\n v => v[\"Layout\"][\"LayoutID\"] != null && v[\"Layout\"][\"LayoutID\"] == flowExport.ExportId,\r\n layouts || {}\r\n );\r\n const selectedLayout = Object.keys(theseLayouts).map(item => ({\r\n item: layouts[item],\r\n }));\r\n if (selectedLayout.length > 0 && selectedLayout[0].item.Layout.LayoutCompanyID != companyId) {\r\n dispatch(updateAttribute(\"flowExports\", flowExport.FlowExportId, \"ExportId\", null));\r\n\r\n //begin flow-export-pivot-labels\r\n //clear any pivot parent labels\r\n dispatch(clearFlowRelationParentLabels(flowExport.FlowItemId));\r\n //end flow-export-pivot-labels\r\n\r\n //I may just delete the reports in this scenario, not sure yet\r\n if (reports.length > 0) {\r\n reports.forEach(x => {\r\n dispatch(\r\n updateAttribute(\"flowExportReports\", x.FlowExportReportId, \"DimensionFieldKeys\", \"\")\r\n );\r\n dispatch(\r\n updateAttribute(\"flowExportReports\", x.FlowExportReportId, \"MeasureFieldKeys\", \"\")\r\n );\r\n dispatch(updateAttribute(\"flowExportReports\", x.FlowExportReportId, \"LayoutId\", null));\r\n });\r\n }\r\n }\r\n }\r\n\r\n // Check if destination has field restrictions\r\n if (newValue && destinationFieldRestrictions) {\r\n const destinationId = newValue;\r\n checkFieldRestrictions(destinationId);\r\n } else {\r\n setHasFieldRestrictions(false);\r\n setFieldRestrictions([]);\r\n dispatch(updateAttribute(\"flowItems\", props.flowItemId, \"IsValid\", true));\r\n }\r\n }\r\n };\r\n\r\n const showFirstPartyDataWarningModal = () => {\r\n dispatch(\r\n showModal(\"FILE_BIG_SIZE_UPLOAD_WARNING\", {\r\n continue: () => { },\r\n type: \"First Party Data to Indirect Destination\",\r\n })\r\n );\r\n };\r\n\r\n const showLayoutModal = () => {\r\n const layout = layouts.filter(x => x.Layout.LayoutID == flowExport?.ExportId)[0];\r\n dispatch(requestSelectedLayoutObjects(layout.Layout.LayoutID));\r\n dispatch(showModal(\"FLOW_EXPORT_LAYOUT\", layout));\r\n };\r\n\r\n const canShowCount = () => {\r\n if (flowExport) {\r\n let dest = flowExport.DestinationId;\r\n if (destinationPartners) {\r\n const partners = destinationPartners.filter(d => d.PartnerAccessId == dest);\r\n return partners[0].CanShowCount;\r\n } else {\r\n return true;\r\n }\r\n } else {\r\n return true;\r\n }\r\n };\r\n\r\n const isDestinationCompanyLayouts = enabledFeatures.includes(\"destination-company-layouts\");\r\n\r\n //If selected destination has IsActiveDestinationLayout and is not self company\r\n const selectedLayout = ofilter(\r\n v =>\r\n v[\"Layout\"][\"LayoutID\"] != null &&\r\n v[\"Layout\"][\"LayoutCompanyID\"] == (flowExport != null ? flowExport.DestinationId : null) &&\r\n v[\"Layout\"][\"LayoutCompanyID\"] != companyId &&\r\n (isDestinationCompanyLayouts || v[\"Layout\"][\"IsActiveDestinationLayout\"] == true),\r\n layouts || {}\r\n );\r\n\r\n const destinationLayout = isDestinationCompanyLayouts\r\n ? []\r\n : Object.keys(selectedLayout)\r\n .map(item => ({\r\n label: layouts[item].Layout.LayoutName,\r\n value: layouts[item].Layout.LayoutID,\r\n item: layouts[item],\r\n }))\r\n .sort(labelCompare);\r\n\r\n let theseLayouts = ofilter(\r\n v =>\r\n v[\"Layout\"][\"LayoutID\"] != null &&\r\n v[\"Layout\"][\"LayoutCompanyID\"] == companyId &&\r\n v[\"Layout\"][\"LayoutActive\"] == \"Y\",\r\n layouts || {}\r\n );\r\n\r\n if (flowExport?.DestinationId && PartnerList && PartnerList.length > 0 && isDestinationCompanyLayouts) {\r\n const destination = PartnerList.filter(x => x.PartnerAccessId == flowExport.DestinationId);\r\n if (destination.length == 1 && destination[0].CompanyIsDestination) {\r\n theseLayouts = ofilter(\r\n v =>\r\n v[\"Layout\"][\"LayoutID\"] != null &&\r\n v[\"Layout\"][\"LayoutCompanyID\"] == flowExport?.DestinationId &&\r\n v[\"Layout\"][\"LayoutActive\"] == \"Y\",\r\n layouts || {}\r\n );\r\n }\r\n }\r\n\r\n const layoutList = Object.keys(theseLayouts)\r\n .map(item => ({\r\n label: layouts[item].Layout.LayoutName,\r\n value: layouts[item].Layout.LayoutID,\r\n item: layouts[item],\r\n }))\r\n .sort((a, b) => {\r\n if (a.item.Layout.IsActiveDestinationLayout && !b.item.Layout.IsActiveDestinationLayout) {\r\n return -1;\r\n } else if (!a.item.Layout.IsActiveDestinationLayout && b.item.Layout.IsActiveDestinationLayout) {\r\n return 1;\r\n }\r\n\r\n // Else go to the 2nd criteria\r\n if (a.label.toUpperCase() < b.label.toUpperCase()) {\r\n return -1;\r\n } else if (a.label.toUpperCase() > b.label.toUpperCase()) {\r\n return 1;\r\n } else {\r\n // nothing to split them\r\n return 0;\r\n }\r\n });\r\n\r\n let filteredDestinations = PartnerList || [];\r\n //Only auprod and ukprod can see the grouped partners, others only the parent partners\r\n if (environment != \"auprod\" && environment != \"ukprod\" && PartnerList && PartnerList.length > 0) {\r\n filteredDestinations = PartnerList.filter(x => !x.isGrouped || x.PartnerAccessId == x.GroupCompanyID);\r\n }\r\n\r\n // #EMS-8349\r\n const isAllow3p = enabledFeatures.includes(\"allow-multiple-3P-data-providers\");\r\n const thirdPartyFields = ancestorsFields.filter(field => field.IsThirdParty === true);\r\n const uniqueFieldTableKeys = new Set(thirdPartyFields.map(field => field.FieldTableKey));\r\n const hasMoreThanOneUniqueFieldTableKey = uniqueFieldTableKeys.size > 1;\r\n\r\n const destinations = filteredDestinations\r\n .map(item => ({\r\n label:\r\n item.VerticalName +\r\n \" - \" +\r\n item.CompanyName +\r\n (isInternal && item.FTPFolder != null ? \" (\" + item.FTPFolder + \")\" : \"\"),\r\n value: item.PartnerAccessId,\r\n disabled:\r\n isAllow3p && hasMoreThanOneUniqueFieldTableKey ? (item.DestinationTrackingId ? false : true) : false,\r\n item,\r\n }))\r\n .sort(labelCompare);\r\n\r\n const layout = layouts && layouts.filter(x => x.Layout.LayoutID == flowExport?.ExportId)[0];\r\n\r\n const filteredLayouts = destinationLayout.length > 0 ? destinationLayout : layoutList;\r\n const filteredLayout = filteredLayouts.filter(x => x.value == flowExport?.ExportId);\r\n\r\n const thisDestination = destinations.find(x => x.value == flowExport?.DestinationId);\r\n\r\n const deploySetting = thisDestination && thisDestination.item.DeploySetting;\r\n const hasSnowflake = enabledFeatures.includes(\"snowflake-db\");\r\n const hasFlowExportTemplateFields = enabledFeatures.includes(\"flow-export-template-fields\");\r\n const isAdditionalTemplate =\r\n deploySetting == DeploySettings.DeployAdditionalFacebookTemplate && hasFlowExportTemplateFields;\r\n const isTradeDeskTemplate = deploySetting == DeploySettings.DeployTradedeskTemplate;\r\n const isPubmaticTemplate = deploySetting == DeploySettings.DeployPubmaticTemplate;\r\n const isPinterestTemplate = deploySetting == DeploySettings.DeployPinterestAutomationTemplate;\r\n const isFreewheelDriverFile = deploySetting == DeploySettings.DeployFreewheelDriverFile;\r\n const isMagniteDriverFile = deploySetting == DeploySettings.DeployMagniteDriverFile;\r\n const isTikTokTemplate = deploySetting == DeploySettings.DeployTikTokDriverFile;\r\n const isSnowflakeTable = deploySetting == DeploySettings.DeploySnowflakeTable && hasSnowflake;\r\n const isNonExternalFields = deploySetting == DeploySettings.DeployNonExternalFields;\r\n let splitOverwrite = false;\r\n if (\r\n isAdditionalTemplate ||\r\n isPinterestTemplate ||\r\n isTikTokTemplate ||\r\n isTradeDeskTemplate ||\r\n isPubmaticTemplate ||\r\n isFreewheelDriverFile ||\r\n isMagniteDriverFile ||\r\n isSnowflakeTable ||\r\n isNonExternalFields\r\n ) {\r\n splitOverwrite = false;\r\n } else if (layout != null) {\r\n splitOverwrite = layout.Layout.DeploySeparateFiles;\r\n }\r\n\r\n const isActivationDestination = Boolean(\r\n thisDestination &&\r\n filteredDestinations.find(x => thisDestination.value == x.PartnerAccessId)?.CompanyIsActivationDestination\r\n );\r\n\r\n const destinationId = flowExport?.DestinationId;\r\n let showRequestExportApprovalMessage = false;\r\n if (\r\n destinationId &&\r\n filteredDestinations &&\r\n filteredDestinations.filter(x => x.PartnerAccessId == destinationId && x.EnforceDeploymentRequest).length > 0\r\n ) {\r\n showRequestExportApprovalMessage = true;\r\n }\r\n\r\n const formatNumber = (val: number) => (val != null ? val.toLocaleString() : \"\");\r\n\r\n return flowExport ? (\r\n
\r\n {showRequestExportApprovalMessage && (\r\n
\r\n Your chosen destination will require you to request export approval. To do so, click the 3 dots menu\r\n in the upper right hand corner from the main flow canvas and select "Request Export\r\n Approval"\r\n
\r\n )}\r\n
\r\n
\r\n
\r\n

Export Settings

\r\n
\r\n {!enabledFeatures.includes(\"activation-receipt-deployment\") && (\r\n
\r\n \r\n
\r\n )}\r\n
\r\n
\r\n {props.isModal && canShowCount()\r\n ? formatNumber(flowItemsById[flowExport.FlowItemId].FlowItemQty)\r\n : \"\"}\r\n
\r\n
 
\r\n
\r\n \r\n
\r\n \r\n \r\n {enabledFeatures.includes(\"flow-export-destination-selection-new-ui\") && thisDestination ? (\r\n \r\n
\r\n setPartner(undefined)}\r\n />\r\n
\r\n
\r\n ) : (\r\n \r\n \r\n (option && option.label) || \"\"}\r\n getOptionSelected={(option, value) => value.value === option.value}\r\n onChange={(_, e) => {\r\n if (e && !e.disabled) {\r\n setPartner(e.value);\r\n }\r\n }}\r\n autoComplete\r\n value={thisDestination || null}\r\n disabled={PartnerList == null || !canEdit || (flow && flow.IsLocked)}\r\n renderInput={params => (\r\n \r\n )}\r\n getOptionDisabled={option => option.disabled}\r\n />\r\n \r\n \r\n )}\r\n\r\n {(deploySetting == DeploySettings.DeployTradedeskTemplate ||\r\n deploySetting == DeploySettings.DeployXandrTemplate) && (\r\n \r\n \r\n \r\n )}\r\n\r\n {(deploySetting == DeploySettings.DeployPubmaticTemplate) && (\r\n \r\n \r\n \r\n )}\r\n {isActivationDestination && (\r\n \r\n \r\n \r\n )}\r\n \r\n
\r\n \r\n 0 ? destinationLayout : layoutList}\r\n getOptionLabel={option => option.label}\r\n getOptionSelected={(option, value) => value.value === option.value}\r\n onChange={layoutChanged}\r\n autoComplete\r\n value={filteredLayout.length > 0 ? filteredLayout[0] : null}\r\n disabled={\r\n destinationLayout.length > 0\r\n ? true\r\n : !canEdit || (flow && flow.IsLocked)\r\n ? true\r\n : false\r\n }\r\n renderOption={option => (\r\n \r\n {option.label}\r\n \r\n )}\r\n renderInput={params => }\r\n />\r\n \r\n \r\n View Details\r\n \r\n
\r\n
\r\n
\r\n
\r\n {hasFieldRestrictions ? (\r\n
\r\n
\r\n error_outline\r\n The selected destination does not allow the use of the below fields\r\n
\r\n \r\n
\r\n ) : (\r\n
\r\n {layout &&\r\n layout.Layout &&\r\n layout.LayoutTaxonomyObjects != null &&\r\n layout.LayoutTaxonomyObjects.length > 0 &&\r\n !props.hideExtra && }\r\n\r\n \r\n\r\n {flowExport && flowExport.DestinationId && (\r\n \r\n )}\r\n {/* \r\n )}\r\n
\r\n
\r\n ) : null;\r\n};\r\n\r\ntype FlowExportSelector = (state: IAppState, props: Props) => S;\r\nexport const makeGetFlowExport = (): FlowExportSelector =>\r\n // @ts-ignore\r\n createSelector(\r\n (state: IAppState) => getFlowExportsByFlowItemId(state),\r\n (_, props: Props) => props.flowItemId,\r\n (flowExportsByFlowItemId: FlowExportsByItemId, flowItemId: number): FlowExport | undefined =>\r\n flowExportsByFlowItemId[flowItemId]\r\n );\r\n\r\ntype FlowExportReportSelector = (state: IAppState, props: Props) => S;\r\nconst makeGetFlowExportReport = (): FlowExportReportSelector> =>\r\n // @ts-ignore\r\n createSelector(\r\n (state: IAppState) => getFlowExportReportsArray(state),\r\n (_, props: Props) => props.flowItemId,\r\n (reports: Array, flowItemId: number): Array =>\r\n reports.filter(x => x.ParentFlowItemId == flowItemId)\r\n );\r\n\r\ntype FlowExportDestinationSelector = (state: IAppState) => S;\r\nexport const makeGetExportDestinations = (): FlowExportDestinationSelector> =>\r\n // @ts-ignore\r\n createSelector(\r\n (state: IAppState) => state.vars.destinations,\r\n (destinations: Array): Array =>\r\n destinations ? destinations.filter(x => x.AcceptFlag == \"Y\") : []\r\n );\r\n\r\nexport default FlowExportEdit;\r\n","import React from \"react\";\r\n// Redux + AC\r\nimport { connect } from \"react-redux\";\r\nimport { bindActionCreators } from \"redux\";\r\nimport * as flowActions from \"../../../actions/flowActions\";\r\nimport * as actionCreators from \"../../../actions/actionCreators\";\r\nimport * as fieldTreeActions from \"../../../actions/fieldTreeActions\";\r\nimport * as clientVariableActions from \"../../../actions/clientVariableActions\";\r\nimport { Link } from \"react-router-dom\";\r\nimport { editUrlForFlowItem } from \"../../../reducers/flowItems\";\r\n// Components and helpers\r\nimport GenericConfirmModal from \"../../modals/GenericConfirmModal\";\r\nimport FieldPicker from \"../../tree-field/FieldPicker\";\r\nimport FlowItemQAToggle from \"./Shared/FlowItemQAToggle\";\r\nimport { addCommas, renderFlowItemType } from \"../../../helpers/typedHelpers\";\r\nimport { makeGetFlowSVDedupe } from \"../item/FlowSVDedupeEdit\";\r\nimport FlowSVDedupeEdit from \"./FlowSVDedupeEdit\";\r\nimport { arrayMoveImmutable } from \"array-move\";\r\nimport OfferDedupeToggle from \"./FlowOfferItems/OfferDedupeToggle\";\r\nimport OfferTemplateButton from \"./FlowOfferItems/OfferTemplateButton\";\r\nimport OfferCodeImport from \"./FlowOfferItems/OfferCodeImport\";\r\nimport MenuItem from \"@material-ui/core/MenuItem\";\r\nimport Select from \"@material-ui/core/Select\";\r\nimport FieldListEntryText from \"../../tree-field/FieldListEntryText\";\r\n\r\n// Reselects\r\nimport { createSelector } from \"reselect\";\r\nimport { getFlowOfferMergesByFlowItemId } from \"../../../reducers/flowOfferMerges\";\r\nimport { makeGetPermissionsItemFromProps, getSelectedFlowPermissions } from \"../../../reducers/flowItems\";\r\nimport { getClientVariablesWithValuesForSelectedFlow } from \"../../../reducers/clientVariables\";\r\nimport { getFlowItemClientVariablesForSelectedFlow } from \"../../../reducers/flowItemClientVariables\";\r\nimport { getFlowRelationsForSelectedFlow } from \"../../../reducers/flowRelations\";\r\nimport { getSVDedupeErrorsForSelectedFlow } from \"../../../reducers/flowSVDedupes\";\r\n\r\n// Types\r\nimport { VariableValueType, ClientVariableWithValue } from \"../../../types/stores/vars\";\r\nimport type { FlowOfferMergesByItemId } from \"../../../reducers/flowOfferMerges\";\r\nimport type { MapStateToProps } from \"react-redux\";\r\nimport type {\r\n FlowItem,\r\n FlowOfferMerge,\r\n FlowAndItemPermissions,\r\n FlowItemClientVariable,\r\n FlowItemClientVariableD,\r\n UpdateAttribute,\r\n FlowPermissions,\r\n FlowRelation,\r\n FlowSVDedupeD,\r\n FlowErrorsByItemId,\r\n} from \"../../../types/flowTypes\";\r\n\r\nimport Button from \"@material-ui/core/Button\";\r\nimport Divider from \"@material-ui/core/Divider\";\r\nimport Icon from \"@material-ui/core/Icon\";\r\nimport MaterialTooltip from \"@material-ui/core/Tooltip\";\r\nimport TextField from \"@material-ui/core/TextField\";\r\nimport NumericalTextField from \"../../material-components/Misc/NumericalTextField\";\r\n\r\ntype Props = {\r\n // Passed In\r\n flowItemId: number,\r\n // Redux\r\n flow: any,\r\n flowPermissions: FlowPermissions,\r\n selectedFlow: number,\r\n selectedFlowItem: number,\r\n flowItems: { [number]: FlowItem },\r\n flowRelations: Array,\r\n offerCodes: Array,\r\n flowItemClientVariables: Array,\r\n flowOfferMerges: Array,\r\n permissions: FlowAndItemPermissions,\r\n fields: Object,\r\n variableScope: string,\r\n flowSVDedupe: ?FlowSVDedupeD,\r\n flowSVDedupeErrors: ?FlowErrorsByItemId,\r\n // AC\r\n updateAttribute: UpdateAttribute,\r\n newFlowItemClientVariable: (\r\n variableId: number,\r\n flowId: number,\r\n flowItemId: number,\r\n childFlowItemId: number,\r\n variableValue: VariableValueType\r\n ) => void,\r\n deleteFlowItemClientVariable: (id: number) => void,\r\n requestClientVariables: () => void,\r\n deleteFlowOfferMerge: (id: number) => void,\r\n invalidateItemAndChildren: (flowItemId: number) => void,\r\n goEditFlowItem: (FlowItemId: number) => void,\r\n flowItemSetClientVariable: (\r\n flowId: number,\r\n flowItemId: number,\r\n variableId: number,\r\n variableValue: VariableValueType\r\n ) => void,\r\n showModal: (string, any) => void,\r\n newFlowSVDedupe: (flowItemId: number) => void,\r\n deleteFlowSVDedupe: (id: number) => void,\r\n setHasUnsavedChanges: (flowItemId: number) => void,\r\n updateFlowOfferMerge: (flowOfferMergeId: number, flowOfferPriority: number) => void,\r\n flowItemSetOfferCode: (\r\n flowId: number,\r\n flowItemId: number,\r\n variableId: number,\r\n isVisible: boolean,\r\n sortOrder: ?number\r\n ) => void,\r\n setSelectedField: (fieldKey: ?number) => void,\r\n};\r\n\r\ntype State = {\r\n sortBy: string,\r\n sortDirection: string,\r\n tabKey: ?number,\r\n hasDedupe: boolean,\r\n hasDedupeErrors: boolean,\r\n sortedParentFlowItems: Array,\r\n stringFieldOfferId: ?number,\r\n stringFieldParent: ?number,\r\n};\r\n\r\nclass FlowOfferMergeEdit extends React.Component {\r\n constructor(props) {\r\n super(props);\r\n this.state = {\r\n sortBy: \"ItemName\",\r\n sortDirection: \"ASC\",\r\n tabKey: 1,\r\n hasDedupe: false,\r\n hasDedupeErrors: false,\r\n sortedParentFlowItems: [],\r\n stringFieldOfferId: 0,\r\n stringFieldParent: 0,\r\n };\r\n }\r\n\r\n componentDidUpdate(prevProps) {\r\n if (prevProps != this.props) {\r\n this.setDedupeErrors();\r\n this.setState({ hasDedupe: this.props.flowSVDedupe != null });\r\n if (this.props.flowSVDedupe != null) {\r\n this.resetPriorities();\r\n this.setState({ sortBy: \"FlowOfferPriority\", sortDirection: \"ASC\" });\r\n }\r\n }\r\n }\r\n\r\n resetPriorities = () => {\r\n const { flowOfferMerges, updateFlowOfferMerge } = this.props;\r\n\r\n // Set New items to bottom priority\r\n let maxPri = Math.max(...flowOfferMerges.map(x => x.FlowOfferPriority));\r\n for (const flowOfferMerge of flowOfferMerges) {\r\n if (flowOfferMerge.FlowOfferPriority <= 0) {\r\n flowOfferMerge.FlowOfferPriority = ++maxPri;\r\n updateFlowOfferMerge(flowOfferMerge.FlowOfferMergeId, maxPri);\r\n }\r\n }\r\n\r\n // Resort and reassign to account for deleted items\r\n this.sortOffersByPriority();\r\n let newPri = 1;\r\n for (const flowOfferMerge of flowOfferMerges) {\r\n // Update state if value changed\r\n if (flowOfferMerge.FlowOfferPriority != newPri) {\r\n updateFlowOfferMerge(flowOfferMerge.FlowOfferMergeId, newPri);\r\n }\r\n newPri++;\r\n }\r\n };\r\n\r\n resetOfferCodeSortOrder = () => {\r\n const { offerCodes, flowItemSetOfferCode, selectedFlow, selectedFlowItem } = this.props;\r\n\r\n // Set New items to last\r\n const sortedOffers = [...offerCodes];\r\n let maxOrder = Math.max(...offerCodes.map(x => x.SortOrder || 0));\r\n sortedOffers.forEach((value, index) => {\r\n if (sortedOffers[index].IsVisible && sortedOffers[index].SortOrder == null) {\r\n maxOrder++;\r\n sortedOffers[index].SortOrder = maxOrder;\r\n } else if (!sortedOffers[index].IsVisible) {\r\n sortedOffers[index].SortOrder = null;\r\n }\r\n });\r\n\r\n // Sort and reassign\r\n sortedOffers.sort((a, b) => {\r\n if (a[\"SortOrder\"] == null && b[\"SortOrder\"] != null) {\r\n return -1;\r\n }\r\n if (a[\"SortOrder\"] != null && b[\"SortOrder\"] == null) {\r\n return 1;\r\n }\r\n if (a[\"SortOrder\"] == null && b[\"SortOrder\"] == null) {\r\n return 0;\r\n }\r\n if (a[\"SortOrder\"] != null && b[\"SortOrder\"] != null && a[\"SortOrder\"] > b[\"SortOrder\"]) {\r\n return 1;\r\n }\r\n if (a[\"SortOrder\"] != null && b[\"SortOrder\"] != null && a[\"SortOrder\"] < b[\"SortOrder\"]) {\r\n return -1;\r\n }\r\n return 0;\r\n });\r\n\r\n let newSort = 1;\r\n sortedOffers.forEach((value, index) => {\r\n flowItemSetOfferCode(\r\n selectedFlow,\r\n selectedFlowItem,\r\n sortedOffers[index].Id,\r\n sortedOffers[index].IsVisible,\r\n sortedOffers[index].IsVisible ? newSort : null\r\n );\r\n if (sortedOffers[index].IsVisible) {\r\n newSort++;\r\n }\r\n });\r\n };\r\n\r\n sortOffersByPriority = () => {\r\n const { flowOfferMerges } = this.props;\r\n flowOfferMerges.sort((a, b) => {\r\n if (a[\"FlowOfferPriority\"] > b[\"FlowOfferPriority\"]) {\r\n return 1;\r\n }\r\n if (a[\"FlowOfferPriority\"] < b[\"FlowOfferPriority\"]) {\r\n return -1;\r\n }\r\n return 0;\r\n });\r\n };\r\n\r\n handleTabSelect = tabKey => this.setState({ tabKey });\r\n\r\n editVisibility = () => {\r\n const { showModal, variableScope, offerCodes } = this.props;\r\n\r\n // Set Initial Sort Order for Offers\r\n this.resetOfferCodeSortOrder();\r\n\r\n const clientVariablesWithValues = offerCodes;\r\n const modalProps = {\r\n variableScope,\r\n clientVariablesWithValues,\r\n };\r\n showModal(\"FLOW_VISIBLE_VARIABLES\", modalProps);\r\n };\r\n\r\n bulkAssignModal = e => {\r\n const { showModal, offerCodes } = this.props;\r\n const offerCodeId = e.currentTarget.id;\r\n if (!offerCodeId) {\r\n return;\r\n }\r\n const selectedOffer = offerCodes.find(x => x.Id == offerCodeId);\r\n if (!selectedOffer) {\r\n return;\r\n }\r\n if (\r\n selectedOffer.VariableKind == \"string\" ||\r\n selectedOffer.VariableKind == \"field\" ||\r\n selectedOffer.VariableKind == \"stringField\"\r\n ) {\r\n showModal(\"FLOW_OFFER_CODE_VALUE\", {\r\n variableId: selectedOffer.Id,\r\n variableKind: selectedOffer.VariableKind,\r\n variableName: selectedOffer.VariableName,\r\n assignValues: this.bulkAssignValues,\r\n regex: selectedOffer.Regex,\r\n dropdownValues: selectedOffer.DropdownValues,\r\n });\r\n } else {\r\n return;\r\n }\r\n };\r\n\r\n bulkAssignValues = (id, kind, bulkValue) => {\r\n const {\r\n flowOfferMerges,\r\n flowItemClientVariables,\r\n updateAttribute,\r\n newFlowItemClientVariable,\r\n selectedFlow,\r\n setSelectedField,\r\n flowItemId,\r\n } = this.props;\r\n flowOfferMerges.forEach((value, index) => {\r\n const foundItemClientVariable = flowItemClientVariables.find(\r\n x => x.VariableId == id && x.FlowItemId == flowOfferMerges[index].ParentFlowItemId\r\n );\r\n let newValueObject: VariableValueType = {\r\n Kind: kind,\r\n ValueString: kind == \"string\" ? bulkValue : null,\r\n ValueDate: null,\r\n FieldId: kind == \"field\" ? bulkValue : null,\r\n };\r\n if (kind == \"stringField\") {\r\n newValueObject = {\r\n Kind: kind,\r\n ValueString: bulkValue.split(\"+\").shift(),\r\n ValueDate: null,\r\n FieldId: parseInt(bulkValue.split(\"+\").pop()),\r\n };\r\n }\r\n if (foundItemClientVariable) {\r\n updateAttribute(\r\n \"flowItemClientVariables\",\r\n foundItemClientVariable.FlowItemClientVariableId,\r\n \"VariableValue\",\r\n newValueObject,\r\n true\r\n );\r\n } else {\r\n newFlowItemClientVariable(\r\n id,\r\n selectedFlow,\r\n flowOfferMerges[index].ParentFlowItemId,\r\n flowItemId,\r\n newValueObject\r\n );\r\n }\r\n });\r\n\r\n // Clear selected field\r\n if (kind == \"field\" || kind == \"stringField\") {\r\n setSelectedField(null);\r\n }\r\n };\r\n\r\n downloadExcelLink = flowItemId => {\r\n const { hasDedupe } = this.state;\r\n const excelLink = `/FlowItemReports/OfferMergeReport?flowItemId=${flowItemId}&hasDedupe=${hasDedupe.toString()}`;\r\n window.location = excelLink;\r\n };\r\n\r\n filterOfferCodes = () => {\r\n const { offerCodes } = this.props;\r\n const visibleOffers = offerCodes.filter(x => x.IsVisible);\r\n visibleOffers.sort((a, b) => {\r\n if (a[\"SortOrder\"] == null || b[\"SortOrder\"] == null) {\r\n return 0;\r\n }\r\n if (a[\"SortOrder\"] > b[\"SortOrder\"]) {\r\n return 1;\r\n }\r\n if (a[\"SortOrder\"] < b[\"SortOrder\"]) {\r\n return -1;\r\n }\r\n return 0;\r\n });\r\n\r\n return visibleOffers;\r\n };\r\n\r\n invalidate = () => {\r\n const { flowItemId, invalidateItemAndChildren } = this.props;\r\n invalidateItemAndChildren(flowItemId);\r\n };\r\n\r\n delete = (id: number) => {\r\n const { deleteFlowOfferMerge } = this.props;\r\n deleteFlowOfferMerge(id);\r\n this.invalidate();\r\n };\r\n\r\n onVariableChange = (\r\n flowItemClientVariable: ?FlowItemClientVariableD,\r\n variableId: number,\r\n parentFlowItemId: number,\r\n variableValue: VariableValueType\r\n ) => {\r\n const {\r\n selectedFlow,\r\n updateAttribute,\r\n newFlowItemClientVariable,\r\n deleteFlowItemClientVariable,\r\n flowItemClientVariables,\r\n flowItemId,\r\n } = this.props;\r\n\r\n if (flowItemClientVariable) {\r\n if (variableValue) {\r\n if (variableValue.ValueString != \"\" || variableValue.FieldId) {\r\n updateAttribute(\r\n \"flowItemClientVariables\",\r\n flowItemClientVariable.FlowItemClientVariableId,\r\n \"VariableValue\",\r\n variableValue,\r\n true\r\n );\r\n } else {\r\n deleteFlowItemClientVariable(flowItemClientVariable.FlowItemClientVariableId);\r\n }\r\n } else {\r\n deleteFlowItemClientVariable(flowItemClientVariable.FlowItemClientVariableId);\r\n }\r\n } else if (\r\n flowItemClientVariables.filter(\r\n x => x.VariableId == variableId && x.FlowItemId == parentFlowItemId && x.ChildFlowItemId == flowItemId\r\n ).length == 0\r\n ) {\r\n newFlowItemClientVariable(variableId, selectedFlow, parentFlowItemId, flowItemId, variableValue);\r\n }\r\n\r\n this.invalidate();\r\n };\r\n\r\n onPriorityChange = (val, Id) => {\r\n const { flowOfferMerges, updateFlowOfferMerge } = this.props;\r\n const row = flowOfferMerges.find(x => x.FlowOfferMergeId == Id);\r\n if (!row || !val) {\r\n return;\r\n }\r\n\r\n const intNewPri = parseInt(val);\r\n this.sortOffersByPriority();\r\n const changedOffer = flowOfferMerges.find(x => x.FlowOfferMergeId == Id);\r\n if (!changedOffer) {\r\n return;\r\n }\r\n const oldIndex = flowOfferMerges.indexOf(changedOffer);\r\n const newIndex = intNewPri - 1;\r\n let updatedMerges = arrayMoveImmutable(flowOfferMerges, oldIndex, newIndex);\r\n updatedMerges.forEach((value, index) => {\r\n const newPri = index + 1;\r\n const idToUpdate = updatedMerges[index][\"FlowOfferMergeId\"];\r\n updatedMerges[index].FlowOfferPriority = newPri;\r\n updateFlowOfferMerge(idToUpdate, newPri);\r\n });\r\n\r\n this.setState({ sortedParentFlowItems: updatedMerges });\r\n\r\n this.invalidate();\r\n this.forceUpdate();\r\n };\r\n\r\n getRows = (arrayToPopulate, tableId, row) => {\r\n const tableElement = document.querySelector(tableId);\r\n if (tableElement instanceof HTMLTableElement) {\r\n const numCols = tableElement && tableElement.rows ? tableElement.rows[0].cells.length : 0;\r\n let col = 0;\r\n if (row < 0) {\r\n return;\r\n }\r\n\r\n for (col = 0; col < numCols; ++col) {\r\n if (tableElement.rows[row].cells.length > col) {\r\n if (tableElement.rows[row].cells[col].className == \"editable-string-td\") {\r\n arrayToPopulate.push(tableElement.rows[row].cells[col]);\r\n }\r\n }\r\n }\r\n }\r\n };\r\n\r\n getColumns = (arrayToPopulate, tableId, col) => {\r\n const tableElement = document.querySelector(tableId);\r\n if (tableElement instanceof HTMLTableElement) {\r\n const numRows = tableElement && tableElement.rows ? tableElement.rows.length : 0;\r\n let row = 0;\r\n\r\n if (col < 0) {\r\n return;\r\n }\r\n\r\n for (row = 0; row < numRows; ++row) {\r\n if (tableElement.rows[row].cells.length > col) {\r\n if (tableElement.rows[row].cells[col].className == \"editable-string-td\") {\r\n arrayToPopulate.push(tableElement.rows[row].cells[col]);\r\n }\r\n }\r\n }\r\n }\r\n };\r\n\r\n handleKeyPress = e => {\r\n let editableStringArray = [];\r\n const table = document.querySelector(\"#offer-code-tables\");\r\n const isEnterKey = e.key == \"Enter\";\r\n const isTabKey = e.key == \"Tab\";\r\n\r\n if ((isEnterKey || isTabKey) && table instanceof HTMLTableElement) {\r\n if (isEnterKey) {\r\n for (let i = 0; i < table.rows[0].cells.length; ++i) {\r\n this.getColumns(editableStringArray, \"#offer-code-tables\", i);\r\n }\r\n } else if (isTabKey) {\r\n for (let i = 0; i < table.rows.length; ++i) {\r\n this.getRows(editableStringArray, \"#offer-code-tables\", i);\r\n }\r\n }\r\n\r\n e.preventDefault(); // prevent default event for tab or enter\r\n this.navTable(e, editableStringArray);\r\n }\r\n };\r\n\r\n navTable = (e, editableStringArray) => {\r\n const useShiftKey = e.shiftKey;\r\n const identifier = e.target.id;\r\n let nextChild = null;\r\n\r\n if (!useShiftKey) {\r\n nextChild =\r\n editableStringArray[\r\n editableStringArray.findIndex(el => {\r\n if (el && el.firstChild) {\r\n const input = el.firstChild.querySelector(\".MuiInputBase-input\");\r\n if (input instanceof HTMLInputElement) {\r\n return input.id == identifier;\r\n }\r\n }\r\n }) + 1\r\n ];\r\n\r\n if (nextChild && nextChild.firstChild) {\r\n const nextInput = nextChild.firstChild.querySelector(\".MuiInputBase-input\");\r\n if (nextInput && nextInput instanceof HTMLInputElement) {\r\n nextInput.focus();\r\n nextInput.select();\r\n }\r\n }\r\n } else {\r\n nextChild =\r\n editableStringArray[\r\n editableStringArray.findIndex(el => {\r\n if (el && el.firstChild) {\r\n const input = el.firstChild.querySelector(\".MuiInputBase-input\");\r\n if (input instanceof HTMLInputElement) {\r\n return input.id == identifier;\r\n }\r\n }\r\n }) - 1\r\n ];\r\n\r\n if (nextChild && nextChild.firstChild && nextChild.firstChild instanceof HTMLInputElement) {\r\n const nextInput = nextChild.firstChild.querySelector(\".MuiInputBase-input\");\r\n if (nextInput && nextInput instanceof HTMLInputElement) {\r\n nextInput.focus();\r\n nextInput.select();\r\n }\r\n }\r\n }\r\n };\r\n\r\n renderEditableString = (\r\n flowItemClientVariable,\r\n variableId,\r\n parentFlowItemId,\r\n valueString,\r\n editableIdentifier,\r\n regex,\r\n dropdownValues\r\n ) => {\r\n const {\r\n permissions: {\r\n item: { canEdit },\r\n },\r\n flow,\r\n } = this.props;\r\n\r\n if (dropdownValues) {\r\n const dropdownArr = dropdownValues.split(\"|\");\r\n if (dropdownArr.length > 0) {\r\n return (\r\n {\r\n const newValueObject: VariableValueType = {\r\n Kind: \"string\",\r\n ValueString: e.target.value,\r\n ValueDate: null,\r\n FieldId: null,\r\n };\r\n\r\n this.onVariableChange(flowItemClientVariable, variableId, parentFlowItemId, newValueObject);\r\n }}\r\n style={{ fontSize: 16, width: \"100%\" }}\r\n >\r\n {dropdownArr.map(x => (\r\n \r\n {x}\r\n \r\n ))}\r\n \r\n );\r\n }\r\n }\r\n let sequenceStr = false;\r\n if (valueString.startsWith(\"{\")) {\r\n sequenceStr = true;\r\n }\r\n // set error state for regex values\r\n const reg = new RegExp(regex);\r\n const isError = Boolean(valueString && regex && !reg.test(valueString));\r\n const helperText = isError ? \"Value doesn't match \" + regex : \"\";\r\n\r\n return (\r\n {\r\n this.handleKeyPress(e);\r\n }}\r\n onChange={e => {\r\n const newValue = e.target.value;\r\n\r\n const newValueObject: VariableValueType = {\r\n Kind: \"string\",\r\n ValueString: newValue,\r\n ValueDate: null,\r\n FieldId: null,\r\n };\r\n this.onVariableChange(flowItemClientVariable, variableId, parentFlowItemId, newValueObject);\r\n }}\r\n helperText={helperText}\r\n />\r\n );\r\n };\r\n\r\n renderEditableField = (flowItemClientVariable, variableId, flowItemId, fieldId) => {\r\n const {\r\n permissions: {\r\n item: { canEdit },\r\n },\r\n flow,\r\n } = this.props;\r\n return (\r\n {\r\n const newValueObject: VariableValueType = {\r\n Kind: \"field\",\r\n ValueString: null,\r\n ValueDate: null,\r\n FieldId: newFieldId,\r\n };\r\n this.onVariableChange(flowItemClientVariable, variableId, flowItemId, newValueObject);\r\n }}\r\n />\r\n );\r\n };\r\n\r\n renderEditableStringField = (id, flowItemClientVariable, parentFlowItemId) => {\r\n const { showModal, offerCodes } = this.props;\r\n this.setState({ stringFieldParent: parentFlowItemId });\r\n if (flowItemClientVariable != null) {\r\n this.setState({ stringFieldOfferId: flowItemClientVariable.FlowItemClientVariableId });\r\n }\r\n const selectedOffer = offerCodes.find(x => x.Id == id);\r\n if (!selectedOffer) {\r\n return;\r\n }\r\n showModal(\"FLOW_OFFER_CODE_VALUE\", {\r\n variableId: selectedOffer.Id,\r\n variableKind: selectedOffer.VariableKind,\r\n variableName: selectedOffer.VariableName,\r\n assignValues: this.assignStringFieldValues,\r\n regex: selectedOffer.Regex,\r\n dropdownValues: selectedOffer.DropdownValues,\r\n });\r\n };\r\n\r\n assignStringFieldValues = (id, kind, stringFieldValue) => {\r\n const { updateAttribute, newFlowItemClientVariable, selectedFlow, setSelectedField, flowItemId } = this.props;\r\n const { stringFieldOfferId, stringFieldParent } = this.state;\r\n const newValueObject: VariableValueType = {\r\n Kind: kind,\r\n ValueString: stringFieldValue.split(\"+\").shift(),\r\n ValueDate: null,\r\n FieldId: parseInt(stringFieldValue.split(\"+\").pop()),\r\n };\r\n if (stringFieldOfferId != 0) {\r\n updateAttribute(\"flowItemClientVariables\", stringFieldOfferId, \"VariableValue\", newValueObject, true);\r\n } else {\r\n newFlowItemClientVariable(id, selectedFlow, stringFieldParent, flowItemId, newValueObject);\r\n }\r\n this.setState({ stringFieldOfferId: 0, stringFieldParent: 0 });\r\n setSelectedField(null);\r\n };\r\n\r\n clearEditableStringField(flowItemClientVariable) {\r\n if (flowItemClientVariable != null) {\r\n this.props.deleteFlowItemClientVariable(flowItemClientVariable.FlowItemClientVariableId);\r\n }\r\n }\r\n\r\n renderActions = flowOfferMergeId => {\r\n const {\r\n permissions: {\r\n item: { canEdit },\r\n },\r\n flow,\r\n } = this.props;\r\n\r\n const confirmDeleteBody =
{`Are you sure you want to delete this row?`}
;\r\n const confirmDeleteText = \"Delete Row\";\r\n\r\n return (\r\n this.delete(flowOfferMergeId)}\r\n body={confirmDeleteBody}\r\n confirmText={confirmDeleteText}\r\n title=\"Confirm Delete Merge\"\r\n buttonText={\r\n \r\n }\r\n buttonDisabled={!canEdit || (flow && flow.IsLocked)}\r\n cnBtnStyle=\"normal-transparent-button\"\r\n />\r\n );\r\n };\r\n\r\n renderOfferItems = parentFlowItemId => {\r\n const { flowItemClientVariables, flowOfferMerges } = this.props;\r\n const { sortedParentFlowItems } = this.state;\r\n\r\n let offerItems = [];\r\n let index = 1;\r\n for (const offerCode of this.filterOfferCodes()) {\r\n const foundFlowItemClientVariable = flowItemClientVariables.filter(\r\n x => x.FlowItemId == parentFlowItemId && x.VariableId == offerCode.Id\r\n );\r\n let flowItemClientVariable;\r\n if (foundFlowItemClientVariable.length > 0) {\r\n flowItemClientVariable = foundFlowItemClientVariable[0];\r\n }\r\n if (offerCode.VariableKind == \"stringField\") {\r\n const valueString = flowItemClientVariable ? flowItemClientVariable.VariableValue.ValueString : \"\";\r\n const fieldId = flowItemClientVariable ? flowItemClientVariable.VariableValue.FieldId : null;\r\n offerItems.push(\r\n \r\n {valueString + \" \"}\r\n {fieldId != null ? : \"\"}\r\n
\r\n \r\n this.renderEditableStringField(\r\n offerCode.Id,\r\n flowItemClientVariable,\r\n parentFlowItemId\r\n )\r\n }\r\n >\r\n edit\r\n \r\n this.clearEditableStringField(flowItemClientVariable)}\r\n >\r\n clear\r\n \r\n
\r\n \r\n );\r\n }\r\n\r\n if (offerCode.VariableKind == \"field\") {\r\n const fieldId = flowItemClientVariable ? flowItemClientVariable.VariableValue.FieldId : null;\r\n const field = this.renderEditableField(flowItemClientVariable, offerCode.Id, parentFlowItemId, fieldId);\r\n offerItems.push({field});\r\n } else if (offerCode.VariableKind == \"string\") {\r\n const valueString = flowItemClientVariable ? flowItemClientVariable.VariableValue.ValueString : \"\";\r\n\r\n // Only get sorted parents when priority changes, else we get the original.\r\n let mergeItem = null;\r\n if (sortedParentFlowItems.length > 0) {\r\n mergeItem = sortedParentFlowItems.find(item => item.ParentFlowItemId == parentFlowItemId);\r\n } else {\r\n mergeItem = flowOfferMerges.find(item => item.ParentFlowItemId == parentFlowItemId);\r\n }\r\n\r\n const identifier = mergeItem\r\n ? `${\r\n mergeItem.FlowOfferPriority && mergeItem.FlowOfferPriority > 0\r\n ? mergeItem.FlowOfferPriority\r\n : mergeItem.ParentFlowItemId\r\n }-${index}`\r\n : \"\";\r\n\r\n const inputText = this.renderEditableString(\r\n flowItemClientVariable,\r\n offerCode.Id,\r\n parentFlowItemId,\r\n valueString,\r\n identifier,\r\n offerCode.Regex,\r\n offerCode.DropdownValues\r\n );\r\n offerItems.push(\r\n \r\n {inputText}\r\n \r\n );\r\n index++;\r\n }\r\n }\r\n\r\n return offerItems;\r\n };\r\n\r\n renderPrioritySelect = parentFlowItemId => {\r\n const {\r\n flowOfferMerges,\r\n permissions: {\r\n item: { canEdit },\r\n },\r\n flow,\r\n } = this.props;\r\n const item = flowOfferMerges.find(x => x.ParentFlowItemId == parentFlowItemId);\r\n if (!item) {\r\n return null;\r\n }\r\n return (\r\n {\r\n let value = parseInt(e.target.value);\r\n if (value < 1) {\r\n value = 1;\r\n } else if (value.toString().length > 3) {\r\n value = 999;\r\n }\r\n this.onPriorityChange(value, item.FlowOfferMergeId);\r\n }}\r\n />\r\n );\r\n };\r\n\r\n createOfferTable = () => {\r\n const { flowOfferMerges, flowItems, flowItemClientVariables, flowRelations } = this.props;\r\n let table = [];\r\n\r\n for (const flowOfferMerge of flowOfferMerges) {\r\n const parentFlowItem: ?FlowItem = flowItems[flowOfferMerge.ParentFlowItemId];\r\n\r\n let line = {};\r\n\r\n line.flowOfferMerge = flowOfferMerge;\r\n line.Quantity = 0;\r\n line.ItemName = \"Item not found\";\r\n line.ParentFlowItemId = flowOfferMerge.ParentFlowItemId;\r\n line.FlowOfferPriority = flowOfferMerge.FlowOfferPriority;\r\n\r\n if (parentFlowItem) {\r\n line.Quantity = parseInt(parentFlowItem.FlowItemQty);\r\n\r\n if (parentFlowItem.FlowItemType != \"empty\") {\r\n const parentFlowItemType = renderFlowItemType(parentFlowItem.FlowItemType);\r\n line.ItemName = parentFlowItem.FlowItemName + \" - \" + parentFlowItemType;\r\n } else {\r\n line.ItemName = parentFlowItem.FlowItemName;\r\n\r\n const emptyParentRelations = flowRelations\r\n .filter(x => x.ChildFlowItemId == parentFlowItem.FlowItemId && x.ParentFlowItemId != 0)\r\n .map(x => x.ParentFlowItemId);\r\n\r\n if (emptyParentRelations.length > 0) {\r\n const emptyParentFlowItemId = emptyParentRelations[0];\r\n const emptyParentFlowItem: FlowItem = flowItems[emptyParentFlowItemId];\r\n const emptyParentFlowItemType = renderFlowItemType(emptyParentFlowItem.FlowItemType);\r\n line.ItemName += \" - \" + emptyParentFlowItem.FlowItemName + \" - \" + emptyParentFlowItemType;\r\n }\r\n }\r\n }\r\n\r\n for (const offerCode of this.filterOfferCodes()) {\r\n const foundFlowItemClientVariable = flowItemClientVariables.filter(\r\n x => x.FlowItemId == flowOfferMerge.ParentFlowItemId && x.VariableId == offerCode.Id\r\n );\r\n\r\n let flowItemClientVariable = null;\r\n if (foundFlowItemClientVariable.length > 0) {\r\n flowItemClientVariable = foundFlowItemClientVariable[0];\r\n }\r\n\r\n line[offerCode.VariableName] = flowItemClientVariable;\r\n }\r\n\r\n table.push(line);\r\n }\r\n\r\n return this.sortTable(table);\r\n };\r\n\r\n setSort = e => {\r\n const { sortBy, sortDirection } = this.state;\r\n\r\n const newSortBy = e.currentTarget.dataset.sortfield || \"Quantity\";\r\n\r\n let newSortDirection = \"ASC\";\r\n if (newSortBy == sortBy && sortDirection == \"ASC\") {\r\n newSortDirection = \"DESC\";\r\n }\r\n\r\n this.setState({ sortBy: newSortBy, sortDirection: newSortDirection });\r\n };\r\n\r\n getVariableValue = input => {\r\n const { fields } = this.props;\r\n\r\n if (input == null) {\r\n return \"\";\r\n }\r\n\r\n let output = input ? input : \"\";\r\n if (input.VariableValue) {\r\n const kind = input.VariableValue.Kind;\r\n if (kind == \"string\") {\r\n output = input.VariableValue.ValueString;\r\n } else if (kind == \"field\") {\r\n output = fields[input.VariableValue.FieldId] ? fields[input.VariableValue.FieldId].text : \"\";\r\n }\r\n }\r\n\r\n return output.toString().toLowerCase();\r\n };\r\n\r\n sortTable = offerTable => {\r\n const { sortBy, sortDirection } = this.state;\r\n\r\n let sortedOfferTable = offerTable;\r\n if (sortBy && sortDirection) {\r\n sortedOfferTable = offerTable.sort((a, b) => {\r\n const nameA = this.getVariableValue(a[sortBy]);\r\n const nameB = this.getVariableValue(b[sortBy]);\r\n const bothNumbers = !isNaN(parseFloat(nameA)) && !isNaN(parseFloat(nameB));\r\n\r\n let comparison = 0;\r\n if (sortDirection == \"ASC\") {\r\n if (bothNumbers) {\r\n if (Number(nameA) < Number(nameB)) {\r\n comparison = -1;\r\n } else if (Number(nameA) > Number(nameB)) {\r\n comparison = 1;\r\n }\r\n } else if (nameA < nameB) {\r\n comparison = -1;\r\n } else if (nameA > nameB) {\r\n comparison = 1;\r\n }\r\n\r\n if (comparison == 0) {\r\n comparison = a.ParentFlowItemId < b.ParentFlowItemId ? -1 : 1;\r\n }\r\n\r\n return comparison;\r\n } else if (bothNumbers) {\r\n return Number(nameA) > Number(nameB) ? -1 : 1;\r\n } else {\r\n return nameA > nameB ? -1 : 1;\r\n }\r\n });\r\n }\r\n return sortedOfferTable;\r\n };\r\n\r\n renderOfferHeader = offerCode => {\r\n const {\r\n permissions: {\r\n item: { canEdit },\r\n },\r\n flow,\r\n } = this.props;\r\n\r\n const header = (\r\n \r\n
\r\n \r\n {offerCode.VariableName}\r\n \r\n {canEdit && (\r\n \r\n \r\n edit\r\n \r\n
\r\n )}\r\n
\r\n \r\n );\r\n\r\n return header;\r\n };\r\n\r\n editItem = id => {\r\n const { goEditFlowItem } = this.props;\r\n goEditFlowItem(id);\r\n };\r\n\r\n renderNewTable = () => {\r\n const { hasDedupe } = this.state;\r\n const { flowItemId, flowItems } = this.props;\r\n const currentFlowItem = flowItems[flowItemId];\r\n\r\n let sortedOfferTable = this.createOfferTable();\r\n\r\n let offerHeaders = [];\r\n for (const offerCode of this.filterOfferCodes()) {\r\n offerHeaders.push(this.renderOfferHeader(offerCode));\r\n }\r\n\r\n let tableLines = [];\r\n\r\n for (const line of sortedOfferTable) {\r\n const offerItems = this.renderOfferItems(line.flowOfferMerge.ParentFlowItemId);\r\n\r\n const actionsColumn = this.renderActions(line.flowOfferMerge.FlowOfferMergeId);\r\n const formattedQty = line.Quantity ? addCommas(line.Quantity) : \"N/A\";\r\n const prioritySelect = this.renderPrioritySelect(line.flowOfferMerge.ParentFlowItemId);\r\n const dedupeClass = `text-center${hasDedupe ? \" headcol\" : \" hidden\"}`;\r\n\r\n tableLines.push(\r\n \r\n \r\n {line.ItemName ? (\r\n this.editItem(line.flowOfferMerge.ParentFlowItemId)}\r\n >\r\n {line.ItemName}\r\n \r\n ) : (\r\n \"Item not found\"\r\n )}\r\n \r\n {prioritySelect}\r\n {formattedQty}\r\n \r\n {currentFlowItem && currentFlowItem.HasResultTable\r\n ? line.flowOfferMerge\r\n ? addCommas(line.flowOfferMerge.DupesQty)\r\n : \"\"\r\n : \"N/A\"}\r\n \r\n\r\n {offerItems}\r\n {{actionsColumn}}\r\n \r\n );\r\n }\r\n\r\n const offerTable = (\r\n \r\n \r\n \r\n \r\n \r\n Priority\r\n \r\n \r\n \r\n Output Quantity\r\n \r\n\r\n {offerHeaders}\r\n \r\n \r\n {tableLines}\r\n
\r\n Item\r\n \r\n Input Quantity\r\n \r\n
\r\n );\r\n\r\n return offerTable;\r\n };\r\n\r\n setDedupeErrors = () => {\r\n const { flowItemId, flowSVDedupeErrors } = this.props;\r\n let hasErrors = false;\r\n if (flowItemId && flowSVDedupeErrors) {\r\n const errors = flowSVDedupeErrors[flowItemId];\r\n if (errors && errors.length > 0) {\r\n hasErrors = true;\r\n }\r\n }\r\n this.setState({ hasDedupeErrors: hasErrors });\r\n };\r\n\r\n render() {\r\n const { hasDedupe, hasDedupeErrors } = this.state;\r\n const { offerCodes, flowItemId, flowOfferMerges, permissions, flow } = this.props;\r\n\r\n if (flowItemId == null || offerCodes.length == 0 || flowOfferMerges.length == 0) {\r\n return null;\r\n }\r\n\r\n const newTable = this.renderNewTable();\r\n\r\n const visibilityButton = (\r\n edit}\r\n onClick={this.editVisibility}\r\n disabled={!permissions.item.canEdit || (flow && flow.IsLocked)}\r\n >\r\n Edit Visibility\r\n \r\n );\r\n\r\n const templateButton = (\r\n \r\n );\r\n\r\n const tableClass = hasDedupeErrors ? \"offer-table-errors\" : \"offer-table-full\";\r\n\r\n const offerMergeEdit = (\r\n
\r\n
\r\n

Offer Settings

\r\n
\r\n this.handleTabSelect(1)}\r\n isDisabled={!permissions.item.canEdit || (flow && flow.IsLocked)}\r\n />\r\n \r\n
\r\n {visibilityButton}\r\n
\r\n
\r\n
\r\n \r\n
\r\n
{newTable}
\r\n\r\n {hasDedupe && (\r\n \r\n )}\r\n\r\n
\r\n
\r\n

Import

\r\n \r\n Import your own file to automatically populate and configure your offer codes\r\n \r\n
\r\n
{templateButton}
\r\n
\r\n \r\n \r\n
\r\n
\r\n );\r\n\r\n return offerMergeEdit;\r\n }\r\n}\r\n\r\nexport const makeGetFlowOfferMerge = () =>\r\n createSelector(\r\n state => getFlowOfferMergesByFlowItemId(state),\r\n (_, props) => props.flowItemId,\r\n (flowOfferMergesByFlowItemId: FlowOfferMergesByItemId, flowItemId: number): Array =>\r\n flowOfferMergesByFlowItemId[flowItemId]\r\n );\r\n\r\nconst variableScope = \"OfferCode\";\r\nconst mapStateToProps: MapStateToProps<*, *, *> = () => {\r\n const getFlowOfferMerge = makeGetFlowOfferMerge();\r\n const getPermissionsItemFromProps = makeGetPermissionsItemFromProps();\r\n const getFlowSVDedupe = makeGetFlowSVDedupe();\r\n return (state, ownProps) => ({\r\n flow: state.flows.byId[state.selected.flow],\r\n selectedFlow: state.selected.flow,\r\n selectedFlowItem: state.selected.flowItem,\r\n flowItems: state.flowItems.byId,\r\n flowRelations: getFlowRelationsForSelectedFlow(state),\r\n offerCodes: getClientVariablesWithValuesForSelectedFlow(state).filter(x => x.VariableScope == variableScope),\r\n flowItemClientVariables: getFlowItemClientVariablesForSelectedFlow(state), // array\r\n flowOfferMerges: getFlowOfferMerge(state, ownProps) || [],\r\n flowPermissions: getSelectedFlowPermissions(state),\r\n permissions: getPermissionsItemFromProps(state, ownProps),\r\n fields: state.fields.byId,\r\n variableScope,\r\n flowSVDedupe: getFlowSVDedupe(state, ownProps),\r\n flowSVDedupeErrors: getSVDedupeErrorsForSelectedFlow(state),\r\n });\r\n};\r\nconst mapDispatchToProps = dispatch =>\r\n bindActionCreators(\r\n Object.assign({}, actionCreators, flowActions, clientVariableActions, fieldTreeActions),\r\n dispatch\r\n );\r\nconst FlowOfferMergeEditC = connect(mapStateToProps, mapDispatchToProps)(FlowOfferMergeEdit);\r\n\r\nexport default FlowOfferMergeEditC;\r\n","import React, { useEffect, useState, useCallback } from \"react\";\r\nimport { useDispatch, useSelector } from \"react-redux\";\r\nimport {\r\n Paper,\r\n FormLabel,\r\n FormControl,\r\n FormControlLabel,\r\n RadioGroup,\r\n Radio,\r\n TextField,\r\n Button,\r\n Select,\r\n MenuItem,\r\n InputLabel,\r\n Icon,\r\n Tooltip,\r\n IconButton,\r\n} from \"@material-ui/core\";\r\nimport TextFieldForTable from \"../material-components/Misc/TextFieldForTable\";\r\nimport CircularLoading from \"../loading/CircularLoading\";\r\nimport MaterialTable, { Column } from \"@material-table/core\";\r\nimport NumericalTextField from \"../material-components/Misc/NumericalTextField\";\r\n\r\n// actions\r\nimport { setHasUnsavedLayoutChanges } from \"../../actions/flowActions\";\r\nimport { requestExternalServiceLayoutData, requestAddExternalServiceLayout } from \"../../actions/flowControlActions\";\r\nimport { showModal } from \"../../actions/actionCreators\";\r\n\r\n// reducers\r\nimport { getSelectedFlowPermissions } from \"../../reducers/flowItems\";\r\nimport {\r\n getFlowExternalServiceForSelectedFlowItem,\r\n getFlowItemExternalServiceDefeaultFields,\r\n getClientFieldAliasForSelectedFlowItem,\r\n} from \"../../reducers/flowExternalServices\";\r\nimport { getFlowExternalServiceParametersForSelectedFlowItem } from \"../../reducers/flowExternalServiceParameters\";\r\nimport { getFlowExternalServiceHardcodesForSelectedFlowItem } from \"../../reducers/flowExternalServiceHardcodes\";\r\n\r\n// types\r\nimport { IAppState } from \"../../types/stores/index\";\r\nimport { IExternalServiceLayout, IExternalServiceLayoutField } from \"../../types/stores/externalServiceLayoutData\";\r\nimport { IEnrichmentField } from \"../../types/stores/umbrellaData\";\r\nimport { getServiceFieldData, getItemParameterValue } from \"../../helpers/flowControlHelper\";\r\nimport { ISaveExternalServiceLayoutData } from \"../../types/stores/flowControlData\";\r\nimport { FlowExternalServiceHardcode } from \"../../types/stores/flowTypes\";\r\nimport { qualifiers } from \"../../helpers/constants\";\r\n\r\nexport enum LayoutTypes {\r\n Input = 1,\r\n Output = 2,\r\n}\r\n\r\n// layout empty value\r\nexport const defaultLayout: IExternalServiceLayout = {\r\n LayoutId: 0,\r\n CompanyId: 0,\r\n LayoutType: LayoutTypes.Input,\r\n RelativePositions: true,\r\n Delimiter: null,\r\n RecordSize: 0,\r\n LayoutName: \"\",\r\n Qualifier: \"\",\r\n};\r\n\r\ninterface IProps {\r\n layoutType?: number;\r\n flowExternalServiceId?: number;\r\n onCancel?: () => void;\r\n isTable?: boolean;\r\n}\r\nconst LayoutBuilder: React.FC = ({ layoutType, flowExternalServiceId, onCancel, isTable }: IProps) => {\r\n const dispatch = useDispatch();\r\n\r\n // State\r\n const [localLayout, setLocalLayout] = useState({\r\n ...defaultLayout,\r\n LayoutType: layoutType ? layoutType : LayoutTypes.Input,\r\n });\r\n const [layoutFields, setLayoutFields] = useState>([]);\r\n const [addFieldType, setAddFieldType] = useState(\"standard\");\r\n const [selectedServiceField, setSelectedServiceField] = useState(0);\r\n const [selectedCustomField, setSelectedCustomField] = useState(-1);\r\n const [addFieldName, setAddFieldName] = useState(\"\");\r\n const [customFieldName, setCustomFieldName] = useState(\"\");\r\n const [addFieldAlias, setAddFieldAlias] = useState(\"\");\r\n const [addPosition, setAddPosition] = useState(\"\");\r\n const [addLength, setAddLength] = useState(\"\");\r\n const [addEncryption, setAddEncryption] = useState(\"NONE\");\r\n const [fieldErrors, setFieldErrors] = useState>([]);\r\n const [layoutErrors, setLayoutErrors] = useState>([]);\r\n const [currentServiceFields, setCurrentServiceFields] = useState>([]);\r\n const [localDelimiter, setLocalDelimiter] = useState(\"\");\r\n const [customDelimiter, setCustomDelimiter] = useState(\"\");\r\n const [isfieldNameEmpty, setIsfieldNameEmpty] = useState(false);\r\n const [addHardcodes, setAddHardcodes] = useState(\"false\");\r\n const [hardcodePlacement, setHardcodePlacement] = useState(\"\");\r\n const [selectedQualifier, setSelectedQualifier] = useState(\"\");\r\n\r\n // Redux\r\n const companyId = useSelector((state: IAppState) => state.session.companyId!);\r\n const layouts = useSelector((state: IAppState) => state.externalServiceLayoutData.externalServiceLayouts);\r\n const serviceFields = useSelector((state: IAppState) => state.externalServiceLayoutData.externalServiceFields);\r\n const layoutIsSaving = useSelector((state: IAppState) => state.externalServiceLayoutData.layoutIsSaving);\r\n const layoutIsSavingAsNew = useSelector((state: IAppState) => state.externalServiceLayoutData.layoutIsSavingAsNew);\r\n const selectedLayout = useSelector((state: IAppState) => state.externalServiceLayoutData.selectedLayout);\r\n const allLayoutFields = useSelector(\r\n (state: IAppState) => state.externalServiceLayoutData.externalServiceLayoutFields\r\n );\r\n const flowPermissions = useSelector((state: IAppState) => getSelectedFlowPermissions(state));\r\n const awsIsDownloading = useSelector((state: IAppState) => state.aws.isDownloading);\r\n const importedLayoutFields = useSelector((state: IAppState) => state.externalServiceLayoutData.importedFields);\r\n const importedLayoutIsFixed = useSelector((state: IAppState) => state.externalServiceLayoutData.importedIsFixed);\r\n const flowExternalService = useSelector((state: IAppState) => getFlowExternalServiceForSelectedFlowItem(state));\r\n const flowExternalServiceParameters = useSelector((state: IAppState) =>\r\n getFlowExternalServiceParametersForSelectedFlowItem(state)\r\n );\r\n const externalServiceParameters = useSelector(\r\n (state: IAppState) => state.flowControlData.externalServiceParameters\r\n );\r\n const currentFieldsUE = useSelector((state: IAppState) => state.umbrellaData.currEnrichmentFields || []);\r\n const selectedFieldsUE = useSelector((state: IAppState) => state.umbrellaData.selectedFieldsItem || []);\r\n const fileDelimiters = useSelector((state: IAppState) => state.session.fileDelimiters);\r\n const listExternalParameters = useSelector((state: IAppState) => state.flowControlData.externalParameters);\r\n const externalServices = useSelector((state: IAppState) => state.flowControlData.externalServices);\r\n const flowExternalServiceHardcodes = useSelector>(state =>\r\n getFlowExternalServiceHardcodesForSelectedFlowItem(state)\r\n );\r\n const itemServiceDefaultFields = useSelector((state: IAppState) => getFlowItemExternalServiceDefeaultFields(state));\r\n const itemClientFieldAlias = useSelector((state: IAppState) => getClientFieldAliasForSelectedFlowItem(state));\r\n const layout = layouts.find(l => l.LayoutId == selectedLayout);\r\n\r\n //getting Internal Matchback id\r\n const idInternalMatchback = listExternalParameters.find(\r\n parameter => parameter.ParameterName == \"matchback_type\"\r\n )?.ParameterId;\r\n\r\n //getting Internal Table Name Length id\r\n const idTableNameLength = listExternalParameters.find(\r\n parameter => parameter.ParameterName == \"tableCodeOverride\"\r\n )?.ParameterId;\r\n\r\n //getting Internal Matchback chechbox value\r\n const internalMatchback = flowExternalServiceParameters.filter(\r\n parameter => parameter.ParameterId == idInternalMatchback\r\n )[0];\r\n\r\n //getting flow extenal service parameters for Table Name Length\r\n const flowExternalServiceParameterTableName = flowExternalServiceParameters.filter(\r\n parameter => parameter.ParameterId == idTableNameLength\r\n );\r\n\r\n //getting Internal Matchback value\r\n const tableNameLength = flowExternalServiceParameterTableName[0];\r\n\r\n //getting Field Name Type value\r\n const enabledFeatures = useSelector((state: IAppState) => state.session.enabledFeatures || []);\r\n const altUEFieldName =\r\n enabledFeatures.includes(\"flow-control-field-name-type\") &&\r\n getItemParameterValue(listExternalParameters, flowExternalServiceParameters, \"output_field_names\") == \"true\";\r\n\r\n // Features\r\n const fcQualifiersFeature = enabledFeatures.includes(\"flow-control-qualifiers\");\r\n\r\n useEffect(() => {\r\n if (!layouts || !serviceFields) {\r\n dispatch(requestExternalServiceLayoutData(companyId));\r\n }\r\n }, [dispatch, layouts, serviceFields, companyId]);\r\n\r\n useEffect(() => {\r\n if (layout) {\r\n setLocalLayout({ ...layout });\r\n const layoutFields = [...allLayoutFields.filter(f => f.LayoutId == layout.LayoutId)];\r\n setFinalLayoutFields(layoutFields);\r\n } else {\r\n setLocalLayout({\r\n ...defaultLayout,\r\n LayoutType: typeof layoutType != \"undefined\" && layoutType != 0 ? layoutType : LayoutTypes.Input,\r\n });\r\n }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [layout, allLayoutFields, layoutType]);\r\n\r\n useEffect(() => {\r\n if (importedLayoutFields && importedLayoutFields.length > 0) {\r\n setLocalLayout({\r\n ...defaultLayout,\r\n LayoutType: typeof layoutType != \"undefined\" && layoutType != 0 ? layoutType : LayoutTypes.Input,\r\n RelativePositions: !importedLayoutIsFixed,\r\n });\r\n const importFields = importedLayoutFields.map(x => x.Field);\r\n setFinalLayoutFields(importFields);\r\n }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [importedLayoutFields, layoutType, importedLayoutIsFixed]);\r\n\r\n // Set LocalDelimiter and CustomDelimiter\r\n useEffect(() => {\r\n if (localLayout.RelativePositions && localLayout.Delimiter != null && localLayout.Delimiter.length > 0) {\r\n if (fileDelimiters.filter(x => x.Delimiter == localLayout.Delimiter).length > 0) {\r\n setLocalDelimiter(localLayout.Delimiter);\r\n setCustomDelimiter(\"\");\r\n } else {\r\n setLocalDelimiter(\"custom\");\r\n setCustomDelimiter(localLayout.Delimiter);\r\n }\r\n } else {\r\n setLocalDelimiter(isTable ? \",\" : \"\");\r\n }\r\n }, [localLayout, fileDelimiters, isTable]);\r\n\r\n // Set SelectedQualifier\r\n useEffect(() => {\r\n if (localLayout.RelativePositions) {\r\n setSelectedQualifier(layout ? layout.Qualifier : localLayout.Qualifier ?? \"\");\r\n }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [localLayout.RelativePositions]);\r\n\r\n const loadAllUEFields = useCallback(\r\n (fields: Array) => {\r\n const serviceFields = getServiceFieldData(\r\n externalServiceParameters,\r\n flowExternalServiceParameters,\r\n fields,\r\n [],\r\n externalServices,\r\n tableNameLength?.Value\r\n );\r\n setCurrentServiceFields(serviceFields);\r\n },\r\n [externalServiceParameters, flowExternalServiceParameters, externalServices, tableNameLength?.Value]\r\n );\r\n\r\n useEffect(() => {\r\n if (layoutType == 2 && currentFieldsUE.length > 0) {\r\n loadAllUEFields(currentFieldsUE);\r\n }\r\n }, [loadAllUEFields, layoutType, currentFieldsUE]);\r\n\r\n const addServiceFields = () => {\r\n let position = 0;\r\n let length = 50;\r\n let fields = [...layoutFields];\r\n const fieldsCurrentLayout = [...allLayoutFields.filter(f => f.LayoutId == layout?.LayoutId)];\r\n if (layoutFields?.length === 0 && fieldsCurrentLayout?.length > 0) {\r\n const sortedFields = getSortedFields(fieldsCurrentLayout);\r\n fields = [...sortedFields.map(x => ({ ...x, id: x.LayoutFieldId }))]; //all positions\r\n const pos = fields.map(x => x.FieldPosition);\r\n position = Math.max(...pos);\r\n }\r\n if (internalMatchback?.Value == \"true\") {\r\n const serviceFields = getServiceFieldData(\r\n externalServiceParameters,\r\n flowExternalServiceParameters,\r\n selectedFieldsUE,\r\n itemServiceDefaultFields,\r\n externalServices,\r\n tableNameLength?.Value\r\n );\r\n serviceFields.forEach(field => {\r\n if (\r\n !fieldsCurrentLayout.find(currField => currField.FieldName == field.FieldName) &&\r\n !fieldsCurrentLayout.find(currField => currField.FieldName == field.FieldId.toString())\r\n ) {\r\n position++;\r\n const name =\r\n field.FieldId == 0\r\n ? field.FieldName\r\n : field.FieldId.toString() != field.FieldName && !isNaN(parseInt(field.FieldName))\r\n ? field.FieldName\r\n : field.FieldId.toString();\r\n let newField: IExternalServiceLayoutField = {\r\n // setting the new id as a negative value so that fields can be updated\r\n id: isNaN(parseInt(field.FieldName))\r\n ? field.FieldId == 0\r\n ? position\r\n : field.FieldId\r\n : parseInt(field.FieldName),\r\n LayoutFieldId: isNaN(parseInt(field.FieldName)) ? field.FieldId : parseInt(field.FieldName),\r\n LayoutId: 0,\r\n ServiceFieldId: 0,\r\n FieldName: name,\r\n ShortName:\r\n field.FieldId == 0\r\n ? field.FieldName.substring(0, 19)\r\n : field.FieldId.toString().substring(0, 19),\r\n FieldPosition: position,\r\n FieldLength: field.Length == 0 ? length : field.Length,\r\n EncryptionType: \"NONE\",\r\n IsHardcode: false,\r\n FieldAlias: findClientAlias(0, field.FieldId == 0 ? field.FieldName : field.FieldId.toString()),\r\n AlternateName: null,\r\n };\r\n fields.push(newField);\r\n }\r\n });\r\n\r\n setCurrentServiceFields(serviceFields);\r\n setLayoutFields(fields);\r\n setAddFieldType(\"standard\");\r\n setSelectedServiceField(0);\r\n setAddFieldName(\"\");\r\n setAddPosition(\"\");\r\n setAddLength(\"\");\r\n setAddEncryption(\"NONE\");\r\n setFieldErrors([]);\r\n }\r\n };\r\n\r\n useEffect(() => {\r\n if (layoutType == 2 && !layout) {\r\n addServiceFields();\r\n }\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [layoutType, layout]);\r\n\r\n const setDelimitedFixedValue = (value: string) => {\r\n const newLocalLayout = layout ? { ...layout } : { ...localLayout };\r\n if (value == \"delimited\") {\r\n newLocalLayout.RecordSize = 0;\r\n } else {\r\n newLocalLayout.Delimiter = \"\";\r\n }\r\n newLocalLayout.RelativePositions = value == \"delimited\";\r\n\r\n // Reset Alias on Fixed Output layouts\r\n if (newLocalLayout.LayoutType == LayoutTypes.Output && !newLocalLayout.RelativePositions) {\r\n let newFields = [...layoutFields];\r\n newFields.map(x => (x.FieldAlias = null));\r\n setLayoutFields(newFields);\r\n }\r\n\r\n setLocalLayout(newLocalLayout);\r\n };\r\n\r\n const handleEncryptionChanged = value => setAddEncryption(value);\r\n\r\n const resetAddField = () => {\r\n setAddFieldType(\"standard\");\r\n setSelectedServiceField(0);\r\n setAddFieldName(\"\");\r\n setAddPosition(\"\");\r\n setAddLength(\"\");\r\n setAddEncryption(\"NONE\");\r\n setFieldErrors([]);\r\n setAddFieldAlias(\"\");\r\n };\r\n\r\n const resetPage = () => {\r\n setLocalLayout({ ...defaultLayout });\r\n setLayoutFields([]);\r\n resetAddField();\r\n dispatch(setHasUnsavedLayoutChanges(false));\r\n };\r\n\r\n const FieldPositionLabel = localLayout.RelativePositions ? \"Column Number\" : \"Position\";\r\n\r\n const addField = () => {\r\n // Validate\r\n let errors: string[] = [];\r\n const findPos = layoutFields.filter(x => x.FieldPosition == parseInt(addPosition));\r\n if (findPos.length > 0) {\r\n errors.push(`${FieldPositionLabel} ${addPosition} already assigned in the layout.`);\r\n }\r\n const aliasError = fieldAliasError(addFieldAlias);\r\n if (aliasError && aliasError != \"\") {\r\n errors.push(aliasError);\r\n }\r\n if (errors.length > 0) {\r\n setFieldErrors(errors);\r\n return;\r\n }\r\n\r\n // min value from layout fields LayoutFieldId\r\n const min = layoutFields.length > 0 ? Math.min(...layoutFields.map(f => f.LayoutFieldId)) : 0;\r\n const newField: IExternalServiceLayoutField = {\r\n // setting the new id as a negative value so that fields can be updated\r\n id: min - 1,\r\n LayoutFieldId: min - 1,\r\n LayoutId: 0,\r\n ServiceFieldId: addFieldType == \"standard\" ? selectedServiceField : 0,\r\n FieldName:\r\n addFieldType == \"custom\"\r\n ? customFieldName == \"\"\r\n ? addFieldName.trimStart().trimEnd()\r\n : customFieldName\r\n : null,\r\n ShortName:\r\n addFieldType == \"custom\"\r\n ? customFieldName == \"\"\r\n ? addFieldName.trimStart().trimEnd()\r\n : customFieldName\r\n : null,\r\n FieldPosition: parseInt(addPosition),\r\n FieldLength: parseInt(addLength),\r\n EncryptionType: addEncryption,\r\n IsHardcode: false,\r\n FieldAlias: addFieldAlias.trim() == \"\" ? null : addFieldAlias,\r\n AlternateName: null,\r\n };\r\n\r\n let fields = [...layoutFields];\r\n fields.push(newField);\r\n setLayoutFields(fields);\r\n\r\n setAddFieldType(\"standard\");\r\n setSelectedServiceField(0);\r\n setSelectedCustomField(-1);\r\n setAddFieldName(\"\");\r\n setAddFieldAlias(\"\");\r\n setAddPosition(\"\");\r\n setAddLength(\"\");\r\n setAddEncryption(\"NONE\");\r\n setFieldErrors([]);\r\n };\r\n\r\n const addFieldDisabled = () => {\r\n if (addFieldType == \"standard\" && selectedServiceField == 0) {\r\n return true;\r\n }\r\n if (addFieldType == \"custom\" && addFieldName.trim() == \"\" && customFieldName == \"\") {\r\n return true;\r\n }\r\n if (addPosition == \"\") {\r\n return true;\r\n }\r\n if (addLength == \"\") {\r\n return true;\r\n }\r\n return false;\r\n };\r\n\r\n const renderFieldsDropdown = (\r\n showLabel: boolean,\r\n selectedFieldId: number,\r\n onChange: (newValue: number) => void\r\n ) => {\r\n const usedFields = layoutFields.map(f => f.ServiceFieldId);\r\n\r\n const options = serviceFields.map(x => (\r\n \r\n {x.DisplayName}\r\n \r\n ));\r\n\r\n return (\r\n \r\n {showLabel && Field}\r\n onChange(parseInt(e.target.value as string))}\r\n value={selectedFieldId > 0 ? selectedFieldId : \"\"}\r\n style={{ minWidth: \"275px\" }}\r\n fullWidth\r\n >\r\n {options}\r\n \r\n \r\n );\r\n };\r\n\r\n const handleOnChangeCustomDropdown = (newValue: number) => {\r\n const inputLayoutId = flowExternalService.InputLayoutId;\r\n const customFields = allLayoutFields.filter(\r\n field => field.LayoutId == inputLayoutId && field.FieldName != null\r\n );\r\n const customField = customFields.find(field => field.FieldPosition == newValue);\r\n //all positions\r\n const pos = layoutFields.map(x => x.FieldPosition);\r\n\r\n let newLength = customField?.FieldLength || 0;\r\n let newName = customField?.FieldName || \"\";\r\n let newPos = Math.max(...pos) + 1;\r\n\r\n setSelectedCustomField(newValue);\r\n setCustomFieldName(newName);\r\n setAddLength(newLength.toString());\r\n setAddPosition(newPos.toString());\r\n setAddFieldName(\"\");\r\n setAddFieldAlias(findClientAlias(0, newName) ?? \"\");\r\n };\r\n\r\n const handleOnchangeCustomField = (newValue: string) => {\r\n setAddFieldName(newValue);\r\n setSelectedCustomField(-1);\r\n setCustomFieldName(\"\");\r\n setAddLength(\"\");\r\n setAddPosition(\"\");\r\n setAddFieldAlias(findClientAlias(0, newValue) ?? \"\");\r\n };\r\n\r\n const renderCustomFieldsDropdown = (selectedFieldId: number) => {\r\n const usedFields = layoutFields.map(f => f.FieldName);\r\n const inputLayoutId = flowExternalService.InputLayoutId;\r\n let customFields = allLayoutFields.filter(field => field.LayoutId == inputLayoutId && field.FieldName != null);\r\n let customOptions;\r\n\r\n if (customFields.length > 0) {\r\n customOptions = customFields.map(x => (\r\n \r\n {x.FieldName}\r\n \r\n ));\r\n } else {\r\n customOptions = (\r\n \r\n {\"No Custom Fields to Display\"}\r\n \r\n );\r\n }\r\n\r\n return (\r\n \r\n Custom Field\r\n handleOnChangeCustomDropdown(parseInt(e.target.value as string))}\r\n value={selectedFieldId}\r\n style={{ width: \"250px\" }}\r\n fullWidth\r\n >\r\n {customOptions}\r\n \r\n \r\n );\r\n };\r\n\r\n const validateFields = (): Array => {\r\n const errors: Array = [];\r\n let customFieldsWithEmptyName = false;\r\n let fieldsWithRepeatedPositions = false;\r\n let fieldsWithNoLength = false;\r\n\r\n for (const field of layoutFields) {\r\n if (!customFieldsWithEmptyName && field.LayoutFieldId == 0 && field.FieldName == \"\") {\r\n customFieldsWithEmptyName = true;\r\n }\r\n\r\n if (\r\n !fieldsWithRepeatedPositions &&\r\n layoutFields.filter(\r\n x => x.LayoutFieldId != field.LayoutFieldId && x.FieldPosition == field.FieldPosition\r\n ).length > 0\r\n ) {\r\n fieldsWithRepeatedPositions = true;\r\n }\r\n\r\n if (!fieldsWithNoLength && !field.FieldLength) {\r\n fieldsWithNoLength = true;\r\n }\r\n }\r\n\r\n if (customFieldsWithEmptyName) {\r\n errors.push(\"Field name is required for custom fields.\");\r\n }\r\n\r\n if (fieldsWithRepeatedPositions) {\r\n errors.push(\"There are fields with duplicated column numbers.\");\r\n }\r\n\r\n if (fieldsWithNoLength) {\r\n errors.push(\"Field length is required for all fields.\");\r\n }\r\n return errors;\r\n };\r\n\r\n const save = (isSaveAsNew: boolean = false) => {\r\n // Validate\r\n let errors: string[] = [];\r\n\r\n if (localLayout.LayoutName == \"\") {\r\n errors.push(\"Layout name is required.\");\r\n }\r\n\r\n if (\r\n layouts.some(\r\n e =>\r\n e.LayoutName.trim() === localLayout.LayoutName.trim() &&\r\n (isSaveAsNew || e.LayoutId != localLayout.LayoutId)\r\n )\r\n ) {\r\n errors.push(\"Layout name already exists.\");\r\n }\r\n\r\n const layout = { ...localLayout };\r\n\r\n // Check Delimiter\r\n if (localLayout.RelativePositions && (localDelimiter == null || localDelimiter.trim() == \"\")) {\r\n errors.push(\"Delimiter is required.\");\r\n } else if (localDelimiter == \"custom\" && (customDelimiter == null || customDelimiter.trim() == \"\")) {\r\n errors.push(\"Custom delimiter is required.\");\r\n } else {\r\n layout.Delimiter = localDelimiter == \"custom\" ? customDelimiter : localDelimiter;\r\n }\r\n\r\n // Check Qualifier\r\n if (fcQualifiersFeature && layout.RelativePositions) {\r\n layout.Qualifier = selectedQualifier;\r\n } else {\r\n layout.Qualifier = \"\";\r\n }\r\n\r\n setLocalLayout(layout);\r\n\r\n // Check Record Size\r\n if (!localLayout.RelativePositions && (localLayout.RecordSize == null || localLayout.RecordSize <= 0)) {\r\n errors.push(\"Record size is required.\");\r\n }\r\n\r\n // Check Fields Count\r\n if (layoutFields.length == 0) {\r\n errors.push(\"At least 1 Field is required.\");\r\n }\r\n\r\n const validateFieldPosition = layoutFields.find(lay => !lay.FieldPosition || lay.FieldPosition < 1);\r\n\r\n if (validateFieldPosition) {\r\n errors.push(`${FieldPositionLabel} cannot be set to 0.`);\r\n }\r\n\r\n if (isfieldNameEmpty) {\r\n errors.push(\"There are fields with blank name.\");\r\n }\r\n\r\n if (isTable && layoutType == LayoutTypes.Input) {\r\n const columns = flowExternalService.InputTableColumns.filter(x => x.Include).length;\r\n if (layoutFields.length != columns) {\r\n errors.push(\"Number of layout fields must match included table columns.\");\r\n }\r\n }\r\n\r\n const fieldErrors = validateFields();\r\n if (fieldErrors.length > 0) {\r\n errors = errors.concat(fieldErrors);\r\n }\r\n\r\n const aliasErrors = allAliasErrors();\r\n if (aliasErrors.length > 0) {\r\n errors = errors.concat(aliasErrors);\r\n }\r\n\r\n if (errors.length > 0) {\r\n setLayoutErrors(errors);\r\n return;\r\n } else {\r\n setLayoutErrors([]);\r\n }\r\n\r\n // Save\r\n if (layout.CompanyId == 0) {\r\n layout.CompanyId = companyId;\r\n }\r\n\r\n if (isSaveAsNew) layout.LayoutId = 0;\r\n const saveLayout: ISaveExternalServiceLayoutData = {\r\n Layout: layout,\r\n Fields: finalizeOutputLayout(layoutFields),\r\n flowExternalServiceId,\r\n };\r\n dispatch(requestAddExternalServiceLayout(saveLayout, isSaveAsNew, flowExternalService.WFClientCode || \"\"));\r\n resetPage();\r\n };\r\n\r\n const fieldAliasError = (alias: string): string => {\r\n if (!enabledFeatures.includes(\"flow-control-custom-headers\") || !alias || alias == \"\") {\r\n return \"\";\r\n }\r\n\r\n let invalid = false;\r\n const defaultMessage =\r\n \"Invalid Alias '__ALIAS_NAME__': can only contain AlphaNumerics, (_) Underscore, cannot start with a Number or contain the Custom Delimiter\";\r\n\r\n // // alphanumeric and _ only\r\n if (alias.match(/[^a-zA-Z0-9_]/g)) {\r\n invalid = true;\r\n }\r\n // cannot use custom delimiter\r\n if (localDelimiter == \"custom\" && customDelimiter != \"\" && alias.includes(customDelimiter)) {\r\n invalid = true;\r\n }\r\n // cannot start with a number\r\n if (alias.match(/^\\d/)) {\r\n invalid = true;\r\n }\r\n\r\n if (invalid) {\r\n return defaultMessage.replace(\"__ALIAS_NAME__\", alias);\r\n } else {\r\n return \"\";\r\n }\r\n };\r\n\r\n const allAliasErrors = (): Array => {\r\n let errors: Array = [];\r\n layoutFields.forEach(field => {\r\n const error = fieldAliasError(field.FieldAlias ?? \"\");\r\n if (error != \"\") {\r\n errors.push(error);\r\n }\r\n });\r\n return errors;\r\n };\r\n\r\n const handleFieldIdChanged = (layoutFieldId: number, newValue: number) => {\r\n const newLayoutFields = [...layoutFields];\r\n const field = newLayoutFields.find(x => x.LayoutFieldId == layoutFieldId);\r\n if (field) {\r\n field.ServiceFieldId = newValue;\r\n }\r\n setLayoutFields(newLayoutFields);\r\n };\r\n\r\n const handleAddFieldIdChanged = (newValue: number) => {\r\n setSelectedServiceField(newValue);\r\n setAddFieldAlias(findClientAlias(newValue, \"\") ?? \"\");\r\n };\r\n\r\n const handleCustomFieldNameChange = (layoutFieldId: number, newValue: string) => {\r\n const newLayoutFields = [...layoutFields];\r\n const field = newLayoutFields.find(x => x.LayoutFieldId == layoutFieldId);\r\n if (field) {\r\n field.FieldName = newValue.trim();\r\n field.ShortName = newValue.trim();\r\n }\r\n if (field!.FieldName != \"\") {\r\n setLayoutFields(newLayoutFields);\r\n setIsfieldNameEmpty(false);\r\n } else {\r\n setIsfieldNameEmpty(true);\r\n }\r\n };\r\n\r\n const determineLayoutFieldName = (fieldName: string, display: boolean, forceAlternateName: boolean = false) => {\r\n const itemDefaultFields = itemServiceDefaultFields.map(x => x.FieldName);\r\n if (!isNaN(parseInt(fieldName || \"\"))) {\r\n fieldName =\r\n (altUEFieldName || forceAlternateName) && !itemDefaultFields.includes(fieldName || \"\")\r\n ? currentServiceFields.find(x => x.FieldId == parseInt(fieldName || \"\"))?.AlternateName ||\r\n currentFieldsUE.find(y => y.FieldId == parseInt(fieldName || \"\"))?.AlternateName ||\r\n selectedFieldsUE.find(y => y.FieldId == parseInt(fieldName || \"\"))?.AlternateName ||\r\n \"\"\r\n : display\r\n ? currentServiceFields.find(x => x.FieldId == parseInt(fieldName || \"\"))?.FieldName ||\r\n currentFieldsUE.find(y => y.FieldId == parseInt(fieldName || \"\"))?.FieldName ||\r\n selectedFieldsUE.find(y => y.FieldId == parseInt(fieldName || \"\"))?.FieldName ||\r\n \"\"\r\n : fieldName;\r\n }\r\n\r\n return fieldName;\r\n };\r\n\r\n const finalizeOutputLayout = (layoutFields: Array) => {\r\n let finalFields = [...layoutFields];\r\n finalFields.forEach(field => {\r\n field.AlternateName = determineLayoutFieldName(field.FieldName || \"\", false, true);\r\n });\r\n return finalFields;\r\n };\r\n\r\n const renderFieldName = (row: IExternalServiceLayoutField) => {\r\n let fieldName = row.FieldName;\r\n let fieldShortName = row.ShortName;\r\n if (!isNaN(parseInt(fieldName || \"\"))) {\r\n let name = determineLayoutFieldName(fieldName || \"\", true);\r\n\r\n let shortName =\r\n currentServiceFields.find(x => x.FieldId == parseInt(fieldShortName || \"\"))?.FieldName ||\r\n currentFieldsUE.find(y => y.FieldId == parseInt(fieldShortName || \"\"))?.FieldName ||\r\n selectedFieldsUE.find(y => y.FieldId == parseInt(fieldShortName || \"\"))?.FieldName ||\r\n \"\";\r\n fieldName = name != \"\" ? name : shortName != \"\" ? \"Table Name \" + shortName : row.FieldName;\r\n }\r\n if (row.ServiceFieldId > 0) {\r\n return renderFieldsDropdown(false, row.ServiceFieldId, val => handleFieldIdChanged(row.LayoutFieldId, val));\r\n } else {\r\n return (\r\n handleCustomFieldNameChange(row.LayoutFieldId, e.target.value)}\r\n required\r\n error={fieldName!.trim() === \"\"}\r\n helperText={fieldName!.trim() === \"\" ? \"Field name is required\" : \"\"}\r\n onWheel={event => {\r\n const eventTarget = event.target as HTMLInputElement;\r\n return eventTarget.blur();\r\n }}\r\n fullWidth\r\n />\r\n );\r\n }\r\n };\r\n\r\n const renderEditableNumberField = (row: IExternalServiceLayoutField, property: string) => (\r\n {\r\n const newValue = e.target.value;\r\n const index = layoutFields.findIndex(x => x.id == row.id);\r\n let newLayoutFields = [...layoutFields];\r\n\r\n if (newValue == \"\" || parseInt(newValue) < 0) {\r\n newLayoutFields[index][property] = 0;\r\n } else if (isNaN(parseInt(newValue))) {\r\n newLayoutFields[index][property] = layoutFields[index][property];\r\n } else if (parseInt(newValue) > 9999) {\r\n newLayoutFields[index][property] = 9999;\r\n } else {\r\n newLayoutFields[index][property] = parseInt(newValue);\r\n }\r\n\r\n setLayoutFields(newLayoutFields);\r\n }}\r\n onWheel={event => {\r\n const eventTarget = event.target as HTMLInputElement;\r\n return eventTarget.blur();\r\n }}\r\n />\r\n );\r\n\r\n const handleFieldEncryptionChanged = (layoutFieldId: number, newValue: string) => {\r\n const newLayoutFields = [...layoutFields];\r\n const field = newLayoutFields.find(x => x.LayoutFieldId == layoutFieldId);\r\n if (field) {\r\n field.EncryptionType = newValue;\r\n }\r\n setLayoutFields(newLayoutFields);\r\n };\r\n\r\n const renderFieldEncryption = (row: IExternalServiceLayoutField) => (\r\n handleFieldEncryptionChanged(row.LayoutFieldId, e.target.value as string)}\r\n value={row.EncryptionType}\r\n fullWidth\r\n >\r\n \r\n None\r\n \r\n \r\n Scramble\r\n \r\n \r\n Standard\r\n \r\n \r\n );\r\n\r\n const handleDeleteField = (id: number) => {\r\n let newLayoutFields = [...layoutFields];\r\n newLayoutFields = newLayoutFields.filter(f => f.id != id);\r\n setLayoutFields(newLayoutFields);\r\n };\r\n\r\n const handleAddFieldType = (type: string) => {\r\n if (type == \"standard\") {\r\n setSelectedCustomField(-1);\r\n setCustomFieldName(\"\");\r\n setAddFieldName(\"\");\r\n } else {\r\n setSelectedServiceField(0);\r\n }\r\n setAddFieldAlias(\"\");\r\n setAddFieldType(type);\r\n };\r\n\r\n const renderDeleteOption = (row: IExternalServiceLayoutField) => (\r\n \r\n handleDeleteField(row.id)}>\r\n \r\n delete\r\n \r\n \r\n \r\n );\r\n\r\n const renderQualifierOption = () => {\r\n const options = qualifiers?.map((qualifier, index) => (\r\n \r\n {qualifier.label}\r\n \r\n ));\r\n\r\n return (\r\n \r\n \r\n Field Qualifier - {localDelimiter}VALUE{localDelimiter}\r\n \r\n setSelectedQualifier(e.target.value as string)}\r\n disabled={!localLayout?.RelativePositions}\r\n style={{ width: \"175px\" }}\r\n >\r\n {options}\r\n \r\n \r\n );\r\n };\r\n\r\n const renderDelimiterOption = () => {\r\n const options = fileDelimiters.map(x => (\r\n \r\n {x.DelimiterName}\r\n \r\n ));\r\n options.push(\r\n \r\n Custom Delimiter\r\n \r\n );\r\n\r\n return (\r\n \r\n Delimiter\r\n {\r\n setLocalDelimiter(e.target.value as string);\r\n setCustomDelimiter(\"\");\r\n }}\r\n value={localDelimiter}\r\n style={{ width: \"175px\" }}\r\n disabled={isTable}\r\n >\r\n {options}\r\n \r\n \r\n );\r\n };\r\n\r\n const nameSearch = (term: string, row: IExternalServiceLayoutField) => {\r\n let fieldName = \"\";\r\n if (row.ServiceFieldId > 0) {\r\n const field = serviceFields.find(f => f.ServiceFieldId == row.ServiceFieldId);\r\n if (field) {\r\n fieldName = `${field.DisplayName} ${field.FieldName}`;\r\n }\r\n } else {\r\n fieldName = `${row.FieldName} ${row.ShortName}`;\r\n }\r\n\r\n return fieldName.toLowerCase().indexOf(term.toLowerCase()) >= 0;\r\n };\r\n\r\n const updateFieldAlias = (id: number, alias: string) => {\r\n let updateFields = [...layoutFields];\r\n const index = updateFields.findIndex(x => x.id == id);\r\n if (index >= 0) {\r\n updateFields[index].FieldAlias = alias;\r\n setLayoutFields(updateFields);\r\n }\r\n };\r\n\r\n const findClientAlias = (serviceFieldId: number, textName: string): string | null => {\r\n if (!enabledFeatures.includes(\"flow-control-custom-headers\")) {\r\n return null;\r\n }\r\n\r\n let alias: string | null = null;\r\n if (serviceFieldId > 0) {\r\n const standard = itemClientFieldAlias.filter(x => x.ServiceFieldId == serviceFieldId);\r\n if (standard.length == 1) {\r\n alias = standard[0].FieldAlias;\r\n }\r\n }\r\n if (textName.trim().length > 0) {\r\n const custom = itemClientFieldAlias.filter(x => x.FieldName == textName.trim());\r\n if (custom.length == 1) {\r\n alias = custom[0].FieldAlias;\r\n }\r\n }\r\n return alias;\r\n };\r\n\r\n const renderFieldAliasAdd = () => (\r\n
\r\n setAddFieldAlias(e.target.value)}\r\n style={{ width: \"275px\" }}\r\n onWheel={event => {\r\n const eventTarget = event.target as HTMLInputElement;\r\n return eventTarget.blur();\r\n }}\r\n />\r\n
\r\n );\r\n\r\n const renderFieldAliasEdit = (row: IExternalServiceLayoutField) => (\r\n
\r\n updateFieldAlias(row.id, e.target.value)}\r\n style={{ width: \"275px\" }}\r\n disabled={row.IsHardcode}\r\n onWheel={event => {\r\n const eventTarget = event.target as HTMLInputElement;\r\n return eventTarget.blur();\r\n }}\r\n />\r\n
\r\n );\r\n\r\n const getColumns: Array> = [\r\n {\r\n title: \"Field Name\",\r\n render: renderFieldName,\r\n customFilterAndSearch: nameSearch,\r\n },\r\n {\r\n title: \"Alias\",\r\n field: \"FieldAlias\",\r\n render: renderFieldAliasEdit,\r\n hidden:\r\n !localLayout.RelativePositions ||\r\n localLayout.LayoutType == LayoutTypes.Input ||\r\n !enabledFeatures.includes(\"flow-control-custom-headers\"),\r\n },\r\n {\r\n title: FieldPositionLabel,\r\n field: \"FieldPosition\",\r\n render: rowData => renderEditableNumberField(rowData, \"FieldPosition\"),\r\n },\r\n {\r\n title: \"Field Length\",\r\n field: \"FieldLength\",\r\n render: rowData => renderEditableNumberField(rowData, \"FieldLength\"),\r\n },\r\n {\r\n title: \"Encryption\",\r\n field: \"EncryptionType\",\r\n render: renderFieldEncryption,\r\n },\r\n {\r\n title: \"Actions\",\r\n render: renderDeleteOption,\r\n },\r\n ];\r\n\r\n const getSortedFields = (layoutFields: Array) =>\r\n layoutFields.sort((a, b) => a.FieldPosition - b.FieldPosition);\r\n\r\n const setFinalLayoutFields = (layoutFields: Array) => {\r\n layoutFields.forEach(x => {\r\n x.FieldAlias = findClientAlias(x.ServiceFieldId, x.FieldName ?? \"\");\r\n });\r\n const sortedFields = getSortedFields(layoutFields);\r\n setLayoutFields(sortedFields.map(x => ({ ...x, id: x.LayoutFieldId })));\r\n };\r\n\r\n const handleAddHardcodes = (value: string) => {\r\n setAddHardcodes(value);\r\n setHardcodePlacement(value == \"false\" ? \"\" : hardcodePlacement);\r\n updateHardcodesInLayout(value == \"true\", \"\");\r\n };\r\n\r\n const handleLayoutPlacement = (value: string) => {\r\n setHardcodePlacement(value);\r\n updateHardcodesInLayout(addHardcodes == \"true\", value);\r\n };\r\n\r\n const updateHardcodesInLayout = (add: boolean, placement: string) => {\r\n let newLayoutFields = [...layoutFields];\r\n\r\n // Remove harcodes\r\n newLayoutFields = newLayoutFields.filter(x => !x.IsHardcode);\r\n\r\n // Add\r\n if (add && placement != \"\") {\r\n if (placement == \"start\") {\r\n let startFields: Array = [];\r\n flowExternalServiceHardcodes.forEach(value => {\r\n startFields.push({\r\n id: 0,\r\n LayoutFieldId: 0,\r\n LayoutId: localLayout.LayoutId,\r\n ServiceFieldId: 0,\r\n FieldName: value.HardcodeName,\r\n ShortName: value.HardcodeName.substring(0, 19),\r\n FieldPosition: 0,\r\n FieldLength: value.HardcodeValue.length,\r\n EncryptionType: \"NONE\",\r\n IsHardcode: true,\r\n FieldAlias: null,\r\n AlternateName: null,\r\n });\r\n });\r\n\r\n newLayoutFields = startFields.concat(newLayoutFields);\r\n } else if (placement == \"end\") {\r\n flowExternalServiceHardcodes.forEach(value => {\r\n newLayoutFields.push({\r\n id: 0,\r\n LayoutFieldId: 0,\r\n LayoutId: localLayout.LayoutId,\r\n ServiceFieldId: 0,\r\n FieldName: value.HardcodeName,\r\n ShortName: value.HardcodeName.substring(0, 19),\r\n FieldPosition: 0,\r\n FieldLength: value.HardcodeValue.length,\r\n EncryptionType: \"NONE\",\r\n IsHardcode: true,\r\n FieldAlias: null,\r\n AlternateName: null,\r\n });\r\n });\r\n }\r\n }\r\n\r\n // Update Positions\r\n let position = 1;\r\n let prevLength = 0;\r\n newLayoutFields.forEach((field, index) => {\r\n if (localLayout.RelativePositions) {\r\n field.FieldPosition = index + 1;\r\n } else {\r\n field.FieldPosition = position += prevLength;\r\n prevLength = field.FieldLength;\r\n }\r\n });\r\n\r\n setLayoutFields(newLayoutFields);\r\n };\r\n\r\n return (\r\n \r\n Layout Builder\r\n
\r\n {layoutErrors.length > 0 && (\r\n \r\n {layoutErrors.map((err, index) => (\r\n
\r\n error_outline\r\n {err}\r\n
\r\n ))}\r\n
\r\n )}\r\n {(layoutIsSaving || layoutIsSavingAsNew) && (\r\n \r\n )}\r\n
\r\n

Layout Details

\r\n
\r\n \r\n setLocalLayout({ ...localLayout, LayoutType: parseInt(e.target.value) })}\r\n >\r\n
\r\n }\r\n label=\"Input\"\r\n disabled={layoutType ? true : false}\r\n />\r\n }\r\n label=\"Output\"\r\n disabled={layoutType ? true : false}\r\n />\r\n
\r\n \r\n
\r\n save}\r\n onClick={() => save(false)}\r\n disabled={layoutIsSaving || layoutIsSavingAsNew}\r\n >\r\n
\r\n {layoutIsSaving ? : null}\r\n {layoutIsSaving ? \"Saving...\" : \"Save Layout\"}\r\n
\r\n \r\n {selectedLayout > 0 ? (\r\n save}\r\n onClick={() => save(true)}\r\n disabled={layoutIsSaving || layoutIsSavingAsNew}\r\n >\r\n
\r\n {layoutIsSavingAsNew ? (\r\n \r\n ) : null}\r\n {layoutIsSavingAsNew ? \"Saving...\" : \"Save Layout As New\"}\r\n
\r\n \r\n ) : (\r\n input}\r\n onClick={() => dispatch(showModal(\"FLOW_CONTROL_LAYOUT_IMPORT\"))}\r\n disabled={!flowPermissions.canEdit}\r\n >\r\n Import\r\n \r\n )}\r\n\r\n cancel}\r\n onClick={() => (onCancel ? onCancel() : null)}\r\n disabled={!flowPermissions.canEdit || awsIsDownloading}\r\n >\r\n Cancel\r\n \r\n
\r\n
\r\n setLocalLayout({ ...localLayout, LayoutName: e.target.value })}\r\n onWheel={event => {\r\n const eventTarget = event.target as HTMLInputElement;\r\n return eventTarget.blur();\r\n }}\r\n />\r\n
\r\n
\r\n
\r\n \r\n setDelimitedFixedValue(e.target.value)}\r\n >\r\n
\r\n }\r\n label=\"Delimited\"\r\n disabled={isTable}\r\n />\r\n }\r\n label=\"Fixed Width\"\r\n disabled={isTable}\r\n />\r\n
\r\n \r\n
\r\n
\r\n {localLayout.RelativePositions ? (\r\n
\r\n
\r\n {renderDelimiterOption()}\r\n {localDelimiter == \"custom\" && (\r\n setCustomDelimiter(e.target.value)}\r\n style={{ width: \"100px\" }}\r\n onWheel={event => {\r\n const eventTarget = event.target as HTMLInputElement;\r\n return eventTarget.blur();\r\n }}\r\n />\r\n )}\r\n
\r\n {fcQualifiersFeature ? renderQualifierOption() : null}\r\n
\r\n ) : (\r\n
\r\n {\r\n const newValue = e.target.value;\r\n let newLocalLayout = { ...localLayout };\r\n\r\n if (newValue != \"\" && isNaN(parseInt(newValue))) {\r\n newLocalLayout[\"RecordSize\"] = localLayout[\"RecordSize\"];\r\n } else {\r\n newLocalLayout[\"RecordSize\"] = parseInt(newValue);\r\n }\r\n\r\n setLocalLayout(newLocalLayout);\r\n }}\r\n onBlur={e => {\r\n const newValue = e.target.value;\r\n let newLocalLayout = { ...localLayout };\r\n\r\n if (newValue === \"\" || parseInt(newValue) < 0) {\r\n newLocalLayout[\"RecordSize\"] = 0;\r\n } else if (isNaN(parseInt(newValue))) {\r\n newLocalLayout[\"RecordSize\"] = localLayout[\"RecordSize\"];\r\n } else if (parseInt(newValue) > 9999) {\r\n newLocalLayout[\"RecordSize\"] = 9999;\r\n } else {\r\n newLocalLayout[\"RecordSize\"] = parseInt(newValue);\r\n }\r\n\r\n setLocalLayout(newLocalLayout);\r\n }}\r\n onWheel={event => {\r\n const eventTarget = event.target as HTMLInputElement;\r\n return eventTarget.blur();\r\n }}\r\n />\r\n
\r\n )}\r\n
\r\n
\r\n {!layout && layoutType == LayoutTypes.Output && flowExternalServiceHardcodes.length > 0 && (\r\n
\r\n

Add Constants

\r\n
\r\n
\r\n \r\n handleAddHardcodes(e.target.value)}\r\n >\r\n
\r\n }\r\n label=\"Yes\"\r\n />\r\n }\r\n label=\"No\"\r\n />\r\n
\r\n \r\n
\r\n
\r\n {addHardcodes === \"true\" && (\r\n
\r\n \r\n Layout Placement\r\n handleLayoutPlacement(e.target.value as string)}\r\n value={hardcodePlacement}\r\n style={{ width: \"175px\" }}\r\n >\r\n \r\n Beginning\r\n \r\n \r\n End\r\n \r\n \r\n \r\n
\r\n )}\r\n
\r\n
\r\n )}\r\n
\r\n

Add Field

\r\n
\r\n
\r\n \r\n handleAddFieldType(e.target.value)}\r\n >\r\n
\r\n }\r\n label=\"Standard\"\r\n />\r\n }\r\n label=\"Custom\"\r\n />\r\n
\r\n \r\n
\r\n
\r\n
\r\n add}\r\n onClick={addField}\r\n disabled={addFieldDisabled()}\r\n >\r\n Add Field\r\n \r\n
\r\n
\r\n
\r\n {addFieldType == \"standard\" ? (\r\n
\r\n {renderFieldsDropdown(true, selectedServiceField, val => handleAddFieldIdChanged(val))}\r\n
\r\n ) : (\r\n
\r\n handleOnchangeCustomField(e.target.value)}\r\n style={{ width: \"275px\" }}\r\n required\r\n error={addFieldName.trim() === \"\"}\r\n helperText={\r\n addFieldName.trim() === \"\"\r\n ? localLayout.LayoutType == 1\r\n ? \"Field name is required\"\r\n : \"Select column name from drop down\"\r\n : \"\"\r\n }\r\n onWheel={event => {\r\n const eventTarget = event.target as HTMLInputElement;\r\n return eventTarget.blur();\r\n }}\r\n />\r\n {layoutType == 2 ? renderCustomFieldsDropdown(selectedCustomField) : null}\r\n
\r\n )}\r\n {localLayout.RelativePositions &&\r\n localLayout.LayoutType == LayoutTypes.Output &&\r\n enabledFeatures.includes(\"flow-control-custom-headers\") &&\r\n renderFieldAliasAdd()}\r\n
\r\n {\r\n let value = parseInt(e.target.value);\r\n if (value < 0) {\r\n value = 0;\r\n }\r\n setAddPosition(value.toString());\r\n }}\r\n style={{ width: \"150px\" }}\r\n onWheel={event => {\r\n const eventTarget = event.target as HTMLInputElement;\r\n return eventTarget.blur();\r\n }}\r\n />\r\n
\r\n
\r\n {\r\n let value = parseInt(e.target.value);\r\n if (value < 0) {\r\n value = 0;\r\n }\r\n setAddLength(value.toString());\r\n }}\r\n style={{ width: \"100px\" }}\r\n onWheel={event => {\r\n const eventTarget = event.target as HTMLInputElement;\r\n return eventTarget.blur();\r\n }}\r\n />\r\n
\r\n
\r\n \r\n Encryption\r\n handleEncryptionChanged(e.target.value)}\r\n value={addEncryption}\r\n style={{ width: \"150px\" }}\r\n >\r\n \r\n None\r\n \r\n \r\n Scramble\r\n \r\n \r\n Standard\r\n \r\n \r\n \r\n
\r\n
\r\n {fieldErrors.length > 0 && (\r\n \r\n {fieldErrors.map((err, index) => (\r\n
\r\n error_outline\r\n {err}\r\n
\r\n ))}\r\n
\r\n )}\r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n );\r\n};\r\n\r\nexport default LayoutBuilder;\r\n","import React from \"react\";\r\n\r\ntype Props = {\r\n size: string;\r\n saved?: boolean;\r\n color?: string;\r\n};\r\n\r\nconst CircularLoading: React.FC = ({ size, saved, color }: Props) => {\r\n let px = \"30px\";\r\n switch (size) {\r\n case \"large\":\r\n px = \"65px\";\r\n break;\r\n case \"medium\":\r\n px = \"40px\";\r\n break;\r\n case \"small\":\r\n px = \"20px\";\r\n break;\r\n case \"x-small\":\r\n px = \"12px\";\r\n break;\r\n }\r\n\r\n return (\r\n
\r\n
\r\n {!saved && (\r\n \r\n \r\n \r\n )}\r\n
\r\n );\r\n};\r\n\r\nexport default CircularLoading;\r\n","import React, { useRef, useState, useEffect } from \"react\";\r\nimport { TextField, TextFieldProps } from \"@material-ui/core\";\r\n\r\nfunction TextFieldForTable({ ...props }: TextFieldProps): JSX.Element {\r\n let textfieldProps: TextFieldProps = { ...props };\r\n let regex: RegExp;\r\n\r\n const [localValue, setLocalValue] = useState(props.value ? (props.value as string | number) : \"\");\r\n const prevValueRef = useRef(props.value ? (props.value as string | number) : \"\");\r\n\r\n useEffect(() => {\r\n if (props.value != undefined && props.value != prevValueRef.current) {\r\n setLocalValue(props.value as string | number);\r\n prevValueRef.current = props.value as string | number;\r\n }\r\n }, [props.value]);\r\n\r\n const onBlur: React.FocusEventHandler = e => {\r\n const reg = new RegExp(regex);\r\n\r\n if (reg.test(e.target.value)) {\r\n setLocalValue(e.target.value);\r\n\r\n if (props.onBlur) {\r\n props.onBlur(e);\r\n }\r\n } else {\r\n setLocalValue(prevValueRef.current || \"\");\r\n }\r\n };\r\n\r\n const onChange: React.ChangeEventHandler = e => {\r\n const reg = new RegExp(regex);\r\n\r\n if (reg.test(e.target.value)) {\r\n setLocalValue(e.target.value);\r\n\r\n if (props.onChange) {\r\n props.onChange(e);\r\n }\r\n }\r\n };\r\n\r\n textfieldProps.value = localValue;\r\n textfieldProps.onChange = e => onChange(e);\r\n textfieldProps.onBlur = e => onBlur(e);\r\n\r\n return (\r\n // putting type=\"number\" as a prop will add the up/down arrows back\r\n \r\n );\r\n}\r\n\r\nexport default TextFieldForTable;\r\n","import prettyCron from \"prettycron\";\r\nimport { ISchedule } from \"../../../types/stores/schedules\";\r\nimport { ScheduleType } from \"../../../enums/schedules\";\r\n\r\nexport const getSchedulePrettyName = (schedule: ISchedule): string => {\r\n let prettyName = \"\";\r\n\r\n switch (schedule.ScheduleType) {\r\n case ScheduleType.TableRefresh:\r\n prettyName = `Table Refresh`;\r\n break;\r\n case ScheduleType.ExperianAssetRefresh:\r\n prettyName = `Experian Assets Update`;\r\n break;\r\n case ScheduleType.TimeFrequency:\r\n prettyName = getSchedulePrettyNameForTimeFrequency(schedule);\r\n break;\r\n default:\r\n prettyName = prettyCron.toString(schedule.CronString);\r\n break;\r\n }\r\n\r\n if (!schedule.Name.includes(prettyName)) {\r\n prettyName = `${schedule.Name} (${prettyName})`;\r\n }\r\n return prettyName;\r\n};\r\n\r\nexport const getSchedulePrettyNameForTimeFrequency = (schedule: ISchedule): string => {\r\n const { TimeType, TimeCount } = schedule;\r\n if (!TimeType || !TimeCount) {\r\n return \"\";\r\n }\r\n\r\n const typeString = [\"\", \"day\", \"week\", \"month\"][TimeType];\r\n const countString = TimeCount > 1 ? TimeCount : \"\";\r\n\r\n return `Every ${countString} ${typeString}${TimeCount > 1 ? \"s\" : \"\"}`;\r\n};\r\n\r\nexport const hourOptions = Array.from({ length: 24 }, (_, i) => i.toString());\r\n\r\nexport const minuteOptions = Array.from({ length: 60 }, (_, i) => i.toString());\r\n","import React from \"react\";\r\nimport { connect } from \"react-redux\";\r\nimport { bindActionCreators, Dispatch } from \"redux\";\r\nimport * as actionCreators from \"../../actions/actionCreators\";\r\nimport * as fieldTreeActions from \"../../actions/fieldTreeActions\";\r\nimport withFieldDropTarget from \"../../hocs/withFieldDropTarget\";\r\nimport withGenericFieldDropTarget from \"../../hocs/withGenericFieldDropTarget\";\r\nimport { ConnectDropTarget } from \"react-dnd\";\r\nimport { IAppState } from \"../../types/stores/index\";\r\n\r\ninterface Props {\r\n // injected by react-dnd\r\n connectDropTarget?: ConnectDropTarget;\r\n isOver?: boolean;\r\n canDrop?: boolean;\r\n // passed\r\n type: string;\r\n wording: string;\r\n fieldIdChanged: (fieldId: number | string) => void;\r\n isDisabled: boolean;\r\n isGenericQbAdd?: boolean;\r\n // redux\r\n selectedFields?: Array;\r\n pathname?: string;\r\n}\r\n\r\n// Drop Target from react-dnd needs React Component class - maybe we can change when we upgrade react dnd?\r\nclass FieldDropTarget extends React.Component {\r\n render() {\r\n const { connectDropTarget, isOver, type, wording, pathname, isDisabled } = this.props;\r\n\r\n const wordToUse = wording !== null ? wording : type;\r\n\r\n let className = \"hidden-print dnd-target-striped\";\r\n if (isOver) {\r\n className += \" is-over\";\r\n }\r\n\r\n let styles: React.CSSProperties = {\r\n margin: \"0px auto\",\r\n padding: \"10px\",\r\n border: \"1px solid #ccc\",\r\n borderRadius: \"10px\",\r\n width: \"260px\",\r\n textAlign: \"center\",\r\n };\r\n\r\n if (pathname && (pathname.includes(\"/flows\") || pathname.includes(\"restricted-fields\"))) {\r\n styles = {\r\n margin: \"30px auto\",\r\n padding: \"10px\",\r\n border: \"1px solid rgb(204, 204, 204)\",\r\n borderRadius: \"9px\",\r\n width: \"40vw\",\r\n height: \"50px\",\r\n textAlign: \"center\",\r\n };\r\n }\r\n\r\n if (isDisabled) {\r\n styles[\"opacity\"] = 0.4;\r\n }\r\n\r\n styles[\"textTransform\"] = \"capitalize\";\r\n\r\n const element = (\r\n
\r\n Drag and Drop {wordToUse}s Here\r\n
\r\n );\r\n\r\n return isDisabled ? element : connectDropTarget!(element);\r\n }\r\n}\r\n\r\nconst mapStateToProps = (state: IAppState) => ({\r\n // used by FieldDropTarget\r\n pathname: state.router && state.router.location && state.router.location.pathname,\r\n // used in the drop target wrapper for bulk selection\r\n selectedFields: state.selected.selectedFields || [],\r\n});\r\n\r\nconst mapDispatchToProps = (dispatch: Dispatch) =>\r\n bindActionCreators(Object.assign({}, actionCreators, fieldTreeActions), dispatch);\r\n\r\n// This version uses a simple callback to determine behavior, props.onFieldDropped = (fieldId) => ....\r\nlet FieldDropTargetGeneric = withGenericFieldDropTarget(FieldDropTarget);\r\nFieldDropTargetGeneric = connect(mapStateToProps, mapDispatchToProps)(FieldDropTargetGeneric);\r\nexport { FieldDropTargetGeneric };\r\n\r\nlet FieldDropTargetConnect = withFieldDropTarget(FieldDropTarget);\r\nFieldDropTargetConnect = connect(mapStateToProps, mapDispatchToProps)(FieldDropTargetConnect);\r\nexport default FieldDropTargetConnect;\r\n","export enum ScheduleType {\r\n Recurring = 0,\r\n OneTime = 1,\r\n NumberOfOccurrences = 2,\r\n EndDate = 3,\r\n TableRefresh = 4,\r\n ExperianAssetRefresh = 5,\r\n TimeFrequency = 6,\r\n}\r\n\r\nexport enum ScheduleTimeType {\r\n Day = 1,\r\n Week = 2,\r\n Month = 3,\r\n}\r\n","import { notifyError } from \"./actions/notifyActions\";\r\n\r\nconst helpers = {\r\n checkStatus(response) {\r\n if (response.status >= 200 && response.status < 300) {\r\n return response;\r\n }\r\n const error = new Error(response.statusText);\r\n error.response = response;\r\n throw error;\r\n },\r\n toJson(response) {\r\n return response.json();\r\n },\r\n serialize(data) {\r\n return Object.keys(data)\r\n .map(keyName => encodeURIComponent(keyName) + \"=\" + encodeURIComponent(data[keyName]))\r\n .join(\"&\");\r\n },\r\n error(message, error = null, keepDisplayed = false) {\r\n /* eslint-disable no-console */\r\n console.log(message);\r\n top.store.dispatch(notifyError(message, keepDisplayed));\r\n if (error) {\r\n console.log(error);\r\n }\r\n if (top.JL) {\r\n top.JL(\"React\").error(message + \" \" + JSON.stringify(error));\r\n }\r\n\r\n if (error) {\r\n console.log(error);\r\n }\r\n if (top.JL) {\r\n top.JL(\"React\").error(message + \" \" + JSON.stringify(error));\r\n }\r\n },\r\n throwGTMTrigger(eventName, eventCategory, eventAction, eventLabel, eventValue) {\r\n window.dataLayer.push({\r\n event: eventName,\r\n eventProps: {\r\n category: eventCategory,\r\n action: eventAction,\r\n label: eventLabel,\r\n value: eventValue,\r\n },\r\n });\r\n },\r\n errorSilent(message, error = null) {\r\n /* eslint-disable no-console */\r\n console.log(message);\r\n\r\n if (error) {\r\n console.log(error);\r\n }\r\n if (top.JL) {\r\n top.JL(\"React\").error(message + \" \" + JSON.stringify(error));\r\n }\r\n /* eslint-enable no-console */\r\n },\r\n info(message) {\r\n if (top.JL) {\r\n top.JL(\"React\").info(message);\r\n }\r\n },\r\n replaceAll(o, str1, str2, ignore) {\r\n // replaceAll: Using string o, find str1 and replace with str2, optionally ignore case\r\n return o.replace(\r\n new RegExp(str1.replace(/([\\/\\,\\!\\\\\\^\\$\\{\\}\\[\\]\\(\\)\\.\\*\\+\\?\\|\\<\\>\\-\\&])/g, \"\\\\$&\"), ignore ? \"gi\" : \"g\"),\r\n typeof str2 == \"string\" ? str2.replace(/\\$/g, \"$$$$\") : str2\r\n );\r\n },\r\n addDiffDividersToStringDoubleQuoteIsWordBoundary(o, str1, dividerBegin, dividerEnd, ignore) {\r\n if (!o || !str1 || !dividerBegin || !dividerEnd || typeof o != \"string\") {\r\n return o;\r\n }\r\n // using string o, find str1 and place \"divider\" text before and after occurrences, optionally ignore case\r\n // all \" marks will be transformed into \\b\r\n dividerBegin = dividerBegin.replace(/\\$/g, \"$$$$\");\r\n dividerEnd = dividerEnd.replace(/\\$/g, \"$$$$\");\r\n\r\n if (!Array.isArray(str1)) {\r\n str1 = [str1];\r\n }\r\n\r\n const regExpElements = [];\r\n for (const str2 of str1) {\r\n let regExpText = str2.replace(/([\\/\\,\\!\\\\\\^\\$\\{\\}\\[\\]\\(\\)\\.\\*\\+\\?\\|\\<\\>\\-\\&])/g, \"\\\\$&\");\r\n regExpText = regExpText.replace(new RegExp(/\"/, \"g\"), \"\\\\b\");\r\n regExpElements.push(regExpText);\r\n }\r\n const regExpText = \"(\" + regExpElements.join(\"|\") + \")\";\r\n\r\n return o.replace(new RegExp(regExpText, ignore ? \"gi\" : \"g\"), dividerBegin + \"$&\" + dividerEnd);\r\n },\r\n addRequestVerificationToken(object) {\r\n /* This doesn't work. See\r\n http://stackoverflow.com/questions/2906754/how-can-i-supply-an-antiforgerytoken-when-posting-json-data-using-ajax\r\n Not sure I want to add the extension/override to our MVC app yet - what else might it break?\r\n */\r\n if (document.getElementsByName(\"__RequestVerificationToken\").length > 0) {\r\n object.__RequestVerificationToken = document.getElementsByName(\"__RequestVerificationToken\")[0].value;\r\n }\r\n return object;\r\n },\r\n htmlEncode(htmlvalue) {\r\n return htmlvalue.replace(/&/g, \"&\").replace(/>/g, \">\").replace(/\r\n props.match &&\r\n props.match.params &&\r\n props.match.params.selectedFlowItem &&\r\n parseInt(props.match.params.selectedFlowItem, 10);\r\nexport const getSelectedFlowFromRouterProps = props =>\r\n props.match &&\r\n props.match.params &&\r\n props.match.params.selectedFlow &&\r\n parseInt(props.match.params.selectedFlow, 10);\r\n\r\nexport const getSelectedUserFromRouterProps = match =>\r\n match && match.params && match.params.userId && parseInt(match.params.userId, 10);\r\n\r\nexport const fixReactSelectValue = x => (typeof x == \"object\" && x !== null && x.value ? x.value : x);\r\n\r\n// shouldCancelStart - to be used with react-sortable-hoc, allows you to\r\n// click through to