{"version":3,"file":"static/js/main.35b4e52b.chunk.js","sources":["actions/index.ts","middleware/analytics.ts","util/sentry.ts","middleware/api.ts","middleware/architect.ts","middleware/autocomplete.ts","middleware/createableSchemas.ts","resource/duplicate.ts","resource/navbar/duplicator.ts","schemas/setFieldValue.ts","middleware/document.ts","documents/digestEnums.ts","documents/urlBuilder.ts","middleware/documents.ts","middleware/export.ts","middleware/field.ts","middleware/filters.ts","flags.ts","middleware/flags.ts","flags/flags.ts","middleware/i18n.ts","middleware/memberships.ts","middleware/organizations.ts","middleware/session.ts","middleware/pages.ts","middleware/password.ts","middleware/renderer.ts","schemas/parseModules.ts","middleware/schemas.ts","middleware/search.ts","middleware/settings.ts","middleware/sort.ts","middleware/storage.ts","middleware/tags.ts","middleware/translations.ts","middleware/triggers.ts","middleware/ui.ts","middleware/v3Leads.ts","middleware/v3Organizations.ts","util/enums.ts","util/api_errors.ts","actions/document.ts","resource/index.ts","components/TextField/TextField.tsx","util/ci.ts","util/date.ts","util/filters.ts","util/imgix.ts","util/sort.ts","util/theme.ts","util/users.ts","util/v3Orgs.ts","selectors/scope.ts","v3/type/Action.ts","schemas/index.ts","actions/documents.ts","actions/field.ts","actions/location.ts","actions/i18n.ts","types/index.ts","selectors/schema.ts","actions/organization.ts","util/triggers.ts","components/Loading/Loading.tsx","actions/export.ts","actions/tags.ts","actions/search.ts","actions/ui.ts","selectors/V3Organizations.ts","components/FieldMessage/FieldMessage.tsx","actions/autocomplete.ts","selectors/session.ts","actions/sort.ts","selectors/settings.ts","schemas/listableFields.ts","selectors/search.ts","types/Option.ts","actions/pagination.ts","actions/storage.ts","actions/route.ts","components/root.module.scss","reducers/i18n.ts","util/contentConfig.ts","v3/type/Condition.ts","components/root_drk.module.scss","theme/index.ts","components/Select/Select.tsx","lib/formatLocalTime.ts","lib/replaceVariable.ts","lib/replaceVariables.ts","lib/index.ts","selectors/autocomplete.ts","selectors/ui.ts","selectors/document.ts","actions/triggers.ts","util/leads.ts","util/legacy.ts","util/tracking.ts","actions/createableSchemas.ts","actions/flags.ts","actions/memberships.ts","actions/menu.ts","selectors/createableSchemas.ts","selectors/flags.ts","selectors/menu.ts","selectors/schemas.ts","serviceWorker.ts","components/RefreshToast/RefreshToast.tsx","types/Activity.ts","types/API.ts","selectors/i18n.ts","types/Filter.ts","types/Rule.ts","actions/analytics.ts","actions/architect.ts","actions/filters.ts","actions/password.ts","actions/renderer.ts","actions/schema.ts","actions/schemas.ts","actions/session.ts","actions/settings.ts","actions/translations.ts","actions/v3Leads.ts","actions/V3Organizations.ts","components/JSONEditor/JSONEditor.tsx","components/Options/Options.tsx","architect/reorderSection.ts","architect/formatRenderError.ts","v3/type/Trigger.ts","schemas/v3Mocks.ts","v3/context/i18n.tsx","selectors/analytics.ts","selectors/architect.ts","selectors/documents.ts","selectors/filters.ts","selectors/memberships.ts","selectors/organizations.ts","selectors/pages.ts","selectors/pagination.ts","selectors/sort.ts","selectors/storage.ts","selectors/userSettings.ts","selectors/v3Leads.ts","actions/api.ts","i18n lazy /^/.//.*$/ groupOptions: {} namespace object","actions/auth.ts","components/Login/LoginError.tsx","components/Login/RootLogin.tsx","components/Login/ForgotPassword.tsx","components/Login/ResetPassword.tsx","request/fetchPlatformSettings.ts","components/OneClickAction/OneClickAction.tsx","components/AppRoot/AppRoot.tsx","index.tsx","components/Button/Button.tsx","selectors/triggers.ts","selectors/location.ts","selectors/contentConfig.ts","config.ts","util/localStorage.ts"],"sourceRoot":"","sourcesContent":["export * from './analytics'\nexport * from './anyAppAction'\nexport * from './api'\nexport * from './architect'\nexport * from './autocomplete'\nexport * from './createableSchemas'\nexport * from './document'\nexport * from './documents'\nexport * from './export'\nexport * from './field'\nexport * from './filters'\nexport * from './flags'\nexport * from './i18n'\nexport * from './location'\nexport * from './memberships'\nexport * from './menu'\nexport * from './organization'\nexport * from './pagination'\nexport * from './password'\nexport * from './renderer'\nexport * from './schema'\nexport * from './schemas'\nexport * from './search'\nexport * from './session'\nexport * from './settings'\nexport * from './sort'\nexport * from './storage'\nexport * from './tags'\nexport * from './translations'\nexport * from './triggers'\nexport * from './ui'\nexport * from './v3Leads'\nexport * from './V3Organizations'\n","import { ANALYTICS, API_ERROR, API_SUCCESS, apiRequest, GET_ANALYTICS, setAnalytics, setAnalyticsError, setDocuments, setSchema } from '../actions'\nimport { Schema } from '../schemas'\nimport { analyticsTitleSelector, focusedOrgSelector } from '../selectors'\nimport { Middleware } from '../store'\nimport { V2Response } from '../types'\n\nexport const analyticsMiddleware: Middleware = ({ dispatch, getState }) => (next) => (action) => {\n next(action)\n\n const state = getState()\n const org = focusedOrgSelector(state)\n\n switch (action.type) {\n case GET_ANALYTICS:\n dispatch(\n apiRequest({\n url: `/organizations/${org?.trunkID}/${org?.ID}/analytics/${action.dashboardType}`,\n method: 'GET',\n feature: ANALYTICS,\n })\n )\n break\n\n case `${ANALYTICS} ${API_SUCCESS}`:\n // set totalCount to -1 so the AppBar Title doesn't display a count\n dispatch(\n setDocuments(({\n totalCount: -1,\n } as unknown) as V2Response)\n )\n // the AppBar needs a title for analytics\n dispatch(\n setSchema({\n label: analyticsTitleSelector(state),\n } as Schema)\n )\n dispatch(setAnalytics(action.payload))\n break\n\n case `${ANALYTICS} ${API_ERROR}`:\n dispatch(setAnalyticsError(action.payload))\n break\n }\n}\n","import { Scope } from '@sentry/react'\nimport { getAxiosErrResponse, getPCErrorField } from './api_errors'\nimport { FieldActionType } from '../actions'\n\nconst alwaysSkipFeatures: string[] = [\n // This type is called every time a user sets a field value, it is\n // too noisy to care about (actual validation problems on submit are caught by\n // the Documents type(s)).\n FieldActionType.VALIDATE,\n]\n\n// certain request types are not worth reporting to Sentry.\n// This is meant to be expanded upon later as we find more noisy errors.\nexport const shouldSendSentry = (error: unknown, reqType: string): boolean => {\n return !alwaysSkipFeatures.includes(reqType)\n}\n\ntype SentryGoof = {\n code: string\n message: string\n inputs?: Record<string, string>\n fault?: boolean\n}\n\n// setSentryErrorData gathers relevant data from an Axios error and adds it\n// to a provided Sentry Scope.\nexport const setSentryErrorData = (scope: Scope, error: unknown) => {\n const resp = getAxiosErrResponse(error)\n if (resp) {\n scope.setContext('request-status', {\n status: resp.status,\n statusText: resp.statusText,\n })\n scope.setTag('statusCode', resp.status)\n }\n\n const code = getPCErrorField(error, 'code')\n const message = getPCErrorField(error, 'message')\n if (!code && !message) {\n return\n }\n const ctx: SentryGoof = {\n code: code,\n message: message,\n }\n const inputs = getPCErrorField(error, 'inputs')\n if (inputs) {\n ctx.inputs = inputs\n }\n const fault = getPCErrorField(error, 'fault')\n if (fault) {\n ctx.fault = fault\n }\n scope.setContext('error', ctx)\n}\n","import axios, { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios'\nimport { API_REQUEST, apiError, apiSuccess, hideLoader, showLoader } from '../actions'\nimport config from '../config'\nimport { authHeaderSelector } from '../selectors'\nimport { Middleware } from '../store'\nimport * as Sentry from '@sentry/react'\nimport { setSentryErrorData, shouldSendSentry } from '../util/sentry'\n\nconst API = config.api\nconst cancel: any = {}\n\nexport type RequestConfig = AxiosRequestConfig & {\n payload?: any\n type: string\n}\n\nexport const doRequest = async <T>(config: RequestConfig): Promise<AxiosResponse<T> | undefined> => {\n const { headers, method, payload, params, responseType, type, url, validateStatus } = config\n\n if (!url) {\n return Promise.reject('invalid url')\n }\n\n if (cancel[type]) {\n cancel[type](`${type} cancelled (url: ${url})`)\n }\n\n const reqConfig: AxiosRequestConfig = {\n method,\n data: payload || 'boolean' === typeof payload || payload === '' ? JSON.stringify(payload) : null,\n headers,\n params,\n responseType,\n cancelToken: new axios.CancelToken(function (c: any) {\n cancel[type] = c\n }),\n }\n\n if (url.indexOf('http') === 0) {\n reqConfig.url = url\n } else {\n reqConfig.url = API + url\n }\n\n if (validateStatus) {\n reqConfig.validateStatus = validateStatus\n }\n\n return axios(reqConfig)\n .then((response) => {\n cancel[type] = null\n return response\n })\n .catch((error: AxiosError) => {\n cancel[type] = null\n // Returning an undefined response for cancellations to break the\n // Promise chain - calling functions must be ready to handle an undefined\n // response.\n // For this app, a cancellation is almost always fine, so there is\n // no need to continue the chain or report on errors.\n // This may be confusing and likely worth a refactor given that\n // Axios updated their cancellation handlings away from CancelTokens.\n if (axios.isCancel(error)) {\n return undefined\n }\n\n if (shouldSendSentry(error, config.type)) {\n Sentry.withScope(function (scope) {\n setSentryErrorData(scope, error)\n scope.setTag('type', config.type)\n scope.setContext('request', {\n url: reqConfig.url,\n method: method,\n })\n Sentry.captureException(error)\n })\n }\n\n console.error('API ERROR: ', error)\n throw error\n })\n}\n\nexport const apiMiddleware: Middleware = ({ dispatch, getState }) => (next) => (action) => {\n next(action)\n\n if (action.type.includes(API_REQUEST)) {\n const { feature, resource } = action.meta\n\n dispatch(showLoader(feature))\n\n doRequest({\n ...action.meta,\n headers: authHeaderSelector(getState(), action?.meta?.scope, action?.meta?.asOwnerOverride),\n payload: action.payload,\n type: action.type,\n })\n .then((response) => {\n if (!response) {\n return\n }\n if (401 === response.status) {\n dispatch(apiError(response.data, feature))\n } else if (response.status > 299) {\n dispatch(apiError(response.data, feature))\n dispatch(hideLoader(feature))\n } else {\n dispatch(apiSuccess(response.data, feature, resource, response.headers))\n dispatch(hideLoader(feature))\n }\n })\n .catch((error: AxiosError) => {\n if (error.response && error.response.data) {\n dispatch(apiError(error.response.data, feature))\n dispatch(hideLoader(feature))\n } else {\n dispatch(apiError(error.response, feature))\n dispatch(hideLoader(feature))\n }\n })\n }\n}\n","import _ from 'lodash'\nimport { LocationState } from 'redux-first-router'\nimport {\n apiRequest,\n API_SUCCESS,\n ArchitectActionType,\n getComponents,\n getPages,\n getSite,\n hideLoader,\n rendererRequest,\n RENDERER_ERROR,\n RENDERER_SUCCESS,\n renderPage,\n setComponents,\n setForm,\n setHtml,\n setPage,\n setPages,\n setSite,\n showLoader,\n} from '../actions'\nimport { formatRenderError } from '../architect'\nimport { architectPageSelector, sessionReadySelector, siteSelector } from '../selectors'\nimport { Middleware } from '../store'\nimport { Component, Page } from '../types'\n\nexport const architectMiddleware: Middleware = ({ dispatch, getState }) => (next) => (action) => {\n next(action)\n\n const state = getState()\n const site = siteSelector(state)\n switch (action.type) {\n // GET PAGES\n case ArchitectActionType.GET_PAGES:\n if (sessionReadySelector(state)) {\n dispatch(getSite(action.payload))\n dispatch(\n rendererRequest({\n url: '/pages',\n method: 'GET',\n feature: ArchitectActionType.GET_PAGES,\n params: {\n siteID: action.payload,\n },\n })\n )\n } else {\n setTimeout(() => {\n dispatch(getPages(action.payload))\n }, 250)\n }\n break\n\n case `${ArchitectActionType.GET_PAGES} ${RENDERER_SUCCESS}`:\n dispatch(setPages(action.payload))\n break\n\n // SITE\n case ArchitectActionType.GET_SITE:\n dispatch(\n apiRequest({\n url: `/sites/${action.payload}`,\n method: 'GET',\n feature: ArchitectActionType.GET_SITE,\n })\n )\n break\n\n case `${ArchitectActionType.GET_SITE} ${API_SUCCESS}`:\n dispatch(setSite(action.payload.data))\n dispatch(getComponents())\n break\n\n // SET PAGES\n case ArchitectActionType.SET_PAGES: // Load Home page when architect loads initial root page\n const pages: Page[] = action.payload\n const currentPage: Page = architectPageSelector(getState())\n const location: LocationState = getState().location\n const currentRouterLocationPageID = location.payload?.pageID ?? null\n\n if (pages.length > 1) {\n if (!currentPage.ID && currentRouterLocationPageID === null) dispatch(setPage(pages[0].ID))\n if (currentPage.ID && currentRouterLocationPageID === null) break // prevents unnecessary actions being fired.\n if (currentPage.ID !== currentRouterLocationPageID && currentRouterLocationPageID !== null) dispatch(setPage(currentRouterLocationPageID))\n }\n break\n\n // SET PAGE\n case ArchitectActionType.SET_PAGE:\n dispatch(renderPage())\n break\n\n // RENDER PAGE\n case ArchitectActionType.RENDER_PAGE:\n const matchSiteID = window.location.search.match(/dataSiteID=([^&]+)/),\n siteID = matchSiteID && matchSiteID.length > 1 ? matchSiteID[1] : undefined\n dispatch(showLoader(ArchitectActionType.RENDER_PAGE))\n dispatch(\n rendererRequest({\n url: `/pages/${architectPageSelector(state).ID}/render`,\n method: 'GET',\n feature: ArchitectActionType.RENDER_PAGE,\n params: {\n siteID,\n },\n })\n )\n break\n\n case `${ArchitectActionType.RENDER_PAGE} ${RENDERER_SUCCESS}`:\n dispatch(setHtml(action.payload.html))\n dispatch(hideLoader(ArchitectActionType.RENDER_PAGE))\n break\n\n case `${ArchitectActionType.RENDER_PAGE} ${RENDERER_ERROR}`:\n dispatch(setHtml(formatRenderError(action.payload)))\n dispatch(hideLoader(ArchitectActionType.RENDER_PAGE))\n break\n\n // FORMS\n case ArchitectActionType.GET_FORM:\n const page = architectPageSelector(state)\n const url = action.payload.url ?? `/pages/${page.ID}/settings`\n dispatch(\n rendererRequest({\n url,\n method: 'GET',\n feature: ArchitectActionType.GET_FORM,\n })\n )\n break\n\n case `${ArchitectActionType.GET_FORM} ${RENDERER_SUCCESS}`:\n dispatch(setForm(action.payload.form))\n break\n\n case ArchitectActionType.SUBMIT_FORM:\n dispatch(showLoader(ArchitectActionType.SUBMIT_FORM))\n dispatch(\n rendererRequest({\n url: action.payload.url,\n method: action.payload.method,\n body: action.payload.data,\n feature: ArchitectActionType.SUBMIT_FORM,\n })\n )\n break\n\n case `${ArchitectActionType.SUBMIT_FORM} ${RENDERER_SUCCESS}`:\n dispatch(getPages(site.ID))\n dispatch(renderPage())\n dispatch(setForm(''))\n dispatch(hideLoader(ArchitectActionType.SUBMIT_FORM))\n break\n\n // SECTIONS\n case ArchitectActionType.REORDER_SECTION:\n dispatch(\n rendererRequest({\n url: `/pages/${action.payload.pageID}/sections/${action.payload.sectionID}/reorder/${action.payload.index}`,\n method: 'PUT',\n feature: ArchitectActionType.REORDER_SECTION,\n })\n )\n break\n\n case `${ArchitectActionType.REORDER_SECTION} ${RENDERER_SUCCESS}`:\n dispatch(renderPage())\n break\n\n case ArchitectActionType.ADD_SECTION:\n dispatch(\n rendererRequest({\n url: `/pages/${action.payload.pageID}/sections/new`,\n method: 'POST',\n body: {\n index: action.payload.index,\n },\n feature: ArchitectActionType.ADD_SECTION,\n })\n )\n break\n\n case `${ArchitectActionType.ADD_SECTION} ${RENDERER_SUCCESS}`:\n dispatch(getPages(site.ID))\n break\n\n case ArchitectActionType.DELETE_SECTION:\n dispatch(\n rendererRequest({\n url: `/pages/${action.payload.pageID}/sections/${action.payload.sectionID}`,\n method: 'DELETE',\n feature: ArchitectActionType.DELETE_SECTION,\n })\n )\n break\n\n case `${ArchitectActionType.DELETE_SECTION} ${RENDERER_SUCCESS}`:\n dispatch(getPages(site.ID))\n break\n\n case `${ArchitectActionType.DELETE_SECTION} ${RENDERER_ERROR}`:\n dispatch(getPages(site.ID))\n break\n\n // COMPONENTS\n case ArchitectActionType.GET_COMPONENTS:\n dispatch(\n rendererRequest({\n url: '/components',\n method: 'GET',\n feature: ArchitectActionType.GET_COMPONENTS,\n params: {\n trunkID: site.trunkID,\n },\n })\n )\n break\n\n case `${ArchitectActionType.GET_COMPONENTS} ${RENDERER_SUCCESS}`:\n const components = _.chain(action.payload.categories)\n .values()\n .flatten()\n .uniqBy((c: Component) => c.HID)\n .sortBy((c: Component) => c.name)\n .value()\n\n dispatch(setComponents(components))\n break\n\n case ArchitectActionType.PUBLISH_PAGE:\n dispatch(showLoader(ArchitectActionType.PUBLISH_PAGE))\n dispatch(\n rendererRequest({\n url: `/pages/${action.payload}/publish`,\n method: 'PUT',\n feature: ArchitectActionType.PUBLISH_PAGE,\n })\n )\n break\n\n case `${ArchitectActionType.PUBLISH_PAGE} ${RENDERER_SUCCESS}`:\n dispatch(hideLoader(ArchitectActionType.PUBLISH_PAGE))\n break\n }\n}\n","import { apiRequest, AutocompleteActionType, setAssignments, setAutoComplete } from '../actions'\nimport { wipDocumentSelector } from '../selectors'\nimport { Middleware } from '../store'\nimport { Schema } from '../schemas'\nimport { Option, OptionType, Organization, ReferenceFieldValueDoc } from '../types'\n\nexport const autocompleteMiddleware: Middleware = ({ dispatch, getState }) => (next) => (action) => {\n next(action)\n\n switch (action.type) {\n case AutocompleteActionType.GET_AUTOCOMPLETE: {\n const { field } = action.payload\n const { resource, textField } = field.autoComplete!\n const { trunkID, organizationID, value } = action.payload.params\n const url = '/autocomplete'\n const doc = wipDocumentSelector(getState())\n dispatch(\n apiRequest({\n url,\n method: 'GET',\n feature: AutocompleteActionType.GET_AUTOCOMPLETE,\n params: {\n resource,\n trunkID,\n organizationID,\n match: textField,\n prefix: value,\n ...(doc && doc.locale && doc.locale.length\n ? {\n locale: doc.locale,\n }\n : {}),\n },\n })\n )\n break\n }\n\n case AutocompleteActionType.GET_AUTOCOMPLETE_SUCCESS: {\n const state = getState()\n const field = state.autocomplete.referenceField\n if (!field) {\n break\n }\n\n const options: Option[] = []\n if (field.autoComplete?.resource && field.autoComplete.resource === 'organizations') {\n const payload = action.payload as Organization[]\n payload.forEach((opt) => {\n options.push({\n type: OptionType.Organization,\n label: opt.name,\n secondaryLabel: `${opt.trunkOrganizationName !== opt.name ? opt.trunkOrganizationName : ''} ${opt.type}`,\n value: opt,\n })\n })\n } else {\n const payload = action.payload as Schema[]\n payload.forEach((opt) => {\n const labelKey = field && field.autoComplete && field.autoComplete.textField\n const label = labelKey ? opt[labelKey as keyof Schema] : ''\n options.push({\n type: OptionType.ReferenceField,\n label: label,\n value: (opt as unknown) as ReferenceFieldValueDoc,\n })\n })\n }\n dispatch(setAutoComplete(options))\n break\n }\n\n case AutocompleteActionType.GET_ASSIGNMENTS:\n dispatch(\n apiRequest({\n url: `/assignments?resource=${action.payload.resource}&resourceID=${action.payload.documentID}&prefix=${action.payload.value}`,\n method: 'GET',\n feature: AutocompleteActionType.GET_ASSIGNMENTS,\n })\n )\n break\n\n case AutocompleteActionType.GET_ASSIGNMENTS_SUCCESS:\n dispatch(setAssignments(action.payload))\n break\n }\n}\n","import { API_SUCCESS, apiRequest, C_SCHEMAS, GET_C_SCHEMAS, setCreateableSchemas } from '../actions'\nimport { AppState, Middleware } from '../store'\n\nexport const createableSchemasMiddleware: Middleware = ({ dispatch, getState }) => (next) => (action) => {\n next(action)\n\n switch (action.type) {\n case GET_C_SCHEMAS:\n const state: AppState = getState()\n const org = state.session.organization\n dispatch(\n apiRequest({\n url: `/organizations/${org.trunkID}/${org.ID}/${action.payload}/add`,\n method: 'GET',\n feature: C_SCHEMAS,\n })\n )\n break\n\n case `${C_SCHEMAS} ${API_SUCCESS}`:\n dispatch(setCreateableSchemas(action.payload.resources))\n break\n }\n}\n","import { cloneDeep as clone, find } from 'lodash'\nimport { DuplicableResource, hasExternalID, hasSlug, hasStatus, Resource } from '.'\nimport { Schema } from '../schemas'\nimport { duplicator as navbars } from './navbar/duplicator'\n\nexport type DuplicableSchema = Schema & {\n isDuplicable: true\n}\n\nexport type Duplicator<T> = (source: T, schema: DuplicableSchema) => T\n\n// defaultDuplicator can ideally handle the majority of consistent\n// resource type duplication logic, for outliers define customDuplicators\n// see /resource/navbar/duplicator for an implementation example\nconst defaultDuplicator: Duplicator<DuplicableResource> = (source, schema) => {\n const dupe = clone<DuplicableResource>(source)\n dupe.duplicatedFromID = source.ID\n dupe.duplicatedFromLocaleID = source.localeID\n dupe.ID = ''\n if (hasStatus(dupe)) {\n const status = find(schema.fields, (field) => 'status' === field.key)\n if (status) {\n dupe.status = status.defaultValue\n }\n }\n if (hasExternalID(dupe)) {\n dupe.externalID = ''\n }\n if (hasSlug(dupe)) {\n dupe.slug = ''\n }\n dupe.localeID = undefined\n delete dupe.audit\n return dupe\n}\n\ntype Duplicators = {\n [k: string]: Duplicator<any>\n}\n\n// customDuplicators is a registry for more specialized\n// duplicator funcs by resource name\nconst customDuplicators: Duplicators = {\n navbars,\n}\n\n// duplicateResource returns a duplicated resource\n// with ID, status etc modifications\nexport const duplicateResource = (document: any, schema: Schema): DuplicableResource => {\n if (!isDuplicableSchema(schema)) {\n throw new Error(`resource is not duplicable: ${schema.resource}`)\n }\n const customResourceDuplicator = customDuplicators[schema.resource]\n if (!customResourceDuplicator) {\n return defaultDuplicator(document, schema)\n }\n return customResourceDuplicator(document, schema)\n}\n\nfunction isDuplicableSchema(schema: Schema): schema is DuplicableSchema {\n return schema.isDuplicable\n}\n\nexport const duplicateWithLocaleID = (source: Resource, schema: Schema): Resource => {\n const dupe = defaultDuplicator(source, schema as DuplicableSchema)\n\n dupe.duplicatedFromID = undefined\n dupe.duplicatedFromLocaleID = undefined\n\n dupe.localeID = source.localeID\n\n return dupe\n}\n","import { cloneDeep as clone } from 'lodash'\nimport { Duplicator } from '../duplicate'\nimport { Navbar } from './model'\n\nexport const duplicator: Duplicator<Navbar> = (source, _schema) => {\n const dupe = clone<Navbar>(source)\n dupe.duplicatedFromID = source.ID\n dupe.duplicatedFromLocaleID = source.localeID\n dupe.ID = ''\n dupe.locale = undefined\n dupe.localeID = undefined\n delete dupe.audit\n return dupe\n}\n","import { cloneDeep, get as getPath, set as setPath } from 'lodash'\nimport { allPass, compose, curry, dropLast, lensPath, merge, pathOr, propOr, reduce, set, view } from 'ramda'\nimport { Field } from '.'\n\nconst notIn = (list: any) => (presentationKey: any) => {\n // if the key has a falsey value, then it's not in the \"blocked\" list\n if (!presentationKey) return true\n if (!Array.isArray(list)) return true\n return (list || []).indexOf(presentationKey) < 0\n}\n\nconst isMultiSetField = allPass([\n compose((v: any) => v.length, pathOr('', ['autoComplete', 'match'])),\n compose(notIn(['reference', 'references']), propOr('', 'presentation')),\n])\n\n// $FlowFixMe\nconst setFieldValue = curry((path: Array<any>, fieldSchema: Field, value: any, doc: any) => {\n // some fields require that their siblings be set with a new value (autocomplete fields)\n if (isMultiSetField(fieldSchema) && path[0] !== 'tagIDs') {\n // the parent path needs to be used so that we're setting the siblings of the field being edited\n // and not the children of the edited field.\n const parentPath = dropLast(1, path)\n const mapInstructions = fieldSchema?.autoComplete?.set ?? []\n // get the 'old' value (from 'doc')\n const oldDoc: any = view(lensPath(parentPath), doc)\n // get the \"new\" values from the \"value\" parameter and the \"from\" attribute in the \"mapInstructions\"\n const mappedFields = reduce(\n (acc: any, curr: any) => {\n acc[curr.to] = value[curr.from]\n return acc\n },\n {},\n mapInstructions\n )\n const newDoc = merge(oldDoc, mappedFields)\n return set(lensPath(parentPath), newDoc, doc)\n }\n\n // apply autoComplete setInstructions to the value\n if (fieldSchema?.autoComplete?.set?.length) {\n // setPath doesn't work w/out cloning?\n value = cloneDeep(value)\n // apply autoComplete setInstructions\n fieldSchema.autoComplete.set.forEach((setInstruction) => setPath(value, setInstruction.to, getPath(value, setInstruction.from)))\n }\n\n // setting single property\n return set(lensPath(path), value, doc)\n})\n\nexport default setFieldValue\n","import { pathOr } from 'ramda'\nimport {\n AnyDocumentAction,\n AnyPaginationAction,\n apiRequest,\n ApiRequestAction,\n clearDocument,\n DocumentActionType,\n FieldActionType,\n generateSlug,\n getDocument,\n hideModal,\n HideModalAction,\n loadEditor,\n LoadEditorAction,\n loadList,\n LoadListAction,\n ModalType,\n resetPagination,\n setDocument,\n setDuplicate,\n setError,\n SetFieldAction,\n setSchema,\n SetSchemaAction,\n setSettings,\n setTranslate,\n showModalV2,\n ShowModalV2Action,\n updateDocument,\n validateField,\n ValidateFieldAction,\n} from '../actions'\nimport { getSlugableField, hasSlug } from '../resource'\nimport { duplicateResource, duplicateWithLocaleID } from '../resource/duplicate'\nimport { duplicateSchema, translationSchema } from '../schemas'\nimport setFieldValue from '../schemas/setFieldValue'\nimport {\n categorySelector,\n documentIDSelector,\n focusedOrgSelector,\n i18n as i18nSelector,\n resourceSelector,\n schemaSelector,\n userSelector,\n wipDocumentSelector,\n} from '../selectors'\nimport { AppState, Middleware } from '../store'\nimport * as Sentry from '@sentry/react'\nimport { SessionState } from '../reducers/session'\nimport { getLocalStorage, setLocalStorage } from '../util'\nimport config from '../config'\n\nconst isNewDoc = (state: any): boolean => {\n const { wip = {} } = state.document\n return !wip.ID || wip.ID === ''\n}\n\nconst isActiveOrgCheck = (state: any): boolean => {\n const resource = resourceSelector(state)\n if (resource !== 'organizations') {\n return false\n }\n const { wip = {} } = state.document\n return wip.status === 'inactive'\n}\n\nconst isReactivateOrgCheck = (state: any): boolean => {\n const resource = resourceSelector(state)\n if (resource !== 'organizations') {\n return false\n }\n const { wip = {}, original = {} } = state.document\n return original.status === 'inactive' && wip.status === 'active'\n}\n\nconst isPlatformSetting = (state: AppState): boolean => {\n return resourceSelector(state) === 'platformSettings'\n}\n\ntype HandleActions = SetFieldAction | AnyDocumentAction\ntype DispatchActions =\n | HandleActions\n | ApiRequestAction\n | ValidateFieldAction\n | ShowModalV2Action\n | HideModalAction\n | LoadEditorAction\n | LoadListAction\n | AnyPaginationAction\n | SetSchemaAction\n\nexport const documentMiddleware: Middleware<HandleActions, DispatchActions> = ({ dispatch, getState }) => (next) => (action) => {\n next(action)\n\n const state = getState()\n const user = userSelector(state)\n const resource = resourceSelector(state)\n const org = focusedOrgSelector(state)\n const category = categorySelector(state)\n const doc = wipDocumentSelector(state)\n const schema = schemaSelector(state)\n\n switch (action.type) {\n case FieldActionType.SET:\n const { fieldSchema, field, value } = action.payload\n const oldWip = pathOr({}, ['document', 'wip'], state)\n const newWip = setFieldValue([field], fieldSchema, value, oldWip)\n next(updateDocument(newWip))\n dispatch(validateField(state.schema.resource, field, value))\n break\n\n case DocumentActionType.CLEAR: {\n dispatch(resetPagination())\n break\n }\n\n case DocumentActionType.DELETE_ERROR:\n case DocumentActionType.DENY_CHANGES_ERROR:\n case DocumentActionType.DRAFT_ERROR:\n case DocumentActionType.GET_ERROR:\n case DocumentActionType.PUBLISH_CHANGES_ERROR:\n case DocumentActionType.SAVE_ERROR:\n case DocumentActionType.SAVE_USER_ERROR:\n case DocumentActionType.SUBMIT_CHANGES_ERROR:\n case DocumentActionType.GENERATE_SLUG_ERROR:\n dispatch(setError(action?.payload?._inputs ?? action.payload))\n break\n\n case DocumentActionType.CLOSE_TRANSLATOR: {\n dispatch(loadEditor(category, resource, state.location.payload.id))\n break\n }\n\n case DocumentActionType.DELETE:\n dispatch(\n apiRequest({\n url: `/${resource}/${action.id}`,\n method: 'DELETE',\n feature: DocumentActionType.DELETE,\n })\n )\n break\n\n case DocumentActionType.DELETE_SUCCESS:\n dispatch(loadList(categorySelector(state)))\n dispatch(hideModal())\n dispatch(clearDocument())\n break\n\n case DocumentActionType.DENY_CHANGES:\n dispatch(\n apiRequest({\n url: `/moderations/${documentIDSelector(state)}?moderationDeny=${encodeURIComponent(action.denialReason)}`,\n method: 'POST',\n feature: DocumentActionType.DENY_CHANGES,\n })\n )\n break\n\n case DocumentActionType.DENY_CHANGES_SUCCESS:\n dispatch(loadList(category))\n break\n\n case DocumentActionType.DRAFT: {\n const url = doc.ID ? `/${schema.resource}/${doc.ID}` : `/${schema.resource}`\n dispatch(\n apiRequest({\n url,\n method: doc.ID ? 'PATCH' : 'PUT',\n body: doc,\n feature: DocumentActionType.DRAFT,\n params: {\n moderate: 'draft',\n },\n })\n )\n break\n }\n\n case DocumentActionType.DRAFT_SUCCESS:\n next(setDocument(action.payload.data))\n next(setSchema(action.payload.schema))\n break\n\n case DocumentActionType.GENERATE_SLUG:\n dispatch(\n apiRequest({\n url: `/organizations/${org?.trunkID}/${org?.ID}/${resource}/slug`,\n method: 'GET',\n feature: DocumentActionType.GENERATE_SLUG,\n params: {\n slug: action.slug,\n name: action.name,\n },\n })\n )\n break\n\n case DocumentActionType.GET: {\n const { id, duplicatedFrom } = action\n const { localeID } = state.location.payload\n if (user && (resource || id === 'self')) {\n if (id === 'new') {\n dispatch(\n apiRequest({\n url: `/organizations/${org?.trunkID}/${org?.ID}/${resource}/new`,\n method: 'GET',\n feature: DocumentActionType.GET,\n params: {\n localeID,\n duplicatedFrom,\n },\n })\n )\n } else if (id === 'self') {\n dispatch(\n apiRequest({\n url: `/self/${user.ID}`,\n method: 'GET',\n feature: DocumentActionType.GET,\n })\n )\n } else {\n dispatch(\n apiRequest({\n url: `/organizations/${org?.trunkID || org?.ID}/${org?.ID}/${resource}/${id}`,\n method: 'GET',\n feature: DocumentActionType.GET,\n resource,\n })\n )\n }\n } else {\n // TODO: prevent non-auth related calls until\n // session has been established, wait to\n // handle route actions until session is\n // established\n setTimeout(() => {\n dispatch(getDocument(id))\n }, 250)\n }\n break\n }\n\n case DocumentActionType.GET_SUCCESS: {\n const { data, schema } = action.payload\n\n dispatch(setSchema(schema))\n\n if (state.document.duplicate) {\n dispatch(setDuplicate(data))\n } else if (state.document.translate) {\n dispatch(setTranslate(data))\n } else {\n dispatch(setDocument(data))\n }\n break\n }\n\n case DocumentActionType.LOAD_TRANSLATOR: {\n const { wip } = state.document\n const { id } = state.location.payload\n if (!wip || wip.ID !== id) {\n dispatch(getDocument(id))\n }\n break\n }\n\n case DocumentActionType.PUBLISH_CHANGES:\n dispatch(\n apiRequest({\n url: `/moderations/${documentIDSelector(state)}`,\n method: 'POST',\n body: doc,\n feature: DocumentActionType.PUBLISH_CHANGES,\n params: {\n moderationApprove: 'true',\n },\n })\n )\n break\n\n case DocumentActionType.PUBLISH_CHANGES_SUCCESS:\n next(setDocument(action.payload.data))\n dispatch(loadList(category))\n break\n\n case DocumentActionType.SAVE:\n const i18n = i18nSelector(state)\n const saveDoc = () => {\n dispatch(\n apiRequest({\n url: `/organizations/${org?.trunkID || org?.ID}/${org?.ID}/${resource}/${doc.ID}`,\n method: doc.ID ? 'PATCH' : 'PUT',\n body: doc,\n feature: DocumentActionType.SAVE,\n })\n )\n }\n if (user && user.ID === doc.ID) {\n dispatch(\n apiRequest({\n url: `/self/${user.ID}`,\n method: 'PATCH',\n body: doc,\n feature: DocumentActionType.SAVE_USER,\n })\n )\n } else if (isNewDoc(state)) {\n saveDoc()\n } else if (isActiveOrgCheck(state)) {\n dispatch(\n showModalV2(\n {\n title: i18n('organization.inactive.title'),\n body: i18n('organization.inactive.message'),\n type: ModalType.Confirm,\n },\n () => {\n dispatch(hideModal())\n saveDoc()\n }\n )\n )\n } else if (isReactivateOrgCheck(state)) {\n dispatch(\n showModalV2(\n {\n title: i18n('organization.reactivate.title'),\n body: i18n('organization.reactivate.message'),\n type: ModalType.Confirm,\n },\n () => {\n dispatch(hideModal())\n saveDoc()\n }\n )\n )\n } else {\n saveDoc()\n }\n break\n\n case DocumentActionType.SAVE_SUCCESS: {\n const { data, ID, schema } = action.payload\n\n // schema isn't always returns (see user creation response)\n if (schema) {\n dispatch(setSchema(schema))\n }\n\n dispatch(setDocument(data))\n\n if (doc.ID === '') {\n dispatch(loadEditor(category, resource, ID || data?.ID))\n } else if (!!data?.ID && doc.ID !== data.ID) {\n // redirect to saved document id, such as instances where\n // a save returns a newly created form instead of mutating an existing form\n dispatch(loadEditor(category, resource, data.ID))\n } else {\n // update the store if updating platformSettings\n if (isPlatformSetting(state)) {\n next(setSettings(data))\n }\n }\n break\n }\n\n case DocumentActionType.SAVE_USER_SUCCESS:\n next(setDocument(action.payload.data))\n const session: SessionState | null = getLocalStorage(config.sessionKey)\n if (session && action.payload && action.payload.data) {\n session.user = action.payload.data\n setLocalStorage(config.sessionKey, session)\n window.dispatchEvent(new Event('toggle-theme'))\n }\n break\n\n // When is this the case?\n case DocumentActionType.SET_DUPLICATE: {\n const { duplicatedFrom } = action\n const { id } = state.location.payload\n if (!duplicatedFrom) {\n dispatch(getDocument('new', id !== 'new' ? id : undefined))\n } else {\n try {\n if (hasSlug(duplicatedFrom)) {\n dispatch(generateSlug(duplicatedFrom.slug, getSlugableField(duplicatedFrom)))\n }\n dispatch(setSchema(duplicateSchema(schema)))\n const dupe = duplicateResource(duplicatedFrom, schema)\n dispatch(setDocument(dupe))\n } catch (err) {\n // recover from duplicate error by returning to editor of source doc\n Sentry.captureException(err, {\n tags: {\n source: 'DocumentsMiddleware',\n },\n })\n console.error(err)\n dispatch(loadEditor(category, resource, id))\n }\n }\n break\n }\n\n case DocumentActionType.SET_TRANSLATE: {\n const { translatedFrom } = action\n const { id, locale, localeID } = state.location.payload\n if (!translatedFrom) {\n // Still have to hit new, to get the schema permissions correct\n // otherwise it does not obey the isImmutable b/c you should\n // be able to edit the slug even if you are duplicating from\n // existing.\n dispatch(getDocument('new', id !== 'new' ? id : undefined))\n } else {\n try {\n if (hasSlug(translatedFrom)) {\n dispatch(generateSlug(translatedFrom.slug, getSlugableField(translatedFrom)))\n }\n const dupe = duplicateWithLocaleID(translatedFrom, schema)\n if (locale) {\n dupe.locale = locale\n }\n if (localeID) {\n dupe.localeID = localeID\n if (localeID !== translatedFrom.localeID) {\n // translating from a duplication-source locale\n dispatch(setSchema(translationSchema(schema, locale)))\n }\n }\n dispatch(setDocument(dupe))\n } catch (err) {\n // recover from duplicate error by returning to editor of source doc\n Sentry.captureException(err, {\n tags: {\n source: 'DocumentsMiddleware',\n },\n })\n console.error(err)\n dispatch(loadEditor(category, resource, id))\n }\n }\n break\n }\n\n case DocumentActionType.SUBMIT_CHANGES:\n dispatch(\n apiRequest({\n url: `/${schema.resource}/${doc.ID}`,\n method: doc.ID ? 'PATCH' : 'PUT',\n body: doc,\n feature: DocumentActionType.SUBMIT_CHANGES,\n params: {\n moderate: 'publish',\n },\n })\n )\n break\n\n case DocumentActionType.SUBMIT_CHANGES_SUCCESS:\n next(setDocument(action.payload.data))\n dispatch(loadList(category))\n break\n }\n}\n","import { and, always, compose, cond, curry, find, gt, ifElse, is, length, lt, map, mapObjIndexed, not, or, pathOr, propOr, T, when } from 'ramda'\n\nconst asArray = when(compose(not, is(Array)), always([]))\n\nconst getFieldValue = curry((field: any, value: any) => {\n const enums = or(pathOr([], ['restrictions', 'enums'], field), [])\n return ifElse(\n () => gt(length(enums), 0),\n () => {\n const obj = find((e: any) => e.value === value, enums)\n return propOr(value, 'label', obj)\n },\n () => value\n )(value)\n})\n\nconst digestEnumValues = (schema: any, doc: any): any => {\n return mapObjIndexed((val, key) => {\n // get the field for the current key\n const field = find((f: any) => f.key === key, or(propOr([], 'fields', schema), []))\n const getValue = getFieldValue(field)\n const hasFields = compose(lt(0), length, asArray, propOr([], 'fields'))(field)\n return cond([\n // if the field has \"fields\" && value is an Array => mapObjIndexed + recurse\n [(value) => and(is(Array, value), hasFields), (value) => map((v) => digestEnumValues(field, v), value)],\n // if the field has \"fields\" && value is object => recurse\n [(value) => and(is(Object, value), hasFields), (value) => digestEnumValues(field, value)],\n // if the field has \"fields\" && value is NOT object => return value\n [() => hasFields, (value) => value],\n // get digested value using field\n [T, getValue],\n ])(val)\n }, doc)\n}\n\nexport const digestDocumentsForList = curry((schema: any, documents: Array<any>) =>\n compose(\n map((doc: any) => digestEnumValues(schema, doc)),\n asArray\n )(documents)\n)\n\nexport default digestEnumValues\n","import { find, path } from 'ramda'\nimport { getListableFields } from '../schemas/listableFields'\nimport {\n focusedOrgSelector,\n limitSelector,\n moduleSelector,\n searchTextSelector,\n selectAPIFilters,\n selectFilters,\n skipSelector,\n sortSelector,\n v3LeadSortSelector,\n} from '../selectors'\nimport { scopeSelector } from '../selectors/scope'\nimport { AppState } from '../store'\nimport { APIFilter, DateOption, DateOptionRangeType, EnumOption, FilterField, isEnumOption, Option, Scope } from '../types'\nimport * as Sentry from '@sentry/react'\n\nconst SINGLE_CONTEXT_URL = '/organizations/:trunkID/:organizationID/:resource'\nconst MULTI_CONTEXT_URL = '/:resource'\n\nexport const buildFilters = (state: AppState) => {\n return selectAPIFilters(state).reduce((obj: any, filter: APIFilter) => {\n const defaultFilter: string[] = path(['field', 'filterConfig', 'defaultValues'], filter) || []\n const filterValue = defaultFilter.join(',')\n const filterObj = {\n [filter.fieldPath.join('.')]: filterValue.length ? filterValue : null,\n }\n obj = {\n ...obj,\n ...(filterValue.length ? filterObj : {}),\n }\n return obj\n }, {})\n}\n\nconst replacePathVariables = (pattern: any, params: any) => {\n const regex = /:\\w+/g\n const matches = pattern.match(regex)\n return (\n (matches || []).reduce((acc: any, key: any) => {\n const value = (params || {})[key.slice(1)] || key\n return acc.replace(key, value)\n }, pattern) || pattern\n )\n}\nconst addSort = (state: AppState) => {\n const module = moduleSelector(state)\n if (!module) {\n return {}\n }\n const schema = (module.schemas || [])[0]\n const sort = sortSelector(state)\n if (sort.column && sort.hasOwnProperty('direction')) {\n return {\n sort: `${sort.direction}${sort.column}`,\n }\n }\n // @ts-ignore strange ramda linting err\n const listableFields: any = getListableFields(schema, {})\n const defaultListConfig = find((v: any): any => path(['field', 'listConfig', 'isDefaultSort'], v), listableFields)\n const defaultDirection = path(['field', 'listConfig', 'defaultSortDirection'], defaultListConfig)\n if (defaultListConfig && defaultDirection) {\n return {\n sort: `${defaultDirection === 'descending' ? '-' : ''}${defaultListConfig.key}`,\n }\n }\n return {}\n}\n\nexport const addV3Sort = (state: AppState) => {\n const sort = v3LeadSortSelector(state)\n\n if (sort.column) {\n return {\n _order: `${sort.column} ${sort.direction === '-' ? 'DESC' : 'ASC'}`,\n }\n }\n}\n\nconst buildParams = (state: AppState) => {\n const focusedOrg = focusedOrgSelector(state)\n return {\n ...focusedOrg,\n organizationID: focusedOrg?.ID ?? '',\n }\n}\n\nconst addOrg = (state: AppState) => {\n const module = moduleSelector(state)\n if (!module) {\n return {}\n }\n const scope = scopeSelector(state)\n if (scope !== Scope.All && !module.noMultiContext) {\n const focusedOrg = focusedOrgSelector(state)\n return {\n organizationID: focusedOrg?.ID ?? '',\n includeDescendants: scope === Scope.IncludeDescendants,\n }\n }\n return {}\n}\n\nconst addSearch = (state: AppState) => {\n const searchText = searchTextSelector(state)\n if (searchText) {\n return {\n prefix: searchText,\n }\n }\n return {}\n}\n\nconst createURL = (state: AppState) => {\n const module = moduleSelector(state)\n if (!module) return\n // Some category is laying around and causing this to crash - wrapping it a try/catch for debug\n try {\n const endpoint = module.noMultiContext ? SINGLE_CONTEXT_URL : MULTI_CONTEXT_URL\n const params = buildParams(state)\n const targetSchema = (module.schemas || [])[0]\n return replacePathVariables(endpoint, {\n ...params,\n resource: targetSchema?.resource,\n })\n } catch (e) {\n Sentry.captureException(e, {\n tags: {\n source: 'urlBuilder',\n },\n contexts: {\n module: module,\n },\n })\n console.error(`caught error with multicontext check for module:`, module, e)\n }\n}\n\nexport const addAppliedFilters = (state: AppState) => {\n const appliedFilters = selectFilters(state)\n\n return appliedFilters.reduce((acc: Record<string, string | number>, curr: FilterField) => {\n if (!curr.selected || curr.selected.length === 0) {\n return acc\n }\n\n // A date range filter is two \"options\" as separate 'fields\" in the UI, but\n // in reality its one field - so cover both option types and return.\n if (curr.presentation === 'dateRange') {\n const selected = curr.selected as DateOption[]\n selected.forEach((sel) => {\n if (sel.range === DateOptionRangeType.From) {\n acc['audit.createdGreaterThan'] = sel.value\n }\n if (sel.range === DateOptionRangeType.To) {\n acc['audit.createdLessThan'] = sel.value\n }\n })\n return acc\n }\n\n // A simple string array reduction is all that is needed for select dropdowns.\n if (curr.presentation === 'select') {\n const selected = curr.selected as EnumOption[]\n acc[curr.key] = selected\n .reduce((valAcc: string[], valCurr: Option) => {\n if (isEnumOption(valCurr)) {\n valAcc.push(valCurr.value)\n return valAcc\n }\n return valAcc\n }, [])\n .join(',')\n return acc\n }\n return acc\n }, {})\n}\n\nconst urlBuilder = (state: AppState): any => {\n const url = createURL(state)\n if (!url) return\n const params = {\n ...buildFilters(state),\n ...addAppliedFilters(state),\n ...addSearch(state),\n limit: limitSelector(state),\n skip: skipSelector(state),\n ...addOrg(state),\n ...addSort(state),\n }\n return {\n url,\n params,\n }\n}\n\nexport default urlBuilder\n","import {\n API_ERROR,\n API_SUCCESS,\n apiRequest,\n DOCS,\n DocumentsActionType,\n getCreateableSchemas,\n getDocuments,\n getV3Leads,\n LEADS_LIST,\n PaginationActionType,\n setDocuments,\n setSchema,\n setSchemaCategory,\n showLoader,\n updateDocumentList,\n} from '../actions'\nimport { digestDocumentsForList } from '../documents/digestEnums'\nimport urlBuilder from '../documents/urlBuilder'\nimport { Middleware } from '../store'\nimport { schemaSelector, selectLocationType } from '../selectors'\n\nexport const docsMiddleware: Middleware = ({ dispatch, getState }) => (next) => (action) => {\n next(action)\n\n switch (action.type) {\n case DocumentsActionType.GET_DOCUMENTS: {\n const org = getState().session.organization\n if (!org) {\n return\n }\n\n dispatch(setSchemaCategory(getState().location?.payload?.category))\n const locationType = selectLocationType(getState())\n // PD-601 Rerouting v3 requests here instead of scattered throughout the codebase\n switch (locationType) {\n case LEADS_LIST:\n dispatch(getV3Leads())\n break\n default:\n dispatch(showLoader(DOCS))\n const schema = schemaSelector(getState())\n const url = urlBuilder(getState())\n dispatch(\n apiRequest({\n url: url.url,\n method: 'GET',\n params: url.params,\n feature: DOCS,\n resource: schema.resource,\n })\n )\n }\n break\n }\n\n case DocumentsActionType.UPDATE_DOCUMENTS: {\n const locationType = selectLocationType(getState())\n // PD-601 Rerouting v3 requests here instead of scattered throughout the codebase\n switch (locationType) {\n case LEADS_LIST:\n dispatch(getV3Leads())\n break\n default:\n dispatch(showLoader(DOCS))\n const schema = schemaSelector(getState())\n const url = urlBuilder(getState())\n dispatch(\n apiRequest({\n url: url.url,\n method: 'GET',\n params: url.params,\n feature: DOCS,\n resource: schema.resource,\n })\n )\n }\n break\n }\n\n case DocumentsActionType.SET_SCOPE: {\n dispatch(getDocuments())\n break\n }\n\n case PaginationActionType.SET_PAGE:\n case PaginationActionType.SET_LIMIT:\n case PaginationActionType.NEXT_PAGE:\n case PaginationActionType.PREV_PAGE: {\n dispatch(updateDocumentList())\n break\n }\n\n case `${DOCS} ${API_SUCCESS}`:\n dispatch(\n setDocuments({\n ...action.payload,\n data: digestDocumentsForList(action.payload.schema, action.payload.data),\n })\n )\n\n dispatch(setSchema(action.payload.schema))\n dispatch(getCreateableSchemas(action.payload.schema.resource))\n break\n\n case `${DOCS} ${API_ERROR}`:\n break\n }\n}\n","import fs from 'file-saver'\nimport { apiRequest, API_SUCCESS } from '../actions/api'\nimport { EXPORT, EXPORT_DOCS } from '../actions/export'\nimport urlBuilder from '../documents/urlBuilder'\nimport { categorySelector } from '../selectors/location'\nimport { Middleware } from '../store'\n\nexport const exportMiddleware: Middleware = ({ dispatch, getState }) => (next) => (action) => {\n next(action)\n\n switch (action.type) {\n case EXPORT_DOCS:\n const { url, params } = urlBuilder(getState())\n params.export = true\n delete params.limit\n delete params.skip\n\n dispatch(\n apiRequest({\n url,\n params,\n method: 'GET',\n feature: EXPORT,\n responseType: 'blob',\n })\n )\n break\n\n case `${EXPORT} ${API_SUCCESS}`:\n const filename = categorySelector(getState())\n fs.saveAs(action.payload, `${filename}.zip`)\n break\n }\n}\n","import { isEmpty, reduce, values } from 'lodash'\nimport { apiRequest, ApiRequestAction } from '../actions/api'\nimport { setError as setDocumentError, SetErrorAction } from '../actions/document'\nimport { AnyFieldAction, FieldActionType } from '../actions/field'\nimport { Middleware } from '../store'\n\ntype HandleActions = AnyFieldAction\ntype DispatchActions = ApiRequestAction | SetErrorAction\n\nexport const fieldMiddleware: Middleware<HandleActions, DispatchActions> = ({ dispatch, getState }) => (next) => (action) => {\n next(action)\n\n const state = getState()\n\n switch (action.type) {\n case FieldActionType.VALIDATE: {\n const { resource, field, value } = action.payload\n const trunkID = state?.session?.organization?.trunkID ?? undefined\n const orgID = state?.session?.organization?.ID ?? undefined\n let url = `/schemas/${resource}/validate/${field}`\n\n if (trunkID) {\n url += `/${trunkID}`\n\n if (orgID) {\n url += `/${orgID}`\n }\n }\n\n dispatch(\n apiRequest({\n url,\n method: 'POST',\n body: value,\n feature: FieldActionType.VALIDATE,\n })\n )\n break\n }\n\n case FieldActionType.VALIDATE_SUCCESS: {\n const { field: fieldSchema } = action.payload\n\n switch (fieldSchema.primitive) {\n case 'joinString': {\n // reset all join field errs\n const payload = reduce(\n fieldSchema?.autoComplete?.set ?? [],\n (errs, setInstruction) => ({\n ...errs,\n [setInstruction.to]: undefined,\n }),\n {\n [fieldSchema.key]: undefined,\n }\n )\n dispatch(setDocumentError(payload))\n break\n }\n\n case 'object': {\n // reset all object field errs\n const errs = reduce(\n fieldSchema.fields,\n (errs: any, field: any) => ({\n ...errs,\n [field.key]: undefined,\n }),\n {}\n )\n\n const payload = {\n // if every field err is undefined, unset the entire object key\n [fieldSchema.key]: values(errs).every(isEmpty) ? undefined : errs,\n }\n\n dispatch(setDocumentError(payload))\n break\n }\n\n default:\n dispatch(\n setDocumentError({\n [fieldSchema.key]: undefined,\n })\n )\n }\n break\n }\n\n case FieldActionType.VALIDATE_ERROR:\n dispatch(setDocumentError(action?.payload?._inputs ?? []))\n break\n }\n}\n","import {\n AnyFiltersAction,\n apiRequest,\n FiltersActionType,\n getDocuments,\n hideLoader,\n LEAD_DETAILS,\n LEADS_LIST,\n LoadListAction,\n setFilters,\n setSchemas,\n showLoader,\n TRIGGER_DETAILS,\n TRIGGERS_LIST,\n updateDocumentList,\n} from '../actions'\nimport {\n focusedOrgSelector,\n i18n,\n moduleSelector,\n selectFilterOptionStringsByKey,\n selecti18n,\n selectLeadStatusToStageSetting,\n selectLeadTypeEnums,\n selectV3EnabledSetting,\n} from '../selectors'\nimport { AppState, Middleware } from '../store'\nimport { getV3LeadAPIFiltersFromMockSchema } from '../util'\nimport { selectLeadStageEnums, selectLeadStatusEnums } from '../selectors/contentConfig'\nimport { Schema } from '../schemas'\nimport { createV3LeadsAPISchemaFromMock, getV3LeadsMockSchema, V3LeadsCategory } from '../schemas/v3Mocks'\n\ntype HandleActions = AnyFiltersAction | LoadListAction\n\nexport const filtersMiddleware: Middleware<HandleActions> = ({ dispatch, getState }) => (next) => (action) => {\n next(action)\n\n const handleV3Leads = (state: AppState) => {\n const mockV3LeadsSchema = getV3LeadsMockSchema(\n i18n(state),\n selectLeadStatusEnums(state, false),\n selectLeadTypeEnums(state),\n selectLeadStageEnums(state),\n selectFilterOptionStringsByKey(state, 'Stage', false),\n selectLeadStatusToStageSetting(state)\n )\n\n const newV3LeadsSchema = createV3LeadsAPISchemaFromMock(selecti18n(state, 'leads.detail.section.content.label'), mockV3LeadsSchema)\n\n const updatedSchemas = state.schemas.reduce((acc: Schema[], curr: Schema) => {\n if (curr.key !== V3LeadsCategory) {\n acc.push(curr)\n return acc\n }\n acc.push(newV3LeadsSchema)\n return acc\n }, [])\n\n dispatch(setSchemas(updatedSchemas))\n\n // Reevaluate the filters with updated stageEnums\n // Mock an API success with our filter result\n dispatch({\n type: FiltersActionType.GET_SUCCESS,\n payload: getV3LeadAPIFiltersFromMockSchema(mockV3LeadsSchema),\n meta: {\n feature: FiltersActionType.GET,\n resource: V3LeadsCategory,\n },\n })\n }\n\n switch (action.type) {\n case FiltersActionType.GET: {\n dispatch(showLoader(FiltersActionType.GET))\n\n switch (getState().location.type) {\n case TRIGGER_DETAILS:\n case TRIGGERS_LIST:\n // V3 resources with no filters (yet)\n dispatch(hideLoader(FiltersActionType.GET))\n break\n case LEAD_DETAILS:\n case LEADS_LIST:\n // skip fetching filters (prevent firing requests to v3 API) if v3 not enabled for org on org switch\n if (!selectV3EnabledSetting(getState())) {\n dispatch(hideLoader(FiltersActionType.GET))\n break\n }\n handleV3Leads(getState())\n\n break\n default:\n const resource = moduleSelector(getState())?.schemas?.[0]?.resource\n if (resource) {\n const organization = focusedOrgSelector(getState())\n const filterFragment = `/${resource}/filters`\n const url = organization?.trunkID ? `/organizations/${organization.trunkID}/${organization.ID}${filterFragment}` : filterFragment\n dispatch(\n apiRequest({\n url,\n method: 'GET',\n feature: FiltersActionType.GET,\n resource: resource,\n })\n )\n }\n }\n break\n }\n\n case FiltersActionType.GET_SUCCESS:\n // Any mocked filters won't hit the API middleware, catch that with this hideLoader call.\n dispatch(hideLoader(FiltersActionType.GET))\n dispatch(setFilters(action.meta.resource, action.payload))\n dispatch(getDocuments())\n break\n\n case FiltersActionType.UPDATE:\n // when selecting a lead stage, we want to filter out now-unavailable statuses as well.\n // This was originally assigned to an Azure ticket but redone as part of PD-601 to reflect\n // current filter handling\n const { key, resource } = action\n if (resource === V3LeadsCategory && key === 'Stage') {\n // For all intents and purposes, we basically just want to re-do what happens when calling\n // GET for filters on V3 leads, just with a re-evaluation of the stage enums.\n handleV3Leads(getState())\n break\n }\n\n dispatch(updateDocumentList())\n break\n }\n}\n","import { Environment, Environments } from './config'\nimport { FlagConfigs } from './flags/flags'\n\n// This is defunct, but not being removed for now (See CSSEditor component\nconst allowCSSFramework: string[] = []\n\n// People who should be able to at least see every piece of functionality.\n// Either devs that work with the full stack or management that needs to know the full state of the product\n// at any given time.\nconst allowAll = [\n 'amiller@powerchordsystem.com',\n 'crivera@powerchordsystem.com',\n 'mvandiest@powerchord.io',\n 'mvandiest@powerchordsystem.com',\n 'smiles@powerchordsystem.com',\n]\n\n// Same as allowAll but only for non-production environments - mostly Team Blue devs.\n// This basically just limits visibility to Default Rules, since we don't want them accidentally edited.\nconst allowAllNonProd = [\n ...allowAll,\n 'dsmolen@powerchordsystem.com',\n 'jmostyn@powerchordsystem.com',\n 'mvisich@powerchordsystem.com',\n 'tmctesterson@powerchordsystem.com',\n // Team Orange QA, occasionally needs access to help out\n 'dhartwell@powerchordsystem.com',\n 'esibal@powerchordsystem.com',\n 'hgraham@powerchordsystem.com',\n]\n\n// People who need elevated access to view Architect and pages within\nconst allowArchitect = [...allowAllNonProd, 'bdundas@powerchordsystem.com', 'jhillegas@powerchordsystem.com', 'kcline@powerchordsystem.com']\n\nconst internalDomains = ['powerchord.com', 'powerchord.io', 'powerchordsystem.com']\n\nconst flags: FlagConfigs = {\n architect: {\n users: allowArchitect,\n },\n internal: {\n domains: internalDomains,\n },\n cssFramework: {\n users: allowCSSFramework,\n },\n localeSwitcher: {\n environments: Environments,\n },\n languageToggle: {\n environments: Environments,\n },\n ruleAdmins: {\n users: allowAll,\n },\n ruleDevs: {\n users: allowAllNonProd,\n environments: Environments.filter((env) => env !== Environment.Production),\n },\n}\n\nexport default flags\n","import { FlagActionTypes, setFlags } from '../actions'\nimport config from '../config'\nimport defaultFlags from '../flags'\nimport { calculateFlags } from '../flags/flags'\nimport { userSelector } from '../selectors'\nimport { Middleware } from '../store'\n\nexport const flagsMiddleware: Middleware = ({ getState, dispatch }) => (next) => (action) => {\n next(action)\n\n switch (action.type) {\n case FlagActionTypes.CALCULATE_FLAGS:\n const state = getState()\n const user = userSelector(state)\n // This variable is checked at runtime\n const environment = config.environment!\n const flags = calculateFlags({ user, environment }, defaultFlags)\n dispatch(setFlags(flags))\n break\n }\n}\n","import { Environment } from '../config'\n\ntype FlagConfig = {\n users?: Array<string>\n environments?: Array<Environment>\n domains?: Array<string>\n}\n\ntype Config = boolean | FlagConfig\n\nexport type FlagConfigs = Record<string, Config>\n\nexport type CalculateFlagsState = {\n environment: Environment\n user?: {\n email: string\n }\n}\n\nexport const calculateFlags = (state: CalculateFlagsState, config: FlagConfigs): Record<string, boolean> => {\n const { user, environment } = state\n const ret: Record<string, boolean> = {}\n\n for (const [key, value] of Object.entries(config)) {\n if (typeof value === 'boolean') {\n ret[key] = value\n continue\n }\n\n let matches = 0\n ret[key] = false\n if (value.environments) {\n if (value.environments.indexOf(environment) > -1) {\n matches++\n }\n }\n\n if (user) {\n if (value.users && value.users.indexOf(user.email) > -1) {\n matches++\n }\n\n if (value.domains) {\n const matchingDomains = value.domains.filter((domain) => {\n return user.email.endsWith(domain)\n })\n if (matchingDomains.length > 0) {\n matches++\n }\n }\n }\n\n const doesMatch = matches === Object.keys(value).length\n ret[key] = doesMatch\n }\n\n return ret\n}\n","import { i18nActionTypes } from '../actions/i18n'\nimport { i18nMap } from '../reducers/i18n'\nimport { Middleware } from '../store'\n\n// importLanguageJSON will attempt to import the language or throw an err\nexport const importLanguageJSON = async (filename: string): Promise<i18nMap> => {\n try {\n const module = await import(`../i18n/${filename}`)\n return module.default as i18nMap\n } catch (err) {\n console.warn(`unable to load language '${filename}'`)\n throw err\n }\n}\n\nexport const i18nMiddleware: Middleware = ({ dispatch, getState }) => (next) => (action) => {\n next(action)\n\n switch (action.type) {\n case i18nActionTypes.SET_LOCALE:\n // Note SM 06-20-24\n // This is a variant of a long-standing hack to reload all API resources\n // with the correct locale.\n // Simply - its easiest to reload the window, which will trigger the translations being\n // loaded alongside the correct API data.\n // This is only needed on desktop once logged in, as the mobile experience and login screen\n // do not require these schemas.\n window.location.reload()\n }\n}\n","import { API_SUCCESS, apiRequest, GET_MEMBERSHIPS, MEMBERSHIPS, setMemberships } from '../actions'\nimport { Middleware } from '../store'\n\nexport const membershipsMiddleware: Middleware = ({ dispatch }) => (next) => (action) => {\n next(action)\n\n switch (action.type) {\n case GET_MEMBERSHIPS:\n dispatch(\n apiRequest({\n url: `/userAndMemberships/${action.payload}`,\n method: 'GET',\n feature: MEMBERSHIPS,\n })\n )\n break\n\n case `${MEMBERSHIPS} ${API_SUCCESS}`:\n dispatch(setMemberships(action.payload.data?.memberships))\n break\n }\n}\n","import { apiRequest, API_SUCCESS } from '../actions/api'\nimport { GET_ORGS, ORGS, setOrgs } from '../actions/organization'\nimport { Middleware } from '../store'\n\nexport const orgsMiddelware: Middleware = ({ dispatch }) => (next) => (action) => {\n next(action)\n\n switch (action.type) {\n case GET_ORGS:\n dispatch(\n apiRequest({\n url: `/context?namePrefix=${action.payload}`,\n method: 'GET',\n feature: ORGS,\n })\n )\n break\n\n case `${ORGS} ${API_SUCCESS}`:\n dispatch(setOrgs(action.payload.data))\n break\n }\n}\n","import { setError } from 'actions/document'\nimport axios, { AxiosError } from 'axios'\nimport {\n apiRequest,\n calculateFlags,\n clearSession,\n getContentConfigs,\n getLeadTypes,\n getMemberships,\n getV3OrgHierarchy,\n renderMenu,\n SESSION,\n SessionActionTypes,\n setContext,\n setFiltersOnOrgSwitch,\n setLoginError,\n setSchemas,\n setSession,\n} from '../actions'\nimport config from '../config'\nimport { focusedOrgSelector, i18n, roleSelector, schemaSelector, selectV3EnabledSetting, userSelector } from '../selectors'\nimport { Middleware } from '../store'\nimport { getV3Schemas } from '../schemas/v3Mocks'\nimport * as Sentry from '@sentry/react'\nimport { getLocalStorage, removeLocalStorage, setLocalStorage } from '../util'\nimport { SessionState } from '../reducers/session'\n\n// reloadToLogin clears session storage, and uses location.replace\n// to avoid persisting any in-memory app state\nexport const reloadToLogin = () => {\n removeLocalStorage(config.sessionKey)\n window.location.replace('/login')\n}\n\nexport const sessionMiddleware: Middleware = ({ dispatch, getState }) => (next) => async (action) => {\n next(action)\n\n switch (action.type) {\n case SessionActionTypes.LOGIN:\n dispatch(\n apiRequest({\n method: 'POST',\n url: '/authenticate/credentials',\n feature: SESSION,\n body: action.payload,\n })\n )\n break\n\n case SessionActionTypes.SET_FOCUSED_ORG: {\n let session: SessionState | null = getLocalStorage(config.sessionKey)\n if (!session) {\n session = {} as SessionState\n }\n session.organization = action.payload\n setLocalStorage(config.sessionKey, session)\n const schema = schemaSelector(getState())\n const response = await axios({\n url: `${config.api}/context`,\n method: 'PUT',\n data: {\n contexts: [\n {\n organizationID: action?.payload?.ID ?? '',\n trunkID: (action?.payload?.trunkID || action?.payload?.ID) ?? '',\n },\n ],\n },\n }).catch((err: AxiosError) => {\n setError(err)\n })\n // There's a ton of weirdness and timing issues with the state when doing v2/v3 switching, so it's easier to just reload\n window.location.reload()\n break\n }\n\n case SessionActionTypes.API_SUCCESS:\n dispatch(setSession(action.payload))\n break\n\n case SessionActionTypes.API_ERROR:\n dispatch(setLoginError(action?.payload?._message ?? i18n(getState())('auth.error.login')))\n // clear session on 401\n if (401 === action?.payload?.response?.status) {\n // if not on login page, redirect to it\n if (window.location.pathname !== '/login') {\n reloadToLogin()\n } else {\n dispatch(clearSession())\n }\n }\n break\n\n case SessionActionTypes.CLEAR_SESSION:\n removeLocalStorage(config.sessionKey)\n break\n\n case SessionActionTypes.SET_SESSION: {\n const state = getState()\n\n if (selectV3EnabledSetting(state)) {\n // PD-601 while this *could* be done in preloaded state or otherwise,\n // doing so here allows us to reference an i18nSelectorMap instead of the I18nState itself,\n // which is more in line with the rest of the codebase.\n // All enum arrays are blank - we don't need them yet and will populate them later.\n const schemas = [...state.schemas, ...getV3Schemas(i18n(state), [], [], [], [], [])]\n dispatch(setSchemas(schemas))\n dispatch(getV3OrgHierarchy())\n dispatch(getContentConfigs(action.payload.organization.trunkID))\n dispatch(getLeadTypes())\n }\n\n // set focused org for filters when session is loaded/set\n dispatch(setFiltersOnOrgSwitch(action?.payload?.organization?.ID))\n dispatch(calculateFlags())\n dispatch(getMemberships(action?.payload?.user?.ID))\n const user = userSelector(state)\n if (user) {\n Sentry.setUser({\n id: user.ID,\n email: user.email,\n username: user.fullName,\n })\n }\n const role = roleSelector(state)\n const additionalContext: Record<string, unknown> = {}\n if (role) {\n additionalContext['role'] = role\n }\n const org = focusedOrgSelector(state)\n if (org) {\n additionalContext['org'] = {\n id: org?.ID,\n name: org?.name,\n trunkID: org?.trunkID,\n trunkName: org?.trunkOrganizationName,\n }\n }\n if (Object.keys(additionalContext).length > 0) {\n Sentry.setContext('user-info', additionalContext)\n }\n setLocalStorage(config.sessionKey, action.payload)\n dispatch(renderMenu())\n break\n }\n\n case SessionActionTypes.LOGOUT:\n reloadToLogin()\n break\n\n case SessionActionTypes.APPLY_CONTEXT:\n dispatch(\n apiRequest({\n url: '/context',\n method: 'PUT',\n feature: SessionActionTypes.APPLY_CONTEXT,\n body: {\n contexts: [\n {\n organizationID: action?.payload?.ID ?? '',\n trunkID: (action?.payload?.trunkID || action?.payload?.ID) ?? '',\n },\n ],\n },\n })\n )\n break\n\n case SessionActionTypes.APPLY_CONTEXT_SUCCESS:\n dispatch(setContext(action?.payload?.contexts[0] ?? {}))\n break\n }\n}\n","import {\n ACCOUNT_PAGE,\n ANALYTICS_PAGE,\n ARCHITECT_APP,\n calculateFlags,\n clearDocument,\n clearDocuments,\n clearSearch,\n clearSort,\n EDITOR_PAGE,\n EditorMode,\n getAnalytics,\n getContentConfigs,\n getDocument,\n getDocuments,\n getFilters,\n getPages,\n getTriggerDetail,\n getTriggerList,\n getV3Lead,\n getV3Leads,\n HOME_PAGE,\n LEAD_DETAILS,\n LEADS_LIST,\n LIST_PAGE,\n loadArchitect,\n loadDefaultPage,\n loadLeadsList,\n LOGIN_PAGE,\n OLD_SB_ROUTE,\n setDuplicate,\n setRedirect,\n setSchema,\n setTranslate,\n setTriggerScope,\n TRIGGER_DETAILS,\n TRIGGERS_LIST,\n} from '../actions'\nimport { setCategory, unsetCategory } from '../actions/route'\nimport { Schema } from '../schemas'\nimport {\n analyticsSettingsSelector,\n defaultSchemaSelector,\n focusedOrgSelector,\n isCategoryAvailableSelector,\n isPageAction,\n isPublicPage,\n isValidSession,\n readyForV3Filters,\n selecti18n,\n shouldUpdateFilters,\n siteIDSelector,\n} from '../selectors'\nimport { Middleware } from '../store'\nimport { reloadToLogin } from './session'\nimport { triggerTitleSelector } from 'selectors/triggers'\nimport { selectContentConfigs } from '../selectors/contentConfig'\nimport { Scope } from '../types'\nimport { V3LeadsCategory } from '../schemas/v3Mocks'\n\nexport const pagesMiddleware: Middleware = ({ dispatch, getState }) => (next) => (action) => {\n next(action)\n const sessionValid = isValidSession(getState())\n const publicPage = isPublicPage(action.type)\n\n if (isPageAction(action.type)) {\n if (!publicPage && !sessionValid) {\n next(setRedirect(action.payload))\n reloadToLogin()\n return\n }\n // unsetCategory so navigating back to a list based view\n // detects that it should go get new filters\n dispatch(unsetCategory())\n }\n\n switch (action.type) {\n case LOGIN_PAGE:\n dispatch(calculateFlags())\n break\n\n case HOME_PAGE:\n dispatch(loadDefaultPage(defaultSchemaSelector(getState())))\n break\n\n case LEAD_DETAILS: {\n dispatch(clearDocument())\n // set a schema label for the AppBar title\n dispatch(getV3Lead(action.payload))\n break\n }\n\n case LEADS_LIST: {\n dispatch(clearDocuments())\n // TODO: 90% of this can be combined with LIST_PAGE at this point.\n if (!action?.payload?.category) {\n // fix empty location.payload if this route is initial page\n dispatch(loadLeadsList(getState().location?.query))\n break\n }\n\n if (getState().search) {\n dispatch(clearSearch(false))\n }\n\n // When we are ready, one of the contentconfigs / lead types getters will\n // call loadLeadsList.\n if (!readyForV3Filters(getState())) {\n break\n }\n\n if (shouldUpdateFilters(getState())) {\n dispatch(getFilters())\n } else {\n dispatch(getV3Leads())\n }\n // set the category to detect changes between categories\n dispatch(setCategory(V3LeadsCategory))\n break\n }\n\n case LIST_PAGE: {\n dispatch(clearDocuments())\n // redirect to the default available page if the user does not have access to the requested category\n if (!isCategoryAvailableSelector(getState(), action.payload.category)) {\n // PD-601 a VERY nasty recursion loop can happen if the default schema isn't loaded, so just break out\n const schema = defaultSchemaSelector(getState())\n if (schema === '') {\n break\n }\n dispatch(loadDefaultPage(schema))\n break\n }\n dispatch(clearSort())\n if (getState().search) {\n dispatch(clearSearch(false))\n }\n\n if (shouldUpdateFilters(getState())) {\n // getFilters() will trigger getDocuments()\n dispatch(getFilters())\n } else {\n // always at least getDocuments()\n dispatch(getDocuments())\n }\n // set the category to detect changes between categories\n dispatch(setCategory(action.payload.category))\n break\n }\n\n case EDITOR_PAGE: {\n const { document } = getState()\n const wipIsCurrent = document?.wip?.ID === action.payload.id\n switch (action.payload.mode) {\n case EditorMode.DUPLICATE:\n dispatch(setDuplicate(wipIsCurrent ? document.wip : undefined))\n break\n\n case EditorMode.TRANSLATE:\n dispatch(setTranslate(wipIsCurrent ? document.wip : undefined))\n break\n\n default:\n dispatch(clearDocument())\n dispatch(getDocument(action.payload.id))\n }\n break\n }\n\n case ACCOUNT_PAGE:\n dispatch(clearDocuments())\n dispatch(clearDocument())\n dispatch(getDocument('self'))\n break\n\n case ANALYTICS_PAGE: {\n const state = getState()\n let analyticsTypeEnabled = false\n const { dashboardType } = action.payload\n const settings = analyticsSettingsSelector(state)\n const schemaIsAvailable = isCategoryAvailableSelector(state, `analytics/${dashboardType}`)\n\n switch (dashboardType) {\n case 'sites':\n analyticsTypeEnabled = settings?.enableSiteAnalytics\n break\n case 'leads':\n analyticsTypeEnabled = settings?.enableAnalytics\n break\n case 'campaigns':\n analyticsTypeEnabled = settings?.enableCampaignAnalytics\n break\n }\n\n analyticsTypeEnabled && schemaIsAvailable ? dispatch(getAnalytics(dashboardType)) : dispatch(loadDefaultPage(defaultSchemaSelector(state)))\n break\n }\n\n case ARCHITECT_APP:\n const siteID = siteIDSelector(getState())\n dispatch(getPages(siteID))\n break\n\n case OLD_SB_ROUTE:\n dispatch(loadArchitect(action.payload.siteID))\n break\n\n case TRIGGERS_LIST: {\n dispatch(clearDocuments())\n const state = getState()\n const { isPlatform } = state.location.payload\n\n let label = selecti18n(state, 'nav.labels.rules.customOrganization')\n let scope = Scope.IncludeDescendants\n if (isPlatform) {\n label = selecti18n(state, 'nav.labels.rules.platformSystem')\n scope = Scope.PlatformSystem\n }\n dispatch(setTriggerScope(scope))\n dispatch(getTriggerList(scope))\n\n const configs = selectContentConfigs(state)\n if (configs.length === 0) {\n const org = focusedOrgSelector(state)\n if (org) {\n dispatch(getContentConfigs(org.trunkID))\n }\n }\n\n dispatch(setSchema({ resource: 'trigger', label: label } as Schema))\n break\n }\n\n case TRIGGER_DETAILS: {\n dispatch(clearDocument())\n const state = getState()\n const { id, isPlatform } = state.location.payload\n const configs = selectContentConfigs(state)\n if (configs.length === 0) {\n const org = focusedOrgSelector(state)\n if (org) {\n dispatch(getContentConfigs(org.trunkID))\n }\n }\n const scope = isPlatform ? Scope.PlatformSystem : Scope.IncludeDescendants\n dispatch(setSchema({ resource: 'trigger', label: triggerTitleSelector(getState()) } as Schema))\n dispatch(setTriggerScope(scope))\n dispatch(getTriggerDetail(id, scope))\n break\n }\n }\n}\n","import {\n API_ERROR,\n API_SUCCESS,\n apiRequest,\n clearPasswordResetError,\n loadDefaultPage,\n PASSWORD,\n SAVE_PASSWORD,\n setPasswordResetError,\n} from '../actions'\nimport { Middleware } from '../store'\nimport { defaultSchemaSelector } from '../selectors'\n\nexport const passwordMiddleware: Middleware = ({ dispatch, getState }) => (next) => (action) => {\n next(action)\n\n const state = getState()\n\n switch (action.type) {\n case SAVE_PASSWORD:\n dispatch(\n apiRequest({\n url: '/credentials/change',\n method: 'POST',\n body: action.payload,\n feature: PASSWORD,\n })\n )\n break\n\n case `${PASSWORD} ${API_SUCCESS}`:\n dispatch(clearPasswordResetError())\n dispatch(loadDefaultPage(defaultSchemaSelector(state)))\n break\n\n case `${PASSWORD} ${API_ERROR}`:\n dispatch(setPasswordResetError(action?.payload?._message ?? ''))\n break\n }\n}\n","import axios, { AxiosRequestConfig, AxiosResponse } from 'axios'\nimport { RENDERER_REQUEST, rendererError, rendererSuccess } from '../actions'\nimport config from '../config'\nimport { authHeaderSelector } from '../selectors'\nimport { Middleware } from '../store'\nimport { RendererError } from '../types'\nimport * as Sentry from '@sentry/react'\nimport { setSentryErrorData } from '../util/sentry'\n\nexport const rendererMiddleware: Middleware = (store) => (next) => (action) => {\n next(action)\n\n if (action.type.indexOf(RENDERER_REQUEST) > 0) {\n const { url, method, feature, params, responseType } = action.meta\n\n let fullUrl: string\n let data: any\n if (url.indexOf('http') === 0) {\n fullUrl = url\n data = action.payload\n } else {\n fullUrl = config.renderer + url\n data = action.payload ? JSON.stringify(action.payload) : null\n }\n\n const headers = authHeaderSelector(store.getState())\n if (method === 'POST' || method === 'PUT') {\n headers['Content-Type'] = 'application/x-www-form-urlencoded'\n }\n\n const reqConfig: AxiosRequestConfig = {\n url: fullUrl,\n method,\n headers: headers,\n data,\n params,\n responseType,\n }\n\n axios(reqConfig)\n .then((response: AxiosResponse) => {\n if (response.status > 299) {\n store.dispatch(rendererError(response.data, feature))\n } else {\n store.dispatch(rendererSuccess(response.data, feature))\n }\n })\n .catch((error) => {\n if (axios.isCancel(error)) {\n return undefined\n }\n\n Sentry.withScope(function (scope) {\n setSentryErrorData(scope, error)\n scope.setTag('source', 'rendererMiddleware')\n scope.setTag('type', feature)\n scope.setContext('request', {\n url: fullUrl,\n method: method,\n })\n Sentry.captureException(error)\n })\n console.error('RENDERER ERROR: ', error)\n if (error?.response?.data) {\n store.dispatch(rendererError(error.response.data, feature))\n } else {\n store.dispatch(rendererError((error.response as unknown) as RendererError, feature))\n }\n })\n }\n}\n","import _ from 'lodash'\n\nconst normalizeGroupShape = (groups: any) =>\n (groups || []).map((group: any) => {\n const items = (group.categories || [])\n .map((category: any) => ({\n key: category.key,\n label: category.label,\n presentation: category.presentation,\n type: 'category',\n isAllowed: !!category.isAllowed,\n }))\n .map((item: any): any => {\n if (group.key === item.key || 'show' === item.presentation) {\n return null\n }\n item.category = item.key\n return item\n })\n .filter(Boolean)\n const dup = _.find(group.items, (i: any) => i.key === group.key || i.label === group.label)\n const firstKey = _.get(group, 'categories[0].key')\n const category = (dup && dup.key) || firstKey\n return {\n key: group.key,\n label: group.label,\n type: 'group',\n isAllowed: group.isAllowed || true,\n items,\n category,\n sortOrder: group.sortOrder,\n }\n })\n\nconst parseModules = (groups: any) =>\n normalizeGroupShape((groups || []).filter((group: any) => (group.categories || []).filter((category: any) => category.isAllowed).length))\n\nexport default parseModules\n","import {\n apiRequest,\n GET_SCHEMAS,\n GET_SCHEMAS_SUCCESS,\n getFilters,\n LIST_PAGE,\n loadHome,\n LOGIN_PAGE,\n Menu,\n RENDER_MENU,\n SCHEMAS,\n setMenu,\n setSchemas,\n} from '../actions'\nimport parseModules from '../schemas/parseModules'\nimport { flagSelector, membershipSelector, selectAnyFlag } from '../selectors'\nimport { I18n, i18n as i18nSelector } from '../selectors/i18n'\nimport { AppState, Middleware } from '../store'\n\nconst appendMenuItems = (state: AppState, groups: any, i18n: I18n) => {\n const menuItems: Menu = [\n {\n isAllowed: true,\n category: 'helpCenter',\n key: 'helpCenter',\n label: i18n('nav.labels.helpCenter'),\n weblink: 'https://powerchord.atlassian.net/servicedesk/customer/portals',\n presentation: 'webLink',\n items: [],\n sortOrder: 99,\n },\n ]\n\n const isArchitectUser = flagSelector(state, 'architect')\n const canViewRulesAdmin = selectAnyFlag(state, 'ruleAdmins', 'ruleDevs')\n const memberships = membershipSelector(state)\n\n if (canViewRulesAdmin) {\n menuItems.unshift({\n isAllowed: true,\n category: 'v3/platform/rules',\n key: 'rules',\n label: i18n('nav.labels.rules.platformSystem'),\n weblink: '',\n presentation: '',\n items: [],\n })\n }\n if (isArchitectUser || canViewRulesAdmin || HasRulesManagementMembership(memberships)) {\n // @todo turn these into a grouped menu item\n menuItems.unshift({\n isAllowed: true,\n category: 'v3/rules',\n key: 'rules',\n label: i18n('nav.labels.rules.customOrganization'),\n weblink: '',\n presentation: '',\n items: [],\n })\n }\n\n return groups.concat(menuItems)\n}\n\n//TODO add membership check here\nfunction HasRulesManagementMembership(memberships: any): boolean {\n return false\n}\n\nexport const schemasMiddleware: Middleware = ({ dispatch, getState }) => (next) => (action) => {\n next(action)\n\n const state = getState()\n\n switch (action.type) {\n case GET_SCHEMAS:\n dispatch(\n apiRequest({\n method: 'GET',\n // AB#3674 scope schemas request to focused organization\n url: `/schemas?${state.session?.organization?.ID ? 'organizationID=' + state.session.organization?.ID : ''}`,\n feature: SCHEMAS,\n })\n )\n break\n\n case GET_SCHEMAS_SUCCESS: {\n const schemas = action.payload\n dispatch(setSchemas(schemas))\n if (LIST_PAGE === state?.location?.type) {\n dispatch(getFilters())\n }\n // re-route to home page on login, after the schemas have loaded\n if (LOGIN_PAGE === state?.location?.type) {\n dispatch(loadHome())\n }\n break\n }\n\n case RENDER_MENU: {\n const i18n = i18nSelector(state)\n const modules = parseModules(state.schemas)\n const menu = appendMenuItems(state, modules, i18n)\n dispatch(setMenu(menu))\n break\n }\n }\n}\n","import { debounce } from 'lodash'\nimport { AnyAction, Dispatch } from 'redux'\nimport { schemaSelector } from 'selectors'\nimport { updateDocumentList } from '../actions/documents'\nimport { setSkip } from '../actions/pagination'\nimport { AnySearchAction, SearchActionType } from '../actions/search'\nimport { Middleware } from '../store'\nimport { V3LeadsCategory } from '../schemas/v3Mocks'\n\nconst delayedRefetch = debounce((dispatch: Dispatch<AnyAction>) => dispatch(updateDocumentList()), 350)\n\nexport const searchMiddleware: Middleware<AnySearchAction> = ({ dispatch, getState }) => (next) => (action) => {\n next(action)\n\n switch (action.type) {\n case SearchActionType.CLEAR:\n case SearchActionType.SET:\n const schema = schemaSelector(getState())\n // PD-601 keeping the setSkip behavior that was here previously before\n // the switch statement was removed\n if (schema.resource !== V3LeadsCategory) {\n dispatch(setSkip(0))\n }\n if (action.refetch) {\n if (action.delayed) {\n delayedRefetch(dispatch)\n } else {\n dispatch(updateDocumentList())\n }\n }\n break\n }\n}\n","import { AnyAction, Middleware, MiddlewareAPI } from 'redux'\nimport { apiRequest, getV3OrgHierarchy, loadDefaultPage, setSettings, SETTINGS, SettingsActionTypes, getFilters } from '../actions'\nimport { defaultSchemaSelector, focusedOrgSelector } from '../selectors'\n\nexport const settingsMiddleware: Middleware = ({ dispatch, getState }: MiddlewareAPI) => (next: Function) => (action: AnyAction) => {\n next(action)\n\n switch (action.type) {\n case SettingsActionTypes.GET_SETTINGS:\n const org = focusedOrgSelector(getState())\n if (org) {\n dispatch(\n apiRequest({\n method: 'GET',\n url: `/organizations/${org.trunkID || org.ID}/${org.ID}/platformSettings`,\n feature: SETTINGS,\n })\n )\n }\n break\n\n case SettingsActionTypes.SET_SETTINGS: {\n if (action?.payload?.enableV3) {\n dispatch(getV3OrgHierarchy())\n }\n break\n }\n\n case SettingsActionTypes.GET_SETTINGS_SUCCESS:\n if (action?.payload?.data?.length) {\n dispatch(setSettings(action.payload.data[0]))\n // load the default list page since lead view switching relies on up-to-date platformSettings\n dispatch(loadDefaultPage(defaultSchemaSelector(getState())))\n }\n break\n }\n}\n","import { debounce } from 'lodash'\nimport { updateDocumentList } from '../actions/documents'\nimport { AnySortAction, SortActionType } from '../actions/sort'\nimport { Middleware } from '../store'\n\nconst refetch = debounce((dispatch) => dispatch(updateDocumentList()), 150)\n\nexport const sortMiddleware: Middleware<AnySortAction> = ({ dispatch }) => (next) => (action) => {\n next(action)\n\n switch (action.type) {\n case SortActionType.SET:\n refetch(dispatch)\n break\n }\n}\n","import { AnyAction, Middleware } from 'redux'\nimport { SET_LOCAL_STORAGE } from '../actions/storage'\nimport { setLocalStorage } from '../util'\n\nexport const storageMiddleware: Middleware = () => (next: Function) => (action: AnyAction) => {\n next(action)\n\n switch (action.type) {\n case SET_LOCAL_STORAGE:\n setLocalStorage(action.payload.key, action.payload.value)\n break\n }\n}\n","import { apiRequest, API_SUCCESS } from '../actions/api'\nimport { setAutoComplete } from '../actions/autocomplete'\nimport { GET_TAGS } from '../actions/tags'\nimport { Middleware } from '../store'\n\nexport const tagsMiddleware: Middleware = ({ dispatch }) => (next) => (action) => {\n next(action)\n\n switch (action.type) {\n case GET_TAGS:\n dispatch(\n apiRequest({\n url: '/tagFilters',\n method: 'GET',\n params: {\n prefix: action.payload,\n },\n feature: GET_TAGS,\n })\n )\n break\n\n case `${GET_TAGS} ${API_SUCCESS}`:\n dispatch(setAutoComplete(action.payload))\n break\n }\n}\n","import { saveAs } from 'file-saver'\nimport { AnyTranslationsAction, apiRequest, ApiRequestAction, GenerateReportAction, TranslationsActionType } from '../actions'\nimport { i18nMap } from '../reducers/i18n'\nimport { Middleware } from '../store'\nimport { importLanguageJSON } from './i18n'\nimport { selectAvailableLocales } from '../selectors'\n\ntype HandleActions = AnyTranslationsAction\ntype DispatchActions = GenerateReportAction | ApiRequestAction\n\ntype GenerateReportPayload = {\n [key: string]: i18nMap\n}\n\n// getReportPayload imports all languages defined in availableLocales\nconst getReportPayload = async (files: string[]): Promise<GenerateReportPayload> => {\n return files.reduce(async (promise, localeCode) => {\n const payload = await promise\n\n try {\n payload[localeCode] = await importLanguageJSON(`${localeCode}.json`)\n } catch (err) {}\n\n return Promise.resolve(payload)\n }, Promise.resolve({} as GenerateReportPayload))\n}\n\nexport const translationsMiddleware: Middleware<HandleActions, DispatchActions> = ({ dispatch, getState }) => (next) => (action) => {\n next(action)\n switch (action.type) {\n case TranslationsActionType.GENERATE_UI_REPORT:\n const files = selectAvailableLocales(getState()).map((language) => language.value)\n getReportPayload(files).then((payload) => {\n dispatch(\n apiRequest({\n url: `/translations/report`,\n method: 'POST',\n body: payload,\n feature: action.type,\n responseType: 'text',\n })\n )\n })\n\n break\n\n case TranslationsActionType.GENERATE_SCHEMA_REPORT:\n dispatch(\n apiRequest({\n url: `/translations/schemas`,\n method: 'GET',\n feature: action.type,\n })\n )\n break\n\n case TranslationsActionType.GENERATE_ERROR_REPORT:\n dispatch(\n apiRequest({\n url: `/translations/errors`,\n method: 'GET',\n feature: action.type,\n })\n )\n break\n\n case TranslationsActionType.GENERATE_SCHEMA_REPORT_ERROR:\n case TranslationsActionType.GENERATE_UI_REPORT_ERROR:\n case TranslationsActionType.GENERATE_ERROR_REPORT_ERROR:\n console.warn('unable to generate report', action.payload)\n break\n\n case TranslationsActionType.GENERATE_SCHEMA_REPORT_SUCCESS:\n case TranslationsActionType.GENERATE_UI_REPORT_SUCCESS:\n case TranslationsActionType.GENERATE_ERROR_REPORT_SUCCESS: {\n const blob = new Blob([action.payload], { type: 'text/csv;charset=utf-8' })\n let filenamePrefix\n switch (action?.meta?.feature) {\n case TranslationsActionType.GENERATE_UI_REPORT:\n filenamePrefix = 'cc'\n break\n case TranslationsActionType.GENERATE_ERROR_REPORT:\n filenamePrefix = 'api-error'\n break\n default:\n filenamePrefix = 'schema'\n }\n saveAs(blob, `${filenamePrefix}-translations-required.csv`)\n break\n }\n }\n}\n","import {\n apiRequest,\n DeleteTriggerDetailAction,\n DeleteTriggerErrorAction,\n GetTriggerDetailAction,\n GetTriggerDetailSuccessAction,\n GetTriggerListAction,\n GetTriggerListSuccessAction,\n hideLoader,\n hideModal,\n loadTriggerDetail,\n loadTriggersList,\n SaveTriggerDetailAction,\n SaveTriggerDetailSuccessAction,\n setDocuments,\n setSchema,\n setTrigger,\n setTriggerEditorError,\n setTriggerError,\n setTriggers,\n showLoader,\n TriggerActionType,\n unsetTriggerEditorError,\n UpdateTriggerAction,\n} from '../actions'\nimport { Schema } from 'schemas'\nimport config from '../config'\nimport { Middleware } from '../store'\nimport { Scope, V2Response } from '../types'\nimport { focusedOrgSelector, i18n, selecti18n } from '../selectors'\nimport { getV3DefaultOwnerID, IDFromV2 } from '../util'\nimport { Query } from 'redux-first-router'\nimport { ResourceTypeType, Trigger, TriggerKeys, TriggerType } from '../v3/type/Trigger'\nimport { Action, CachedActionIDs } from '../v3/type/Action'\nimport { cachedActionsSelector, triggerScopeSelector, triggerSelector, triggerTitleSelector } from '../selectors/triggers'\nimport { APITriggerCondition, UITriggerCondition } from '../v3/type/Condition'\nimport { conditionsFromConditionDeps, defaultTriggerActionsByType, deserializeTriggerCondition, serializeTriggerCondition } from '../util/triggers'\n\nexport const triggersMiddleware: Middleware = ({ dispatch, getState }) => (next) => (action) => {\n next(action)\n\n const validateTriggerField = (field: string, value: any): string | undefined => {\n // TODO: see about using enums here that are already ready\n let message: string | undefined\n\n switch (field) {\n case 'Name':\n if (value.trim().length <= 2) {\n message = selecti18n(getState(), `rules.detail.page.validateField`)\n }\n break\n case 'Conditions.Status': {\n const val = (value as UITriggerCondition).value\n if (!val || (val as string[]).length === 0) {\n message = selecti18n(getState(), `rules.detail.page.condition.error.message.Status`)\n }\n break\n }\n case 'Conditions.DaysInStatus': {\n const val = Number((value as UITriggerCondition).value)\n if (isNaN(val) || val < 1) {\n message = selecti18n(getState(), `rules.detail.page.condition.error.message.DaysInStatus`)\n }\n break\n }\n case 'Conditions.DaysBetweenReminders': {\n const val = Number((value as UITriggerCondition).value)\n if (isNaN(val)) {\n message = selecti18n(getState(), `rules.detail.page.condition.error.message.DaysBetweenReminders`)\n }\n const trigger = triggerSelector(getState())\n if (trigger.Conditions) {\n const conditions = trigger.Conditions as UITriggerCondition[]\n conditions.forEach((c) => {\n if (c.dataKey === 'TriggerCount') {\n const cVal = Number(c.value)\n const triggerCountAboveTwo = !isNaN(cVal) && cVal >= 2\n const daysBetweenReminder = val < 1\n if (triggerCountAboveTwo && daysBetweenReminder) {\n message = selecti18n(getState(), `rules.detail.page.condition.error.message.DaysBetweenReminders`)\n }\n }\n })\n }\n break\n }\n case 'Conditions.TriggerCount':\n const val = Number((value as UITriggerCondition).value)\n if (isNaN(val)) {\n message = selecti18n(getState(), `rules.detail.page.validateField`)\n }\n const trigger = triggerSelector(getState())\n if (trigger.Conditions) {\n const conditions = trigger.Conditions as UITriggerCondition[]\n conditions.forEach((c) => {\n if (c.dataKey === 'DaysBetweenReminders') {\n const cVal = Number(c.value)\n const triggerCountAboveTwo = !isNaN(val) && val >= 2\n const daysBetweenReminder = cVal < 1\n let secondaryMessage: string | undefined\n if (triggerCountAboveTwo && daysBetweenReminder) {\n secondaryMessage = selecti18n(getState(), `rules.detail.page.condition.error.message.DaysBetweenReminders`)\n }\n dispatch(setTriggerEditorError('Conditions.DaysBetweenReminders', secondaryMessage))\n }\n })\n }\n break\n case 'Actions.Content.URL': // TODO: validate https?\n const action = value as Action\n if (!action.Content || !action.Content.URL || action.Content.URL?.trim().length <= 2) {\n message = selecti18n(getState(), `rules.detail.page.validateField`)\n }\n break\n case 'ResourceType':\n if (value === '') {\n message = selecti18n(getState(), `rules.detail.page.validateField`)\n }\n break\n case 'Conditions.NotifyParentOrgs':\n case 'Description':\n case 'Actions':\n case 'Conditions':\n case 'Type':\n case 'Status':\n case 'EffectiveDate':\n case 'Actions.Description':\n case 'Actions.Name':\n case 'ID':\n case 'ReadOnly':\n case 'CreatedAt':\n case 'CreatedBy':\n case 'UpdatedAt':\n case 'UpdatedBy':\n case 'OwnerID':\n case 'Executions':\n case 'LastProcessed':\n case 'Cronjob':\n // these field don't need validation\n break\n default:\n console.warn('unknown trigger field encountered while validating:', field)\n }\n\n return message\n }\n\n const cacheActions = () => {\n const state = getState()\n Object.values(CachedActionIDs).forEach((id: string) => {\n const action = cachedActionsSelector(state).find((act) => {\n return act.ID === id\n })\n if (!action) {\n dispatch(\n apiRequest({\n url: `${config.v3Api}/action/${id}`,\n method: 'GET',\n feature: TriggerActionType.GET_CACHED_ACTIONS,\n scope: Scope.PlatformSystem,\n asOwnerOverride: getV3DefaultOwnerID(),\n })\n )\n }\n })\n }\n\n switch (action.type) {\n case TriggerActionType.LIST_GET: {\n const state = getState()\n const { location } = state\n const { query } = location\n const act = action as GetTriggerListAction\n dispatch(showLoader(action.type))\n cacheActions()\n dispatch(\n apiRequest({\n url: `${config.v3Api}/trigger`,\n method: 'GET',\n params: query,\n feature: TriggerActionType.LIST_GET,\n scope: act.payload.scope,\n })\n )\n break\n }\n\n case TriggerActionType.LIST_GET_SUCCESS:\n const act = action as GetTriggerListSuccessAction\n dispatch(\n setDocuments(({\n totalCount: act.payload.length,\n } as unknown) as V2Response)\n )\n dispatch(setTriggers(act.payload))\n dispatch(setTriggerError(undefined))\n dispatch(hideLoader(TriggerActionType.LIST_GET))\n break\n\n case TriggerActionType.DETAIL_GET: {\n const act = action as GetTriggerDetailAction\n const state = getState()\n const query = state.location.query ?? ({} as Query)\n query._preload = 'Actions'\n\n dispatch(showLoader(act.type))\n cacheActions()\n\n const org = focusedOrgSelector(state)\n\n if (act.payload.id === 'new') {\n let ownerID = IDFromV2(org!.ID)\n if (act.payload.scope === Scope.PlatformSystem) {\n ownerID = getV3DefaultOwnerID()\n }\n const trigger = {\n ResourceType: ResourceTypeType.LeadsCreated,\n Name: '',\n Type: TriggerType.LeadCreatedTrigger,\n Status: true,\n EffectiveDate: new Date().toISOString(),\n OwnerID: ownerID,\n Actions: defaultTriggerActionsByType(TriggerType.LeadCreatedTrigger, []),\n } as Trigger\n dispatch({ type: TriggerActionType.DETAIL_GET_SUCCESS, payload: [trigger] })\n } else {\n dispatch(\n apiRequest({\n url: `${config.v3Api}/trigger/${act.payload.id}`,\n method: 'GET',\n params: query,\n feature: TriggerActionType.DETAIL_GET,\n scope: act.payload.scope,\n })\n )\n }\n break\n }\n\n case TriggerActionType.DETAIL_GET_SUCCESS: {\n const act = action as GetTriggerDetailSuccessAction\n const payload = act.payload[0]\n\n if (payload.Conditions) {\n const deserialized: UITriggerCondition[] = (payload.Conditions as APITriggerCondition[]).map((cond: APITriggerCondition) => {\n return deserializeTriggerCondition(i18n(getState()), cond)\n })\n\n payload.Conditions = conditionsFromConditionDeps(deserialized)\n }\n\n dispatch(setTrigger(payload, true))\n dispatch(setTriggerError(undefined))\n dispatch(unsetTriggerEditorError())\n // Don't display a count\n dispatch(\n setDocuments(({\n totalCount: -1,\n } as unknown) as V2Response)\n )\n dispatch(\n setSchema({\n resource: 'trigger',\n label: triggerTitleSelector(getState()),\n } as Schema)\n )\n dispatch(hideLoader(TriggerActionType.DETAIL_GET))\n break\n }\n\n case TriggerActionType.SAVE_TRIGGER: {\n dispatch(showLoader(action.type))\n const state = getState()\n let trigger = (action as SaveTriggerDetailAction).payload\n let hasError = false\n\n for (const [key, value] of Object.entries(trigger)) {\n switch (key) {\n case 'Actions': {\n if (trigger.Type === TriggerType.LeadRemindersTrigger) break\n const values = trigger[key] as Action[] | undefined\n if (!values) break\n for (let i = 0; i < values.length; i++) {\n const fieldErr = validateTriggerField('Actions.Content.URL', values[i])\n if (fieldErr) {\n hasError = true\n }\n dispatch(setTriggerEditorError('Actions.Content.URL', fieldErr))\n }\n break\n }\n case 'Conditions': {\n const values = trigger[key] as UITriggerCondition[] | undefined\n if (!values) break\n for (let i = 0; i < values.length; i++) {\n const condition = values[i]\n const fieldErr = validateTriggerField(`Conditions.${condition.dataKey}`, condition)\n if (fieldErr) {\n hasError = true\n }\n dispatch(setTriggerEditorError(`Conditions.${condition.dataKey}` as TriggerKeys, fieldErr))\n }\n break\n }\n default:\n const fieldErr = validateTriggerField(key, value)\n if (fieldErr) {\n hasError = true\n }\n dispatch(setTriggerEditorError(key as TriggerKeys, fieldErr))\n }\n }\n\n if (hasError) {\n dispatch(hideLoader(action.type))\n break\n }\n\n if (trigger.Conditions) {\n const serialized: APITriggerCondition[] = (trigger.Conditions as UITriggerCondition[]).map((cond: UITriggerCondition) => {\n return serializeTriggerCondition(cond)\n })\n trigger = {\n ...trigger,\n Conditions: serialized,\n }\n }\n\n const createTrigger = !trigger.ID || trigger.ID === ''\n\n dispatch(\n apiRequest({\n url: createTrigger ? `${config.v3Api}/trigger` : `${config.v3Api}/trigger/${trigger.ID}`,\n method: createTrigger ? 'POST' : 'PUT',\n feature: action.type,\n scope: triggerScopeSelector(state),\n body: trigger,\n })\n )\n\n break\n }\n\n case TriggerActionType.SAVE_TRIGGER_SUCCESS:\n const state = getState()\n let updatedTrigger = (action as SaveTriggerDetailSuccessAction).payload\n if (updatedTrigger.Conditions) {\n const deserialized: UITriggerCondition[] = (updatedTrigger.Conditions as APITriggerCondition[]).map((cond: APITriggerCondition) => {\n return deserializeTriggerCondition(i18n(getState()), cond)\n })\n updatedTrigger = {\n ...updatedTrigger,\n Conditions: deserialized,\n }\n }\n const stateTrigger = triggerSelector(state)\n\n dispatch(setTrigger(updatedTrigger))\n dispatch(hideLoader(TriggerActionType.SAVE_TRIGGER))\n // If the trigger in state does not have an ID - it was a new trigger and we need to redirect and reload.\n if (!stateTrigger.ID || stateTrigger.ID === '') {\n dispatch(loadTriggerDetail(triggerScopeSelector(state), updatedTrigger.ID))\n }\n break\n\n case TriggerActionType.DELETE_TRIGGER: {\n const state = getState()\n const trigger = (action as DeleteTriggerDetailAction).payload\n\n dispatch(showLoader(action.type))\n dispatch(hideModal())\n dispatch(\n apiRequest({\n url: `${config.v3Api}/trigger/${trigger.ID}`,\n method: 'DELETE',\n feature: action.type,\n body: trigger,\n scope: triggerScopeSelector(state),\n })\n )\n break\n }\n\n case TriggerActionType.DELETE_TRIGGER_SUCCESS: {\n dispatch(setTriggerError(undefined))\n dispatch(loadTriggersList(triggerScopeSelector(getState())))\n dispatch(hideLoader(TriggerActionType.DELETE_TRIGGER))\n break\n }\n\n case TriggerActionType.DELETE_TRIGGER_ERROR:\n // Note: this will trigger the general error screen - its very hard to actually trigger a deletion error in the first place.\n dispatch(setTriggerError((action as DeleteTriggerErrorAction).payload.message))\n dispatch(hideLoader(TriggerActionType.DELETE_TRIGGER))\n break\n\n case TriggerActionType.UPDATE_TRIGGER: {\n const state = getState()\n const { field, value } = (action as UpdateTriggerAction).payload\n\n const fieldErr = validateTriggerField(field, value)\n dispatch(setTriggerEditorError(field, fieldErr))\n\n const wip = triggerSelector(state)\n let updatedValue = value\n let fieldKey = field\n\n const primaryField = field.substring(0, field.indexOf('.'))\n switch (primaryField) {\n case 'Conditions':\n const conditions = wip.Conditions as UITriggerCondition[]\n const conditionValue = value as UITriggerCondition\n\n updatedValue = conditions.map((condition: UITriggerCondition) => {\n if (condition.type === conditionValue.type) {\n return value\n }\n return condition\n })\n updatedValue = conditionsFromConditionDeps(updatedValue)\n fieldKey = primaryField\n break\n case 'Actions':\n updatedValue = [value]\n fieldKey = primaryField\n break\n }\n\n dispatch(\n setTrigger({\n ...wip,\n [fieldKey]: updatedValue,\n })\n )\n break\n }\n }\n}\n","import _ from 'lodash'\nimport { clearNotification, CREATE_NOTIFICATION } from '../actions/ui'\nimport { Middleware } from '../store'\n\nexport const uiMiddleware: Middleware = ({ dispatch }) => (next) => (action) => {\n next(action)\n\n switch (action.type) {\n case CREATE_NOTIFICATION:\n setTimeout(() => {\n dispatch(clearNotification())\n }, _.get(action, 'payload.autoHideDuration', 2500))\n break\n }\n}\n","import {\n API_ERROR,\n apiRequest,\n GetContentConfigsAction,\n GetContentConfigsSuccessAction,\n GetLeadTypesSuccessAction,\n hideLoader,\n loadLeadsList,\n reloadV3Lead,\n SaveV3LeadAction,\n setDocument,\n setDocuments,\n setSchema,\n setSchemaCategory,\n setV3ContentConfigs,\n setV3Lead,\n setV3Leads,\n setV3LeadTypes,\n showLoader,\n V3LeadActionTypes,\n} from '../actions'\nimport config from '../config'\nimport {\n i18n,\n readyForV3Filters,\n selectFilterOptionStringsByKey,\n selectLeadStatusToStageSetting,\n selectLeadTypeEnums,\n selectPartialV3LeadForPatch,\n v3LeadQueryRequestConfigSelector,\n} from '../selectors'\nimport { Middleware } from '../store'\nimport { Lead, V2Response } from '../types'\nimport { getLeadName, marshalQueriedLeadsToLeads } from '../util'\nimport { getV3LeadsMockSchema, V3LeadsCategory } from '../schemas/v3Mocks'\nimport { selectLeadStageEnums, selectLeadStatusEnums } from '../selectors/contentConfig'\nimport { saveAs } from 'file-saver'\n\nexport const v3LeadsMiddleware: Middleware = ({ dispatch, getState }) => (next) => (action) => {\n next(action)\n\n switch (action.type) {\n // GET_LEADS fetch leads from v3 api\n case V3LeadActionTypes.GET_LEADS: {\n dispatch(showLoader(V3LeadActionTypes.GET_LEADS))\n dispatch(setSchemaCategory(V3LeadsCategory))\n dispatch(\n apiRequest({\n url: `${config.v3Api}/lead/query`,\n method: 'POST',\n feature: V3LeadActionTypes.GET_LEADS,\n body: v3LeadQueryRequestConfigSelector(getState()),\n })\n )\n break\n }\n\n // GET_LEAD retrieves a single lead by id from the v3 api\n case V3LeadActionTypes.GET_LEAD: {\n // It is possible to trigger GET_LEAD from a payload that is either a QueriedLead or Lead object type,\n // which use different capitalization for the ID/id field.\n let payloadID: string = action?.payload?.id\n if (!payloadID || payloadID === '') {\n payloadID = action?.payload?.ID\n }\n dispatch(showLoader(V3LeadActionTypes.GET_LEAD))\n dispatch(\n apiRequest({\n url: `${config.v3Api}/lead/${payloadID}?_related=Organization&_preload=Activities,Notes`,\n method: 'GET',\n feature: V3LeadActionTypes.GET_LEAD,\n })\n )\n break\n }\n\n case V3LeadActionTypes.SAVE_LEAD: {\n dispatch(showLoader(V3LeadActionTypes.SAVE_LEAD))\n const { payload } = action as SaveV3LeadAction\n\n const diff = selectPartialV3LeadForPatch(getState())\n\n dispatch(hideLoader(V3LeadActionTypes.SAVE_LEAD))\n\n // AB#12017 - SM 6/30/2023\n //\n // The scope of a user's filters and the PATCH request can become out of sync.\n // This scope is only saved in redux storage,\n // so any reloading of the page resets it to the default of `includeDescendants`.\n //\n // If a user does this while editing a Lead in their memberships but NOT under their focused org,\n // the Lead will not be found by the platform, because the As-Owner header will not match the Lead Owner.\n //\n // This is due to incorrect filter handling elsewhere in the app, but breaks the most here.\n // Therefore, it is assumed that if you can see the lead, you can update it, and the ownerID for the request is\n // manually overridden.\n //\n // This can likely be removed once the rest of the filter handling is fixed.\n\n dispatch(\n apiRequest({\n url: `${config.v3Api}/lead/${payload.ID}`,\n method: 'PATCH',\n body: diff,\n feature: V3LeadActionTypes.SAVE_LEAD,\n asOwnerOverride: payload.OwnerID,\n })\n )\n break\n }\n\n // handle GET_LEADS (multiple) api success\n case V3LeadActionTypes.GET_LEADS_SUCCESS: {\n const { data, total } = action.payload\n const leads: Lead[] = marshalQueriedLeadsToLeads(data)\n const state = getState()\n const schema = getV3LeadsMockSchema(\n i18n(state),\n selectLeadStatusEnums(state, false),\n selectLeadTypeEnums(state),\n selectLeadStageEnums(state),\n selectFilterOptionStringsByKey(state, 'Stage', false),\n selectLeadStatusToStageSetting(state)\n )\n dispatch(setSchema(schema))\n dispatch(setV3Leads(leads))\n dispatch(setDocuments({ totalCount: total } as V2Response))\n dispatch(hideLoader(V3LeadActionTypes.GET_LEADS))\n break\n }\n\n // handle GET_LEAD (single) api success\n case V3LeadActionTypes.GET_LEAD_SUCCESS: {\n dispatch(setV3Lead(action.payload))\n const state = getState()\n const schema = getV3LeadsMockSchema(\n i18n(state),\n selectLeadStatusEnums(state, false),\n selectLeadTypeEnums(state),\n selectLeadStageEnums(state),\n selectFilterOptionStringsByKey(state, 'Stage', false),\n selectLeadStatusToStageSetting(state)\n )\n dispatch(setSchema(schema))\n // The name is mocked as a document field for the AppBar title\n dispatch(\n setDocument({\n name: getLeadName(action.payload),\n })\n )\n dispatch(hideLoader(V3LeadActionTypes.GET_LEAD))\n break\n }\n\n case V3LeadActionTypes.SAVE_LEAD_SUCCESS: {\n dispatch(showLoader(V3LeadActionTypes.RELOAD_LEAD))\n // Workaround for AB#14128 - we need to force a reload of the lead state in order to reflect\n // changes like the Stage field, and the DetailView component expects the additional information\n // appended in the getV3Lead query, so it is easiest to just query for it again.\n if (action && action.payload && (action.payload.ID || action.payload.id)) {\n dispatch(reloadV3Lead(action.payload.ID))\n }\n dispatch(hideLoader(V3LeadActionTypes.SAVE_LEAD))\n break\n }\n\n case V3LeadActionTypes.RELOAD_LEAD: {\n dispatch(showLoader(V3LeadActionTypes.RELOAD_LEAD))\n dispatch(\n apiRequest({\n url: `${config.v3Api}/lead/${action.payload}?_related=Organization&_preload=Activities,Notes`,\n method: 'GET',\n feature: V3LeadActionTypes.RELOAD_LEAD,\n })\n )\n break\n }\n\n case V3LeadActionTypes.RELOAD_LEAD_SUCCESS: {\n dispatch(setV3Lead(action.payload))\n dispatch(hideLoader(V3LeadActionTypes.RELOAD_LEAD))\n break\n }\n\n case `${V3LeadActionTypes.GET_LEADS} ${API_ERROR}`: {\n dispatch(hideLoader(V3LeadsCategory))\n break\n }\n\n case V3LeadActionTypes.GET_LEAD_ERROR: {\n dispatch(hideLoader(V3LeadsCategory))\n break\n }\n\n case V3LeadActionTypes.GET_CONTENT_CONFIGS: {\n const { trunkID } = action as GetContentConfigsAction\n showLoader(V3LeadActionTypes.GET_CONTENT_CONFIGS)\n dispatch(\n apiRequest({\n url: `${config.v3Api}/organization/${trunkID}/contentconfig`,\n method: 'GET',\n feature: V3LeadActionTypes.GET_CONTENT_CONFIGS,\n })\n )\n break\n }\n\n case V3LeadActionTypes.GET_CONTENT_CONFIGS_SUCCESS: {\n const { payload } = action as GetContentConfigsSuccessAction\n if (!payload.fields || payload.fields.length === 0) {\n break\n }\n\n dispatch(setV3ContentConfigs(payload.fields))\n hideLoader(V3LeadActionTypes.GET_CONTENT_CONFIGS)\n if (readyForV3Filters(getState())) {\n dispatch(loadLeadsList())\n }\n break\n }\n\n case V3LeadActionTypes.GET_LEAD_TYPES: {\n showLoader(V3LeadActionTypes.GET_LEAD_TYPES)\n dispatch(\n apiRequest({\n url: `${config.v3Api}/lead/type`,\n method: 'GET',\n feature: V3LeadActionTypes.GET_LEAD_TYPES,\n })\n )\n break\n }\n\n case V3LeadActionTypes.GET_LEAD_TYPES_SUCCESS: {\n const { payload } = action as GetLeadTypesSuccessAction\n dispatch(setV3LeadTypes(payload || []))\n showLoader(V3LeadActionTypes.GET_LEAD_TYPES)\n if (readyForV3Filters(getState())) {\n dispatch(loadLeadsList())\n }\n break\n }\n\n case V3LeadActionTypes.EXPORT_LEADS: {\n dispatch(showLoader(V3LeadActionTypes.EXPORT_LEADS))\n dispatch(\n apiRequest({\n url: `${config.v3Api}/lead/export/csv`,\n method: 'POST',\n responseType: 'blob',\n feature: action.type,\n body: v3LeadQueryRequestConfigSelector(getState()),\n })\n )\n break\n }\n\n case V3LeadActionTypes.EXPORT_LEADS_SUCCESS: {\n const blob = new Blob([action.payload], { type: 'text/csv;charset=utf-8' })\n saveAs(blob, `leads-${new Date().getTime()}.csv`)\n }\n }\n}\n","import { Middleware } from '../store'\nimport {\n API_ERROR,\n API_SUCCESS,\n apiRequest,\n getV3DownstreamOrgs,\n getV3Organization,\n getV3UpstreamOrgs,\n hideLoader,\n setV3Organization,\n setV3Organizations,\n showLoader,\n V3OrganizationActionTypes,\n} from '../actions'\nimport config from '../config'\nimport { IDFromV2 } from '../util'\n\nexport const v3OrganizationsMiddleware: Middleware = ({ dispatch, getState }) => (next) => (action) => {\n next(action)\n\n const state = getState()\n const org = state?.session?.organization\n if (!org) {\n return\n }\n\n switch (action.type) {\n case V3OrganizationActionTypes.GET_ORGANIZATIONS: {\n dispatch(showLoader(V3OrganizationActionTypes.GET_ORGANIZATIONS))\n dispatch(\n apiRequest({\n url: `${config.v3Api}/organization`,\n method: 'GET',\n feature: V3OrganizationActionTypes.GET_ORGANIZATIONS,\n })\n )\n break\n }\n\n case V3OrganizationActionTypes.GET_ORGANIZATION: {\n dispatch(showLoader(V3OrganizationActionTypes.GET_ORGANIZATION))\n dispatch(\n apiRequest({\n url: `${config.v3Api}/organization/${action.payload.id}`,\n method: 'GET',\n feature: V3OrganizationActionTypes.GET_ORGANIZATION,\n })\n )\n break\n }\n\n // GET_ORG_HIERARCHY dispatches calls to retrieve organizations in the hierarchy of the focused org\n case V3OrganizationActionTypes.GET_ORG_HIERARCHY: {\n const { session } = state\n dispatch(getV3Organization(IDFromV2(session.organization.ID)))\n break\n }\n\n case V3OrganizationActionTypes.GET_DOWNSTREAM_ORGS: {\n dispatch(showLoader(V3OrganizationActionTypes.GET_DOWNSTREAM_ORGS))\n dispatch(\n apiRequest({\n url: `${config.v3Api}/organization/${action.payload.id}/downstream`,\n method: 'GET',\n feature: V3OrganizationActionTypes.GET_DOWNSTREAM_ORGS,\n })\n )\n break\n }\n\n case V3OrganizationActionTypes.GET_UPSTREAM_ORGS: {\n dispatch(showLoader(V3OrganizationActionTypes.GET_UPSTREAM_ORGS))\n dispatch(\n apiRequest({\n url: `${config.v3Api}/organization/${action.payload.id}/upstream`,\n method: 'GET',\n feature: V3OrganizationActionTypes.GET_UPSTREAM_ORGS,\n })\n )\n break\n }\n\n case `${V3OrganizationActionTypes.GET_DOWNSTREAM_ORGS} ${API_SUCCESS}`: {\n dispatch(hideLoader(V3OrganizationActionTypes.GET_DOWNSTREAM_ORGS))\n dispatch(setV3Organizations(action.payload))\n break\n }\n\n case `${V3OrganizationActionTypes.GET_UPSTREAM_ORGS} ${API_SUCCESS}`: {\n dispatch(hideLoader(V3OrganizationActionTypes.GET_UPSTREAM_ORGS))\n dispatch(setV3Organizations(action.payload))\n break\n }\n\n case `${V3OrganizationActionTypes.GET_ORGANIZATIONS} ${API_SUCCESS}`: {\n dispatch(hideLoader(V3OrganizationActionTypes.GET_ORGANIZATIONS))\n dispatch(setV3Organizations(action.payload))\n break\n }\n\n case `${V3OrganizationActionTypes.GET_ORGANIZATION} ${API_SUCCESS}`: {\n dispatch(hideLoader(V3OrganizationActionTypes.GET_ORGANIZATION))\n dispatch(setV3Organization(action.payload))\n if (action.payload.TrunkID !== '') {\n dispatch(getV3UpstreamOrgs(action.payload?.ID))\n }\n dispatch(getV3DownstreamOrgs(action.payload?.ID))\n break\n }\n\n case `${V3OrganizationActionTypes.GET_DOWNSTREAM_ORGS} ${API_ERROR}`: {\n dispatch(hideLoader(V3OrganizationActionTypes.GET_DOWNSTREAM_ORGS))\n break\n }\n\n case `${V3OrganizationActionTypes.GET_UPSTREAM_ORGS} ${API_ERROR}`: {\n dispatch(hideLoader(V3OrganizationActionTypes.GET_UPSTREAM_ORGS))\n break\n }\n\n case `${V3OrganizationActionTypes.GET_ORGANIZATIONS} ${API_ERROR}`: {\n dispatch(hideLoader(V3OrganizationActionTypes.GET_ORGANIZATIONS))\n break\n }\n\n case `${V3OrganizationActionTypes.GET_ORGANIZATION} ${API_ERROR}`: {\n dispatch(hideLoader(V3OrganizationActionTypes.GET_ORGANIZATION))\n break\n }\n }\n}\n","import { Enum, Option, OptionType } from '../types'\n\nexport const deduplicateEnumsByValue = (inputArray: Enum[]): Enum[] => {\n return inputArray.reduce((accumulator: Enum[], currentValue) => {\n const existingItem = accumulator.find((item) => item.value === currentValue.value)\n\n if (!existingItem) {\n accumulator.push(currentValue)\n }\n\n return accumulator\n }, [])\n}\n\nexport const enumToOptionEnum = (enums: Enum[]): Option[] => {\n if (enums.length === 0) return []\n return enums.map((e: Enum) => {\n return {\n ...e,\n type: OptionType.Enum,\n }\n })\n}\n","import axios, { AxiosResponse } from 'axios'\n\n// Valid PC error fields:\n// - code / _code: the PC-XXX-XXX error code\n// - message / _message: the actual error message\n// - fault / _fault: Whether a PC service was responsible for the error\n// - inputs / _inputs: The array of inputs that have an error.\nexport const getPCErrorField = (error: unknown, field: string): any | undefined => {\n const errData = getAxiosErrData(error)\n if (!errData) {\n return\n }\n\n let underscored = field\n let nonunderscored = field\n if (field.indexOf('_') === 0) {\n nonunderscored = field.replace('_', '')\n } else {\n underscored = `_${field}`\n }\n\n if (errData.hasOwnProperty(underscored)) {\n return errData[underscored]\n }\n\n if (errData.hasOwnProperty(nonunderscored)) {\n return errData[nonunderscored]\n }\n\n if (errData[nonunderscored]) {\n return errData[nonunderscored]\n }\n\n return\n}\n\nexport const getAxiosErrResponse = (error: unknown): AxiosResponse | undefined => {\n if (!axios.isAxiosError(error)) {\n return\n }\n\n if (!error.response) {\n return\n }\n\n return error.response\n}\n\nconst getAxiosErrData = (error: unknown): any | undefined => {\n const errResp = getAxiosErrResponse(error)\n if (!errResp) {\n return\n }\n\n if (!errResp.data) {\n return\n }\n\n return errResp.data\n}\n","import { Action } from 'redux'\nimport { Resource } from '../resource'\nimport { ApiErrorPayload, ApiSuccessPayload } from './api'\n\nexport const DOC = '[doc]'\n\nexport enum DocumentActionType {\n CLEAR = '[doc] Clear',\n CLOSE_TRANSLATOR = '[doc] Close Translator',\n DELETE = '[doc] Delete',\n DELETE_ERROR = '[doc] Delete API_ERROR',\n DELETE_SUCCESS = '[doc] Delete API_SUCCESS',\n DENY_CHANGES = '[doc] Deny Changes',\n DENY_CHANGES_ERROR = '[doc] Deny Changes API_ERROR',\n DENY_CHANGES_SUCCESS = '[doc] Deny Changes API_SUCCESS',\n DRAFT = '[doc] Draft',\n DRAFT_ERROR = '[doc] Draft API_ERROR',\n DRAFT_SUCCESS = '[doc] Draft API_SUCCESS',\n ERROR = '[doc] Error',\n GET = '[doc] Fetch',\n GET_ERROR = '[doc] Fetch API_ERROR',\n GET_SUCCESS = '[doc] Fetch API_SUCCESS',\n GENERATE_SLUG = '[doc] Generate Slug',\n GENERATE_SLUG_ERROR = '[doc] Generate Slug API_ERROR',\n GENERATE_SLUG_SUCCESS = '[doc] Generate Slug API_SUCCESS',\n LOAD_TRANSLATOR = '[doc] Load Translator',\n PUBLISH_CHANGES = '[doc] Publish Changes',\n PUBLISH_CHANGES_ERROR = '[doc] Publish Changes API_ERROR',\n PUBLISH_CHANGES_SUCCESS = '[doc] Publish Changes API_SUCCESS',\n SAVE = '[doc] Save',\n SAVE_ERROR = '[doc] Save API_ERROR',\n SAVE_SUCCESS = '[doc] Save API_SUCCESS',\n SAVE_USER = '[doc] Save User',\n SAVE_USER_ERROR = '[doc] Save User API_ERROR',\n SAVE_USER_SUCCESS = '[doc] Save User API_SUCCESS',\n SUBMIT_CHANGES = '[doc] Submit Changes',\n SUBMIT_CHANGES_ERROR = '[doc] Submit Changes API_ERROR',\n SUBMIT_CHANGES_SUCCESS = '[doc] Submit Changes API_SUCCESS',\n SET = '[doc] Set',\n SET_DUPLICATE = '[doc] Set Duplicate',\n SET_TRANSLATE = '[doc] Set Translate',\n UPDATE_DOCUMENT = '[doc] Update',\n}\n\ntype DocumentAction = Action<DocumentActionType>\n\ntype ApiSuccessAction = DocumentAction & {\n type:\n | DocumentActionType.DELETE_SUCCESS\n | DocumentActionType.DENY_CHANGES_SUCCESS\n | DocumentActionType.DRAFT_SUCCESS\n | DocumentActionType.GENERATE_SLUG_SUCCESS\n | DocumentActionType.GET_SUCCESS\n | DocumentActionType.PUBLISH_CHANGES_SUCCESS\n | DocumentActionType.SAVE_SUCCESS\n | DocumentActionType.SAVE_USER_SUCCESS\n | DocumentActionType.SUBMIT_CHANGES_SUCCESS\n payload: ApiSuccessPayload\n}\n\ntype ApiErrorAction = DocumentAction & {\n type:\n | DocumentActionType.DELETE_ERROR\n | DocumentActionType.DENY_CHANGES_ERROR\n | DocumentActionType.DRAFT_ERROR\n | DocumentActionType.GENERATE_SLUG_ERROR\n | DocumentActionType.GET_ERROR\n | DocumentActionType.PUBLISH_CHANGES_ERROR\n | DocumentActionType.SAVE_ERROR\n | DocumentActionType.SAVE_USER_ERROR\n | DocumentActionType.SUBMIT_CHANGES_ERROR\n payload: ApiErrorPayload\n}\n\ntype ClearDocumentAction = DocumentAction & {\n type: DocumentActionType.CLEAR\n}\n\nexport const clearDocument = (): ClearDocumentAction => ({\n type: DocumentActionType.CLEAR,\n})\n\ntype CloseTranslatorAction = DocumentAction & {\n type: DocumentActionType.CLOSE_TRANSLATOR\n}\n\nexport const closeTranslator = (): CloseTranslatorAction => ({\n type: DocumentActionType.CLOSE_TRANSLATOR,\n})\n\ntype DeleteDocumentAction = DocumentAction & {\n type: DocumentActionType.DELETE\n id: string\n}\n\nexport const deleteDocument = (id: string): DeleteDocumentAction => ({\n type: DocumentActionType.DELETE,\n id,\n})\n\ntype DenyChangesAction = DocumentAction & {\n type: DocumentActionType.DENY_CHANGES\n documentID: string\n denialReason: string\n}\n\nexport const denyChanges = (documentID: string, denialReason: string): DenyChangesAction => ({\n type: DocumentActionType.DENY_CHANGES,\n documentID,\n denialReason,\n})\n\ntype DraftDocumentAction = DocumentAction & {\n type: DocumentActionType.DRAFT\n}\n\nexport const draftDocument = (): DraftDocumentAction => ({\n type: DocumentActionType.DRAFT,\n})\n\ntype GenerateSlugAction = DocumentAction & {\n type: DocumentActionType.GENERATE_SLUG\n slug: string\n name: string\n}\n\nexport const generateSlug = (slug: string, name: string): GenerateSlugAction => ({\n type: DocumentActionType.GENERATE_SLUG,\n slug,\n name,\n})\n\ntype GetDocumentAction = DocumentAction & {\n type: DocumentActionType.GET\n id: string\n duplicatedFrom?: string\n}\n\nexport const getDocument = (id: string, duplicatedFrom?: string): GetDocumentAction => ({\n type: DocumentActionType.GET,\n id,\n duplicatedFrom,\n})\n\ntype LoadDocumentTranslatorAction = DocumentAction & {\n type: DocumentActionType.LOAD_TRANSLATOR\n}\n\nexport const loadDocumentTranslator = (): LoadDocumentTranslatorAction => ({\n type: DocumentActionType.LOAD_TRANSLATOR,\n})\n\ntype PublishChangesAction = DocumentAction & {\n type: DocumentActionType.PUBLISH_CHANGES\n}\n\nexport const publishChanges = (): PublishChangesAction => ({\n type: DocumentActionType.PUBLISH_CHANGES,\n})\n\ntype SaveDocumentAction = DocumentAction & {\n type: DocumentActionType.SAVE\n}\n\nexport const saveDocument = (): SaveDocumentAction => ({\n type: DocumentActionType.SAVE,\n})\n\ntype SetDocumentAction = DocumentAction & {\n type: DocumentActionType.SET\n document: any\n}\n\nexport const setDocument = (document: any): SetDocumentAction => ({\n type: DocumentActionType.SET,\n document,\n})\n\ntype SetDuplicateAction = DocumentAction & {\n type: DocumentActionType.SET_DUPLICATE\n duplicatedFrom: Resource\n}\n\nexport const setDuplicate = (duplicatedFrom: Resource): SetDuplicateAction => ({\n type: DocumentActionType.SET_DUPLICATE,\n duplicatedFrom,\n})\n\nexport type SetErrorAction = DocumentAction & {\n type: DocumentActionType.ERROR\n error: object\n}\n\nexport const setError = (error: object): SetErrorAction => ({\n type: DocumentActionType.ERROR,\n error,\n})\n\ntype SetTranslateAction = DocumentAction & {\n type: DocumentActionType.SET_TRANSLATE\n translatedFrom: Resource\n}\n\nexport const setTranslate = (translatedFrom: Resource): SetTranslateAction => ({\n type: DocumentActionType.SET_TRANSLATE,\n translatedFrom,\n})\n\ntype SubmitChangesAction = DocumentAction & {\n type: DocumentActionType.SUBMIT_CHANGES\n}\n\nexport const submitChanges = (): SubmitChangesAction => ({\n type: DocumentActionType.SUBMIT_CHANGES,\n})\n\ntype UpdateDocumentAction = DocumentAction & {\n type: DocumentActionType.UPDATE_DOCUMENT\n document: any\n}\n\nexport const updateDocument = (document: any): UpdateDocumentAction => ({\n type: DocumentActionType.UPDATE_DOCUMENT,\n document,\n})\n\nexport type AnyDocumentAction =\n | ApiErrorAction\n | ApiSuccessAction\n | ClearDocumentAction\n | CloseTranslatorAction\n | DeleteDocumentAction\n | DenyChangesAction\n | DraftDocumentAction\n | GenerateSlugAction\n | GetDocumentAction\n | LoadDocumentTranslatorAction\n | PublishChangesAction\n | SaveDocumentAction\n | SetDocumentAction\n | SetDuplicateAction\n | SetErrorAction\n | SetTranslateAction\n | SubmitChangesAction\n | UpdateDocumentAction\n","import { Audit } from '../types'\n\nexport type Resource = {\n ID: string\n audit?: Audit\n locale?: string\n localeID?: string\n organizationID?: string\n trunkID?: string\n}\n\nexport const isResource = (doc: any): doc is Resource => {\n return (doc as Resource).ID !== undefined\n}\n\nexport type DuplicableResource = Resource & {\n duplicatedFromID?: string\n duplicatedFromLocaleID?: string\n}\n\nexport const isDuplicate = (doc: Resource): doc is DuplicableResource => {\n return (doc as DuplicableResource).duplicatedFromID !== undefined\n}\n\nexport type StatusResource = Resource & {\n status: string\n}\n\nexport const hasStatus = (doc: Resource): doc is StatusResource => {\n return (doc as StatusResource).status !== undefined\n}\n\nexport type ExternalIDResource = Resource & {\n externalID: string\n}\n\nexport const hasExternalID = (doc: Resource): doc is ExternalIDResource => {\n return (doc as ExternalIDResource).externalID !== undefined\n}\n\nexport type SlugResource = Resource & {\n slug: string\n pcTitle?: string\n name?: string\n}\n\nexport const hasSlug = (doc: Resource): doc is SlugResource => {\n return doc.ID !== '' && (doc as SlugResource).slug !== undefined\n}\n\nexport function getSlugableField(doc: SlugResource): string {\n return doc.pcTitle || doc.name || ''\n}\n\nexport const getResourceTitle = (resource: Resource): string => {\n if (!resource) {\n return ''\n }\n const { pcTitle, name, ID } = resource as any\n let title = ''\n if (pcTitle) {\n title = pcTitle\n } else if (name) {\n title = name\n } else if (ID) {\n title = ID\n }\n if (title) {\n title = title.trim()\n }\n return title\n}\n","import { isObject, uniqueId } from 'lodash'\nimport React, { Component } from 'react'\nimport { formatModifiedByMessage } from '../../schemas'\nimport FieldMessage from '../FieldMessage/FieldMessage'\nimport JSONEditor from '../JSONEditor/JSONEditor'\nimport './TextField.scss'\nimport { genCIAttr } from '../../util'\n\nconst TextJSON = 'textjson'\n\ntype onClickHandler = (event: React.MouseEvent) => void\n\ntype Props = {\n className?: string\n clearIcon?: any\n defaultValue?: string\n disabled?: boolean\n error?: any\n fieldKey?: string\n id?: string\n label?: string\n leftIcon?: any\n maxLength?: number\n modifiedAt?: number\n modifiedBy?: string\n name?: string\n onChange?: (value: string) => void\n onClick?: (event: React.MouseEvent) => void\n onInput?: (value: string) => void\n onKeyDown?: (event: React.KeyboardEvent) => void\n onLeftIconClick?: (event: React.MouseEvent) => void\n onRightIconClick?: (event: React.MouseEvent) => void\n placeholder?: string\n presentationOptions?: any\n readOnly?: boolean\n required?: boolean\n rightIcon?: any\n symbol?: any\n testID?: string\n type?: string\n value?: string\n}\n\ntype State = {\n error?: any\n isControlled: boolean\n isFocused: boolean\n value: string\n}\n\nexport default class Text extends Component<Props, State> {\n state: State\n input = React.createRef<HTMLInputElement>()\n uniqueFieldId = ''\n jsonEditor = React.createRef<JSONEditor>()\n\n static getDerivedStateFromProps = ({ value: propsValue }: Props, nextState: State) => {\n // only update state if isControlled and state value != props value\n const { isControlled, value: stateValue } = nextState\n\n if (isControlled && propsValue !== stateValue) {\n return {\n ...nextState,\n value: propsValue,\n }\n }\n return null\n }\n\n constructor(props: Props) {\n super(props)\n const { defaultValue = '', fieldKey, value } = props\n\n this.state = {\n isControlled: typeof value !== undefined,\n isFocused: false,\n value: value || defaultValue,\n }\n\n const key = fieldKey || 'field-ID'\n this.uniqueFieldId = uniqueId(`${key}`)\n }\n\n handleInputBlur = () => {\n if (this.input.current) {\n this.onBlur(this.input.current.value)\n }\n }\n\n handleInputFocus = () => {\n this.setState({\n ...this.state,\n isFocused: true,\n })\n }\n\n handleTextInput = (event: React.FormEvent<HTMLInputElement>) => {\n const value = event.currentTarget.value\n this.setState({\n ...this.state,\n value,\n })\n this.onValue(value)\n }\n\n handleJSONBlur = () => this.onBlur(this.state.value)\n\n handleJSONInput = (value: string, _event: any) => {\n this.setState(\n {\n ...this.state,\n value,\n error: undefined,\n },\n () => this.onValue(value)\n )\n }\n\n handleJSONErr = (error: string, _value?: string) => {\n this.setState({\n ...this.state,\n error,\n })\n }\n\n focusJSONEditor = () => {\n if (this.jsonEditor.current) {\n this.setState({\n ...this.state,\n isFocused: true,\n })\n this.jsonEditor.current.focus()\n }\n }\n\n onBlur = (value: string) => {\n const { onChange } = this.props\n\n this.setState({\n ...this.state,\n isFocused: false,\n })\n\n if (onChange) {\n onChange(value)\n }\n }\n\n onValue = (value: string) => {\n const { onInput } = this.props\n\n if (onInput) {\n onInput(value)\n }\n }\n\n renderField = () => {\n const { type } = this.props\n\n switch (type) {\n case TextJSON:\n return this.renderJSONInput()\n\n default:\n return this.renderTextInput()\n }\n }\n\n renderJSONInput = () => {\n const { disabled, name, placeholder = '', presentationOptions = {}, readOnly } = this.props\n const { value } = this.state\n const { requireValidJSON } = presentationOptions\n\n return (\n <div className=\"field\">\n <JSONEditor\n name={name}\n value={value}\n placeholder={placeholder}\n disabled={disabled || readOnly}\n ref={this.jsonEditor}\n requireValidJSON={requireValidJSON}\n onBlur={this.handleJSONBlur}\n onFocus={this.handleInputFocus}\n onChange={this.handleJSONInput}\n onError={this.handleJSONErr}\n />\n </div>\n )\n }\n\n renderTextInput = () => {\n const {\n fieldKey,\n clearIcon,\n defaultValue,\n disabled,\n leftIcon,\n maxLength,\n name,\n placeholder = '',\n readOnly,\n rightIcon,\n symbol,\n testID,\n type = 'text',\n onClick,\n onKeyDown,\n onLeftIconClick,\n onRightIconClick,\n } = this.props\n\n const { isControlled } = this.state\n let { value } = this.state\n\n if (isObject(value)) {\n value = JSON.stringify(value)\n }\n\n let dataCI = testID\n if (!testID && fieldKey && fieldKey.length > 0) {\n dataCI = fieldKey\n }\n\n return (\n <div className=\"field\">\n {this.renderIcon(leftIcon, clearIcon === 'left', onLeftIconClick)}\n {this.renderSymbol(symbol)}\n <input\n className=\"text\"\n defaultValue={isControlled ? defaultValue : undefined}\n disabled={disabled || readOnly}\n id={this.uniqueFieldId}\n maxLength={maxLength}\n name={name}\n onBlur={this.handleInputBlur}\n onClick={onClick}\n onChange={this.handleTextInput}\n onFocus={this.handleInputFocus}\n onKeyDown={onKeyDown}\n placeholder={placeholder}\n ref={this.input}\n type={type}\n value={value}\n data-ci={genCIAttr('text-field', dataCI, 'input')}\n />\n {this.renderIcon(rightIcon, clearIcon === 'right', onRightIconClick)}\n </div>\n )\n }\n\n renderIcon = (icon: string, clearInput: boolean, onClick?: onClickHandler) => {\n if (icon) {\n if (onClick) {\n const handleClick: onClickHandler = (event) => {\n if (clearInput) {\n if (this.state.isControlled) {\n this.setState(\n {\n ...this.state,\n value: '',\n },\n () => onClick(event)\n )\n } else {\n if (this.input.current) {\n this.input.current.value = ''\n }\n onClick(event)\n }\n }\n }\n\n return <div className={'icon ' + icon} onClick={handleClick} role=\"button\" tabIndex={0} />\n }\n\n return <div className={'icon ' + icon} />\n }\n return undefined\n }\n\n renderText = () => {\n const { label, type } = this.props\n\n if (!label) {\n return this.renderField()\n }\n\n // react-ace does not provide an id for the label htmlFor attribute\n const focusJSONEditor = TextJSON === type ? this.focusJSONEditor : undefined\n\n return (\n <label htmlFor={this.uniqueFieldId} onClick={focusJSONEditor}>\n {label}\n {this.renderField()}\n </label>\n )\n }\n\n renderMessage = () => {\n const error = this.props.error || this.state.error\n if (error) {\n return <FieldMessage error={error} dataCIKey={genCIAttr('text-field-error', this.props.fieldKey)} />\n }\n return undefined\n }\n\n renderSymbol = (symbol: string) => {\n if (symbol) {\n return <div className=\"symbol\">{symbol}</div>\n }\n return undefined\n }\n\n renderModerationMessage = () => {\n const { modifiedBy, modifiedAt = 0 } = this.props\n if (!modifiedBy || !modifiedAt) {\n return undefined\n }\n return <span data-ci=\"moderation-message\">{formatModifiedByMessage(modifiedBy, modifiedAt)}</span>\n }\n\n render() {\n const { className, label, modifiedAt, modifiedBy, placeholder, required, fieldKey } = this.props\n\n let classList = 'TextField'\n if (className) {\n classList += ` ${className}`\n }\n if (this.props.error) {\n classList += ' has-error'\n } else if (this.state.error) {\n classList += ' has-error'\n }\n if (this.props.disabled) {\n classList += ' is-disabled'\n }\n if (this.state.isFocused) {\n classList += ' is-focused'\n }\n if (required) {\n classList += ' is-required'\n }\n // isModified is used to show modified fields in Draft/Pending records so they can be found and approved. - JamesS\n if (modifiedBy && modifiedAt) {\n classList += ' is-modified'\n }\n\n return (\n <div className={classList} data-ci={genCIAttr('text-field', fieldKey)}>\n {this.renderModerationMessage()}\n {this.renderText()}\n {this.renderMessage()}\n </div>\n )\n }\n}\n","/**\n * Generates a concatenated attribute string based on the given parameters.\n * Will return undefined if passed an empty based or empty / undefined key, to allow for using props that could be undefined.\n *\n * @param {string} base - Ideally the type of element, manually defined (ie: TextField == 'text-field', Autocomplete = 'autocomplete').\n * @param {string | undefined} key - The unique key for the element (ie: schema field key or custom string).\n * @param {string} [modifier] - The modifier value for an element (ie: pass 'input' if you're generating for the <input> field of a <TextField> element.\n * @returns {string | undefined} - The generated attribute string or undefined if parameters were invalid.\n */\nexport const genCIAttr = (base: string, key: string | undefined, modifier?: string): string | undefined => {\n if (!key || key.length === 0 || base.length === 0) {\n return\n }\n\n if (modifier && modifier.length > 0) {\n return `${base}-${key}-${modifier}`\n }\n\n return `${base}-${key}`\n}\n","import { format, isToday, isYesterday, parseISO } from 'date-fns'\nimport { I18n } from '../selectors'\n\n// Some objects that use the ISO parser functions could have an undefined date,\n// fall back to epoch 0 if this is the case.\nexport function isoDateSanitize(time: string | undefined): string {\n if (!time) {\n return new Date(0).toISOString()\n }\n return time\n}\n\n// isoDateParser accepts a date is ISO string format and returns a string of the date\n// in 'MM/dd/yyy, H:mm'\n// https://date-fns.org/v1.28.5/docs/format\n// todo: add a flag to return 'dd/mm/yy, hh:mm' for our international friends\nexport function isoDateParser(time: string | undefined): string {\n const sanitizedTime = isoDateSanitize(time)\n const t = parseISO(sanitizedTime)\n\n return format(t, 'MM/dd/yy H:mm')\n}\n\nexport function isoDateParserLocalized(time: string | undefined, i18n: I18n): string {\n const sanitizedTime = isoDateSanitize(time)\n const t = parseISO(sanitizedTime)\n const template = i18n('global.dateTime.format') ?? 'MM/dd/yy H:mm'\n return format(t, template)\n}\n\n// nearRelativeDateParser accepts a date in ISO string format and an i18n selector (for translations), and returns the following:\n// - 'Today | H:mm' if the time is today\n// - 'Yesterday | H:mm' if the time was yesterday\n// - 'MM/dd/yy | H:mm' in all other cases\n// https://date-fns.org/v1.28.5/docs/format\nexport function nearRelativeDateParser(time: string | undefined, i18n: I18n): string {\n const sanitizedTime = isoDateSanitize(time)\n const t = parseISO(sanitizedTime)\n if (isToday(t)) {\n return `${i18n('global.dateTime.today')} | ${format(t, 'H:mm')}`\n }\n\n if (isYesterday(t)) {\n return `${i18n('global.dateTime.yesterday')} | ${format(t, 'H:mm')}`\n }\n\n return format(t, \"MM/dd/yy '|' H:mm\")\n}\n","import { APIFilter, FilterField, FilterFieldKeys, isDateOption, StoredFilters, StoredFiltersForOrg, StoredFiltersForResource } from '../types'\nimport { Field, Schema } from '../schemas'\nimport { getLocalStorage, setLocalStorage } from './localStorage'\nimport config from '../config'\n\n// getStoredFilters handles getting the stored filters.\n// If a filter version isn't present or doesn't match - it will return blank filters for the app to populate.\n// For the purposes of this versioning, all calls to get filters from localstorage should use this function.\nexport const getStoredFilters = (): StoredFilters => {\n const filterVersion: string | null = getLocalStorage(config.filterVersionKey)\n if (!filterVersion || filterVersion !== config.filterVersionCurrent) {\n setLocalStorage(config.filterVersionKey, config.filterVersionCurrent)\n return {}\n }\n\n const filtersFromLocalStorage: StoredFilters | null = getLocalStorage(config.filtersKey)\n if (!filtersFromLocalStorage) return {}\n return filtersFromLocalStorage\n}\n\nexport const getStoredResourceFiltersForOrg = (orgID: string, resource: string): StoredFiltersForResource => {\n const filtersFromLocalStorage = getStoredFilters()\n const orgFilters: StoredFiltersForOrg | undefined = filtersFromLocalStorage[orgID]\n if (!orgFilters) return {}\n const resourceFilters: StoredFiltersForResource | undefined = orgFilters[resource]\n if (!resourceFilters) return {}\n return resourceFilters\n}\n\nexport const setStoredResourceFiltersForOrg = (orgID: string, resource: string, filters: FilterField[]) => {\n const filtersFromLocalStorage: StoredFilters = getLocalStorage(config.filtersKey) ?? {}\n const orgFilters: StoredFiltersForOrg = filtersFromLocalStorage[orgID] ?? {}\n const localStorageFilters: StoredFiltersForResource = {}\n filters.forEach((filter) => {\n // Don't both storing disabled options\n localStorageFilters[filter.key] = filter.selected.filter((opt) => opt.disabled === undefined || !opt.disabled)\n })\n orgFilters[resource] = localStorageFilters\n filtersFromLocalStorage[orgID] = orgFilters\n setLocalStorage(config.filtersKey, filtersFromLocalStorage)\n}\n\n// resetDateFilters remove any existing DateOptions that are stored in local storage.\n// This should be called on new sessions - we always want users to start a session with the default date options.\nexport const resetDateFilters = () => {\n const filtersFromLocalStorage = getStoredFilters()\n if (!filtersFromLocalStorage) return\n\n for (const [_, orgFilters] of Object.entries(filtersFromLocalStorage)) {\n for (const [_, resourceFilters] of Object.entries(orgFilters)) {\n for (const [fieldKey, options] of Object.entries(resourceFilters)) {\n const isDate = options.some((opt) => isDateOption(opt))\n if (isDate) {\n delete resourceFilters[fieldKey]\n }\n }\n }\n }\n setLocalStorage(config.filtersKey, filtersFromLocalStorage)\n}\n\nexport const getDefaultFilterDateRange = (): [number, number] => {\n const today = new Date()\n today.setHours(23, 59, 59, 0)\n\n const oneMonthAgo = new Date()\n oneMonthAgo.setMonth(oneMonthAgo.getMonth() - 1)\n oneMonthAgo.setHours(0, 0, 0, 0)\n\n return [today.getTime() / 1000, oneMonthAgo.getTime() / 1000]\n}\n\nexport const getV3LeadAPIFiltersFromMockSchema = (schema: Schema): APIFilter[] => {\n return schema.fields.reduce((acc: APIFilter[], curr: Field): APIFilter[] => {\n acc.push({\n field: curr,\n fieldPath: [curr.key as FilterFieldKeys],\n })\n return acc\n }, [])\n}\n","import config, { Environment } from '../config'\n\nexport type FocalPoint = {\n x: number\n y: number\n}\n\nexport function toImgixURL(url: string): string {\n const { environment } = config\n\n switch (environment) {\n case Environment.Production:\n return url.replace('s3.amazonaws.com/clients.powerchord.io', 'powerchord.imgix.net')\n\n default:\n // do not replace environment in url because\n // of s3 urls in the wrong environments\n // such as clients-dev showing up in qa\n return url.replace('s3.amazonaws.com/clients-', '').replace('.powerchord.io', '-powerchord.imgix.net')\n }\n}\n\nexport const toImgixFocalDebug = (url: string, fp: FocalPoint): string => {\n if (!url) {\n return ''\n }\n url = toImgixURL(url)\n return `${url}?fp-x=${fp.x}&fp-y=${fp.y}&fp-debug=true`\n}\n\nexport const toImgixThumbnail = (url: string): string => {\n url = toImgixURL(url)\n return `${url}?fit=original&auto=compress,format&h=160&w=160`\n}\n","import { Sort } from '../types'\n\nexport const updateSort = (sort: Sort, columnName: string): Sort => {\n if (sort.column === columnName) {\n return {\n ...sort,\n direction: sort.direction === '-' ? '' : '-',\n }\n } else {\n return {\n column: columnName,\n direction: '',\n }\n }\n}\n","export function prefersDarkMode(): boolean {\n return window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches\n}\n","import { User } from '../types'\n\nexport const getUserName = (user: User): string => {\n return user.preferredName !== '' ? user.preferredName : user.fullName ?? 'Anonymous'\n}\n","// This is duplicative but there seems to be a technical difference\n// between \"default\" and \"system\" semantics, so the two getters\n// are split.\nimport { V3Organization } from '../types'\n\nconst defaultID = '00000000-0000-0000-0000-000000000000'\nexport function getV3DefaultOwnerID(): string {\n return defaultID\n}\n\nexport function getV3SystemOwnerID(): string {\n return defaultID\n}\n\nexport const deduplicateV3Orgs = (a: V3Organization[], b: V3Organization[]): V3Organization[] => {\n return [...a, ...b].reduce((acc: V3Organization[], curr: V3Organization) => {\n if (acc.findIndex((act) => act.ID === curr.ID) < 0) {\n acc.push(curr)\n }\n return acc\n }, [])\n}\n","import { AppState } from 'store'\nimport { IDFromV2 } from '../util'\nimport { Scope } from '../types'\n\nexport type ScopeHeaders = {\n 'As-Owner': string\n 'Owner-Scope': Scope\n}\n\n// scopeHeadersSelector returns headers for scoping v3 requests to a specific Organization & filter type\nexport const scopeHeadersSelector = (state: AppState, ownerScope?: Scope, asOwnerOverride?: string): ScopeHeaders => {\n if (!ownerScope) {\n ownerScope = scopeSelector(state)\n }\n\n const asOwner = IDFromV2(state?.session?.organization?.ID)\n\n const headers: ScopeHeaders = {\n 'Owner-Scope': ownerScope,\n 'As-Owner': '',\n }\n\n switch (ownerScope) {\n case Scope.IncludeDescendants:\n case Scope.Focused:\n headers['As-Owner'] = asOwner\n }\n\n // AB#12017 - SM 6/30/2023\n // If an Owner override is present, use it explicitly.\n // See SAVE_LEAD in middleware/v3Leads for documentation on why this happens.\n if (asOwnerOverride && asOwnerOverride.length > 0) {\n headers['As-Owner'] = asOwnerOverride\n }\n\n return headers\n}\n\nexport const scopeSelector = (state: AppState): Scope => {\n return state?.documents?.scope ?? Scope.IncludeDescendants\n}\n","import { Ownership, ActionDoc } from '../../types/Doc'\n\nexport enum ActionType {\n WebhookHTTPAction = 'action.webhook.http',\n NotificationEmailAction = 'action.notification.email',\n NotificationSMSAction = 'action.notification.sms',\n LeadResponseEmailAction = 'action.lead.response.email',\n SayHelloAction = 'action.say.hello',\n Unspecified = '',\n}\n\nexport enum CachedActionIDs {\n DefaultLeadReminderEmail = '6c43409e-5509-4422-8342-1ac45c7a9019',\n}\n\nexport type Content = {\n LocalizedTemplates?: LocalizedTemplates\n Type: string\n URL?: string\n}\n\ntype ContentKeys = keyof Content\n\nexport type LocalizedTemplates = {\n 'en-US': string\n}\n\nexport type Action = ActionDoc &\n Ownership & {\n ID?: string\n Type: ActionType\n Content?: Content\n Name?: string\n Description?: string\n ApplyToTree: boolean\n }\n\nexport type ActionKeys = keyof Action | `Content.${ContentKeys}`\n\nexport type ActionToUpdate = {\n action: Action\n url: string\n method: 'POST' | 'PUT' | 'DELETE'\n createAssociation?: boolean\n preloadedAssociationID?: string\n}\n","import { cloneDeep as clone } from 'lodash'\nimport { Resource } from '../resource'\nimport { Category } from '../types/Schema'\n\nexport const formatModifiedByMessage = (name: string, date: number) => {\n const d = new Date(date * 1000)\n return `Modified by ${name} | ${d.toLocaleDateString('en-US')}, ${d.toLocaleTimeString(['en-US'], {\n hour: '2-digit',\n minute: '2-digit',\n })}`\n}\n\n// duplicateSchema resets locale schema fields.\n// Used when duplicating a locale to another locale within the same\n// locale group, and should hide the Translations card\nexport const duplicateSchema = (schema: Schema): Schema => {\n const duplicate = clone(schema)\n duplicate.localeGroup = []\n duplicate.fields = duplicate.fields.map((field) => {\n if ('locale' === field.key) {\n if (field?.restrictions?.enums?.length) {\n // our new dupe will create a new locale-group\n // so none of the locale enums should be disabled\n field.restrictions.enums = field.restrictions.enums.map((enumerable) => ({\n ...enumerable,\n disabled: false,\n }))\n }\n }\n return field\n })\n return duplicate\n}\n\n// translationSchema filters locale schema enums by the provided locale.\n// Used when duplicating a locale from a duplication-source locale-group into\n// target locale-group, because command-center does not have locale-group info\n// for target locale-group which describes target locales available for translation\n// should hide the Translations card\nexport const translationSchema = (schema: Schema, locale: string): Schema => {\n const duplicate = duplicateSchema(schema)\n duplicate.fields = duplicate.fields.map((field) => {\n if ('locale' === field.key) {\n if (field?.restrictions?.enums?.length) {\n field.restrictions.enums = field.restrictions.enums.filter((enumerable) => enumerable.value === locale)\n }\n }\n return field\n })\n return duplicate\n}\n\ntype ListConfig = {\n defaultSortDirection: string\n isDefaultSort: boolean\n isDraggable: boolean\n sortOrder: number\n type: string\n}\n\nexport type FilterConfig = {\n defaultValues: string[]\n isFilter: boolean\n presentation: string\n sortOrder: number\n singleSelect: boolean\n additionalOptions: Enum[] | null\n}\n\nexport type Locale = {\n value: string\n translatedID: string\n requiresTitle: boolean\n hasTranslation: boolean\n}\n\nexport type LocaleTranslation = {\n locale: string\n localeID: string\n localeDescription: string\n translation?: Resource\n duplicatedFromTranslation?: Resource\n isPrimary: boolean\n}\n\ntype Modification = {\n path: string[]\n position: number\n modified: number\n modifiedBy: string\n action: string\n previousValue: unknown\n modifiedValue: unknown\n modifications: Modification[]\n}\n\nexport type SetInstruction = {\n from: string\n to: string\n}\n\nexport type AutoComplete = {\n match: string\n resource: string\n set?: SetInstruction[]\n scope?: unknown[]\n textField: string\n valueField: string\n}\n\nexport type Section = {\n ID?: string\n internalOnly: boolean\n label: string\n help: string\n fields: string[][]\n sections?: Section[]\n}\n\n// TODO: the Field type probably needs fixing at this point, there are some\n// fields that have `omitempty` on the platform but are required here\nexport type Field = {\n allowTQL: boolean\n autoComplete?: AutoComplete\n blockOnContentConfiguration: boolean\n dataSource: string\n defaultValue: string\n embeddedTqlAllowed: boolean\n expandable: boolean\n field?: string\n fields: Field[] | null\n filterConfig: FilterConfig\n goTags: unknown\n help: string\n importPath: string\n importedResource: string\n inUse: boolean\n isFilter: boolean\n isImmutable: boolean\n join?: unknown\n key: string\n label: string\n listConfig: ListConfig\n modification: Modification | null\n overRides: unknown\n presentation: string\n presentationOptions?: any\n primitive: string\n restrictions?: Restrictions\n search?: unknown\n showOnList: boolean\n userCanEdit: boolean\n}\n\nexport enum FieldPrimitive {\n String = 'string',\n StringList = 'string_list',\n Object = 'object',\n JoinString = 'joinString',\n}\n\nexport type Restrictions = {\n email: boolean\n enums?: Enum[]\n enumsFrom?: unknown\n max: number\n min: number\n referenceCollection: string\n required: boolean\n step?: number\n}\n\nexport type Enum = {\n disabled: boolean\n label: string\n value: string\n}\n\nexport type Schema = {\n allowTQL: boolean\n availableLocales: Locale[]\n canCreate: boolean\n category?: string\n categories: Category[]\n collection: string\n config: unknown\n dataSource: string\n defaultValue: string\n embeddedTqlAllowed: boolean\n enabled: boolean\n exportConfig: {\n isAllowed: boolean\n allowRealTimeDownload: boolean\n excludedFields: string[]\n }\n fields: Field[]\n filterConfig?: any\n goTags: any\n headerResource: string\n help: string\n icon: string\n importPath: string\n importedResource: string\n inUse: boolean\n isDuplicable: boolean\n isExportable: boolean\n isFilter: boolean\n isImmutable: boolean\n isHeader: boolean\n isLinkable: boolean\n isReadOnly: boolean\n key: string\n label: string\n listConfig?: ListConfig\n localeGroup: LocaleTranslation[]\n many: boolean\n maxFacetHits?: number\n maxValuesPerFacet?: number\n modification?: any\n modifiedCount: number\n overRides?: any\n position?: number\n presentation: string\n primitive: string\n privateSearch: boolean\n publicSearch: boolean\n resource: string\n restrictions: any\n sections?: Section[]\n shouldModerate: boolean\n shouldSyndicate: boolean\n showOnList: boolean\n sideEffects: any[]\n singular: string\n sortOrder: number\n standardSelectors: unknown[]\n statusIsContentConfigurable: boolean\n userCanRead: boolean\n userCanCreate: boolean\n userCanDelete: boolean\n userCanDuplicate: boolean\n userCanEdit: boolean\n}\n","import { Scope, V2Response } from '../types'\n\nexport const DOCS = '[docs]'\n\nexport enum DocumentsActionType {\n GET_DOCUMENTS = '[docs] Fetch',\n SET_DOCUMENTS = '[docs] Set',\n SET_SCOPE = '[docs] Set Scope',\n UPDATE_DOCUMENTS = '[docs] Update',\n}\n\ninterface GetDocumentsAction {\n type: DocumentsActionType.GET_DOCUMENTS\n}\n\nexport const getDocuments = (): GetDocumentsAction => ({\n type: DocumentsActionType.GET_DOCUMENTS,\n})\n\ninterface SetDocumentsAction {\n type: DocumentsActionType.SET_DOCUMENTS\n payload: V2Response\n}\n\nexport const setDocuments = (payload: V2Response): SetDocumentsAction => ({\n type: DocumentsActionType.SET_DOCUMENTS,\n payload,\n})\n\nexport const clearDocuments = (): SetDocumentsAction => ({\n type: DocumentsActionType.SET_DOCUMENTS,\n payload: ({\n data: [],\n } as unknown) as V2Response,\n})\n\ninterface SetScopeAction {\n type: DocumentsActionType.SET_SCOPE\n payload: Scope\n}\n\nexport const setScope = (scope: Scope): SetScopeAction => ({\n type: DocumentsActionType.SET_SCOPE,\n payload: scope,\n})\n\ninterface UpdateDocumentList {\n type: DocumentsActionType.UPDATE_DOCUMENTS\n}\n\nexport const updateDocumentList = (): UpdateDocumentList => ({\n type: DocumentsActionType.UPDATE_DOCUMENTS,\n})\n","import { Field } from '../schemas'\nimport { ApiErrorPayload } from './api'\n\nexport enum FieldActionType {\n SET = '[field] Set',\n SET_SUCCESS = '[field] Set API_SUCCESS',\n VALIDATE = '[field] Validate',\n VALIDATE_ERROR = '[field] Validate API_ERROR',\n VALIDATE_SUCCESS = '[field] Validate API_SUCCESS',\n}\n\nexport type ValidateSuccessPayload = {\n field: Field\n}\n\nexport type SetFieldAction = {\n type: FieldActionType.SET\n payload: {\n fieldSchema: Field\n field: string\n value: any\n skipValidation: boolean\n }\n}\n\nexport const setField = (fieldSchema: Field, field: string, value: any, skipValidation: any): SetFieldAction => {\n return {\n type: FieldActionType.SET,\n payload: {\n fieldSchema,\n field,\n value,\n skipValidation,\n },\n }\n}\n\nexport type ValidateFieldAction = {\n type: FieldActionType.VALIDATE\n payload: {\n resource: string\n field: string\n value: any\n }\n}\n\nexport const validateField = (resource: string, field: string, value: any): ValidateFieldAction => ({\n type: FieldActionType.VALIDATE,\n payload: {\n resource,\n field,\n value,\n },\n})\n\ntype ValidateSuccessAction = {\n type: FieldActionType.VALIDATE_SUCCESS\n payload: ValidateSuccessPayload\n}\n\ntype ValidateErrorAction = {\n type: FieldActionType.VALIDATE_ERROR\n payload: ApiErrorPayload\n}\n\nexport type AnyFieldAction = SetFieldAction | ValidateFieldAction | ValidateErrorAction | ValidateSuccessAction\n","import { Query } from 'redux-first-router' // typechecking for router\nimport { Scope } from '../types'\nimport { V3LeadsCategory } from '../schemas/v3Mocks'\n\nexport const PAGE = '[page]'\nexport const LOGIN_PAGE = '[page] Login'\nexport const EDITOR_PAGE = '[page] Editor'\nexport const LIST_PAGE = '[page] List'\nexport const ACCOUNT_PAGE = '[page] Account'\nexport const SECURITY_PAGE = '[page] Security'\nexport const ARCHITECT_APP = '[page] Architect'\nexport const HOME_PAGE = '[page] Home'\nexport const FORGOT_PASSWORD = '[page] Forgot Password'\nexport const RESET_PASSWORD = '[page] RESET_PASSWORD'\nexport const OLD_SB_ROUTE = '[page] OLD_SB_ROUTE'\nexport const ANALYTICS_PAGE = '[page] Analytics'\nexport const LEADS_LIST = '[page] Leads List'\nexport const LEAD_DETAILS = '[page] Leads Detail'\nexport const TRIGGERS_LIST = '[page] Triggers List'\nexport const TRIGGER_DETAILS = '[page] Trigger Detail'\n\nexport enum EditorMode {\n DUPLICATE = 'duplicate',\n TRANSLATE = 'translate',\n}\n\nexport interface LoadLoginAction {\n type: typeof LOGIN_PAGE\n}\n\nexport const loadLogin = (): LoadLoginAction => ({\n type: LOGIN_PAGE,\n})\n\ninterface LoadHomeAction {\n type: typeof HOME_PAGE\n}\n\nexport const loadHome = (): LoadHomeAction => ({\n type: HOME_PAGE,\n})\n\nexport interface LoadEditorAction {\n type: typeof EDITOR_PAGE\n payload: {\n category: string\n resource: string\n id: string\n locale?: string\n localeID?: string\n mode?: string\n }\n}\n\nexport const loadEditor = (category: string, resource: string, id: string): LoadEditorAction => ({\n type: EDITOR_PAGE,\n payload: {\n category,\n resource,\n id,\n },\n})\n\nexport const loadEditorNew = (category: string, resource: string): LoadEditorAction => ({\n type: EDITOR_PAGE,\n payload: {\n category,\n resource,\n id: 'new',\n },\n})\n\nexport const loadTranslator = (category: string, resource: string, id: string, localeID?: string, locale?: string): LoadEditorAction => ({\n type: EDITOR_PAGE,\n payload: {\n category,\n resource,\n id,\n locale,\n localeID,\n mode: EditorMode.TRANSLATE,\n },\n})\n\nexport const loadDuplicator = (category: string, resource: string, id: string): LoadEditorAction => ({\n type: EDITOR_PAGE,\n payload: {\n category,\n resource,\n id,\n mode: EditorMode.DUPLICATE,\n },\n})\n\nexport interface LoadListAction {\n type: typeof LIST_PAGE\n payload: {\n category: string\n }\n}\n\nexport const loadList = (category: string): LoadListAction => ({\n type: LIST_PAGE,\n payload: {\n category,\n },\n})\n\ninterface LoadAccountAction {\n type: typeof ACCOUNT_PAGE\n}\n\nexport const loadAccount = (): LoadAccountAction => ({\n type: ACCOUNT_PAGE,\n})\n\ninterface LoadSecurityAction {\n type: typeof SECURITY_PAGE\n}\n\nexport const loadSecurity = (): LoadSecurityAction => ({\n type: SECURITY_PAGE,\n})\n\nexport interface LoadForgotPasswordAction {\n type: typeof FORGOT_PASSWORD\n}\n\nexport const loadForgotPassword = (): LoadForgotPasswordAction => ({\n type: FORGOT_PASSWORD,\n})\n\nexport type LoadArchitectAction = {\n type: typeof ARCHITECT_APP\n payload: loadArchitectPayload\n}\n\nexport type loadArchitectPayload = {\n siteID: string\n pages?: 'pages'\n pageID?: string\n query?: Query\n}\n\nexport const loadArchitect = (payload: loadArchitectPayload): LoadArchitectAction => ({\n type: ARCHITECT_APP,\n payload,\n})\n\ntype LoadAnalyticsAction = {\n type: typeof ANALYTICS_PAGE\n dashboardType: string\n}\n\ntype LoadPageAction = LoadListAction | LoadAnalyticsAction | LoadLeadsListAction\n\nexport const loadAnalytics = (dashboardType: string): LoadAnalyticsAction => ({\n type: ANALYTICS_PAGE,\n dashboardType,\n})\n\nexport const loadDefaultPage = (category: string): LoadPageAction => {\n switch (category) {\n case '':\n // default to leads category\n return loadLeadsList()\n\n case 'analytics':\n return loadAnalytics(category)\n\n default:\n return loadList(category)\n }\n}\n\ninterface LoadLeadsListAction {\n type: typeof LEADS_LIST\n query?: Query\n payload: {\n category: string\n resource: string\n }\n}\n\nexport const loadLeadsList = (query?: Query): LoadLeadsListAction => {\n return {\n type: LEADS_LIST,\n query,\n payload: {\n category: V3LeadsCategory,\n resource: 'leads',\n },\n }\n}\n\ninterface LoadLeadDetailsAction {\n type: typeof LEAD_DETAILS\n payload: {\n category: string\n id: string\n }\n}\n\nexport const loadLeadDetail = (id: string): LoadLeadDetailsAction => ({\n type: LEAD_DETAILS,\n payload: {\n category: V3LeadsCategory,\n id,\n },\n})\n\ninterface LoadTriggersListAction {\n type: typeof TRIGGERS_LIST\n payload: {\n isPlatform?: string\n }\n}\n\nexport const loadTriggersList = (scope: Scope): LoadTriggersListAction => {\n const isPlatform = scope === Scope.PlatformSystem ? 'platform' : undefined\n return {\n type: TRIGGERS_LIST,\n payload: {\n isPlatform: isPlatform,\n },\n }\n}\n\ninterface LoadTriggerDetailsAction {\n type: typeof TRIGGER_DETAILS\n payload: {\n isPlatform?: string\n id: string\n }\n}\n\nexport const loadTriggerDetail = (scope: Scope, id: string): LoadTriggerDetailsAction => {\n const isPlatform = scope === Scope.PlatformSystem ? 'platform' : undefined\n return {\n type: TRIGGER_DETAILS,\n payload: {\n isPlatform: isPlatform,\n id: id,\n },\n }\n}\n","import { i18nMap } from '../reducers/i18n'\n\nexport enum i18nActionTypes {\n SET_LOCALE = '[i18n] Set Locale',\n SET_TRANSLATIONS = '[i18n] Set Translations',\n}\n\nexport type SetLocaleAction = {\n type: i18nActionTypes.SET_LOCALE\n locale: string\n}\n\nexport const setLocale = (locale: string): SetLocaleAction => ({\n type: i18nActionTypes.SET_LOCALE,\n locale: locale,\n})\n\nexport type SetTranslationsAction = {\n type: i18nActionTypes.SET_TRANSLATIONS\n translations: i18nMap\n}\n\nexport type i18nActions = SetLocaleAction | SetTranslationsAction\n","export * from './Action'\nexport * from './Activity'\nexport * from './API'\nexport * from './Architect'\nexport * from './Audit'\nexport * from './Component'\nexport * from './ContentConfig'\nexport * from './Doc'\nexport * from './Document'\nexport * from './Enum'\nexport * from './Filter'\nexport * from './Form'\nexport * from './generic'\nexport * from './Http'\nexport * from './Lead'\nexport * from './Note'\nexport * from './Option'\nexport * from './Organization'\nexport * from './Owner'\nexport * from './Page'\nexport * from './Presentation'\nexport * from './Provider'\nexport * from './ReferenceField'\nexport * from './Rule'\nexport * from './Schema'\nexport * from './Settings'\nexport * from './Site'\nexport * from './Sort'\nexport * from './User'\n","import { find } from 'lodash'\nimport { createSelector } from 'reselect'\nimport { Field, Locale, Schema } from '../schemas'\nimport { getListableFields } from '../schemas/listableFields'\nimport { AppState } from '../store'\n\nexport const schemaSelector = (state: AppState): Schema => state.schema\n\nexport const listableFieldsSelector = (state: AppState): any => {\n // @ts-ignore strange ramda linting err\n return getListableFields(state.schema, {})\n}\n\nexport const localesSelector = (state: AppState): Locale[] => state?.schema?.availableLocales ?? []\n\nexport const shouldModerateSelector = (state: AppState): boolean => state?.schema?.shouldModerate ?? false\n\nexport const modifiedCountSelector = (state: AppState): number => state?.schema?.modifiedCount ?? 0\n\nexport const pendingApprovalSelector = (state: AppState): boolean => {\n if (!state || !state.schema) {\n return false\n }\n return state?.schema?.modifiedCount > 0\n}\n\nexport const fieldSchemaSelector = (fieldKey: string) =>\n createSelector(schemaSelector, (schema: Schema) => find(schema.fields, (field: Field) => field.key === fieldKey))\n","export const ORGS = '[orgs]'\nexport const SET_ORGS = `${ORGS} Set`\nexport const GET_ORGS = `${ORGS} Fetch`\n\nexport const getOrgsByName = (name: any): any => ({\n type: GET_ORGS,\n payload: name,\n})\n\nexport const setOrgs = (orgs: any): any => ({\n type: SET_ORGS,\n payload: orgs,\n})\n","import { ResourceTypeType, TriggerType } from '../v3/type/Trigger'\nimport { Action, ActionType, CachedActionIDs } from '../v3/type/Action'\nimport { i18nKey, i18nSelectorMap } from '../reducers/i18n'\nimport {\n APITriggerCondition,\n APITriggerConditionDataKeys,\n Operator,\n TriggerConditionType,\n UITriggerCondition,\n ValidConditionValue,\n} from '../v3/type/Condition'\n\nexport const defaultTriggerActionsByType = (t: TriggerType, actions: Action[]): Action[] => {\n switch (t) {\n case TriggerType.LeadRemindersTrigger:\n return actions.filter((act) => {\n return act.ID === CachedActionIDs.DefaultLeadReminderEmail\n })\n default:\n return [newWebhookAction()]\n }\n}\n\nexport const defaultTriggerConditionsByType = (type: TriggerType, i18n: i18nSelectorMap): UITriggerCondition[] => {\n // TODO: handle conditions existing already\n switch (type) {\n case TriggerType.LeadRemindersTrigger:\n return [\n newUIConditionFromConditionType(i18n, TriggerConditionType.StatusInOrNotIn),\n newUIConditionFromConditionType(i18n, TriggerConditionType.DaysInStatus),\n newUIConditionFromConditionType(i18n, TriggerConditionType.TriggerCountLimit),\n newUIConditionFromConditionType(i18n, TriggerConditionType.DaysBetweenReminders),\n newUIConditionFromConditionType(i18n, TriggerConditionType.NotifyParentOrgs),\n ]\n default:\n return []\n }\n}\n\n// TODO: where was this intended to be used again?\nexport const resourceTypeByTriggerType = new Map([\n [TriggerType.LeadCreatedTrigger, ResourceTypeType.LeadsCreated],\n [TriggerType.LeadReassignedTrigger, ResourceTypeType.LeadsCreated],\n [TriggerType.LeadRemindersTrigger, ResourceTypeType.LeadsCreated],\n [TriggerType.LeadModifiedTrigger, ResourceTypeType.LeadsModified],\n])\n\nconst newUIConditionFromConditionType = (i18n: i18nSelectorMap, t: TriggerConditionType): UITriggerCondition => {\n return {\n required: true,\n type: t,\n dataKey: dataKeyByConditionType.get(t) ?? 'Unknown',\n i18n: i18n(`rules.detail.page.condition.${t}` as i18nKey),\n helpText: i18n(`rules.detail.page.condition.helpText.${t}` as i18nKey),\n operator: operatorByConditionType.get(t),\n value: defaultValueByConditionType.get(t),\n }\n}\n\nconst dataKeyByConditionType = new Map<TriggerConditionType, APITriggerConditionDataKeys>([\n [TriggerConditionType.CreatedBeforeOrAfter, 'Data'],\n [TriggerConditionType.StatusInOrNotIn, 'Status'],\n [TriggerConditionType.DaysInStatus, 'DaysInStatus'],\n [TriggerConditionType.TriggerCountLimit, 'TriggerCount'],\n [TriggerConditionType.DaysBetweenReminders, 'DaysBetweenReminders'],\n [TriggerConditionType.NotifyParentOrgs, 'NotifyParentOrgs'],\n [TriggerConditionType.CreatedAtElapsed, 'Elapsed'],\n [TriggerConditionType.ViewCount, 'Count'],\n])\n\nconst operatorByConditionType = new Map<TriggerConditionType, Operator>([\n [TriggerConditionType.StatusInOrNotIn, Operator.In],\n [TriggerConditionType.DaysInStatus, Operator.GreaterThanOrEqual],\n [TriggerConditionType.TriggerCountLimit, Operator.LessThan],\n])\n\nconst defaultValueByConditionType = new Map<TriggerConditionType, ValidConditionValue>([\n [TriggerConditionType.DaysInStatus, '3'],\n [TriggerConditionType.TriggerCountLimit, 3],\n [TriggerConditionType.DaysBetweenReminders, ''],\n])\n\nconst getValueByConditionType = (t: TriggerConditionType, val?: ValidConditionValue): ValidConditionValue | undefined => {\n if (val === undefined) return\n switch (t) {\n case TriggerConditionType.CreatedBeforeOrAfter:\n return String(val)\n case TriggerConditionType.StatusInOrNotIn:\n return (val as string[]).map((v) => {\n return String(v)\n })\n case TriggerConditionType.NotifyParentOrgs:\n return Boolean(val)\n case TriggerConditionType.DaysInStatus:\n case TriggerConditionType.DaysBetweenReminders:\n case TriggerConditionType.CreatedAtElapsed:\n case TriggerConditionType.ViewCount:\n const countValue = Number(val)\n return countValue\n case TriggerConditionType.TriggerCountLimit:\n return Number(val)\n }\n}\n\nexport const serializeTriggerCondition = (condition: UITriggerCondition): APITriggerCondition => {\n const ret: APITriggerCondition = {\n Required: condition.required,\n Type: condition.type,\n Operator: operatorByConditionType.get(condition.type),\n }\n\n if (condition.value !== undefined) {\n ret[condition.dataKey] = getValueByConditionType(condition.type, condition.value)\n }\n\n return ret\n}\n\nexport const deserializeTriggerCondition = (i18n: i18nSelectorMap, condition: APITriggerCondition): UITriggerCondition => {\n const ret: UITriggerCondition = {\n required: condition.Required,\n type: condition.Type,\n dataKey: dataKeyByConditionType.get(condition.Type) ?? 'Unknown',\n i18n: i18n(`rules.detail.page.condition.${condition.Type}` as i18nKey),\n helpText: i18n(`rules.detail.page.condition.helpText.${condition.Type}` as i18nKey),\n operator: operatorByConditionType.get(condition.Type),\n }\n\n if (condition[ret.dataKey] !== undefined) {\n ret.value = getValueByConditionType(condition.Type, condition[ret.dataKey])\n }\n\n return ret\n}\n\nexport const newWebhookAction = (): Action => {\n return {\n ID: '',\n Type: ActionType.WebhookHTTPAction,\n Content: {\n Type: 'action.webhook.http',\n URL: '',\n },\n Name: '',\n Description: '',\n ExplicitAccessList: [],\n ApplyToTree: false,\n }\n}\n\nexport const newEmailAction = (): Action => {\n return {\n ID: '',\n Type: ActionType.NotificationEmailAction,\n Content: {\n Type: 'action.notification.email',\n URL: '',\n },\n ExplicitAccessList: [],\n ApplyToTree: false,\n }\n}\n\nexport const conditionsFromConditionDeps = (conditions: UITriggerCondition[]): UITriggerCondition[] => {\n const needsUpdate = conditions.some((c) => {\n return c.type === TriggerConditionType.TriggerCountLimit && Number(c.value) === 1\n })\n\n return conditions.reduce((acc: UITriggerCondition[], currVal: UITriggerCondition): UITriggerCondition[] => {\n if (currVal.type === TriggerConditionType.DaysBetweenReminders) {\n const updatedValue = needsUpdate ? '0' : currVal.value\n acc.push({\n ...currVal,\n value: updatedValue,\n forceDisabled: needsUpdate,\n })\n return acc\n }\n acc.push(currVal)\n return acc\n }, [])\n}\n","import { createStyles, makeStyles, Theme } from '@material-ui/core'\nimport React from 'react'\nimport { connect } from 'react-redux'\nimport { useI18nSelector } from 'v3/context/i18n'\nimport { i18nKey, i18nState } from '../../reducers/i18n'\nimport { categorySelector } from '../../selectors/location'\nimport { AppState } from '../../store'\nimport './Loading.scss'\nimport { moduleSelector } from '../../selectors'\n\nexport const Loading = (props: MapProps) => {\n const i18n = useI18nSelector()\n\n // Title and message props can be explicity null to prevent the field\n // from rendering at all, and undefined to accept the default\n const { category, module } = props\n let title = props.title\n if (typeof title === 'undefined') {\n if (module || category) {\n title = i18n(`loading.messages.${module || category}.title` as i18nKey)\n } else {\n title = i18n(`loading.messages.app-loading.title`)\n }\n }\n\n let message = props.message\n if (typeof message === 'undefined') {\n if (module || category) {\n message = i18n(`loading.messages.${module || category}.message` as i18nKey)\n } else {\n message = i18n(`loading.messages.app-loading.message`)\n }\n }\n\n const classes = ['loader-root']\n if (props.fullScreen) {\n classes.push('full-screen')\n }\n\n return (\n <div className={classes.join(' ')}>\n <div className=\"loader\" />\n <div className=\"message-wrapper\">\n {title && <h2 className=\"title\">{title}</h2>}\n {message && <p className=\"message\">{message}</p>}\n </div>\n </div>\n )\n}\n\ntype MapProps = {\n title?: string | null\n message?: string | null\n module?: string\n category?: string\n fullScreen?: boolean\n}\nconst mapProps = (state: AppState): any => ({\n category: categorySelector(state),\n module: moduleSelector(state),\n})\n\nexport default connect<MapProps, any, any, AppState>(mapProps)(Loading)\n","export const EXPORT = '[export]'\nexport const EXPORT_DOCS = '[export] docs'\n\ninterface ExportDocsAction {\n type: typeof EXPORT_DOCS\n}\n\nexport const exportDocs = (): ExportDocsAction => ({\n type: EXPORT_DOCS,\n})\n","import { AnyAction } from 'redux'\n\nexport const TAGS = '[tags]'\nexport const GET_TAGS = `${TAGS} Get`\n\nexport const getTags = (prefix: string): AnyAction => ({\n type: GET_TAGS,\n payload: prefix,\n})\n","export enum SearchActionType {\n CLEAR = '[search] Clear',\n SET = '[search] Set',\n}\n\ntype ClearSearchAction = {\n delayed: boolean\n refetch: boolean\n type: SearchActionType.CLEAR\n}\n\nexport const clearSearch = (refetch = true): ClearSearchAction => ({\n delayed: false,\n type: SearchActionType.CLEAR,\n refetch,\n})\n\ntype SetSearchAction = {\n delayed: boolean\n refetch: boolean\n text: string\n type: SearchActionType.SET\n}\n\nexport const setSearch = (text: string, refetch = true, delayed = true): SetSearchAction => ({\n type: SearchActionType.SET,\n delayed,\n refetch,\n text,\n})\n\nexport type AnySearchAction = SetSearchAction | ClearSearchAction\n","export const SHOW_MODAL: '[ui] Show Modal' = '[ui] Show Modal'\nexport const SHOW_MODAL_V2: '[ui] Show Modal V2' = '[ui] Show Modal V2'\nexport const HIDE_MODAL: '[ui] Hide Modal' = '[ui] Hide Modal'\nexport const SHOW_LOADER: '[ui] Show Loader' = '[ui] Show Loader'\nexport const HIDE_LOADER: '[ui] Hide Loader' = '[ui] Hide Loader'\nexport const CREATE_NOTIFICATION: '[ui] Create Notification' = '[ui] Create Notification'\nexport const CLEAR_NOTIFICATION: '[ui] Clear Notification' = '[ui] Clear Notification'\n\ninterface ShowLoaderAction {\n type: typeof SHOW_LOADER\n payload: string\n}\n\nexport const showLoader = (entity: string): ShowLoaderAction => ({\n type: SHOW_LOADER,\n payload: entity,\n})\n\ninterface HideLoaderAction {\n type: typeof HIDE_LOADER\n payload: string\n}\n\nexport const hideLoader = (entity: string): HideLoaderAction => ({\n type: HIDE_LOADER,\n payload: entity,\n})\n\ntype Notification = {}\n\nexport interface CreateNotificationAction {\n type: typeof CREATE_NOTIFICATION\n payload: Notification\n}\n\nexport const createNotification = (notification: Notification): CreateNotificationAction => ({\n type: CREATE_NOTIFICATION,\n payload: notification,\n})\n\ninterface ClearNotificationAction {\n type: typeof CLEAR_NOTIFICATION\n payload?: string\n}\n\nexport const clearNotification = (id?: string): ClearNotificationAction => ({\n type: CLEAR_NOTIFICATION,\n payload: id,\n})\n\nexport type ModalBody = object | Array<any> | null\n\nexport type Modal = {\n body: ModalBody\n buttons: object[]\n callback?: Function\n}\n\ninterface ShowModalAction {\n type: typeof SHOW_MODAL\n payload: Modal | { modal: Modal }\n}\n\nexport const showModal = (buttons: object[], body: ModalBody, callback?: Function): ShowModalAction => ({\n type: SHOW_MODAL,\n payload: {\n body,\n buttons,\n callback,\n },\n})\n\nexport interface HideModalAction {\n type: typeof HIDE_MODAL\n}\n\nexport const hideModal = (): HideModalAction => ({\n type: HIDE_MODAL,\n})\n\nexport enum ModalType {\n TextArea,\n Confirm,\n Acknowledge,\n}\n\nexport type ModalProps = {\n title: string\n body: string\n type: ModalType\n helpText?: string\n callback?: Function\n}\n\nexport interface ShowModalV2Action {\n type: typeof SHOW_MODAL_V2\n payload: ModalProps & { callback?: Function }\n}\n\nexport const showModalV2 = (modalProps: ModalProps, callback?: Function): ShowModalV2Action => ({\n type: SHOW_MODAL_V2,\n payload: {\n ...modalProps,\n callback,\n },\n})\n\nexport type UIActionTypes =\n | ShowLoaderAction\n | HideLoaderAction\n | CreateNotificationAction\n | ClearNotificationAction\n | ShowModalAction\n | HideModalAction\n | ShowModalV2Action\n","import { V3Organization } from '../types'\nimport { AppState } from '../store'\n\nexport const V3OrganizationsSelector = (state: AppState): V3Organization[] => {\n return state.v3Organizations.organizations\n}\n\nexport const selectV3OrgsLoaded = (state: AppState): boolean => {\n return state.v3Organizations.organizations.length > 0\n}\n\nexport const selectActiveV3Orgs = (state: AppState): V3Organization[] => {\n return state.v3Organizations.organizations.filter((org) => {\n return org.Status.toLowerCase() === 'active'\n })\n}\n","import React, { Component } from 'react'\nimport './FieldMessage.scss'\n\ntype FieldMessageProps = {\n value?: string\n className?: string\n error?: Error | string\n dataCIKey?: string\n}\n\nexport default class FieldMessage extends Component<FieldMessageProps, any> {\n state = {}\n\n render() {\n let classList = 'FieldMessage'\n let message: string | Error = this.props.value || ''\n\n if (this.props.className) {\n classList += ` ${this.props.className}`\n }\n\n if (this.props.error) {\n classList += ' is-error'\n message = this.props.error\n }\n\n if (Array.isArray(message)) {\n message = message.join(', ')\n }\n\n if ('object' === typeof message) {\n // catch malformed messages\n message = JSON.stringify(message)\n }\n\n return (\n <div data-ci={this.props.dataCIKey} className={classList}>\n {message}\n </div>\n )\n }\n}\n","import { GetOptionsArgs, ReferenceField } from '../types/ReferenceField'\nimport { Enum, Option, Organization } from '../types'\nimport { Schema } from '../schemas'\n\nexport enum AutocompleteActionType {\n GET_AUTOCOMPLETE = '[autocomplete] Fetch',\n GET_AUTOCOMPLETE_SUCCESS = '[autocomplete] Fetch API_SUCCESS',\n SET_AUTOCOMPLETE = '[autocomplete] Set',\n GET_ASSIGNMENTS = '[autocomplete] Fetch Assignments',\n GET_ASSIGNMENTS_SUCCESS = '[autocomplete] Fetch Assignments API_SUCCESS',\n SET_ASSIGNMENTS = '[autocomplete] Set Assignments',\n}\n\ninterface GetAutoCompleteAction {\n type: AutocompleteActionType.GET_AUTOCOMPLETE\n payload: {\n field: ReferenceField\n params: GetOptionsArgs\n }\n}\n\nexport const getAutoComplete = (field: ReferenceField, params: GetOptionsArgs): GetAutoCompleteAction => ({\n type: AutocompleteActionType.GET_AUTOCOMPLETE,\n payload: {\n field,\n params,\n },\n})\n\ninterface GetAutocompleteSuccessAction {\n type: AutocompleteActionType.GET_AUTOCOMPLETE_SUCCESS\n payload: Schema[] | Organization[]\n}\n\ninterface SetAutoCompleteAction {\n type: AutocompleteActionType.SET_AUTOCOMPLETE\n payload: Option[]\n}\n\nexport const setAutoComplete = (options: Option[]): SetAutoCompleteAction => ({\n type: AutocompleteActionType.SET_AUTOCOMPLETE,\n payload: options,\n})\n\ninterface GetAssignmentsAction {\n type: AutocompleteActionType.GET_ASSIGNMENTS\n payload: {\n resource: string\n documentID: string\n value: string\n }\n}\n\nexport const getAssignments = (value: string, resource: string, documentID: string): GetAssignmentsAction => ({\n type: AutocompleteActionType.GET_ASSIGNMENTS,\n payload: {\n value,\n resource,\n documentID,\n },\n})\n\ninterface GetAssignmentsApiSuccessAction {\n type: AutocompleteActionType.GET_ASSIGNMENTS_SUCCESS\n payload: Enum[]\n}\n\ninterface SetAssignmentsAction {\n type: AutocompleteActionType.SET_ASSIGNMENTS\n payload: Enum[]\n}\n\nexport const setAssignments = (assignments: Enum[]): SetAssignmentsAction => ({\n type: AutocompleteActionType.SET_ASSIGNMENTS,\n payload: assignments,\n})\n\nexport type AnyAutoCompleteAction =\n | SetAutoCompleteAction\n | GetAutoCompleteAction\n | SetAssignmentsAction\n | GetAssignmentsAction\n | GetAssignmentsApiSuccessAction\n | GetAutocompleteSuccessAction\n","import { AppState } from '../store'\nimport { Organization, Scope, User } from '../types'\nimport { scopeHeadersSelector } from './scope'\nimport { ScopeHeaders } from '../selectors/scope'\nimport { localeSelector } from './i18n'\n\nexport type AuthHeaders = ScopeHeaders & {\n 'Content-Type': string\n 'Accept-Language': string\n Authorization: string\n OrganizationID: string\n}\n\nexport const authHeaderSelector = (state: AppState, scope?: Scope, asOwnerOverride?: string): AuthHeaders => {\n const token = state?.session?.authorizationToken ?? ''\n const orgID = state?.session?.organization?.ID ?? ''\n const locale = localeSelector(state)\n\n if (!isValidSession(state)) {\n return {} as AuthHeaders\n }\n\n const headers: AuthHeaders = {\n 'Content-Type': 'application/json',\n 'Accept-Language': locale,\n Authorization: token,\n OrganizationID: orgID,\n ...scopeHeadersSelector(state, scope, asOwnerOverride),\n }\n\n return headers\n}\n\nexport const authRequiredSelector = (state: AppState): boolean => !state?.session?.authorizationToken\n\nexport const sessionReadySelector = (state: AppState): boolean => {\n const hasToken = !!state?.session?.authorizationToken\n const hasSchemas = state?.schemas?.length > 0\n return hasToken && hasSchemas\n}\n\nexport const focusedOrgSelector = (state: AppState): Organization | undefined => state?.session?.organization\n\nexport const userSelector = (state: AppState): User => state.session.user\n\nexport const isValidSession = (state: AppState): boolean => {\n const date = new Date()\n const token = state?.session?.authorizationTokenExpiration\n if (token) {\n return new Date(token) > date\n }\n return false\n}\n\nexport const loginErrorSelector = (state: AppState): string => state?.session?.error ?? ''\n\nexport const passwordResetErrorSelector = (state: AppState): string => state?.session?.error ?? ''\n\nexport const redirectSelector = (state: AppState): any => state?.session?.redirect\n\nexport const roleSelector = (state: AppState): any => state?.session?.context?.role ?? ''\n","import { Sort } from '../types/Sort'\n\nexport enum SortActionType {\n CLEAR = '[sort] Clear',\n SET = '[sort] Set',\n}\n\ntype ClearSortAction = {\n type: SortActionType.CLEAR\n}\n\nexport const clearSort = (): ClearSortAction => ({\n type: SortActionType.CLEAR,\n})\n\ntype SetSortAction = {\n sort: Sort\n type: SortActionType.SET\n}\n\nexport const setSort = (sort: Sort): SetSortAction => ({\n type: SortActionType.SET,\n sort,\n})\n\nexport type AnySortAction = ClearSortAction | SetSortAction\n","import { AppState } from '../store'\nimport { LeadStatusToStage, Settings } from '../types'\n\nexport const analyticsEnabledSelector = (state: AppState): boolean => state?.settings?.analyticsSettings?.enableAnalytics ?? false\n\nexport const siteAnalyticsEnabledSelector = (state: AppState): boolean => state?.settings?.analyticsSettings?.enableSiteAnalytics ?? false\n\nexport const campaignAnalyticsEnabledSelector = (state: AppState): boolean => state?.settings?.analyticsSettings?.enableCampaignAnalytics ?? false\n\nexport const locatorAnalyticsEnabledSelector = (state: AppState): boolean => state?.settings?.analyticsSettings?.enableLocatorAnalytics ?? false\n\nexport const focalPointEnabledSelector = (state: AppState): boolean => state?.settings?.enableFocalPoint ?? false\n\nexport const mapBoxEnabledSelector = (state: AppState): boolean => state?.settings?.resourceSettings?.useMapBox ?? false\n\nexport const primaryLocaleSelector = (state: AppState): string => state?.settings?.primaryLocale ?? ''\n\nexport const settingsSelector = (state: AppState): Settings => state?.settings ?? null\n\nexport const selectV3EnabledSetting = (state: AppState): boolean => state.settings.enableV3\n\nexport const selectLeadStatusToStageSetting = (state: AppState): LeadStatusToStage[] => {\n return state.settings.leadStatusToStage\n}\n","import { always, any, complement, compose, filter, flatten, is, length, lt, map, not, path, pathOr, prop, reduce, sort, when } from 'ramda'\n\nexport const LIST_PAGE = 'listPage'\nexport const NESTED_LIST = 'nestedList'\n\nconst asArray = when(compose(not, is(Array)), always([]))\nconst arrayHasLength = compose(lt(0), length, asArray)\nconst isEmptyArray = complement(arrayHasLength)\nconst hasNestedFields = compose(arrayHasLength, (v: any) => prop('fields')(v))\nconst hasEmptyFields = compose(isEmptyArray, (v: any) => prop('fields')(v))\n\nconst getListConfig = (field: any) => pathOr({}, ['listConfig'], field)\nconst getSortOrder = (field: any) => path(['listConfig', 'sortOrder'], field)\nconst sortBySortOrder = (a: any, b: any) => (a.sortOrder && a.sortOrder ? a.sortOrder - b.sortOrder : 0)\n\nconst filterByListType = (listType: any) =>\n function filterField(field: any): any {\n if (!field) return false\n // if there is a `fields` property on the field, follow it.\n if (hasNestedFields(field)) return any(filterField, field.fields)\n const listConfig: any = getListConfig(field)\n return !!(listConfig && listConfig.type === listType)\n }\n\nconst showOnList = (v: any) => filterByListType(LIST_PAGE)(v)\nconst showOnNested = filterByListType(NESTED_LIST)\n\nconst buildEnums = (field: Object) => {\n const enums = pathOr([], ['restrictions', 'enums'], field) || []\n if (!enums.length) {\n return\n }\n\n return reduce(\n (acc: any, curr: any) => {\n acc[curr.value] = curr.label\n return acc\n },\n {},\n enums\n )\n}\n\nconst getListFields = (predicateFn: (a: any) => boolean, ignoreNested: boolean) =>\n compose(\n sort(sortBySortOrder),\n flatten,\n reduce((acc: any, curr: any) => {\n if (Array.isArray(curr)) return acc.concat(curr)\n return acc.concat([curr])\n }, []),\n filter(Boolean),\n map((field: any) => {\n if (hasEmptyFields(field))\n return {\n key: field.key,\n label: field.label,\n enums: buildEnums(field),\n presentation: field.presentation,\n sortOrder: getSortOrder(field),\n field,\n }\n\n if (ignoreNested) return null\n\n const nested = field.fields.filter(predicateFn)\n if (!nested.length) return null\n return nested.map((f: any) => {\n if (hasEmptyFields(f))\n return {\n key: `${field.key}.${f.key}`,\n label: f.label,\n sortOrder: getSortOrder(f),\n field: f,\n }\n\n const doubleNested = f.fields.filter(predicateFn)\n if (!doubleNested.length) return null\n return doubleNested.map((dnf: any) => ({\n key: `${field.key}.${f.key}.${dnf.key}`,\n label: dnf.label,\n sortOrder: getSortOrder(dnf),\n field: dnf,\n }))\n })\n }),\n (v: any) => compose(filter(predicateFn), pathOr([], ['fields']))(v)\n )\n\nexport const getListableFields = getListFields(showOnList, false)\nexport const getListableNestedFields = getListFields(showOnNested, true)\n","import { AppState } from '../store'\n\nexport const searchTextSelector = (state: AppState): string => {\n return (state && state.search) || ''\n}\n","/**\n * Types for Autocomplete/select options\n */\nimport { ReferenceFieldValueDoc } from './ReferenceField'\nimport { Organization } from './Organization'\nimport { Scope } from './API'\n\nexport enum OptionType {\n Enum,\n Organization,\n ReferenceField,\n Date,\n Scope,\n}\n\nexport type Option = EnumOption | OrganizationOption | ReferenceFieldOption | DateOption | ScopeOption\n\nexport const isOption = (opt: any): opt is Option => {\n return isEnumOption(opt) || isOrganizationOption(opt) || isReferenceFieldOption(opt) || isDateOption(opt) || isScopeOption(opt)\n}\n\ntype baseOption = {\n label: string\n disabled?: boolean\n value: string\n}\n// EnumOption is just the platform Enum with `disabled` optional\nexport type EnumOption = baseOption & {\n type: OptionType.Enum\n}\n\nexport const isEnumOption = (opt: any): opt is EnumOption => {\n return opt.type !== undefined && opt.type === OptionType.Enum\n}\n\n// OrganizationOption is used generally when an Autocomplete select field is being used for Organizations (ie. changing\n// the focused org).\n// The \"Scope\" filter still uses an EnumOption.\nexport type OrganizationOption = Omit<baseOption, 'value'> & {\n type: OptionType.Organization\n secondaryLabel: string\n value: Organization\n}\n\nexport const isOrganizationOption = (opt: any): opt is OrganizationOption => {\n return opt.type !== undefined && opt.type === OptionType.Organization\n}\n\n// ReferenceFieldOption uses a ReferenceFieldValue for `value`, when using autocomplete / reference selects.\nexport type ReferenceFieldOption = Omit<baseOption, 'value'> & {\n type: OptionType.ReferenceField\n value: ReferenceFieldValueDoc\n}\n\nexport const isReferenceFieldOption = (opt: any): opt is ReferenceFieldOption => {\n return opt.type !== undefined && opt.type === OptionType.ReferenceField\n}\n\nexport enum DateOptionRangeType {\n From,\n To,\n}\n\n// DateOption uses a Unix timestamp for the value and tracks whether the date contained\n// is for the \"from\" or the \"to\" part of a date range.\nexport type DateOption = Omit<baseOption, 'value'> & {\n type: OptionType.Date\n value: number\n range: DateOptionRangeType\n}\n\nexport const isDateOption = (opt: any): opt is DateOption => {\n return opt.type !== undefined && opt.type === OptionType.Date\n}\n\n// ScopeOption uses a Scape for `value`, when using the OrganizationScope select.\nexport type ScopeOption = Omit<baseOption, 'value'> & {\n type: OptionType.Scope\n value: Scope\n}\n\nexport const isScopeOption = (opt: any): opt is ScopeOption => {\n return opt.type !== undefined && opt.type === OptionType.Scope\n}\n","export enum PaginationActionType {\n NEXT_PAGE = '[pagination] Next',\n PREV_PAGE = '[pagination] Prev',\n SET_PAGE = '[pagination] Set Page',\n SET_SKIP = '[pagination] Set Skip',\n SET_LIMIT = '[pagination] Set Limit',\n SET_TOTAL = '[pagination] Set Total',\n RESET_PAGINATION = '[pagination] Reset',\n}\n\ntype NextPageAction = {\n type: PaginationActionType.NEXT_PAGE\n}\n\nexport const nextPage = (): NextPageAction => ({\n type: PaginationActionType.NEXT_PAGE,\n})\n\ntype PreviousPageAction = {\n type: PaginationActionType.PREV_PAGE\n}\n\nexport const prevPage = (): PreviousPageAction => ({\n type: PaginationActionType.PREV_PAGE,\n})\n\ntype SetPaginationPageAction = {\n type: PaginationActionType.SET_PAGE\n payload: number\n}\n\nexport const setPaginationPage = (page: number): SetPaginationPageAction => ({\n type: PaginationActionType.SET_PAGE,\n payload: page,\n})\n\ntype SetSkipAction = {\n type: PaginationActionType.SET_SKIP\n payload: number\n}\n\nexport const setSkip = (skipCount: number): SetSkipAction => ({\n type: PaginationActionType.SET_SKIP,\n payload: skipCount,\n})\n\ntype SetLimitAction = {\n type: PaginationActionType.SET_LIMIT\n payload: number\n}\n\nexport const setLimit = (limit: number): SetLimitAction => ({\n type: PaginationActionType.SET_LIMIT,\n payload: limit,\n})\n\ntype SetTotalAction = {\n type: PaginationActionType.SET_TOTAL\n payload: number\n}\n\nexport const setTotal = (total: number): SetTotalAction => ({\n type: PaginationActionType.SET_TOTAL,\n payload: total,\n})\n\ntype ResetPaginationAction = {\n type: PaginationActionType.RESET_PAGINATION\n}\n\nexport const resetPagination = (): ResetPaginationAction => ({\n type: PaginationActionType.RESET_PAGINATION,\n})\n\nexport type AnyPaginationAction =\n | NextPageAction\n | PreviousPageAction\n | SetPaginationPageAction\n | SetSkipAction\n | SetLimitAction\n | SetTotalAction\n | ResetPaginationAction\n","import { AnyAction } from 'redux'\n\nexport const STORAGE = '[storage]'\nexport const SET_LOCAL_STORAGE = `${STORAGE} Set Local`\n\nexport const setLocalStorage = (key: string, value: string): AnyAction => ({\n type: SET_LOCAL_STORAGE,\n payload: {\n key,\n value,\n },\n})\n","export enum RouteActionType {\n CategorySet = '[route] Category Set',\n CategoryUnset = '[route] Category Unset',\n}\n\nexport type CategorySetAction = {\n type: RouteActionType.CategorySet\n category: string\n}\n\nexport const setCategory = (category: string): CategorySetAction => ({\n type: RouteActionType.CategorySet,\n category,\n})\n\nexport type CategoryUnsetAction = {\n type: RouteActionType.CategoryUnset\n}\n\nexport const unsetCategory = (): CategoryUnsetAction => ({\n type: RouteActionType.CategoryUnset,\n})\n\nexport type AnyRouteAction = CategorySetAction | CategoryUnsetAction\n","// extracted by mini-css-extract-plugin\nmodule.exports = {\"primary\":\"#116069\",\"secondary\":\"#5c6060\",\"primaryLighten_15\":\"#157984\",\"primaryLighten_30\":\"#1a919e\",\"primaryDarken_15\":\"#0d484f\",\"primaryDarken_30\":\"#093035\",\"isModifiedColor\":\"#157984\",\"mutedBrand\":\"#809193\",\"primaryTextColor\":\"#5c6060\",\"secondaryTextColor\":\"#525757\",\"navBgColor\":\"#f4f6f6\",\"tertiaryTextColor\":\"#6d727c\",\"invertedTextColor\":\"#fff\",\"contentBgColor\":\"#fff\",\"appBgColor\":\"#fff\",\"accentFillColor\":\"#fafbfc\",\"borderColor\":\"#e0e0e0\",\"border1pxSolid\":\"1px solid #e0e0e0\",\"fieldBgColor\":\"#f7f9fb\",\"fieldFocus\":\"#8aa5a8\",\"listHover\":\"#f7f9fb\",\"tableBandedBackground\":\"#f3f3f3\",\"ui_0\":\"#000\",\"ui_15\":\"#212b2c\",\"ui_30\":\"#415658\",\"ui_45\":\"#628184\",\"ui_60\":\"#8aa5a8\",\"ui_75\":\"#b6c7c9\",\"ui_85\":\"#d3ddde\",\"ui_90\":\"#e2e9e9\",\"ui_95\":\"#f0f4f4\",\"ui_98\":\"#f9fbfb\",\"ui_100\":\"#fff\",\"success\":\"#3cae4c\",\"error\":\"#aa403e\",\"alert\":\"#2ad2c9\",\"disabledDark\":\"#525757\",\"tundora\":\"#404040\",\"fieldDisabledBorder\":\"#e0e0e0\",\"fieldDisabledBackground\":\"#fff\",\"fieldDisabledText\":\"#a5abb5\",\"powerchordBrandmark\":\"url(/static/media/powerchord-brandmark.c5479dc1.svg)\",\"powerchordLogo\":\"url(/static/media/powerchord_logo.25138d89.svg)\",\"powerchordAltLogo\":\"url(/static/media/powerchord_logo_alt.49c02054.svg)\",\"architectIconSize\":\"18px\",\"iconInfo\":\"url(/static/media/info.3905d52e.svg)\",\"iconFieldCalendar\":\"url(/static/media/calendar.2d798caf.svg)\",\"iconFocalPoint\":\"url(/static/media/focal-point.b405bbfc.svg)\",\"iconUacArrow\":\"url(/static/media/keyboard_arrow_down.d222f318.svg)\",\"fullContentWidth\":\"calc(100vw - 18rem)\",\"fullContentHeight\":\"calc(100vh - 3.5rem)\",\"pcShadowColor\":\"rgba(0,0,0,.15)\",\"pcShadowColorLight\":\"rgba(0,0,0,.08)\",\"pcDropShadow\":\"1px 2px 6px rgba(0,0,0,.08)\",\"pcDropShadowFar\":\"1px 2px 20px rgba(0,0,0,.08)\",\"iconOrgLandingPage\":\"url(/static/media/org_landing_page.7f2a5699.svg)\"};","import { i18nActions, i18nActionTypes } from '../actions/i18n'\nimport enUS from '../i18n/en-US.json'\nimport { setLocalStorage } from '../util'\nimport config from '../config'\nimport { Enum } from '../types'\nimport * as Sentry from '@sentry/react'\n\nexport type i18nMap = typeof enUS\nexport type i18nKey = keyof i18nMap\n\nexport type i18nState = {\n locale: string\n translations: i18nMap\n availableLocales: Enum[]\n}\n\nexport const initialI18nState = {\n locale: 'en-US',\n translations: enUS,\n availableLocales: [\n {\n label: 'Deutsch',\n value: 'de-DE',\n disabled: false,\n },\n {\n label: 'English',\n value: 'en-US',\n disabled: false,\n },\n {\n label: 'Español',\n value: 'es-ES',\n disabled: false,\n },\n {\n label: 'Français',\n value: 'fr-FR',\n disabled: false,\n },\n {\n label: 'Italiano',\n value: 'it-IT',\n disabled: false,\n },\n ],\n}\n\nexport type i18nSelectorMap = (key: i18nKey) => string\n\nconst i18nReducer = (state: i18nState = initialI18nState, action: i18nActions): i18nState => {\n switch (action.type) {\n case i18nActionTypes.SET_LOCALE:\n Sentry.setTag('locale', action.locale)\n setLocalStorage(config.languageKey, action.locale)\n return {\n ...state,\n locale: action.locale,\n }\n case i18nActionTypes.SET_TRANSLATIONS:\n return {\n ...state,\n translations: action.translations,\n }\n default:\n return state\n }\n}\n\nexport default i18nReducer\n","import { ContentConfig } from '../types/ContentConfig'\nimport { i18nSelectorMap } from '../reducers/i18n'\nimport { Enum } from '../types'\n\nexport const deduplicateContentConfigs = (a: ContentConfig[], b: ContentConfig[]): ContentConfig[] => {\n return [...a, ...b].reduce((acc: ContentConfig[], curr: ContentConfig) => {\n if (acc.findIndex((act) => act.field === curr.field) < 0) {\n acc.push(curr)\n }\n return acc\n }, [])\n}\n\n// getLeadStatusEnums provides a set of Lead 'Status' enums\n// if the organization has 'Status' enums set in their content configuration, their enums will be returned\n// otherwise, the predefined default is returned\n// The parameter `trimDefaults` controls whether the full list of defaults is returned (for filter dropdowns, etc.)\n// or only a subset (for actual Lead status fields, etc.).\nexport const getLeadStatusEnums = (i18n: i18nSelectorMap, contentConfigs: ContentConfig[], trimDefaults: boolean): Enum[] => {\n const configuredEnums = contentConfigs.find((c) => c.field === 'status')\n if (configuredEnums && configuredEnums.enums) return configuredEnums.enums\n\n const defaults = [\n {\n label: i18n('leads.status.enum.open.label'),\n value: 'open',\n disabled: false,\n },\n {\n label: i18n('leads.status.enum.contacted.label'),\n value: 'contacted',\n disabled: false,\n },\n {\n label: i18n('leads.status.enum.inProgress.label'),\n value: 'inProgress',\n disabled: false,\n },\n {\n label: i18n('leads.status.enum.onHold.label'),\n value: 'onHold',\n disabled: false,\n },\n {\n label: i18n('leads.status.enum.closedWon.label'),\n value: 'closedWon',\n disabled: false,\n },\n {\n label: i18n('leads.status.enum.closedNotInterested.label'),\n value: 'closedNotInterested',\n disabled: false,\n },\n {\n label: i18n('leads.status.enum.closedBoughtUsed.label'),\n value: 'closedBoughtUsed',\n disabled: false,\n },\n {\n label: i18n('leads.status.enum.closedBoughtOtherBrand.label'),\n value: 'closedBoughtOtherBrand',\n disabled: false,\n },\n ]\n\n if (trimDefaults) return defaults\n\n return defaults.concat([\n {\n // Triggered by email/SMS opt out - zero contact requested\n label: i18n('leads.status.enum.closedOptOut.label'),\n value: 'closedOptOut',\n disabled: false,\n },\n {\n // Lead Record has been opened in Command Center Desktop or Mobile\n label: i18n('leads.status.enum.engaged.label'),\n value: 'engaged',\n disabled: false,\n },\n {\n // Follow-Up functionality (TBD)\n label: i18n('leads.status.enum.followUp.label'),\n value: 'followUp',\n disabled: false,\n },\n {\n // Triggered by rules - Lead not lost, not won - no status change\n label: i18n('leads.status.enum.nurture.label'),\n value: 'nurture',\n disabled: false,\n },\n {\n label: i18n('leads.status.enum.active.label'),\n value: 'active',\n disabled: false,\n },\n {\n label: i18n('leads.status.enum.closed.label'),\n value: 'closed',\n disabled: false,\n },\n {\n label: i18n('leads.status.enum.demoed.label'),\n value: 'demoed',\n disabled: false,\n },\n ])\n}\n\n// Currently, we don't *actually* support custom stage enums, so this is just a\n// wrapper for the default.\nexport const getLeadStageEnums = (i18n: i18nSelectorMap): Enum[] => {\n return getLocalizedDefaultLeadStageOptions(i18n)\n}\n\nconst getLocalizedDefaultLeadStageOptions = (i18n: i18nSelectorMap): Enum[] => {\n return [\n {\n label: i18n('leads.stage.enum.lead.label'),\n value: 'lead',\n disabled: false,\n },\n {\n label: i18n('leads.stage.enum.opportunity.label'),\n value: 'opportunity',\n disabled: false,\n },\n {\n label: i18n('leads.stage.enum.converted.label'),\n value: 'converted',\n disabled: false,\n },\n {\n label: i18n('leads.stage.enum.other.label'),\n value: 'other',\n disabled: false,\n },\n ]\n}\n","export enum TriggerConditionType {\n StatusInOrNotIn = 'StatusInOrNotIn',\n CreatedBeforeOrAfter = 'CreatedBeforeOrAfter',\n CreatedAtElapsed = 'CreatedAtElapsed',\n ViewCount = 'ViewCount',\n DaysInStatus = 'DaysInStatus',\n TriggerCountLimit = 'TriggerCountLimit',\n DaysBetweenReminders = 'DaysBetweenReminders',\n NotifyParentOrgs = 'NotifyParentOrgs',\n}\n\nexport enum Operator {\n Equals = '=',\n NotEquals = '!=',\n NotEqualsANSI = '<>',\n LessThan = '<',\n LessThanOrEqual = '<=',\n GreaterThan = '>',\n GreaterThanOrEqual = '>=',\n In = 'IN',\n NotIn = 'NOT IN',\n Before = 'BEFORE',\n After = 'AFTER',\n Trigger = 'TRIGGER',\n}\n\nexport type ValidConditionValue = string | string[] | boolean | number\n\nexport type APITriggerCondition = {\n Required: boolean\n Type: TriggerConditionType\n Operator?: string\n} & {\n [k in APITriggerConditionDataKeys]?: ValidConditionValue\n}\n\nexport type APITriggerConditionDataKeys =\n | 'Data'\n | 'Status'\n | 'DaysInStatus'\n | 'TriggerCount'\n | 'DaysBetweenReminders'\n | 'NotifyParentOrgs'\n | 'Elapsed'\n | 'Count'\n | 'Unknown'\n\nexport type UITriggerCondition = {\n required: boolean\n type: TriggerConditionType\n operator?: string\n\n dataKey: APITriggerConditionDataKeys\n value?: ValidConditionValue\n\n i18n: string\n helpText?: string\n\n forceDisabled?: boolean\n}\n\nexport type UITriggerConditionKeys = keyof Pick<UITriggerCondition, 'required' | 'type' | 'operator'> | APITriggerConditionDataKeys\n","// extracted by mini-css-extract-plugin\nmodule.exports = {\"primary\":\"#186262\",\"secondary\":\"#d8d9d9\",\"primaryLighten_15\":\"#158484\",\"primaryLighten_30\":\"#1a9e9e\",\"primaryDarken_15\":\"#0d4f4f\",\"primaryDarken_30\":\"#093535\",\"isModifiedColor\":\"#158484\",\"mutedBrand\":\"#809393\",\"primaryTextColor\":\"#d8d9d9\",\"secondaryTextColor\":\"#babbbe\",\"navBgColor\":\"#393c45\",\"tertiaryTextColor\":\"#d8d9d9\",\"invertedTextColor\":\"#2e3138\",\"contentBgColor\":\"#2e3138\",\"appBgColor\":\"#2e3138\",\"accentFillColor\":\"#5dc5c6\",\"borderColor\":\"#6d6f74\",\"border1pxSolid\":\"1px solid #6d6f74\",\"fieldBgColor\":\"#393c42\",\"fieldFocus\":\"#e3e3e3\",\"listHover\":\"#393c45\",\"tableBandedBackground\":\"#393c45\",\"ui_0\":\"#000\",\"ui_15\":\"#212c2c\",\"ui_30\":\"#415858\",\"ui_45\":\"#628484\",\"ui_60\":\"#8aa8a8\",\"ui_75\":\"#b6c9c9\",\"ui_85\":\"#d3dede\",\"ui_90\":\"#e2e9e9\",\"ui_95\":\"#f0f4f4\",\"ui_98\":\"#f9fbfb\",\"ui_100\":\"#fff\",\"success\":\"#3cae4c\",\"error\":\"#f3dd6d\",\"alert\":\"#2ad2c9\",\"disabledDark\":\"#525757\",\"tundora\":\"#404040\",\"fieldDisabledBorder\":\"#6d6f74\",\"fieldDisabledBackground\":\"#2e3138\",\"fieldDisabledText\":\"#a5abb5\",\"powerchordLogo\":\"url(/static/media/powerchord_logo_alt.49c02054.svg)\",\"powerchordAltLogo\":\"url(/static/media/powerchord_logo.25138d89.svg)\",\"iconInfo\":\"url(/static/media/info.cf65b834.svg)\",\"iconFieldCalendar\":\"url(/static/media/calendar.2d798caf.svg)\",\"iconUacArrow\":\"url(/static/media/keyboard_arrow_down.7d79d9d8.svg)\",\"fullContentWidth\":\"calc(100vw - 18rem)\",\"fullContentHeight\":\"calc(100vh - 3.5rem)\",\"pcShadowColor\":\"rgba(0,0,0,.15)\",\"pcShadowColorLight\":\"rgba(0,0,0,.08)\",\"pcDropShadow\":\"0px 5px 8px 3px rgba(0,0,0,.15)\",\"pcDropShadowFar\":\"1px 2px 20px rgba(0,0,0,.15)\",\"powerchordBrandmark\":\"url(/static/media/powerchord-brandmark.09a3c2cd.svg)\",\"architectIconSize\":\"18px\",\"iconOrgLandingPage\":\"url(/static/media/org_landing_page.7f2a5699.svg)\"};","import { createMuiTheme, Theme } from '@material-ui/core/styles'\nimport rootScss from '../components/root.module.scss'\nimport darkRootScss from '../components/root_drk.module.scss'\nimport { UserSettings } from '../types'\n\nconst spacer = 8\n\nconst spacing = (num1: number, num2?: number): string => {\n if (num2) {\n return `${spacer * num1}px ${spacer * num2}px`\n }\n return `${spacer * num1}px`\n}\n\n// Dumb thing. Injecting Sass variables when importing root.scss works fine in webpack,\n// but exports obj is undefined in jest tests. This function allows us to fall back to #fff in tests\nconst getRootScssFn = (scss: Record<string, string>) => (varName: string): string => {\n const value = scss[varName]\n if (value === undefined) {\n console.warn('Tried to get a root.scss variable named ' + varName + \" that doesn't exist. Defaulting to #fff\")\n return '#fff'\n }\n return value\n}\n\n/**\n * New Theme variables can be added below to either add new colors or new properties that can be used\n * like makeStyles(theme => { ..., value: { cssProp: theme.palette.newProp } })\n */\ndeclare module '@material-ui/core/styles/createPalette' {\n interface Palette {\n architectDrawer: string\n listItemOver: string\n tableBandedBackground: string\n }\n\n interface PaletteOptions {\n architectDrawer: string\n listItemOver: string\n tableBandedBackground: string\n }\n}\nconst theme = function (getRootScss: (what: string) => string) {\n return createMuiTheme({\n spacing,\n palette: {\n primary: {\n main: getRootScss('primary'),\n light: getRootScss('listHover'),\n },\n secondary: {\n main: getRootScss('secondary'),\n },\n error: {\n main: getRootScss('error'),\n light: getRootScss('error'),\n },\n text: {\n primary: getRootScss('primaryTextColor'),\n secondary: getRootScss('secondaryTextColor'),\n disabled: getRootScss('fieldDisabledText'),\n },\n background: {\n paper: getRootScss('appBgColor'),\n default: getRootScss('appBgColor'),\n },\n divider: getRootScss('borderColor'),\n architectDrawer: getRootScss('navBgColor'),\n listItemOver: getRootScss('ui_90'),\n tableBandedBackground: getRootScss('tableBandedBackground'),\n },\n typography: {\n fontFamily: ['Europa'].join(','),\n },\n props: {\n MuiIconButton: {\n color: 'inherit',\n },\n },\n overrides: {\n MuiList: {\n padding: {\n paddingTop: 0,\n paddingBottom: 0,\n },\n },\n MuiInputBase: {\n root: {\n border: getRootScss('border1pxSolid'),\n borderRadius: 4,\n cursor: 'inherit',\n padding: spacing(0.5, 1),\n backgroundColor: getRootScss('fieldBgColor'),\n '&.Mui-focused': {\n borderColor: getRootScss('fieldFocus'),\n },\n '&.MuiInput-underline:before': {\n borderBottom: 'none',\n },\n '&.MuiInput-underline:hover:not(.Mui-disabled):before': {\n borderBottom: 'none',\n },\n '&.MuiInput-underline:after': {\n borderBottom: 'none',\n },\n },\n },\n MuiOutlinedInput: {\n notchedOutline: {\n borderColor: getRootScss('primary'),\n '&:hover': {\n borderColor: getRootScss('primary'),\n },\n },\n input: {\n padding: spacing(1),\n },\n },\n MuiTable: {\n root: {\n borderSpacing: '0 3px',\n },\n },\n MuiTableRow: {\n root: {\n borderBottom: getRootScss('border1pxSolid'),\n '&$selected': {\n backgroundColor: getRootScss('tableBandedBackground'),\n },\n },\n },\n MuiTableCell: {\n root: {\n color: getRootScss('secondaryTextColor'),\n borderBottom: getRootScss('border1pxSolid'),\n paddingTop: '6px',\n paddingBottom: '6px',\n },\n },\n MuiTablePagination: {\n root: {\n display: 'flex',\n justifyContent: 'center',\n },\n },\n MuiSelect: {\n select: {\n background: 'none',\n '&:focus': {\n backgroundColor: 'transparent',\n },\n },\n },\n MuiButton: {\n root: {\n textTransform: 'initial',\n '&.Mui-disabled': {\n color: getRootScss('fieldDisabledText'),\n backgroundColor: getRootScss('fieldDisabledBackground'),\n },\n },\n contained: {\n '&.Mui-disabled': {\n color: getRootScss('fieldDisabledText'),\n backgroundColor: getRootScss('fieldDisabledBackground'),\n },\n },\n },\n MuiFormLabel: {\n asterisk: {\n display: 'none',\n },\n root: {\n fontSize: '1.1rem',\n '&.Mui-required::before': {\n content: '\"* \"',\n color: getRootScss('error'),\n },\n },\n },\n },\n })\n}\n\nexport const getTheme = (userSettings: UserSettings) => {\n switch (userSettings.theme) {\n case 'dark':\n return getRootScssFn(darkRootScss) //dark theme\n case 'light':\n default:\n return getRootScssFn(rootScss) //light theme\n }\n}\nexport default function (t?: string): Theme {\n switch (t) {\n case 'dark':\n return theme(getRootScssFn(darkRootScss)) //dark theme\n case 'light':\n default:\n return theme(getRootScssFn(rootScss)) //light theme\n }\n}\n","import { compose, defaultTo, isEmpty } from 'ramda'\nimport React, { Component } from 'react'\nimport { isEqual } from '../../lib'\nimport { Field, FieldPrimitive, formatModifiedByMessage } from '../../schemas'\nimport { Option } from '../../types'\nimport FieldMessage from '../FieldMessage/FieldMessage'\nimport Options from '../Options/Options'\nimport './Select.scss'\nimport { genCIAttr } from '../../util'\n\nconst EMPTY_VALUE_STRING = '-'\n\nexport const defaultIfEmpty = compose(defaultTo(EMPTY_VALUE_STRING), (value: any) => (isEmpty(value) ? null : value))\n\n// This is a very basic implementation with nearly all items set to\n// optional - the props are messy in actual usage but relying on\n// just `this.props` in the code is annoying!\ntype SelectProps = {\n className?: string\n required?: boolean\n value: Option[] | undefined\n multiple?: boolean\n disabled?: boolean\n label?: string\n field?: Field\n readOnly?: boolean\n placeholder?: string\n icon?: string\n hideLabel?: boolean\n error?: string\n options: Option[]\n modifiedBy?: string\n modifiedAt?: number\n focusedFilter?: string\n dataCIKey: string | undefined\n\n onChange: (value: Option[]) => void\n onClose?: (label: string) => void\n}\n\ntype SelectState = {\n selected: Option[]\n showOptions: boolean\n}\n\nexport default class Select extends Component<SelectProps, SelectState> {\n static getDerivedStateFromProps = (nextProps: SelectProps, prevState: SelectState) => {\n if (!isEqual(prevState.selected, nextProps.value)) {\n return {\n ...prevState,\n selected: nextProps.value ?? [],\n }\n }\n return null\n }\n\n constructor(props: SelectProps) {\n super(props)\n let showOptions = false\n if (props.focusedFilter && props.focusedFilter === props.label) {\n showOptions = true\n }\n this.state = {\n selected: this.props.value ?? [],\n showOptions: showOptions,\n }\n }\n\n componentDidMount() {\n document.addEventListener('click', this.handleOffClick)\n document.addEventListener('keydown', this.handleOffClick)\n }\n\n componentWillUnmount() {\n document.removeEventListener('click', this.handleOffClick)\n document.removeEventListener('keydown', this.handleOffClick)\n }\n\n component: any\n\n handleOffClick = (event: any) => {\n if (this.state.showOptions && this.component && !this.component.contains(event.target)) {\n this.setState({\n showOptions: false,\n })\n // set focusedFilter to empty!\n this.close(event)\n }\n }\n\n handleFieldClick = (event: any) => {\n event.stopPropagation()\n if (!this.props.disabled) {\n this.setState({\n showOptions: true,\n })\n }\n }\n\n field: any\n\n close = (event?: any) => {\n // set focusedFilter to empty!\n if (this.props.onClose && this.props.label) {\n this.props.onClose(this.props.label)\n }\n }\n\n handleFieldKeyDown = (event: any) => {\n event.stopPropagation()\n if (event.key === 'Enter' || event.key === ' ') {\n if (!this.props.disabled) {\n this.setState({\n showOptions: !this.state.showOptions,\n })\n // set focusedFilter to empty!\n this.close(event)\n }\n } else if (event.key === 'Escape') {\n this.setState({\n showOptions: false,\n })\n this.field.focus()\n // set focusedFilter to empty!\n this.close(event)\n }\n }\n\n handleOptionSelect = (value: Option[]) => {\n const shouldStayOpen = this.props.multiple || false\n this.props.onChange(value)\n this.setState({\n selected: value,\n showOptions: shouldStayOpen,\n })\n this.field.focus()\n if (!shouldStayOpen) {\n this.close()\n }\n }\n\n renderIcon = (icon: string | undefined) => {\n if (!icon) return null\n return <div className={'icon ' + icon} />\n }\n\n getFieldKey(): string | undefined {\n const fieldKey = this.props.field?.key\n if (!fieldKey || fieldKey.length === 0) return undefined\n return fieldKey\n }\n\n renderField = (fieldID: any) => {\n let selectedText = ''\n if (this.state.selected.length > 0) {\n selectedText = this.state.selected.map((selection: any) => selection.label).join(', ')\n }\n\n if (!this.props.readOnly) {\n let textClass = 'text'\n\n if (!selectedText && this.props.placeholder) {\n textClass += ' placeholder'\n selectedText = this.props.placeholder\n }\n\n return (\n <div\n className=\"field\"\n id={fieldID}\n data-ci={genCIAttr('select', this.props.dataCIKey)}\n onClick={this.handleFieldClick}\n onKeyDown={this.handleFieldKeyDown}\n ref={(field) => {\n this.field = field\n }}\n role=\"button\"\n tabIndex={0}\n >\n {this.renderIcon(this.props.icon)}\n <div className={textClass}>{selectedText}</div>\n <div className=\"arrow\" />\n {this.renderOptions()}\n </div>\n )\n }\n\n // if the field is readOnly and the selectedText is an empty string (undefined, null, ''), then it needs to be set to the determined default\n selectedText = defaultIfEmpty(selectedText)\n\n return (\n <div className=\"text\" id={fieldID} data-ci={genCIAttr('select', this.props.dataCIKey, 'readOnly')}>\n {selectedText}\n </div>\n )\n }\n\n renderLabel = (label: any) => {\n const fieldKey = this.getFieldKey()\n const fieldID = fieldKey || 'field-ID-' + Date.now()\n if (!label) {\n return this.renderField(fieldID)\n }\n return (\n <label htmlFor={fieldID}>\n {this.props.hideLabel ? null : label}\n {this.renderField(fieldID)}\n </label>\n )\n }\n\n renderMessage = () => {\n if (this.props.error) {\n return <FieldMessage error={this.props.error} />\n }\n return null\n }\n\n renderOptions = () => {\n if (this.props.options && this.props.options.length && !this.props.readOnly && this.state.showOptions) {\n return (\n <Options\n field={this.props.field}\n multiple={this.props.multiple}\n onSelect={this.handleOptionSelect}\n options={this.props.options}\n selected={this.state.selected}\n dataCIKey={this.props.dataCIKey}\n />\n )\n }\n return null\n }\n\n renderModerationMessage = () => {\n const { modifiedBy, modifiedAt } = this.props\n if (!modifiedBy || !modifiedAt) {\n return null\n }\n return <span data-ci=\"moderation-message\">{formatModifiedByMessage(modifiedBy, modifiedAt)}</span>\n }\n\n render = () => {\n let classList = 'Select'\n if (this.props.className) {\n classList += ` ${this.props.className}`\n }\n if (this.props.error) {\n classList += ' has-error'\n }\n if (this.props.disabled) {\n classList += ' is-disabled'\n }\n if (this.props.required) {\n classList += ' is-required'\n }\n // isModified is used to show modified fields in Draft/Pending records so they can be found and approved. - JamesS\n if (this.props.modifiedBy && this.props.modifiedAt) {\n classList += ' is-modified'\n }\n\n return (\n <div\n data-ci={genCIAttr('select-wrapper', this.props.dataCIKey)}\n className={classList}\n ref={(component) => {\n this.component = component\n }}\n >\n {this.renderModerationMessage()}\n {this.renderLabel(this.props.label)}\n {this.renderMessage()}\n </div>\n )\n }\n}\n","import { always, ifElse, not } from 'ramda'\n\nconst formatLocalTime = ifElse(not, always(''), (timestamp: any) =>\n timestamp.toLocaleTimeString([], {\n day: '2-digit',\n month: '2-digit',\n year: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n })\n)\n\nexport default formatLocalTime\n","// Expects an i18n string, variable to find in the string, and value to replace the variable with\n// Example: (\"Add {item}\", \"item\", \"Products\") would result in \"Add Products\"\nexport default function (i18nString: string, variableName: string, variableValue: string) {\n return i18nString.replace(new RegExp('{' + variableName + '}', 'g'), variableValue)\n}\n","export default function (i18nString: string, values: any) {\n for (const variable in values) {\n i18nString = i18nString.replace(new RegExp('{' + variable + '}', 'g'), values[variable])\n }\n return i18nString\n}\n","import { createBrowserHistory } from 'history'\nimport { anyPass, complement, compose, find, isEmpty, isNil, merge, pickBy } from 'ramda'\n\nexport function isArrayEqual(a: Array<any>, b: Array<any>): boolean {\n if (!Array.isArray(a) || !Array.isArray(b)) return false\n if (a.length !== b.length) return false\n return a.reduce((acc, curr) => {\n // if the value has been flipped to false, keep it that way\n if (!acc) return acc\n // if the current value is not in \"b\", then return false\n const bCurr = find((v) => isEqual(v, curr), b)\n if (!bCurr) return false\n return acc\n }, true)\n}\n\nexport function isObjectEqual(a: any, b: any): boolean {\n if (typeof a !== 'object' || typeof b !== 'object') return false\n const aKeys = Object.getOwnPropertyNames(a)\n const bKeys = Object.getOwnPropertyNames(b)\n if (aKeys.length !== bKeys.length) return false\n return aKeys.reduce((acc: any, curr: any) => {\n if (!acc) return acc\n const aVal = a[curr]\n const bVal = b[curr]\n return isEqual(aVal, bVal)\n }, true)\n}\n\nexport function isValueEqual(a: any, b: any): boolean {\n return a === b\n}\n\nexport function isEqual(a: any, b: any): boolean {\n if (typeof a !== typeof b) return false\n if (Array.isArray(a)) return isArrayEqual(a, b)\n if (typeof a === 'object') return isObjectEqual(a, b)\n return isValueEqual(a, b)\n}\nconst emptyOrNil = anyPass([isNil, isEmpty])\nconst notEmptyOrNil = complement(emptyOrNil)\nexport const mergeAndFilterRight = compose(pickBy(notEmptyOrNil), merge)\n\nexport const history = createBrowserHistory()\n\nexport const push = history.push\n\nexport const callIfExists = (...values: any) => (fn?: Function) => {\n if (fn && typeof fn === 'function') {\n return fn(...values)\n }\n return values[0]\n}\n\nexport const uuid = () => {\n let d = new Date().getTime()\n if (typeof performance !== 'undefined' && typeof performance.now === 'function') {\n d += performance.now()\n }\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\n const r = (d + Math.random() * 16) % 16 | 0\n d = Math.floor(d / 16)\n return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16)\n })\n}\n\nexport { default as formatLocalTime } from './formatLocalTime'\nexport { default as replaceVariable } from './replaceVariable'\nexport { default as replaceVariables } from './replaceVariables'\nexport { default as getFirstNestedPathString } from './getFirstNestedPathString'\n","import { createSelector } from 'reselect'\nimport { AppState } from '../store'\nimport { Enum, Option } from '../types'\nimport { enumToOptionEnum } from '../util/enums'\n\nexport const autocompleteSelector = createSelector(\n (state: AppState) => state && state.autocomplete,\n (autocomplete: any): Option[] => autocomplete.options || []\n)\n\nexport const assignmentsSelector = (state: AppState): Enum[] => state.autocomplete.assignments ?? []\n\nexport const selectAssignmentOptions = (state: AppState): Option[] => {\n return enumToOptionEnum(assignmentsSelector(state))\n}\n","import { every, get, isArray } from 'lodash'\nimport { ModalProps } from '../actions'\nimport { AppState } from '../store'\n\nexport const showModalSelector = (state: AppState): any => {\n return (state && state.ui && state.ui.showModal) || false\n}\n\nexport const modalSelector = (state: AppState): any => {\n return (state && state.ui && state.ui.modal) || ''\n}\n\nexport const modalCallbackSelector = (state: AppState): any => {\n return (state && state.ui && state.ui.modalCallback) || ''\n}\n\nexport const loadingSelector = (state: AppState, entity: string | Array<string>): boolean => {\n const loaders = get(state, 'ui.loaders', {})\n\n if (isArray(entity)) {\n // return true if every entity is not done loading\n return !every(entity, (e: any) => !loaders[e])\n }\n return loaders[entity]\n}\n\nexport const notificationSelector = (state: AppState): any => {\n return get(state, 'ui.notifications', [])\n}\n\nexport const v2ModalSelector = (state: AppState): ModalProps | null => {\n return get(state, 'ui.v2Modal', null)\n}\n","import { find, isEmpty, isNil, isObject, reduce } from 'lodash'\nimport { DocumentState } from 'reducers/document'\nimport { createSelector } from 'reselect'\nimport { EditorMode } from '../actions'\nimport { Resource } from '../resource'\nimport { Field, Schema } from '../schemas'\nimport { primaryLocaleSelector } from './settings'\nimport { AppState } from '../store'\nimport { fieldSchemaSelector, pendingApprovalSelector, schemaSelector } from './schema'\nimport { i18nSelectorMap } from '../reducers/i18n'\n\nexport const wipDocumentSelector = (state: AppState): Resource => (state?.document?.wip ?? {}) as Resource\n\nexport const originalDocumentSelector = (state: AppState): Resource => (state?.document?.original ?? {}) as Resource\n\nexport const unsavedChangesSelector = (state: { document?: DocumentState }): boolean => {\n const original = state?.document?.original ?? {}\n const wip = state?.document?.wip ?? {}\n return JSON.stringify(original) !== JSON.stringify(wip)\n}\n\nexport const documentErrorSelector = (state: AppState): any => state?.document?.errors ?? undefined\n\nexport const canBeDuplicatedSelector = (state: AppState, schema?: Schema): boolean => {\n if (!schema) {\n schema = schemaSelector(state)\n }\n if (!schema.isDuplicable) {\n return false\n }\n if (!schema.userCanDuplicate) {\n return false\n }\n\n // This was formerly a selector, but it was imported cyclically and only used here so we'll just access state directly instead.\n const allowDuplication = state.settings?.resourceSettings?.allowDuplication ?? false\n if (!allowDuplication) {\n return false\n }\n const document = originalDocumentSelector(state)\n const primaryLocale = primaryLocaleSelector(state)\n if (primaryLocale !== document.locale) {\n return false\n }\n if (!document.ID) {\n return false\n }\n return true\n}\n\n/**\n * Get the name of a resource type, or an error title if there was an error while loading a resource\n */\nexport const documentPageTitleSelector = (state: AppState, i18n: i18nSelectorMap): string | undefined => {\n if (state?.schema?.label) {\n return state.schema.label\n }\n\n const error = documentErrorSelector(state)\n if (!error) {\n return undefined\n }\n\n switch (error._code) {\n case 'ErrNotFound':\n return i18n('editor.messages.loadErrorTitleNotFound')\n\n default:\n return i18n('editor.messages.loadErrorTitle')\n }\n}\n\nexport const fieldSelector = (fieldKey: string) =>\n createSelector(\n (state: AppState) => state?.document?.wip?.[fieldKey] ?? null,\n fieldSchemaSelector,\n (fieldValue: any, fieldSchema: any) => {\n return {\n value: fieldValue,\n schema: fieldSchema,\n }\n }\n )\n\nexport const documentWipIDSelector = (state: AppState) => state?.document?.wip?.ID ?? ''\n\nexport const fieldValueSelector = (state: AppState, fieldKey: string) => state?.document?.wip?.[fieldKey] ?? null\n\nexport const fieldErrorSelector = (state: AppState, fieldKey: string) => {\n const errs = state?.document?.errors\n if (!errs) {\n return undefined\n }\n\n // display err for fieldKey\n const fieldErr = errs?.[fieldKey]\n if (fieldErr) {\n return fieldErr\n }\n\n const fieldSchema = find(state.schema.fields, (field: Field) => field.key === fieldKey)\n\n if (fieldSchema) {\n // display errs for \"hidden\" fields which\n // are set by an autoComplete setInstruction\n const setInstructions = fieldSchema?.autoComplete?.set\n if (setInstructions) {\n const setInstructionErr = find(errs, (_err, key) => find(setInstructions, (setInstruction) => setInstruction.to === key))\n\n if (setInstructionErr) {\n return setInstructionErr\n }\n }\n }\n\n return undefined\n}\n\nexport const documentActionSelector = (state: AppState): string[] => {\n const schema = schemaSelector(state)\n const pendingApproval = pendingApprovalSelector(state)\n const document = wipDocumentSelector(state)\n const canBeDuplicated = canBeDuplicatedSelector(state, schema)\n const actions: string[] = []\n\n if (canBeDuplicated) {\n actions.push(EditorMode.DUPLICATE)\n }\n\n if (schema.isImmutable) {\n actions.push('cancel')\n } else if (schema.shouldModerate) {\n actions.push('cancel', 'draft', 'publish')\n } else if (pendingApproval) {\n actions.push('cancel', 'deny', 'approve')\n } else if (document.ID === '') {\n actions.push('cancel', 'create')\n } else if (document.ID && document.ID.length) {\n actions.push('cancel', 'save')\n }\n\n return actions\n}\n\nexport const documentErrorCountSelector = (state: AppState): number => {\n // We need to account for undefined key values. This happens when document\n // errors are cleared\n\n const errs = omitNullish(documentErrorSelector(state))\n return getErrCount(errs)\n}\n\n// getErrCount counts all fields recursively\nfunction getErrCount(errs: any): number {\n if (!errs) {\n return 0\n }\n\n return reduce(\n errs,\n (sum, value) => {\n if (isObject(value)) {\n return sum + getErrCount(value)\n }\n return sum + 1\n },\n 0\n )\n}\n\n// omitNullish recursively omits nullish fields\n// because validation assigns successfully validated fields\n// on the errors object with an undefined value\n// and can include nested fields\nfunction omitNullish(value: any): any | undefined {\n if (isNil(value) || isEmpty(value)) {\n return undefined\n }\n\n if (isObject(value)) {\n const omitted = reduce(\n value,\n (sum: any, value: any, key: string) => {\n if (isObject(value)) {\n const omitted = omitNullish(value)\n if (!!omitted) {\n sum[key] = omitted\n }\n } else if (!isNil(value)) {\n sum[key] = value\n }\n return sum\n },\n {}\n )\n\n if (isEmpty(omitted)) {\n return undefined\n }\n return omitted\n }\n return value\n}\n","import { Trigger, TriggerKeys } from '../v3/type/Trigger'\nimport { Action } from '../v3/type/Action'\nimport { Scope } from '../types'\n\nexport enum TriggerActionType {\n // Detail CRUD\n DETAIL_GET = '[trigger] Detail Get',\n DETAIL_GET_ERROR = '[trigger] Detail Get API_ERROR',\n DETAIL_GET_SUCCESS = '[trigger] Detail Get API_SUCCESS',\n SAVE_TRIGGER = '[trigger] Detail Save',\n SAVE_TRIGGER_ERROR = '[trigger] Detail Save API_ERROR',\n SAVE_TRIGGER_SUCCESS = '[trigger] Detail Save API_SUCCESS',\n DELETE_TRIGGER = '[trigger] Delete',\n DELETE_TRIGGER_ERROR = '[trigger] Delete API_ERROR',\n DELETE_TRIGGER_SUCCESS = '[trigger] Delete API_SUCCESS',\n // List CRUD\n LIST_GET = '[triggers] List Get',\n LIST_GET_ERROR = '[triggers] List Get API_ERROR',\n LIST_GET_SUCCESS = '[triggers] List Get API_SUCCESS',\n // Cached actions CRUD\n GET_CACHED_ACTIONS = '[triggers] Get Cached Actions',\n GET_CACHED_ACTIONS_SUCCESS = '[triggers] Get Cached Actions API_SUCCESS',\n GET_CACHED_ACTIONS_ERROR = '[triggers] Get Cached Actions API_ERROR',\n // State updates\n SET_TRIGGER = '[trigger] Set',\n SET_TRIGGERS = '[triggers] Set',\n SET_SCOPE = '[triggers] Set Scope',\n UPDATE_TRIGGER = '[trigger] Update State',\n SET_TRIGGER_ERROR = '[triggers] Set Error',\n SET_EDITOR_ERROR = '[trigger] Set Editor Error',\n UNSET_EDITOR_ERROR = '[trigger] Unset Editor Error',\n}\n\n// GET Detail Page action\nexport type GetTriggerDetailAction = {\n type: TriggerActionType.DETAIL_GET\n payload: {\n id: string\n scope: Scope\n }\n}\n\nexport const getTriggerDetail = (id: string, scope: Scope): GetTriggerDetailAction => ({\n type: TriggerActionType.DETAIL_GET,\n payload: {\n id: id,\n scope: scope,\n },\n})\n\nexport type GetTriggerDetailErrorAction = {\n type: TriggerActionType.DETAIL_GET_ERROR\n payload: {\n message: string\n }\n}\n\nexport type GetTriggerDetailSuccessAction = {\n type: TriggerActionType.DETAIL_GET_SUCCESS\n payload: Trigger[]\n}\n\nexport type UpdateTriggerAction = {\n type: TriggerActionType.UPDATE_TRIGGER\n payload: {\n field: TriggerKeys\n value: any\n skipValidation?: boolean\n }\n}\n\nexport const updateTrigger = (field: TriggerKeys, value: unknown, skipValidation?: boolean): UpdateTriggerAction => ({\n type: TriggerActionType.UPDATE_TRIGGER,\n payload: {\n field: field,\n value: value,\n skipValidation: skipValidation,\n },\n})\n\nexport type SaveTriggerDetailAction = {\n type: TriggerActionType.SAVE_TRIGGER\n payload: Trigger\n}\n\nexport const saveTrigger = (trigger: Trigger): SaveTriggerDetailAction => ({\n type: TriggerActionType.SAVE_TRIGGER,\n payload: trigger,\n})\n\nexport type SaveTriggerDetailSuccessAction = {\n type: TriggerActionType.SAVE_TRIGGER_SUCCESS\n payload: Trigger\n}\n\n// GET List action\nexport type GetTriggerListAction = {\n type: TriggerActionType.LIST_GET\n payload: {\n scope: Scope\n }\n}\n\nexport const getTriggerList = (scope: Scope): GetTriggerListAction => ({\n type: TriggerActionType.LIST_GET,\n payload: {\n scope: scope,\n },\n})\n\nexport type GetTriggerListErrorAction = {\n type: TriggerActionType.LIST_GET_ERROR\n payload: {\n message: string\n }\n}\n\nexport type GetTriggerListSuccessAction = {\n type: TriggerActionType.LIST_GET_SUCCESS\n payload: Trigger[]\n}\n\nexport type SetTriggerAction = {\n type: TriggerActionType.SET_TRIGGER\n payload: {\n trigger: Trigger\n initialLoad: boolean\n }\n}\n\nexport const setTrigger = (trigger: Trigger, initialLoad?: boolean): SetTriggerAction => ({\n type: TriggerActionType.SET_TRIGGER,\n payload: {\n trigger: trigger,\n initialLoad: !!initialLoad,\n },\n})\n\nexport type SetTriggersAction = {\n type: TriggerActionType.SET_TRIGGERS\n payload: {\n triggers: Trigger[]\n }\n}\nexport const setTriggers = (triggers: Trigger[]): SetTriggersAction => ({\n type: TriggerActionType.SET_TRIGGERS,\n payload: {\n triggers: triggers,\n },\n})\n\n// DELETE Detail Page action\nexport type DeleteTriggerDetailAction = {\n type: TriggerActionType.DELETE_TRIGGER\n payload: Trigger\n}\n\nexport const deleteTriggerDetail = (trigger: Trigger): DeleteTriggerDetailAction => ({\n type: TriggerActionType.DELETE_TRIGGER,\n payload: trigger,\n})\n\nexport type DeleteTriggerErrorAction = {\n type: TriggerActionType.DELETE_TRIGGER_ERROR\n payload: {\n message: string\n }\n}\n\nexport type DeleteTriggerSuccessAction = {\n type: TriggerActionType.DELETE_TRIGGER_SUCCESS\n}\n\nexport type SetTriggerScopeAction = {\n type: TriggerActionType.SET_SCOPE\n payload: Scope\n}\n\nexport const setTriggerScope = (scope: Scope): SetTriggerScopeAction => ({\n type: TriggerActionType.SET_SCOPE,\n payload: scope,\n})\n\nexport type SetTriggerErrorAction = {\n type: TriggerActionType.SET_TRIGGER_ERROR\n payload?: string\n}\n\nexport const setTriggerError = (error?: string): SetTriggerErrorAction => ({\n type: TriggerActionType.SET_TRIGGER_ERROR,\n payload: error,\n})\n\nexport type SetTriggerEditorErrorAction = {\n type: TriggerActionType.SET_EDITOR_ERROR\n payload: {\n field: TriggerKeys\n error: string | undefined\n }\n}\n\nexport const setTriggerEditorError = (field: TriggerKeys, error: string | undefined): SetTriggerEditorErrorAction => ({\n type: TriggerActionType.SET_EDITOR_ERROR,\n payload: {\n field: field,\n error: error,\n },\n})\n\nexport type UnsetTriggerEditorErrorAction = {\n type: TriggerActionType.UNSET_EDITOR_ERROR\n}\n\nexport const unsetTriggerEditorError = (): UnsetTriggerEditorErrorAction => ({\n type: TriggerActionType.UNSET_EDITOR_ERROR,\n})\n\nexport type GetActionSuccessAction = {\n type: TriggerActionType.GET_CACHED_ACTIONS_SUCCESS\n payload: Action\n}\n\nexport type TriggerActions =\n | GetTriggerDetailAction\n | GetTriggerDetailSuccessAction\n | GetTriggerDetailErrorAction\n | SetTriggerAction\n | SetTriggersAction\n | SaveTriggerDetailAction\n | SaveTriggerDetailSuccessAction\n | GetTriggerListAction\n | GetTriggerListSuccessAction\n | GetTriggerListErrorAction\n | DeleteTriggerDetailAction\n | SetTriggerScopeAction\n | SetTriggerErrorAction\n | SetTriggerEditorErrorAction\n | UnsetTriggerEditorErrorAction\n | GetActionSuccessAction\n | UpdateTriggerAction\n | DeleteTriggerSuccessAction\n | DeleteTriggerErrorAction\n","import { Enum, Lead, LeadType, Option, QueriedLead, V3Organization } from '../types'\nimport { i18nKey, i18nSelectorMap } from '../reducers/i18n'\n\nconst productKeys: string[] = ['productName', 'variant', 'vehicleModel', 'vehicleMake']\n\nexport function getLeadName(lead: Lead): string {\n if (lead.DisplayName) {\n return lead.DisplayName\n }\n\n const content = lead.Content\n if (!content) {\n return ''\n }\n\n let name = ''\n\n try {\n if (content['name']) {\n name = content['name']\n }\n\n if (name === '') {\n const fn = content['firstName'] ?? content['first_name'] ?? ''\n const ln = content['lastName'] ?? content['last_name'] ?? ''\n\n if (fn !== '') {\n name = fn\n }\n\n if (fn === '' && ln !== '') {\n name = ln\n }\n\n if (name !== '' && ln !== '') {\n name += ' ' + ln\n }\n }\n\n for (let i = 0; i < productKeys.length; i++) {\n const value = content[productKeys[i]] ?? ''\n if (value.length) {\n name += ' ' + value\n break\n }\n }\n } catch (err) {}\n\n return name\n}\n\nexport const getLeadBrandName = (lead: Lead, v3Orgs: V3Organization[]): string => {\n if (!lead.Organization) return ''\n\n const brandName = lead.Organization.Name ?? ''\n\n if (lead.Organization.TrunkID === '' || v3Orgs.length === 0) {\n return brandName\n }\n\n const trunk = v3Orgs.find((org) => {\n return org.ID === lead.Organization!.TrunkID\n })\n if (!trunk) {\n return brandName\n }\n\n return trunk.Name ?? brandName\n}\n\nexport const marshalQueriedLeadToLead = (ql: QueriedLead): Lead => {\n // Items marked with 'Placeholder' are not present in a QueriedLead, but are required by a Lead.\n // These fields should not be used in places where we are handling QueriedLeads - if we ever\n // neeed to, then the backend query result must be updated!\n //\n // Some of these fields may actually be optional - ex: the V3Organization may have too many required fields\n return {\n ID: ql.id,\n CreatedAt: ql.createdAt,\n UpdatedAt: ql.updatedAt,\n TypeLabel: ql.typeLabel,\n TypeKey: ql.typeKey,\n Status: ql.status,\n Stage: ql.stage,\n Content: ql.content,\n IsTestLead: ql.isTestLead,\n DisplayName: ql.displayName,\n Organization: {\n ID: ql.orgID,\n Name: ql.orgName, // Placeholder\n Status: '', // Placeholder\n TrunkID: ql.trunkID,\n TrunkName: ql.trunkName,\n },\n }\n}\n\nexport const marshalQueriedLeadsToLeads = (qls: QueriedLead[]): Lead[] => {\n return qls.map((ql) => {\n return marshalQueriedLeadToLead(ql)\n })\n}\n\nexport const convertLeadTypesToEnums = (leadTypes: LeadType[]): Enum[] => {\n return leadTypes.map((lt) => ({ label: lt.typeLabel, value: lt.typeLabel, disabled: false }))\n}\n\nexport const getLeadStatusLabel = (i18n: i18nSelectorMap, status: string | undefined, statusOptions: Option[]): string => {\n return getStatusOrStageLabel(i18n, status, statusOptions, false)\n}\n\nexport const getLeadStageLabel = (i18n: i18nSelectorMap, stage: string | undefined, stageOptions: Option[]): string => {\n return getStatusOrStageLabel(i18n, stage, stageOptions, true)\n}\n\nconst getStatusOrStageLabel = (i18n: i18nSelectorMap, value: string | undefined, options: Option[], isStage: boolean): string => {\n if (!value || value === '') {\n return ''\n }\n\n let i18nNamespace = 'status'\n if (isStage) {\n i18nNamespace = 'stage'\n }\n\n // We want to maintain localized labels wherever possible\n const i18nLabel = i18n(`leads.${i18nNamespace}.enum.${value}.label` as i18nKey)\n if (i18nLabel !== '') {\n return i18nLabel\n }\n\n // Find the status/stage by value in the provided options array and return the label for this if found.\n const statusOrStageFromOptions = options.find((op) => op.value === value)\n if (statusOrStageFromOptions && statusOrStageFromOptions.label !== '') {\n return statusOrStageFromOptions.label\n }\n\n // Fallback to returning the provided value string\n return value\n}\n","// IDFromV2 transposes a V2 ID into a V3 ID\n// works with 00000000-0000-0000-0000-000000000000\nexport function IDFromV2(id: string): string {\n if (!id) {\n return ''\n }\n\n if (id.length === 32) {\n return id\n }\n\n // pad the left portion of the V2 ID with the appropriate amount of zeros\n const v3 = new Array(32 - id.length).fill(0).concat(id.split(''))\n\n // slice the padded array into it's component parts, joining each individual slice to create a string\n // then, join each array element of strings with '-' to create the V3 ID structure\n return [v3.slice(0, 8).join(''), v3.slice(8, 12).join(''), v3.slice(12, 16).join(''), v3.slice(16, 20).join(''), v3.slice(20).join('')].join('-')\n}\n","import { SessionState } from 'reducers/session'\nimport config from '../config'\nimport { Settings } from '../types'\nimport { getLocalStorage } from './localStorage'\n\ndeclare global {\n interface Window {\n // Defined by apps/admin/public/deps.x.x.x.js\n PCTracking: typeof PCTracking\n }\n}\n\n/**\n * TODO expand this from the source. Maybe rip it from the lib that pc clickstream was forked from.\n */\nexport declare class PCTracking {\n static client?: PCTracking\n constructor(opts: { host?: string })\n static ready(fn: () => void): void\n static listenTo(what: Record<string, (e: Event) => void>): void\n static helpers: {\n getDomNodePath(e?: EventTarget | null): string\n getBrowserProfile(): {}\n getDomNodeProfile(el: Element): {}\n getUniqueId(): string\n }\n static utils: {\n timer(): {\n value(): number\n }\n }\n extendEvents(fn: (a: any, b: any) => {}): void\n recordEvent(name: string, meta: {}, fn?: (err?: {}, res?: {}) => void): void\n initAutoTracking(opts: {}): void\n}\n\n// The time that the app was first rendered\nconst pageLoadTime = new Date()\n// The time since the last 'pageviews' event was invoked. Should be reset manually whenever there's a page change\nlet lastPageChange = new Date()\n\n/**\n * Enable PC Clickstream Tracking, listen to global events, and set default tracking data\n * Additional usage docs here: https://github.com/tampajohn/keen-tracking.js\n */\nexport function initTracking() {\n PCTracking.ready(() => {\n PCTracking.client = new PCTracking({\n host: 'pc.clickstream.events',\n })\n\n // Collect all button click events\n PCTracking.listenTo({\n // Just button clicks for now. Listening to `a` clicks causes the whole app to reload every time the user clicks a sidenav link.\n 'click button, button *': (e) => {\n const target = e.target as Element\n PCTracking.client?.recordEvent('click', {\n element: PCTracking.helpers.getDomNodeProfile(target),\n })\n },\n })\n\n PCTracking?.client?.extendEvents(trackingData)\n })\n}\n\n/**\n * Invoke this whenever a route changes to track it in PC Clickstream\n */\nexport function trackPageView() {\n // Wrap in a ready() because sometimes this function is invoked before PCTracking is done setting itself up\n window.PCTracking.ready(() => {\n window.PCTracking.client?.recordEvent('pageviews', {}, (err) => {\n if (!err) {\n // Reset the 'time on page' counter\n lastPageChange = new Date()\n }\n })\n })\n}\n\nexport function trackEvent(name: string, payload?: {}) {\n window.PCTracking.ready(() => {\n window.PCTracking.client?.recordEvent(name, payload ?? {})\n })\n}\n\n/**\n * trackingData injects platformSettings feature flags into default tracking data sent to pc click stream\n */\nexport function trackingData(platformSettings?: Settings): any {\n const loadId = PCTracking.helpers.getUniqueId()\n\n const browserProfile: { description?: string } = PCTracking.helpers.getBrowserProfile()\n const timeOnPageMs = new Date().getTime() - lastPageChange.getTime()\n const data = {\n app: 'Command Center',\n build: config.build,\n local_time_full: new Date().toISOString(),\n featureFlags: {\n analyticsSettings: platformSettings?.analyticsSettings,\n enableV3: platformSettings?.enableV3,\n enableFocalPoint: platformSettings?.enableFocalPoint,\n },\n locale: getLocalStorage(config.languageKey),\n url: { full: window.location.href, host: window.location.hostname, path: window.location.pathname, qs: window.location.search },\n tech: { profile: browserProfile },\n user: {},\n organization: {},\n page: {\n load_id: loadId,\n title: document ? document.title : null,\n description: browserProfile.description,\n time_on_page: Math.round(timeOnPageMs / 1000),\n time_on_page_ms: timeOnPageMs,\n time_since_first_load: new Date().getTime() - pageLoadTime.getTime(),\n },\n }\n\n const session: SessionState | null = getLocalStorage(config.sessionKey)\n if (session) {\n data.user = { ...session.user, uuid: session.user.ID }\n data.organization = session.organization\n }\n\n return data\n}\n","export const C_SCHEMAS = '[createable schemas]'\nexport const GET_C_SCHEMAS = '[createable schemas] Fetch'\nexport const SET_C_SCHEMAS = '[createable schemas] Set'\n\ninterface SetCreateableSchemasAction {\n type: typeof SET_C_SCHEMAS\n payload: any\n}\n\nexport const setCreateableSchemas = (cSchemas: any): SetCreateableSchemasAction => ({\n type: SET_C_SCHEMAS,\n payload: cSchemas,\n})\n\ninterface GetCreatableSchemasAction {\n type: typeof GET_C_SCHEMAS\n payload: string\n}\n\nexport const getCreateableSchemas = (resource: string): GetCreatableSchemasAction => ({\n type: GET_C_SCHEMAS,\n payload: resource,\n})\n","export enum FlagActionTypes {\n SET_FLAG = '[flags] Set Flag',\n SET_FLAGS = '[flags] Set All',\n CALCULATE_FLAGS = '[flags] Calculate',\n}\n\nexport type FlagActions =\n | { type: FlagActionTypes.SET_FLAG; payload: { key: string; on: boolean } }\n | { type: FlagActionTypes.SET_FLAGS; payload: Record<string, boolean> }\n | { type: FlagActionTypes.CALCULATE_FLAGS }\n\nexport const setFlags = (flags: Record<string, boolean>): FlagActions => ({\n type: FlagActionTypes.SET_FLAGS,\n payload: flags,\n})\n\nexport const setFlag = (key: string, on: boolean): FlagActions => ({\n type: FlagActionTypes.SET_FLAG,\n payload: {\n key,\n on,\n },\n})\n\nexport const calculateFlags = (): FlagActions => ({\n type: FlagActionTypes.CALCULATE_FLAGS,\n})\n","export const MEMBERSHIPS = '[memberships]'\nexport const SET_MEMBERSHIPS = '[memberships] Set'\nexport const GET_MEMBERSHIPS = '[memberships] Fetch'\n\ninterface SetMembershipsAction {\n type: typeof SET_MEMBERSHIPS\n payload: any[]\n}\n\nexport const setMemberships = (memberships: any[]): SetMembershipsAction => ({\n type: SET_MEMBERSHIPS,\n payload: memberships,\n})\n\ninterface GetMembershipsAction {\n type: typeof GET_MEMBERSHIPS\n payload: string\n}\n\nexport const getMemberships = (userID: string): GetMembershipsAction => ({\n type: GET_MEMBERSHIPS,\n payload: userID,\n})\n","import { AnyAction } from 'redux'\n\nexport const MENU = '[menu]'\nexport const SET_MENU = `${MENU} Set`\n\nexport type MenuItem = {\n key: string\n label: string\n type?: string\n isAllowed: boolean\n items?: ItemChild[]\n category: string\n presentation: string\n weblink: string\n sortOrder?: number\n}\n\nexport type ItemChild = Omit<MenuItem, 'items'>\n\nexport type Menu = MenuItem[]\n\nexport const setMenu = (menu: Menu): AnyAction => ({\n type: SET_MENU,\n payload: menu,\n})\n","import { Schema } from '../schemas'\nimport { AppState } from '../store'\n\nexport const createableSchemasSelector = (state: AppState): Schema[] => state?.createableSchemas ?? []\n","import { AppState } from '../store'\n\nexport const flagSelector = (state: AppState, flag: string): boolean => state.flags?.[flag] ?? false\n\nexport const selectAllFlags = (state: AppState, ...flags: string[]): boolean => {\n for (const i of flags) {\n if (!flagSelector(state, i)) {\n return false\n }\n }\n return true\n}\n\nexport const selectAnyFlag = (state: AppState, ...flags: string[]): boolean => {\n for (const i of flags) {\n if (flagSelector(state, i)) {\n return true\n }\n }\n return false\n}\n","import { Menu } from '../actions/menu'\nimport { AppState } from '../store'\n\nexport const menuSelector = (state: AppState): Menu => state?.menu ?? []\n","import _ from 'lodash'\nimport { AppState } from '../store'\nimport { categorySelector } from './location'\nimport { Schema } from '../schemas'\nimport { Category } from '../types/Schema'\n\nconst parseCategories = (schemas: Schema[]) => (schemas || []).reduce((ac: Category[], cur) => ac.concat(cur.categories || []), [])\n\n// return the first schema in the list as the default schema, used as default landing page after login\nexport const defaultSchemaSelector = (state: AppState): string => {\n return state?.schemas[0]?.key ?? ''\n}\n\nexport const schemasSelector = (state: AppState, key: string): Schema => {\n return state?.schemas.find((schema: Schema) => schema.key === key) ?? ({} as Schema)\n}\n\n// returns true if provided category is in a list of parsed categories derived from the available schemas\nexport const isCategoryAvailableSelector = (state: AppState, category: string): boolean =>\n !!parseCategories(state.schemas).find((cat: Category) => cat.key === category)\n\nexport const moduleSelector = (state: AppState): Category | undefined => {\n const categories = parseCategories(state.schemas)\n const catKey = categorySelector(state)\n const category = _.find(categories, (c) => c.key === catKey)\n return category || categories[0]\n}\n","// This optional code is used to register a service worker.\n// register() is not called by default.\n\n// This lets the app load faster on subsequent visits in production, and gives\n// it offline capabilities. However, it also means that developers (and users)\n// will only see deployed updates on subsequent visits to a page, after all the\n// existing tabs open on the page have been closed, since previously cached\n// resources are updated in the background.\n\n// To learn more about the benefits of this model and instructions on how to\n// opt-in, read https://bit.ly/CRA-PWA\n\nconst isLocalhost = Boolean(\n window.location.hostname === 'localhost' ||\n // [::1] is the IPv6 localhost address.\n window.location.hostname === '[::1]' ||\n // 127.0.0.1/8 is considered localhost for IPv4.\n window.location.hostname.match(/^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)\n)\n\ntype Config = {\n onSuccess?: (registration: ServiceWorkerRegistration) => void\n onUpdate?: (registration: ServiceWorkerRegistration) => void\n}\n\nexport function register(config?: Config) {\n if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\n // The URL constructor is available in all browsers that support SW.\n const publicUrl = new URL((process as { env: { [key: string]: string } }).env.PUBLIC_URL, window.location.href)\n if (publicUrl.origin !== window.location.origin) {\n // Our service worker won't work if PUBLIC_URL is on a different origin\n // from what our page is served on. This might happen if a CDN is used to\n // serve assets; see https://github.com/facebook/create-react-app/issues/2374\n return\n }\n\n window.addEventListener('load', () => {\n const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`\n\n if (isLocalhost) {\n // This is running on localhost. Let's check if a service worker still exists or not.\n checkValidServiceWorker(swUrl, config)\n\n // Add some additional logging to localhost, pointing developers to the\n // service worker/PWA documentation.\n navigator.serviceWorker.ready.then(() => {\n console.info('This web app is being served cache-first by a service worker. To learn more, visit https://bit.ly/CRA-PWA')\n })\n } else {\n // Is not localhost. Just register service worker\n registerValidSW(swUrl, config)\n }\n })\n }\n}\n\nfunction registerValidSW(swUrl: string, config?: Config) {\n navigator.serviceWorker\n .register(swUrl)\n .then((registration) => {\n registration.onupdatefound = () => {\n const installingWorker = registration.installing\n if (installingWorker == null) {\n return\n }\n installingWorker.onstatechange = () => {\n if (installingWorker.state === 'installed') {\n if (navigator.serviceWorker.controller) {\n // At this point, the updated precached content has been fetched,\n // but the previous service worker will still serve the older\n // content until all client tabs are closed.\n console.info('New content is available and will be used when all tabs for this page are closed. See https://bit.ly/CRA-PWA.')\n\n // Execute callback\n if (config && config.onUpdate) {\n config.onUpdate(registration)\n }\n } else {\n // At this point, everything has been precached.\n // It's the perfect time to display a\n // \"Content is cached for offline use.\" message.\n console.info('Content is cached for offline use.')\n\n // Execute callback\n if (config && config.onSuccess) {\n config.onSuccess(registration)\n }\n }\n }\n }\n }\n })\n .catch((error) => {\n console.error('Error during service worker registration:', error)\n })\n}\n\nfunction checkValidServiceWorker(swUrl: string, config?: Config) {\n // Check if the service worker can be found. If it can't reload the page.\n fetch(swUrl)\n .then((response) => {\n // Ensure service worker exists, and that we really are getting a JS file.\n const contentType = response.headers.get('content-type')\n if (response.status === 404 || (contentType != null && contentType.indexOf('javascript') === -1)) {\n // No service worker found. Probably a different app. Reload the page.\n navigator.serviceWorker.ready.then((registration) => {\n registration.unregister().then(() => {\n window.location.reload()\n })\n })\n } else {\n // Service worker found. Proceed as normal.\n registerValidSW(swUrl, config)\n }\n })\n .catch(() => {\n console.info('No internet connection found. App is running in offline mode.')\n })\n}\n\nexport function unregister() {\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.ready.then((registration) => {\n registration.unregister()\n })\n }\n}\n","import React, { useEffect, useState } from 'react'\nimport { toast, ToastProps } from 'react-toastify'\nimport * as serviceWorker from '../../serviceWorker'\nimport Button from '../Button/Button'\nimport { useI18nSelector } from '../../v3/context/i18n'\n\nexport const RefreshToast = () => {\n const i18n = useI18nSelector()\n const [updateAvailable, setUpdateAvailable] = useState(false)\n const [waitingWorker, setWaitingWorker] = useState<ServiceWorker>()\n\n useEffect(() => {\n // on initial load in production, register our service worker\n if (process.env.NODE_ENV === 'production') {\n /**\n * ESCAPE HATCH: if issues arise with service worker, replace next line with `serviceWorker.unregister()` to\n * not load/register the service worker\n */\n serviceWorker.register({ onUpdate: onServiceWorkerUpdate })\n }\n }, [])\n\n useEffect(() => {\n if (updateAvailable) {\n // show notification\n toast(i18n('global.status.updateAvailable'), {\n toastId: 'refresh-toast',\n closeOnClick: false,\n autoClose: false,\n position: 'top-center',\n closeButton: toastButton,\n })\n }\n }, [updateAvailable])\n\n function toastButton({ closeToast }: ToastProps) {\n return (\n <Button\n variant=\"contained\"\n color=\"primary\"\n onClick={() => {\n closeToast()\n updateServiceWorker()\n }}\n >\n Refresh\n </Button>\n )\n }\n\n function onServiceWorkerUpdate({ waiting }: ServiceWorkerRegistration) {\n if (waiting) {\n setWaitingWorker(waiting)\n setUpdateAvailable(true)\n }\n }\n\n function updateServiceWorker() {\n if (!waitingWorker) {\n console.info('NO WAITING WORKER')\n return\n }\n\n // the message defined here should match expectations in the service worker message listener\n waitingWorker.postMessage({ type: 'SKIP_WAITING' })\n setUpdateAvailable(false)\n window.location.reload()\n }\n\n return null\n}\n","import { Doc, Lead, Note, V3User } from '.'\nimport { RuleEngineAction, RuleEngineTrigger } from './Rule'\n\ntype ActivityCommon = Pick<Doc, 'ID' | 'ReadOnly' | 'CreatedAt' | 'UpdatedAt'> & {\n // Field is the resource field that was changed\n Field: string\n // ResourceID is the V3 Document ID\n ResourceID: string\n // ResourceType is the V3 model name\n ResourceType: string\n // User is the user who made the change tracked by this event\n User: V3User\n}\n\nexport enum ActivityType {\n ResourceCreated = 'resource-create',\n ResourceUpdate = 'resource-update',\n StatusUpdate = 'status-update',\n Impression = 'impression',\n Notification = 'notification',\n Reassignment = 'reassignment',\n Share = 'share',\n Unshare = 'unshare',\n View = 'view',\n OneClickedAction = 'one-click-action',\n NoteAdded = 'note-added',\n ActionError = 'action-error',\n ActionSuccess = 'action-success',\n LeadReminderSuccess = 'lead-reminder-success',\n LeadReminderError = 'lead-reminder-error',\n LeadReminderTrigger = 'lead-reminder-trigger',\n}\n\nexport type ActivityResourceCreated = ActivityCommon & { Type: ActivityType.ResourceCreated }\nexport type ActivityResourceUpdated = ActivityCommon & { Type: ActivityType.ResourceUpdate; Field: string; Value: string }\nexport type ActivityStatusUpdated = ActivityCommon & { Type: ActivityType.StatusUpdate; Status: string }\nexport type ActivityImpression = ActivityCommon & { Type: ActivityType.Impression; RequestMeta: {} }\nexport type ActivityNotification = ActivityCommon & { Type: ActivityType.Notification; Recipients: {}[] }\nexport type ActivityReassignment = ActivityCommon & { Type: ActivityType.Reassignment; ReassignedFrom: string; ReassignedTo: string }\nexport type ActivityShare = ActivityCommon & { Type: ActivityType.Share; SharedWith: string[] }\nexport type ActivityUnshare = ActivityCommon & { Type: ActivityType.Unshare; UnsharedWith: string[] }\nexport type ActivityView = ActivityCommon & { Type: ActivityType.View; RequestMeta: {} }\nexport type ActivityOneClicked = ActivityCommon & { Type: ActivityType.OneClickedAction; Url: string; QueryStringAction: string; Scopes: string[] }\nexport type ActivityNoteAdded = ActivityCommon & { Type: ActivityType.NoteAdded; Note: Note }\nexport type ActivityLeadReminderSuccess = ActivityCommon & { Type: ActivityType.LeadReminderSuccess; Success: string }\nexport type ActivityLeadReminderError = ActivityCommon & { Type: ActivityType.LeadReminderError; Error: string }\nexport type ActivityLeadReminderTrigger = ActivityCommon & { Type: ActivityType.LeadReminderTrigger; Trigger: RuleEngineTrigger }\nexport type ActivityActionError = ActivityCommon & {\n Type: ActivityType.ActionError\n Action: RuleEngineAction\n Error: string\n Trigger: RuleEngineTrigger\n}\nexport type ActivityActionSuccess = ActivityCommon & {\n Type: ActivityType.ActionSuccess\n Action: RuleEngineAction\n Trigger: RuleEngineTrigger\n}\n\nexport type Activity =\n | ActivityResourceCreated\n | ActivityResourceUpdated\n | ActivityStatusUpdated\n | ActivityImpression\n | ActivityNotification\n | ActivityReassignment\n | ActivityShare\n | ActivityUnshare\n | ActivityView\n | ActivityOneClicked\n | ActivityNoteAdded\n | ActivityActionError\n | ActivityActionSuccess\n | ActivityLeadReminderSuccess\n | ActivityLeadReminderError\n | ActivityLeadReminderTrigger\n","import { User } from './User'\nimport { Organization } from './Organization'\nimport { Schema } from '../schemas'\n\nexport type APIError = {\n _code: string\n _message: string\n _inputs: Record<string, string[]>\n _fault: boolean\n}\n\nexport type RendererError = {\n Code: string\n HttpStatusCode: number\n Message: string\n}\n\nexport enum Scope {\n All = 'all',\n Focused = 'focused',\n IncludeDescendants = 'includeDescendants',\n PlatformSystem = 'platformSystem',\n}\n\nexport type V2Response<T = Document> = {\n data: T[]\n limit: number\n resultCount: number\n schema: Schema\n skip: number\n totalCount: number\n}\n\nexport type AuthResponse = {\n authorizationToken: string\n authorizationTokenExpiration: Date\n user: User\n organization: Organization\n}\n\nexport type AnalyticsResponse = {\n embedURL: string\n}\n\nexport type CreateableSchemasResponse = {\n resources: Partial<Schema>[]\n}\n","import enUS from '../i18n/en-US.json'\nimport { i18nKey, i18nMap, i18nSelectorMap } from '../reducers/i18n'\nimport { AppState } from '../store'\nimport { Enum } from '../types'\n\nconst warnOnce: any = {}\n\n// TODO: Replace I18n with i18nSelectorMap everywhere in code (there's a LOT of places, and those places\n// should likely just use usei18nSelector())\nexport type I18n = i18nSelectorMap\n\nexport const localeSelector = (state: AppState): string => {\n return state.i18n?.locale ?? 'en-US'\n}\n\nexport const selectAvailableLocales = (state: AppState): Enum[] => {\n return state.i18n.availableLocales\n}\n\nexport const i18n = (state: AppState): i18nSelectorMap => (key: i18nKey): string => {\n const localeValue = state?.i18n?.translations[key]\n if (localeValue) {\n return localeValue\n }\n\n const currentLocale = localeSelector(state)\n const warnKey = `${currentLocale}-${key}`\n if (!warnOnce[warnKey]) {\n console.info(`could not find key '${key}' for locale '${currentLocale}'`)\n warnOnce[warnKey] = 1\n }\n return (enUS as i18nMap)?.[key] ?? ''\n}\n\nexport const selecti18n = (state: AppState, key: i18nKey): string => {\n const i18nState = state.i18n\n let localeValue = i18nState.translations[key]\n if (localeValue) {\n return localeValue\n }\n const currentLocale = localeSelector(state)\n const warnKey = `${currentLocale}-${key}`\n if (!warnOnce[warnKey]) {\n console.warn(`could not find key '${key}' for locale '${currentLocale}'`)\n warnOnce[warnKey] = 1\n }\n localeValue = enUS[key as i18nKey]\n if (!localeValue && currentLocale !== 'en-US') {\n console.warn(`could not fallback to key '${key}' for en-US locale`)\n warnOnce[`en-US-${key}`] = 1\n }\n return localeValue ?? ''\n}\n","import { Option } from 'types'\nimport { Field } from '../schemas'\n\n// Types for filters when stored in local storage\nexport type StoredFilters = Record<string, StoredFiltersForOrg> // keyed to Organization ID\nexport type StoredFiltersForOrg = Record<string, StoredFiltersForResource> // keyed to resource for filter\nexport type StoredFiltersForResource = Record<string, Option[]> // Keyed to FilterField.key\n\ntype baseFilterField = {\n key: string\n label: string\n singleSelect: boolean\n // defaultSelected is set when the filters are initially loaded, and used when comparing if\n // a filter selection is \"dirty\" and should be overridden.\n defaultSelected: Option[]\n selected: Option[]\n}\n\nexport type SelectFilterField = baseFilterField & {\n presentation: 'select'\n options: Option[]\n}\n\nexport const isSelectFilterField = (field: any): field is SelectFilterField => {\n return field.presentation !== undefined && field.presentation === 'select'\n}\n\nexport type DateFilterField = baseFilterField & {\n presentation: 'dateRange'\n}\n\nexport const isDateFilterField = (field: any): field is DateFilterField => {\n return field.presentation !== undefined && field.presentation === 'dateRange'\n}\n\nexport type FilterField = SelectFilterField | DateFilterField\n\n// Filters as returned from the /filters endpoint, as as mocked for v3 Leads.\nexport type APIFilter = {\n fieldPath: FilterFieldKeys[]\n field: Field\n}\n\nexport const validFilterFieldKeys = [\n // V2 Lead-specific\n 'originFormID',\n 'stage',\n 'isTestLead',\n // V3 Lead-specific\n // TODO: come onnnnnn these should have been lowercased so we don't need different keys. Make them lowercase\n 'TypeLabel',\n 'Stage',\n 'Status',\n 'IsTestLead',\n 'CreatedAt',\n 'CreatedAtGreaterThan',\n 'CreatedAtLessThan',\n // Org / Location-specific\n 'isTestOrg',\n 'isPrimary',\n // Sites-specific\n 'category',\n // Content / General keys\n 'type',\n 'status',\n 'isFeatured',\n 'created',\n 'locale',\n 'audit.createdLessThan',\n 'audit.createdGreaterThan',\n // The \"global\" scope is stored in filters strictly for usage on the list pages.\n 'scope',\n] as const\n\nexport type FilterFieldKeys = typeof validFilterFieldKeys[number]\n","import { Doc, Ownership, Scope } from '.'\n\nexport enum ResourceType {\n LeadCreatedType = 'leads',\n OrganizationType = 'organizations',\n MobilePhoneType = 'mobilephone',\n LeadModifiedType = 'lead-modifications',\n LeadReminders = 'lead-reminders',\n}\n\nexport enum RuleEngineActionType {\n WebhookHTTPActionType = 'action.webhook.http',\n NotificationEmailActionType = 'action.notification.email',\n LeadResponseEmailActionType = 'action.lead.response.email',\n SayHelloActionType = 'action.say.hello',\n}\n\ntype RuleEngineCommon<T = {}> = Doc & {\n Content: T\n Description: string\n Name: string\n Type: RuleEngineActionType\n}\n\nexport type RuleEngineEmail = RuleEngineCommon<RuleEngineEmailContent> & {\n Type: RuleEngineActionType.NotificationEmailActionType | RuleEngineActionType.LeadResponseEmailActionType\n}\n\nexport type RuleEngineAction = RuleEngineEmail\n\nexport enum RuleEngineTriggerFlag {\n LeadResponderEmailEnabled = 'LeadResponderEmailEnabled',\n SMSNotificationsEnabled = 'SMSNotificationsEnabled',\n}\n\nexport enum RuleEngineTriggerType {\n LeadCreatedTriggerType = 'lead.created',\n LeadReassignedTriggerType = 'lead.reassigned',\n LeadRemindersTrigger = 'lead.stale',\n LeadModifiedTrigger = 'lead.modified',\n OrganizationMobilePhoneAddedTriggerType = 'organization.mobilephone.added',\n OrganizationStatusActivatedTriggerType = 'organization.status.activated',\n OrganizationStatusDeactivatedTriggerType = 'organization.status.deactivated',\n}\n\nexport enum RuleStatusType {\n Active = 'active',\n Inactive = 'inactive',\n}\n\nexport type RuleEngineTrigger = Doc &\n Ownership & {\n Actions: RuleEngineAction[]\n Flags: RuleEngineTriggerFlag\n Conditions: unknown[]\n Description?: string\n Executions: number\n LastProcessed: Date\n Name?: string\n ResourceType: ResourceType\n Type: RuleEngineTriggerType\n Status: RuleStatusType\n Cronjob: boolean\n CreatedAt: string\n EffectiveDate: string\n }\n\ntype RuleEngineEmailContent = {\n DefaultLocale: string\n EmailContent: Record<string, string>\n Emails: string[]\n TemplateTitle: string\n LocalizedTemplates: Record<string, string>\n Type: RuleEngineActionType\n}\n\nexport interface RuleQueryRequest {\n orgScope: Scope\n limit?: number\n offset?: number\n isTestLead?: boolean[]\n status?: string[]\n typeLabel?: string[]\n search?: string\n createdAtStart?: string\n createdAtEnd?: string\n sortField?: string\n sortDirection?: string\n}\n\n// JSON Response body for v3 rule query endpoint (POST /rule/query)\nexport interface RuleQueryResponse {\n limit: number\n offset: number\n total: number\n data: QueriedRule[]\n}\n\n// Rule as represented from the v3 rule query endpoint (POST /rule/query).\n// It includes only the data we need for the rules list, including some org/trunk info\nexport interface QueriedRule {\n id: string\n readOnly: string\n createdAt: string\n updatedAt: string\n ownerID: string\n name?: string\n resourceType: string\n type: string\n actions?: RuleEngineAction[]\n conditions?: unknown[]\n executions: number\n lastProcessed: string\n}\n","import { AnalyticsState } from '../reducers/analytics'\nimport { APIError } from '../types'\n\nexport const ANALYTICS = '[analytics]'\nexport const SET_ANALYTICS = `${ANALYTICS} Set`\nexport const GET_ANALYTICS = `${ANALYTICS} Fetch`\nexport const ERROR_ANALYTICS = `${ANALYTICS} Error`\n\nexport const getAnalytics = (dashboardType: string): any => ({\n type: GET_ANALYTICS,\n dashboardType,\n})\n\nexport const setAnalytics = (analytics: AnalyticsState): any => ({\n type: SET_ANALYTICS,\n payload: analytics,\n})\n\nexport const setAnalyticsError = (error: APIError): any => ({\n type: ERROR_ANALYTICS,\n payload: error._message,\n})\n","import { Component, HttpMethod, Page, Site } from '../types'\n\ntype Form = 'siteSettings'\n\nexport enum ArchitectActionType {\n ARCHITECT = '[architect]',\n GET_PAGES = `[architect] Fetch Pages`,\n SET_PAGES = `[architect] Set Pages`,\n SET_PAGE = `[architect] Set Page`,\n RENDER_PAGE = `[architect] Render Page`,\n SET_HTML = `[architect] Set HTML`,\n GET_SITE = `[architect] Fetch Site`,\n SET_SITE = `[architect] Set Site`,\n GET_FORM = `[architect] Fetch Form`,\n SET_FORM = `[architect] Set Form`,\n SUBMIT_FORM = `[architect] Submit Form`,\n REORDER_SECTION = `[architect] Reorder Section`,\n TOGGLE_VIEWPORT = `[architect] Toggle Viewport`,\n ADD_PAGE = `[architect] Add Page`,\n EDIT_SECTION = `[architect] Edit Section`,\n ADD_SECTION = `[architect] Add Section`,\n DELETE_SECTION = `[architect] Delete Section`,\n GET_COMPONENTS = `[architect] Get Components`,\n SET_COMPONENTS = `[architect] Set Components`,\n PUBLISH_PAGE = `[architect] Publish Page`,\n}\n\nexport const forms: Record<string, Form> = {\n siteSettings: 'siteSettings',\n}\n\ntype GetPagesAction = {\n type: ArchitectActionType.GET_PAGES\n payload: string\n}\n\nexport const getPages = (siteID: string): GetPagesAction => ({\n type: ArchitectActionType.GET_PAGES,\n payload: siteID,\n})\n\ntype SetPagesAction = {\n type: ArchitectActionType.SET_PAGES\n payload: Page[]\n}\n\nexport const setPages = (pages: Page[]): SetPagesAction => ({\n type: ArchitectActionType.SET_PAGES,\n payload: pages,\n})\n\ntype SetPageAction = {\n type: ArchitectActionType.SET_PAGE\n payload: string\n}\n\nexport const setPage = (pageID: string): SetPageAction => ({\n type: ArchitectActionType.SET_PAGE,\n payload: pageID,\n})\n\ntype RenderPageAction = {\n type: ArchitectActionType.RENDER_PAGE\n}\n\nexport const renderPage = (): RenderPageAction => ({\n type: ArchitectActionType.RENDER_PAGE,\n})\n\ntype SetHtmlAction = {\n type: ArchitectActionType.SET_HTML\n payload: string\n}\n\nexport const setHtml = (html: string): SetHtmlAction => ({\n type: ArchitectActionType.SET_HTML,\n payload: html,\n})\n\ntype GetSiteAction = {\n type: ArchitectActionType.GET_SITE\n payload: string\n}\n\nexport const getSite = (id: string): GetSiteAction => ({\n type: ArchitectActionType.GET_SITE,\n payload: id,\n})\n\ntype SetSiteAction = {\n type: ArchitectActionType.SET_SITE\n payload: Site\n}\n\nexport const setSite = (site: Site): SetSiteAction => ({\n type: ArchitectActionType.SET_SITE,\n payload: site,\n})\n\ntype GetFormAction = {\n type: ArchitectActionType.GET_FORM\n payload: Form\n}\n\nexport const getForm = (form: Form): GetFormAction => ({\n type: ArchitectActionType.GET_FORM,\n payload: form,\n})\n\ntype ArchitectFetchAction = {\n type: ArchitectActionType.GET_FORM\n payload: {\n url: string\n }\n}\n\nexport const getComponentSettings = (pageID: string, sectionID: string, areaID: string, componentHID: string): ArchitectFetchAction => ({\n type: ArchitectActionType.GET_FORM,\n payload: {\n url: `/pages/${pageID}/sections/${sectionID}/areas/${areaID}/components/${componentHID}`,\n },\n})\n\nexport const getPageSettings = (pageID: string): ArchitectFetchAction => ({\n type: ArchitectActionType.GET_FORM,\n payload: {\n url: `/pages/${pageID}`,\n },\n})\n\nexport const addPage = (siteID: string): ArchitectFetchAction => ({\n type: ArchitectActionType.GET_FORM,\n payload: {\n url: `/pages/new?siteID=${siteID}`,\n },\n})\n\nexport const editSection = (pageID: string, sectionID: string): ArchitectFetchAction => ({\n type: ArchitectActionType.GET_FORM,\n payload: {\n url: `/pages/${pageID}/sections/${sectionID}`,\n },\n})\n\nexport const placeComponent = (pageID: string, sectionID: string, areaID: string, HID: string): ArchitectFetchAction => ({\n type: ArchitectActionType.GET_FORM,\n payload: {\n url: `/pages/${pageID}/sections/${sectionID}/areas/${areaID}/components/new?hid=${HID}`,\n },\n})\n\ntype SetFormAction = {\n type: ArchitectActionType.SET_FORM\n payload: string\n}\n\nexport const setForm = (form: string): SetFormAction => ({\n type: ArchitectActionType.SET_FORM,\n payload: form,\n})\n\ntype SubmitFormAction = {\n type: ArchitectActionType.SUBMIT_FORM\n payload: {\n url: string\n method: HttpMethod\n data: FormData\n }\n}\n\nexport const submitForm = (url: string, method: HttpMethod, data: FormData): SubmitFormAction => ({\n type: ArchitectActionType.SUBMIT_FORM,\n payload: {\n url,\n method,\n data,\n },\n})\n\ntype ReorderSectionAction = {\n type: ArchitectActionType.REORDER_SECTION\n payload: {\n pageID: string\n sectionID: string\n index: number\n }\n}\n\nexport const reorderSection = (pageID: string, sectionID: string, index: number): ReorderSectionAction => ({\n type: ArchitectActionType.REORDER_SECTION,\n payload: {\n pageID,\n sectionID,\n index,\n },\n})\n\ntype ToggleViewportAction = {\n type: ArchitectActionType.TOGGLE_VIEWPORT\n payload: boolean\n}\n\nexport const toggleViewport = (showMobile: boolean): ToggleViewportAction => ({\n type: ArchitectActionType.TOGGLE_VIEWPORT,\n payload: showMobile,\n})\n\ntype AddSectionAction = {\n type: ArchitectActionType.ADD_SECTION\n payload: {\n pageID: string\n index: number\n }\n}\n\nexport const addSection = (pageID: string, index: number): AddSectionAction => ({\n type: ArchitectActionType.ADD_SECTION,\n payload: {\n pageID,\n index,\n },\n})\n\ntype DeleteSectionAction = {\n type: ArchitectActionType.DELETE_SECTION\n payload: {\n pageID: string\n sectionID: string\n }\n}\n\nexport const deleteSection = (pageID: string, sectionID: string): DeleteSectionAction => ({\n type: ArchitectActionType.DELETE_SECTION,\n payload: {\n pageID,\n sectionID,\n },\n})\n\ntype GetComponentsAction = {\n type: ArchitectActionType.GET_COMPONENTS\n}\n\nexport const getComponents = (): GetComponentsAction => ({\n type: ArchitectActionType.GET_COMPONENTS,\n})\n\ntype SetComponentsAction = {\n type: ArchitectActionType.SET_COMPONENTS\n payload: Component[]\n}\n\nexport const setComponents = (components: Component[]): SetComponentsAction => ({\n type: ArchitectActionType.SET_COMPONENTS,\n payload: components,\n})\n\ntype PublishPageAction = {\n type: ArchitectActionType.PUBLISH_PAGE\n payload: string\n}\n\nexport const publishPage = (pageID: string): PublishPageAction => ({\n type: ArchitectActionType.PUBLISH_PAGE,\n payload: pageID,\n})\n\nexport type AnyArchitectAction =\n | GetPagesAction\n | SetPagesAction\n | SetPageAction\n | RenderPageAction\n | SetHtmlAction\n | GetSiteAction\n | SetSiteAction\n | GetFormAction\n | ArchitectFetchAction\n | SetFormAction\n | SubmitFormAction\n | ReorderSectionAction\n | ToggleViewportAction\n | AddSectionAction\n | DeleteSectionAction\n | GetComponentsAction\n | SetComponentsAction\n | PublishPageAction\n","import { Action } from 'redux'\nimport { ApiErrorPayload } from './api'\nimport { APIFilter, FilterField, Option } from '../types'\n\nexport enum FiltersActionType {\n GET = '[filters] Fetch',\n GET_ERROR = '[filters] Fetch API_ERROR',\n GET_SUCCESS = `[filters] Fetch API_SUCCESS`,\n SET = '[filters] Set',\n SET_FOCUSED_ORG_FILTERS = `[filters] Set Focused Org Filters`,\n UPDATE = '[filters] Update',\n UPDATE_ERROR = '[filters] Update API_ERROR',\n UPDATE_SUCCESS = '[filters] Update API_SUCCESS',\n UPDATE_FOCUSED_FILTER = '[filters] Update Focused Filter',\n SET_FETCHED_WITH = '[filters] Set Fetched With',\n SET_TO_FETCHED_WITH = '[filters] Reset to FetchedWith',\n}\n\nexport type SetFetchedWithAction = {\n type: FiltersActionType.SET_FETCHED_WITH\n fetchedWith: FilterField[]\n}\n\nexport type SetToFetchedWithAction = {\n type: FiltersActionType.SET_TO_FETCHED_WITH\n}\n\nexport type SetFiltersAction = {\n type: FiltersActionType.SET\n resource: string\n filters: APIFilter[]\n}\n\nexport const setFilters = (resource: string, filters: APIFilter[]): SetFiltersAction => ({\n type: FiltersActionType.SET,\n resource,\n filters,\n})\n\nexport type SetOrgSwitchFiltersAction = {\n type: FiltersActionType.SET_FOCUSED_ORG_FILTERS\n id: string\n}\n\nexport const setFiltersOnOrgSwitch = (id: string) => ({\n type: FiltersActionType.SET_FOCUSED_ORG_FILTERS,\n id,\n})\n\nexport type GetFiltersAction = {\n type: FiltersActionType.GET\n}\n\nexport const getFilters = (): GetFiltersAction => ({\n type: FiltersActionType.GET,\n})\n\nexport type UpdateFilterAction = {\n type: FiltersActionType.UPDATE\n key: string\n resource: string\n value: Option[]\n multiSelect: boolean\n}\n\nexport const updateFilter = (resource: string, key: string, value: Option[], multiSelect: boolean): UpdateFilterAction => ({\n type: FiltersActionType.UPDATE,\n key,\n resource,\n value,\n multiSelect,\n})\n\nexport type UpdateFocusedFilterAction = {\n type: FiltersActionType.UPDATE_FOCUSED_FILTER\n focusedFilter: string | undefined\n}\n\nexport const updateFocusedFilter = (label: string | undefined): UpdateFocusedFilterAction => ({\n type: FiltersActionType.UPDATE_FOCUSED_FILTER,\n focusedFilter: label,\n})\n\ntype FiltersAction = Action<FiltersActionType>\n\ntype ApiErrorAction = FiltersAction & {\n type: FiltersActionType.GET_ERROR | FiltersActionType.UPDATE_ERROR\n payload: ApiErrorPayload\n}\n\ntype ApiSuccessAction = FiltersAction & {\n type: FiltersActionType.GET_SUCCESS | FiltersActionType.UPDATE_SUCCESS\n payload: APIFilter[]\n meta: {\n feature: string\n resource: string\n }\n}\n\nexport type AnyFiltersAction =\n | GetFiltersAction\n | SetFiltersAction\n | SetOrgSwitchFiltersAction\n | UpdateFilterAction\n | ApiErrorAction\n | ApiSuccessAction\n | UpdateFocusedFilterAction\n | SetFetchedWithAction\n | SetToFetchedWithAction\n","export const PASSWORD = '[password]'\nexport const SAVE_PASSWORD = `${PASSWORD} Save`\n\nexport const savePassword = (original: string, password: string, passwordConfirm: string): any => ({\n type: SAVE_PASSWORD,\n payload: {\n original,\n password,\n passwordConfirm,\n },\n})\n","import { HttpMethod, RendererError } from '../types'\nimport { ArchitectActionType } from './architect'\n\nexport const RENDERER_REQUEST = 'RENDERER_REQUEST'\nexport const RENDERER_SUCCESS = 'RENDERER_SUCCESS'\nexport const RENDERER_ERROR = 'RENDERER_ERROR'\n\ntype RendererRequestProps = {\n feature: ArchitectActionType\n body?: RequestBody\n method: HttpMethod\n url: string\n params?: {\n [key: string]: string | undefined\n }\n responseType?: string\n}\n\ntype RequestBody = {\n [key: string]: string\n}\n\nexport type RendererRequestAction = {\n type: string\n payload: RequestBody | undefined\n meta: Omit<RendererRequestProps, 'body'>\n}\n\nexport const rendererRequest = ({ feature, body, method, url, params, responseType }: RendererRequestProps): RendererRequestAction => ({\n type: `${feature} ${RENDERER_REQUEST}`,\n payload: body,\n meta: {\n method,\n url,\n feature,\n params,\n responseType,\n },\n})\n\ntype RendererData = {\n diagnostics: string[]\n html: string\n}\n\nexport type RendererSuccessAction = {\n type: string\n payload: RendererData\n meta: {\n feature: string\n }\n}\n\nexport const rendererSuccess = (data: RendererData, feature: ArchitectActionType): RendererSuccessAction => ({\n type: `${feature} ${RENDERER_SUCCESS}`,\n payload: data,\n meta: {\n feature,\n },\n})\n\nexport type RendererErrorAction = {\n type: string\n payload: RendererError\n meta: {\n feature: string\n }\n}\n\nexport const rendererError = (error: RendererError, feature: ArchitectActionType): RendererErrorAction => ({\n type: `${feature} ${RENDERER_ERROR}`,\n payload: error,\n meta: {\n feature,\n },\n})\n\nexport type AnyRendererAction = RendererSuccessAction | RendererRequestAction | RendererErrorAction\n","import { Schema } from '../schemas'\n\nexport enum SchemaActionType {\n Set = '[schema] Set',\n SetCategory = '[schema] Set Category',\n}\n\nexport type SetSchemaAction = {\n type: SchemaActionType.Set\n schema: Schema\n}\n\nexport const setSchema = (schema: Schema): SetSchemaAction => ({\n type: SchemaActionType.Set,\n schema,\n})\n\nexport type SetSchemaCategoryAction = {\n type: SchemaActionType.SetCategory\n category: string\n}\n\nexport const setSchemaCategory = (category: string): SetSchemaCategoryAction => ({\n type: SchemaActionType.SetCategory,\n category,\n})\n\nexport type AnySchemaAction = SetSchemaAction | SetSchemaCategoryAction\n","import { Schema } from '../schemas'\nimport { API_SUCCESS } from './api'\n\nexport const SCHEMAS = '[schemas]'\nexport const GET_SCHEMAS = `${SCHEMAS} Fetch`\nexport const SET_SCHEMAS = `${SCHEMAS} Set`\nexport const GET_SCHEMAS_SUCCESS = `${SCHEMAS} ${API_SUCCESS}`\nexport const RENDER_MENU = 'RENDER_MENU'\n\nexport const renderMenu = () => ({\n type: RENDER_MENU,\n})\n\nexport const getSchemas = () => ({\n type: GET_SCHEMAS,\n})\n\nexport const setSchemas = (schemas: Schema[]) => ({\n type: SET_SCHEMAS,\n payload: schemas,\n})\n","import { SessionState } from 'reducers/session'\nimport { Organization } from '../types'\n\nexport const SESSION = '[session]'\n\nexport enum SessionActionTypes {\n LOGIN = '[session] LOGIN',\n LOGOUT = '[session] LOGOUT',\n SET_SESSION = '[session] SET',\n SET_FOCUSED_ORG = '[session] Set Focused Org',\n CLEAR_SESSION = '[session] Clear',\n SET_LOGIN_ERROR = '[session] Set Login Error',\n SET_PASSWORD_RESET_ERROR = '[session] Set Password Reset Error',\n SET_REDIRECT = '[session] Set Redirect',\n APPLY_CONTEXT = '[session] Apply Context',\n SET_CONTEXT = '[session] Set Context',\n APPLY_CONTEXT_SUCCESS = '[session] Apply Context API_SUCCESS',\n API_SUCCESS = '[session] API_SUCCESS',\n API_ERROR = '[session] API_ERROR',\n}\n\nexport type SessionAction =\n | { type: SessionActionTypes.LOGIN; payload: { email: string; password: string } }\n | { type: SessionActionTypes.SET_SESSION; payload: SessionState }\n | { type: SessionActionTypes.SET_FOCUSED_ORG; payload: Organization }\n | { type: SessionActionTypes.LOGOUT }\n | { type: SessionActionTypes.CLEAR_SESSION }\n | { type: SessionActionTypes.SET_LOGIN_ERROR; payload: string }\n | { type: SessionActionTypes.SET_PASSWORD_RESET_ERROR; payload: string }\n | { type: SessionActionTypes.SET_REDIRECT; payload: string }\n | { type: SessionActionTypes.APPLY_CONTEXT; payload: Partial<Organization> }\n | { type: SessionActionTypes.SET_CONTEXT; payload: {} }\n\nexport const login = (email: string, password: string): SessionAction => ({\n type: SessionActionTypes.LOGIN,\n payload: {\n email,\n password,\n },\n})\n\nexport const setSession = (session: SessionState): SessionAction => ({\n type: SessionActionTypes.SET_SESSION,\n payload: session,\n})\n\nexport const setFocusedOrg = (org: Organization): SessionAction => ({\n type: SessionActionTypes.SET_FOCUSED_ORG,\n payload: org,\n})\n\nexport const logout = (): SessionAction => ({\n type: SessionActionTypes.LOGOUT,\n})\n\nexport const clearSession = (): SessionAction => ({\n type: SessionActionTypes.CLEAR_SESSION,\n})\n\nexport const setLoginError = (error: string): SessionAction => ({\n type: SessionActionTypes.SET_LOGIN_ERROR,\n payload: error,\n})\n\nexport const clearPasswordResetError = (): SessionAction => ({\n type: SessionActionTypes.SET_PASSWORD_RESET_ERROR,\n payload: '',\n})\n\nexport const setPasswordResetError = (error: string): SessionAction => ({\n type: SessionActionTypes.SET_PASSWORD_RESET_ERROR,\n payload: error,\n})\n\nexport const setRedirect = (redirectAction: string): SessionAction => ({\n type: SessionActionTypes.SET_REDIRECT,\n payload: redirectAction,\n})\n\nexport const applyContext = (org: Organization): SessionAction => ({\n type: SessionActionTypes.APPLY_CONTEXT,\n payload: org,\n})\n\nexport const setContext = (context: {}): SessionAction => ({\n type: SessionActionTypes.SET_CONTEXT,\n payload: context,\n})\n","import { ApiSuccessPayload } from '.'\nimport { Settings, UserSettings } from '../types'\n\nexport const SETTINGS = '[settings]'\n\nexport enum SettingsActionTypes {\n GET_SETTINGS = '[settings] GET',\n SET_SETTINGS = '[settings] SET',\n GET_SETTINGS_SUCCESS = '[settings] API_SUCCESS',\n\n GET_USER_SETTINGS = '[user settings] GET',\n SET_USER_SETTINGS = '[user settings] SET',\n GET_USER_SETTINGS_SUCCESS = '[user settings] API_SUCCESS',\n PATCH_USER_SETTINGS_SUCCESS = '[doc] Save User API_SUCCESS',\n}\n\nexport type SettingsAction = { type: SettingsActionTypes.SET_SETTINGS; payload: Settings } | { type: SettingsActionTypes.GET_SETTINGS }\n\nexport const getSettings = () => ({\n type: SettingsActionTypes.GET_SETTINGS,\n})\n\nexport const setSettings = (settings: Settings) => ({\n type: SettingsActionTypes.SET_SETTINGS,\n payload: settings,\n})\n\nexport type UserSettingsAction =\n | { type: SettingsActionTypes.SET_USER_SETTINGS; payload: UserSettings }\n | { type: SettingsActionTypes.PATCH_USER_SETTINGS_SUCCESS; payload: ApiSuccessPayload<UserSettings> }\n | { type: SettingsActionTypes.GET_USER_SETTINGS }\n\nexport const getUserSettings = () => ({\n type: SettingsActionTypes.GET_USER_SETTINGS,\n})\n\nexport const setUserSettings = (settings: UserSettings) => ({\n type: SettingsActionTypes.SET_USER_SETTINGS,\n payload: settings,\n})\n","import { Action } from 'redux'\nimport { ApiErrorPayload } from './api'\n\nexport enum TranslationsActionType {\n GENERATE_UI_REPORT = '[translations] Generate UI Report',\n GENERATE_SCHEMA_REPORT = '[translations] Generate Schema Report',\n GENERATE_ERROR_REPORT = '[translations] Generate Error Report',\n GENERATE_UI_REPORT_ERROR = '[translations] Generate UI Report API_ERROR',\n GENERATE_UI_REPORT_SUCCESS = '[translations] Generate UI Report API_SUCCESS',\n GENERATE_SCHEMA_REPORT_ERROR = '[translations] Generate Schema Report API_ERROR',\n GENERATE_SCHEMA_REPORT_SUCCESS = '[translations] Generate Schema Report API_SUCCESS',\n GENERATE_ERROR_REPORT_ERROR = '[translations] Generate Error Report API_ERROR',\n GENERATE_ERROR_REPORT_SUCCESS = '[translations] Generate Error Report API_SUCCESS',\n}\n\ntype TranslationsAction = Action<TranslationsActionType>\n\ntype GENERATE_REPORT_ERROR =\n | TranslationsActionType.GENERATE_UI_REPORT_ERROR\n | TranslationsActionType.GENERATE_SCHEMA_REPORT_ERROR\n | TranslationsActionType.GENERATE_ERROR_REPORT_ERROR\ntype GENERATE_REPORT_SUCCESS =\n | TranslationsActionType.GENERATE_UI_REPORT_SUCCESS\n | TranslationsActionType.GENERATE_SCHEMA_REPORT_SUCCESS\n | TranslationsActionType.GENERATE_ERROR_REPORT_SUCCESS\n\ntype ApiSuccessAction = TranslationsAction & {\n type: GENERATE_REPORT_SUCCESS\n payload: string\n meta: {\n feature: string\n }\n}\n\ntype ApiErrorAction = TranslationsAction & {\n type: GENERATE_REPORT_ERROR\n payload: ApiErrorPayload\n}\n\nexport type GenerateUiReportAction = TranslationsAction & {\n type: TranslationsActionType.GENERATE_UI_REPORT\n}\n\nexport const generateUiReport = (): GenerateUiReportAction => ({\n type: TranslationsActionType.GENERATE_UI_REPORT,\n})\n\nexport type GenerateSchemaReportAction = TranslationsAction & {\n type: TranslationsActionType.GENERATE_SCHEMA_REPORT\n}\n\nexport const generateSchemaReport = (): GenerateSchemaReportAction => ({\n type: TranslationsActionType.GENERATE_SCHEMA_REPORT,\n})\n\nexport type GenerateErrorReportAction = TranslationsAction & {\n type: TranslationsActionType.GENERATE_ERROR_REPORT\n}\n\nexport const generateErrorReport = (): GenerateErrorReportAction => ({\n type: TranslationsActionType.GENERATE_ERROR_REPORT,\n})\n\nexport type GenerateReportAction = GenerateUiReportAction | GenerateSchemaReportAction | GenerateErrorReportAction\n\nexport type AnyTranslationsAction = ApiErrorAction | ApiSuccessAction | GenerateReportAction\n","import { ContentConfig, ContentConfigResponse, Lead, LeadQueryResponse, LeadType, Patchable } from '../types'\n\nexport const LeadsFormsDocumentCategory = 'formDocuments'\n\nexport enum V3LeadActionTypes {\n GET_LEAD = '[v3leads] GET_LEAD',\n GET_LEAD_SUCCESS = '[v3leads] GET_LEAD API_SUCCESS',\n GET_LEAD_ERROR = '[v3leads] GET_LEAD API_ERROR',\n GET_LEADS = '[v3leads] GET_LEADS',\n GET_LEADS_SUCCESS = '[v3leads] GET_LEADS API_SUCCESS',\n SET_LEADS = '[v3leads] SET_LEADS',\n SET_LEAD = '[v3leads] SET_LEAD',\n UPDATE_LEAD = '[v3leads] UPDATE_LEAD',\n SAVE_LEAD = '[v3leads] SAVE_LEAD',\n SAVE_LEAD_SUCCESS = '[v3leads] SAVE_LEAD API_SUCCESS',\n RELOAD_LEAD = '[v3leads] RELOAD_LEAD',\n RELOAD_LEAD_SUCCESS = '[v3leads] RELOAD_LEAD API_SUCCESS',\n SET_CONTENT_CONFIGS = '[v3leads] SET_CONTENT_CONFIGS',\n SET_LEAD_TYPES = '[v3leads] SET_LEAD_TYPES',\n GET_CONTENT_CONFIGS = '[v3leads] GET_CONTENT_CONFIGS',\n GET_CONTENT_CONFIGS_SUCCESS = '[v3leads] GET_CONTENT_CONFIGS API_SUCCESS',\n GET_LEAD_TYPES = '[v3leads] GET_LEAD_TYPES',\n GET_LEAD_TYPES_SUCCESS = '[v3leads] GET_LEAD_TYPES API_SUCCESS',\n EXPORT_LEADS = `[v3leads] EXPORT_LEADS`,\n EXPORT_LEADS_SUCCESS = `[v3leads] EXPORT_LEADS API_SUCCESS`,\n}\n\ninterface GetV3LeadAction {\n type: V3LeadActionTypes.GET_LEAD\n payload: string\n}\n\nexport const getV3Lead = (id: string): GetV3LeadAction => ({\n type: V3LeadActionTypes.GET_LEAD,\n payload: id,\n})\n\ninterface GetV3LeadSuccessAction {\n type: V3LeadActionTypes.GET_LEAD_SUCCESS\n payload: Lead\n}\n\ninterface GetV3LeadErrorAction {\n type: V3LeadActionTypes.GET_LEAD_ERROR\n payload: {\n message: string\n }\n}\n\ninterface GetV3LeadsAction {\n type: V3LeadActionTypes.GET_LEADS\n}\n\nexport const getV3Leads = (): GetV3LeadsAction => ({\n type: V3LeadActionTypes.GET_LEADS,\n})\n\ninterface GetV3LeadsSuccessAction {\n type: V3LeadActionTypes.GET_LEADS_SUCCESS\n payload: LeadQueryResponse\n}\n\ninterface SetV3LeadAction {\n type: V3LeadActionTypes.SET_LEAD\n payload: Lead\n}\n\nexport const setV3Lead = (payload: Lead): SetV3LeadAction => ({\n type: V3LeadActionTypes.SET_LEAD,\n payload,\n})\n\ninterface SetV3LeadsAction {\n type: V3LeadActionTypes.SET_LEADS\n payload: Lead[]\n}\n\nexport const setV3Leads = (payload: Lead[]): SetV3LeadsAction => ({\n type: V3LeadActionTypes.SET_LEADS,\n payload,\n})\n\ninterface UpdateV3LeadAction {\n type: V3LeadActionTypes.UPDATE_LEAD\n payload: Lead\n}\n\nexport const updateV3Lead = (payload: Lead): UpdateV3LeadAction => ({\n type: V3LeadActionTypes.UPDATE_LEAD,\n payload,\n})\n\nexport interface SaveV3LeadAction {\n type: V3LeadActionTypes.SAVE_LEAD\n payload: Patchable<Lead>\n}\n\nexport const saveV3Lead = (payload: Patchable<Lead>): SaveV3LeadAction => ({\n type: V3LeadActionTypes.SAVE_LEAD,\n payload,\n})\n\ninterface SaveV3LeadSuccessAction {\n type: V3LeadActionTypes.SAVE_LEAD_SUCCESS\n payload: Lead\n}\n\ninterface SetV3ContentConfigs {\n type: V3LeadActionTypes.SET_CONTENT_CONFIGS\n contentConfigs: ContentConfig[]\n}\n\nexport const setV3ContentConfigs = (contentConfigs: ContentConfig[]): SetV3ContentConfigs => ({\n type: V3LeadActionTypes.SET_CONTENT_CONFIGS,\n contentConfigs,\n})\n\ninterface SetV3LeadTypes {\n type: V3LeadActionTypes.SET_LEAD_TYPES\n leadTypes: LeadType[]\n}\n\nexport const setV3LeadTypes = (leadTypes: LeadType[]): SetV3LeadTypes => ({\n type: V3LeadActionTypes.SET_LEAD_TYPES,\n leadTypes,\n})\n\ninterface ReloadV3LeadAction {\n type: V3LeadActionTypes.RELOAD_LEAD\n payload: string\n}\n\nexport const reloadV3Lead = (id: string): ReloadV3LeadAction => ({\n type: V3LeadActionTypes.RELOAD_LEAD,\n payload: id,\n})\n\ninterface ReloadV3LeadSuccessAction {\n type: V3LeadActionTypes.RELOAD_LEAD_SUCCESS\n payload: Lead\n}\n\nexport interface GetContentConfigsAction {\n type: V3LeadActionTypes.GET_CONTENT_CONFIGS\n trunkID: string\n}\n\nexport const getContentConfigs = (trunkID: string): GetContentConfigsAction => ({\n type: V3LeadActionTypes.GET_CONTENT_CONFIGS,\n trunkID: trunkID,\n})\n\nexport interface GetContentConfigsSuccessAction {\n type: V3LeadActionTypes.GET_CONTENT_CONFIGS_SUCCESS\n payload: ContentConfigResponse\n}\n\nexport interface GetLeadTypesAction {\n type: V3LeadActionTypes.GET_LEAD_TYPES\n}\n\nexport const getLeadTypes = (): GetLeadTypesAction => ({\n type: V3LeadActionTypes.GET_LEAD_TYPES,\n})\n\nexport interface GetLeadTypesSuccessAction {\n type: V3LeadActionTypes.GET_LEAD_TYPES_SUCCESS\n payload: LeadType[]\n}\n\nexport interface ExportLeadsAction {\n type: V3LeadActionTypes.EXPORT_LEADS\n}\nexport const exportLeads = (): ExportLeadsAction => ({\n type: V3LeadActionTypes.EXPORT_LEADS,\n})\n\nexport interface ExportLeadsSuccessAction {\n type: V3LeadActionTypes.EXPORT_LEADS_SUCCESS\n payload: string\n meta: {\n feature: string\n }\n}\n\nexport type V3LeadActions =\n | GetV3LeadAction\n | GetV3LeadSuccessAction\n | GetV3LeadErrorAction\n | GetV3LeadsAction\n | GetV3LeadsSuccessAction\n | SetV3ContentConfigs\n | SetV3LeadTypes\n | SetV3LeadAction\n | SetV3LeadsAction\n | SaveV3LeadAction\n | SaveV3LeadSuccessAction\n | UpdateV3LeadAction\n | ReloadV3LeadAction\n | ReloadV3LeadSuccessAction\n | GetContentConfigsAction\n | GetContentConfigsSuccessAction\n | GetLeadTypesAction\n | GetLeadTypesSuccessAction\n | ExportLeadsAction\n | ExportLeadsSuccessAction\n","import { V3Organization } from '../types'\n\nexport const V3Organizations = '[v3Organizations]'\n\nexport enum V3OrganizationActionTypes {\n GET_ORGANIZATIONS = '[v3Organizations] GET_ORGANIZATIONS',\n GET_ORGANIZATION = '[v3Organizations] GET_ORGANIZATION',\n SET_ORGANIZATIONS = '[v3Organizations] SET_ORGANIZATIONS',\n SET_ORGANIZATION = '[v3Organizations] SET_ORGANIZATION',\n GET_DOWNSTREAM_ORGS = '[v3Organizations] GET_DOWNSTREAM_ORGS',\n GET_UPSTREAM_ORGS = '[v3Organizations] GET_UPSTREAM_ORGS',\n GET_ORG_HIERARCHY = '[v3Organizations] GET_ORG_HIERARCHY',\n}\n\ninterface GetV3OrganizationsAction {\n type: V3OrganizationActionTypes.GET_ORGANIZATIONS\n}\n\nexport const getV3Organizations = (): GetV3OrganizationsAction => ({\n type: V3OrganizationActionTypes.GET_ORGANIZATIONS,\n})\n\ninterface GetV3OrganizationAction {\n type: V3OrganizationActionTypes.GET_ORGANIZATION\n payload: { id: string }\n}\n\nexport const getV3Organization = (id: string): GetV3OrganizationAction => ({\n type: V3OrganizationActionTypes.GET_ORGANIZATION,\n payload: {\n id,\n },\n})\n\ninterface GetV3DownstreamOrgsAction {\n type: V3OrganizationActionTypes.GET_DOWNSTREAM_ORGS\n payload: { id: string }\n}\n\nexport const getV3DownstreamOrgs = (id: string): GetV3DownstreamOrgsAction => ({\n type: V3OrganizationActionTypes.GET_DOWNSTREAM_ORGS,\n payload: {\n id,\n },\n})\n\ninterface GetV3UpstreamOrgsAction {\n type: V3OrganizationActionTypes.GET_UPSTREAM_ORGS\n payload: { id: string }\n}\n\nexport const getV3UpstreamOrgs = (id: string): GetV3UpstreamOrgsAction => ({\n type: V3OrganizationActionTypes.GET_UPSTREAM_ORGS,\n payload: {\n id,\n },\n})\n\ninterface SetV3OrganizationsAction {\n type: V3OrganizationActionTypes.SET_ORGANIZATIONS\n payload: V3Organization[]\n}\n\nexport const setV3Organizations = (payload: V3Organization[]): SetV3OrganizationsAction => ({\n type: V3OrganizationActionTypes.SET_ORGANIZATIONS,\n payload,\n})\n\ninterface SetV3OrganizationAction {\n type: V3OrganizationActionTypes.SET_ORGANIZATION\n payload: V3Organization\n}\n\nexport const setV3Organization = (payload: V3Organization): SetV3OrganizationAction => ({\n type: V3OrganizationActionTypes.SET_ORGANIZATION,\n payload,\n})\n\ninterface GetV3OrgHierarchyAction {\n type: V3OrganizationActionTypes.GET_ORG_HIERARCHY\n}\n\nexport const getV3OrgHierarchy = (): GetV3OrgHierarchyAction => ({\n type: V3OrganizationActionTypes.GET_ORG_HIERARCHY,\n})\n\nexport type V3OrganizationActions =\n | GetV3OrganizationsAction\n | GetV3OrganizationAction\n | GetV3DownstreamOrgsAction\n | GetV3UpstreamOrgsAction\n | GetV3OrgHierarchyAction\n | SetV3OrganizationsAction\n | SetV3OrganizationAction\n","import 'ace-builds/src-min-noconflict/ace'\nimport 'ace-builds/src-min-noconflict/mode-json'\nimport 'ace-builds/src-min-noconflict/theme-xcode'\nimport { find } from 'lodash'\nimport React from 'react'\nimport AceEditor, { IAceEditorProps, IAnnotation, IEditorProps } from 'react-ace'\n\nconst defaultStyle: React.CSSProperties = {\n color: '#222A30',\n margin: '13px 12px 13px 12px',\n width: '100%',\n}\n\ntype Props = IAceEditorProps & {\n disabled?: boolean\n onBlur?: (value?: string) => void\n onError?: (err: string, value?: string) => void\n readOnly?: boolean\n requireValidJSON?: boolean\n style?: React.CSSProperties\n}\n\ntype State = {\n error?: string\n value: string\n}\n\nclass JSONEditor extends React.Component<Props> {\n editor!: IEditorProps\n\n state: State = {\n value: '',\n }\n\n focus = () => {\n if (this.editor) {\n this.editor.focus()\n }\n }\n\n componentDidMount() {\n const { value } = this.props\n this.setState({ value })\n }\n\n onLoad = (editor: IEditorProps) => {\n this.editor = editor\n }\n\n onChange = (value: string, _event?: any) => {\n const { requireValidJSON = true, onChange } = this.props\n\n this.setState({\n value,\n })\n\n if (!requireValidJSON && onChange) {\n onChange(value)\n }\n }\n\n onValidate = (annotations: IAnnotation[]) => {\n const { onChange, onError } = this.props\n const { value } = this.state\n\n if (annotations.length) {\n const firstErr = find(annotations, (annotation) => 'error' === annotation.type)\n if (firstErr) {\n const error = `Invalid JSON on line ${firstErr.row}: ${firstErr.text}`\n this.setState({\n ...this.state,\n error,\n })\n if (onError) {\n onError(error)\n }\n return\n }\n }\n\n this.setState({\n ...this.state,\n error: undefined,\n })\n\n if (onChange) {\n onChange(value)\n }\n }\n\n onBlur = () => {\n const { onBlur } = this.props\n const { value } = this.state\n\n if (onBlur) {\n onBlur(value)\n }\n }\n\n render() {\n const { disabled, fontSize = 13, name, placeholder, readOnly, requireValidJSON, style, onBlur, onFocus } = this.props\n const { value } = this.state\n\n const styles = {\n ...defaultStyle,\n ...style,\n }\n\n return (\n <AceEditor\n style={styles}\n placeholder={placeholder}\n mode=\"json\"\n fontSize={fontSize}\n theme=\"xcode\"\n name={name}\n value={value}\n onLoad={this.onLoad}\n onBlur={onBlur}\n onFocus={onFocus}\n onChange={this.onChange}\n showPrintMargin={false}\n showGutter={true}\n maxLines={Infinity}\n highlightActiveLine={false}\n onValidate={this.onValidate}\n setOptions={{\n useWorker: requireValidJSON,\n readOnly: readOnly || disabled,\n showLineNumbers: true,\n tabSize: 2,\n highlightSelectedWord: true,\n // ace cursor position is incorrect when\n // not using a monospace font\n //fontFamily: \"'Open Sans', 'PowerChord', sans-serif\",\n }}\n />\n )\n }\n}\n\nexport default JSONEditor\n","import { Theme, withStyles, WithStyles } from '@material-ui/core'\nimport React, { Component } from 'react'\nimport { Option, OptionType } from '../../types/Option'\nimport './Options.scss'\nimport { Field, FieldPrimitive } from '../../schemas'\nimport { genCIAttr } from '../../util'\n\nconst styles = (_theme: Theme) => ({\n option: {\n '& .option--disabled': {\n opacity: '0.5',\n 'pointer-events': 'none',\n },\n },\n secondaryText: {\n fontSize: '0.75rem',\n },\n})\n\nexport type OptionsProps = WithStyles<typeof styles> & {\n options?: Option[]\n multiple?: boolean\n onSelect?: (value: Option[]) => void\n selected: Option[]\n dataCIKey: string | undefined\n field?: Field\n}\n\nclass Options extends Component<OptionsProps> {\n isIdentical = (option1: Option, option2: Option) => {\n return option1.label === option2.label && option1.value === option2.value\n }\n\n findOptionIndex = (option: Option, array: Option[]) => {\n for (let i = 0; i < array.length; i++) {\n if (this.isIdentical(option, array[i])) {\n return i\n }\n }\n return -1\n }\n\n handleOptionClick = (option: Option) => (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n event.stopPropagation()\n this.selectOption(option)\n }\n\n handleOptionKeyDown = (option: Option) => (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key !== 'Escape') {\n event.stopPropagation()\n if (event.key === 'Enter' || event.key === ' ') {\n this.selectOption(option)\n }\n }\n }\n\n selectOption = (option: Option) => {\n if (!this.props.onSelect || option.disabled) return\n\n switch (this.props.multiple) {\n case true:\n const selected = (this.props.selected || []).slice(0)\n const selectedValues: Option[] = []\n const selectionIndex = this.findOptionIndex(option, selected)\n\n if (selectionIndex === -1) {\n selected.push(option)\n } else {\n selected.splice(selectionIndex, 1)\n }\n\n for (const selection of selected) {\n if (selection.value) {\n selectedValues.push(selection)\n }\n }\n\n this.props.onSelect(selectedValues)\n break\n default:\n // For AB#5018, the ability to reset a select with a null value was necessary for validation - SM 11/17/20\n // Sending an option with an empty value string suffices now - SM 05/22/24\n this.props.onSelect([option])\n }\n }\n\n render = () => {\n if (this.props.options) {\n const { classes } = this.props\n const optionItems = this.props.options.map((option, index) => {\n const optionKey = 'option-' + index\n const selected = this.props.selected || []\n let optionClass = 'option'\n\n if (this.props.multiple && Array.isArray(selected) && this.findOptionIndex(option, selected) > -1) {\n optionClass += ' is-selected'\n }\n\n if (option.disabled) {\n optionClass += ' option--disabled'\n }\n\n let label\n let dataCI\n\n if (option.type === OptionType.Organization) {\n label = (\n <div>\n <div>{option.label}</div>\n <div className={classes ? classes.secondaryText : undefined}>{option.secondaryLabel}</div>\n </div>\n )\n dataCI = option.label\n } else {\n label = option.label\n dataCI = option.label\n }\n\n return (\n <div\n className={optionClass}\n data-ci={genCIAttr('options', this.props.dataCIKey, dataCI)}\n key={optionKey}\n onClick={this.handleOptionClick(option)}\n onKeyDown={this.handleOptionKeyDown(option)}\n role=\"button\"\n tabIndex={0}\n >\n <div className=\"label\">{label}</div>\n </div>\n )\n })\n\n return (\n <div className={`Options ${classes.option}`} data-ci={genCIAttr('options', this.props.dataCIKey)}>\n {optionItems}\n </div>\n )\n }\n return null\n }\n}\n\nexport default withStyles(styles)(Options)\n","import _ from 'lodash'\n\nconst reorderSection = (pages: any, data: any): any => {\n return pages.map((page: any) => {\n if (page.ID === data.pageID) {\n const to = data.index\n const from = _.findIndex(page.sections, (s: any) => s.ID === data.sectionID)\n // We need to make a copy of the array so we can reorder it without mutating\n // application state\n const arrCopy = page.sections.slice(0)\n arrCopy.splice(to, 0, arrCopy.splice(from, 1)[0])\n return {\n ...page,\n sections: arrCopy,\n }\n }\n return page\n })\n}\n\nexport default reorderSection\n","import { RendererError } from '../types'\n\nconst formatRenderError = (error: RendererError): string => {\n const msg = error?.Message ?? 'Could not render page'\n\n const html = `\n <html>\n <style>\n html, body {\n margin: 0;\n padding: 0;\n font-family: Roboto, Arial;\n }\n .container {\n display: flex;\n flex-direction: column;\n align-items: center;\n }\n .title {\n font-size: 2rem;\n font-weight: bold;\n margin: 8px;\n }\n #message {\n color: #b30000;\n background-color: #ffffc7;\n box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.75);\n padding: 15px 25px;\n margin: 25px;\n }\n #hidden-text {\n position: absolute;\n top: -100px;\n }\n #copy {\n background-color: #1D6FBF;\n cursor: pointer;\n color: white;\n border: none;\n border-radius: 4px;\n font-weight: 500;\n line-height: 1.75;\n padding: 6px 16px;\n letter-spacing: 0.02857em;\n text-transform: uppercase;\n box-shadow: 0px 1px 5px 0px rgba(0,0,0,0.2), 0px 2px 2px 0px rgba(0,0,0,0.14), 0px 3px 1px -2px rgba(0,0,0,0.12);\n }\n #copy:hover {\n background-color: rgb(20, 77, 133);\n }\n </style>\n <script>\n function copyToClipboard() {\n var copyText = document.getElementById('hidden-text');\n copyText.select();\n document.execCommand('copy');\n var btn = document.getElementById('copy');\n btn.innerText = 'Copied!';\n setTimeout(() => {\n btn.innerText = 'Copy Error';\n }, 3500);\n }\n </script>\n </html>\n <body>\n <div class=\"container\">\n <h2 class=\"title\">Rendering Error</h2>\n <p id=\"message\">\n ${msg}\n </p>\n <button id=\"copy\" onclick=\"copyToClipboard()\">Copy Error</button>\n <input type=\"text\" value=\"${msg}\" id=\"hidden-text\">\n </div>\n </body>\n `\n return btoa(html)\n}\n\nexport default formatRenderError\n","import { Doc, Ownership } from '../../types'\nimport { Action, ActionKeys } from './Action'\nimport { APITriggerCondition, UITriggerCondition, UITriggerConditionKeys } from './Condition'\n\nexport enum ResourceTypeType {\n LeadsCreated = 'leads',\n Organizations = 'organizations',\n LeadsModified = 'lead-modifications',\n}\n\nexport enum TriggerType {\n LeadCreatedTrigger = 'lead.created',\n LeadReassignedTrigger = 'lead.reassigned',\n LeadRemindersTrigger = 'lead.stale',\n LeadModifiedTrigger = 'lead.modified',\n OrganizationMobilePhoneAddedTriggerType = 'organization.mobilephone.added',\n OrganizationStatusActivatedTrigger = 'organization.status.activated',\n OrganizationStatusDeactivatedTrigger = 'organization.status.deactivated',\n}\n\nexport type Trigger = Doc &\n Ownership & {\n Actions: Action[]\n Description?: string\n Type: TriggerType\n Conditions?: UITriggerCondition[] | APITriggerCondition[]\n CreatedAt?: string\n Executions?: number\n OwnerID: string\n ID: string\n LastProcessed?: string\n ReadOnly?: boolean\n Name?: string\n // TODO: This shouldn't be null, it can't be in the DB\n ResourceType?: ResourceTypeType\n Status: boolean\n EffectiveDate: string\n }\n\nexport type TriggerKeys = keyof Trigger | `Conditions.${UITriggerConditionKeys}` | `Actions.${ActionKeys}`\n\nexport type TriggerUIErrors = Partial<Record<TriggerKeys, string | undefined>>\n","import { Field, Schema } from './index'\nimport { i18nSelectorMap } from '../reducers/i18n'\nimport { Enum, LeadStatusToStage } from '../types'\nimport { deduplicateEnumsByValue } from '../util/enums'\n\nexport const V3LeadsCategory = 'v3/leads'\n\nexport const getV3Schemas = (\n i18n: i18nSelectorMap,\n statusEnums: Enum[],\n leadTypeEnums: Enum[],\n stageEnumDefaults: Enum[],\n currentStages: string[],\n leadStatusToStage: LeadStatusToStage[]\n): Schema[] => {\n const mockV3LeadsSchema = getV3LeadsMockSchema(i18n, statusEnums, leadTypeEnums, stageEnumDefaults, currentStages, leadStatusToStage)\n return [createV3LeadsAPISchemaFromMock(i18n('leads.detail.section.content.label'), mockV3LeadsSchema)]\n}\n\nexport const createV3LeadsAPISchemaFromMock = (label: string, schema: Schema): Schema => {\n return {\n key: V3LeadsCategory,\n label: label,\n categories: [\n {\n key: V3LeadsCategory,\n label: label,\n schemas: [schema],\n noMultiContext: false,\n icon: 'leads',\n },\n ],\n } as Schema\n}\n\nexport const getV3LeadsMockSchema = (\n i18n: i18nSelectorMap,\n statusEnums: Enum[],\n leadTypeEnums: Enum[],\n stageEnumDefaults: Enum[],\n currentStages: string[],\n leadStatusToStage: LeadStatusToStage[]\n): Schema => {\n const label = i18n('leads.detail.section.content.label')\n const currentStatusesAvailableEnums = getStatusEnumMappingState(statusEnums, currentStages, leadStatusToStage)\n return {\n resource: V3LeadsCategory,\n key: V3LeadsCategory,\n label: label,\n fields: [\n createV3FieldMock('TypeLabel', i18n('leads.originformid.label'), leadTypeEnums),\n createV3FieldMock('Stage', i18n('leads.stage.label'), stageEnumDefaults),\n createV3FieldMock('Status', i18n('leads.list.column.status'), currentStatusesAvailableEnums),\n createV3FieldMock('IsTestLead', i18n('leads.isTestLead.label'), [\n {\n value: 'true',\n label: 'True',\n disabled: false,\n },\n {\n value: 'false',\n label: 'False',\n disabled: false,\n },\n ]),\n createV3FieldMock('CreatedAt', i18n('leads.list.column.createdAt'), []),\n ],\n } as Schema\n}\n\nconst createV3FieldMock = (key: string, label: string, enums: Enum[]): Field => {\n let presentation = 'select'\n let sortOrder = 1\n switch (key) {\n case 'CreatedAt':\n presentation = 'dateRange'\n sortOrder = 99\n break\n }\n return ({\n key: key,\n label: label,\n filterConfig: {\n presentation: presentation,\n sortOrder: sortOrder,\n isFilter: true,\n singleSelect: false,\n defaultValues: enums.length > 0 ? enums.map((e) => e.value) : [],\n additionalOptions: [],\n },\n restrictions: {\n enums: enums,\n },\n } as unknown) as Field\n}\n\nconst getStatusEnumMappingState = (currentStatusValues: Enum[], stageSelections: string[], leadStatusToStage: LeadStatusToStage[]): Enum[] => {\n if (!stageSelections || stageSelections.length === 0) {\n // Return an array of the current Enum items as-is\n return deduplicateEnumsByValue(currentStatusValues)\n }\n // Verifying valid Status Mappings are taking here if a stage is selected\n const statusFromStageMappings: string[] = []\n for (const mapping of leadStatusToStage) {\n if (stageSelections.some((s) => s === mapping.stage)) {\n statusFromStageMappings.push(mapping.status)\n }\n }\n\n const validStatusMappings = currentStatusValues.filter((cs) => {\n return statusFromStageMappings.indexOf(cs.value) > -1\n })\n\n // De-dup the list here\n return deduplicateEnumsByValue(validStatusMappings)\n}\n","import React, { createContext, Dispatch, FC, useContext, useEffect, useReducer } from 'react'\nimport i18nReducer, { i18nKey, i18nMap, i18nSelectorMap, i18nState, initialI18nState } from '../../reducers/i18n'\nimport enUS from '../../i18n/en-US.json'\nimport { i18nActions, i18nActionTypes } from '../../actions'\nimport { importLanguageJSON } from '../../middleware'\nimport { Enum, Option } from '../../types'\nimport { enumToOptionEnum } from '../../util/enums'\nimport * as Sentry from '@sentry/react'\n\nconst I18nStateContext = createContext<i18nState>({} as i18nState)\nconst I18nDispatchContext = createContext<Dispatch<i18nActions>>(() => void 0)\n\ntype I18nProviderProps = {\n locale: string\n}\nconst I18nProvider: FC<I18nProviderProps> = ({ children, locale }) => {\n const [state, dispatch] = useReducer(i18nReducer, {\n ...initialI18nState,\n locale: locale,\n })\n\n useEffect(() => {\n importLanguageJSON(state.locale)\n .then((words: i18nMap) => {\n dispatch({ type: i18nActionTypes.SET_TRANSLATIONS, translations: words })\n })\n .catch((err) => {\n Sentry.captureException(err, {\n tags: {\n source: 'i18nProvider',\n },\n })\n console.warn('could not import language json', err)\n })\n }, [state.locale])\n\n return (\n <I18nStateContext.Provider value={state}>\n <I18nDispatchContext.Provider value={dispatch}>{children}</I18nDispatchContext.Provider>\n </I18nStateContext.Provider>\n )\n}\n\nfunction useI18nState() {\n const context = useContext(I18nStateContext)\n if (context === undefined) {\n throw new Error('useI18nState must be used within an I18nStateContext')\n }\n return context\n}\n\nfunction useI18nDispatch() {\n const context = useContext(I18nDispatchContext)\n if (context === undefined) {\n throw new Error('useI18nDispatch must be used within an I18nDispatchContext')\n }\n return context\n}\n\nfunction useI18nSelector(): i18nSelectorMap {\n const state = useI18nState()\n return (key: i18nKey): string => {\n const text = state.translations[key] ?? ''\n if (text !== '') {\n return text\n }\n\n return enUS?.[key] ?? ''\n }\n}\n\nfunction useAvailableLocaleOptions(): Option[] {\n const state = useI18nState()\n return enumToOptionEnum(state.availableLocales)\n}\n\nexport { I18nProvider, useI18nState, useI18nDispatch, useI18nSelector, useAvailableLocaleOptions }\n","import { AnalyticsState } from '../reducers/analytics'\nimport { i18nKey } from '../reducers/i18n'\nimport { selecti18n } from './i18n'\nimport { AppState } from '../store'\nimport { AnalyticsSettings } from '../types'\n\nexport const analyticsSelector = (state: AppState): AnalyticsState => {\n return state?.analytics\n}\n\nexport const analyticsSettingsSelector = (state: AppState): AnalyticsSettings => {\n return state?.settings.analyticsSettings\n}\n\nexport const analyticsTitleSelector = (state: AppState): string => {\n const dashboardType = state?.analytics?.dashboardType ?? ''\n\n if (!dashboardType) {\n return selecti18n(state, 'nav.labels.analytics')\n }\n\n const key = `nav.labels.analytics.${dashboardType}` as i18nKey\n\n const translation = selecti18n(state, key)\n\n if (!translation) {\n return selecti18n(state, 'nav.labels.analytics')\n }\n\n return translation\n}\n","import { AppState } from '../store'\nimport { Component, Page, Section, Site } from '../types'\nimport { ArchitectHTML } from '../types/Architect'\n\nexport const pagesSelector = (state: AppState): Page[] => {\n return state?.architect?.pages || []\n}\n\nexport const architectPageSelector = (state: AppState): Page => {\n const pages = state?.architect?.pages || []\n const defaultPage = pages[0]?.ID ?? ''\n const pageID = state?.architect?.page ?? defaultPage\n if (pageID) {\n const page = pages.find((p: any) => p.ID === pageID)\n return page || ({} as Page)\n }\n return {} as Page\n}\n\nexport const htmlSelector = (state: AppState): ArchitectHTML => {\n return state?.architect?.html ?? ''\n}\n\nexport const sectionsSelector = (state: AppState): Section[] => {\n const page = architectPageSelector(state)\n return page?.sections || []\n}\n\nexport const siteSelector = (state: AppState): Site => {\n return state?.architect?.site ?? {}\n}\n\n// https://stackoverflow.com/questions/30106476/using-javascripts-atob-to-decode-base64-doesnt-properly-decode-utf-8-strings\nconst b64DecodeUnicode = (str: string): string => {\n return decodeURIComponent(\n atob(str)\n .split('')\n .map(function (c) {\n return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)\n })\n .join('')\n )\n}\n\nexport const formSelector = (state: AppState): string => {\n return b64DecodeUnicode(state?.architect?.form ?? '')\n}\n\nexport const mobileViewportSelector = (state: AppState): boolean => {\n return state?.architect?.mobileViewport ?? false\n}\n\nexport const componentsSelector = (state: AppState): Component[] => {\n return state?.architect?.components ?? []\n}\n\nexport const componentNameSelector = (state: AppState) => (HID: string): string => {\n return state?.architect?.componentMap.get(HID)?.name ?? ''\n}\n","import { AppState } from '../store'\n\nexport const documentListSelector = (state: AppState): Array<any> => {\n return state?.documents?.list || []\n}\n\nexport const documentCountSelector = (state: AppState): number => {\n return state?.documents?.resultCount\n}\n\nexport const countSelector = (state: AppState): any => {\n return state?.documents?.count ?? -1\n}\n","import { DateOptionRangeType, FilterField, isDateOption, isEnumOption, Option } from 'types'\nimport { AppState } from '../store'\nimport { getDefaultFilterDateRange } from '../util'\nimport { LEADS_LIST, LIST_PAGE } from '../actions'\nimport { categorySelector, selectLocationType, selectPrevCategory, selectPrevLocationType } from './location'\n\nexport const selectFilters = (state: AppState): FilterField[] => {\n return state.filters.filters\n}\n\nexport const selectAPIFilters = (state: AppState) => {\n return state.filters.apiFilters\n}\n\nexport const focusedFilterSelector = (state: AppState) => {\n return state.filters.focusedFilter\n}\n\nexport const shouldUpdateFilters = (state: AppState): boolean => {\n // Do not retrieve filters unless on a list page that supports filters\n const locationType = selectLocationType(state)\n if (locationType !== LEADS_LIST && locationType !== LIST_PAGE) {\n return false\n }\n\n // Should update if we don't have filters yet (Generally - first load)\n if (selectFilters(state).length === 0) {\n return true\n }\n\n const currentCategory = categorySelector(state)\n\n // Don't update if current category matches the category stored in state upon list page load\n if (currentCategory === state.route.category) {\n return false\n }\n\n // Should update if current category does not match the previous category in the location reducer\n if (currentCategory !== selectPrevCategory(state)) {\n return true\n }\n\n // Should update if the location type does not match the previous one\n if (locationType !== selectPrevLocationType(state)) {\n return true\n }\n\n return false\n}\n\nexport const readyForV3Filters = (state: AppState): boolean => {\n return state.page === 'LeadList' && state.v3Leads.loaded.leadTypes && state.v3Leads.loaded.contentConfigs\n}\n\nexport const selectFilterOptionsByKey = (state: AppState, key: string, useDefaults: boolean): Option[] => {\n const filters = selectFilters(state)\n for (const filter of filters) {\n if (filter.key === key) {\n if (useDefaults) {\n return filter.defaultSelected\n }\n return filter.selected\n }\n }\n return []\n}\n\nexport const selectFilterOptionStringsByKey = (state: AppState, key: string, useDefaults: boolean): string[] => {\n return selectFilterOptionsByKey(state, key, useDefaults).reduce((acc: string[], curr: Option) => {\n if (isEnumOption(curr)) {\n acc.push(curr.value)\n }\n return acc\n }, [])\n}\n\nexport const selectFilterOptionBoolsByKey = (state: AppState, key: string, useDefaults: boolean): boolean[] => {\n return selectFilterOptionsByKey(state, key, useDefaults).map((opt) => opt.value === 'true')\n}\n\nexport const selectDateRangeFilterOptionValuesByKey = (state: AppState, key: string): [number, number] => {\n let [lessThan, greaterThan] = getDefaultFilterDateRange()\n const created = selectFilterOptionsByKey(state, key, false)\n created.forEach((cr) => {\n if (isDateOption(cr)) {\n if (cr.range === DateOptionRangeType.From) {\n greaterThan = cr.value\n }\n if (cr.range === DateOptionRangeType.To) {\n lessThan = cr.value\n }\n }\n })\n\n return [lessThan, greaterThan]\n}\n\n// The *Clean selectors checks the selected filter options against their defaults, and returns\n// undefined if the two options match.\n// This is to support V3 leads queries. Use with caution elsewhere.\n// PD-601: migrated from `selectedStagesSelector` and `selectedStatusesSelector`\n// Original comment:\n// Everything is selected by default, but that won't include results that aren't in the enum list.\n// So, if everything is selected, we should pass empty array to the backend to actually return everything\n\nexport const selectSelectedFilterOptionStringsByKeyClean = (state: AppState, key: string): string[] | undefined => {\n const selectedOptions = selectFilterOptionStringsByKey(state, key, false)\n const defaultOptions = selectFilterOptionStringsByKey(state, key, true)\n\n if (selectedOptions.length !== defaultOptions.length) {\n return selectedOptions\n }\n\n for (const opt of selectedOptions) {\n if (!defaultOptions.some((def) => def === opt)) {\n return selectedOptions\n }\n }\n\n return\n}\n\nexport const selectSelectedFilterOptionBoolsByKeyClean = (state: AppState, key: string): boolean[] | undefined => {\n const selectedOptions = selectFilterOptionBoolsByKey(state, key, false)\n const defaultOptions = selectFilterOptionBoolsByKey(state, key, true)\n\n if (selectedOptions.length !== defaultOptions.length) {\n return selectedOptions\n }\n\n for (const opt of selectedOptions) {\n if (!defaultOptions.some((def) => def === opt)) {\n return selectedOptions\n }\n }\n\n return\n}\n","import { AppState } from '../store'\n\nexport const membershipSelector = (state: AppState): any => {\n return (state && state.memberships) || []\n}\n","import { AppState } from '../store'\nimport { OrganizationsState } from '../reducers/organizations'\n\nexport const organizationsSelector = (state: AppState): OrganizationsState => {\n return state && state.organizations\n}\n","import _ from 'lodash'\nimport { FORGOT_PASSWORD, LOGIN_PAGE, PAGE, RESET_PASSWORD } from '../actions/location'\nimport { AppState } from '../store'\n\nconst publicPages = [FORGOT_PASSWORD, LOGIN_PAGE, RESET_PASSWORD]\n\nexport const pageSelector = (state: AppState): any => {\n return state && state.page\n}\n\nexport const isPublicPage = (page: string): boolean => {\n return _.includes(publicPages, page)\n}\n\nexport const isPageAction = (actionType: string): boolean => {\n return actionType.indexOf(PAGE) === 0\n}\n","import { countSelector } from './documents'\nimport { AppState } from '../store'\n\nexport const hasNextPageSelector = (state: AppState): any => {\n const skip = skipSelector(state)\n const limit = limitSelector(state)\n const documentCount = countSelector(state)\n const nextSkip = skip + limit\n const nextPageCount = documentCount - nextSkip > limit ? limit : documentCount - nextSkip\n return nextPageCount\n}\n\nexport const skipSelector = (state: AppState): number => {\n return state?.pagination?.skip ?? 0\n}\n\nexport const limitSelector = (state: AppState): number => {\n return state?.pagination?.limit ?? 100\n}\n\nexport const pagePaginationSelector = (state: AppState): number => {\n return state?.pagination?.page ?? 0\n}\n","import { AppState } from '../store'\nimport { Sort } from '../types/Sort'\n\nexport const sortSelector = (state: AppState): Sort => state?.sort ?? {}\n","export const localStorageSelector = (key: string) => {\n return localStorage.getItem(key)\n}\n","import { AppState } from '../store'\n\nexport const userThemeSelector = (state: AppState) => state.userSettings.theme\n","import { AppState } from '../store'\nimport { Enum, Lead, LeadQueryRequest, LeadType, Sort } from '../types'\nimport { limitSelector, skipSelector } from './pagination'\nimport { scopeSelector } from './scope'\nimport { searchTextSelector } from './search'\nimport { convertLeadTypesToEnums } from '../util'\nimport { differenceWith, isEqual } from 'lodash'\nimport {\n selectDateRangeFilterOptionValuesByKey,\n selectSelectedFilterOptionBoolsByKeyClean,\n selectSelectedFilterOptionStringsByKeyClean,\n} from './filters'\n\nexport const v3LeadsListSelector = (state: AppState): Lead[] => {\n return state.v3Leads.leads\n}\n\nexport const v3LeadSelector = (state: AppState): Lead => {\n return state.v3Leads.lead\n}\n\nexport const selectInitialV3Lead = (state: AppState): Lead => {\n return state.v3Leads.initialLead\n}\n\n// The PATCH endpoint for V3 Leads only takes a small subset of fields\nexport const selectPartialV3LeadForPatch = (state: AppState): Partial<Lead> => {\n const wip = v3LeadSelector(state)\n const original = selectInitialV3Lead(state)\n\n const validFields = ['ID', 'IsTestLead', 'Status', 'Notes']\n\n const patchable: Partial<Lead> = {}\n for (const [key, value] of Object.entries(wip)) {\n if (validFields.indexOf(key) === -1) {\n continue\n }\n\n // Always return the ID\n if (key === 'ID') {\n patchable[key] = value as string\n continue\n }\n\n switch (key) {\n case 'IsTestLead':\n if (original['IsTestLead'] !== wip['IsTestLead']) {\n patchable['IsTestLead'] = value as boolean\n }\n break\n case 'Status':\n if (original['Status'] !== wip['Status']) {\n patchable['Status'] = value as string\n }\n break\n case 'Notes':\n const noteDiff = differenceWith(wip['Notes'] ?? [], original['Notes'] ?? [], isEqual)\n if (noteDiff.length > 0) {\n patchable['Notes'] = noteDiff\n }\n }\n }\n\n return patchable\n}\n\nexport const selectLeadTypes = (state: AppState): LeadType[] => {\n return state.v3Leads.leadTypes\n}\n\nexport const selectLeadTypeEnums = (state: AppState): Enum[] => {\n const leadTypes = selectLeadTypes(state)\n return convertLeadTypesToEnums(leadTypes)\n}\n\nexport const v3LeadSortSelector = (state: AppState): Sort => {\n return state.v3Leads.sort ?? {}\n}\n\nexport const selectUnsavedV3LeadChanges = (state: AppState): boolean => {\n return JSON.stringify(selectInitialV3Lead(state)) !== JSON.stringify(v3LeadSelector(state))\n}\n\nexport function v3LeadQueryRequestConfigSelector(state: AppState): LeadQueryRequest {\n const params = new URLSearchParams(state?.location?.query as Record<string, string>)\n const sortParts = params.get('_order')?.split(' ')\n const sortField = sortParts?.length === 2 ? sortParts[0] : undefined\n const sortDirection = sortParts?.length === 2 ? sortParts[1] : undefined\n const [dateLT, dateGT] = selectDateRangeFilterOptionValuesByKey(state, 'CreatedAt')\n return {\n orgScope: scopeSelector(state),\n limit: limitSelector(state),\n offset: skipSelector(state),\n isTestLead: selectSelectedFilterOptionBoolsByKeyClean(state, 'IsTestLead'),\n status: selectSelectedFilterOptionStringsByKeyClean(state, 'Status'),\n stage: selectSelectedFilterOptionStringsByKeyClean(state, 'Stage'),\n typeLabel: selectSelectedFilterOptionStringsByKeyClean(state, 'TypeLabel'),\n search: searchTextSelector(state) || undefined,\n createdAtStart: new Date(dateGT * 1000).toISOString(),\n createdAtEnd: new Date(dateLT * 1000).toISOString(),\n sortField,\n sortDirection,\n }\n}\n","import { Schema } from '../schemas'\n\nexport const API_REQUEST: 'API_REQUEST' = 'API_REQUEST'\nexport const API_SUCCESS: 'API_SUCCESS' = 'API_SUCCESS'\nexport const API_ERROR: 'API_ERROR' = 'API_ERROR'\n\nexport type PaginationHeaders = {\n 'pagination-offset': string\n 'pagination-limit': string\n 'pagination-total': string\n}\n\ntype Methods = 'GET' | 'PUT' | 'POST' | 'PATCH' | 'DELETE'\n\nexport interface ApiRequestAction {\n type: string\n payload?: Body\n meta: {\n method: Methods\n url: string\n responseType?: string\n params?: object\n feature: string\n resource: string\n scope?: string\n // asOwnerOverride can be passed to override the As-Owner header in calls to apiRequest\n asOwnerOverride?: string\n }\n}\n\nexport type ApiSuccessPayload<T = any> = {\n ID: string\n data: T\n schema: Schema\n}\n\nexport type ApiErrorPayload = {\n _inputs?: any\n}\n\ntype Body = object | any[] | null\n\ntype Request = {\n method: Methods\n feature: string\n body?: Body\n url: string\n params?: object\n responseType?: string\n resource?: string\n scope?: string\n // asOwnerOverride can be passed to override the As-Owner header in calls to apiRequest\n asOwnerOverride?: string\n}\n\nexport const apiRequest = ({\n feature,\n body,\n method,\n url,\n params,\n responseType,\n resource = '',\n scope,\n asOwnerOverride,\n}: Request): ApiRequestAction => ({\n type: `${feature} ${API_REQUEST}`,\n payload: body,\n meta: {\n method,\n url,\n feature,\n params,\n responseType,\n resource,\n scope,\n asOwnerOverride,\n },\n})\n\ninterface ApiSuccessAction {\n type: string\n payload: object | any[] | null\n meta: {\n feature: string\n resource: string\n }\n headers: Record<string, string>\n}\n\nexport const apiSuccess = (data: any, feature: string, resource: string, headers: any): ApiSuccessAction => ({\n type: `${feature} ${API_SUCCESS}`,\n payload: data,\n meta: {\n feature,\n resource,\n },\n headers,\n})\n\nexport const apiError = (error: any, feature: any) => ({\n type: `${feature} ${API_ERROR}`,\n payload: error,\n meta: {\n feature,\n },\n})\n","var map = {\n\t\"./de-DE\": [\n\t\t483,\n\t\t2\n\t],\n\t\"./de-DE.json\": [\n\t\t483,\n\t\t2\n\t],\n\t\"./en-US\": [\n\t\t84\n\t],\n\t\"./en-US.json\": [\n\t\t84\n\t],\n\t\"./es-ES\": [\n\t\t484,\n\t\t3\n\t],\n\t\"./es-ES.json\": [\n\t\t484,\n\t\t3\n\t],\n\t\"./fr-FR\": [\n\t\t485,\n\t\t4\n\t],\n\t\"./fr-FR.json\": [\n\t\t485,\n\t\t4\n\t],\n\t\"./it-IT\": [\n\t\t486,\n\t\t5\n\t],\n\t\"./it-IT.json\": [\n\t\t486,\n\t\t5\n\t]\n};\nfunction webpackAsyncContext(req) {\n\tif(!__webpack_require__.o(map, req)) {\n\t\treturn Promise.resolve().then(function() {\n\t\t\tvar e = new Error(\"Cannot find module '\" + req + \"'\");\n\t\t\te.code = 'MODULE_NOT_FOUND';\n\t\t\tthrow e;\n\t\t});\n\t}\n\n\tvar ids = map[req], id = ids[0];\n\treturn Promise.all(ids.slice(1).map(__webpack_require__.e)).then(function() {\n\t\treturn __webpack_require__.t(id, 3);\n\t});\n}\nwebpackAsyncContext.keys = function webpackAsyncContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackAsyncContext.id = 690;\nmodule.exports = webpackAsyncContext;","// These are not proper \"actions\", but are used to record the different\n// types/features of auth requests. They are here for completion's sake.\nexport enum AuthActionTypes {\n Login = '[auth] Login',\n Forgot = '[auth] Forgot Password',\n Reset = '[auth] Reset Password',\n}\n","import { i18nSelectorMap } from '../../reducers/i18n'\nimport { AxiosError } from 'axios'\nimport { getPCErrorField } from '../../util/api_errors'\nimport React from 'react'\nimport { AuthActionTypes } from '../../actions/auth'\n\nexport type LoginError = {\n root: string[]\n inputs?: {\n email?: string\n password?: string\n }\n}\n\nexport const getLoginError = (i18n: i18nSelectorMap, err: AxiosError, reqType: string): LoginError | null => {\n let loginErr: LoginError | null = null\n const errMsg: string[] = []\n const pcMsg = getPCErrorField(err, 'message')\n if (pcMsg) {\n errMsg.push(pcMsg)\n } else {\n errMsg.push(i18n('auth.error.unexpected'), i18n('auth.error.tryAgain'))\n }\n\n switch (reqType) {\n case AuthActionTypes.Reset:\n errMsg[0] = `${i18n('auth.error.reset')}: ${errMsg[0]}`\n loginErr = {\n root: errMsg,\n }\n break\n case AuthActionTypes.Forgot:\n // PD-135 - catch the specific \"email invalid\" error code and show\n // a different message in the event that error was not the problem,\n // so that users reporting problems can relay that for our troubleshooting.\n const code = getPCErrorField(err, 'code')\n switch (code) {\n case 'PC-API-AUTH-15':\n loginErr = {\n root: [i18n('auth.error.forgot')],\n inputs: {\n email: `${i18n('auth.forgot.email')} ${i18n('auth.error.tryAgain')}`,\n },\n }\n break\n default:\n errMsg[0] = `${i18n('auth.error.forgot')}: ${errMsg[0]}`\n loginErr = {\n root: errMsg,\n }\n }\n break\n default:\n errMsg[0] = `${i18n('auth.error.login')}: ${errMsg[0]}`\n loginErr = {\n root: errMsg,\n }\n }\n\n if (!loginErr.inputs) {\n const inputs = getPCErrorField(err, 'inputs')\n if (inputs) {\n loginErr.inputs = {\n email: inputs.email,\n password: inputs.password,\n }\n }\n }\n\n return loginErr\n}\n\ntype LoginErrorMessageProps = {\n error: LoginError | null\n}\nexport const LoginErrorMessage = ({ error }: LoginErrorMessageProps): JSX.Element | null => {\n if (!error) return null\n return (\n <div className=\"error\">\n {error.root.map((err, index) => {\n return <p key={`err-${err}-${index}`}>{err}</p>\n })}\n </div>\n )\n}\n","import React, { useState } from 'react'\nimport { useHistory, useLocation } from 'react-router-dom'\nimport { Option, OptionType } from '../../types'\nimport Button from '../Button/Button'\nimport Select from '../Select/Select'\nimport TextField from '../TextField/TextField'\nimport { SessionState } from 'reducers/session'\nimport { RefreshToast } from '../RefreshToast/RefreshToast'\nimport config from '../../config'\nimport './Login.scss'\nimport { useAvailableLocaleOptions, useI18nSelector, useI18nDispatch, useI18nState } from '../../v3/context/i18n'\nimport { resetDateFilters, setLocalStorage } from '../../util'\nimport { i18nActionTypes } from '../../actions'\nimport * as Sentry from '@sentry/react'\nimport { doRequest } from '../../middleware'\nimport { AuthActionTypes } from '../../actions/auth'\nimport { getLoginError, LoginError } from './LoginError'\nimport { LoginErrorMessage } from './LoginError'\n\ntype RootLoginProps = {\n email?: string\n error?: string\n}\nexport const RootLogin = ({ email: propsEmail, error: propsError }: RootLoginProps) => {\n const [email, setEmail] = useState<string>(propsEmail ?? '')\n const [password, setPassword] = useState('')\n let initErr: LoginError | null = null\n if (propsError) {\n initErr = {\n root: [propsError],\n }\n }\n const [error, setError] = useState<LoginError | null>(initErr)\n const history = useHistory()\n const { locale } = useI18nState()\n const availableLocales = useAvailableLocaleOptions()\n const i18n = useI18nSelector()\n const i18nDispatch = useI18nDispatch()\n const location = useLocation()\n\n let { from } = location.state || { from: { pathname: '/' } }\n if (!from || !from.pathname || from.pathname === '/login') {\n from = {\n pathname: '/',\n }\n }\n\n const onSubmit = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n e.preventDefault()\n\n Sentry.setUser({ email: email })\n\n doRequest({\n url: `${config.api}/authenticate/credentials`,\n method: 'POST',\n headers: {\n 'Accept-Language': locale,\n },\n payload: {\n email,\n password,\n },\n validateStatus: (status) => {\n return status === 200\n },\n type: AuthActionTypes.Login,\n })\n .then((res) => {\n if (!res) return\n setLocalStorage(config.sessionKey, res.data as SessionState)\n window.dispatchEvent(new Event('toggle-theme'))\n // AB#8587 Lead list date filters should be reset on every user session\n resetDateFilters()\n // reloading the window; this allows the app to re-fetch the session from storage and load into desktop or mobile views\n history.replace(from)\n })\n .catch((err) => {\n setError(getLoginError(i18n, err, AuthActionTypes.Login))\n })\n }\n\n const logoClasses = ['logo']\n if (error) {\n logoClasses.push('has-error')\n }\n\n return (\n <div className=\"LoginScreen\">\n <div className=\"Login\">\n <form className=\"form\">\n <div className={logoClasses.join(' ')} />\n <LoginErrorMessage error={error} />\n <TextField\n label={i18n('auth.emailLabel')}\n onInput={(value: string) => {\n setError(null)\n setEmail(value)\n }}\n type=\"email\"\n value={email}\n error={error?.inputs?.email}\n testID={'login-email'}\n />\n <TextField\n label={i18n('auth.passwordLabel')}\n onInput={(value: string) => {\n setError(null)\n setPassword(value)\n }}\n type=\"password\"\n value={password}\n error={error?.inputs?.password}\n testID={'login-password'}\n />\n <Select\n dataCIKey={'locale'}\n label={i18n('locale.language')}\n options={availableLocales}\n value={availableLocales.filter((v: any): boolean => locale === v.value)}\n onChange={(opts: Option[]) => {\n const locale = opts[0]\n if (locale.type !== OptionType.Enum) return\n i18nDispatch({ type: i18nActionTypes.SET_LOCALE, locale: locale.value })\n }}\n />\n <div className=\"buttons\">\n <div className=\"actions login\">\n <Button className=\"submit\" id=\"submit\" variant=\"contained\" color=\"primary\" disableElevation onClick={onSubmit} type=\"submit\">\n {i18n('auth.cta.signIn')}\n </Button>\n </div>\n <div className=\"helpers\">\n <Button className=\"forgotPassword\" onClick={() => history.push('/forgot-password')}>\n {i18n('auth.forgotPassword')}\n </Button>\n <LoginHelpButton reqType={AuthActionTypes.Login} />\n </div>\n </div>\n </form>\n <div className={'recaptcha-disclaimer'}>\n <p\n dangerouslySetInnerHTML={{\n __html: i18n('auth.recaptcha.disclaimer'),\n }}\n ></p>\n </div>\n </div>\n <RefreshToast />\n </div>\n )\n}\n\ntype LoginHelpButtonProps = {\n reqType: string\n}\nexport const LoginHelpButton = ({ reqType }: LoginHelpButtonProps) => {\n const i18n = useI18nSelector()\n let link = 'https://powerchord.atlassian.net/servicedesk/customer/portals'\n if (reqType !== AuthActionTypes.Login) {\n link = 'https://powerchord.atlassian.net/servicedesk/customer/kb/view/723222633'\n }\n return (\n <Button className=\"help\">\n <a href={link} target={'_blank'} rel={'noreferrer'}>\n {i18n('auth.needHelp')}\n </a>\n </Button>\n )\n}\n","import React, { useState } from 'react'\nimport { useHistory } from 'react-router-dom'\nimport config from '../../config'\nimport Button from '../Button/Button'\nimport TextField from '../TextField/TextField'\nimport { useI18nSelector, useI18nState } from '../../v3/context/i18n'\nimport './Login.scss'\nimport { doRequest } from '../../middleware'\nimport { AuthActionTypes } from '../../actions/auth'\nimport * as Sentry from '@sentry/react'\nimport { AxiosError } from 'axios'\nimport { getLoginError, LoginError, LoginErrorMessage } from './LoginError'\nimport { LoginHelpButton } from './RootLogin'\n\nconst ForgotPassword = () => {\n const [email, setEmail] = useState('')\n const [error, setError] = useState<LoginError | null>(null)\n const [sent, setSent] = useState(false)\n const history = useHistory()\n const i18n = useI18nSelector()\n const { locale } = useI18nState()\n\n const handleInputChange = (value: string) => {\n setEmail(value)\n setError(null)\n }\n\n const handleSubmit = () => {\n Sentry.setUser({ email: email })\n\n doRequest({\n url: `${config.api}/credentials/forgot`,\n method: 'POST',\n payload: {\n email,\n },\n headers: {\n 'Accept-Language': locale,\n },\n validateStatus: (status) => {\n return status === 200\n },\n type: AuthActionTypes.Forgot,\n })\n .then((res) => {\n setError(null)\n setSent(true)\n })\n .catch((err: AxiosError) => {\n setError(getLoginError(i18n, err, AuthActionTypes.Forgot))\n })\n }\n\n const handleKeyDown = (event: any) => {\n if (event.key === 'Enter') {\n handleSubmit()\n }\n }\n\n const renderMessage = () => {\n let message = i18n('auth.forgot.introduction')\n let className = 'message'\n\n if (sent) {\n message = i18n('auth.help.resetLinkSent')\n className = 'attention'\n }\n\n return <p className={className}>{message}</p>\n }\n\n return (\n <div className=\"LoginScreen forgot-screen\">\n <div className=\"Login\">\n <div className=\"form\">\n <div className=\"logo\" />\n {renderMessage()}\n <LoginErrorMessage error={error} />\n {sent ? null : (\n <TextField\n className={'forgot-password-input'}\n error={error?.inputs?.email}\n label={i18n('auth.emailLabel')}\n onInput={handleInputChange}\n onKeyDown={handleKeyDown}\n type=\"email\"\n />\n )}\n <div className=\"buttons\">\n <div className=\"actions forgot\">\n <Button\n className=\"cancel\"\n onClick={() => history.push('/login')}\n variant=\"contained\"\n color={sent ? 'primary' : 'default'}\n disableElevation\n >\n {sent ? i18n('auth.cta.goBack') : i18n('global.action.labels.cancel')}\n </Button>\n {sent ? null : (\n <Button className=\"submit\" variant=\"contained\" color=\"primary\" disableElevation onClick={handleSubmit}>\n {i18n('auth.cta.sendEmail')}\n </Button>\n )}\n </div>\n <div className=\"helpers\">\n <LoginHelpButton reqType={AuthActionTypes.Login} />\n </div>\n </div>\n </div>\n </div>\n </div>\n )\n}\n\nexport default ForgotPassword\n","import React, { useEffect, useState } from 'react'\nimport TextField from '../../components/TextField/TextField'\nimport config from '../../config'\nimport Button from '../Button/Button'\nimport './Login.scss'\nimport { useI18nSelector, useI18nState } from '../../v3/context/i18n'\nimport { removeLocalStorage } from '../../util'\nimport { doRequest } from '../../middleware'\nimport { AuthActionTypes } from '../../actions/auth'\nimport * as Sentry from '@sentry/react'\nimport { getLoginError, LoginError, LoginErrorMessage } from './LoginError'\nimport { LoginHelpButton } from './RootLogin'\n\nexport interface ResetPasswordProps {\n token?: string\n}\n\nconst ResetPassword = (props: ResetPasswordProps) => {\n const [password, setPassword] = useState('')\n const [passwordConfirm, setPasswordConfirm] = useState('')\n const [success, setSuccess] = useState(false)\n const [error, setError] = useState<LoginError | null>(null)\n const i18n = useI18nSelector()\n const { locale } = useI18nState()\n\n useEffect(() => {\n const tokenErr: LoginError = {\n root: [i18n('auth.reset.token-error'), i18n('auth.reset.token-help')],\n }\n if (props.token && props.token !== '') {\n return\n }\n // Checking the values of the current and new error - otherwise the\n // unlocalized version may show.\n if (error && error.root[0] === tokenErr.root[0]) {\n return\n }\n setError(tokenErr)\n Sentry.withScope(function (scope) {\n scope.setTag('type', AuthActionTypes.Reset)\n Sentry.captureException(new Error('invalid password reset token'))\n })\n }, [props.token, i18n, error])\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.key === 'Enter') {\n handleSubmit(event)\n }\n }\n\n const handleSubmit = (event: React.SyntheticEvent) => {\n if (event) {\n event.preventDefault()\n }\n\n doRequest({\n url: `${config.api}/credentials/reset`,\n method: 'POST',\n payload: {\n password,\n passwordConfirm,\n token: props.token,\n },\n validateStatus: (status) => {\n return status === 200\n },\n headers: {\n 'Accept-Language': locale,\n },\n type: AuthActionTypes.Reset,\n })\n .then((res) => {\n if (!res) return\n setSuccess(true)\n setError(null)\n removeLocalStorage(config.sessionKey) // prevent routing issues when resetting password while an active session exists\n })\n .catch((err) => {\n setError(getLoginError(i18n, err, AuthActionTypes.Reset))\n })\n }\n\n const passwordForm = (): React.ReactNode => {\n return (\n <>\n <p className=\"message\">{i18n('auth.reset.introduction')}</p>\n <LoginErrorMessage error={error} />\n <TextField label={i18n('auth.passwordLabel')} onInput={(v) => setPassword(v)} onKeyDown={handleKeyDown} type=\"password\" />\n <TextField label={i18n('auth.passwordConfirmation')} onInput={(v) => setPasswordConfirm(v)} onKeyDown={handleKeyDown} type=\"password\" />\n <div className=\"buttons\">\n <div className=\"actions reset\">\n <Button className=\"submit\" variant=\"contained\" color=\"primary\" disableElevation onClick={handleSubmit}>\n {i18n('auth.cta.resetPassword')}\n </Button>\n </div>\n <div className=\"helpers\">\n <LoginHelpButton reqType={AuthActionTypes.Reset} />\n </div>\n </div>\n </>\n )\n }\n\n const passwordSuccess = (): React.ReactNode => {\n return (\n <>\n <p className=\"message\">{i18n('auth.reset.successful')}</p>\n <div className=\"buttons\">\n <div className=\"actions reset-login\">\n <Button\n className=\"submit\"\n variant=\"contained\"\n color=\"primary\"\n id=\"submit\"\n onClick={() =>\n // Using react-router's push() causes a state problem here, so just reload the whole page\n (window.location.href = '/login')\n }\n >\n {i18n('auth.cta.reset.login')}\n </Button>\n </div>\n </div>\n </>\n )\n }\n\n return (\n <div className=\"LoginScreen\">\n <div className=\"Login\">\n <div className=\"form\">\n <div className=\"logo\" />\n {success ? passwordSuccess() : passwordForm()}\n </div>\n <div className=\"greeting\" />\n </div>\n </div>\n )\n}\n\nexport default ResetPassword\n","import { Settings } from '../types'\nimport config from '../config'\nimport { SessionState } from '../reducers/session'\n\nexport async function fetchPlatformSettings(session: SessionState): Promise<Settings> {\n if (session?.authorizationToken) {\n return fetch(\n `${config.api ?? 'MISSING API URL'}/organizations/${session.organization?.trunkID}/${session.organization?.trunkID}/platformSettings`,\n {\n headers: {\n Authorization: `${session.authorizationToken}`,\n },\n }\n )\n .then((response) => response.json())\n .then((response) => response?.data[0])\n .catch(() => ({}))\n }\n\n return {} as Settings\n}\n","import React, { PropsWithChildren, useEffect, useState } from 'react'\nimport { useHistory, useLocation, useParams } from 'react-router-dom'\nimport { useI18nSelector } from 'v3/context/i18n'\nimport { parse } from 'query-string'\nimport Button from '../Button/Button'\nimport './OneClick.scss'\nimport { Lead } from '../../types'\nimport config from '../../config'\nimport { doRequest } from '../../middleware'\nimport { Loading } from '../Loading/Loading'\nimport { trackEvent } from '../../util'\n\ntype OneClickProps = {\n leadID: string\n result: string | undefined\n}\n\ntype OneClickParams = Partial<Lead> & {\n auth_token: string\n recaptcha_response: string | null\n}\n\ndeclare global {\n interface Window {\n grecaptcha: {\n enterprise: any\n }\n }\n}\n\ntype OneClickActionProps = {\n recaptcha: any | undefined\n}\n\nexport const OneClickAction = ({ recaptcha }: OneClickActionProps) => {\n const history = useHistory()\n const location = useLocation()\n const i18n = useI18nSelector()\n const { leadID, result } = useParams<OneClickProps>()\n\n // Letting params be undefined without search prevents the recaptcha\n // submission from duplicating on redirects\n let params: OneClickParams | undefined\n if (location.search) {\n params = parse(location.search)\n }\n\n const success = result === 'success'\n const [loading, setLoading] = useState<boolean>(!result)\n\n useEffect(() => {\n if (!recaptcha || !leadID || !params || !loading) return\n recaptcha.enterprise.ready(async () => {\n try {\n const token = await recaptcha.enterprise.execute(config.recaptchaKey, { action: 'LeadOCA' })\n await doRequest({\n url: `${config.v3Api}/lead/${leadID}/oneclick`,\n method: 'POST',\n payload: {\n ...params,\n recaptcha_response: token,\n },\n headers: {\n 'Content-Type': 'application/json',\n },\n type: 'OCA_LEAD_UPDATE',\n })\n trackEvent('leadOCASuccess', { ocaMeta: { leadID: leadID, ...params } })\n history.replace(`/oca/lead/${leadID}/success`)\n } catch (err) {\n trackEvent('leadOCAError', { ocaMeta: { leadID: leadID, ...params } })\n history.replace(`/oca/lead/${leadID}/error`)\n } finally {\n setLoading(false)\n }\n })\n }, [history, leadID, loading, params, recaptcha])\n\n switch (loading) {\n case true:\n return (\n <Content>\n <Loading title={i18n('leads.oca.loading.title')} message={null} />\n </Content>\n )\n default:\n // ?from param is for clickstream tracking\n let path = `/v3/leads/${leadID}?from=ocaError`\n let message = i18n('leads.oca.error.message')\n if (success) {\n path = `/v3/leads/${leadID}?from=ocaSuccess`\n message = i18n('leads.oca.success.message')\n }\n return (\n <Content>\n <span className=\"message\">{message}</span>\n <div className=\"buttons\">\n <Button className=\"view-lead\" onClick={() => history.push(path)} variant=\"contained\" color=\"primary\" disableElevation>\n {i18n('leads.oca.button.label')}\n </Button>\n </div>\n </Content>\n )\n }\n}\n\nconst Content = ({ children }: PropsWithChildren<any>) => {\n return (\n <div className=\"OneClick\">\n <div className=\"Content\">\n <div className=\"form\">\n <div className=\"logo\" />\n {children}\n </div>\n </div>\n </div>\n )\n}\n","import { ThemeProvider, useMediaQuery } from '@material-ui/core'\nimport { Loading } from 'components/Loading/Loading'\nimport { parse } from 'query-string'\nimport React, { lazy, Suspense, useEffect, useState } from 'react'\nimport { BrowserRouter, Redirect, Route, Switch, useLocation } from 'react-router-dom'\nimport { ToastContainer } from 'react-toastify'\nimport { Settings } from 'types'\nimport config from '../../config'\nimport { SessionState } from '../../reducers/session'\nimport theme from '../../theme'\nimport { getLocalStorage, trackPageView } from '../../util'\nimport ForgotPassword from '../Login/ForgotPassword'\nimport ResetPassword from '../Login/ResetPassword'\nimport { RootLogin } from '../Login/RootLogin'\nimport { I18nProvider } from '../../v3/context/i18n'\nimport { fetchPlatformSettings } from '../../request/fetchPlatformSettings'\nimport { OneClickAction } from '../OneClickAction/OneClickAction'\n\nconst MobileRoot = lazy(() => import('../Mobile/App'))\nconst V1Root = lazy(() => import('../AppV1/Wrapper'))\n\n// For root / auth purposes, we need to assume state fields could be unset,\n// even for fields that we can safely assume are set later.\n// Every usage of SessionState that could encounter an unauthenticated session\n// should use this type.\ntype RootSessionState = Partial<SessionState>\n\n/**\n * The AppRoot is the entry-point for Command Center\n * It handles top-level routing, session fetching, and redirection\n */\nexport default function AppRoot() {\n // Load reCAPTCHA enterprise for all pages\n const [recaptcha, setRecaptcha] = useState<any | undefined>(undefined)\n useEffect(() => {\n if (window.grecaptcha) return\n const script = document.createElement('script')\n script.src = `https://www.google.com/recaptcha/enterprise.js?render=${config.recaptchaKey}`\n script.async = true\n script.addEventListener('load', () => {\n setRecaptcha(window.grecaptcha)\n })\n document.head.appendChild(script)\n return () => {\n document.head.removeChild(script)\n }\n }, [])\n\n // Dark mode is not supported on Mobile (under 600px)\n const mobileView = useMediaQuery('(max-width:600px)')\n const preferDark = useMediaQuery('(prefers-color-scheme: dark)')\n\n // SAVE_USER_SUCCESS and RootLogin will emit a 'toggle-theme' event on the window when a user saves their\n // own account info - this listener picks up the theme change and the state\n // variable will trigger the useEffect hook..\n const [themeReload, setThemeReload] = useState(false)\n\n useEffect(() => {\n const toggleTheme = () => {\n setThemeReload((prev) => !prev)\n }\n window.addEventListener('toggle-theme', toggleTheme)\n\n return () => {\n window.removeEventListener('toggle-theme', toggleTheme)\n }\n }, [])\n\n const [userTheme, setUserTheme] = useState<string>(preferDark ? 'dark' : 'light')\n\n // Switch to dark theme when the user does not have a preference and their\n // OS switches.\n useEffect(() => {\n let newTheme = mobileView ? 'light' : 'dark'\n if (!mobileView) {\n newTheme = preferDark ? 'dark' : 'light'\n const localSession: RootSessionState | null = getLocalStorage(config.sessionKey)\n if (localSession && localSession.user && localSession.user.theme) {\n newTheme = localSession.user.theme\n }\n }\n\n setUserTheme((prevState) => {\n if (prevState === newTheme) {\n return prevState\n }\n return newTheme\n })\n }, [themeReload, preferDark, mobileView])\n\n let locale: string | null = getLocalStorage(config.languageKey)\n if (!locale) {\n locale = 'en-US'\n }\n\n return (\n <ThemeProvider theme={theme(userTheme)}>\n <span className={userTheme}>\n <I18nProvider locale={locale}>\n {/* forceRefresh=true will force the window to refresh on navigation, which allows the app to reload if user\n is authenticated while navigating to /login (forces app refresh to load app and other routers) */}\n <BrowserRouter>\n <Switch>\n <Route path=\"/forgot-password\">\n <ForgotPassword />\n <PageChangeTracker />\n </Route>\n\n <Route path=\"/my-account/reset-password\">\n <ResetPasswordRoute />\n <PageChangeTracker />\n </Route>\n\n <Route path=\"/login\">\n <LoginRoute />\n <PageChangeTracker />\n </Route>\n\n <Route exact path=\"/oca/lead/:leadID/:result?\">\n <OneClickAction recaptcha={recaptcha} />\n <PageChangeTracker />\n </Route>\n\n <Route>\n <DefaultAppRoute />\n </Route>\n </Switch>\n </BrowserRouter>\n </I18nProvider>\n <ToastContainer />\n </span>\n </ThemeProvider>\n )\n}\n\n// Exists so that page loads for routes defined by react-router can trigger pageview events in PC Tracking\n// Legacy redux-first-router routed page views are tracked automatically in the App component\nfunction PageChangeTracker() {\n const location = useLocation()\n\n useEffect(() => {\n trackPageView()\n }, [location])\n return null\n}\n\nfunction ResetPasswordRoute() {\n const params: { token?: string } = parse(window.location.search)\n return <ResetPassword token={params.token} />\n}\n\nfunction LoginRoute() {\n // If authorized, redirect to root '/'. the respective routers, redux-router or react-router depending on app view, will redirect accordingly\n const session: RootSessionState | null = getLocalStorage(config.sessionKey)\n if (session && session.authorizationToken) {\n return <Redirect to=\"/\" />\n }\n return <RootLogin />\n}\n\n// Installed via <script> tag in index.html\ndeclare const pendo: {\n initialize: (settings: {}) => void\n}\n\nfunction DefaultAppRoute() {\n const [platformSettings, setPlatformSettings] = useState<Settings>()\n const width = window.innerWidth\n const location = useLocation()\n\n const session: RootSessionState | null = getLocalStorage(config.sessionKey)\n\n if (!session || !session.user) {\n return (\n <Redirect\n to={{\n pathname: '/login',\n state: { from: location },\n }}\n />\n )\n }\n\n // From this point onwards, we are back to assuming SessionState is the valid type\n\n // Pendo install docs: https://app.eu.pendo.io/setup?setupKey=eyJTdWJzY3JpcHRpb25OYW1lIjoiUG93ZXJDaG9yZCIsIkhtYWMiOiJ6ZDI3TzFhaUdiT3AxN2x1YWdVZjJ0SnRYRWlIR3JTV3V6dXYwVDFwVWRJPSJ9&os=web\n pendo.initialize({\n visitor: {\n id: session.user.ID,\n email: session.user.email,\n full_name: session.user.fullName,\n },\n account: {\n id: (session as SessionState).organization.ID,\n name: (session as SessionState).organization.name,\n },\n })\n\n const shouldShowMobile = width < 600 && platformSettings?.enableV3\n if (platformSettings) {\n if (shouldShowMobile) {\n return (\n <Suspense fallback={<Loading fullScreen={true} />}>\n <MobileRoot session={session as SessionState} platformSettings={platformSettings} />\n </Suspense>\n )\n }\n return (\n <Suspense fallback={<Loading fullScreen={true} />}>\n <V1Root session={session as SessionState} platformSettings={platformSettings} />\n </Suspense>\n )\n } else {\n fetchPlatformSettings(session as SessionState).then((s) => setPlatformSettings(s))\n return <Loading fullScreen={true} />\n }\n}\n","import React from 'react'\nimport 'react-app-polyfill/ie11'\nimport 'react-app-polyfill/stable'\nimport ReactDOM from 'react-dom'\nimport './index.scss'\nimport AppRoot from 'components/AppRoot/AppRoot'\nimport * as Sentry from '@sentry/react'\nimport config from './config'\nimport * as process from 'process'\n\n// Mui's ThemeProvider is unnecessarily cranky about Sentry annotating it and throws an error in the console.\n// This error causes false positives in tests, at a min, and could trigger other false positives if we ever monitor\n// console errors.\n// This workaround suppresses that error log while passing others through to the original console.\nconst consoleErr = console.error\nconsole.error = (...data: any[]) => {\n if (\n !data.some(\n (en) =>\n en === 'The following props are not supported: `data-sentry-element`, `data-sentry-component`, `data-sentry-source-file`. Please remove them.'\n )\n ) {\n consoleErr(...data)\n }\n}\n\nSentry.init({\n dsn: 'https://1e4f10f3d9174107a477683dbe1b0740@sentry.io/1523390',\n debug: config.debugSentry,\n environment: config.environment,\n // This is the Git tag / build number, set in GHA workflows.\n release: process.env.SENTRY_RELEASE,\n integrations: [Sentry.extraErrorDataIntegration()],\n beforeSend(event) {\n // denyURLs can fail in weird ways, this is a more generic test\n if (event.request?.url?.includes('localhost')) {\n console.debug('Sentry event blocked from sending:', event)\n return null\n }\n return event\n },\n})\n\nif (window && window.top && window.top.location && window.top.location !== window.self.location) {\n console.warn('this app is not intended to be used within an iframe')\n} else if (process.env.REACT_APP_RUN_IN_STRICT_MODE === 'true') {\n console.warn('app is running in strict mode')\n ReactDOM.render(\n <React.StrictMode>\n <AppRoot />\n </React.StrictMode>,\n document.getElementById('root')\n )\n} else {\n ReactDOM.render(<AppRoot />, document.getElementById('root'))\n}\n","import React, { useState, useRef } from 'react'\nimport {\n Button as MaterialButton,\n Popper,\n MenuList,\n MenuItem,\n Paper,\n Grow,\n LinearProgress,\n Theme,\n ClickAwayListener,\n makeStyles,\n createStyles,\n} from '@material-ui/core'\nimport clsx from 'clsx'\nimport { ArrowDropDown } from '@material-ui/icons'\nimport { ButtonProps } from '@material-ui/core/Button'\n\ntype Props = ButtonProps & {\n options?: any[] | null\n loading?: boolean\n buttontext?: string\n}\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n arrow: {\n width: theme.spacing(1),\n minWidth: theme.spacing(1),\n },\n root: {\n position: 'relative',\n },\n progress: {\n position: 'absolute',\n width: '100%',\n bottom: 0,\n borderRadius: '0 0 5px 5px',\n },\n })\n)\n\nconst Button = (props: Props) => {\n const classes = useStyles(props)\n const [open, setOpen] = useState(false)\n const anchorRef = useRef(null)\n const { children, options, onClick, loading, className, ...rest } = props\n function handleToggle() {\n setOpen((prevOpen) => !prevOpen)\n }\n function handleClose(_event: any) {\n // if (anchorRef.current && anchorRef.current.contains(event.target)) {\n // return;\n // }\n\n setOpen(false)\n }\n if (options) {\n return (\n <div>\n <MaterialButton {...rest} ref={anchorRef} onClick={handleToggle}>\n {rest.buttontext}\n <ArrowDropDown />\n </MaterialButton>\n <Popper open={open} anchorEl={anchorRef.current} transition disablePortal>\n {({ TransitionProps, placement }) => (\n <Grow\n {...TransitionProps}\n style={{\n transformOrigin: placement === 'bottom' ? 'center top' : 'center bottom',\n }}\n >\n <Paper>\n <ClickAwayListener onClickAway={handleClose}>\n <MenuList>\n {options.map((option: any) => {\n return (\n <MenuItem\n key={option.value}\n onClick={() => {\n onClick && onClick(option.value)\n }}\n >\n {option.label}\n </MenuItem>\n )\n })}\n </MenuList>\n </ClickAwayListener>\n </Paper>\n </Grow>\n )}\n </Popper>\n </div>\n )\n }\n return (\n <div className={clsx(classes.root, className)}>\n <MaterialButton data-ci={`button-${children}`} {...rest} onClick={onClick} disableElevation>\n {children}\n </MaterialButton>\n {loading && <LinearProgress className={classes.progress} />}\n </div>\n )\n}\n\nexport default Button\n","import { AppState } from '../store'\nimport { Trigger, TriggerKeys, TriggerType, TriggerUIErrors } from '../v3/type/Trigger'\nimport { Action, ActionType } from '../v3/type/Action'\nimport { focusedOrgSelector } from './session'\nimport { scopeSelector } from './scope'\nimport { getV3DefaultOwnerID, IDFromV2 } from '../util'\nimport { Enum, Option, OptionType, Scope, V3Organization } from '../types'\nimport { selectActiveV3Orgs, V3OrganizationsSelector } from './V3Organizations'\nimport { CheckboxOption } from '../v3/component/CheckboxGroup/CheckboxGroup'\nimport { UITriggerCondition } from '../v3/type/Condition'\nimport { selecti18n } from './i18n'\nimport { selectLeadStatusEnums } from './contentConfig'\n\nexport const triggerSelector = (state: AppState): Trigger => {\n return state.triggers.trigger\n}\n\nexport const selectInitialTrigger = (state: AppState): Trigger => {\n return state.triggers.initialTrigger\n}\n\nexport const triggerScopeSelector = (state: AppState): Scope => {\n return state.triggers.scope\n}\n\nexport const triggerErrorSelector = (state: AppState): string | undefined => {\n return state.triggers.triggerError\n}\n\nexport const selectTriggerEditorErrors = (state: AppState): TriggerUIErrors => {\n return state.triggers.editorErrors\n}\n\nexport const selectTriggerEditorErrorsCount = (state: AppState): number => {\n const errors = selectTriggerEditorErrors(state)\n let count = 0\n for (const value of Object.values(errors)) {\n if (value) {\n count++\n }\n }\n return count\n}\n\nexport const selectTriggerFieldHasError = (state: AppState, field: TriggerKeys): string | undefined => {\n const errors = selectTriggerEditorErrors(state)\n return errors[field]\n}\n\nexport const editorErrorSelector = (state: AppState): TriggerUIErrors => {\n return state.triggers.editorErrors\n}\n\nexport const cachedActionsSelector = (state: AppState): Action[] => {\n return state.triggers.cachedActions\n}\n\nexport const selectDefaultTriggerOwner = (state: AppState): string => {\n const focusedOrg = focusedOrgSelector(state)\n const scope = scopeSelector(state)\n switch (true) {\n case scope === Scope.PlatformSystem:\n return getV3DefaultOwnerID()\n case focusedOrg && focusedOrg.ID !== '':\n return IDFromV2(focusedOrg!.ID)\n default:\n return ''\n }\n}\n\nexport const selectTriggerOrgOptions = (state: AppState): Option[] => {\n const scope = triggerScopeSelector(state)\n if (scope === Scope.PlatformSystem) {\n return [\n {\n type: OptionType.Enum,\n label: selecti18n(state, 'rules.detail.list.ruleOwner.default'),\n value: getV3DefaultOwnerID(),\n },\n ]\n }\n const v3Orgs = selectActiveV3Orgs(state)\n return v3Orgs.reduce((acc: Option[], org: V3Organization) => {\n if (org.ID === '') {\n return acc\n }\n acc.push({\n type: OptionType.Enum,\n label: org.Name ?? '',\n value: org.ID,\n })\n return acc\n }, [])\n}\n\nexport const selectTriggerOwnerName = (state: AppState, trigger: Trigger): string => {\n if (trigger.OwnerID === getV3DefaultOwnerID()) {\n return selecti18n(state, 'rules.detail.list.ruleOwner.default')\n }\n\n const v3Orgs = V3OrganizationsSelector(state)\n const ownerOrg = v3Orgs.find((org) => org.ID === trigger.OwnerID)\n if (!ownerOrg || !ownerOrg.Name) {\n return ''\n }\n\n return ownerOrg.Name\n}\n\nexport const selectTriggerRuleTypeOptions = (state: AppState): Option[] => {\n return [\n {\n type: OptionType.Enum,\n label: selecti18n(state, 'rules.detail.page.ruleTypes.lead.created'),\n value: TriggerType.LeadCreatedTrigger,\n },\n {\n type: OptionType.Enum,\n label: selecti18n(state, 'rules.detail.page.ruleTypes.lead.modified'),\n value: TriggerType.LeadModifiedTrigger,\n },\n {\n type: OptionType.Enum,\n label: selecti18n(state, 'rules.detail.page.ruleTypes.lead.reminders'),\n value: TriggerType.LeadRemindersTrigger,\n },\n ]\n}\n\nexport const selectHumanizedTriggerRuleType = (state: AppState, trigger: Trigger): string => {\n switch (trigger.Type) {\n case TriggerType.LeadCreatedTrigger:\n return selecti18n(state, 'rules.detail.page.ruleTypes.lead.created')\n case TriggerType.LeadModifiedTrigger:\n return selecti18n(state, 'rules.detail.page.ruleTypes.lead.modified')\n case TriggerType.LeadRemindersTrigger:\n return selecti18n(state, 'rules.detail.page.ruleTypes.lead.reminders')\n default:\n return trigger.Type\n }\n}\n\nexport const selectTriggerStatusOptions = (state: AppState): Option[] => {\n const active = selecti18n(state, 'leads.status.enum.active.label')\n const inactive = selecti18n(state, 'rules.detail.page.status.inactive')\n return [\n {\n type: OptionType.Enum,\n label: active,\n value: 'true',\n },\n {\n type: OptionType.Enum,\n label: inactive,\n value: 'false',\n },\n ]\n}\n\nexport const selectLeadStatusesAsCheckboxOptions = (state: AppState, condition: UITriggerCondition) => {\n const leadStatusEnums = selectLeadStatusEnums(state, false)\n return leadStatusEnums.map(\n (e: Enum): CheckboxOption => {\n let selected = false\n if (condition) {\n const selectedOptions = condition.value as string[]\n if (selectedOptions && selectedOptions.indexOf(e.value) > -1) {\n selected = true\n }\n }\n\n return {\n label: e.label,\n value: e.value,\n disabled: e.disabled,\n selected: selected,\n }\n }\n )\n}\n\nexport const triggerTitleSelector = (state: AppState): string => {\n const trigger = triggerSelector(state)\n if (trigger.Name && trigger.Name !== '') {\n return trigger.Name\n }\n\n const triggerScope = triggerScopeSelector(state)\n if (triggerScope === Scope.PlatformSystem) {\n return selecti18n(state, 'nav.labels.rules.platformSystem')\n }\n\n return selecti18n(state, 'nav.labels.rules.customOrganization')\n}\n\n// TODO: these values need to be localized\nexport const selectActionOptions = (state: AppState): Option[] => {\n return [\n {\n type: OptionType.Enum,\n label: 'Webhook',\n value: ActionType.WebhookHTTPAction,\n },\n //TODO: bring back when we are working on email actions\n //{\n // type: OptionType.Enum,\n // label: 'Email',\n // value: ActionType.NotificationEmailAction,\n //},\n ]\n}\n\nexport const selectTriggerCountLimitOptions = (state: AppState): Option[] => {\n return Array.from(Array(10).keys()).reduce((acc: Option[], currVal: number): Option[] => {\n if (currVal !== 0) {\n acc.push({\n type: OptionType.Enum,\n label: currVal.toString(),\n value: currVal.toString(),\n })\n }\n return acc\n }, [])\n}\n","import { AppState } from '../store'\n\nexport const categorySelector = (state: AppState): string => state?.location?.payload?.category ?? ''\n\nexport const resourceSelector = (state: AppState): string => state?.location?.payload?.resource ?? ''\n\nexport const siteIDSelector = (state: AppState): any => state?.location?.payload?.siteID ?? ''\n\nexport const querySelector = (state: AppState): any => state?.location?.query ?? {}\n\nexport const documentIDSelector = (state: AppState): string => state?.location?.payload?.id ?? ''\n\nexport const pathnameSelector = (state: AppState) => state?.location?.pathname ?? ''\n\nexport const selectLocationType = (state: AppState) => state.location.type\n\nexport const selectPrevLocationType = (state: AppState): string => {\n return state.location.prev.type\n}\n\nexport const selectPrevCategory = (state: AppState): string => {\n return state.location.prev.payload.category\n}\n","import { AppState } from '../store'\nimport { ContentConfig, Enum, Option } from '../types'\nimport { getLeadStageEnums, getLeadStatusEnums } from '../util/contentConfig'\nimport { i18n } from './i18n'\nimport { enumToOptionEnum } from '../util/enums'\n\nexport const selectContentConfigs = (state: AppState): ContentConfig[] => {\n return state.v3Leads.contentConfigs\n}\n\nexport const selectLeadStatusEnums = (state: AppState, trimDefaults: boolean): Enum[] => {\n const configs = selectContentConfigs(state)\n return getLeadStatusEnums(i18n(state), configs, trimDefaults)\n}\n\nexport const selectLeadStageEnums = (state: AppState): Enum[] => {\n return getLeadStageEnums(i18n(state))\n}\n\nexport const selectLeadStatusOptions = (state: AppState, trimDefaults: boolean): Option[] => {\n const statusEnums = selectLeadStatusEnums(state, trimDefaults)\n return enumToOptionEnum(statusEnums)\n}\n\nexport const selectLeadStageOptions = (state: AppState): Option[] => {\n return enumToOptionEnum(selectLeadStageEnums(state))\n}\n","export enum Environment {\n Production = 'production',\n QA = 'qa',\n Development = 'dev',\n Workstation = 'workstation',\n}\n\nexport const Environments: Environment[] = [Environment.Workstation, Environment.Development, Environment.QA, Environment.Production]\ndeclare global {\n interface Window {\n pcEnv: Record<string, string>\n }\n}\n\nconst config = {\n api: getEnv('REACT_APP_API'),\n v3Api: getEnv('REACT_APP_V3_API'),\n renderer: getEnv('REACT_APP_RENDERER'),\n environment: getEnv('REACT_APP_ENV') as Environment,\n mapboxToken: getEnv('REACT_APP_MAPBOX_TOKEN'),\n build: getEnv('REACT_APP_UI_BUILD'),\n recaptchaKey: getEnv('REACT_APP_RECAPTCHA_KEY'),\n debugSentry: process.env.REACT_APP_SENTRY_DEBUG ? process.env.REACT_APP_SENTRY_DEBUG.toLowerCase() === 'true' : false,\n sessionKey: 'pc:admin:auth',\n filtersKey: 'pc:filters',\n languageKey: 'language',\n logLevel: 'all',\n // Triggers different Sentry logs.\n debugLogs: true,\n // Used to identify different iterations of filters so we can handle transitions\n filterVersionKey: 'pc:filters:version',\n filterVersionCurrent: '2',\n}\n\nfunction getEnv(envVar: string): string {\n let ret: string | undefined\n if (process.env.NODE_ENV !== 'production' && envVar === 'REACT_APP_MAPBOX_TOKEN') {\n ret = 'dummy_token'\n } else if (process.env.NODE_ENV !== 'production' && process.env[envVar]) {\n ret = process.env[envVar]\n } else if (window.pcEnv) {\n ret = window.pcEnv[envVar]\n }\n if (!ret) {\n throw new Error(`Missing environment variable: ${envVar}. Make sure you add environment variables to apps/admin/.env!`)\n }\n return ret\n}\n\nexport default config\n","import { Nullable } from '../types'\nimport config from '../config'\nimport * as Sentry from '@sentry/react'\n\nconst sentryTagStorageKey = 'localStorageKey'\n\nfunction getLocalStorage<T>(key: string): Nullable<T> {\n const item: string | null = window.localStorage.getItem(key)\n if (!item) return null\n\n try {\n const ret = JSON.parse(item)\n if (ret && typeof ret === 'object') {\n return ret\n }\n } catch (e) {}\n\n // Non-JSON objects just need to be returned as the generic type (a string)\n return (item as unknown) as T\n}\n\n// setLocalStorage sets data into local storage by the provided key.\n// It wraps the call to setItem with Sentry error handling, so it should be used whenever possible to set\n// local storage data.\nfunction setLocalStorage<T>(key: string, value: T) {\n try {\n if (typeof value === 'string') {\n window.localStorage.setItem(key, value)\n return\n }\n\n window.localStorage.setItem(key, JSON.stringify(value))\n } catch (e) {\n Sentry.withScope((scope) => {\n scope.setTag(sentryTagStorageKey, key)\n // We don't want to log session info, only filters and any other context\n if (key !== config.sessionKey) {\n scope.setContext('data', {\n value: value,\n })\n }\n Sentry.captureException(e)\n })\n console.warn('could not set data into local storage:', key, e)\n }\n}\n\nfunction removeLocalStorage(key: string) {\n window.localStorage.removeItem(key)\n}\n\nexport { removeLocalStorage, getLocalStorage, setLocalStorage }\n"],"names":["analyticsMiddleware","dispatch","getState","next","action","state","org","focusedOrgSelector","type","GET_ANALYTICS","apiRequest","url","trunkID","ID","dashboardType","method","feature","ANALYTICS","API_SUCCESS","setDocuments","totalCount","setSchema","label","analyticsTitleSelector","setAnalytics","payload","API_ERROR","setAnalyticsError","alwaysSkipFeatures","FieldActionType","VALIDATE","setSentryErrorData","scope","error","resp","getAxiosErrResponse","setContext","status","statusText","setTag","code","getPCErrorField","message","ctx","inputs","fault","API","config","api","cancel","doRequest","a","headers","params","responseType","validateStatus","Promise","reject","reqConfig","data","JSON","stringify","cancelToken","axios","CancelToken","c","indexOf","then","response","catch","reqType","isCancel","includes","Sentry","console","apiMiddleware","API_REQUEST","meta","resource","showLoader","authHeaderSelector","asOwnerOverride","apiError","hideLoader","apiSuccess","architectMiddleware","site","siteSelector","ArchitectActionType","GET_PAGES","sessionReadySelector","getSite","rendererRequest","siteID","setTimeout","getPages","RENDERER_SUCCESS","setPages","GET_SITE","setSite","getComponents","SET_PAGES","pages","currentPage","architectPageSelector","currentRouterLocationPageID","location","pageID","length","setPage","SET_PAGE","renderPage","RENDER_PAGE","matchSiteID","window","search","match","undefined","setHtml","html","RENDERER_ERROR","formatRenderError","GET_FORM","page","setForm","form","SUBMIT_FORM","body","REORDER_SECTION","sectionID","index","ADD_SECTION","DELETE_SECTION","GET_COMPONENTS","components","_","chain","categories","values","flatten","uniqBy","HID","sortBy","name","value","setComponents","PUBLISH_PAGE","autocompleteMiddleware","AutocompleteActionType","GET_AUTOCOMPLETE","field","autoComplete","textField","organizationID","doc","wipDocumentSelector","prefix","locale","GET_AUTOCOMPLETE_SUCCESS","autocomplete","referenceField","options","forEach","opt","push","OptionType","Organization","secondaryLabel","trunkOrganizationName","labelKey","ReferenceField","setAutoComplete","GET_ASSIGNMENTS","documentID","GET_ASSIGNMENTS_SUCCESS","setAssignments","createableSchemasMiddleware","GET_C_SCHEMAS","session","organization","C_SCHEMAS","setCreateableSchemas","resources","defaultDuplicator","source","schema","dupe","clone","duplicatedFromID","duplicatedFromLocaleID","localeID","hasStatus","find","fields","key","defaultValue","hasExternalID","externalID","hasSlug","slug","audit","customDuplicators","navbars","_schema","list","isMultiSetField","allPass","compose","v","pathOr","presentationKey","Array","isArray","propOr","setFieldValue","curry","path","fieldSchema","parentPath","dropLast","mapInstructions","set","oldDoc","view","lensPath","mappedFields","reduce","acc","curr","to","from","newDoc","merge","cloneDeep","setInstruction","setPath","getPath","documentMiddleware","user","userSelector","resourceSelector","category","categorySelector","schemaSelector","SET","oldWip","newWip","updateDocument","validateField","DocumentActionType","CLEAR","resetPagination","DELETE_ERROR","DENY_CHANGES_ERROR","DRAFT_ERROR","GET_ERROR","PUBLISH_CHANGES_ERROR","SAVE_ERROR","SAVE_USER_ERROR","SUBMIT_CHANGES_ERROR","GENERATE_SLUG_ERROR","setError","_inputs","CLOSE_TRANSLATOR","loadEditor","id","DELETE","DELETE_SUCCESS","loadList","hideModal","clearDocument","DENY_CHANGES","documentIDSelector","encodeURIComponent","denialReason","DENY_CHANGES_SUCCESS","DRAFT","moderate","DRAFT_SUCCESS","setDocument","GENERATE_SLUG","GET","duplicatedFrom","getDocument","GET_SUCCESS","document","duplicate","setDuplicate","translate","setTranslate","LOAD_TRANSLATOR","wip","PUBLISH_CHANGES","moderationApprove","PUBLISH_CHANGES_SUCCESS","SAVE","i18n","i18nSelector","saveDoc","SAVE_USER","isNewDoc","isActiveOrgCheck","original","isReactivateOrgCheck","showModalV2","title","ModalType","Confirm","SAVE_SUCCESS","isPlatformSetting","setSettings","SAVE_USER_SUCCESS","getLocalStorage","sessionKey","setLocalStorage","dispatchEvent","Event","SET_DUPLICATE","generateSlug","getSlugableField","duplicateSchema","isDuplicable","isDuplicableSchema","Error","customResourceDuplicator","duplicateResource","err","tags","SET_TRANSLATE","translatedFrom","duplicateWithLocaleID","translationSchema","SUBMIT_CHANGES","SUBMIT_CHANGES_SUCCESS","asArray","when","not","is","always","getFieldValue","enums","or","ifElse","gt","obj","e","digestEnumValues","mapObjIndexed","val","f","getValue","hasFields","lt","cond","and","map","Object","T","digestDocumentsForList","documents","createURL","module","moduleSelector","endpoint","noMultiContext","focusedOrg","buildParams","targetSchema","schemas","pattern","slice","replace","replacePathVariables","contexts","urlBuilder","selectAPIFilters","filter","filterValue","join","filterObj","fieldPath","buildFilters","selectFilters","selected","presentation","sel","range","DateOptionRangeType","From","To","valAcc","valCurr","isEnumOption","addAppliedFilters","searchText","searchTextSelector","addSearch","limit","limitSelector","skip","skipSelector","scopeSelector","Scope","All","includeDescendants","IncludeDescendants","addOrg","sort","sortSelector","column","hasOwnProperty","direction","listableFields","getListableFields","defaultListConfig","defaultDirection","addSort","docsMiddleware","DocumentsActionType","GET_DOCUMENTS","setSchemaCategory","selectLocationType","LEADS_LIST","getV3Leads","DOCS","UPDATE_DOCUMENTS","SET_SCOPE","getDocuments","PaginationActionType","SET_LIMIT","NEXT_PAGE","PREV_PAGE","updateDocumentList","getCreateableSchemas","exportMiddleware","EXPORT_DOCS","export","EXPORT","filename","fs","saveAs","fieldMiddleware","orgID","VALIDATE_SUCCESS","primitive","errs","setDocumentError","every","isEmpty","VALIDATE_ERROR","filtersMiddleware","handleV3Leads","mockV3LeadsSchema","getV3LeadsMockSchema","selectLeadStatusEnums","selectLeadTypeEnums","selectLeadStageEnums","selectFilterOptionStringsByKey","selectLeadStatusToStageSetting","newV3LeadsSchema","createV3LeadsAPISchemaFromMock","selecti18n","updatedSchemas","V3LeadsCategory","setSchemas","FiltersActionType","getV3LeadAPIFiltersFromMockSchema","TRIGGER_DETAILS","TRIGGERS_LIST","LEAD_DETAILS","selectV3EnabledSetting","filterFragment","setFilters","UPDATE","allowAll","allowAllNonProd","flags","architect","users","internal","domains","cssFramework","localeSwitcher","environments","Environments","languageToggle","ruleAdmins","ruleDevs","env","Environment","Production","flagsMiddleware","FlagActionTypes","CALCULATE_FLAGS","environment","ret","entries","matches","email","domain","endsWith","doesMatch","keys","calculateFlags","defaultFlags","setFlags","importLanguageJSON","default","warn","i18nMiddleware","i18nActionTypes","SET_LOCALE","reload","membershipsMiddleware","GET_MEMBERSHIPS","MEMBERSHIPS","setMemberships","memberships","orgsMiddelware","GET_ORGS","ORGS","setOrgs","reloadToLogin","removeLocalStorage","sessionMiddleware","SessionActionTypes","LOGIN","SET_FOCUSED_ORG","CLEAR_SESSION","SET_SESSION","LOGOUT","APPLY_CONTEXT","APPLY_CONTEXT_SUCCESS","SESSION","setSession","setLoginError","_message","pathname","clearSession","getV3Schemas","getV3OrgHierarchy","getContentConfigs","getLeadTypes","setFiltersOnOrgSwitch","getMemberships","username","fullName","role","roleSelector","additionalContext","trunkName","renderMenu","pagesMiddleware","sessionValid","isValidSession","publicPage","isPublicPage","isPageAction","setRedirect","unsetCategory","LOGIN_PAGE","HOME_PAGE","loadDefaultPage","defaultSchemaSelector","getV3Lead","clearDocuments","loadLeadsList","query","clearSearch","readyForV3Filters","shouldUpdateFilters","getFilters","setCategory","LIST_PAGE","isCategoryAvailableSelector","clearSort","EDITOR_PAGE","wipIsCurrent","mode","EditorMode","DUPLICATE","TRANSLATE","ACCOUNT_PAGE","ANALYTICS_PAGE","analyticsTypeEnabled","settings","analyticsSettingsSelector","schemaIsAvailable","enableSiteAnalytics","enableAnalytics","enableCampaignAnalytics","getAnalytics","ARCHITECT_APP","siteIDSelector","OLD_SB_ROUTE","loadArchitect","isPlatform","PlatformSystem","setTriggerScope","getTriggerList","selectContentConfigs","triggerTitleSelector","getTriggerDetail","passwordMiddleware","SAVE_PASSWORD","PASSWORD","clearPasswordResetError","setPasswordResetError","rendererMiddleware","store","RENDERER_REQUEST","fullUrl","renderer","rendererError","rendererSuccess","parseModules","groups","group","items","isAllowed","item","Boolean","dup","i","firstKey","get","sortOrder","normalizeGroupShape","schemasMiddleware","GET_SCHEMAS","SCHEMAS","GET_SCHEMAS_SUCCESS","loadHome","RENDER_MENU","menu","menuItems","weblink","isArchitectUser","flagSelector","canViewRulesAdmin","selectAnyFlag","membershipSelector","unshift","concat","appendMenuItems","setMenu","delayedRefetch","debounce","searchMiddleware","SearchActionType","setSkip","refetch","delayed","settingsMiddleware","SettingsActionTypes","GET_SETTINGS","SETTINGS","SET_SETTINGS","enableV3","GET_SETTINGS_SUCCESS","sortMiddleware","SortActionType","storageMiddleware","SET_LOCAL_STORAGE","tagsMiddleware","GET_TAGS","getReportPayload","files","promise","localeCode","resolve","translationsMiddleware","TranslationsActionType","GENERATE_UI_REPORT","selectAvailableLocales","language","GENERATE_SCHEMA_REPORT","GENERATE_ERROR_REPORT","GENERATE_SCHEMA_REPORT_ERROR","GENERATE_UI_REPORT_ERROR","GENERATE_ERROR_REPORT_ERROR","GENERATE_SCHEMA_REPORT_SUCCESS","GENERATE_UI_REPORT_SUCCESS","GENERATE_ERROR_REPORT_SUCCESS","filenamePrefix","blob","Blob","triggersMiddleware","validateTriggerField","trim","Number","isNaN","trigger","triggerSelector","Conditions","dataKey","cVal","secondaryMessage","setTriggerEditorError","Content","URL","cacheActions","CachedActionIDs","cachedActionsSelector","act","v3Api","TriggerActionType","GET_CACHED_ACTIONS","getV3DefaultOwnerID","LIST_GET","LIST_GET_SUCCESS","setTriggers","setTriggerError","DETAIL_GET","_preload","ownerID","IDFromV2","ResourceType","ResourceTypeType","LeadsCreated","Name","Type","TriggerType","LeadCreatedTrigger","Status","EffectiveDate","Date","toISOString","OwnerID","Actions","defaultTriggerActionsByType","DETAIL_GET_SUCCESS","deserialized","deserializeTriggerCondition","conditionsFromConditionDeps","setTrigger","unsetTriggerEditorError","SAVE_TRIGGER","hasError","LeadRemindersTrigger","fieldErr","condition","serialized","serializeTriggerCondition","createTrigger","triggerScopeSelector","SAVE_TRIGGER_SUCCESS","updatedTrigger","stateTrigger","loadTriggerDetail","DELETE_TRIGGER","DELETE_TRIGGER_SUCCESS","loadTriggersList","DELETE_TRIGGER_ERROR","UPDATE_TRIGGER","updatedValue","fieldKey","primaryField","substring","conditions","conditionValue","uiMiddleware","CREATE_NOTIFICATION","clearNotification","v3LeadsMiddleware","V3LeadActionTypes","GET_LEADS","v3LeadQueryRequestConfigSelector","GET_LEAD","payloadID","SAVE_LEAD","diff","selectPartialV3LeadForPatch","GET_LEADS_SUCCESS","total","leads","marshalQueriedLeadsToLeads","setV3Leads","GET_LEAD_SUCCESS","setV3Lead","getLeadName","SAVE_LEAD_SUCCESS","RELOAD_LEAD","reloadV3Lead","RELOAD_LEAD_SUCCESS","GET_LEAD_ERROR","GET_CONTENT_CONFIGS","GET_CONTENT_CONFIGS_SUCCESS","setV3ContentConfigs","GET_LEAD_TYPES","GET_LEAD_TYPES_SUCCESS","setV3LeadTypes","EXPORT_LEADS","EXPORT_LEADS_SUCCESS","getTime","v3OrganizationsMiddleware","V3OrganizationActionTypes","GET_ORGANIZATIONS","GET_ORGANIZATION","GET_ORG_HIERARCHY","getV3Organization","GET_DOWNSTREAM_ORGS","GET_UPSTREAM_ORGS","setV3Organizations","setV3Organization","TrunkID","getV3UpstreamOrgs","getV3DownstreamOrgs","deduplicateEnumsByValue","inputArray","accumulator","currentValue","enumToOptionEnum","Enum","errData","getAxiosErrData","underscored","nonunderscored","isAxiosError","errResp","deleteDocument","denyChanges","draftDocument","publishChanges","saveDocument","ERROR","submitChanges","UPDATE_DOCUMENT","pcTitle","getResourceTitle","TextJSON","Text","props","input","React","createRef","uniqueFieldId","jsonEditor","handleInputBlur","current","onBlur","handleInputFocus","setState","isFocused","handleTextInput","event","currentTarget","onValue","handleJSONBlur","handleJSONInput","_event","handleJSONErr","_value","focusJSONEditor","focus","onChange","onInput","renderField","renderJSONInput","renderTextInput","disabled","placeholder","presentationOptions","readOnly","requireValidJSON","className","ref","onFocus","onError","clearIcon","leftIcon","maxLength","rightIcon","symbol","testID","onClick","onKeyDown","onLeftIconClick","onRightIconClick","isControlled","isObject","dataCI","renderIcon","renderSymbol","genCIAttr","icon","clearInput","tabIndex","renderText","htmlFor","renderMessage","dataCIKey","renderModerationMessage","modifiedBy","modifiedAt","formatModifiedByMessage","uniqueId","this","required","classList","Component","getDerivedStateFromProps","nextState","propsValue","stateValue","base","modifier","isoDateSanitize","time","isoDateParserLocalized","sanitizedTime","t","parseISO","template","format","nearRelativeDateParser","isToday","isYesterday","getStoredFilters","filterVersion","filterVersionKey","filterVersionCurrent","filtersFromLocalStorage","filtersKey","getStoredResourceFiltersForOrg","orgFilters","resourceFilters","setStoredResourceFiltersForOrg","filters","localStorageFilters","resetDateFilters","some","isDateOption","getDefaultFilterDateRange","today","setHours","oneMonthAgo","setMonth","getMonth","toImgixURL","updateSort","columnName","prefersDarkMode","matchMedia","getUserName","preferredName","defaultID","deduplicateV3Orgs","b","findIndex","scopeHeadersSelector","ownerScope","asOwner","Focused","ActionType","FieldPrimitive","date","d","toLocaleDateString","toLocaleTimeString","hour","minute","localeGroup","restrictions","enumerable","SET_DOCUMENTS","setScope","setField","skipValidation","PAGE","SECURITY_PAGE","FORGOT_PASSWORD","RESET_PASSWORD","loadEditorNew","loadTranslator","loadDuplicator","loadAccount","loadSecurity","setLocale","listableFieldsSelector","shouldModerateSelector","shouldModerate","modifiedCountSelector","modifiedCount","pendingApprovalSelector","fieldSchemaSelector","createSelector","SET_ORGS","getOrgsByName","orgs","actions","DefaultLeadReminderEmail","newWebhookAction","defaultTriggerConditionsByType","newUIConditionFromConditionType","TriggerConditionType","StatusInOrNotIn","DaysInStatus","TriggerCountLimit","DaysBetweenReminders","NotifyParentOrgs","resourceTypeByTriggerType","Map","LeadReassignedTrigger","LeadModifiedTrigger","LeadsModified","dataKeyByConditionType","helpText","operator","operatorByConditionType","defaultValueByConditionType","CreatedBeforeOrAfter","CreatedAtElapsed","ViewCount","Operator","In","GreaterThanOrEqual","LessThan","getValueByConditionType","String","Required","WebhookHTTPAction","Description","ExplicitAccessList","ApplyToTree","needsUpdate","currVal","forceDisabled","Loading","useI18nSelector","classes","fullScreen","connect","exportDocs","setSearch","text","SHOW_MODAL","SHOW_MODAL_V2","HIDE_MODAL","SHOW_LOADER","HIDE_LOADER","CLEAR_NOTIFICATION","entity","createNotification","notification","showModal","buttons","callback","modalProps","V3OrganizationsSelector","v3Organizations","organizations","selectActiveV3Orgs","toLowerCase","FieldMessage","getAutoComplete","SET_AUTOCOMPLETE","getAssignments","assignments","SET_ASSIGNMENTS","token","authorizationToken","localeSelector","Authorization","OrganizationID","hasToken","hasSchemas","authorizationTokenExpiration","passwordResetErrorSelector","context","setSort","analyticsEnabledSelector","analyticsSettings","siteAnalyticsEnabledSelector","campaignAnalyticsEnabledSelector","locatorAnalyticsEnabledSelector","enableLocatorAnalytics","focalPointEnabledSelector","enableFocalPoint","mapBoxEnabledSelector","resourceSettings","useMapBox","primaryLocaleSelector","primaryLocale","settingsSelector","leadStatusToStage","arrayHasLength","isEmptyArray","complement","hasNestedFields","prop","hasEmptyFields","getSortOrder","sortBySortOrder","filterByListType","listType","filterField","any","listConfig","getListConfig","showOnNested","buildEnums","getListFields","predicateFn","ignoreNested","nested","doubleNested","dnf","getListableNestedFields","isOption","isOrganizationOption","isReferenceFieldOption","isScopeOption","nextPage","prevPage","setPaginationPage","skipCount","SET_SKIP","setLimit","setTotal","SET_TOTAL","RESET_PAGINATION","RouteActionType","CategorySet","CategoryUnset","exports","initialI18nState","translations","enUS","availableLocales","i18nReducer","languageKey","SET_TRANSLATIONS","deduplicateContentConfigs","getLeadStatusEnums","contentConfigs","trimDefaults","configuredEnums","defaults","getLeadStageEnums","getLocalizedDefaultLeadStageOptions","spacing","num1","num2","getRootScssFn","scss","varName","theme","getRootScss","createMuiTheme","palette","primary","main","light","secondary","background","paper","divider","architectDrawer","listItemOver","tableBandedBackground","typography","fontFamily","MuiIconButton","color","overrides","MuiList","padding","paddingTop","paddingBottom","MuiInputBase","root","border","borderRadius","cursor","backgroundColor","borderColor","borderBottom","MuiOutlinedInput","notchedOutline","MuiTable","borderSpacing","MuiTableRow","MuiTableCell","MuiTablePagination","display","justifyContent","MuiSelect","select","MuiButton","textTransform","contained","MuiFormLabel","asterisk","fontSize","content","getTheme","userSettings","darkRootScss","rootScss","defaultIfEmpty","defaultTo","Select","component","handleOffClick","showOptions","contains","target","close","handleFieldClick","stopPropagation","onClose","handleFieldKeyDown","handleOptionSelect","shouldStayOpen","multiple","fieldID","selectedText","selection","textClass","renderOptions","renderLabel","getFieldKey","now","hideLabel","onSelect","render","focusedFilter","addEventListener","removeEventListener","nextProps","prevState","isEqual","formatLocalTime","timestamp","day","month","year","i18nString","variableName","variableValue","RegExp","variable","isArrayEqual","aKeys","getOwnPropertyNames","bKeys","isObjectEqual","isValueEqual","emptyOrNil","anyPass","isNil","notEmptyOrNil","callIfExists","pickBy","createBrowserHistory","fn","uuid","performance","r","Math","random","floor","toString","autocompleteSelector","selectAssignmentOptions","assignmentsSelector","showModalSelector","ui","modalSelector","modal","modalCallbackSelector","modalCallback","loadingSelector","loaders","notificationSelector","v2ModalSelector","unsavedChangesSelector","documentErrorSelector","errors","documentPageTitleSelector","_code","documentWipIDSelector","fieldValueSelector","fieldErrorSelector","setInstructions","setInstructionErr","_err","documentActionSelector","pendingApproval","canBeDuplicated","userCanDuplicate","allowDuplication","originalDocumentSelector","canBeDuplicatedSelector","isImmutable","documentErrorCountSelector","getErrCount","omitNullish","sum","omitted","updateTrigger","saveTrigger","initialLoad","SET_TRIGGER","triggers","SET_TRIGGERS","deleteTriggerDetail","SET_TRIGGER_ERROR","SET_EDITOR_ERROR","UNSET_EDITOR_ERROR","productKeys","lead","DisplayName","ln","getLeadBrandName","v3Orgs","brandName","trunk","qls","ql","CreatedAt","createdAt","UpdatedAt","updatedAt","TypeLabel","typeLabel","TypeKey","typeKey","Stage","stage","IsTestLead","isTestLead","displayName","orgName","TrunkName","marshalQueriedLeadToLead","convertLeadTypesToEnums","leadTypes","getLeadStatusLabel","statusOptions","getStatusOrStageLabel","getLeadStageLabel","stageOptions","isStage","i18nNamespace","i18nLabel","statusOrStageFromOptions","op","v3","fill","split","pageLoadTime","lastPageChange","trackPageView","PCTracking","ready","client","recordEvent","trackEvent","trackingData","platformSettings","loadId","helpers","getUniqueId","browserProfile","getBrowserProfile","timeOnPageMs","app","build","local_time_full","featureFlags","full","href","host","hostname","qs","tech","profile","load_id","description","time_on_page","round","time_on_page_ms","time_since_first_load","SET_C_SCHEMAS","cSchemas","SET_FLAGS","SET_MEMBERSHIPS","userID","SET_MENU","createableSchemasSelector","createableSchemas","flag","menuSelector","parseCategories","ac","cur","cat","catKey","isLocalhost","register","navigator","process","origin","swUrl","fetch","contentType","serviceWorker","registration","unregister","registerValidSW","info","checkValidServiceWorker","onupdatefound","installingWorker","installing","onstatechange","controller","onUpdate","onSuccess","RefreshToast","useState","updateAvailable","setUpdateAvailable","waitingWorker","setWaitingWorker","toastButton","closeToast","Button","variant","postMessage","updateServiceWorker","onServiceWorkerUpdate","waiting","useEffect","toast","toastId","closeOnClick","autoClose","position","closeButton","ActivityType","warnOnce","localeValue","currentLocale","warnKey","isSelectFilterField","isDateFilterField","RuleEngineActionType","RuleEngineTriggerFlag","RuleEngineTriggerType","RuleStatusType","SET_ANALYTICS","ERROR_ANALYTICS","analytics","forms","siteSettings","SET_HTML","SET_SITE","getForm","getComponentSettings","areaID","componentHID","getPageSettings","addPage","editSection","placeComponent","SET_FORM","submitForm","reorderSection","toggleViewport","showMobile","TOGGLE_VIEWPORT","addSection","deleteSection","SET_COMPONENTS","publishPage","SET_FOCUSED_ORG_FILTERS","updateFilter","multiSelect","updateFocusedFilter","UPDATE_FOCUSED_FILTER","savePassword","password","passwordConfirm","SchemaActionType","Set","SetCategory","SET_SCHEMAS","setFocusedOrg","logout","SET_LOGIN_ERROR","SET_PASSWORD_RESET_ERROR","redirectAction","SET_REDIRECT","SET_CONTEXT","generateUiReport","generateSchemaReport","generateErrorReport","SET_LEAD","SET_LEADS","updateV3Lead","UPDATE_LEAD","saveV3Lead","SET_CONTENT_CONFIGS","SET_LEAD_TYPES","exportLeads","SET_ORGANIZATIONS","SET_ORGANIZATION","defaultStyle","margin","width","JSONEditor","editor","onLoad","onValidate","annotations","firstErr","annotation","row","style","styles","showPrintMargin","showGutter","maxLines","Infinity","highlightActiveLine","setOptions","useWorker","showLineNumbers","tabSize","highlightSelectedWord","Options","isIdentical","option1","option2","findOptionIndex","option","array","handleOptionClick","selectOption","handleOptionKeyDown","selectedValues","selectionIndex","splice","optionItems","optionKey","optionClass","secondaryText","withStyles","_theme","opacity","sections","s","arrCopy","msg","Message","btoa","statusEnums","leadTypeEnums","stageEnumDefaults","currentStages","currentStatusesAvailableEnums","getStatusEnumMappingState","createV3FieldMock","filterConfig","isFilter","singleSelect","defaultValues","additionalOptions","currentStatusValues","stageSelections","statusFromStageMappings","mapping","validStatusMappings","cs","I18nStateContext","createContext","I18nDispatchContext","I18nProvider","children","useReducer","words","Provider","useI18nState","useContext","useI18nDispatch","useAvailableLocaleOptions","analyticsSelector","translation","pagesSelector","defaultPage","p","htmlSelector","sectionsSelector","formSelector","str","decodeURIComponent","atob","charCodeAt","mobileViewportSelector","mobileViewport","componentsSelector","componentNameSelector","componentMap","documentListSelector","countSelector","count","apiFilters","focusedFilterSelector","locationType","currentCategory","route","selectPrevCategory","selectPrevLocationType","v3Leads","loaded","selectFilterOptionsByKey","useDefaults","defaultSelected","selectFilterOptionBoolsByKey","selectDateRangeFilterOptionValuesByKey","lessThan","greaterThan","cr","selectSelectedFilterOptionStringsByKeyClean","selectedOptions","defaultOptions","def","selectSelectedFilterOptionBoolsByKeyClean","organizationsSelector","publicPages","pageSelector","actionType","hasNextPageSelector","documentCount","nextSkip","pagination","pagePaginationSelector","localStorageSelector","localStorage","getItem","userThemeSelector","v3LeadsListSelector","v3LeadSelector","selectInitialV3Lead","initialLead","validFields","patchable","noteDiff","differenceWith","selectLeadTypes","v3LeadSortSelector","selectUnsavedV3LeadChanges","sortParts","URLSearchParams","sortField","sortDirection","dateLT","dateGT","orgScope","offset","createdAtStart","createdAtEnd","webpackAsyncContext","req","__webpack_require__","o","ids","all","AuthActionTypes","getLoginError","loginErr","errMsg","pcMsg","Reset","Forgot","LoginErrorMessage","RootLogin","propsEmail","propsError","setEmail","setPassword","initErr","history","useHistory","i18nDispatch","useLocation","logoClasses","TextField","opts","disableElevation","preventDefault","Login","res","dangerouslySetInnerHTML","__html","LoginHelpButton","link","rel","ForgotPassword","sent","setSent","handleSubmit","ResetPassword","setPasswordConfirm","success","setSuccess","tokenErr","handleKeyDown","json","OneClickAction","recaptcha","useParams","leadID","result","parse","loading","setLoading","enterprise","execute","recaptchaKey","recaptcha_response","ocaMeta","MobileRoot","lazy","V1Root","AppRoot","setRecaptcha","grecaptcha","script","createElement","src","async","head","appendChild","removeChild","mobileView","useMediaQuery","preferDark","themeReload","setThemeReload","toggleTheme","prev","userTheme","setUserTheme","newTheme","localSession","ThemeProvider","PageChangeTracker","ResetPasswordRoute","LoginRoute","exact","DefaultAppRoute","setPlatformSettings","innerWidth","pendo","initialize","visitor","full_name","account","shouldShowMobile","fallback","fetchPlatformSettings","consoleErr","en","dsn","debug","debugSentry","release","SENTRY_RELEASE","integrations","beforeSend","request","top","self","REACT_APP_RUN_IN_STRICT_MODE","ReactDOM","StrictMode","getElementById","useStyles","makeStyles","createStyles","arrow","minWidth","progress","bottom","open","setOpen","anchorRef","useRef","rest","handleClose","prevOpen","buttontext","anchorEl","transition","disablePortal","TransitionProps","placement","transformOrigin","onClickAway","clsx","triggerErrorSelector","triggerError","selectTriggerEditorErrors","editorErrors","selectTriggerEditorErrorsCount","selectTriggerFieldHasError","cachedActions","selectTriggerOrgOptions","selectTriggerOwnerName","ownerOrg","selectTriggerRuleTypeOptions","selectHumanizedTriggerRuleType","selectTriggerStatusOptions","active","inactive","selectLeadStatusesAsCheckboxOptions","selectActionOptions","selectTriggerCountLimitOptions","pathnameSelector","configs","selectLeadStatusOptions","selectLeadStageOptions","Workstation","Development","QA","getEnv","mapboxToken","REACT_APP_SENTRY_DEBUG","logLevel","debugLogs","envVar","pcEnv","setItem","removeItem"],"mappings":";;8FAAA,+n1B,2mCCMaA,EAAkC,SAAC,GAAD,IAAGC,EAAH,EAAGA,SAAUC,EAAb,EAAaA,SAAb,OAA4B,SAACC,GAAD,OAAU,SAACC,GACpFD,EAAKC,GAEL,IAAMC,EAAQH,IACRI,EAAMC,YAAmBF,GAE/B,OAAQD,EAAOI,MACb,KAAKC,gBACHR,EACES,qBAAW,CACTC,IAAI,kBAAD,cAAoBL,QAApB,IAAoBA,OAApB,EAAoBA,EAAKM,QAAzB,mBAAoCN,QAApC,IAAoCA,OAApC,EAAoCA,EAAKO,GAAzC,sBAAyDT,EAAOU,eACnEC,OAAQ,MACRC,QAASC,eAGb,MAEF,IAAI,GAAJ,OAAQA,YAAR,YAAqBC,eAEnBjB,EACEkB,uBAAc,CACZC,YAAa,KAIjBnB,EACEoB,oBAAU,CACRC,MAAOC,YAAuBlB,MAGlCJ,EAASuB,uBAAapB,EAAOqB,UAC7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