mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-02-16 17:25:58 +00:00
Add additional checks for NPS survey (#1610)
* Add additional checks for NPS survey * Fix variable name * Fix lint errors
This commit is contained in:
parent
c07000a5c2
commit
53fd738982
@ -277,6 +277,20 @@ export default class Explorer {
|
|||||||
userContext.databaseAccount?.systemData?.createdAt || "",
|
userContext.databaseAccount?.systemData?.createdAt || "",
|
||||||
NINETY_DAYS_IN_MS
|
NINETY_DAYS_IN_MS
|
||||||
);
|
);
|
||||||
|
const lastSubmitted: string = localStorage.getItem("lastSubmitted");
|
||||||
|
|
||||||
|
if (lastSubmitted !== null) {
|
||||||
|
let lastSubmittedDate: number = parseInt(lastSubmitted);
|
||||||
|
if (isNaN(lastSubmittedDate)) {
|
||||||
|
lastSubmittedDate = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const nowMs: number = Date.now();
|
||||||
|
const millisecsSinceLastSubmitted = nowMs - lastSubmittedDate;
|
||||||
|
if (millisecsSinceLastSubmitted < NINETY_DAYS_IN_MS) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Try Cosmos DB subscription - survey shown to random 25% 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 (userContext.isTryCosmosDBSubscription) {
|
||||||
@ -285,17 +299,20 @@ export default class Explorer {
|
|||||||
this.getRandomInt(100) < 25
|
this.getRandomInt(100) < 25
|
||||||
) {
|
) {
|
||||||
sendMessage({ type: MessageTypes.DisplayNPSSurvey });
|
sendMessage({ type: MessageTypes.DisplayNPSSurvey });
|
||||||
|
localStorage.setItem("lastSubmitted", Date.now().toString());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// An existing account is lesser than 90 days old. For existing account show to random 10 % of users in Data Explorer.
|
// An existing account is lesser than 90 days old. For existing account show to random 10 % of users in Data Explorer.
|
||||||
if (isAccountNewerThanNinetyDays) {
|
if (isAccountNewerThanNinetyDays) {
|
||||||
if (this.getRandomInt(100) < 10) {
|
if (this.getRandomInt(100) < 10) {
|
||||||
sendMessage({ type: MessageTypes.DisplayNPSSurvey });
|
sendMessage({ type: MessageTypes.DisplayNPSSurvey });
|
||||||
|
localStorage.setItem("lastSubmitted", Date.now().toString());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// An existing account is greater than 90 days. For existing account show to random 25 % of users in Data Explorer.
|
// 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) {
|
if (this.getRandomInt(100) < 25) {
|
||||||
sendMessage({ type: MessageTypes.DisplayNPSSurvey });
|
sendMessage({ type: MessageTypes.DisplayNPSSurvey });
|
||||||
|
localStorage.setItem("lastSubmitted", Date.now().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user