Skip to content

Commit c26570f

Browse files
antonisclaude
andauthored
feat(core): Track shake to report integration usage (#5929)
* feat(core): Track shake to report integration usage Add a lazy-loaded ShakeToReport marker integration to track when the shake-to-report feedback feature is enabled, following the same pattern used by AutoInjectMobileFeedback and other feedback marker integrations. Closes #5897 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Fix lint issue --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 43f4002 commit c26570f

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

packages/core/src/js/feedback/FeedbackWidgetManager.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
lazyLoadAutoInjectFeedbackButtonIntegration,
66
lazyLoadAutoInjectFeedbackIntegration,
77
lazyLoadAutoInjectScreenshotButtonIntegration,
8+
lazyLoadShakeToReportIntegration,
89
} from './lazy';
910
import { startShakeListener, stopShakeListener } from './ShakeToReportBug';
1011

@@ -146,6 +147,7 @@ let _imperativeShakeListenerStarted = false;
146147

147148
const enableFeedbackOnShake = (): void => {
148149
lazyLoadAutoInjectFeedbackIntegration();
150+
lazyLoadShakeToReportIntegration();
149151
if (!_imperativeShakeListenerStarted) {
150152
_imperativeShakeListenerStarted = startShakeListener(showFeedbackWidget);
151153
}

packages/core/src/js/feedback/FeedbackWidgetProvider.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {
3737
getScreenshotButtonOptions,
3838
isShakeToReportEnabled,
3939
} from './integration';
40+
import { lazyLoadShakeToReportIntegration } from './lazy';
4041
import { ScreenshotButton } from './ScreenshotButton';
4142
import { startShakeListener, stopShakeListener } from './ShakeToReportBug';
4243
import { isModalSupported, isNativeDriverSupportedForColorAnimations } from './utils';
@@ -123,6 +124,7 @@ export class FeedbackWidgetProvider extends React.Component<FeedbackWidgetProvid
123124
});
124125

125126
if (isShakeToReportEnabled()) {
127+
lazyLoadShakeToReportIntegration();
126128
this._startedShakeListener = startShakeListener(showFeedbackWidget);
127129
}
128130
}

packages/core/src/js/feedback/lazy.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,19 @@ export function lazyLoadAutoInjectFeedbackButtonIntegration(): void {
3939
}
4040
}
4141

42+
export const SHAKE_TO_REPORT_INTEGRATION_NAME = 'ShakeToReport';
43+
44+
/**
45+
* Lazy loads the shake to report integration if it is not already loaded.
46+
*/
47+
export function lazyLoadShakeToReportIntegration(): void {
48+
const integration = getClient()?.getIntegrationByName(SHAKE_TO_REPORT_INTEGRATION_NAME);
49+
if (!integration) {
50+
// Lazy load the integration to track usage
51+
getClient()?.addIntegration({ name: SHAKE_TO_REPORT_INTEGRATION_NAME });
52+
}
53+
}
54+
4255
export const AUTO_INJECT_SCREENSHOT_BUTTON_INTEGRATION_NAME = 'AutoInjectMobileScreenshotButton';
4356

4457
/**

0 commit comments

Comments
 (0)