Skip to content

Commit

Permalink
Merge pull request #874 from jetstreamapp/chore/move-core-to-shared-1
Browse files Browse the repository at this point in the history
Move core code to shared library
  • Loading branch information
paustint authored May 4, 2024
2 parents 7ba42a3 + 4707d3a commit b46c1f4
Show file tree
Hide file tree
Showing 218 changed files with 1,648 additions and 63,209 deletions.
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"eamodio.gitlens",
"ms-playwright.playwright",
"wayou.vscode-todo-highlight",
"orta.vscode-jest"
"orta.vscode-jest",
"firsttris.vscode-jest-runner"
]
}
3 changes: 1 addition & 2 deletions apps/jetstream/src/app/app.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Maybe, UserProfileUi } from '@jetstream/types';
import { AppToast, ConfirmationServiceProvider } from '@jetstream/ui';
// import { initSocket } from '@jetstream/shared/data';
import { DownloadFileStream, ErrorBoundaryFallback } from '@jetstream/ui-core';
import { OverlayProvider } from '@react-aria/overlays';
import { Suspense, useEffect, useState } from 'react';
import { DndProvider } from 'react-dnd';
Expand All @@ -13,8 +14,6 @@ import { AppRoutes } from './AppRoutes';
import AppInitializer from './components/core/AppInitializer';
import AppLoading from './components/core/AppLoading';
import AppStateResetOnOrgChange from './components/core/AppStateResetOnOrgChange';
import { DownloadFileStream } from './components/core/DownloadFileStream';
import ErrorBoundaryFallback from './components/core/ErrorBoundaryFallback';
import HeaderNavbar from './components/core/HeaderNavbar';
import LogInitializer from './components/core/LogInitializer';
import NotificationsRequestModal from './components/core/NotificationsRequestModal';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ import {
ViewDocsLink,
getModifierKey,
} from '@jetstream/ui';
import { STORAGE_KEYS, applicationCookieState, selectSkipFrontdoorAuth, selectedOrgState } from '@jetstream/ui-core';
import { useAmplitude } from '@jetstream/ui-core';
import Editor, { OnMount, useMonaco } from '@monaco-editor/react';
import localforage from 'localforage';
import escapeRegExp from 'lodash/escapeRegExp';
import type { editor } from 'monaco-editor';
import { Fragment, FunctionComponent, MouseEvent, useCallback, useEffect, useRef, useState } from 'react';
import { useRecoilState, useRecoilValue } from 'recoil';
import { STORAGE_KEYS, applicationCookieState, selectSkipFrontdoorAuth, selectedOrgState } from '../../app-state';
import { useAmplitude } from '../core/analytics';
import AnonymousApexFilter from './AnonymousApexFilter';
import AnonymousApexHistory from './AnonymousApexHistory';
import * as fromApexState from './apex.state';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { logger } from '@jetstream/shared/client-logger';
import { DATE_FORMATS, INDEXED_DB } from '@jetstream/shared/constants';
import { groupByFlat, hashString, pluralizeFromNumber, truncate } from '@jetstream/shared/utils';
import { ApexHistoryItem, SalesforceOrgUi } from '@jetstream/types';
import { selectedOrgState } from '@jetstream/ui-core';
import { addDays } from 'date-fns/addDays';
import { formatDate } from 'date-fns/format';
import { isBefore } from 'date-fns/isBefore';
import { startOfDay } from 'date-fns/startOfDay';
import localforage from 'localforage';
import orderBy from 'lodash/orderBy';
import { atom, selector } from 'recoil';
import * as fromAppState from '../../app-state';

let didRunCleanup = false;

