@elliemae/pui-app-sdk 5.17.2 → 5.17.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.
@@ -22,8 +22,10 @@ __export(loginParams_exports, {
22
22
  setLoginParams: () => setLoginParams
23
23
  });
24
24
  module.exports = __toCommonJS(loginParams_exports);
25
- let loginParams;
26
25
  const setLoginParams = (params) => {
27
- loginParams = { redirectUri: new URL(window.location.href).href, ...params };
26
+ window.emui.loginParams = {
27
+ redirectUri: new URL(window.location.href).href,
28
+ ...params
29
+ };
28
30
  };
29
- const getLoginParams = () => loginParams;
31
+ const getLoginParams = () => window.emui.loginParams;
@@ -75,13 +75,21 @@ function ImmutableArgs(_target, _propertyKey, descriptor) {
75
75
  function Memoize(_target, _key, descriptor) {
76
76
  const originalMethod = descriptor.value;
77
77
  const cache = /* @__PURE__ */ new Map();
78
+ const maxSize = 500;
78
79
  descriptor.value = function value(...args) {
79
80
  const key = JSON.stringify(args);
80
81
  if (cache.has(key)) {
81
- return cache.get(key);
82
+ const cacheValue = cache.get(key);
83
+ cache.delete(key);
84
+ cache.set(key, cacheValue);
85
+ return cacheValue;
82
86
  }
83
87
  const result = originalMethod.call(this, ...args);
84
88
  cache.set(key, result);
89
+ if (cache.size > maxSize) {
90
+ const firstKey = cache.keys().next().value;
91
+ cache.delete(firstKey);
92
+ }
85
93
  return result;
86
94
  };
87
95
  }
@@ -1,8 +1,10 @@
1
- let loginParams;
2
1
  const setLoginParams = (params) => {
3
- loginParams = { redirectUri: new URL(window.location.href).href, ...params };
2
+ window.emui.loginParams = {
3
+ redirectUri: new URL(window.location.href).href,
4
+ ...params
5
+ };
4
6
  };
5
- const getLoginParams = () => loginParams;
7
+ const getLoginParams = () => window.emui.loginParams;
6
8
  export {
7
9
  getLoginParams,
8
10
  setLoginParams
@@ -46,13 +46,21 @@ function ImmutableArgs(_target, _propertyKey, descriptor) {
46
46
  function Memoize(_target, _key, descriptor) {
47
47
  const originalMethod = descriptor.value;
48
48
  const cache = /* @__PURE__ */ new Map();
49
+ const maxSize = 500;
49
50
  descriptor.value = function value(...args) {
50
51
  const key = JSON.stringify(args);
51
52
  if (cache.has(key)) {
52
- return cache.get(key);
53
+ const cacheValue = cache.get(key);
54
+ cache.delete(key);
55
+ cache.set(key, cacheValue);
56
+ return cacheValue;
53
57
  }
54
58
  const result = originalMethod.call(this, ...args);
55
59
  cache.set(key, result);
60
+ if (cache.size > maxSize) {
61
+ const firstKey = cache.keys().next().value;
62
+ cache.delete(firstKey);
63
+ }
56
64
  return result;
57
65
  };
58
66
  }
@@ -1,11 +1,5 @@
1
- type LoginParams = {
2
- clientId: string;
3
- scope: string;
4
- responseType: string;
5
- redirectUri: string;
6
- };
1
+ import { LoginParams } from './types';
7
2
  export declare const setLoginParams: (params: Omit<LoginParams, "redirectUri"> & {
8
3
  redirectUri?: string;
9
4
  }) => void;
10
5
  export declare const getLoginParams: () => LoginParams;
11
- export {};
@@ -6,3 +6,9 @@ export type EndSessionFn = (params: {
6
6
  code?: string;
7
7
  skipRevoke?: boolean;
8
8
  }) => Promise<void>;
9
+ export type LoginParams = {
10
+ clientId: string;
11
+ scope: string;
12
+ responseType: string;
13
+ redirectUri: string;
14
+ };
@@ -1,6 +1,7 @@
1
1
  import { IMicroAppGuest, IMicroAppHost, BAEvent } from '@elliemae/pui-micro-frontend-base';
2
2
  import { BreakPoint } from '@elliemae/pui-theme';
3
3
  import { Logger } from '@elliemae/pui-diagnostics';
4
+ import { LoginParams } from './auth/types';
4
5
  export type EMUI = {
5
6
  [key: string]: IMicroAppGuest | IMicroAppGuest[];
6
7
  } & {
@@ -12,6 +13,7 @@ export type EMUI = {
12
13
  appId: string;
13
14
  uuid: string;
14
15
  app?: IMicroAppGuest;
16
+ loginParams: LoginParams;
15
17
  };
16
18
  declare global {
17
19
  interface Window {