@amedia/user 0.13.29 → 0.13.31

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.
@@ -0,0 +1,15 @@
1
+ import { CacheEntry } from '../src/cache/types';
2
+
3
+ declare global {
4
+ interface Window {
5
+ amediaUserCache?: { [index: string]: CacheEntry };
6
+ }
7
+
8
+ namespace NodeJS {
9
+ interface Global {
10
+ amediaUserCache?: { [index: string]: CacheEntry };
11
+ }
12
+ }
13
+
14
+ export var amediaUserCache: { [index: string]: CacheEntry };
15
+ }
@@ -2,3 +2,6 @@ export declare const requestStorage: (namespaces: string[]) => void;
2
2
  export declare const updateStorage: (storage: {
3
3
  [namespace: string]: object;
4
4
  }) => void;
5
+ export declare const saveStorage: (storage: {
6
+ [namespace: string]: object;
7
+ }) => void;
@@ -1,18 +1,4 @@
1
1
  import { CacheEntry, Engine } from '../types';
2
- declare global {
3
- interface Window {
4
- amediaUserCache?: {
5
- [index: string]: CacheEntry;
6
- };
7
- }
8
- namespace NodeJS {
9
- interface Global {
10
- amediaUserCache?: {
11
- [index: string]: CacheEntry;
12
- };
13
- }
14
- }
15
- }
16
2
  export declare const get: (key: string) => Promise<CacheEntry>;
17
3
  export declare const set: (key: string, data: unknown, expires: number) => Promise<void>;
18
4
  export declare const remove: (key: string) => Promise<void>;
@@ -3,7 +3,8 @@ export declare enum AmediaUserEvents {
3
3
  REQUEST_STATE = "amedia-user.request-state",
4
4
  REQUEST_USER_ATTRIBUTES = "amedia-user.request-user-attributes",
5
5
  REQUEST_STORAGE_NAMESPACES = "amedia-user.request-storage-namespaces",
6
- UPDATE_STORAGE = "amedua-user.update-storage-namespaces",
6
+ SAVE_STORAGE = "amedia-user.save-storage-namespaces",
7
+ UPDATE_STORAGE = "amedia-user.update-storage-namespaces",
7
8
  ON_ATTRIBUTES_UPDATED = "amedia-user.on-user-attributes-updated",
8
9
  ON_STATE_UPDATED = "amedia-user.on-state-updated",
9
10
  ON_STORAGE_UPDATED = "amedia-user.on-storage-updated"
@@ -13,6 +14,9 @@ declare global {
13
14
  [AmediaUserEvents.REQUEST_STATE]: CustomEvent;
14
15
  [AmediaUserEvents.REQUEST_USER_ATTRIBUTES]: CustomEvent<Array<keyof UserAttributes>>;
15
16
  [AmediaUserEvents.REQUEST_STORAGE_NAMESPACES]: CustomEvent<Array<string>>;
17
+ [AmediaUserEvents.SAVE_STORAGE]: CustomEvent<{
18
+ [namespace: string]: object;
19
+ }>;
16
20
  [AmediaUserEvents.UPDATE_STORAGE]: CustomEvent<{
17
21
  [namespace: string]: object;
18
22
  }>;
package/dist/index.d.ts CHANGED
@@ -57,6 +57,9 @@ declare module '@amedia/user/actions/storage' {
57
57
  export const updateStorage: (storage: {
58
58
  [namespace: string]: object;
59
59
  }) => void;
60
+ export const saveStorage: (storage: {
61
+ [namespace: string]: object;
62
+ }) => void;
60
63
 
61
64
  }
62
65
  declare module '@amedia/user/actions/userData' {
@@ -97,20 +100,6 @@ declare module '@amedia/user/autologin/thirdPartyCookie.spec' {
97
100
  }
98
101
  declare module '@amedia/user/cache/engines/global' {
99
102
  import { CacheEntry, Engine } from '@amedia/user/cache/types';
100
- global {
101
- interface Window {
102
- amediaUserCache?: {
103
- [index: string]: CacheEntry;
104
- };
105
- }
106
- namespace NodeJS {
107
- interface Global {
108
- amediaUserCache?: {
109
- [index: string]: CacheEntry;
110
- };
111
- }
112
- }
113
- }
114
103
  export const get: (key: string) => Promise<CacheEntry>;
115
104
  export const set: (key: string, data: unknown, expires: number) => Promise<void>;
116
105
  export const remove: (key: string) => Promise<void>;
@@ -321,7 +310,8 @@ declare module '@amedia/user/eventHandlers/eventMap' {
321
310
  REQUEST_STATE = "amedia-user.request-state",
322
311
  REQUEST_USER_ATTRIBUTES = "amedia-user.request-user-attributes",
323
312
  REQUEST_STORAGE_NAMESPACES = "amedia-user.request-storage-namespaces",
324
- UPDATE_STORAGE = "amedua-user.update-storage-namespaces",
313
+ SAVE_STORAGE = "amedia-user.save-storage-namespaces",
314
+ UPDATE_STORAGE = "amedia-user.update-storage-namespaces",
325
315
  ON_ATTRIBUTES_UPDATED = "amedia-user.on-user-attributes-updated",
326
316
  ON_STATE_UPDATED = "amedia-user.on-state-updated",
327
317
  ON_STORAGE_UPDATED = "amedia-user.on-storage-updated"
@@ -331,6 +321,9 @@ declare module '@amedia/user/eventHandlers/eventMap' {
331
321
  [AmediaUserEvents.REQUEST_STATE]: CustomEvent;
332
322
  [AmediaUserEvents.REQUEST_USER_ATTRIBUTES]: CustomEvent<Array<keyof UserAttributes>>;
333
323
  [AmediaUserEvents.REQUEST_STORAGE_NAMESPACES]: CustomEvent<Array<string>>;
324
+ [AmediaUserEvents.SAVE_STORAGE]: CustomEvent<{
325
+ [namespace: string]: object;
326
+ }>;
334
327
  [AmediaUserEvents.UPDATE_STORAGE]: CustomEvent<{
335
328
  [namespace: string]: object;
336
329
  }>;
@@ -426,6 +419,9 @@ declare module '@amedia/user/index' {
426
419
  export const updateStorage: (storage: {
427
420
  [index: string]: Object;
428
421
  }) => void;
422
+ export const saveStorage: (storage: {
423
+ [index: string]: Object;
424
+ }) => void;
429
425
 
430
426
  }
431
427
  declare module '@amedia/user/janitor/index' {
@@ -606,7 +602,7 @@ declare module '@amedia/user/types' {
606
602
 
607
603
  }
608
604
  declare module '@amedia/user/utils/customEventWrapper' {
609
- let rootElement: Window | Element;
605
+ let rootElement: Window | Element | typeof globalThis;
610
606
  export const setRootElement: (element: typeof rootElement) => void;
611
607
  /**
612
608
  * This listener MUST be used by all listeners in ../eventHandlers