@apia/notifications 0.3.0 → 0.3.3

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/LICENSE.md CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) [year] [fullname]
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ MIT License
2
+
3
+ Copyright (c) [year] [fullname]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
package/README.md CHANGED
@@ -1,28 +1,28 @@
1
- # Initiator
2
-
3
- Este package se creó con la única utilidad de copiarlo entero y pegarlo a la hora de crear un nuevo package.
4
-
5
- Este iniciador permite crear un paquete que compila typescript y puede ser importado desde otros packages.
6
-
7
- ## IMPORTANTE
8
-
9
- Los archivos **tsconfig.json** y **tsup.config.ts** no son archivos únicos sino symlinks a archivos de configuración comunes a todos los packages. En caso de que sea necesario modificar alguno de ellos **que en la gran mayoría de los casos no sería necesario**, es necesario eliminar el archivo a modificar y crear uno nuevo.
10
-
11
- ## Procedimiento
12
-
13
- - Copiar la carpeta initiator y pegarla con otro nombre dentro de packages.
14
- - Modificar el package.json:
15
- - Eliminar la línea ```private: true```.
16
- - Cambiar la ocurrencia `initiator` por el nombre del nuevo paquete.
17
- - Agregar los scripts convenientes: dev, build, etc.
18
- - Ejecutar el comando lerna bootstrap desde la carpeta raíz.
19
-
20
- Luego de ejecutar estos pasos, el package estaría listo para comenzar a usarse.
21
-
22
- Este package trae como dependencias por defecto theme-ui y react. Si se desea agregar más dependencias se debe ejecutar el comando ```lerna add --scope="@apia/packageName" dependencyName```. Ejemplo, si creamos un paquete con el nombre @apia/myPackage y queremos agregar lodash-es como dependencia, ejecutamos el comando ```lerna add --scope="@apia/myPackage" lodash-es```.
23
-
24
- **Importante 1**: Dado que estamos desarrollando packages, es importante determinar si las dependencias que vamos a agregar son de tipo dependency o de tipo peerDependency.
25
-
26
- **Importante 2**: lerna no permite instalar de a varias dependencias a la vez como lo hace npm, por lo tanto, si se desea agregar varias dependencias se debe ejecutar el comando anterior tantas veces como dependencias se quiera agregar.
27
-
1
+ # Initiator
2
+
3
+ Este package se creó con la única utilidad de copiarlo entero y pegarlo a la hora de crear un nuevo package.
4
+
5
+ Este iniciador permite crear un paquete que compila typescript y puede ser importado desde otros packages.
6
+
7
+ ## IMPORTANTE
8
+
9
+ Los archivos **tsconfig.json** y **tsup.config.ts** no son archivos únicos sino symlinks a archivos de configuración comunes a todos los packages. En caso de que sea necesario modificar alguno de ellos **que en la gran mayoría de los casos no sería necesario**, es necesario eliminar el archivo a modificar y crear uno nuevo.
10
+
11
+ ## Procedimiento
12
+
13
+ - Copiar la carpeta initiator y pegarla con otro nombre dentro de packages.
14
+ - Modificar el package.json:
15
+ - Eliminar la línea ```private: true```.
16
+ - Cambiar la ocurrencia `initiator` por el nombre del nuevo paquete.
17
+ - Agregar los scripts convenientes: dev, build, etc.
18
+ - Ejecutar el comando lerna bootstrap desde la carpeta raíz.
19
+
20
+ Luego de ejecutar estos pasos, el package estaría listo para comenzar a usarse.
21
+
22
+ Este package trae como dependencias por defecto theme-ui y react. Si se desea agregar más dependencias se debe ejecutar el comando ```lerna add --scope="@apia/packageName" dependencyName```. Ejemplo, si creamos un paquete con el nombre @apia/myPackage y queremos agregar lodash-es como dependencia, ejecutamos el comando ```lerna add --scope="@apia/myPackage" lodash-es```.
23
+
24
+ **Importante 1**: Dado que estamos desarrollando packages, es importante determinar si las dependencias que vamos a agregar son de tipo dependency o de tipo peerDependency.
25
+
26
+ **Importante 2**: lerna no permite instalar de a varias dependencias a la vez como lo hace npm, por lo tanto, si se desea agregar varias dependencias se debe ejecutar el comando anterior tantas veces como dependencias se quiera agregar.
27
+
28
28
  **Importante 3**: React y theme-ui vienen instalados como peerDependencies. En caso de no ser necesarios pueden ser removidos, pero en cualquier caso asegurarse de que estas dependencias no sean instaladas como dependencies puesto que esto causaría comportamientos indeseados en la aplicación.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { ReactNode } from 'react';
3
- import { TApiaSystemMessageObj } from '@apia/util';
3
+ import { EventEmitter, TApiaSystemMessageObj } from '@apia/util';
4
4
 
5
5
  type TNotificationId = string | number;
