aws-observability / aws-rum-web

Amazon CloudWatch RUM Web Client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`PageAttributes` is not exported from root.

quisido opened this issue · comments

recordPageView accepts a PageAttributes parameter, but the PageAttributes type is not exported by aws-rum-web.

In order to either (1) wrap this function or (2) initialize the payload ahead of time, the PageAttributes type needs to be exposed.

Example 1: wrapping the function

function myRecordPageView(payload: PageAttributes | string): void {
  myCustomHandler(payload);
  cwr.recordPageView(payload);
}

Example 2: Initializing the payload ahead of time.

const payload: PageAttributes = {
  pageId: 'test-page-id',
  pageAttributes: {},
};

for (const [key, value] of Object.entries(window.location)) {
  if (typeof value !== 'string') {
    continue;
  }
  payload.pageAttributes[key] = value;
}

cwr.recordPageView(payload);

Both scenarios would be unblocked by allowing:

import type { PageAttributes } from 'aws-rum-web';

Thanks for the report @CharlesStover! Sorry about the wait.