Compare commits

..

14 Commits

Author SHA1 Message Date
Sung-Hyun Kang (from Dev Box)
497d82a88c Merge remote-tracking branch 'origin/master' into copilot_publicpreview 2023-11-10 18:43:55 -06:00
Sung-Hyun Kang (from Dev Box)
da09ba671c Updated the endpoint 2023-11-10 18:41:40 -06:00
Sung-Hyun Kang (from Dev Box)
6e1b104b72 don't call ARM when connectionstring login 2023-11-10 15:55:28 -06:00
Sung-Hyun Kang (from Dev Box)
5433d61bd8 fix formatting 2023-11-10 15:31:53 -06:00
Sung-Hyun Kang (from Dev Box)
feba77e2bf fix formatting 2023-11-10 15:27:33 -06:00
Sung-Hyun Kang (from Dev Box)
22ce69d20c fix formatting 2023-11-10 15:23:54 -06:00
Sung-Hyun Kang (from Dev Box)
d862b929ec fix formatting 2023-11-10 15:18:51 -06:00
Sung-Hyun Kang (from Dev Box)
e626f5218d increase test timeout 2023-11-10 15:15:28 -06:00
Sung-Hyun Kang (from Dev Box)
58aff4f07b add timeout for ARM calls 2023-11-10 15:04:27 -06:00
Sung-Hyun Kang (from Dev Box)
e406bf8190 Update branding and AFEC 2023-11-10 12:44:47 -06:00
Sung-Hyun Kang (from Dev Box)
45bd16e17f Update branding and AFEC 2023-11-10 11:47:11 -06:00
Sung-Hyun Kang (from Dev Box)
7d557df4e0 P1 bugs for copilot 2023-11-09 20:43:43 -06:00
Sung-Hyun Kang (from Dev Box)
b4d6ad172b P1 bugs for copilot 2023-11-09 20:38:14 -06:00
Sung-Hyun Kang (from Dev Box)
a12e8b050f P1 bugs for copilot 2023-11-09 20:36:26 -06:00
7 changed files with 26 additions and 27 deletions

View File

@@ -148,6 +148,9 @@ export function client(): Cosmos.CosmosClient {
endpoint: endpoint() || "https://cosmos.azure.com", // CosmosClient gets upset if we pass a bad URL. This should never actually get called
key: userContext.masterKey,
tokenProvider,
connectionPolicy: {
enableEndpointDiscovery: false,
},
userAgentSuffix: "Azure Portal",
defaultHeaders: _defaultHeaders,
};

View File

@@ -275,7 +275,6 @@ export default class Explorer {
const NINETY_DAYS_IN_MS = 7776000000;
const ONE_DAY_IN_MS = 86400000;
const THREE_DAYS_IN_MS = 259200000;
const isAccountNewerThanNinetyDays = isAccountNewerThanThresholdInMs(
userContext.databaseAccount?.systemData?.createdAt || "",
NINETY_DAYS_IN_MS,
@@ -295,32 +294,32 @@ export default class Explorer {
}
}
// Try Cosmos DB subscription - survey shown to 100% of users at day 1 in Data Explorer.
// Try Cosmos DB subscription - survey shown to random 25% of users at day 1 in Data Explorer.
if (userContext.isTryCosmosDBSubscription) {
if (isAccountNewerThanThresholdInMs(userContext.databaseAccount?.systemData?.createdAt || "", ONE_DAY_IN_MS)) {
this.sendNPSMessage();
if (
isAccountNewerThanThresholdInMs(userContext.databaseAccount?.systemData?.createdAt || "", ONE_DAY_IN_MS) &&
this.getRandomInt(100) < 25
) {
sendMessage({ type: MessageTypes.DisplayNPSSurvey });
localStorage.setItem("lastSubmitted", Date.now().toString());
}
} else {
// An existing account is older than 3 days but less than 90 days old. For existing account show to 100% of users in Data Explorer.
if (
!isAccountNewerThanThresholdInMs(userContext.databaseAccount?.systemData?.createdAt || "", THREE_DAYS_IN_MS) &&
isAccountNewerThanNinetyDays
) {
this.sendNPSMessage();
// An existing account is lesser than 90 days old. For existing account show to random 10 % of users in Data Explorer.
if (isAccountNewerThanNinetyDays) {
if (this.getRandomInt(100) < 10) {
sendMessage({ type: MessageTypes.DisplayNPSSurvey });
localStorage.setItem("lastSubmitted", Date.now().toString());
}
} else {
// An existing account is greater than 90 days. For existing account show to random 33% of users in Data Explorer.
if (this.getRandomInt(100) < 33) {
this.sendNPSMessage();
// An existing account is greater than 90 days. For existing account show to random 25 % of users in Data Explorer.
if (this.getRandomInt(100) < 25) {
sendMessage({ type: MessageTypes.DisplayNPSSurvey });
localStorage.setItem("lastSubmitted", Date.now().toString());
}
}
}
}
private sendNPSMessage() {
sendMessage({ type: MessageTypes.DisplayNPSSurvey });
localStorage.setItem("lastSubmitted", Date.now().toString());
}
public async refreshDatabaseForResourceToken(): Promise<void> {
const databaseId = userContext.parsedResourceToken?.databaseId;
const collectionId = userContext.parsedResourceToken?.collectionId;

View File

@@ -1431,6 +1431,8 @@ export class AddCollectionPanel extends React.Component<AddCollectionPanelProps,
this.setState({ isExecuting: false });
TelemetryProcessor.traceSuccess(Action.CreateCollection, telemetryData, startKey);
useSidePanel.getState().closeSidePanel();
// open NPS Survey Dialog once the collection is created
this.props.explorer.openNPSSurveyDialog();
} catch (error) {
const errorMessage: string = getErrorMessage(error);
this.setState({ isExecuting: false, errorMessage, showErrorDetails: true });

View File

@@ -53,9 +53,7 @@ export const WelcomeModal = ({ visible }: { visible: boolean }): JSX.Element =>
</Stack>
<Stack horizontalAlign="center">
<Stack.Item align="center" style={{ textAlign: "center" }}>
<Text className="title bold" as={"h1"}>
Welcome to Microsoft Copilot for Azure in Cosmos DB (preview)
</Text>
<Text className="title bold">Welcome to Microsoft Copilot for Azure in Cosmos DB (preview)</Text>
</Stack.Item>
<Stack.Item align="center" className="text">
<Stack horizontal>

View File

@@ -76,7 +76,6 @@ exports[`Query Copilot Welcome Modal snapshot test should render when isOpen is
}
>
<Text
as="h1"
className="title bold"
>
Welcome to Microsoft Copilot for Azure in Cosmos DB (preview)

View File

@@ -93,7 +93,7 @@ export const getCopilotEnabled = async (): Promise<boolean> => {
}
if (!response?.ok) {
return false;
throw new Error(await response?.text());
}
const copilotPortalConfiguration = (await response?.json()) as CopilotEnabledConfiguration;

View File

@@ -420,11 +420,9 @@ async function configurePortal(): Promise<Explorer> {
updateContextsFromPortalMessage(inputs);
explorer = new Explorer();
resolve(explorer);
if (userContext.apiType === "Postgres" || userContext.apiType === "SQL" || userContext.apiType === "Mongo") {
setTimeout(() => explorer.openNPSSurveyDialog(), 3000);
if (userContext.apiType === "Postgres") {
explorer.openNPSSurveyDialog();
}
if (openAction) {
handleOpenAction(openAction, useDatabases.getState().databases, explorer);
}