From 4e46ac6816a8b377097e5c0f60d8635814501387 Mon Sep 17 00:00:00 2001 From: Graham Langford <30706330+grahamlangford@users.noreply.github.com> Date: Tue, 2 Jul 2024 13:33:07 -0500 Subject: [PATCH] #8613: rename remaining instances of term installed in the page editor (#8743) * installed -> activated * ts fixes * fix mocks * more renaming * more renaming * more renaming * fix failing unit test; cleanup code * more renaming * removes pointless comment --- .../{uninstallUtils.ts => deactivateUtils.ts} | 4 +- src/activation/activationLinkUtils.ts | 2 +- src/activation/useActivateMod.test.ts | 38 +++++----- src/activation/useActivateMod.ts | 14 ++-- src/activation/useActivateModWizard.test.tsx | 2 +- src/activation/useActivateModWizard.ts | 40 +++++------ src/activation/wizardTypes.ts | 5 +- .../form/ConnectedFieldTemplate.test.tsx | 8 +-- .../activateMod/ActivateModCard.test.tsx | 14 ++-- .../pages/activateMod/ActivateModCard.tsx | 2 +- .../mods/hooks/useModsPageActions.test.tsx | 69 ++++++++++--------- .../pages/mods/utils/useReinstall.test.ts | 4 +- .../pages/mods/utils/useReinstall.ts | 4 +- src/mods/hooks/useDeactivateAction.ts | 25 ++++--- src/pageEditor/baseFormStateTypes.ts | 4 +- .../hooks/useBuildAndValidateMod.test.ts | 10 +-- .../useCheckModStarterBrickInvariants.test.ts | 22 +++--- .../useCompareModComponentCounts.test.ts | 42 +++++------ .../hooks/useCreateModFromMod.test.ts | 12 ++-- src/pageEditor/hooks/useCreateModFromMod.ts | 2 +- .../hooks/useCreateModFromModComponent.ts | 2 +- .../useRemoveModComponentFromStorage.test.ts | 2 +- .../useRemoveModComponentFromStorage.tsx | 2 +- src/pageEditor/hooks/useResetModComponent.ts | 10 +-- .../ActivatedModComponentListItem.tsx | 6 +- .../modListingPanel/ModListItem.tsx | 8 +-- .../modListingPanel/modals/AddToModModal.tsx | 4 +- src/pageEditor/panes/save/saveHelpers.test.ts | 4 +- src/pageEditor/panes/save/saveHelpers.ts | 2 +- src/pageEditor/slices/editorSelectors.ts | 2 +- src/pageEditor/slices/editorSlice.test.ts | 7 +- src/pageEditor/slices/editorSlice.ts | 31 +++++---- src/pageEditor/starterBricks/trigger.ts | 2 +- .../tabs/editTab/dataPanel/DataPanel.tsx | 2 +- .../dataPanel/DataTabJsonTree.test.tsx | 4 +- .../tabs/modMetadata/ModMetadataEditor.tsx | 18 ++--- src/sidebar/activateMod/ActivateModInputs.tsx | 13 +--- src/sidebar/activateMod/ActivateModPanel.tsx | 4 +- .../activateMod/ActivateMultipleModsPanel.tsx | 2 +- ...heckActiveModComponentAvailability.test.ts | 4 +- .../checkAvailableDraftModComponents.test.ts | 4 +- .../{uninstallUtils.ts => deactivateUtils.ts} | 15 ++-- .../sessionChangesListenerMiddleware.ts | 2 +- src/tsconfig.strictNullChecks.json | 4 +- 44 files changed, 245 insertions(+), 232 deletions(-) rename src/__mocks__/@/store/{uninstallUtils.ts => deactivateUtils.ts} (89%) rename src/store/{uninstallUtils.ts => deactivateUtils.ts} (85%) diff --git a/src/__mocks__/@/store/uninstallUtils.ts b/src/__mocks__/@/store/deactivateUtils.ts similarity index 89% rename from src/__mocks__/@/store/uninstallUtils.ts rename to src/__mocks__/@/store/deactivateUtils.ts index b7402d619f..3282e7a6e5 100644 --- a/src/__mocks__/@/store/uninstallUtils.ts +++ b/src/__mocks__/@/store/deactivateUtils.ts @@ -15,6 +15,6 @@ * along with this program. If not, see . */ -export const uninstallMod = jest.fn(); -export const uninstallModComponents = jest.fn(); +export const deactivateMod = jest.fn(); +export const deactivateModComponents = jest.fn(); export const removeModComponentsFromAllTabs = jest.fn(); diff --git a/src/activation/activationLinkUtils.ts b/src/activation/activationLinkUtils.ts index c7405b08db..6a4bf5d95e 100644 --- a/src/activation/activationLinkUtils.ts +++ b/src/activation/activationLinkUtils.ts @@ -79,7 +79,7 @@ export function createActivationRelativeUrl( } for (const mod of mods) { - // `id[]` syntax works in extension both single and multiple values + // `id[]` syntax works in mod component both single and multiple values searchParams.append("id[]", mod.modId); } diff --git a/src/activation/useActivateMod.test.ts b/src/activation/useActivateMod.test.ts index a0bcad6c04..c73fadcdd7 100644 --- a/src/activation/useActivateMod.test.ts +++ b/src/activation/useActivateMod.test.ts @@ -21,9 +21,9 @@ import useActivateMod from "./useActivateMod"; import { validateRegistryId } from "@/types/helpers"; import { type StarterBrickDefinitionLike } from "@/starterBricks/types"; import { type ContextMenuDefinition } from "@/starterBricks/contextMenu/contextMenuTypes"; -import { uninstallMod } from "@/store/uninstallUtils"; +import { deactivateMod } from "@/store/deactivateUtils"; import { type ModDefinition } from "@/types/modDefinitionTypes"; -import extensionsSlice from "@/store/extensionsSlice"; +import modComponentsSlice from "@/store/extensionsSlice"; import { type InnerDefinitions } from "@/types/registryTypes"; import { checkModDefinitionPermissions } from "@/modDefinitions/modDefinitionPermissionsHelpers"; import { emptyPermissionsFactory } from "@/permissions/permissionsUtils"; @@ -43,7 +43,7 @@ import type MockAdapter from "axios-mock-adapter"; jest.mock("@/contentScript/messenger/api"); const checkPermissionsMock = jest.mocked(checkModDefinitionPermissions); -const uninstallModMock = jest.mocked(uninstallMod); +const deactivateModMock = jest.mocked(deactivateMod); const reactivateEveryTabMock = jest.mocked(reloadModsEveryTab); function setupInputs(): { @@ -51,7 +51,7 @@ function setupInputs(): { modDefinition: ModDefinition; } { const formValues: WizardValues = { - extensions: { 0: true }, + modComponents: { 0: true }, integrationDependencies: [], optionsArgs: {}, }; @@ -115,7 +115,7 @@ describe("useActivateMod", () => { setUserAcceptedPermissions(false); const { - result: { current: activateRecipe }, + result: { current: activateMod }, getReduxStore, } = renderHook(() => useActivateMod("marketplace"), { setupRedux(dispatch, { store }) { @@ -123,7 +123,7 @@ describe("useActivateMod", () => { }, }); - const { success, error } = await activateRecipe(formValues, modDefinition); + const { success, error } = await activateMod(formValues, modDefinition); expect(success).toBe(false); expect(error).toBe("You must accept browser permissions to activate."); @@ -131,7 +131,7 @@ describe("useActivateMod", () => { const { dispatch } = getReduxStore(); expect(dispatch).not.toHaveBeenCalled(); - expect(uninstallModMock).not.toHaveBeenCalled(); + expect(deactivateModMock).not.toHaveBeenCalled(); expect(reactivateEveryTabMock).not.toHaveBeenCalled(); }); @@ -141,7 +141,7 @@ describe("useActivateMod", () => { setUserAcceptedPermissions(false); const { - result: { current: activateRecipe }, + result: { current: activateMod }, } = renderHook( () => useActivateMod("marketplace", { checkPermissions: false }), { @@ -151,19 +151,19 @@ describe("useActivateMod", () => { }, ); - const { success, error } = await activateRecipe(formValues, modDefinition); + const { success, error } = await activateMod(formValues, modDefinition); expect(success).toBe(true); expect(error).toBeUndefined(); }); - it("calls uninstallRecipe, installs to extensionsSlice, and calls reactivateEveryTab, if permissions are granted", async () => { + it("calls deactivateMod, activates to modComponentsSlice, and calls reactivateEveryTab, if permissions are granted", async () => { const { formValues, modDefinition } = setupInputs(); setModHasPermissions(false); setUserAcceptedPermissions(true); const { - result: { current: activateRecipe }, + result: { current: activateMod }, getReduxStore, act, } = renderHook(() => useActivateMod("extensionConsole"), { @@ -175,7 +175,7 @@ describe("useActivateMod", () => { let success: boolean; let error: unknown; await act(async () => { - const result = await activateRecipe(formValues, modDefinition); + const result = await activateMod(formValues, modDefinition); success = result.success; error = result.error; }); @@ -185,14 +185,14 @@ describe("useActivateMod", () => { const { dispatch } = getReduxStore(); - expect(uninstallModMock).toHaveBeenCalledWith( + expect(deactivateModMock).toHaveBeenCalledWith( modDefinition.metadata.id, expect.toBeArray(), dispatch, ); expect(dispatch).toHaveBeenCalledWith( - extensionsSlice.actions.activateMod({ + modComponentsSlice.actions.activateMod({ modDefinition, configuredDependencies: [], optionsArgs: {}, @@ -237,7 +237,7 @@ describe("useActivateMod", () => { appApiMock.onPost("/api/databases/").reply(201, createdDatabase); const { - result: { current: activateRecipe }, + result: { current: activateMod }, getReduxStore, act, } = renderHook(() => useActivateMod("marketplace"), { @@ -249,7 +249,7 @@ describe("useActivateMod", () => { let success: boolean; let error: unknown; await act(async () => { - const result = await activateRecipe(formValues, modDefinition); + const result = await activateMod(formValues, modDefinition); success = result.success; error = result.error; }); @@ -260,7 +260,7 @@ describe("useActivateMod", () => { const { dispatch } = getReduxStore(); expect(dispatch).toHaveBeenCalledWith( - extensionsSlice.actions.activateMod({ + modComponentsSlice.actions.activateMod({ modDefinition, configuredDependencies: [], optionsArgs: { @@ -311,7 +311,7 @@ describe("useActivateMod", () => { const errorMessage = "Error creating database"; const { - result: { current: activateRecipe }, + result: { current: activateMod }, act, } = renderHook(() => useActivateMod("marketplace"), { setupRedux(dispatch, { store }) { @@ -322,7 +322,7 @@ describe("useActivateMod", () => { let success: boolean; let error: unknown; await act(async () => { - const result = await activateRecipe(formValues, modDefinition); + const result = await activateMod(formValues, modDefinition); success = result.success; error = result.error; }); diff --git a/src/activation/useActivateMod.ts b/src/activation/useActivateMod.ts index 81637ffd7b..e3fdf93dcf 100644 --- a/src/activation/useActivateMod.ts +++ b/src/activation/useActivateMod.ts @@ -19,10 +19,10 @@ import { type WizardValues } from "@/activation/wizardTypes"; import { type ModDefinition } from "@/types/modDefinitionTypes"; import { useCallback } from "react"; import { useDispatch, useSelector } from "react-redux"; -import extensionsSlice from "@/store/extensionsSlice"; +import modComponentsSlice from "@/store/extensionsSlice"; import reportEvent from "@/telemetry/reportEvent"; import { getErrorMessage } from "@/errors/errorHelpers"; -import { uninstallMod } from "@/store/uninstallUtils"; +import { deactivateMod } from "@/store/deactivateUtils"; import { selectActivatedModComponents } from "@/store/extensionsSelectors"; import { ensurePermissionsFromUserGesture } from "@/permissions/permissionsUtils"; import { checkModDefinitionPermissions } from "@/modDefinitions/modDefinitionPermissionsHelpers"; @@ -59,7 +59,7 @@ function selectActivateEventData(modDefinition: ModDefinition) { } /** - * React hook to install a mod. + * React hook to activate a mod. * * Prompts the user to grant permissions if PixieBrix does not already have the required permissions. * @param source The source of the activation, only used for reporting purposes @@ -85,7 +85,7 @@ function useActivateMod( if (source === "extensionConsole") { // Note: The prefix "Marketplace" on the telemetry event name // here is legacy terminology from before the public marketplace - // was created. It refers to the mod-list part of the extension + // was created. It refers to the mod-list part of the mod component // console, to distinguish that from the workshop. // It's being kept to keep our metrics history clean. reportEvent(Events.MARKETPLACE_ACTIVATE, { @@ -112,7 +112,7 @@ function useActivateMod( if (source === "extensionConsole") { // Note: The prefix "Marketplace" on the telemetry event name // here is legacy terminology from before the public marketplace - // was created. It refers to the mod-list part of the extension + // was created. It refers to the mod-list part of the mod component // console, to distinguish that from the workshop. // It's being kept like this so our metrics history stays clean. reportEvent(Events.MARKETPLACE_REJECT_PERMISSIONS, { @@ -143,14 +143,14 @@ function useActivateMod( (x) => x._recipe?.id === modDefinition.metadata.id, ); - await uninstallMod( + await deactivateMod( modDefinition.metadata.id, existingModComponents, dispatch, ); dispatch( - extensionsSlice.actions.activateMod({ + modComponentsSlice.actions.activateMod({ modDefinition, configuredDependencies: integrationDependencies, optionsArgs, diff --git a/src/activation/useActivateModWizard.test.tsx b/src/activation/useActivateModWizard.test.tsx index 88f88bc24a..d8a15132ec 100644 --- a/src/activation/useActivateModWizard.test.tsx +++ b/src/activation/useActivateModWizard.test.tsx @@ -46,7 +46,7 @@ jest.mock("@/hooks/useAsyncModOptionsValidationSchema", () => ({ default: jest.fn(() => valueToAsyncState({})), })); -describe("useActivateRecipeWizard", () => { +describe("useActivateModWizard", () => { test("show personalized tab", () => { const spy = jest.spyOn(redux, "useSelector"); spy.mockReturnValue([]); diff --git a/src/activation/useActivateModWizard.ts b/src/activation/useActivateModWizard.ts index 31b8800a3e..06601b62fc 100644 --- a/src/activation/useActivateModWizard.ts +++ b/src/activation/useActivateModWizard.ts @@ -65,7 +65,7 @@ function forcePrimitive(value: unknown): Primitive | undefined { return isPrimitive(value) ? value : undefined; } -export type UseActivateRecipeWizardResult = { +export type UseActivateModWizardResult = { wizardSteps: WizardStep[]; initialValues: WizardValues; validationSchema: Yup.AnyObjectSchema; @@ -75,26 +75,26 @@ export function wizardStateFactory({ modDefinition, defaultAuthOptions = {}, databaseOptions, - installedExtensions, + activatedModComponents, optionsValidationSchema, initialModOptions, }: { modDefinition: ModDefinition; defaultAuthOptions: Record; databaseOptions: Option[]; - installedExtensions: ActivatedModComponent[]; + activatedModComponents: ActivatedModComponent[]; optionsValidationSchema: AnyObjectSchema; initialModOptions: UnknownObject; -}): UseActivateRecipeWizardResult { +}): UseActivateModWizardResult { const modComponentDefinitions = modDefinition.extensionPoints ?? []; - const activatedModComponents = installedExtensions?.filter( - (extension) => extension._recipe?.id === modDefinition.metadata.id, + const activatedModComponentsForMod = activatedModComponents?.filter( + (x) => x._recipe?.id === modDefinition.metadata.id, ); - const installedOptions = collectModOptions(activatedModComponents); - const installedIntegrationConfigs = Object.fromEntries( - collectConfiguredIntegrationDependencies(activatedModComponents).map( + const activatedOptions = collectModOptions(activatedModComponentsForMod); + const activatedIntegrationConfigs = Object.fromEntries( + collectConfiguredIntegrationDependencies(activatedModComponentsForMod).map( ({ integrationId, configId }) => [integrationId, configId], ), ); @@ -103,9 +103,9 @@ export function wizardStateFactory({ const integrationDependencies = unconfiguredIntegrationDependencies.map( (unconfiguredDependency) => ({ ...unconfiguredDependency, - // Prefer the installed dependency for reinstall cases, otherwise use the default + // Prefer the activated dependency for reactivate cases, otherwise use the default configId: - installedIntegrationConfigs[unconfiguredDependency.integrationId] ?? + activatedIntegrationConfigs[unconfiguredDependency.integrationId] ?? defaultAuthOptions[unconfiguredDependency.integrationId]?.value, }), ); @@ -129,17 +129,17 @@ export function wizardStateFactory({ }); const initialValues: WizardValues = { - extensions: Object.fromEntries( - // By default, all extensions in the recipe should be toggled on + modComponents: Object.fromEntries( + // By default, all mod components in the mod should be toggled on modComponentDefinitions.map((_, index) => [index, true]), ), integrationDependencies, optionsArgs: mapValues( modDefinition.options?.schema?.properties ?? {}, (optionSchema: Schema, name: string) => { - const installedValue = installedOptions[name]; - if (installedValue) { - return forcePrimitive(installedValue); + const activatedValue = activatedOptions[name]; + if (activatedValue) { + return forcePrimitive(activatedValue); } if ( @@ -167,7 +167,7 @@ export function wizardStateFactory({ }; const validationSchema = Yup.object().shape({ - extensions: Yup.object().shape( + modComponents: Yup.object().shape( Object.fromEntries( modComponentDefinitions.map((_, index) => [ index, @@ -199,8 +199,8 @@ function useActivateModWizard( modDefinition: ModDefinition, defaultAuthOptions: Record = {}, initialOptions: UnknownObject = {}, -): FetchableAsyncState { - const installedExtensions = useSelector(selectActivatedModComponents); +): FetchableAsyncState { + const activatedModComponents = useSelector(selectActivatedModComponents); const optionsValidationSchemaState = useAsyncModOptionsValidationSchema( modDefinition.options?.schema, ); @@ -216,7 +216,7 @@ function useActivateModWizard( modDefinition, defaultAuthOptions, databaseOptions, - installedExtensions, + activatedModComponents, optionsValidationSchema, initialModOptions: initialOptions, }), diff --git a/src/activation/wizardTypes.ts b/src/activation/wizardTypes.ts index d9a1c2b939..58ca47a02b 100644 --- a/src/activation/wizardTypes.ts +++ b/src/activation/wizardTypes.ts @@ -25,15 +25,14 @@ export type WizardStep = { label: string; Component: React.FunctionComponent<{ mod: ModDefinition; - reinstall: boolean; }>; }; export type WizardValues = { /** - * Mapping from extension index to whether or not it's toggled. + * Mapping from mod component index to whether or not it's toggled. */ - extensions: Record; + modComponents: Record; /** * Integration dependencies for the mod diff --git a/src/components/form/ConnectedFieldTemplate.test.tsx b/src/components/form/ConnectedFieldTemplate.test.tsx index f08ac2457e..9fea5554e8 100644 --- a/src/components/form/ConnectedFieldTemplate.test.tsx +++ b/src/components/form/ConnectedFieldTemplate.test.tsx @@ -115,7 +115,7 @@ describe("ConnectedFieldTemplate", () => { { initialValues: formState, setupRedux(dispatch) { - dispatch(actions.selectInstalled(formState)); + dispatch(actions.selectActivatedModComponentFormState(formState)); dispatch( analysisSlice.actions.finishAnalysis({ extensionId: formState.uuid, @@ -179,7 +179,7 @@ describe("ConnectedFieldTemplate", () => { }, }, setupRedux(dispatch) { - dispatch(actions.selectInstalled(formState)); + dispatch(actions.selectActivatedModComponentFormState(formState)); dispatch( analysisSlice.actions.finishAnalysis({ extensionId: formState.uuid, @@ -239,7 +239,7 @@ describe("ConnectedFieldTemplate", () => { { initialValues: formState, setupRedux(dispatch) { - dispatch(actions.selectInstalled(formState)); + dispatch(actions.selectActivatedModComponentFormState(formState)); dispatch( analysisSlice.actions.finishAnalysis({ extensionId: formState.uuid, @@ -339,7 +339,7 @@ describe("ConnectedFieldTemplate", () => { { initialValues: formState, setupRedux(dispatch) { - dispatch(actions.selectInstalled(formState)); + dispatch(actions.selectActivatedModComponentFormState(formState)); dispatch( analysisSlice.actions.finishAnalysis({ extensionId: formState.uuid, diff --git a/src/extensionConsole/pages/activateMod/ActivateModCard.test.tsx b/src/extensionConsole/pages/activateMod/ActivateModCard.test.tsx index da8ffa16bd..a71ec2831a 100644 --- a/src/extensionConsole/pages/activateMod/ActivateModCard.test.tsx +++ b/src/extensionConsole/pages/activateMod/ActivateModCard.test.tsx @@ -50,7 +50,7 @@ const activateModCallbackMock = jest.mock("@/activation/useActivateMod.ts"); -const activateRecipeHookMock = jest.mocked(useActivateMod); +const activateModHookMock = jest.mocked(useActivateMod); jest.mock("@/extensionConsole/pages/useRegistryIdParam", () => ({ __esModule: true, @@ -60,7 +60,7 @@ jest.mock("@/extensionConsole/pages/useRegistryIdParam", () => ({ global.chrome.commands.getAll = jest.fn(); function setupMod(modDefinition: ModDefinition) { - const recipeResponse: RetrieveRecipeResponse = { + const modResponse: RetrieveRecipeResponse = { config: modDefinition, updated_at: modDefinition.updated_at, sharing: { @@ -71,7 +71,7 @@ function setupMod(modDefinition: ModDefinition) { appApiMock .onGet(`/api/recipes/${encodeURIComponent(testModId)}/`) - .reply(200, recipeResponse) + .reply(200, modResponse) // Databases, organizations, etc. .onGet() .reply(200, []); @@ -80,17 +80,17 @@ function setupMod(modDefinition: ModDefinition) { beforeEach(() => { appApiMock.reset(); jest.clearAllMocks(); - activateRecipeHookMock.mockReturnValue(activateModCallbackMock); + activateModHookMock.mockReturnValue(activateModCallbackMock); }); // Activate Mod Card is always rendered when the mod has already been found const ModCard: React.FC = () => { - const recipeState = useGetModDefinitionQuery({ + const modState = useGetModDefinitionQuery({ modId: testModId, }); return ( - + {() => } @@ -172,7 +172,7 @@ describe("ActivateModCard", () => { await waitForEffect(); expect(activateModCallbackMock).toHaveBeenCalledWith( { - extensions: { "0": true }, + modComponents: { "0": true }, optionsArgs: {}, integrationDependencies: [], }, diff --git a/src/extensionConsole/pages/activateMod/ActivateModCard.tsx b/src/extensionConsole/pages/activateMod/ActivateModCard.tsx index c0d33701e5..f14074d062 100644 --- a/src/extensionConsole/pages/activateMod/ActivateModCard.tsx +++ b/src/extensionConsole/pages/activateMod/ActivateModCard.tsx @@ -141,7 +141,7 @@ const ActivateModCard: React.FC = () => {

