Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ability to get hash info for current app when suport case is opened #1072

Merged
merged 4 commits into from
Nov 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/js/createCase.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,19 @@ function registerProduct() {
return product?.name;
}

export function createSupportCase(userInfo, fields) {
async function getProductHash() {
const { store } = spinUpStore();

const currentApp = store.getState().chrome.appId;
const path = `${window.location.origin}${window.insights.chrome.isBeta() ? '/beta/' : '/'}apps/${currentApp}/app.info.json`;

const appData = await (await fetch(path)).json();
return `Current app: ${currentApp}, Current app hash: ${appData.src_hash}`;
}

export async function createSupportCase(userInfo, fields) {
const currentProduct = registerProduct();
const currentHash = await getProductHash();

log('Creating a support case');

Expand All @@ -49,6 +60,7 @@ export function createSupportCase(userInfo, fields) {
sessionDetails: {
createdBy: `${userInfo.user.username}`,
environment: `${window.insights.chrome.isBeta() ? 'Production Beta' : 'Production'}`,
description: `${currentHash}`,
...(currentProduct && { product: currentProduct }),
...fields?.caseFields,
},
Expand Down