export function getDesktopDashboardLink()

in lib/messageUtils.ts [256:309]


export function getDesktopDashboardLink(
  template: string,
  msgId: string,
  channel?: string,
  experiment?: string,
  branchSlug?: string,
  startDate?: string | null,
  endDate?: string | null,
  isCompleted?: boolean,
): string | undefined {
  // The isCompleted value can be useful for messages that used to be in remote
  // settings or old versions of Firefox.
  const submissionDate = getLookerSubmissionTimestampDateFilter(
    startDate,
    endDate,
    isCompleted,
  );
  const dashboardId = getDashboardIdForSurface(template);
  let baseUrl = `https://mozilla.cloud.looker.com/dashboards/${dashboardId}`;
  let paramObj;

  if (_isAboutWelcomeTemplate(template)) {
    paramObj = {
      "Submission Timestamp Date": submissionDate,
      "Message ID": `%${msgId}%`,
      "Normalized Channel": channel ? channel : "",
      Experiment: experiment ? experiment : "",
      Branch: branchSlug ? branchSlug : "",
    };
  }

  if (template === "infobar") {
    paramObj = {
      "Messaging System Ping Type": template,
      "Submission Date": submissionDate,
      "Messaging System Message Id": msgId,
      "Normalized Channel": channel ? channel : "",
      "Normalized OS": "",
      "Client Info App Display Version": "",
      "Normalized Country Code": "",
      Experiment: experiment ? experiment : "",
      "Experiment Branch": branchSlug ? branchSlug : "",
    };
  }

  if (paramObj) {
    const params = new URLSearchParams(Object.entries(paramObj));
    let url = new URL(baseUrl);
    url.search = params.toString();
    return url.toString();
  }

  return undefined;
}