-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[POR-1973] intercom pop up on provisioning pre-flight check and v2 up…
…date errors (#3830)
- Loading branch information
Feroze Mohideen
authored
Oct 18, 2023
1 parent
4887989
commit 6539bcc
Showing
10 changed files
with
69 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// useIntercom contains all the utility methods related to the Intercom chat widget | ||
export const useIntercom = () => { | ||
const showIntercomWithMessageAfterDelay = (message: string, delaySeconds: number) => { | ||
const func = () => { | ||
if (typeof window.Intercom === 'function') { | ||
window.Intercom('showNewMessage', message); | ||
} | ||
} | ||
setTimeout(func, delaySeconds * 1000); | ||
} | ||
|
||
const showIntercomWithMessage = ({ message, delaySeconds = 3 }: { message: string, delaySeconds?: number }) => { | ||
showIntercomWithMessageAfterDelay(message, delaySeconds); | ||
} | ||
|
||
return { | ||
showIntercomWithMessage, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,7 @@ import axios from "axios"; | |
import HelmEditorTab from "./tabs/HelmEditorTab"; | ||
import HelmLatestValuesTab from "./tabs/HelmLatestValuesTab"; | ||
import { Context } from "shared/Context"; | ||
import { useIntercom } from "lib/hooks/useIntercom"; | ||
|
||
// commented out tabs are not yet implemented | ||
// will be included as support is available based on data from app revisions rather than helm releases | ||
|
@@ -83,6 +84,7 @@ const AppDataContainer: React.FC<AppDataContainerProps> = ({ tabParam }) => { | |
const { currentProject, user } = useContext(Context); | ||
|
||
const { updateAppStep } = useAppAnalytics(); | ||
const { showIntercomWithMessage } = useIntercom(); | ||
|
||
const { | ||
porterApp: porterAppRecord, | ||
|
@@ -305,6 +307,8 @@ const AppDataContainer: React.FC<AppDataContainerProps> = ({ tabParam }) => { | |
// redirect to the default tab after save | ||
history.push(`/apps/${porterAppRecord.name}/${DEFAULT_TAB}`); | ||
} catch (err) { | ||
showIntercomWithMessage({ message: "I am running into an issue updating my application." }); | ||
|
||
let message = | ||
"App update failed: please try again or contact [email protected] if the error persists."; | ||
let stack = "Unable to get error stack"; | ||
|
@@ -382,7 +386,6 @@ const AppDataContainer: React.FC<AppDataContainerProps> = ({ tabParam }) => { | |
const errorKeys = Object.keys(errors); | ||
if (errorKeys.length > 0) { | ||
const stringifiedJson = JSON.stringify(errors); | ||
|
||
let errorMessage = | ||
"App update failed. Please try again. If the error persists, please contact [email protected]."; | ||
if (errorKeys.includes("app")) { | ||
|
@@ -411,6 +414,7 @@ const AppDataContainer: React.FC<AppDataContainerProps> = ({ tabParam }) => { | |
} | ||
} | ||
|
||
showIntercomWithMessage({ message: "I am running into an issue updating my application." }); | ||
updateAppStep({ | ||
step: "porter-app-update-failure", | ||
errorMessage: `Form validation error (visible to user): ${errorMessage}. Stringified JSON errors (invisible to user): ${stringifiedJson}`, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters