PromucFlow_constructor/app/client/public/index.html
Vemparala Surya Vamsi 7aa1c98efe
chore: added new relic OTLP exporter (#28480)
## Description
- Added new relic OTLP exporter to export eval traces, click event and
api calls.
- Conditionally loading both browser agent and OTLP scripts based on env
variables.

#### PR fixes following issue(s)
Fixes #28504 and #28506

#### Type of change
- Chore (housekeeping or task changes that don't impact user perception)

#### How Has This Been Tested?
- [x] Manual
- [ ] JUnit
- [ ] Jest
- [ ] Cypress
>
>
#### Test Plan
> Add Testsmith test cases links that relate to this PR
>
>
#### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
>
>
>
## Checklist:
#### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
2023-11-06 15:05:17 +05:30

319 lines
12 KiB
HTML
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<title>Appsmith</title>
<style>
#loader {
position: fixed;
left: 0;
top: 0;
height: 4px;
background: #d7d7d7;
transition: all ease-in 0.3s;
}
</style>
<script>
// '' (empty strings), 'false' are falsy
// could return either boolean or string based on value
const parseConfig = (config) => {
if (
config.indexOf("__") === 0 ||
config.indexOf("$") === 0 ||
config.indexOf("%") === 0
)
return "";
const result = config.trim();
if (result.toLowerCase() === "false" || result === "") {
return false;
} else if (result.toLowerCase() === "true") {
return true;
}
return result;
};
const CLOUD_HOSTING = parseConfig("__APPSMITH_CLOUD_HOSTING__");
const ZIPY_KEY = parseConfig("__APPSMITH_ZIPY_SDK_KEY__");
const AIRGAPPED = parseConfig("__APPSMITH_AIRGAP_ENABLED__");
// NREUM variable is required when we are we are are dynamically loading new relic browser agent script
NREUM = undefined
</script>
<script>
const enableNewRelic=parseConfig("__APPSMITH_NEW_RELIC_ACCOUNT_ENABLE__");
//only when newRelic is enabled do we load the browser agent script
if (!!enableNewRelic) {
const accountId = parseConfig("__APPSMITH_NEW_RELIC_ACCOUNT_ID__");
const applicationId = parseConfig("__APPSMITH_NEW_RELIC_APPLICATION_ID__");
const browserAgentlicenseKey = parseConfig("__APPSMITH_NEW_RELIC_BROWSER_AGENT_LICENSE_KEY__");
const script = document.createElement("script");
//we load the new relic browser agent script from our CDN.
script.src = "https://assets.appsmith.com/newRelicBrowserAgent1.js";
script.onload = () => {
// we have defined and init function within the Browser agent script.
// This init fn gets assigned to a global var called NEW_RELIC_BROWSER_AGENT, when the script tag element loads
// we call the init fn with all env vars. Through this step browser agent has the required license key to push telemetry info to new relic.
NEW_RELIC_BROWSER_AGENT && NEW_RELIC_BROWSER_AGENT.init([accountId,applicationId,browserAgentlicenseKey]);
};
const head = document.getElementsByTagName("head")[0];
head && head.appendChild(script);
}
</script>
<script>
window.__APPSMITH_CHUNKS_TO_PRELOAD =
<%=
(function () {
// This code emits URLs to be preloaded as soon as the main bundle loads.
// If you code-split away some files and need to preload them as well, heres how to do that:
// 1) Give your import a name (use the `webpackChunkName` comment: `import(/* webpackChunkName: "my-name" */ "./my-file")`)
// 2) Add the name into the `chunksToPreload` array below
let chunksToPreload = {
'edit-mode': [...getChunkUrls("editor"), ...getChunkUrls("global-search")],
'view-mode': getChunkUrls("AppViewer")
};
return JSON.stringify(chunksToPreload);
function getChunkUrls(chunkName) {
return compilation.namedChunkGroups.get(chunkName).chunks.flatMap(chunk => [...chunk.files]);
}
})()
%>
</script>
<script>
if (CLOUD_HOSTING && ZIPY_KEY) {
const script = document.createElement("script");
script.crossOrigin = "anonymous";
script.defer = true;
script.src = "https://cdn.zipy.ai/sdk/v1.0/zipy.min.umd.js";
script.onload = () => {
window.zipy && window.zipy.init(ZIPY_KEY);
};
const head = document.getElementsByTagName("head")[0];
head && head.appendChild(script);
}
// This function is triggered on load of google apis javascript library
// Even though the script is loaded asynchronously, in case of firefox run on windows
// The gapi script is getting loaded even before the last script of index.html
// Hence defining this function before loading gapi
// For more info: https://github.com/appsmithorg/appsmith/issues/21033
const gapiLoaded = () => {
window.googleAPIsLoaded = true;
};
const onError = () => {
window.googleAPIsLoaded = false;
};
if (!AIRGAPPED) {
// Adding this Library to access google file picker API in case of limiting google sheet access
const script2 = document.createElement("script");
script2.crossOrigin = "anonymous";
script2.async = true;
script2.defer = true;
script2.src = "https://apis.google.com/js/api.js";
script2.id = "googleapis";
script2.onload = () => {
gapiLoaded();
};
script2.onerror = () => {
onError();
};
const headElement = document.getElementsByTagName("head")[0];
headElement && headElement.appendChild(script2);
}
</script>
</head>
<body class="appsmith-light-theme">
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="loader" style="width: 30vw"></div>
<!--
To keep zIndex for tooltips higher than app comments, todo remove when migrating to Tooltip2
Currently the className does not apply to the portal root, so we're unable to work with z-indexes based on that
-->
<div id="header-root"></div>
<div id="root"></div>
<div
id="date-picker-control"
style="position: relative; z-index: 1000"
></div>
<script type="text/javascript">
// Ref: https://github.com/Modernizr/Modernizr/blob/94592f279a410436530c7c06acc42a6e90c20150/feature-detects/storage/localstorage.js
const getIsLocalStorageSupported = () => {
try {
window.localStorage.setItem("test", "testA");
window.localStorage.removeItem("test");
return true;
} catch (e) {
return false;
}
};
const isLocalStorageSupported = getIsLocalStorageSupported();
const handleLocalStorageNotSupportedError = () => {
console.error("Localstorage storage is not supported on your device.");
};
const localStorageUtil = {
getItem: (key) => {
if (!isLocalStorageSupported) {
handleLocalStorageNotSupportedError();
return;
}
return window.localStorage.getItem(key);
},
removeItem: (key) => {
if (!isLocalStorageSupported) {
handleLocalStorageNotSupportedError();
return;
}
return window.localStorage.removeItem(key);
},
setItem: (key, value) => {
if (!isLocalStorageSupported) {
handleLocalStorageNotSupportedError();
return;
}
return window.localStorage.setItem(key, value);
},
};
window.addEventListener("DOMContentLoaded", (event) => {
document.getElementById("loader").style.width = "50vw";
});
const registerPageServiceWorker = () => {
if (
"serviceWorker" in navigator &&
// Disable the service worker in Cypress tests. We primarily do this to make
// the Performance/LinkRelPreload_Spec.js test work (as it collects URLs all network requests,
// and service worker requests fail it.) But, anecdotally, disabling the service worker
// also seems to make the tests a bit faster, as the network load is lower.
!window.Cypress
) {
window.addEventListener("load", function () {
navigator.serviceWorker
.register("/pageService.js")
.catch((error) => {
console.error("Service Worker Registration failed: " + error);
});
});
}
};
registerPageServiceWorker();
</script>
<script type="text/javascript">
const LOG_LEVELS = ["debug", "error"];
const CONFIG_LOG_LEVEL_INDEX = LOG_LEVELS.indexOf(
parseConfig("__APPSMITH_CLIENT_LOG_LEVEL__"),
);
const INTERCOM_APP_ID =
parseConfig("%REACT_APP_INTERCOM_APP_ID%") ||
parseConfig("__APPSMITH_INTERCOM_APP_ID__");
const DISABLE_INTERCOM = parseConfig("__APPSMITH_DISABLE_INTERCOM__");
// Initialize the Intercom library
if (INTERCOM_APP_ID.length && !DISABLE_INTERCOM) {
(function () {
var w = window;
var ic = w.Intercom;
if (typeof ic === "function") {
ic("reattach_activator");
ic("update", w.intercomSettings);
} else {
var d = document;
var i = function () {
i.c(arguments);
};
i.q = [];
i.c = function (args) {
i.q.push(args);
};
w.Intercom = i;
var l = function () {
var s = d.createElement("script");
s.type = "text/javascript";
s.async = true;
s.src = "https://widget.intercom.io/widget/" + INTERCOM_APP_ID;
var x = d.getElementsByTagName("script")[0];
x.parentNode.insertBefore(s, x);
};
if (document.readyState === "complete") {
l();
} else if (w.attachEvent) {
w.attachEvent("onload", l);
} else {
w.addEventListener("load", l, false);
}
}
})();
}
window.SENTRY_CONFIG = parseConfig("__APPSMITH_SENTRY_DSN__");
window.APPSMITH_FEATURE_CONFIGS = {
sentry: {
dsn: parseConfig("__APPSMITH_SENTRY_DSN__"),
release: parseConfig("__APPSMITH_SENTRY_RELEASE__"),
environment: parseConfig("__APPSMITH_SENTRY_ENVIRONMENT__"),
},
smartLook: {
id: parseConfig("__APPSMITH_SMART_LOOK_ID__"),
},
enableRapidAPI: parseConfig("__APPSMITH_MARKETPLACE_ENABLED__"),
segment: {
apiKey: parseConfig("__APPSMITH_SEGMENT_KEY__"),
ceKey: parseConfig("__APPSMITH_SEGMENT_CE_KEY__"),
},
newRelic:{
enableNewRelic: parseConfig("__APPSMITH_NEW_RELIC_ACCOUNT_ENABLE__"),
accountId: parseConfig("__APPSMITH_NEW_RELIC_ACCOUNT_ID__"),
applicationId: parseConfig("__APPSMITH_NEW_RELIC_APPLICATION_ID__"),
browserAgentlicenseKey: parseConfig("__APPSMITH_NEW_RELIC_BROWSER_AGENT_LICENSE_KEY__"),
otlpLicenseKey: parseConfig("__APPSMITH_NEW_RELIC_OTLP_LICENSE_KEY__"),
},
fusioncharts: {
licenseKey: parseConfig("__APPSMITH_FUSIONCHARTS_LICENSE_KEY__"),
},
enableMixpanel: parseConfig("__APPSMITH_SEGMENT_KEY__"),
algolia: {
apiId: parseConfig("__APPSMITH_ALGOLIA_API_ID__"),
apiKey: parseConfig("__APPSMITH_ALGOLIA_API_KEY__"),
indexName: parseConfig("__APPSMITH_ALGOLIA_SEARCH_INDEX_NAME__"),
},
logLevel:
CONFIG_LOG_LEVEL_INDEX > -1
? LOG_LEVELS[CONFIG_LOG_LEVEL_INDEX]
: LOG_LEVELS[1],
cloudHosting: CLOUD_HOSTING,
enableTNCPP: parseConfig("__APPSMITH_TNC_PP__"),
appVersion: {
id: parseConfig("__APPSMITH_VERSION_ID__"),
releaseDate: parseConfig("__APPSMITH_VERSION_RELEASE_DATE__"),
},
intercomAppID: INTERCOM_APP_ID,
mailEnabled: parseConfig("__APPSMITH_MAIL_ENABLED__"),
cloudServicesBaseUrl:
parseConfig("__APPSMITH_CLOUD_SERVICES_BASE_URL__") ||
"https://cs.appsmith.com",
googleRecaptchaSiteKey: parseConfig("__APPSMITH_RECAPTCHA_SITE_KEY__"),
hideWatermark: parseConfig("__APPSMITH_HIDE_WATERMARK__"),
disableIframeWidgetSandbox: parseConfig(
"__APPSMITH_DISABLE_IFRAME_WIDGET_SANDBOX__",
),
customerPortalUrl:
parseConfig("__APPSMITH_CUSTOMER_PORTAL_URL__") ||
"https://customer.appsmith.com",
pricingUrl:
parseConfig("__APPSMITH_PRICING_URL__") ||
"https://www.appsmith.com/pricing",
};
</script>
</body>
</html>