Expand Down Expand Up @@ -110,7 +110,7 @@ const selectApexHistoryItems = selector({
get: ({ get }) => {
const whichOrg = get(apexHistoryWhichOrg);
const apexHistoryItems = get(apexHistoryState);
const selectedOrg = get(fromAppState.selectedOrgState);
const selectedOrg = get(selectedOrgState);
if (!selectedOrg || !apexHistoryItems) {
return [];
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { TITLES } from '@jetstream/shared/constants';
import { useTitle } from '@jetstream/shared/ui-utils';
import { selectedOrgState } from '@jetstream/ui-core';
import { Fragment, FunctionComponent, useEffect } from 'react';
import { Navigate, Outlet, useLocation, useNavigate } from 'react-router-dom';
import { useRecoilState, useRecoilValue, useResetRecoilState } from 'recoil';
import { selectedOrgState } from '../../app-state';
import * as fromAutomationCtlState from './automation-control.state';

// eslint-disable-next-line @typescript-eslint/no-empty-interface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@ import {
ToolbarItemGroup,
Tooltip,
} from '@jetstream/ui';
import { applicationCookieState, fromJetstreamEvents, selectSkipFrontdoorAuth, selectedOrgState } from '@jetstream/ui-core';
import classNames from 'classnames';
import { FunctionComponent, useState } from 'react';
import { Link } from 'react-router-dom';
import { useRecoilValue } from 'recoil';
import { applicationCookieState, selectSkipFrontdoorAuth, selectedOrgState } from '../../app-state';
import { useAmplitude } from '@jetstream/ui-core';
import { RequireMetadataApiBanner } from '../core/RequireMetadataApiBanner';
import { useAmplitude } from '../core/analytics';
import * as fromJetstreamEvents from '../core/jetstream-events';
import AutomationControlEditorReviewModal from './AutomationControlEditorReviewModal';
import AutomationControlEditorTable from './AutomationControlEditorTable';
import AutomationControlLastRefreshedPopover from './AutomationControlLastRefreshedPopover';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import { logger } from '@jetstream/shared/client-logger';
import { ANALYTICS_KEYS } from '@jetstream/shared/constants';
import { SalesforceOrgUi } from '@jetstream/types';
import { AutoFullHeightContainer, DataTable, Icon, Modal, Spinner } from '@jetstream/ui';
import { ConfirmPageChange, useAmplitude } from '@jetstream/ui-core';
import { Fragment, FunctionComponent, useCallback, useEffect, useMemo, useState } from 'react';
import { Column } from 'react-data-grid';
import ConfirmPageChange from '../core/ConfirmPageChange';
import { useAmplitude } from '../core/analytics';
import { deployMetadata, getAutomationTypeLabel, preparePayloads } from './automation-control-data-utils';
import { AutomationDeployStatusRenderer, BooleanAndVersionRenderer } from './automation-control-table-renderers';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import {
PageHeaderRow,
PageHeaderTitle,
} from '@jetstream/ui';
import { selectedOrgState } from '@jetstream/ui-core';
import { FunctionComponent } from 'react';
import { Link } from 'react-router-dom';
import { useRecoilState, useRecoilValue } from 'recoil';
import { selectedOrgState } from '../../app-state';
import { RequireMetadataApiBanner } from '../core/RequireMetadataApiBanner';
import { AutomationMetadataType } from './automation-control-types';
import * as fromAutomationCtlState from './automation-control.state';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ANALYTICS_KEYS } from '@jetstream/shared/constants';
import { useRollbar } from '@jetstream/shared/ui-utils';
import { SalesforceOrgUi } from '@jetstream/types';
import { useCallback, useEffect, useReducer, useRef } from 'react';
import { useAmplitude } from '../core/analytics';
import { useAmplitude } from '@jetstream/ui-core';
import {
fetchAutomationData,
getAdditionalItemsWorkflowRuleText,
Expand Down
3 changes: 1 addition & 2 deletions apps/jetstream/src/app/components/core/AppInitializer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ import { HTTP } from '@jetstream/shared/constants';
import { checkHeartbeat, registerMiddleware } from '@jetstream/shared/data';
import { useObservable, useRollbar } from '@jetstream/shared/ui-utils';
import { ApplicationCookie, SalesforceOrgUi, UserProfileUi } from '@jetstream/types';
import { fromAppState, useAmplitude, usePageViews } from '@jetstream/ui-core';
import { AxiosResponse } from 'axios';
import localforage from 'localforage';
import React, { Fragment, FunctionComponent, useCallback, useEffect } from 'react';
import { useRecoilState, useRecoilValue } from 'recoil';
import { Subject } from 'rxjs';
import { environment } from '../../../environments/environment';
import * as fromAppState from '../../app-state';
import { useAmplitude, usePageViews } from './analytics';

const orgConnectionError = new Subject<{ uniqueId: string; connectionError: string }>();
const orgConnectionError$ = orgConnectionError.asObservable();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SalesforceOrgUi } from '@jetstream/types';
import { fromAppState } from '@jetstream/ui-core';
import { FunctionComponent, useEffect, useState } from 'react';
import { Resetter, useRecoilValue, useResetRecoilState } from 'recoil';
import * as fromAppState from '../../app-state';
import * as fromAutomationControlState from '../automation-control/automation-control.state';
import * as fromDeployMetadataState from '../deploy/deploy-metadata.state';
import * as fromFormulaState from '../formula-evaluator/formula-evaluator.state';
Expand Down
13 changes: 8 additions & 5 deletions apps/jetstream/src/app/components/core/HeaderNavbar.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import { DropDownItem, Maybe, UserProfileUi } from '@jetstream/types';
import { Header, Navbar, NavbarItem, NavbarMenuItems } from '@jetstream/ui';
import {
HeaderDonatePopover,
HeaderHelpPopover,
Jobs,
RecordSearchPopover,
applicationCookieState,
selectUserPreferenceState,
} from '@jetstream/ui-core';
import { Fragment, FunctionComponent, useEffect, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { useRecoilState, useRecoilValue } from 'recoil';
import Logo from '../../../assets/images/jetstream-logo-v1-200w.png';
import { applicationCookieState, selectUserPreferenceState } from '../../app-state';
import OrgsDropdown from '../orgs/OrgsDropdown';
import HeaderDonatePopover from './HeaderDonatePopover';
import HeaderHelpPopover from './HeaderHelpPopover';
import NotificationsRequestModal from './NotificationsRequestModal';
import { APP_ROUTES } from './app-routes';
import Jobs from './jobs/Jobs';
import { RecordSearchPopover } from './record-lookup/RecordSearchPopover';

export interface HeaderNavbarProps {
userProfile: Maybe<UserProfileUi>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ANALYTICS_KEYS, FEATURE_FLAGS } from '@jetstream/shared/constants';
import { hasFeatureFlagAccess } from '@jetstream/shared/ui-utils';
import { DockedComposer, DockedComposerRef } from '@jetstream/ui';
import { useUserPreferenceState } from '@jetstream/ui-core';
import { Fragment, FunctionComponent, useEffect, useRef, useState } from 'react';
import { useUserPreferenceState } from '../../app-state';
import { useAmplitude } from '../core/analytics';
import { useAmplitude } from '@jetstream/ui-core';
import NotificationExampleImage from './jetstream-sample-notification.png';

export interface NotificationsRequestModalProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { useRecoilValue } from 'recoil';
import * as fromAppState from '../../app-state';
import { useOrgPermissions } from '../orgs/useOrgPermissions';
import { useState } from 'react';
import { Alert } from '@jetstream/ui';
import { fromAppState, useOrgPermissions } from '@jetstream/ui-core';
import { useState } from 'react';
import { useRecoilValue } from 'recoil';

interface RequireMetadataApiBannerProps {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import {
ToolbarItemGroup,
Tooltip,
} from '@jetstream/ui';
import { selectedOrgState } from '@jetstream/ui-core';
import { FunctionComponent, useCallback, useState } from 'react';
import { Link } from 'react-router-dom';
import { useRecoilValue, useResetRecoilState } from 'recoil';
import { selectedOrgState } from '../../app-state';
import { useAmplitude } from '@jetstream/ui-core';
import { RequireMetadataApiBanner } from '../core/RequireMetadataApiBanner';
import { useAmplitude } from '../core/analytics';
import CreateFieldsDeployModal from './CreateFieldsDeployModal';
import CreateFieldsImportExport from './CreateFieldsImportExport';
import CreateFieldsRow from './CreateFieldsRow';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ import { ANALYTICS_KEYS } from '@jetstream/shared/constants';
import { useFetchPageLayouts } from '@jetstream/shared/ui-utils';
import { PermissionSetNoProfileRecord, PermissionSetWithProfileRecord, SalesforceOrgUi } from '@jetstream/types';
import { Checkbox, ConfirmationModalPromise, FileDownloadModal, Grid, Icon, Modal, ScopedNotification, Spinner } from '@jetstream/ui';
import {
ConfirmPageChange,
FieldValues,
applicationCookieState,
fromJetstreamEvents,
prepareDownloadResultsFile,
useAmplitude,
useCreateFields,
} from '@jetstream/ui-core';
import { Fragment, FunctionComponent, useEffect, useState } from 'react';
import { useRecoilState } from 'recoil';
import { applicationCookieState } from '../../app-state';
import ConfirmPageChange from '../core/ConfirmPageChange';
import { useAmplitude } from '../core/analytics';
import * as fromJetstreamEvents from '../core/jetstream-events';
import { FieldValues } from '../shared/create-fields/create-fields-types';
import { prepareDownloadResultsFile } from '../shared/create-fields/create-fields-utils';
import useCreateFields from '../shared/create-fields/useCreateFields';
import CreateFieldsDeployModalRow from './CreateFieldsDeployModalRow';

export interface CreateFieldsDeployModalProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { SalesforceOrgUi } from '@jetstream/types';
import { Badge, Grid, Icon, SalesforceLogin, Spinner, Tooltip } from '@jetstream/ui';
import { CreateFieldsResults, getFriendlyStatus } from '@jetstream/ui-core';
import classNames from 'classnames';
import isString from 'lodash/isString';
import { FunctionComponent, useEffect, useState } from 'react';
import { CreateFieldsResults, getFriendlyStatus } from '../shared/create-fields/useCreateFields';

export interface CreateFieldsDeployModalRowProps {
selectedOrg: SalesforceOrgUi;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,26 @@ import { logger } from '@jetstream/shared/client-logger';
import { ANALYTICS_KEYS } from '@jetstream/shared/constants';
import { useNonInitialEffect } from '@jetstream/shared/ui-utils';
import { SplitWrapper as Split } from '@jetstream/splitjs';
import { Field, FieldType, Maybe, SalesforceOrgUi } from '@jetstream/types';
import { Field, FieldType, Maybe, NullNumberBehavior, SalesforceOrgUi } from '@jetstream/types';
import { Grid, KeyboardShortcut, Modal, Spinner, Tabs, Textarea } from '@jetstream/ui';
import Editor, { OnMount, useMonaco } from '@monaco-editor/react';
import * as formulon from 'formulon';
import type { editor } from 'monaco-editor';
import { forwardRef, useCallback, useEffect, useRef, useState } from 'react';
import { useAmplitude } from '../core/analytics';
import { registerCompletions } from '../formula-evaluator/formula-evaluator.editor-utils';
import { NullNumberBehavior } from '../formula-evaluator/formula-evaluator.state';
import {
FieldDefinition,
FieldValue,
FieldValueState,
FieldValues,
FormulaEvaluatorRecordSearch,
FormulaEvaluatorResults,
FormulaEvaluatorUserSearch,
ManualFormulaRecord,
SalesforceFieldType,
} from '../shared/create-fields/create-fields-types';
import FormulaEvaluatorRecordSearch from '../shared/formula-evaluator/FormulaEvaluatorRecordSearch';
import FormulaEvaluatorResults from '../shared/formula-evaluator/FormulaEvaluatorResults';
import FormulaEvaluatorUserSearch from '../shared/formula-evaluator/FormulaEvaluatorUserSearch';
import { getFormulaData } from '../shared/formula-evaluator/formula-evaluator.utils';
getFormulaData,
useAmplitude,
} from '@jetstream/ui-core';
import Editor, { OnMount, useMonaco } from '@monaco-editor/react';
import * as formulon from 'formulon';
import type { editor } from 'monaco-editor';
import { forwardRef, useCallback, useEffect, useRef, useState } from 'react';
import { registerCompletions } from '../formula-evaluator/formula-evaluator.editor-utils';
import CreateFieldsFormulaEditorManualField from './CreateFieldsFormulaEditorManualField';

export interface CreateFieldsFormulaEditorProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ListItem } from '@jetstream/types';
import { Checkbox, ComboboxWithItems, DatePicker, DateTime, Grid, Input, TimePicker } from '@jetstream/ui';
import { FieldValue, ManualFormulaFieldType } from '@jetstream/ui-core';
import { formatISO } from 'date-fns/formatISO';
import { isValid } from 'date-fns/isValid';
import { parseISO } from 'date-fns/parseISO';
import isDate from 'lodash/isDate';
import { forwardRef } from 'react';
import { FieldValue, ManualFormulaFieldType } from '../shared/create-fields/create-fields-types';

const FieldTypeItems: ListItem<ManualFormulaFieldType, ManualFormulaFieldType>[] = [
{ id: 'string', label: 'Text', value: 'string' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ import {
fireToast,
onParsedMultipleWorkbooks,
} from '@jetstream/ui';
import { Fragment, FunctionComponent, useRef, useState } from 'react';
import { useRecoilState } from 'recoil';
import { applicationCookieState } from '../../app-state';
import { useAmplitude } from '../core/analytics';
import * as fromJetstreamEvents from '../core/jetstream-events';
import { FieldValues } from '../shared/create-fields/create-fields-types';
import {
FieldValues,
allFields,
applicationCookieState,
ensureValidSecondaryType,
ensureValidType,
fieldDefinitions,
fromJetstreamEvents,
getRowsForExport,
} from '../shared/create-fields/create-fields-utils';
useAmplitude,
} from '@jetstream/ui-core';
import { Fragment, FunctionComponent, useRef, useState } from 'react';
import { useRecoilState } from 'recoil';
import { CREATE_FIELDS_EXAMPLE_TEMPLATE } from './create-fields-import-example';

export interface CreateFieldsImportExportProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { SalesforceOrgUi } from '@jetstream/types';
import { Grid, Icon, Tooltip } from '@jetstream/ui';
import { FunctionComponent } from 'react';
import { FieldDefinitionType, FieldValue, FieldValues, SalesforceFieldType } from '../shared/create-fields/create-fields-types';
import {
FieldDefinitionType,
FieldValue,
FieldValues,
SalesforceFieldType,
baseFields,
fieldDefinitions,
fieldTypeDependencies,
getAdditionalFieldDependencies,
} from '../shared/create-fields/create-fields-utils';
} from '@jetstream/ui-core';
import { FunctionComponent } from 'react';
import CreateFieldsRowField from './CreateFieldsRowField';
import CreateFieldsRowPicklistOption from './CreateFieldsRowPicklistOption';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import { css } from '@emotion/react';
import { ListItem, SalesforceOrgUi } from '@jetstream/types';
import { Checkbox, ComboboxWithItems, Grid, Icon, Input, Radio, RadioGroup, Spinner, Textarea, Tooltip } from '@jetstream/ui';
import { FieldDefinition, FieldDefinitions, FieldValue, FieldValueState, FieldValues, SalesforceFieldType } from '@jetstream/ui-core';
import { forwardRef, useEffect, useImperativeHandle, useState } from 'react';
import {
FieldDefinition,
FieldDefinitions,
FieldValue,
FieldValueState,
FieldValues,
SalesforceFieldType,
} from '../shared/create-fields/create-fields-types';
import CreateFieldsFormulaEditor from './CreateFieldsFormulaEditor';

export interface CreateFieldsRowFieldProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SalesforceOrgUi } from '@jetstream/types';
import { Checkbox, Grid } from '@jetstream/ui';
import { FieldDefinitionType, FieldDefinitions, FieldValue, FieldValues } from '@jetstream/ui-core';
import { FunctionComponent, useRef } from 'react';
import { FieldDefinitionType, FieldDefinitions, FieldValue, FieldValues } from '../shared/create-fields/create-fields-types';
import CreateFieldsRowField from './CreateFieldsRowField';
import CreateNewGlobalPicklistModal from './CreateNewGlobalPicklistModal';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ import {
PageHeaderRow,
PageHeaderTitle,
} from '@jetstream/ui';
import { filterCreateFieldsSobjects, selectedOrgState } from '@jetstream/ui-core';
import { FunctionComponent, useEffect, useRef } from 'react';
import { Link } from 'react-router-dom';
import { useRecoilState, useRecoilValue } from 'recoil';
import { selectedOrgState } from '../../app-state';
import { RequireMetadataApiBanner } from '../core/RequireMetadataApiBanner';
import { filterCreateFieldsSobjects } from '../shared/create-fields/create-fields-utils';
import * as fromCreateFieldsState from './create-fields.state';
import CreateNewObject from './create-new-object/CreateNewObject';

Expand Down
Loading

0 comments on commit b46c1f4

Please sign in to comment.