feat: disable Giphy analytics to prevent beforeunload handlers (#16314)

This commit is contained in:
Zaid0412
2025-08-07 17:34:07 +03:00
committed by GitHub
parent d2e52d2c2a
commit dbe4e6a784
3 changed files with 18 additions and 15 deletions

16
giphy-analytics-stub.js Normal file
View File

@@ -0,0 +1,16 @@
// Stub replacement for @giphy/js-analytics to prevent beforeunload handlers
// This completely disables all Giphy analytics functionality
export const pingback = () => {
// Completely disabled - do nothing
};
export const mergeAttributes = (attributes, newAttributes) => {
// Return merged attributes without any analytics calls
return { ...attributes,
...newAttributes };
};
// Ensure no beforeunload handlers are ever registered
export default pingback;

View File

@@ -1,14 +0,0 @@
diff --git a/node_modules/@giphy/js-analytics/dist/send-pingback.js b/node_modules/@giphy/js-analytics/dist/send-pingback.js
index 989f0ff..52471cb 100644
--- a/node_modules/@giphy/js-analytics/dist/send-pingback.js
+++ b/node_modules/@giphy/js-analytics/dist/send-pingback.js
@@ -10,6 +10,9 @@ var global_1 = __importDefault(require("./global"));
var environment = (global_1.default === null || global_1.default === void 0 ? void 0 : global_1.default.GIPHY_PINGBACK_URL) || 'https://pingback.giphy.com';
var pingBackUrl = "".concat(environment, "/v2/pingback?apikey=l0HlIwPWyBBUDAUgM");
var sendPingback = function (events) {
+ // Disabled.
+ return Promise.resolve();
+
var headers = (0, js_util_1.getGiphySDKRequestHeaders)();
/* istanbul ignore next */
headers === null || headers === void 0 ? void 0 : headers.set('Content-Type', 'application/json');

View File

@@ -204,7 +204,8 @@ function getConfig(options = {}) {
].filter(Boolean),
resolve: {
alias: {
'focus-visible': 'focus-visible/dist/focus-visible.min.js'
'focus-visible': 'focus-visible/dist/focus-visible.min.js',
'@giphy/js-analytics': resolve(__dirname, 'giphy-analytics-stub.js')
},
aliasFields: [
'browser'