Skip to content

Commit

Permalink
Do not show welcome banner in non-us orgs (#725)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyaginidhi authored Sep 28, 2023
1 parent 8bb5a03 commit 91823a7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/common/copilot/PowerPagesCopilot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,21 @@ export class PowerPagesCopilot implements vscode.WebviewViewProvider {
const pacOutput = await this._pacWrapper?.activeOrg();

if (pacOutput && pacOutput.Status === PAC_SUCCESS) {
this.handleOrgChangeSuccess(pacOutput.Results);
await this.handleOrgChangeSuccess(pacOutput.Results);
} else if (!IS_DESKTOP && orgID && activeOrgUrl) {
this.handleOrgChangeSuccess({ OrgId: orgID, UserId: userID, OrgUrl: activeOrgUrl } as ActiveOrgOutput);
await this.handleOrgChangeSuccess({ OrgId: orgID, UserId: userID, OrgUrl: activeOrgUrl } as ActiveOrgOutput);
}

webviewView.webview.html = this._getHtmlForWebview(webviewView.webview);

webviewView.webview.onDidReceiveMessage(async (data) => {
switch (data.type) {
case "webViewLoaded": {
if (this.aibEndpoint === COPILOT_UNAVAILABLE) {
this.sendMessageToWebview({ type: 'Unavailable' });
return;
}

sendTelemetryEvent(this.telemetry, { eventName: CopilotLoadedEvent, copilotSessionId: sessionID, orgId: orgID });
this.sendMessageToWebview({ type: 'env' }); //TODO Use IS_DESKTOP
await this.checkAuthentication();
Expand Down Expand Up @@ -327,7 +332,7 @@ export class PowerPagesCopilot implements vscode.WebviewViewProvider {

this.aibEndpoint = await getIntelligenceEndpoint(orgID, this.telemetry, sessionID);
if (this.aibEndpoint === COPILOT_UNAVAILABLE) {
sendTelemetryEvent(this.telemetry, {eventName: CopilotNotAvailable, copilotSessionId: sessionID, orgId: orgID});
sendTelemetryEvent(this.telemetry, { eventName: CopilotNotAvailable, copilotSessionId: sessionID, orgId: orgID });
this.sendMessageToWebview({ type: 'Unavailable' });
} else {
this.sendMessageToWebview({ type: 'Available' });
Expand Down

0 comments on commit 91823a7

Please sign in to comment.