From ecbcef3a73e25765b78b28f8661c6dbb1ed436ed Mon Sep 17 00:00:00 2001 From: "Justin Kolasa (from Dev Box)" Date: Tue, 14 Jan 2025 10:48:42 -0500 Subject: [PATCH] Removed NPS Survey from DE since it has been moved to the Overview Blade --- src/Contracts/MessageTypes.ts | 1 - src/Explorer/Explorer.tsx | 33 +------------------------------- src/hooks/useKnockoutExplorer.ts | 8 -------- 3 files changed, 1 insertion(+), 41 deletions(-) diff --git a/src/Contracts/MessageTypes.ts b/src/Contracts/MessageTypes.ts index 4550d2a53..a5952e098 100644 --- a/src/Contracts/MessageTypes.ts +++ b/src/Contracts/MessageTypes.ts @@ -41,7 +41,6 @@ export enum MessageTypes { OpenPostgreSQLPasswordReset, OpenPostgresNetworkingBlade, OpenCosmosDBNetworkingBlade, - DisplayNPSSurvey, OpenVCoreMongoNetworkingBlade, OpenVCoreMongoConnectionStringsBlade, GetAuthorizationToken, // unused. Can be removed if the portal uses the same list of enums. diff --git a/src/Explorer/Explorer.tsx b/src/Explorer/Explorer.tsx index dea7f7e95..8740ee616 100644 --- a/src/Explorer/Explorer.tsx +++ b/src/Explorer/Explorer.tsx @@ -35,7 +35,7 @@ import { PhoenixClient } from "../Phoenix/PhoenixClient"; import * as ExplorerSettings from "../Shared/ExplorerSettings"; import { Action, ActionModifiers } from "../Shared/Telemetry/TelemetryConstants"; import * as TelemetryProcessor from "../Shared/Telemetry/TelemetryProcessor"; -import { isAccountNewerThanThresholdInMs, updateUserContext, userContext } from "../UserContext"; +import { updateUserContext, userContext } from "../UserContext"; import { getCollectionName, getUploadName } from "../Utils/APITypeUtils"; import { stringToBlob } from "../Utils/BlobUtils"; import { isCapabilityEnabled } from "../Utils/CapabilityUtils"; @@ -278,37 +278,6 @@ export default class Explorer { } } - public openNPSSurveyDialog(): void { - if (!Platform.Portal || !["Postgres", "SQL", "Mongo"].includes(userContext.apiType)) { - return; - } - - const ONE_DAY_IN_MS = 86400000; - const SEVEN_DAYS_IN_MS = 604800000; - - // Try Cosmos DB subscription - survey shown to 100% of users at day 1 in Data Explorer. - if (userContext.isTryCosmosDBSubscription) { - if (isAccountNewerThanThresholdInMs(userContext.databaseAccount?.systemData?.createdAt || "", ONE_DAY_IN_MS)) { - Logger.logInfo( - `Sending message to Portal to check if NPS Survey can be displayed in Try Cosmos DB ${userContext.apiType}`, - "Explorer/openNPSSurveyDialog", - ); - sendMessage({ type: MessageTypes.DisplayNPSSurvey }); - } - } else { - // Show survey when an existing account is older than 7 days - if ( - !isAccountNewerThanThresholdInMs(userContext.databaseAccount?.systemData?.createdAt || "", SEVEN_DAYS_IN_MS) - ) { - Logger.logInfo( - `Sending message to Portal to check if NPS Survey can be displayed for existing ${userContext.apiType} account older than 7 days`, - "Explorer/openNPSSurveyDialog", - ); - sendMessage({ type: MessageTypes.DisplayNPSSurvey }); - } - } - } - public async openCESCVAFeedbackBlade(): Promise { sendMessage({ type: MessageTypes.OpenCESCVAFeedbackBlade }); Logger.logInfo( diff --git a/src/hooks/useKnockoutExplorer.ts b/src/hooks/useKnockoutExplorer.ts index 0656c8a9b..d756793d3 100644 --- a/src/hooks/useKnockoutExplorer.ts +++ b/src/hooks/useKnockoutExplorer.ts @@ -53,7 +53,6 @@ import { } from "../Utils/AuthorizationUtils"; import { isInvalidParentFrameOrigin, shouldProcessMessage } from "../Utils/MessageValidation"; import { getReadOnlyKeys, listKeys } from "../Utils/arm/generatedClients/cosmos/databaseAccounts"; -import { applyExplorerBindings } from "../applyExplorerBindings"; // This hook will create a new instance of Explorer.ts and bind it to the DOM // This hook has a LOT of magic, but ideally we can delete it once we have removed KO and switched entirely to React @@ -95,13 +94,6 @@ export function useKnockoutExplorer(platform: Platform): Explorer { effect(); }, [platform]); - useEffect(() => { - if (explorer) { - applyExplorerBindings(explorer); - explorer.openNPSSurveyDialog(); - } - }, [explorer]); - return explorer; }