Do not unpack arguments directly on exported items

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2021-12-07 19:42:10 +01:00
parent 95ab7baba6
commit dcd1a0c3f4
66 changed files with 433 additions and 708 deletions
+1 -7
View File
@@ -17,13 +17,7 @@ export const analyticsModuleGA: BackstagePlugin<{}, {}>;
//
// @public
export class GoogleAnalytics implements AnalyticsApi {
captureEvent({
context,
action,
subject,
value,
attributes,
}: AnalyticsEvent): void;
captureEvent(event: AnalyticsEvent): void;
static fromConfig(config: Config): GoogleAnalytics;
}
@@ -39,19 +39,15 @@ export class GoogleAnalytics implements AnalyticsApi {
/**
* Instantiate the implementation and initialize ReactGA.
*/
private constructor({
cdmConfig,
trackingId,
scriptSrc,
testMode,
debug,
}: {
private constructor(options: {
cdmConfig: CustomDimensionOrMetricConfig[];
trackingId: string;
scriptSrc?: string;
testMode: boolean;
debug: boolean;
}) {
const { cdmConfig, trackingId, scriptSrc, testMode, debug } = options;
this.cdmConfig = cdmConfig;
// Initialize Google Analytics.
@@ -102,13 +98,8 @@ export class GoogleAnalytics implements AnalyticsApi {
* pageview and the rest as custom events. All custom dimensions/metrics are
* applied as they should be (set on pageview, merged object on events).
*/
captureEvent({
context,
action,
subject,
value,
attributes,
}: AnalyticsEvent) {
captureEvent(event: AnalyticsEvent) {
const { context, action, subject, value, attributes } = event;
const customMetadata = this.getCustomDimensionMetrics(context, attributes);
if (action === 'navigate' && context.extension === 'App') {