@genesislcap/pbc-reporting-ui 2.0.3 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  import { Connect } from '@genesislcap/foundation-comms';
2
2
  import { Genesis } from '../types';
3
+ export declare const tryReadFromSession: (key: string) => string;
3
4
  export declare const getEndpointUrl: (endpoint: string, urlRoot?: string) => string;
4
5
  export declare const getDatasourceSchema: (connect: Connect) => (resourceName: string) => Promise<Genesis.JSONSchema7>;
5
6
  //# sourceMappingURL=endpoint.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"endpoint.d.ts","sourceRoot":"","sources":["../../../../src/new/utils/endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,eAAO,MAAM,cAAc,aACf,MAAM,YACP,MAAM,KACd,MAWF,CAAC;AAEF,eAAO,MAAM,mBAAmB,YAAa,OAAO,oBAA0B,MAAM,iCAwBnF,CAAC"}
1
+ {"version":3,"file":"endpoint.d.ts","sourceRoot":"","sources":["../../../../src/new/utils/endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAW,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,eAAO,MAAM,kBAAkB,QAAS,MAAM,WAK7C,CAAC;AAEF,eAAO,MAAM,cAAc,aACf,MAAM,YACP,MAAM,KACd,MAWF,CAAC;AAEF,eAAO,MAAM,mBAAmB,YAAa,OAAO,oBAA0B,MAAM,iCAwBnF,CAAC"}
@@ -6,7 +6,7 @@ import { customElement, GenesisElement, html, observable } from '@genesislcap/we
6
6
  import { Permissions } from '../../types';
7
7
  import { permissionGuard, showNotificationToast } from '../../utils';
8
8
  import { getFilterParams } from '../../utils/date-filter-params';
9
- import { getEndpointUrl } from '../../utils/endpoint';
9
+ import { getEndpointUrl, tryReadFromSession } from '../../utils/endpoint';
10
10
  import { getFormattedDateTime } from '../../utils/formatters';
11
11
  import { buttonCellRenderer } from '../../utils/renderer';
12
12
  import { GeneratedReportsStyles as styles } from './generated-reports.styles';
@@ -159,7 +159,7 @@ let GeneratedReports = class GeneratedReports extends GenesisElement {
159
159
  }
160
160
  async downloadReport(fileStorageId) {
161
161
  const headers = new Headers();
162
- headers.append('SESSION_AUTH_TOKEN', sessionStorage.getItem('authToken') || '');
162
+ headers.append('SESSION_AUTH_TOKEN', tryReadFromSession('authToken'));
163
163
  const endpoint = getEndpointUrl(`file-server/download?fileStorageId=${fileStorageId}`);
164
164
  try {
165
165
  let filename;
@@ -1,4 +1,12 @@
1
- export const getEndpointUrl = (endpoint, urlRoot = sessionStorage.getItem('hostUrl') || '') => {
1
+ import { Session } from '@genesislcap/foundation-comms';
2
+ import { DI } from '@genesislcap/web-core';
3
+ export const tryReadFromSession = (key) => {
4
+ const container = DI.getOrCreateDOMContainer();
5
+ const session = container.get(Session);
6
+ // session.getSessionStorageItem accounts for namespaced storage
7
+ return session.getSessionStorageItem(key) || sessionStorage.getItem(key) || '';
8
+ };
9
+ export const getEndpointUrl = (endpoint, urlRoot = tryReadFromSession('hostUrl')) => {
2
10
  const url = new URL(urlRoot);
3
11
  const path = url.pathname && url.pathname[url.pathname.length - 1] == '/'
4
12
  ? url.pathname
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/pbc-reporting-ui",
3
3
  "description": "Genesis PBC Reporting UI",
4
- "version": "2.0.3",
4
+ "version": "2.0.4",
5
5
  "license": "SEE LICENSE IN license.txt",
6
6
  "main": "dist/esm/index.js",
7
7
  "types": "dist/dts/index.d.ts",