@unitedstatespowersquadrons/components 1.2.11 → 1.2.13

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.
package/Reducer/types.ts CHANGED
@@ -21,7 +21,12 @@ export interface GenericAppAction {
21
21
  type: string;
22
22
  }
23
23
 
24
- export type CableAction = { data: object; type: "receivedCable" };
24
+ interface CableData {
25
+ toasts?: Toast[];
26
+ dismissToast?: number;
27
+ [key: string]: unknown;
28
+ }
29
+ export type CableAction = { data: CableData; type: "receivedCable" };
25
30
 
26
31
  export type RailsAppAction<R extends RailsResponse = RailsResponse> =
27
32
  | { type: "saveComplete"; res: R }
@@ -19,13 +19,13 @@ export function handleToasts<T extends AppStateWithToasts>(draft: Draft<T>, toas
19
19
  }
20
20
 
21
21
  export function addToast<T extends AppStateWithToasts>(draft: Draft<T>, toastOptions: Toast) {
22
- const { body, status, timeout, title } = toastOptions;
22
+ const { body, id, status, timeout, title } = toastOptions;
23
23
 
24
24
  // Increment current toastId to prevent collisions
25
- const id = draft.toastId ? draft.toastId + 1 : 1;
26
- draft.toastId = id;
25
+ const toastId = draft.toastId ? draft.toastId + 1 : 1;
26
+ draft.toastId = toastId;
27
27
 
28
- const toast = { body, id, status, timeout, title } as ToastProps;
28
+ const toast = { body, id: id || toastId, status, timeout, title } as ToastProps;
29
29
 
30
30
  // Initialize toasts array if not provided by the server
31
31
  if (!draft.toasts) draft.toasts = [];
package/Toasts/types.ts CHANGED
@@ -12,6 +12,7 @@ export type ToastAppAction =
12
12
  | ToastRemoveAppAction;
13
13
 
14
14
  export interface Toast {
15
+ id?: number;
15
16
  status: Toast_Status;
16
17
  title: string;
17
18
  body: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unitedstatespowersquadrons/components",
3
- "version": "1.2.11",
3
+ "version": "1.2.13",
4
4
  "description": "USPS shared React components library",
5
5
  "main": "index.tsx",
6
6
  "scripts": {