{label}

- + ))} diff --git a/src/extensionConsole/pages/mods/hooks/useModsPageActions.test.tsx b/src/extensionConsole/pages/mods/hooks/useModsPageActions.test.tsx index d1f75d21f2..51155bdc49 100644 --- a/src/extensionConsole/pages/mods/hooks/useModsPageActions.test.tsx +++ b/src/extensionConsole/pages/mods/hooks/useModsPageActions.test.tsx @@ -29,9 +29,12 @@ import { import useModPermissions from "@/mods/hooks/useModPermissions"; import { uniq } from "lodash"; import { uuidv4 } from "@/types/helpers"; -import { uninstallModComponents, uninstallMod } from "@/store/uninstallUtils"; +import { + deactivateModComponents, + deactivateMod, +} from "@/store/deactivateUtils"; import { renderHook } from "@/extensionConsole/testHelpers"; -import { actions as extensionActions } from "@/store/extensionsSlice"; +import { actions as modComponentActions } from "@/store/extensionsSlice"; import { type ModDefinition } from "@/types/modDefinitionTypes"; import { type ModComponentBase } from "@/types/modComponentTypes"; import { @@ -94,18 +97,18 @@ const mockHooks = ({ }; const modViewItemFactory = ({ - isExtension, + isModComponent, sharingType, status, unavailable = false, }: { - isExtension: boolean; + isModComponent: boolean; sharingType: SharingType; status: ModStatus; unavailable?: boolean; }) => ({ - mod: isExtension ? modComponentFactory() : defaultModDefinitionFactory(), + mod: isModComponent ? modComponentFactory() : defaultModDefinitionFactory(), sharing: { source: { type: sharingType, @@ -123,7 +126,7 @@ describe("useModsPageActions", () => { test("cloud mod component", () => { mockHooks(); const standaloneModDefinition = modViewItemFactory({ - isExtension: true, + isModComponent: true, sharingType: "Personal", status: "Inactive", }); @@ -137,7 +140,7 @@ describe("useModsPageActions", () => { test("active personal mod component", () => { mockHooks(); const personalModComponent = modViewItemFactory({ - isExtension: true, + isModComponent: true, sharingType: "Personal", status: "Active", }); @@ -154,7 +157,7 @@ describe("useModsPageActions", () => { test("active personal mod", () => { mockHooks(); const personalMod = modViewItemFactory({ - isExtension: false, + isModComponent: false, sharingType: "Personal", status: "Active", }); @@ -178,7 +181,7 @@ describe("useModsPageActions", () => { test("inactive personal mod", () => { mockHooks(); const personalMod = modViewItemFactory({ - isExtension: false, + isModComponent: false, sharingType: "Personal", status: "Inactive", }); @@ -195,7 +198,7 @@ describe("useModsPageActions", () => { test("active team mod", () => { mockHooks(); const teamMod = modViewItemFactory({ - isExtension: false, + isModComponent: false, sharingType: "Team", status: "Active", }); @@ -212,7 +215,7 @@ describe("useModsPageActions", () => { test("inactive team mod", () => { mockHooks(); const teamMod = modViewItemFactory({ - isExtension: false, + isModComponent: false, sharingType: "Team", status: "Inactive", }); @@ -234,7 +237,7 @@ describe("useModsPageActions", () => { }); const teamMod = modViewItemFactory({ - isExtension: false, + isModComponent: false, sharingType: "Team", status: "Inactive", }); @@ -258,7 +261,7 @@ describe("useModsPageActions", () => { test("public mod", () => { mockHooks(); const publicMod = modViewItemFactory({ - isExtension: false, + isModComponent: false, sharingType: "Personal", status: "Active", }); @@ -282,7 +285,7 @@ describe("useModsPageActions", () => { test("team deployment for unrestricted user", () => { mockHooks({ restricted: false }); const deploymentItem = modViewItemFactory({ - isExtension: false, + isModComponent: false, sharingType: "Deployment", status: "Active", }); @@ -296,7 +299,7 @@ describe("useModsPageActions", () => { test("restricted team deployment", () => { mockHooks({ restricted: true }); const deploymentItem = modViewItemFactory({ - isExtension: false, + isModComponent: false, sharingType: "Deployment", status: "Active", }); @@ -307,10 +310,10 @@ describe("useModsPageActions", () => { expectActions(["viewLogs"], actions); }); - test("blueprint with missing permissions", () => { + test("mod with missing permissions", () => { mockHooks({ hasPermissions: false }); const deploymentItem = modViewItemFactory({ - isExtension: false, + isModComponent: false, sharingType: "Team", status: "Active", }); @@ -334,7 +337,7 @@ describe("useModsPageActions", () => { test("mod with access revoked", () => { mockHooks(); const modItem = modViewItemFactory({ - isExtension: false, + isModComponent: false, sharingType: "Team", status: "Active", unavailable: true, @@ -349,7 +352,7 @@ describe("useModsPageActions", () => { test("paused deployment with unrestricted user", () => { mockHooks({ restricted: false }); const deploymentItem = modViewItemFactory({ - isExtension: false, + isModComponent: false, sharingType: "Deployment", status: "Paused", }); @@ -359,14 +362,14 @@ describe("useModsPageActions", () => { } = renderHook(() => useModsPageActions(deploymentItem)); // Unrestricted users (e.g., developers) need to be able to deactivate/reactivate a deployment to use a later - // version of the blueprint for development/testing. + // version of the mod for development/testing. expectActions(["viewLogs", "deactivate", "reactivate"], actions); }); test("paused deployment with restricted user", () => { mockHooks({ restricted: true }); const deploymentItem = modViewItemFactory({ - isExtension: false, + isModComponent: false, sharingType: "Deployment", status: "Paused", }); @@ -381,7 +384,7 @@ describe("useModsPageActions", () => { test("cannot publish without publish-to-marketplace flag", () => { mockHooks({ canPublish: false }); const personalModComponent = modViewItemFactory({ - isExtension: true, + isModComponent: true, sharingType: "Personal", status: "Active", }); @@ -449,15 +452,15 @@ describe("useModsPageActions", () => { }); describe("actions", () => { - describe("uninstall", () => { + describe("deactivate", () => { beforeEach(() => { mockHooks(); }); - test("calls uninstallMod for a mod", () => { + test("calls deactivate for a mod", () => { mockHooks(); const modViewItem = modViewItemFactory({ - isExtension: false, + isModComponent: false, sharingType: "Personal", status: "Active", }); @@ -470,21 +473,21 @@ describe("actions", () => { deactivate(); - expect(uninstallMod).toHaveBeenCalledWith( + expect(deactivateMod).toHaveBeenCalledWith( (modViewItem.mod as ModDefinition).metadata.id, expect.any(Array), expect.any(Function), ); - expect(uninstallModComponents).not.toHaveBeenCalled(); + expect(deactivateModComponents).not.toHaveBeenCalled(); }); - test("calls uninstallModComponents for an mod component", () => { + test("calls deactivateModComponents for a mod component", () => { mockHooks(); const standaloneModDefinition = standaloneModDefinitionFactory(); const modViewItem = modViewItemFactory({ - isExtension: true, + isModComponent: true, sharingType: "Personal", status: "Active", }); @@ -497,12 +500,12 @@ describe("actions", () => { } = renderHook(() => useModsPageActions(modViewItem), { setupRedux(dispatch) { dispatch( - extensionActions.activateStandaloneModDefinition( + modComponentActions.activateStandaloneModDefinition( standaloneModDefinition, ), ); dispatch( - extensionActions.activateStandaloneModDefinition( + modComponentActions.activateStandaloneModDefinition( standaloneModDefinitionFactory(), ), ); @@ -511,8 +514,8 @@ describe("actions", () => { deactivate(); - expect(uninstallMod).not.toHaveBeenCalled(); - expect(uninstallModComponents).toHaveBeenCalledWith( + expect(deactivateMod).not.toHaveBeenCalled(); + expect(deactivateModComponents).toHaveBeenCalledWith( [standaloneModDefinition.id], expect.any(Function), ); diff --git a/src/extensionConsole/pages/mods/utils/useReinstall.test.ts b/src/extensionConsole/pages/mods/utils/useReinstall.test.ts index 1f515f6dad..5fbf680350 100644 --- a/src/extensionConsole/pages/mods/utils/useReinstall.test.ts +++ b/src/extensionConsole/pages/mods/utils/useReinstall.test.ts @@ -18,7 +18,7 @@ import { renderHook } from "@/extensionConsole/testHelpers"; import useReinstall from "./useReinstall"; import { actions as extensionActions } from "@/store/extensionsSlice"; -import { uninstallMod } from "@/store/uninstallUtils"; +import { deactivateMod } from "@/store/deactivateUtils"; import { type ModComponentsRootState } from "@/store/extensionsTypes"; import { defaultModDefinitionFactory } from "@/testUtils/factories/modDefinitionFactories"; import { standaloneModDefinitionFactory } from "@/testUtils/factories/modComponentFactories"; @@ -62,7 +62,7 @@ test("uninstalls mod components", async () => { await act(async () => reinstall(modDefinition)); - expect(uninstallMod).toHaveBeenCalledWith( + expect(deactivateMod).toHaveBeenCalledWith( modDefinition.metadata.id, [expectedExtension], expect.any(Function), diff --git a/src/extensionConsole/pages/mods/utils/useReinstall.ts b/src/extensionConsole/pages/mods/utils/useReinstall.ts index 601f912433..5fed83d08c 100644 --- a/src/extensionConsole/pages/mods/utils/useReinstall.ts +++ b/src/extensionConsole/pages/mods/utils/useReinstall.ts @@ -21,7 +21,7 @@ import { selectActivatedModComponents } from "@/store/extensionsSelectors"; import { useCallback } from "react"; import { actions as extensionActions } from "@/store/extensionsSlice"; import { collectModOptions } from "@/store/extensionsUtils"; -import { uninstallMod } from "@/store/uninstallUtils"; +import { deactivateMod } from "@/store/deactivateUtils"; import collectExistingConfiguredDependenciesForMod from "@/integrations/util/collectExistingConfiguredDependenciesForMod"; type Reinstall = (modDefinition: ModDefinition) => Promise; @@ -49,7 +49,7 @@ function useReinstall(): Reinstall { activatedModComponents, ); - await uninstallMod(modId, activatedModComponents, dispatch); + await deactivateMod(modId, activatedModComponents, dispatch); dispatch( extensionActions.activateMod({ diff --git a/src/mods/hooks/useDeactivateAction.ts b/src/mods/hooks/useDeactivateAction.ts index 54fd1c78fb..1b2595b3b0 100644 --- a/src/mods/hooks/useDeactivateAction.ts +++ b/src/mods/hooks/useDeactivateAction.ts @@ -25,7 +25,10 @@ import { } from "@/utils/modUtils"; import { useCallback } from "react"; import useUserAction from "@/hooks/useUserAction"; -import { uninstallModComponents, uninstallMod } from "@/store/uninstallUtils"; +import { + deactivateModComponents, + deactivateMod, +} from "@/store/deactivateUtils"; import reportEvent from "@/telemetry/reportEvent"; import { Events } from "@/telemetry/events"; import { type ModComponentState } from "@/store/extensionsTypes"; @@ -44,32 +47,32 @@ function useDeactivateAction(modViewItem: ModViewItem): (() => void) | null { // Without memoization, the selector reference changes on every render, which causes useModPermissions // to recompute, spamming the background worker with service locator requests - const memoizedExtensionsSelector = useCallback( + const memoizedModComponentsSelector = useCallback( (state: { options: ModComponentState }) => selectComponentsFromMod(state, mod), [mod], ); - const extensionsFromMod = useSelector(memoizedExtensionsSelector); + const modComponentsFromMod = useSelector(memoizedModComponentsSelector); const deactivate = useUserAction( async () => { if (isModDefinition(mod)) { - const blueprintId = mod.metadata.id; - await uninstallMod(blueprintId, extensionsFromMod, dispatch); + const modId = mod.metadata.id; + await deactivateMod(modId, modComponentsFromMod, dispatch); reportEvent(Events.MOD_REMOVE, { - blueprintId, + blueprintId: modId, }); } else { - await uninstallModComponents( - extensionsFromMod.map(({ id }) => id), + await deactivateModComponents( + modComponentsFromMod.map(({ id }) => id), dispatch, ); - for (const extension of extensionsFromMod) { + for (const modComponent of modComponentsFromMod) { reportEvent(Events.MOD_COMPONENT_REMOVE, { - extensionId: extension.id, + extensionId: modComponent.id, }); } } @@ -78,7 +81,7 @@ function useDeactivateAction(modViewItem: ModViewItem): (() => void) | null { successMessage: `Deactivated mod: ${getLabel(mod)}`, errorMessage: `Error deactivating mod: ${getLabel(mod)}`, }, - [mod, extensionsFromMod], + [mod, modComponentsFromMod], ); return isActive && !isRestricted ? deactivate : null; diff --git a/src/pageEditor/baseFormStateTypes.ts b/src/pageEditor/baseFormStateTypes.ts index 999acbec14..7237dc0c34 100644 --- a/src/pageEditor/baseFormStateTypes.ts +++ b/src/pageEditor/baseFormStateTypes.ts @@ -127,7 +127,7 @@ export interface BaseFormStateV1< extension: TModComponent; /** - * Information about the mod used to install the mod component, or `undefined` + * Information about the mod used to activate the mod component, or `undefined` * if the mod component is not part of a mod. * @see ModComponentBase._recipe */ @@ -185,7 +185,7 @@ export type BaseFormStateV3< * @since 2.0.5 * Part of the Page Editor renaming effort * `recipe` to `modMetadata` - * Information about the mod used to install the mod component, or `undefined` + * Information about the mod used to activate the mod component, or `undefined` * if the mod component is not part of a mod. * @see ModComponentBase._recipe */ diff --git a/src/pageEditor/hooks/useBuildAndValidateMod.test.ts b/src/pageEditor/hooks/useBuildAndValidateMod.test.ts index c39685e655..20961aac96 100644 --- a/src/pageEditor/hooks/useBuildAndValidateMod.test.ts +++ b/src/pageEditor/hooks/useBuildAndValidateMod.test.ts @@ -95,7 +95,7 @@ describe("useBuildAndValidateMod", () => { totalModComponentCount, )(); - // Install the mod + // Activate the mod const state = modComponentsSlice.reducer( { extensions: [] }, modComponentsActions.activateMod({ @@ -116,7 +116,7 @@ describe("useBuildAndValidateMod", () => { // Mock this lookup for the adapter call that follows jest.mocked(lookupStarterBrick).mockResolvedValue(starterBrick); - // Mod was installed, so get the mod component from state + // Mod was activated, so get the mod component from state const modComponent = state.extensions[i]; // Load the adapter for this mod component @@ -174,7 +174,7 @@ describe("useBuildAndValidateMod", () => { it("built mod has the wrong number of mod components", async () => { const modMetadata = modMetadataFactory(); - const installedModDefinition = modDefinitionFactory({ + const activatedModDefinition = modDefinitionFactory({ metadata: modMetadata, extensionPoints: array(modComponentDefinitionFactory, 1), }); @@ -189,7 +189,7 @@ describe("useBuildAndValidateMod", () => { setupRedux(dispatch) { dispatch( modComponentsActions.activateMod({ - modDefinition: installedModDefinition, + modDefinition: activatedModDefinition, screen: "pageEditor", isReactivate: false, }), @@ -204,7 +204,7 @@ describe("useBuildAndValidateMod", () => { await hookAct(async () => { await expect( result.current.buildAndValidateMod({ - sourceMod: installedModDefinition, + sourceMod: activatedModDefinition, cleanModComponents: state.extensions.slice(1), dirtyModComponentFormStates: [dirtyFormState1], }), diff --git a/src/pageEditor/hooks/useCheckModStarterBrickInvariants.test.ts b/src/pageEditor/hooks/useCheckModStarterBrickInvariants.test.ts index c7f91cd519..105d27f99a 100644 --- a/src/pageEditor/hooks/useCheckModStarterBrickInvariants.test.ts +++ b/src/pageEditor/hooks/useCheckModStarterBrickInvariants.test.ts @@ -93,8 +93,8 @@ describe("useCheckModStarterBrickInvariants", () => { expectedResult: boolean; }) => { const modMetadata = modMetadataFactory(); - let installedModDefinition: ModDefinition | null = null; - const installedFormStates: ModComponentFormState[] = []; + let activatedModDefinition: ModDefinition | null = null; + const activatedFormStates: ModComponentFormState[] = []; const newFormStates: ModComponentFormState[] = []; const cleanModComponentDefinitions: ModComponentDefinition[] = []; @@ -130,7 +130,7 @@ describe("useCheckModStarterBrickInvariants", () => { }; } - installedModDefinition = modDefinitionFactory({ + activatedModDefinition = modDefinitionFactory({ metadata: modMetadata, definitions: { ...cleanModInnerDefinitions, @@ -146,13 +146,13 @@ describe("useCheckModStarterBrickInvariants", () => { for (const modComponentDefinition of dirtyModComponentDefinitions) { const activatedModComponent = getActivatedModComponentFromDefinition({ modComponentDefinition, - modDefinition: installedModDefinition, + modDefinition: activatedModDefinition, optionsArgs: {}, integrationDependencies: [], }); // eslint-disable-next-line no-await-in-loop -- we control the loop count to be low here const formState = await modComponentToFormState(activatedModComponent); - installedFormStates.push(formState); + activatedFormStates.push(formState); } for (let i = 0; i < newCount; i++) { @@ -206,18 +206,20 @@ describe("useCheckModStarterBrickInvariants", () => { const { result } = renderHook(() => useCheckModStarterBrickInvariants(), { setupRedux(dispatch) { - if (installedModDefinition) { + if (activatedModDefinition) { dispatch( modComponentsActions.activateMod({ - modDefinition: installedModDefinition, + modDefinition: activatedModDefinition, screen: "pageEditor", isReactivate: false, }), ); } - for (const formState of installedFormStates) { - dispatch(editorActions.selectInstalled(formState)); + for (const formState of activatedFormStates) { + dispatch( + editorActions.selectActivatedModComponentFormState(formState), + ); dispatch(editorActions.syncModComponentFormState(formState)); } @@ -230,7 +232,7 @@ describe("useCheckModStarterBrickInvariants", () => { const checkModStarterBrickInvariants = result.current; const actualResult = await checkModStarterBrickInvariants( resultModDefinition, - { sourceModDefinition: installedModDefinition }, + { sourceModDefinition: activatedModDefinition }, ); expect(actualResult).toBe(expectedResult); }, diff --git a/src/pageEditor/hooks/useCompareModComponentCounts.test.ts b/src/pageEditor/hooks/useCompareModComponentCounts.test.ts index 4db7e8af58..9579d667b3 100644 --- a/src/pageEditor/hooks/useCompareModComponentCounts.test.ts +++ b/src/pageEditor/hooks/useCompareModComponentCounts.test.ts @@ -86,7 +86,7 @@ describe("useCompareModComponentCounts", () => { it("should return true for 1 clean and 1 unmatching dirty component in state and 2 in the definition", () => { const modMetadata = modMetadataFactory(); - const installedModDefinition = modDefinitionFactory({ + const activatedModDefinition = modDefinitionFactory({ metadata: modMetadata, }); const unsavedModDefinition = modDefinitionFactory({ @@ -102,7 +102,7 @@ describe("useCompareModComponentCounts", () => { setupRedux(dispatch) { dispatch( modComponentsActions.activateMod({ - modDefinition: installedModDefinition, + modDefinition: activatedModDefinition, screen: "extensionConsole", isReactivate: false, }), @@ -113,14 +113,14 @@ describe("useCompareModComponentCounts", () => { expect( result.current(unsavedModDefinition, { - sourceModDefinition: installedModDefinition, + sourceModDefinition: activatedModDefinition, }), ).toBe(true); }); it("should return true for 3 clean and 2 unmatching dirty form state and 5 components in the definition", () => { const modMetadata = modMetadataFactory(); - const installedModDefinition = modDefinitionFactory({ + const activatedModDefinition = modDefinitionFactory({ metadata: modMetadata, extensionPoints: array(modComponentDefinitionFactory, 3), }); @@ -140,7 +140,7 @@ describe("useCompareModComponentCounts", () => { setupRedux(dispatch) { dispatch( modComponentsActions.activateMod({ - modDefinition: installedModDefinition, + modDefinition: activatedModDefinition, screen: "extensionConsole", isReactivate: false, }), @@ -152,7 +152,7 @@ describe("useCompareModComponentCounts", () => { expect( result.current(unsavedModDefinition, { - sourceModDefinition: installedModDefinition, + sourceModDefinition: activatedModDefinition, }), ).toBe(true); }); @@ -184,7 +184,7 @@ describe("useCompareModComponentCounts", () => { it("should return false for 1 clean and 1 unmatching form state and 3 in definition", () => { const modMetadata = modMetadataFactory(); - const installedModDefinition = modDefinitionFactory({ + const activatedModDefinition = modDefinitionFactory({ metadata: modMetadata, }); const unsavedModDefinition = modDefinitionFactory({ @@ -200,7 +200,7 @@ describe("useCompareModComponentCounts", () => { setupRedux(dispatch) { dispatch( modComponentsActions.activateMod({ - modDefinition: installedModDefinition, + modDefinition: activatedModDefinition, screen: "extensionConsole", isReactivate: false, }), @@ -211,14 +211,14 @@ describe("useCompareModComponentCounts", () => { expect( result.current(unsavedModDefinition, { - sourceModDefinition: installedModDefinition, + sourceModDefinition: activatedModDefinition, }), ).toBe(false); }); it("should return false for 1 clean and 0 unmatching form state and 0 in definition", () => { const modMetadata = modMetadataFactory(); - const installedModDefinition = modDefinitionFactory({ + const activatedModDefinition = modDefinitionFactory({ metadata: modMetadata, }); const unsavedModDefinition = modDefinitionFactory({ @@ -230,7 +230,7 @@ describe("useCompareModComponentCounts", () => { setupRedux(dispatch) { dispatch( modComponentsActions.activateMod({ - modDefinition: installedModDefinition, + modDefinition: activatedModDefinition, screen: "extensionConsole", isReactivate: false, }), @@ -240,14 +240,14 @@ describe("useCompareModComponentCounts", () => { expect( result.current(unsavedModDefinition, { - sourceModDefinition: installedModDefinition, + sourceModDefinition: activatedModDefinition, }), ).toBe(false); }); it("should return false for 1 clean and 0 unmatching form state and 2 in definition", () => { const modMetadata = modMetadataFactory(); - const installedModDefinition = modDefinitionFactory({ + const activatedModDefinition = modDefinitionFactory({ metadata: modMetadata, }); const unsavedModDefinition = modDefinitionFactory({ @@ -259,7 +259,7 @@ describe("useCompareModComponentCounts", () => { setupRedux(dispatch) { dispatch( modComponentsActions.activateMod({ - modDefinition: installedModDefinition, + modDefinition: activatedModDefinition, screen: "extensionConsole", isReactivate: false, }), @@ -269,7 +269,7 @@ describe("useCompareModComponentCounts", () => { expect( result.current(unsavedModDefinition, { - sourceModDefinition: installedModDefinition, + sourceModDefinition: activatedModDefinition, }), ).toBe(false); }); @@ -303,7 +303,7 @@ describe("useCompareModComponentCounts", () => { it("should return false for 0 clean and 1 unmatching form state and 2 in definition", () => { const modMetadata = modMetadataFactory(); - const installedModDefinition = modDefinitionFactory({ + const activatedModDefinition = modDefinitionFactory({ metadata: modMetadata, extensionPoints: [], }); @@ -320,7 +320,7 @@ describe("useCompareModComponentCounts", () => { setupRedux(dispatch) { dispatch( modComponentsActions.activateMod({ - modDefinition: installedModDefinition, + modDefinition: activatedModDefinition, screen: "extensionConsole", isReactivate: false, }), @@ -331,7 +331,7 @@ describe("useCompareModComponentCounts", () => { expect( result.current(unsavedModDefinition, { - sourceModDefinition: installedModDefinition, + sourceModDefinition: activatedModDefinition, }), ).toBe(false); }); @@ -365,7 +365,7 @@ describe("useCompareModComponentCounts", () => { it("should return false for 3 clean and 1 unmatching form state and 5 in definition", () => { const modMetadata = modMetadataFactory(); - const installedModDefinition = modDefinitionFactory({ + const activatedModDefinition = modDefinitionFactory({ metadata: modMetadata, extensionPoints: array(modComponentDefinitionFactory, 3), }); @@ -382,7 +382,7 @@ describe("useCompareModComponentCounts", () => { setupRedux(dispatch) { dispatch( modComponentsActions.activateMod({ - modDefinition: installedModDefinition, + modDefinition: activatedModDefinition, screen: "extensionConsole", isReactivate: false, }), @@ -393,7 +393,7 @@ describe("useCompareModComponentCounts", () => { expect( result.current(unsavedModDefinition, { - sourceModDefinition: installedModDefinition, + sourceModDefinition: activatedModDefinition, }), ).toBe(false); }); diff --git a/src/pageEditor/hooks/useCreateModFromMod.test.ts b/src/pageEditor/hooks/useCreateModFromMod.test.ts index ce1de577e7..50d7ece6bb 100644 --- a/src/pageEditor/hooks/useCreateModFromMod.test.ts +++ b/src/pageEditor/hooks/useCreateModFromMod.test.ts @@ -94,7 +94,7 @@ describe("useCreateModFromMod", () => { it("does not throw an error if the mod fails the compareModComponentCounts check", async () => { compareModComponentCountsMock.mockReturnValue(() => false); const modMetadata = modMetadataFactory(); - const installedModDefinition = modDefinitionFactory({ + const activatedModDefinition = modDefinitionFactory({ metadata: modMetadata, extensionPoints: array(modComponentDefinitionFactory, 2), }); @@ -107,7 +107,7 @@ describe("useCreateModFromMod", () => { setupRedux(dispatch) { dispatch( modComponentsActions.activateMod({ - modDefinition: installedModDefinition, + modDefinition: activatedModDefinition, screen: "pageEditor", isReactivate: false, }), @@ -117,7 +117,7 @@ describe("useCreateModFromMod", () => { await hookAct(async () => { await result.current.createModFromMod( - installedModDefinition, + activatedModDefinition, modMetadata, ); }); @@ -128,7 +128,7 @@ describe("useCreateModFromMod", () => { it("does not throw an error if the mod fails the checkModStarterBrickInvariants check", async () => { checkModStarterBrickInvariantsMock.mockReturnValue(async () => false); const modMetadata = modMetadataFactory(); - const installedModDefinition = modDefinitionFactory({ + const activatedModDefinition = modDefinitionFactory({ metadata: modMetadata, extensionPoints: array(modComponentDefinitionFactory, 2), }); @@ -141,7 +141,7 @@ describe("useCreateModFromMod", () => { setupRedux(dispatch) { dispatch( modComponentsActions.activateMod({ - modDefinition: installedModDefinition, + modDefinition: activatedModDefinition, screen: "pageEditor", isReactivate: false, }), @@ -151,7 +151,7 @@ describe("useCreateModFromMod", () => { await hookAct(async () => { await result.current.createModFromMod( - installedModDefinition, + activatedModDefinition, modMetadata, ); }); diff --git a/src/pageEditor/hooks/useCreateModFromMod.ts b/src/pageEditor/hooks/useCreateModFromMod.ts index b2d65d6152..3d34e1c852 100644 --- a/src/pageEditor/hooks/useCreateModFromMod.ts +++ b/src/pageEditor/hooks/useCreateModFromMod.ts @@ -118,7 +118,7 @@ function useCreateModFromMod(): UseCreateModFromModReturn { // Error is already handled by buildAndValidateMod. } else { throw error; - } // Other errors can be thrown during mod installation + } // Other errors can be thrown during mod activation } }, [ diff --git a/src/pageEditor/hooks/useCreateModFromModComponent.ts b/src/pageEditor/hooks/useCreateModFromModComponent.ts index 3604dfce8a..0e8cdba0b9 100644 --- a/src/pageEditor/hooks/useCreateModFromModComponent.ts +++ b/src/pageEditor/hooks/useCreateModFromModComponent.ts @@ -120,7 +120,7 @@ function useCreateModFromModComponent( // Error is already handled by buildAndValidateMod. } else { throw error; - } // Other errors can be thrown during mod installation + } // Other errors can be thrown during mod activation } }), [ diff --git a/src/pageEditor/hooks/useRemoveModComponentFromStorage.test.ts b/src/pageEditor/hooks/useRemoveModComponentFromStorage.test.ts index 3b755753a8..8bc7cd86f8 100644 --- a/src/pageEditor/hooks/useRemoveModComponentFromStorage.test.ts +++ b/src/pageEditor/hooks/useRemoveModComponentFromStorage.test.ts @@ -16,7 +16,7 @@ */ import { renderHook } from "@/pageEditor/testHelpers"; -import { removeModComponentsFromAllTabs } from "@/store/uninstallUtils"; +import { removeModComponentsFromAllTabs } from "@/store/deactivateUtils"; import { useRemoveModComponentFromStorage } from "./useRemoveModComponentFromStorage"; import { actions as editorActions } from "@/pageEditor/slices/editorSlice"; import { actions as modComponentsActions } from "@/store/extensionsSlice"; diff --git a/src/pageEditor/hooks/useRemoveModComponentFromStorage.tsx b/src/pageEditor/hooks/useRemoveModComponentFromStorage.tsx index c6e6e664f4..bbd066d66f 100644 --- a/src/pageEditor/hooks/useRemoveModComponentFromStorage.tsx +++ b/src/pageEditor/hooks/useRemoveModComponentFromStorage.tsx @@ -29,7 +29,7 @@ import notify from "@/utils/notify"; import { actions as editorActions } from "@/pageEditor/slices/editorSlice"; import { actions as modComponentsActions } from "@/store/extensionsSlice"; import { removeDraftModComponents } from "@/contentScript/messenger/api"; -import { removeModComponentsFromAllTabs } from "@/store/uninstallUtils"; +import { removeModComponentsFromAllTabs } from "@/store/deactivateUtils"; import { allFramesInInspectedTab } from "@/pageEditor/context/connection"; type Config = { diff --git a/src/pageEditor/hooks/useResetModComponent.ts b/src/pageEditor/hooks/useResetModComponent.ts index 7f601bcc4b..38e132b9c2 100644 --- a/src/pageEditor/hooks/useResetModComponent.ts +++ b/src/pageEditor/hooks/useResetModComponent.ts @@ -38,7 +38,7 @@ type Config = { function useResetModComponent(): (useResetConfig: Config) => Promise { const dispatch = useDispatch(); const sessionId = useSelector(selectSessionId); - const installed = useSelector(selectActivatedModComponents); + const activatedModComponents = useSelector(selectActivatedModComponents); const { data: mods } = useAllModDefinitions(); const { showConfirmation } = useModals(); @@ -62,20 +62,22 @@ function useResetModComponent(): (useResetConfig: Config) => Promise { }); try { - const modComponent = installed.find((x) => x.id === modComponentId); + const modComponent = activatedModComponents.find( + (x) => x.id === modComponentId, + ); if (modComponent == null) { dispatch(actions.removeModComponentFormState(modComponentId)); } else { const formState = await modComponentToFormState(modComponent); initModOptionsIfNeeded(formState, compact(mods)); - dispatch(actions.resetInstalled(formState)); + dispatch(actions.resetActivatedModComponentFormState(formState)); } } catch (error) { reportError(error); dispatch(actions.adapterError({ uuid: modComponentId, error })); } }, - [dispatch, mods, sessionId, installed, showConfirmation], + [dispatch, mods, sessionId, activatedModComponents, showConfirmation], ); } diff --git a/src/pageEditor/modListingPanel/ActivatedModComponentListItem.tsx b/src/pageEditor/modListingPanel/ActivatedModComponentListItem.tsx index 2c2c87e9a3..c91be02e74 100644 --- a/src/pageEditor/modListingPanel/ActivatedModComponentListItem.tsx +++ b/src/pageEditor/modListingPanel/ActivatedModComponentListItem.tsx @@ -115,7 +115,9 @@ const ActivatedModComponentListItem: React.FunctionComponent<{ } } - dispatch(actions.selectInstalled(modComponentFormState)); + dispatch( + actions.selectActivatedModComponentFormState(modComponentFormState), + ); dispatch(actions.checkActiveModComponentAvailability()); if (type === "actionPanel") { @@ -153,7 +155,7 @@ const ActivatedModComponentListItem: React.FunctionComponent<{ })} action active={isActive} - key={`installed-${modComponent.id}`} + key={`activated-${modComponent.id}`} onMouseEnter={ isButton ? async () => showOverlay(modComponent.id) : undefined } diff --git a/src/pageEditor/modListingPanel/ModListItem.tsx b/src/pageEditor/modListingPanel/ModListItem.tsx index a424237510..75e5254f92 100644 --- a/src/pageEditor/modListingPanel/ModListItem.tsx +++ b/src/pageEditor/modListingPanel/ModListItem.tsx @@ -67,7 +67,7 @@ const ModListItem: React.FC = ({ const activeModComponentFormState = useSelector( selectActiveModComponentFormState, ); - const { id: modId, name: savedName, version: installedVersion } = modMetadata; + const { id: modId, name: savedName, version: activatedVersion } = modMetadata; const isActive = activeModId === modId; // TODO: Fix this so it pulls from registry, after registry single-item-api-fetch is implemented @@ -85,8 +85,8 @@ const ModListItem: React.FC = ({ const hasUpdate = latestModVersion != null && - installedVersion != null && - semver.gt(latestModVersion, installedVersion); + activatedVersion != null && + semver.gt(latestModVersion, activatedVersion); const caretIcon = expandedModId === modId ? faCaretDown : faCaretRight; @@ -115,7 +115,7 @@ const ModListItem: React.FC = ({ {hasUpdate && ( )} diff --git a/src/pageEditor/modListingPanel/modals/AddToModModal.tsx b/src/pageEditor/modListingPanel/modals/AddToModModal.tsx index 53bcdaa1e1..b7593dbc0b 100644 --- a/src/pageEditor/modListingPanel/modals/AddToModModal.tsx +++ b/src/pageEditor/modListingPanel/modals/AddToModModal.tsx @@ -23,7 +23,7 @@ import { actions as editorActions } from "@/pageEditor/slices/editorSlice"; import { selectActiveModComponentFormState, selectEditorModalVisibilities, - selectInstalledModMetadatas, + selectActivatedModMetadatas, } from "@/pageEditor/slices/editorSelectors"; import ConnectedFieldTemplate from "@/components/form/ConnectedFieldTemplate"; import notify from "@/utils/notify"; @@ -62,7 +62,7 @@ const AddToModModal: React.FC = () => { const { isAddToModModalVisible: show } = useSelector( selectEditorModalVisibilities, ); - const activatedModMetadatas = useSelector(selectInstalledModMetadatas); + const activatedModMetadatas = useSelector(selectActivatedModMetadatas); const activeModComponentFormState = useSelector( selectActiveModComponentFormState, ); diff --git a/src/pageEditor/panes/save/saveHelpers.test.ts b/src/pageEditor/panes/save/saveHelpers.test.ts index b0b3143744..b7129dc42c 100644 --- a/src/pageEditor/panes/save/saveHelpers.test.ts +++ b/src/pageEditor/panes/save/saveHelpers.test.ts @@ -804,7 +804,7 @@ describe("buildNewMod", () => { totalModComponentCount, )(); - // Install the mod + // Activate the mod const state = modComponentsSlice.reducer( { extensions: [] }, modComponentsSlice.actions.activateMod({ @@ -825,7 +825,7 @@ describe("buildNewMod", () => { // Mock this lookup for the adapter call that follows jest.mocked(lookupStarterBrick).mockResolvedValue(starterBrick); - // Mod was installed, so get the mod component from state + // Mod was activated, so get the mod component from state const modComponent = state.extensions[i]; // Load the adapter for this mod component diff --git a/src/pageEditor/panes/save/saveHelpers.ts b/src/pageEditor/panes/save/saveHelpers.ts index 9d4c72392a..ed4a528791 100644 --- a/src/pageEditor/panes/save/saveHelpers.ts +++ b/src/pageEditor/panes/save/saveHelpers.ts @@ -98,7 +98,7 @@ function findModComponentIndex( ): number { if (modDefinition.metadata.version !== modComponent._recipe?.version) { console.warn( - "Mod component was installed using a different version of the mod", + "Mod component was activated using a different version of the mod", { modDefinitionVersion: modDefinition.metadata.version, modComponentModVersion: modComponent._recipe?.version, diff --git a/src/pageEditor/slices/editorSelectors.ts b/src/pageEditor/slices/editorSelectors.ts index d01ae8d539..2b03f83c0f 100644 --- a/src/pageEditor/slices/editorSelectors.ts +++ b/src/pageEditor/slices/editorSelectors.ts @@ -234,7 +234,7 @@ export const selectEditorModalVisibilities = ({ editor }: EditorRootState) => ({ editor.visibleModalKey === ModalKey.SAVE_DATA_INTEGRITY_ERROR, }); -export const selectInstalledModMetadatas = createSelector( +export const selectActivatedModMetadatas = createSelector( selectModComponentFormStates, selectActivatedModComponents, (formStates, activatedModComponents) => { diff --git a/src/pageEditor/slices/editorSlice.test.ts b/src/pageEditor/slices/editorSlice.test.ts index 6e76d7353c..e30531c7db 100644 --- a/src/pageEditor/slices/editorSlice.test.ts +++ b/src/pageEditor/slices/editorSlice.test.ts @@ -76,7 +76,7 @@ describe("DataPanel state", () => { beforeEach(() => { state = editorSlice.reducer( initialState, - actions.selectInstalled(formStateFactory()), + actions.selectActivatedModComponentFormState(formStateFactory()), ); }); @@ -145,7 +145,10 @@ describe("Add/Remove Bricks", () => { blockRegistry.clear(); blockRegistry.register([echoBrick, teapotBrick]); - editor = editorSlice.reducer(initialState, actions.selectInstalled(source)); + editor = editorSlice.reducer( + initialState, + actions.selectActivatedModComponentFormState(source), + ); }); test("Add Brick", async () => { diff --git a/src/pageEditor/slices/editorSlice.ts b/src/pageEditor/slices/editorSlice.ts index cda386ad25..098211e819 100644 --- a/src/pageEditor/slices/editorSlice.ts +++ b/src/pageEditor/slices/editorSlice.ts @@ -150,12 +150,12 @@ const cloneActiveModComponent = createAsyncThunk< ); }); -type AvailableInstalled = { - availableInstalledIds: UUID[]; +type AvailableActivatedModComponents = { + availableActivatedModComponentIds: UUID[]; }; const checkAvailableActivatedModComponents = createAsyncThunk< - AvailableInstalled, + AvailableActivatedModComponents, void, { state: EditorRootState & ModComponentsRootState } >("editor/checkAvailableActivatedModComponents", async (arg, thunkAPI) => { @@ -180,12 +180,12 @@ const checkAvailableActivatedModComponents = createAsyncThunk< const activatedStarterBrick = activatedStarterBricks.get( x.extensionPointId, ); - // Not installed means not available + // Not activated means not available if (activatedStarterBrick == null) { return false; } - // QuickBar is installed on every page, need to filter by the documentUrlPatterns + // QuickBar is activated on every page, need to filter by the documentUrlPatterns if ( QuickBarStarterBrickABC.isQuickBarStarterBrick(activatedStarterBrick) ) { @@ -200,7 +200,7 @@ const checkAvailableActivatedModComponents = createAsyncThunk< .map((x) => x.id); // Note: we can take out this filter if and when we persist the editor - // slice and remove installed mod components when they become draft form states + // slice and remove activated mod components when they become draft form states const notDraftActivated = notDeletedModComponents.filter( (modComponent) => !notDeletedFormStates.some( @@ -209,11 +209,11 @@ const checkAvailableActivatedModComponents = createAsyncThunk< ), ); - const availableInstalledIds = notDraftActivated + const availableActivatedModComponentIds = notDraftActivated .filter((x) => availableStarterBrickIds.includes(x.id)) .map((x) => x.id); - return { availableInstalledIds }; + return { availableActivatedModComponentIds }; }); async function isStarterBrickFormStateAvailable( @@ -346,7 +346,10 @@ export const editorSlice = createSlice({ state.activeModComponentId = uuid; state.selectionSeq++; }, - selectInstalled(state, action: PayloadAction) { + selectActivatedModComponentFormState( + state, + action: PayloadAction, + ) { const modComponentFormState = action.payload as Draft; const index = state.modComponentFormStates.findIndex( @@ -360,7 +363,10 @@ export const editorSlice = createSlice({ setActiveModComponentId(state, modComponentFormState); }, - resetInstalled(state, actions: PayloadAction) { + resetActivatedModComponentFormState( + state, + actions: PayloadAction, + ) { const modComponentFormState = actions.payload as Draft; const index = state.modComponentFormStates.findIndex( @@ -961,9 +967,10 @@ export const editorSlice = createSlice({ }) .addCase( checkAvailableActivatedModComponents.fulfilled, - (state, { payload: { availableInstalledIds } }) => { + (state, { payload: { availableActivatedModComponentIds } }) => { state.isPendingAvailableActivatedModComponents = false; - state.availableActivatedModComponentIds = availableInstalledIds; + state.availableActivatedModComponentIds = + availableActivatedModComponentIds; }, ) .addCase( diff --git a/src/pageEditor/starterBricks/trigger.ts b/src/pageEditor/starterBricks/trigger.ts index aaab0a26a0..e1e0e3d47e 100644 --- a/src/pageEditor/starterBricks/trigger.ts +++ b/src/pageEditor/starterBricks/trigger.ts @@ -70,7 +70,7 @@ function fromNativeElement( showErrors: true, intervalMillis: undefined, // Use `background: true` for the default for "load" trigger to 1) match the pre-1.8.7 behavior, and 2) - // cause the trigger to run by default when the mod component is installed + // cause the trigger to run by default when the mod component is activated background: true, debounce: undefined, customEvent: undefined, diff --git a/src/pageEditor/tabs/editTab/dataPanel/DataPanel.tsx b/src/pageEditor/tabs/editTab/dataPanel/DataPanel.tsx index 0fe99c5121..5ed953f970 100644 --- a/src/pageEditor/tabs/editTab/dataPanel/DataPanel.tsx +++ b/src/pageEditor/tabs/editTab/dataPanel/DataPanel.tsx @@ -66,7 +66,7 @@ import { BrickTypes } from "@/runtime/runtimeTypes"; * Exclude irrelevant top-level keys. */ const contextFilter = (value: unknown, key: string) => { - // `@options` comes from marketplace-installed mod components. There's a chance the user might add a brick that has + // `@options` comes from marketplace-activated mod components. There's a chance the user might add a brick that has // @options as an output key. In that case, we'd expect values to flow into it. So just checking to see if there's // any data is a good compromise even though we miss the corner-case where @options is user-defined but empty if (key === "@options" && isEmpty(value)) { diff --git a/src/pageEditor/tabs/editTab/dataPanel/DataTabJsonTree.test.tsx b/src/pageEditor/tabs/editTab/dataPanel/DataTabJsonTree.test.tsx index 2fff2f1840..8c1d70b7ba 100644 --- a/src/pageEditor/tabs/editTab/dataPanel/DataTabJsonTree.test.tsx +++ b/src/pageEditor/tabs/editTab/dataPanel/DataTabJsonTree.test.tsx @@ -42,7 +42,9 @@ const data = { const renderJsonTree = () => render(, { setupRedux(dispatch) { - dispatch(actions.selectInstalled(formStateFactory())); + dispatch( + actions.selectActivatedModComponentFormState(formStateFactory()), + ); }, }); diff --git a/src/pageEditor/tabs/modMetadata/ModMetadataEditor.tsx b/src/pageEditor/tabs/modMetadata/ModMetadataEditor.tsx index f307ed5b4c..370d0505a5 100644 --- a/src/pageEditor/tabs/modMetadata/ModMetadataEditor.tsx +++ b/src/pageEditor/tabs/modMetadata/ModMetadataEditor.tsx @@ -69,19 +69,19 @@ const selectFirstModComponent = createSelector( const OldModVersionAlert: React.FunctionComponent<{ modId: RegistryId; - installedModVersion: string; + activatedModVersion: string; latestModVersion: string; }> = ({ modId, - installedModVersion, + activatedModVersion, latestModVersion, }: { modId: RegistryId; - installedModVersion: string; + activatedModVersion: string; latestModVersion: string; }) => ( - You are editing version {installedModVersion} of this mod, the latest + You are editing version {activatedModVersion} of this mod, the latest version is {latestModVersion}. To get the latest version,{" "} { error, } = useOptionalModDefinition(modId); - // Select a single mod component for the mod to check the installed version. + // Select a single mod component for the mod to check the activated version. // We rely on the assumption that every component in the mod has the same version. const modDefinitionComponent = useSelector(selectFirstModComponent); - const installedModVersion = modDefinitionComponent?._recipe?.version; + const activatedModVersion = modDefinitionComponent?._recipe?.version; const latestModVersion = modDefinition?.metadata?.version; const showOldModVersionWarning = - installedModVersion && + activatedModVersion && latestModVersion && - lt(installedModVersion, latestModVersion); + lt(activatedModVersion, latestModVersion); const dirtyMetadata = useSelector(selectDirtyMetadataForModId(modId)); const savedMetadata = modDefinition?.metadata; @@ -157,7 +157,7 @@ const ModMetadataEditor: React.VoidFunctionComponent = () => { {showOldModVersionWarning && ( )} diff --git a/src/sidebar/activateMod/ActivateModInputs.tsx b/src/sidebar/activateMod/ActivateModInputs.tsx index c52ef0006a..b815c26ac5 100644 --- a/src/sidebar/activateMod/ActivateModInputs.tsx +++ b/src/sidebar/activateMod/ActivateModInputs.tsx @@ -31,9 +31,6 @@ import cx from "classnames"; import Effect from "@/components/Effect"; import permissionsDialogImage from "@img/example-permissions-dialog.png"; import { type AnyObjectSchema } from "yup"; -import { useSelector } from "react-redux"; -import { selectModComponentsForMod } from "@/store/extensionsSelectors"; -import { isEmpty } from "lodash"; import { produce } from "immer"; import { isDatabaseField } from "@/components/fields/schemaFields/fieldTypeCheckers"; import { isUUID } from "@/types/helpers"; @@ -91,11 +88,6 @@ const ActivateModInputs: React.FC = ({ }) : mod; - const modComponents = useSelector( - selectModComponentsForMod(normalizedMod?.metadata?.id), - ); - const isReinstall = !isEmpty(modComponents); - const renderBody: RenderBody = ({ values }) => (
@@ -119,10 +111,7 @@ const ActivateModInputs: React.FC = ({ bring everything back in line. */} - + )} diff --git a/src/sidebar/activateMod/ActivateModPanel.tsx b/src/sidebar/activateMod/ActivateModPanel.tsx index a8e8c9b528..4e65c633e3 100644 --- a/src/sidebar/activateMod/ActivateModPanel.tsx +++ b/src/sidebar/activateMod/ActivateModPanel.tsx @@ -39,7 +39,7 @@ import useActivateMod from "@/activation/useActivateMod"; import { type WizardValues } from "@/activation/wizardTypes"; import { createSlice, type PayloadAction } from "@reduxjs/toolkit"; import useActivateModWizard, { - type UseActivateRecipeWizardResult, + type UseActivateModWizardResult, } from "@/activation/useActivateModWizard"; import RequireMods, { type RequiredModDefinition, @@ -212,7 +212,7 @@ export const SuccessPanel: React.FC<{ ); const ActivateModPanelContent: React.FC< - RequiredModDefinition & UseActivateRecipeWizardResult + RequiredModDefinition & UseActivateModWizardResult > = ({ modDefinition, includesQuickBar, diff --git a/src/sidebar/activateMod/ActivateMultipleModsPanel.tsx b/src/sidebar/activateMod/ActivateMultipleModsPanel.tsx index 5b161d74f1..5ef70a7f72 100644 --- a/src/sidebar/activateMod/ActivateMultipleModsPanel.tsx +++ b/src/sidebar/activateMod/ActivateMultipleModsPanel.tsx @@ -100,7 +100,7 @@ const AutoActivatePanel: React.FC<{ mods: RequiredModDefinition[] }> = ({ databaseOptions, optionsValidationSchema, initialModOptions: mod.initialOptions, - installedExtensions: activatedModComponents, + activatedModComponents, }); const result = await activate( diff --git a/src/store/checkActiveModComponentAvailability.test.ts b/src/store/checkActiveModComponentAvailability.test.ts index 9ec3037147..5ec34211c0 100644 --- a/src/store/checkActiveModComponentAvailability.test.ts +++ b/src/store/checkActiveModComponentAvailability.test.ts @@ -92,7 +92,9 @@ describe("checkActiveModComponentAvailability", () => { store.dispatch( actions.addModComponentFormState(unavailableDraftModComponent), ); - store.dispatch(actions.selectInstalled(availableDraftModComponent)); + store.dispatch( + actions.selectActivatedModComponentFormState(availableDraftModComponent), + ); jest .mocked(checkAvailable) diff --git a/src/store/checkAvailableDraftModComponents.test.ts b/src/store/checkAvailableDraftModComponents.test.ts index aad1ad1adc..b52793add1 100644 --- a/src/store/checkAvailableDraftModComponents.test.ts +++ b/src/store/checkAvailableDraftModComponents.test.ts @@ -92,7 +92,9 @@ describe("checkAvailableDraftModComponents", () => { store.dispatch( actions.addModComponentFormState(unavailableDraftModComponent), ); - store.dispatch(actions.selectInstalled(availableDraftModComponent)); + store.dispatch( + actions.selectActivatedModComponentFormState(availableDraftModComponent), + ); jest .mocked(checkAvailable) diff --git a/src/store/uninstallUtils.ts b/src/store/deactivateUtils.ts similarity index 85% rename from src/store/uninstallUtils.ts rename to src/store/deactivateUtils.ts index 41bdccfd0a..aacc4a2a77 100644 --- a/src/store/uninstallUtils.ts +++ b/src/store/deactivateUtils.ts @@ -30,18 +30,18 @@ import { type UUID } from "@/types/stringTypes"; /** * @file utility methods to deactivate mods/mod components and remove from the existing tabs. * - * Mocked in src/__mocks__/@/store/uninstallUtils.ts. + * Mocked in src/__mocks__/@/store/deactivateUtils.ts. */ /** - * Use this helper outside the Page Editor context to uninstall a mod and all of its mod components. + * Use this helper outside the Page Editor context to deactivate a mod and all of its mod components. * - * Uninstalls from: + * Removes from: * - Extension Options slice * - Draft mod components slice (i.e., Page Editor state) * - Notifies all tabs to remove the mod components */ -export async function uninstallMod( +export async function deactivateMod( modId: RegistryId, modComponents: SerializedModComponent[], dispatch: Dispatch, @@ -60,9 +60,9 @@ export async function uninstallMod( } /** - * Use this helper outside the Page Editor context to uninstall a collections of mod components. + * Use this helper outside the Page Editor context to deactivate a collections of mod components. */ -export async function uninstallModComponents( +export async function deactivateModComponents( modComponentIds: UUID[], dispatch: Dispatch, ): Promise { @@ -73,9 +73,6 @@ export async function uninstallModComponents( removeModComponentsFromAllTabs(modComponentIds); } -/** - * Uninstalls the extensions from all open tabs - */ export function removeModComponentsFromAllTabs(modComponentIds: UUID[]): void { for (const modComponentId of modComponentIds) { removeModComponentForEveryTab(modComponentId); diff --git a/src/store/sessionChanges/sessionChangesListenerMiddleware.ts b/src/store/sessionChanges/sessionChangesListenerMiddleware.ts index c4964e0dd5..e4e64bb44e 100644 --- a/src/store/sessionChanges/sessionChangesListenerMiddleware.ts +++ b/src/store/sessionChanges/sessionChangesListenerMiddleware.ts @@ -28,7 +28,7 @@ sessionChangesListenerMiddleware.startListening({ actions.addNode, actions.moveNode, actions.removeNode, - actions.resetInstalled, + actions.resetActivatedModComponentFormState, actions.removeModComponentFormState, actions.editModMetadata, actions.editModOptionsDefinitions, diff --git a/src/tsconfig.strictNullChecks.json b/src/tsconfig.strictNullChecks.json index 9b8575c400..9d8305d15f 100644 --- a/src/tsconfig.strictNullChecks.json +++ b/src/tsconfig.strictNullChecks.json @@ -27,7 +27,7 @@ "./__mocks__/@/icons/getSvgIcon.ts", "./__mocks__/@/icons/list.ts", "./__mocks__/@/sandbox/messenger/api.ts", - "./__mocks__/@/store/uninstallUtils.ts", + "./__mocks__/@/store/deactivateUtils.ts", "./__mocks__/@/telemetry/logging.ts", "./__mocks__/@/telemetry/reportError.ts", "./__mocks__/@/telemetry/reportEvent.ts", @@ -1366,6 +1366,7 @@ "./store/checkAvailableDraftModComponents.test.ts", "./store/checkAvailableInstalledExtensions.test.ts", "./store/commonActions.ts", + "./store/deactivateUtils.ts", "./store/defaultMiddlewareConfig.ts", "./store/editorMigrations.test.ts", "./store/editorMigrations.ts", @@ -1414,7 +1415,6 @@ "./store/sidebar/thunks/removeTemporaryPanel.ts", "./store/sidebar/thunks/resolveTemporaryPanel.ts", "./store/sidebar/utils.ts", - "./store/uninstallUtils.ts", "./store/workshopSlice.ts", "./telemetry/BackgroundLogger.ts", "./telemetry/deployments.ts",