6
6
  interface INotification<T = string> {
@@ -14,25 +14,6 @@ interface INotification<T = string> {
14
14
  type: T;
15
15
  }
16
16
  type TNotificationSelector<T> = (notifications: INotification<T>[]) => INotification<T>[];
17
- interface INotificationsDispatcher<K> {
18
- areNotificationsOpen(): boolean;
19
- /**
20
- * El método close da la señal de cierre. Es importante llamar a delete para
21
- * que no se acumulen las notificaciones en el store
22
- */
23
- close(id: TNotificationId | INotification): void;
24
- closeAll(): void;
25
- /**
26
- * El método delete elimina la entrada en el store, no debe llamarse este
27
- * método directamente, sino el método close
28
- */
29
- delete(id: TNotificationId | INotification): void;
30
- getSelector(): (selector: TNotificationSelector<K>) => INotification<K>[];
31
- /**
32
- * Agrega una nueva notificación
33
- */
34
- notify(notification: INotification<K>): void;
35
- }
36
17
  declare global {
37
18
  interface Window {
38
19
  LBL_ERROR: string;
@@ -57,12 +38,16 @@ declare const _default: React__default.MemoExoticComponent<((props: object) => R
57
38
  declare const onCloseNotificationCallbacks: Record<string, () => unknown>;
58
39
  type TNotificationType = 'danger' | 'success' | 'warning';
59
40
  type TDispatchedNotification = Omit<INotification<TNotificationType>, 'id' | 'type' | 'isOpen'> & Partial<Pick<INotification<TNotificationType>, 'id' | 'type'>>;
60
- declare class DefaultNotifier implements INotificationsDispatcher<TNotificationType> {
41
+ declare class DefaultNotifier extends EventEmitter<{
42
+ changedList: boolean;
43
+ }> {
44
+ notifications: INotification<TNotificationType>[];
61
45
  areNotificationsOpen(): boolean;
46
+ shout(): void;
62
47
  close(id: TNotificationId | INotification): void;
63
48
  closeAll(): void;
64
49
  delete(id: TNotificationId | INotification): void;
65
- getSelector(): (selector: TNotificationSelector<TNotificationType>) => INotification<TNotificationType>[];
50
+ useSelector: (selector: TNotificationSelector<TNotificationType>) => INotification<TNotificationType>[];
66
51
  notify(notification: TDispatchedNotification): void;
67
52
  }
68
53
  declare const defaultNotifier: DefaultNotifier;
@@ -104,4 +89,4 @@ declare const parseServerNotification: (serverNotification: TMessage | TMessage[
104
89
  */
105
90
  declare const dispatchNotifications: (alert: TNotificationMessage) => void;
106
91
 
107
- export { DefaultNotifier, INotification, INotificationsDispatcher, Notification, _default as NotificationsList, TDispatchedNotification, TMessage, TNotificationId, TNotificationMessage, TNotificationSelector, TNotificationType, defaultNotifier, dispatchNotifications, getNotificationMessageObj, notify, onCloseNotificationCallbacks, parseServerNotification };
92
+ export { DefaultNotifier, INotification, Notification, _default as NotificationsList, TDispatchedNotification, TMessage, TNotificationId, TNotificationMessage, TNotificationSelector, TNotificationType, defaultNotifier, dispatchNotifications, getNotificationMessageObj, notify, onCloseNotificationCallbacks, parseServerNotification };
package/dist/index.js CHANGED
@@ -1,100 +1,13 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import React__default from 'react';
3
+ import React__default, { useState } from 'react';
4
4
  import { Alert, Box, Close, makeStyledComponent, spacing, getVariant } from '@apia/theme';
5
5
  import { CSSTransition } from 'react-transition-group';
6
- import { getSpecificParent, getIndex, useUpdateEffect, useUnmount, arrayOrArray } from '@apia/util';
6
+ import { EventEmitter, useLatest, useMount, getIndex, useUpdateEffect, useUnmount, arrayOrArray } from '@apia/util';
7
7
  import { isIconName, Icon } from '@apia/icons';
8
8
  import { uniqueId } from 'lodash-es';
9
- import { createSlice, injectReducers } from '@apia/store';
10
9
  import { keyframes } from '@emotion/react';
11
10
 
12
- var __defProp$3 = Object.defineProperty;
13
- var __defProps$2 = Object.defineProperties;
14
- var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
15
- var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
16
- var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
17
- var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
18
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
19
- var __spreadValues$3 = (a, b) => {
20
- for (var prop in b || (b = {}))
21
- if (__hasOwnProp$3.call(b, prop))
22
- __defNormalProp$3(a, prop, b[prop]);
23
- if (__getOwnPropSymbols$3)
24
- for (var prop of __getOwnPropSymbols$3(b)) {
25
- if (__propIsEnum$3.call(b, prop))
26
- __defNormalProp$3(a, prop, b[prop]);
27
- }
28
- return a;
29
- };
30
- var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
31
- function putNotificationToVibrate(message) {
32
- let hasAnimated = false;
33
- document.querySelectorAll(".notificationsFloatingList .notification__text").forEach((current) => {
34
- if (current.textContent === String(message)) {
35
- const notificationElement = getSpecificParent(
36
- current,
37
- (search) => {
38
- return search.classList.contains("notification");
39
- }
40
- );
41
- if (notificationElement) {
42
- notificationElement.classList.add("animate");
43
- setTimeout(() => {
44
- notificationElement.classList.remove("animate");
45
- }, 300);
46
- hasAnimated = true;
47
- } else
48
- console.warn(
49
- "A notification with that text was found, but it could not be animated"
50
- );
51
- }
52
- });
53
- return hasAnimated;
54
- }
55
- const notificationsSlice = createSlice({
56
- name: "notificationsSlice",
57
- initialState: { notifications: [] },
58
- reducers: {
59
- close(state, { payload }) {
60
- state.notifications = state.notifications.map((current) => {
61
- return current.id === payload.id ? __spreadProps$2(__spreadValues$3({}, current), { isOpen: false }) : current;
62
- });
63
- },
64
- closeAll(state) {
65
- const firstOpenIndex = state.notifications.findIndex((current) => {
66
- return current.isOpen;
67
- });
68
- if (firstOpenIndex >= 0) {
69
- state.notifications[firstOpenIndex].isOpen = false;
70
- setTimeout(() => {
71
- return notificationsStore.dispatch(notificationsActions.closeAll());
72
- }, 50);
73
- }
74
- },
75
- delete: (state, { payload: { id } }) => {
76
- state.notifications = state.notifications.filter((current) => {
77
- return current.id !== id;
78
- });
79
- },
80
- push(state, payload) {
81
- const notifications = payload.payload.notifications.filter(
82
- (notification) => {
83
- return !putNotificationToVibrate(notification.message);
84
- }
85
- );
86
- state.notifications.push(...notifications);
87
- }
88
- }
89
- });
90
- const {
91
- store: notificationsStore,
92
- useSelector: useNotificationsSelector
93
- } = injectReducers({
94
- notificationsSlice: notificationsSlice.reducer
95
- });
96
- const notificationsActions = notificationsSlice.actions;
97
-
98
11
  var __defProp$2 = Object.defineProperty;
99
12
  var __defProps$1 = Object.defineProperties;
100
13
  var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
@@ -115,54 +28,101 @@ var __spreadValues$2 = (a, b) => {
115
28
  };
116
29
  var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
117
30
  const onCloseNotificationCallbacks = {};
118
- class DefaultNotifier {
31
+ function shallowEqual(a, b) {
32
+ if (a.length !== b.length)
33
+ return false;
34
+ for (let i = 0; i < a.length; i++)
35
+ if (a[i] !== b[i])
36
+ return false;
37
+ return true;
38
+ }
39
+ class DefaultNotifier extends EventEmitter {
40
+ constructor() {
41
+ super(...arguments);
42
+ this.notifications = [];
43
+ this.useSelector = (selector) => {
44
+ const [state, setState] = useState([]);
45
+ const lastState = useLatest(state);
46
+ useMount(() => {
47
+ return this.on("changedList", () => {
48
+ const newState = selector(this.notifications);
49
+ if (!shallowEqual(newState, lastState.current)) {
50
+ setState([...newState]);
51
+ }
52
+ });
53
+ });
54
+ return state;
55
+ };
56
+ }
119
57
  areNotificationsOpen() {
120
58
  return !!document.querySelector(".notification");
121
59
  }
60
+ shout() {
61
+ this.emit("changedList", true);
62
+ }
122
63
  close(id) {
123
- notificationsStore.dispatch(
124
- notificationsActions.close({ id: typeof id === "object" ? id.id : id })
125
- );
64
+ const actualId = typeof id === "object" ? id.id : id;
65
+ this.notifications = this.notifications.map((current) => {
66
+ var _a;
67
+ if (current.id === actualId) {
68
+ (_a = current.onClose) == null ? void 0 : _a.call(current);
69
+ return __spreadProps$1(__spreadValues$2({}, current), { isOpen: false });
70
+ }
71
+ return current;
72
+ });
73
+ this.shout();
126
74
  }
127
75
  closeAll() {
128
- notificationsStore.dispatch(notificationsActions.closeAll());
76
+ this.notifications = this.notifications.map((current) => {
77
+ var _a;
78
+ (_a = current.onClose) == null ? void 0 : _a.call(current);
79
+ return __spreadProps$1(__spreadValues$2({}, current), {
80
+ isOpen: false
81
+ });
82
+ });
83
+ this.shout();
129
84
  }
130
85
  delete(id) {
131
- notificationsStore.dispatch(
132
- notificationsActions.delete({ id: typeof id === "object" ? id.id : id })
86
+ const actualId = typeof id === "object" ? id.id : id;
87
+ this.notifications = this.notifications.filter(
88
+ (current) => current.id !== actualId
133
89
  );
134
- }
135
- getSelector() {
136
- return (selector) => {
137
- return useNotificationsSelector((global) => {
138
- return selector(
139
- global.notificationsSlice.notifications
140
- );
141
- });
142
- };
90
+ this.shout();
143
91
  }
144
92
  notify(notification) {
145
93
  var _a, _b;
146
94
  const id = (_a = notification.id) != null ? _a : uniqueId();
147
- if (notification.onClose)
148
- onCloseNotificationCallbacks[id] = notification.onClose;
149
- notificationsStore.dispatch(
150
- notificationsActions.push({
151
- notifications: [
152
- __spreadProps$1(__spreadValues$2({}, notification), {
153
- isOpen: true,
154
- type: (_b = notification.type) != null ? _b : "warning",
155
- id,
156
- onClose: void 0
157
- })
158
- ]
159
- })
160
- );
95
+ let hasAnimated = false;
96
+ document.querySelectorAll(".notificationsFloatingList .notification__text").forEach((current) => {
97
+ if (current.textContent === notification.message) {
98
+ const notificationElement = current.closest(
99
+ ".notification"
100
+ );
101
+ if (notificationElement) {
102
+ notificationElement.classList.add("animate");
103
+ setTimeout(() => {
104
+ notificationElement.classList.remove("animate");
105
+ }, 200);
106
+ hasAnimated = true;
107
+ } else
108
+ console.warn(
109
+ "A notification with that text was found, but it could not be animated"
110
+ );
111
+ }
112
+ });
113
+ if (hasAnimated)
114
+ return;
115
+ this.notifications.push(__spreadProps$1(__spreadValues$2({}, notification), {
116
+ isOpen: true,
117
+ type: (_b = notification.type) != null ? _b : "warning",
118
+ id
119
+ }));
120
+ this.shout();
161
121
  }
162
122
  }
163
123
  const defaultNotifier = new DefaultNotifier();
164
124
  function notify(notification) {
165
- new DefaultNotifier().notify(notification);
125
+ defaultNotifier.notify(notification);
166
126
  }
167
127
 
168
128
  var __defProp$1 = Object.defineProperty;
@@ -230,7 +190,8 @@ const Notification = ({
230
190
  notificationType = "success";
231
191
  const onClick = React.useCallback(() => {
232
192
  setShouldShow(false);
233
- }, []);
193
+ defaultNotifier.close(innerNotification);
194
+ }, [innerNotification]);
234
195
  return /* @__PURE__ */ jsx(
235
196
  CSSTransition,
236
197
  {
@@ -338,6 +299,7 @@ const vibrate = keyframes`
338
299
  100% {
339
300
  transform: rotate(0);
340
301
  }`;
302
+ const useSelector = defaultNotifier.useSelector;
341
303
  const NotificationsList = makeStyledComponent(
342
304
  "NotificationsList",
343
305
  "layout.common.notifications.list",
@@ -371,8 +333,15 @@ const NotificationsList = makeStyledComponent(
371
333
  }
372
334
  },
373
335
  () => {
374
- const notifications = useNotificationsSelector((current) => {
375
- return current.notificationsSlice.notifications;
336
+ const notifications = useSelector((current) => {
337
+ return current;
338
+ });
339
+ useMount(() => {
340
+ document.addEventListener("keydown", (ev) => {
341
+ if (ev.code === "Escape") {
342
+ defaultNotifier.closeAll();
343
+ }
344
+ });
376
345
  });
377
346
  return /* @__PURE__ */ jsx(
378
347
  Box,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/notificationsStore.ts","../src/defaultNotifier.ts","../src/Notification.tsx","../src/NotificationsList.tsx","../src/apia/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { createSlice, injectReducers, PayloadAction } from '@apia/store';\nimport { getSpecificParent } from '@apia/util';\nimport { INotification, TNotificationId } from './types';\n\nfunction putNotificationToVibrate(message: string) {\n let hasAnimated = false;\n document\n .querySelectorAll('.notificationsFloatingList .notification__text')\n .forEach((current) => {\n if (current.textContent === String(message)) {\n const notificationElement = getSpecificParent(\n current as HTMLElement,\n (search) => {\n return search.classList.contains('notification');\n },\n );\n if (notificationElement) {\n notificationElement.classList.add('animate');\n setTimeout(() => {\n notificationElement.classList.remove('animate');\n }, 300);\n hasAnimated = true;\n } else\n console.warn(\n 'A notification with that text was found, but it could not be animated',\n );\n }\n });\n return hasAnimated;\n}\n\nexport const notificationsSlice = createSlice({\n name: 'notificationsSlice',\n initialState: { notifications: [] } as {\n notifications: INotification<any>[];\n },\n reducers: {\n close(state, { payload }: PayloadAction<{ id: TNotificationId }>) {\n state.notifications = state.notifications.map((current) => {\n return current.id === payload.id\n ? { ...current, isOpen: false }\n : current;\n });\n },\n closeAll(state) {\n const firstOpenIndex = state.notifications.findIndex((current) => {\n return current.isOpen;\n });\n if (firstOpenIndex >= 0) {\n state.notifications[firstOpenIndex].isOpen = false;\n setTimeout(() => {\n return notificationsStore.dispatch(notificationsActions.closeAll());\n }, 50);\n }\n },\n delete: (\n state,\n { payload: { id } }: PayloadAction<{ id: TNotificationId }>,\n ) => {\n state.notifications = state.notifications.filter((current) => {\n return current.id !== id;\n });\n },\n push(\n state,\n payload: PayloadAction<{ notifications: INotification<any>[] }>,\n ) {\n const notifications = payload.payload.notifications.filter(\n (notification) => {\n return !putNotificationToVibrate(notification.message);\n },\n );\n\n state.notifications.push(...notifications);\n },\n },\n});\n\nexport const {\n store: notificationsStore,\n useSelector: useNotificationsSelector,\n} = injectReducers({\n notificationsSlice: notificationsSlice.reducer,\n});\n\nexport const notificationsActions = notificationsSlice.actions;\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { uniqueId } from 'lodash-es';\nimport {\n notificationsActions,\n notificationsStore,\n useNotificationsSelector,\n} from './notificationsStore';\nimport {\n INotification,\n INotificationsDispatcher,\n TNotificationId,\n TNotificationSelector,\n} from './types';\n\nexport const onCloseNotificationCallbacks: Record<string, () => unknown> = {};\n\nexport type TNotificationType = 'danger' | 'success' | 'warning';\n\nexport type TDispatchedNotification = Omit<\n INotification<TNotificationType>,\n 'id' | 'type' | 'isOpen'\n> &\n Partial<Pick<INotification<TNotificationType>, 'id' | 'type'>>;\n\nexport class DefaultNotifier\n implements INotificationsDispatcher<TNotificationType>\n{\n areNotificationsOpen(): boolean {\n return !!document.querySelector('.notification');\n }\n\n close(id: TNotificationId | INotification): void {\n notificationsStore.dispatch(\n notificationsActions.close({ id: typeof id === 'object' ? id.id : id }),\n );\n }\n\n closeAll(): void {\n notificationsStore.dispatch(notificationsActions.closeAll());\n }\n\n delete(id: TNotificationId | INotification): void {\n notificationsStore.dispatch(\n notificationsActions.delete({ id: typeof id === 'object' ? id.id : id }),\n );\n }\n\n getSelector(): (\n selector: TNotificationSelector<TNotificationType>,\n ) => INotification<TNotificationType>[] {\n return (selector: TNotificationSelector<TNotificationType>) => {\n return useNotificationsSelector((global) => {\n return selector(\n global.notificationsSlice\n .notifications as INotification<TNotificationType>[],\n );\n });\n };\n }\n\n notify(notification: TDispatchedNotification): void {\n const id = notification.id ?? uniqueId();\n\n if (notification.onClose)\n onCloseNotificationCallbacks[id] = notification.onClose;\n\n notificationsStore.dispatch(\n notificationsActions.push({\n notifications: [\n {\n ...notification,\n isOpen: true,\n type: notification.type ?? 'warning',\n id,\n onClose: undefined,\n },\n ],\n }),\n );\n }\n}\n\nexport const defaultNotifier = new DefaultNotifier();\n\nexport function notify(notification: TDispatchedNotification) {\n new DefaultNotifier().notify(notification);\n}\n","import * as React from 'react';\nimport { Alert, Box, Close } from '@apia/theme';\nimport { CSSTransition } from 'react-transition-group';\nimport { getIndex, useUnmount, useUpdateEffect } from '@apia/util';\nimport { Icon, isIconName, TIconName } from '@apia/icons';\nimport { INotification } from './types';\nimport {\n defaultNotifier,\n onCloseNotificationCallbacks,\n} from './defaultNotifier';\n\nexport interface INotificationProps {\n animationName?: string;\n animationTimeout?: number;\n className?: string;\n disableClose?: boolean;\n notification: INotification;\n}\n\nexport const Notification: React.FC<INotificationProps> = ({\n animationName = 'fromRight',\n animationTimeout = 150,\n className,\n disableClose,\n notification,\n}) => {\n const innerNotification = React.useMemo(\n () => ({ ...notification }),\n [notification],\n );\n const nodeRef = React.useRef(null);\n if (!innerNotification.title)\n innerNotification.title = getIndex(\n [window.LBL_ERROR, window.LBL_WARNING, window.LBL_COMPLETE_OPERATION],\n [\n innerNotification.type === 'danger',\n innerNotification.type === 'warning',\n innerNotification.type === 'success',\n ],\n );\n if (!innerNotification.icon)\n innerNotification.icon = getIndex<TIconName>(\n ['Check', 'Alert', 'Close'],\n [\n innerNotification.type === 'success',\n innerNotification.type === 'warning',\n innerNotification.type === 'danger',\n ],\n );\n\n const [shouldShow, setShouldShow] = React.useState(true);\n\n const close = React.useCallback(() => {\n defaultNotifier.delete(innerNotification);\n }, [innerNotification]);\n\n useUpdateEffect(() => {\n if (!innerNotification.isOpen) setShouldShow(false);\n }, [innerNotification.isOpen]);\n\n useUnmount(() => {\n if (onCloseNotificationCallbacks[innerNotification.id])\n onCloseNotificationCallbacks[innerNotification.id]();\n });\n\n let notificationType: INotification['type'] = 'warning';\n if (['sysException', 'exception', 'danger'].includes(innerNotification.type))\n notificationType = 'danger';\n if (['greenMessage', 'success'].includes(innerNotification.type))\n notificationType = 'success';\n\n const onClick = React.useCallback(() => {\n setShouldShow(false);\n }, []);\n\n return (\n <CSSTransition\n in={shouldShow}\n timeout={animationTimeout}\n classNames={animationName}\n appear\n unmountOnExit\n onExited={close}\n nodeRef={nodeRef}\n >\n <Alert\n data-testid={notificationType}\n role=\"alert\"\n ref={nodeRef}\n variant={`alerts.${notificationType}`}\n className={`${\n className ?? ''\n } notification notification__alert ${notificationType}`}\n tabIndex={0}\n onKeyDown={React.useCallback((ev: React.KeyboardEvent) => {\n if (\n ev.key.toLowerCase() === 'escape' ||\n ev.key.toLowerCase() === 'enter' ||\n ev.key === ' '\n ) {\n ev.preventDefault();\n ev.stopPropagation();\n setShouldShow(false);\n }\n }, [])}\n >\n {(!disableClose ||\n innerNotification.icon ||\n innerNotification.title) && (\n <Box className=\"notification__header\">\n {(innerNotification.title || innerNotification.icon) && (\n <Box as=\"h4\" className=\"notification__title\">\n {innerNotification.icon && (\n <Box className=\"notification__icon\">\n {isIconName(\n innerNotification.icon as unknown as TIconName,\n ) ? (\n <Icon\n title=\"\"\n name={innerNotification.icon as unknown as TIconName}\n />\n ) : (\n innerNotification.icon\n )}\n </Box>\n )}\n {innerNotification.title}\n </Box>\n )}\n {!disableClose && (\n <Close\n type=\"button\"\n onClick={onClick}\n tabIndex={-1}\n className=\"notification__closeButton\"\n />\n )}\n </Box>\n )}\n <Box className=\"notification__body\">\n <Box className=\"notification__content\">\n <Box className=\"notification__message\">\n <Box\n dangerouslySetInnerHTML={{\n __html: innerNotification.message,\n }}\n className=\"notification__text\"\n />\n </Box>\n {innerNotification.trace && (\n <>\n <Box as=\"code\" className=\"notification__trace\">\n <Box as=\"strong\" className=\"notification__traceLabel\">\n Trace:\n </Box>\n <Box className=\"notification__traceText\">\n {innerNotification.trace}\n </Box>\n </Box>\n </>\n )}\n </Box>\n </Box>\n </Alert>\n </CSSTransition>\n );\n};\n","import React from 'react';\nimport { Box } from '@apia/theme';\nimport { getVariant, makeStyledComponent, spacing } from '@apia/theme';\nimport { keyframes } from '@emotion/react';\nimport { Notification } from './Notification';\nimport { useNotificationsSelector } from './notificationsStore';\n\nconst vibrate = keyframes`\n0% {\n transform: rotate(0);\n}\n\n25% {\n transform: rotate(1.5deg);\n}\n\n75% {\n transform: rotate(-1.5deg);\n}\n\n100% {\n transform: rotate(0);\n}`;\n\nconst NotificationsList = makeStyledComponent(\n 'NotificationsList',\n 'layout.common.notifications.list',\n {\n '.notificationsFloatingList': {\n bottom: '10px',\n height: 'min-content',\n maxHeight: 'calc(100vh - 20px)',\n maxWidth: 'floatingNotifications',\n position: 'fixed',\n pr: '5px',\n right: '5px',\n width: '100%',\n zIndex: 'notifications',\n\n '& > *:not(:last-child)': {\n mb: spacing(5),\n },\n\n '.notification.animate': {\n animation: `${vibrate} 0.1s linear infinite`,\n },\n },\n\n '.fromRight-enter, .fromRight-appear': { transform: 'translateX(550px)' },\n '.fromRight-enter-active, .fromRight-appear-active': {\n transition: 'transform 150ms',\n transform: 'translateX(0)',\n },\n '.fromRight-exit': { transform: 'translateX(0)' },\n '.fromRight-exit-active': {\n transition: 'transform 150ms',\n transform: 'translateX(550px)',\n },\n },\n () => {\n const notifications = useNotificationsSelector((current) => {\n return current.notificationsSlice.notifications;\n });\n\n return (\n <Box\n className=\"notificationsFloatingList\"\n {...getVariant('layout.common.components.notifications.list')}\n >\n {notifications.map((current) => {\n return <Notification notification={current} key={current.id} />;\n })}\n </Box>\n );\n },\n);\n\nexport default React.memo(NotificationsList);\n","import { arrayOrArray, TApiaSystemMessageObj } from '@apia/util';\nimport { uniqueId } from 'lodash-es';\nimport { notify, TNotificationType } from '../defaultNotifier';\nimport { INotification } from '../types';\nimport { TMessage, TNotificationMessage } from './types';\n\n/**\n * Devuelve un array de notificaciones a partir de\n * una respuesta de Apia.\n */\nexport const getNotificationMessageObj = (\n data: TApiaSystemMessageObj,\n): INotification<TNotificationType>[] | null => {\n const notifications: INotification<TNotificationType>[] = [];\n if (data?.sysMessages?.message) {\n notifications.push(\n ...parseServerNotification(data.sysMessages.message, 'warning'),\n );\n }\n if (data?.sysExceptions) {\n notifications.push(\n ...parseServerNotification(data.sysExceptions.exception, 'danger'),\n );\n }\n if (data?.exceptions?.exception) {\n notifications.push(\n ...parseServerNotification(data.exceptions.exception, 'danger'),\n );\n }\n if (notifications.length > 0) return notifications;\n return null;\n};\n\nfunction parseServerNotificationType(type: string): TNotificationType {\n switch (type) {\n case '1':\n return 'success';\n case '2':\n return 'warning';\n case '3':\n return 'danger';\n default:\n return 'warning';\n }\n}\n\n/**\n * Toma un objeto de notificación de servidor y lo convierte a un\n * objeto de notificación de cliente.\n */\nexport const parseServerNotification = (\n serverNotification: TMessage | TMessage[],\n type: TNotificationType,\n): INotification<TNotificationType>[] => {\n const messages = arrayOrArray(serverNotification);\n return messages.map((current) => {\n const returnNotification: INotification<TNotificationType> = {\n message: current.text,\n trace: current.content,\n title: current.title,\n type:\n current.type !== undefined\n ? parseServerNotificationType(current.type)\n : (type as TNotificationType),\n isOpen: true,\n id: uniqueId(),\n };\n return returnNotification;\n });\n};\n\n/**\n * Toma un objeto de respuesta de servidor que puede eventualmente\n * tener notificaciones y las pasa al sistema de notificaciones si\n * es que hay alguna.\n */\nexport const dispatchNotifications = (alert: TNotificationMessage) => {\n if (alert) {\n if (alert.sysMessages?.message)\n parseServerNotification(alert.sysMessages?.message, 'warning').forEach(\n notify,\n );\n if (alert.exceptions?.exception)\n parseServerNotification(alert.exceptions?.exception, 'danger').forEach(\n notify,\n );\n if (alert.sysExceptions?.exception)\n parseServerNotification(alert.sysExceptions?.exception, 'danger').forEach(\n notify,\n );\n }\n};\n\nexport * from './types';\n"],"names":["__spreadProps","__spreadValues","React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,SAAS,yBAAyB,OAAiB,EAAA;AACjD,EAAA,IAAI,WAAc,GAAA,KAAA,CAAA;AAClB,EAAA,QAAA,CACG,gBAAiB,CAAA,gDAAgD,CACjE,CAAA,OAAA,CAAQ,CAAC,OAAY,KAAA;AACpB,IAAA,IAAI,OAAQ,CAAA,WAAA,KAAgB,MAAO,CAAA,OAAO,CAAG,EAAA;AAC3C,MAAA,MAAM,mBAAsB,GAAA,iBAAA;AAAA,QAC1B,OAAA;AAAA,QACA,CAAC,MAAW,KAAA;AACV,UAAO,OAAA,MAAA,CAAO,SAAU,CAAA,QAAA,CAAS,cAAc,CAAA,CAAA;AAAA,SACjD;AAAA,OACF,CAAA;AACA,MAAA,IAAI,mBAAqB,EAAA;AACvB,QAAoB,mBAAA,CAAA,SAAA,CAAU,IAAI,SAAS,CAAA,CAAA;AAC3C,QAAA,UAAA,CAAW,MAAM;AACf,UAAoB,mBAAA,CAAA,SAAA,CAAU,OAAO,SAAS,CAAA,CAAA;AAAA,WAC7C,GAAG,CAAA,CAAA;AAC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IAAI,KAAO,EAAA;AACT,IAAI,IAAA,CAAA,EAAA,GAAA,KAAA,CAAM,gBAAN,IAAmB,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,OAAA;AACrB,MAAA,uBAAA,CAAA,CAAwB,EAAM,GAAA,KAAA,CAAA,WAAA,KAAN,IAAmB,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,OAAA,EAAS,SAAS,CAAE,CAAA,OAAA;AAAA,QAC7D,MAAA;AAAA,OACF,CAAA;AACF,IAAI,IAAA,CAAA,EAAA,GAAA,KAAA,CAAM,eAAN,IAAkB,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,SAAA;AACpB,MAAA,uBAAA,CAAA,CAAwB,EAAM,GAAA,KAAA,CAAA,UAAA,KAAN,IAAkB,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,SAAA,EAAW,QAAQ,CAAE,CAAA,OAAA;AAAA,QAC7D,MAAA;AAAA,OACF,CAAA;AACF,IAAI,IAAA,CAAA,EAAA,GAAA,KAAA,CAAM,kBAAN,IAAqB,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,SAAA;AACvB,MAAA,uBAAA,CAAA,CAAwB,EAAM,GAAA,KAAA,CAAA,aAAA,KAAN,IAAqB,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,SAAA,EAAW,QAAQ,CAAE,CAAA,OAAA;AAAA,QAChE,MAAA;AAAA,OACF,CAAA;AAAA,GACJ;AACF;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/defaultNotifier.ts","../src/Notification.tsx","../src/NotificationsList.tsx","../src/apia/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport { uniqueId } from 'lodash-es';\r\nimport { INotification, TNotificationId, TNotificationSelector } from './types';\r\nimport { EventEmitter, useMount, useLatest } from '@apia/util';\r\nimport { useState } from 'react';\r\n\r\nexport const onCloseNotificationCallbacks: Record<string, () => unknown> = {};\r\n\r\nexport type TNotificationType = 'danger' | 'success' | 'warning';\r\n\r\nfunction shallowEqual(a: unknown[], b: unknown[]) {\r\n if (a.length !== b.length) return false;\r\n\r\n for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false;\r\n\r\n return true;\r\n}\r\n\r\nexport type TDispatchedNotification = Omit<\r\n INotification<TNotificationType>,\r\n 'id' | 'type' | 'isOpen'\r\n> &\r\n Partial<Pick<INotification<TNotificationType>, 'id' | 'type'>>;\r\n\r\nexport class DefaultNotifier extends EventEmitter<{ changedList: boolean }> {\r\n notifications: INotification<TNotificationType>[] = [];\r\n\r\n areNotificationsOpen(): boolean {\r\n return !!document.querySelector('.notification');\r\n }\r\n\r\n shout() {\r\n this.emit('changedList', true);\r\n }\r\n\r\n close(id: TNotificationId | INotification): void {\r\n const actualId = typeof id === 'object' ? id.id : id;\r\n this.notifications = this.notifications.map((current) => {\r\n if (current.id === actualId) {\r\n current.onClose?.();\r\n return { ...current, isOpen: false };\r\n }\r\n return current;\r\n });\r\n this.shout();\r\n }\r\n\r\n closeAll(): void {\r\n this.notifications = this.notifications.map((current) => {\r\n current.onClose?.();\r\n return {\r\n ...current,\r\n isOpen: false,\r\n };\r\n });\r\n this.shout();\r\n }\r\n\r\n delete(id: TNotificationId | INotification): void {\r\n const actualId = typeof id === 'object' ? id.id : id;\r\n this.notifications = this.notifications.filter(\r\n (current) => current.id !== actualId,\r\n );\r\n this.shout();\r\n }\r\n\r\n useSelector = (\r\n selector: TNotificationSelector<TNotificationType>,\r\n ): INotification<TNotificationType>[] => {\r\n const [state, setState] = useState<INotification<TNotificationType>[]>([]);\r\n\r\n const lastState = useLatest(state);\r\n useMount(() => {\r\n return this.on('changedList', () => {\r\n const newState = selector(this.notifications);\r\n if (!shallowEqual(newState, lastState.current)) {\r\n setState([...newState]);\r\n }\r\n });\r\n });\r\n\r\n return state;\r\n };\r\n\r\n notify(notification: TDispatchedNotification): void {\r\n const id = notification.id ?? uniqueId();\r\n\r\n let hasAnimated = false;\r\n document\r\n .querySelectorAll('.notificationsFloatingList .notification__text')\r\n .forEach((current) => {\r\n if (current.textContent === notification.message) {\r\n const notificationElement = (current as HTMLElement).closest(\r\n '.notification',\r\n ) as HTMLElement;\r\n if (notificationElement) {\r\n notificationElement.classList.add('animate');\r\n setTimeout(() => {\r\n notificationElement.classList.remove('animate');\r\n }, 200);\r\n hasAnimated = true;\r\n } else\r\n console.warn(\r\n 'A notification with that text was found, but it could not be animated',\r\n );\r\n }\r\n });\r\n if (hasAnimated) return;\r\n\r\n this.notifications.push({\r\n ...notification,\r\n isOpen: true,\r\n type: notification.type ?? 'warning',\r\n id,\r\n });\r\n\r\n this.shout();\r\n }\r\n}\r\n\r\nexport const defaultNotifier = new DefaultNotifier();\r\n\r\nexport function notify(notification: TDispatchedNotification) {\r\n defaultNotifier.notify(notification);\r\n}\r\n","import * as React from 'react';\r\nimport { Alert, Box, Close } from '@apia/theme';\r\nimport { CSSTransition } from 'react-transition-group';\r\nimport { getIndex, useUnmount, useUpdateEffect } from '@apia/util';\r\nimport { Icon, isIconName, TIconName } from '@apia/icons';\r\nimport { INotification } from './types';\r\nimport {\r\n defaultNotifier,\r\n onCloseNotificationCallbacks,\r\n} from './defaultNotifier';\r\n\r\nexport interface INotificationProps {\r\n animationName?: string;\r\n animationTimeout?: number;\r\n className?: string;\r\n disableClose?: boolean;\r\n notification: INotification;\r\n}\r\n\r\nexport const Notification: React.FC<INotificationProps> = ({\r\n animationName = 'fromRight',\r\n animationTimeout = 150,\r\n className,\r\n disableClose,\r\n notification,\r\n}) => {\r\n const innerNotification = React.useMemo(\r\n () => ({ ...notification }),\r\n [notification],\r\n );\r\n const nodeRef = React.useRef(null);\r\n if (!innerNotification.title)\r\n innerNotification.title = getIndex(\r\n [window.LBL_ERROR, window.LBL_WARNING, window.LBL_COMPLETE_OPERATION],\r\n [\r\n innerNotification.type === 'danger',\r\n innerNotification.type === 'warning',\r\n innerNotification.type === 'success',\r\n ],\r\n );\r\n if (!innerNotification.icon)\r\n innerNotification.icon = getIndex<TIconName>(\r\n ['Check', 'Alert', 'Close'],\r\n [\r\n innerNotification.type === 'success',\r\n innerNotification.type === 'warning',\r\n innerNotification.type === 'danger',\r\n ],\r\n );\r\n\r\n const [shouldShow, setShouldShow] = React.useState(true);\r\n\r\n const close = React.useCallback(() => {\r\n defaultNotifier.delete(innerNotification);\r\n }, [innerNotification]);\r\n\r\n useUpdateEffect(() => {\r\n if (!innerNotification.isOpen) setShouldShow(false);\r\n }, [innerNotification.isOpen]);\r\n\r\n useUnmount(() => {\r\n if (onCloseNotificationCallbacks[innerNotification.id])\r\n onCloseNotificationCallbacks[innerNotification.id]();\r\n });\r\n\r\n let notificationType: INotification['type'] = 'warning';\r\n if (['sysException', 'exception', 'danger'].includes(innerNotification.type))\r\n notificationType = 'danger';\r\n if (['greenMessage', 'success'].includes(innerNotification.type))\r\n notificationType = 'success';\r\n\r\n const onClick = React.useCallback(() => {\r\n setShouldShow(false);\r\n defaultNotifier.close(innerNotification);\r\n }, [innerNotification]);\r\n\r\n return (\r\n <CSSTransition\r\n in={shouldShow}\r\n timeout={animationTimeout}\r\n classNames={animationName}\r\n appear\r\n unmountOnExit\r\n onExited={close}\r\n nodeRef={nodeRef}\r\n >\r\n <Alert\r\n data-testid={notificationType}\r\n role=\"alert\"\r\n ref={nodeRef}\r\n variant={`alerts.${notificationType}`}\r\n className={`${\r\n className ?? ''\r\n } notification notification__alert ${notificationType}`}\r\n tabIndex={0}\r\n onKeyDown={React.useCallback((ev: React.KeyboardEvent) => {\r\n if (\r\n ev.key.toLowerCase() === 'escape' ||\r\n ev.key.toLowerCase() === 'enter' ||\r\n ev.key === ' '\r\n ) {\r\n ev.preventDefault();\r\n ev.stopPropagation();\r\n setShouldShow(false);\r\n }\r\n }, [])}\r\n >\r\n {(!disableClose ||\r\n innerNotification.icon ||\r\n innerNotification.title) && (\r\n <Box className=\"notification__header\">\r\n {(innerNotification.title || innerNotification.icon) && (\r\n <Box as=\"h4\" className=\"notification__title\">\r\n {innerNotification.icon && (\r\n <Box className=\"notification__icon\">\r\n {isIconName(\r\n innerNotification.icon as unknown as TIconName,\r\n ) ? (\r\n <Icon\r\n title=\"\"\r\n name={innerNotification.icon as unknown as TIconName}\r\n />\r\n ) : (\r\n innerNotification.icon\r\n )}\r\n </Box>\r\n )}\r\n {innerNotification.title}\r\n </Box>\r\n )}\r\n {!disableClose && (\r\n <Close\r\n type=\"button\"\r\n onClick={onClick}\r\n tabIndex={-1}\r\n className=\"notification__closeButton\"\r\n />\r\n )}\r\n </Box>\r\n )}\r\n <Box className=\"notification__body\">\r\n <Box className=\"notification__content\">\r\n <Box className=\"notification__message\">\r\n <Box\r\n dangerouslySetInnerHTML={{\r\n __html: innerNotification.message,\r\n }}\r\n className=\"notification__text\"\r\n />\r\n </Box>\r\n {innerNotification.trace && (\r\n <>\r\n <Box as=\"code\" className=\"notification__trace\">\r\n <Box as=\"strong\" className=\"notification__traceLabel\">\r\n Trace:\r\n </Box>\r\n <Box className=\"notification__traceText\">\r\n {innerNotification.trace}\r\n </Box>\r\n </Box>\r\n </>\r\n )}\r\n </Box>\r\n </Box>\r\n </Alert>\r\n </CSSTransition>\r\n );\r\n};\r\n","import React from 'react';\r\nimport { Box } from '@apia/theme';\r\nimport { getVariant, makeStyledComponent, spacing } from '@apia/theme';\r\nimport { keyframes } from '@emotion/react';\r\nimport { Notification } from './Notification';\r\nimport { defaultNotifier } from './defaultNotifier';\r\nimport { useMount } from '@apia/util';\r\n\r\nconst vibrate = keyframes`\r\n0% {\r\n transform: rotate(0);\r\n}\r\n\r\n25% {\r\n transform: rotate(1.5deg);\r\n}\r\n\r\n75% {\r\n transform: rotate(-1.5deg);\r\n}\r\n\r\n100% {\r\n transform: rotate(0);\r\n}`;\r\n\r\nconst useSelector = defaultNotifier.useSelector;\r\n\r\nconst NotificationsList = makeStyledComponent(\r\n 'NotificationsList',\r\n 'layout.common.notifications.list',\r\n {\r\n '.notificationsFloatingList': {\r\n bottom: '10px',\r\n height: 'min-content',\r\n maxHeight: 'calc(100vh - 20px)',\r\n maxWidth: 'floatingNotifications',\r\n position: 'fixed',\r\n pr: '5px',\r\n right: '5px',\r\n width: '100%',\r\n zIndex: 'notifications',\r\n\r\n '& > *:not(:last-child)': {\r\n mb: spacing(5),\r\n },\r\n\r\n '.notification.animate': {\r\n animation: `${vibrate} 0.1s linear infinite`,\r\n },\r\n },\r\n\r\n '.fromRight-enter, .fromRight-appear': { transform: 'translateX(550px)' },\r\n '.fromRight-enter-active, .fromRight-appear-active': {\r\n transition: 'transform 150ms',\r\n transform: 'translateX(0)',\r\n },\r\n '.fromRight-exit': { transform: 'translateX(0)' },\r\n '.fromRight-exit-active': {\r\n transition: 'transform 150ms',\r\n transform: 'translateX(550px)',\r\n },\r\n },\r\n () => {\r\n const notifications = useSelector((current) => {\r\n return current;\r\n });\r\n\r\n useMount(() => {\r\n document.addEventListener('keydown', (ev) => {\r\n if (ev.code === 'Escape') {\r\n defaultNotifier.closeAll();\r\n }\r\n });\r\n });\r\n\r\n return (\r\n <Box\r\n className=\"notificationsFloatingList\"\r\n {...getVariant('layout.common.components.notifications.list')}\r\n >\r\n {notifications.map((current) => {\r\n return <Notification notification={current} key={current.id} />;\r\n })}\r\n </Box>\r\n );\r\n },\r\n);\r\n\r\nexport default React.memo(NotificationsList);\r\n","import { arrayOrArray, TApiaSystemMessageObj } from '@apia/util';\r\nimport { uniqueId } from 'lodash-es';\r\nimport { notify, TNotificationType } from '../defaultNotifier';\r\nimport { INotification } from '../types';\r\nimport { TMessage, TNotificationMessage } from './types';\r\n\r\n/**\r\n * Devuelve un array de notificaciones a partir de\r\n * una respuesta de Apia.\r\n */\r\nexport const getNotificationMessageObj = (\r\n data: TApiaSystemMessageObj,\r\n): INotification<TNotificationType>[] | null => {\r\n const notifications: INotification<TNotificationType>[] = [];\r\n if (data?.sysMessages?.message) {\r\n notifications.push(\r\n ...parseServerNotification(data.sysMessages.message, 'warning'),\r\n );\r\n }\r\n if (data?.sysExceptions) {\r\n notifications.push(\r\n ...parseServerNotification(data.sysExceptions.exception, 'danger'),\r\n );\r\n }\r\n if (data?.exceptions?.exception) {\r\n notifications.push(\r\n ...parseServerNotification(data.exceptions.exception, 'danger'),\r\n );\r\n }\r\n if (notifications.length > 0) return notifications;\r\n return null;\r\n};\r\n\r\nfunction parseServerNotificationType(type: string): TNotificationType {\r\n switch (type) {\r\n case '1':\r\n return 'success';\r\n case '2':\r\n return 'warning';\r\n case '3':\r\n return 'danger';\r\n default:\r\n return 'warning';\r\n }\r\n}\r\n\r\n/**\r\n * Toma un objeto de notificación de servidor y lo convierte a un\r\n * objeto de notificación de cliente.\r\n */\r\nexport const parseServerNotification = (\r\n serverNotification: TMessage | TMessage[],\r\n type: TNotificationType,\r\n): INotification<TNotificationType>[] => {\r\n const messages = arrayOrArray(serverNotification);\r\n return messages.map((current) => {\r\n const returnNotification: INotification<TNotificationType> = {\r\n message: current.text,\r\n trace: current.content,\r\n title: current.title,\r\n type:\r\n current.type !== undefined\r\n ? parseServerNotificationType(current.type)\r\n : (type as TNotificationType),\r\n isOpen: true,\r\n id: uniqueId(),\r\n };\r\n return returnNotification;\r\n });\r\n};\r\n\r\n/**\r\n * Toma un objeto de respuesta de servidor que puede eventualmente\r\n * tener notificaciones y las pasa al sistema de notificaciones si\r\n * es que hay alguna.\r\n */\r\nexport const dispatchNotifications = (alert: TNotificationMessage) => {\r\n if (alert) {\r\n if (alert.sysMessages?.message)\r\n parseServerNotification(alert.sysMessages?.message, 'warning').forEach(\r\n notify,\r\n );\r\n if (alert.exceptions?.exception)\r\n parseServerNotification(alert.exceptions?.exception, 'danger').forEach(\r\n notify,\r\n );\r\n if (alert.sysExceptions?.exception)\r\n parseServerNotification(alert.sysExceptions?.exception, 'danger').forEach(\r\n notify,\r\n );\r\n }\r\n};\r\n\r\nexport * from './types';\r\n"],"names":["__spreadProps","__spreadValues","React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMO,MAAM,+BAA8D,GAAC;AAI5E,SAAS,YAAA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,QAAQ,CAAE,CAAA,OAAA;AAAA,QAC7D,MAAA;AAAA,OACF,CAAA;AACF,IAAI,IAAA,CAAA,EAAA,GAAA,KAAA,CAAM,kBAAN,IAAqB,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,SAAA;AACvB,MAAA,uBAAA,CAAA,CAAwB,EAAM,GAAA,KAAA,CAAA,aAAA,KAAN,IAAqB,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,SAAA,EAAW,QAAQ,CAAE,CAAA,OAAA;AAAA,QAChE,MAAA;AAAA,OACF,CAAA;AAAA,GACJ;AACF;;;;"}
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "name": "@apia/notifications",
7
7
  "sideEffects": false,
8
8
  "types": "./dist/index.d.ts",
9
- "version": "0.3.0",
9
+ "version": "0.3.3",
10
10
  "scripts": {
11
11
  "build": "rollup -c rollup.config.esb.mjs",
12
12
  "buildDev": "rollup -c rollup.config.esb.mjs --dev",
@@ -26,16 +26,16 @@
26
26
  "typescript": "^4.9.5"
27
27
  },
28
28
  "dependencies": {
29
- "@apia/icons": "^0.3.0",
30
- "@apia/store": "^0.3.0",
31
- "@apia/theme": "^0.3.0",
32
- "@apia/util": "^0.3.0",
33
29
  "@types/lodash-es": "^4.17.7",
34
30
  "@types/react-transition-group": "^4.4.5",
35
31
  "lodash-es": "^4.17.21",
36
32
  "react-transition-group": "^4.4.5"
37
33
  },
38
34
  "peerDependencies": {
35
+ "@apia/icons": "^0.3.2",
36
+ "@apia/store": "^0.3.2",
37
+ "@apia/theme": "^0.3.2",
38
+ "@apia/util": "^0.3.2",
39
39
  "@emotion/react": "^11.10.6",
40
40
  "react": "^18.2.0",
41
41
  "react-dom": "^18.2.0"
@@ -49,5 +49,5 @@
49
49
  "url": "http://corp-gitlab-01.domst.st.net/products/apia/ApiaNPMPackages.git",
50
50
  "directory": "packages/notifications"
51
51
  },
52
- "gitHead": "20ff06e6c9e9d558a50e3bfae3ed857d6b5d228c"
52
+ "gitHead": "b80952378d3936912fba8939ec711ccdd0e0e29c"
53
53
  }
package/cleanDist.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "cleanDist": 0.055914100472197026
3
- }