@apia/notifications 0.1.3 → 0.2.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.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { ReactNode } from 'react';
3
- import * as theme_ui_jsx_runtime from 'theme-ui/jsx-runtime';
4
3
  import { TApiaSystemMessageObj } from '@apia/util';
5
4
 
6
5
  type TNotificationId = string | number;
@@ -51,7 +50,7 @@ interface INotificationProps {
51
50
  }
52
51
  declare const Notification: React.FC<INotificationProps>;
53
52
 
54
- declare const _default: React__default.MemoExoticComponent<((props: object) => theme_ui_jsx_runtime.JSX.Element) & {
53
+ declare const _default: React__default.MemoExoticComponent<((props: object) => React__default.JSX.Element) & {
55
54
  displayName: string;
56
55
  }>;
57
56
 
package/dist/index.js CHANGED
@@ -1,4 +1,328 @@
1
- import{jsx as a,jsxs as d,Fragment as T}from"react/jsx-runtime";import*as l from"react";import M from"react";import{Alert as B,Box as r,Close as D}from"theme-ui";import{CSSTransition as X}from"react-transition-group";import{getSpecificParent as F,getIndex as x,useUpdateEffect as q,useUnmount as H,arrayOrArray as U}from"@apia/util";import{isIconName as W,Icon as z}from"@apia/icons";import{uniqueId as w}from"lodash-es";import{createSlice as G,injectReducers as K}from"@apia/store";import{makeStyledComponent as V,spacing as J,getVariant as Q}from"@apia/theme";import{keyframes as Y}from"@emotion/react";var Z=Object.defineProperty,ee=Object.defineProperties,te=Object.getOwnPropertyDescriptors,_=Object.getOwnPropertySymbols,ne=Object.prototype.hasOwnProperty,ie=Object.prototype.propertyIsEnumerable,N=(t,e,n)=>e in t?Z(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,oe=(t,e)=>{for(var n in e||(e={}))ne.call(e,n)&&N(t,n,e[n]);if(_)for(var n of _(e))ie.call(e,n)&&N(t,n,e[n]);return t},ae=(t,e)=>ee(t,te(e));function re(t){let e=!1;return document.querySelectorAll(".notificationsFloatingList .notification__text").forEach(n=>{if(n.textContent===String(t)){const o=F(n,s=>s.classList.contains("notification"));o?(o.classList.add("animate"),setTimeout(()=>{o.classList.remove("animate")},300),e=!0):console.warn("A notification with that text was found, but it could not be animated")}}),e}const j=G({name:"notificationsSlice",initialState:{notifications:[]},reducers:{close(t,{payload:e}){t.notifications=t.notifications.map(n=>n.id===e.id?ae(oe({},n),{isOpen:!1}):n)},closeAll(t){const e=t.notifications.findIndex(n=>n.isOpen);e>=0&&(t.notifications[e].isOpen=!1,setTimeout(()=>u.dispatch(y.closeAll()),50))},delete:(t,{payload:{id:e}})=>{t.notifications=t.notifications.filter(n=>n.id!==e)},push(t,e){const n=e.payload.notifications.filter(o=>!re(o.message));t.notifications.push(...n)}}}),{store:u,useSelector:se}=K({notificationsSlice:j.reducer}),y=j.actions;var ce=Object.defineProperty,le=Object.defineProperties,fe=Object.getOwnPropertyDescriptors,S=Object.getOwnPropertySymbols,pe=Object.prototype.hasOwnProperty,me=Object.prototype.propertyIsEnumerable,P=(t,e,n)=>e in t?ce(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,de=(t,e)=>{for(var n in e||(e={}))pe.call(e,n)&&P(t,n,e[n]);if(S)for(var n of S(e))me.call(e,n)&&P(t,n,e[n]);return t},ue=(t,e)=>le(t,fe(e));const g={};class v{areNotificationsOpen(){return!!document.querySelector(".notification")}close(e){u.dispatch(y.close({id:typeof e=="object"?e.id:e}))}closeAll(){u.dispatch(y.closeAll())}delete(e){u.dispatch(y.delete({id:typeof e=="object"?e.id:e}))}getSelector(){return e=>se(n=>e(n.notificationsSlice.notifications))}notify(e){var n,o;const s=(n=e.id)!=null?n:w();e.onClose&&(g[s]=e.onClose),u.dispatch(y.push({notifications:[ue(de({},e),{isOpen:!0,type:(o=e.type)!=null?o:"warning",id:s,onClose:void 0})]}))}}const O=new v;function b(t){new v().notify(t)}var ye=Object.defineProperty,$=Object.getOwnPropertySymbols,ge=Object.prototype.hasOwnProperty,be=Object.prototype.propertyIsEnumerable,C=(t,e,n)=>e in t?ye(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,he=(t,e)=>{for(var n in e||(e={}))ge.call(e,n)&&C(t,n,e[n]);if($)for(var n of $(e))be.call(e,n)&&C(t,n,e[n]);return t};const E=({animationName:t="fromRight",animationTimeout:e=150,className:n,disableClose:o,notification:s})=>{const i=l.useMemo(()=>he({},s),[s]),f=l.useRef(null);i.title||(i.title=x([window.LBL_ERROR,window.LBL_WARNING,window.LBL_COMPLETE_OPERATION],[i.type==="danger",i.type==="warning",i.type==="success"])),i.icon||(i.icon=x(["Check","Alert","Close"],[i.type==="success",i.type==="warning",i.type==="danger"]));const[R,h]=l.useState(!0),A=l.useCallback(()=>{O.delete(i)},[i]);q(()=>{i.isOpen||h(!1)},[i.isOpen]),H(()=>{g[i.id]&&g[i.id]()});let p="warning";["sysException","exception","danger"].includes(i.type)&&(p="danger"),["greenMessage","success"].includes(i.type)&&(p="success");const k=l.useCallback(()=>{h(!1)},[]);return a(X,{in:R,timeout:e,classNames:t,appear:!0,unmountOnExit:!0,onExited:A,nodeRef:f,children:d(B,{"data-testid":p,role:"alert",ref:f,variant:`alerts.${p}`,className:`${n??""} notification notification__alert ${p}`,tabIndex:0,onKeyDown:l.useCallback(m=>{(m.key.toLowerCase()==="escape"||m.key.toLowerCase()==="enter"||m.key===" ")&&(m.preventDefault(),m.stopPropagation(),h(!1))},[]),children:[(!o||i.icon||i.title)&&d(r,{className:"notification__header",children:[(i.title||i.icon)&&d(r,{as:"h4",className:"notification__title",children:[i.icon&&a(r,{className:"notification__icon",children:W(i.icon)?a(z,{title:"",name:i.icon}):i.icon}),i.title]}),!o&&a(D,{type:"button",onClick:k,tabIndex:-1,className:"notification__closeButton"})]}),a(r,{className:"notification__body",children:d(r,{className:"notification__content",children:[a(r,{className:"notification__message",children:a(r,{dangerouslySetInnerHTML:{__html:i.message},className:"notification__text"})}),i.trace&&a(T,{children:d(r,{as:"code",className:"notification__trace",children:[a(r,{as:"strong",className:"notification__traceLabel",children:"Trace:"}),a(r,{className:"notification__traceText",children:i.trace})]})})]})})]})})};var ve=Object.defineProperty,Oe=Object.defineProperties,xe=Object.getOwnPropertyDescriptors,L=Object.getOwnPropertySymbols,we=Object.prototype.hasOwnProperty,_e=Object.prototype.propertyIsEnumerable,I=(t,e,n)=>e in t?ve(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ne=(t,e)=>{for(var n in e||(e={}))we.call(e,n)&&I(t,n,e[n]);if(L)for(var n of L(e))_e.call(e,n)&&I(t,n,e[n]);return t},je=(t,e)=>Oe(t,xe(e));const Se=Y`
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import React__default from 'react';
4
+ import { Alert, Box, Close, makeStyledComponent, spacing, getVariant } from '@apia/theme';
5
+ import { CSSTransition } from 'react-transition-group';
6
+ import { getSpecificParent, getIndex, useUpdateEffect, useUnmount, arrayOrArray } from '@apia/util';
7
+ import { isIconName, Icon } from '@apia/icons';
8
+ import { uniqueId } from 'lodash-es';
9
+ import { createSlice, injectReducers } from '@apia/store';
10
+ import { keyframes } from '@emotion/react';
11
+
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
+ var __defProp$2 = Object.defineProperty;
99
+ var __defProps$1 = Object.defineProperties;
100
+ var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
101
+ var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
102
+ var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
103
+ var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
104
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
105
+ var __spreadValues$2 = (a, b) => {
106
+ for (var prop in b || (b = {}))
107
+ if (__hasOwnProp$2.call(b, prop))
108
+ __defNormalProp$2(a, prop, b[prop]);
109
+ if (__getOwnPropSymbols$2)
110
+ for (var prop of __getOwnPropSymbols$2(b)) {
111
+ if (__propIsEnum$2.call(b, prop))
112
+ __defNormalProp$2(a, prop, b[prop]);
113
+ }
114
+ return a;
115
+ };
116
+ var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
117
+ const onCloseNotificationCallbacks = {};
118
+ class DefaultNotifier {
119
+ areNotificationsOpen() {
120
+ return !!document.querySelector(".notification");
121
+ }
122
+ close(id) {
123
+ notificationsStore.dispatch(
124
+ notificationsActions.close({ id: typeof id === "object" ? id.id : id })
125
+ );
126
+ }
127
+ closeAll() {
128
+ notificationsStore.dispatch(notificationsActions.closeAll());
129
+ }
130
+ delete(id) {
131
+ notificationsStore.dispatch(
132
+ notificationsActions.delete({ id: typeof id === "object" ? id.id : id })
133
+ );
134
+ }
135
+ getSelector() {
136
+ return (selector) => {
137
+ return useNotificationsSelector((global) => {
138
+ return selector(
139
+ global.notificationsSlice.notifications
140
+ );
141
+ });
142
+ };
143
+ }
144
+ notify(notification) {
145
+ var _a, _b;
146
+ 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
+ );
161
+ }
162
+ }
163
+ const defaultNotifier = new DefaultNotifier();
164
+ function notify(notification) {
165
+ new DefaultNotifier().notify(notification);
166
+ }
167
+
168
+ var __defProp$1 = Object.defineProperty;
169
+ var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
170
+ var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
171
+ var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
172
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
173
+ var __spreadValues$1 = (a, b) => {
174
+ for (var prop in b || (b = {}))
175
+ if (__hasOwnProp$1.call(b, prop))
176
+ __defNormalProp$1(a, prop, b[prop]);
177
+ if (__getOwnPropSymbols$1)
178
+ for (var prop of __getOwnPropSymbols$1(b)) {
179
+ if (__propIsEnum$1.call(b, prop))
180
+ __defNormalProp$1(a, prop, b[prop]);
181
+ }
182
+ return a;
183
+ };
184
+ const Notification = ({
185
+ animationName = "fromRight",
186
+ animationTimeout = 150,
187
+ className,
188
+ disableClose,
189
+ notification
190
+ }) => {
191
+ const innerNotification = React.useMemo(
192
+ () => __spreadValues$1({}, notification),
193
+ [notification]
194
+ );
195
+ const nodeRef = React.useRef(null);
196
+ if (!innerNotification.title)
197
+ innerNotification.title = getIndex(
198
+ [window.LBL_ERROR, window.LBL_WARNING, window.LBL_COMPLETE_OPERATION],
199
+ [
200
+ innerNotification.type === "danger",
201
+ innerNotification.type === "warning",
202
+ innerNotification.type === "success"
203
+ ]
204
+ );
205
+ if (!innerNotification.icon)
206
+ innerNotification.icon = getIndex(
207
+ ["Check", "Alert", "Close"],
208
+ [
209
+ innerNotification.type === "success",
210
+ innerNotification.type === "warning",
211
+ innerNotification.type === "danger"
212
+ ]
213
+ );
214
+ const [shouldShow, setShouldShow] = React.useState(true);
215
+ const close = React.useCallback(() => {
216
+ defaultNotifier.delete(innerNotification);
217
+ }, [innerNotification]);
218
+ useUpdateEffect(() => {
219
+ if (!innerNotification.isOpen)
220
+ setShouldShow(false);
221
+ }, [innerNotification.isOpen]);
222
+ useUnmount(() => {
223
+ if (onCloseNotificationCallbacks[innerNotification.id])
224
+ onCloseNotificationCallbacks[innerNotification.id]();
225
+ });
226
+ let notificationType = "warning";
227
+ if (["sysException", "exception", "danger"].includes(innerNotification.type))
228
+ notificationType = "danger";
229
+ if (["greenMessage", "success"].includes(innerNotification.type))
230
+ notificationType = "success";
231
+ const onClick = React.useCallback(() => {
232
+ setShouldShow(false);
233
+ }, []);
234
+ return /* @__PURE__ */ jsx(
235
+ CSSTransition,
236
+ {
237
+ in: shouldShow,
238
+ timeout: animationTimeout,
239
+ classNames: animationName,
240
+ appear: true,
241
+ unmountOnExit: true,
242
+ onExited: close,
243
+ nodeRef,
244
+ children: /* @__PURE__ */ jsxs(
245
+ Alert,
246
+ {
247
+ "data-testid": notificationType,
248
+ role: "alert",
249
+ ref: nodeRef,
250
+ variant: `alerts.${notificationType}`,
251
+ className: `${className != null ? className : ""} notification notification__alert ${notificationType}`,
252
+ tabIndex: 0,
253
+ onKeyDown: React.useCallback((ev) => {
254
+ if (ev.key.toLowerCase() === "escape" || ev.key.toLowerCase() === "enter" || ev.key === " ") {
255
+ ev.preventDefault();
256
+ ev.stopPropagation();
257
+ setShouldShow(false);
258
+ }
259
+ }, []),
260
+ children: [
261
+ (!disableClose || innerNotification.icon || innerNotification.title) && /* @__PURE__ */ jsxs(Box, { className: "notification__header", children: [
262
+ (innerNotification.title || innerNotification.icon) && /* @__PURE__ */ jsxs(Box, { as: "h4", className: "notification__title", children: [
263
+ innerNotification.icon && /* @__PURE__ */ jsx(Box, { className: "notification__icon", children: isIconName(
264
+ innerNotification.icon
265
+ ) ? /* @__PURE__ */ jsx(
266
+ Icon,
267
+ {
268
+ title: "",
269
+ name: innerNotification.icon
270
+ }
271
+ ) : innerNotification.icon }),
272
+ innerNotification.title
273
+ ] }),
274
+ !disableClose && /* @__PURE__ */ jsx(
275
+ Close,
276
+ {
277
+ type: "button",
278
+ onClick,
279
+ tabIndex: -1,
280
+ className: "notification__closeButton"
281
+ }
282
+ )
283
+ ] }),
284
+ /* @__PURE__ */ jsx(Box, { className: "notification__body", children: /* @__PURE__ */ jsxs(Box, { className: "notification__content", children: [
285
+ /* @__PURE__ */ jsx(Box, { className: "notification__message", children: /* @__PURE__ */ jsx(
286
+ Box,
287
+ {
288
+ dangerouslySetInnerHTML: {
289
+ __html: innerNotification.message
290
+ },
291
+ className: "notification__text"
292
+ }
293
+ ) }),
294
+ innerNotification.trace && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Box, { as: "code", className: "notification__trace", children: [
295
+ /* @__PURE__ */ jsx(Box, { as: "strong", className: "notification__traceLabel", children: "Trace:" }),
296
+ /* @__PURE__ */ jsx(Box, { className: "notification__traceText", children: innerNotification.trace })
297
+ ] }) })
298
+ ] }) })
299
+ ]
300
+ }
301
+ )
302
+ }
303
+ );
304
+ };
305
+
306
+ var __defProp = Object.defineProperty;
307
+ var __defProps = Object.defineProperties;
308
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
309
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
310
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
311
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
312
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
313
+ var __spreadValues = (a, b) => {
314
+ for (var prop in b || (b = {}))
315
+ if (__hasOwnProp.call(b, prop))
316
+ __defNormalProp(a, prop, b[prop]);
317
+ if (__getOwnPropSymbols)
318
+ for (var prop of __getOwnPropSymbols(b)) {
319
+ if (__propIsEnum.call(b, prop))
320
+ __defNormalProp(a, prop, b[prop]);
321
+ }
322
+ return a;
323
+ };
324
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
325
+ const vibrate = keyframes`
2
326
  0% {
3
327
  transform: rotate(0);
4
328
  }
@@ -13,4 +337,122 @@ import{jsx as a,jsxs as d,Fragment as T}from"react/jsx-runtime";import*as l from
13
337
 
14
338
  100% {
15
339
  transform: rotate(0);
16
- }`,Pe=O.getSelector(),$e=V("NotificationsList","layout.common.notifications.list",{".notificationsFloatingList":{bottom:"10px",height:"min-content",maxHeight:"calc(100vh - 20px)",maxWidth:"floatingNotifications",position:"fixed",pr:"5px",right:"5px",width:"100%",zIndex:"notifications","& > *:not(:last-child)":{mb:J(5)},".notification.animate":{animation:`${Se} 0.1s linear infinite`}},".fromRight-enter, .fromRight-appear":{transform:"translateX(550px)"},".fromRight-enter-active, .fromRight-appear-active":{transition:"transform 150ms",transform:"translateX(0)"},".fromRight-exit":{transform:"translateX(0)"},".fromRight-exit-active":{transition:"transform 150ms",transform:"translateX(550px)"}},()=>{const t=Pe(e=>e);return a(r,je(Ne({className:"notificationsFloatingList"},Q("layout.common.components.notifications.list")),{children:t.map(e=>a(E,{notification:e},e.id))}))});var Ce=M.memo($e);const Ee=t=>{var e,n;const o=[];return(e=t?.sysMessages)!=null&&e.message&&o.push(...c(t.sysMessages.message,"warning")),t!=null&&t.sysExceptions&&o.push(...c(t.sysExceptions.exception,"danger")),(n=t?.exceptions)!=null&&n.exception&&o.push(...c(t.exceptions.exception,"danger")),o.length>0?o:null};function Le(t){switch(t){case"1":return"success";case"2":return"warning";case"3":return"danger";default:return"warning"}}const c=(t,e)=>U(t).map(n=>({message:n.text,trace:n.content,title:n.title,type:n.type!==void 0?Le(n.type):e,isOpen:!0,id:w()})),Ie=t=>{var e,n,o,s,i,f;t&&((e=t.sysMessages)!=null&&e.message&&c((n=t.sysMessages)==null?void 0:n.message,"warning").forEach(b),(o=t.exceptions)!=null&&o.exception&&c((s=t.exceptions)==null?void 0:s.exception,"danger").forEach(b),(i=t.sysExceptions)!=null&&i.exception&&c((f=t.sysExceptions)==null?void 0:f.exception,"danger").forEach(b))};export{v as DefaultNotifier,E as Notification,Ce as NotificationsList,O as defaultNotifier,Ie as dispatchNotifications,Ee as getNotificationMessageObj,b as notify,g as onCloseNotificationCallbacks,c as parseServerNotification};
340
+ }`;
341
+ const useSelector = defaultNotifier.getSelector();
342
+ const NotificationsList = makeStyledComponent(
343
+ "NotificationsList",
344
+ "layout.common.notifications.list",
345
+ {
346
+ ".notificationsFloatingList": {
347
+ bottom: "10px",
348
+ height: "min-content",
349
+ maxHeight: "calc(100vh - 20px)",
350
+ maxWidth: "floatingNotifications",
351
+ position: "fixed",
352
+ pr: "5px",
353
+ right: "5px",
354
+ width: "100%",
355
+ zIndex: "notifications",
356
+ "& > *:not(:last-child)": {
357
+ mb: spacing(5)
358
+ },
359
+ ".notification.animate": {
360
+ animation: `${vibrate} 0.1s linear infinite`
361
+ }
362
+ },
363
+ ".fromRight-enter, .fromRight-appear": { transform: "translateX(550px)" },
364
+ ".fromRight-enter-active, .fromRight-appear-active": {
365
+ transition: "transform 150ms",
366
+ transform: "translateX(0)"
367
+ },
368
+ ".fromRight-exit": { transform: "translateX(0)" },
369
+ ".fromRight-exit-active": {
370
+ transition: "transform 150ms",
371
+ transform: "translateX(550px)"
372
+ }
373
+ },
374
+ () => {
375
+ const notifications = useSelector((current) => {
376
+ return current;
377
+ });
378
+ return /* @__PURE__ */ jsx(
379
+ Box,
380
+ __spreadProps(__spreadValues({
381
+ className: "notificationsFloatingList"
382
+ }, getVariant("layout.common.components.notifications.list")), {
383
+ children: notifications.map((current) => {
384
+ return /* @__PURE__ */ jsx(Notification, { notification: current }, current.id);
385
+ })
386
+ })
387
+ );
388
+ }
389
+ );
390
+ var NotificationsList$1 = React__default.memo(NotificationsList);
391
+
392
+ const getNotificationMessageObj = (data) => {
393
+ var _a, _b;
394
+ const notifications = [];
395
+ if ((_a = data == null ? void 0 : data.sysMessages) == null ? void 0 : _a.message) {
396
+ notifications.push(
397
+ ...parseServerNotification(data.sysMessages.message, "warning")
398
+ );
399
+ }
400
+ if (data == null ? void 0 : data.sysExceptions) {
401
+ notifications.push(
402
+ ...parseServerNotification(data.sysExceptions.exception, "danger")
403
+ );
404
+ }
405
+ if ((_b = data == null ? void 0 : data.exceptions) == null ? void 0 : _b.exception) {
406
+ notifications.push(
407
+ ...parseServerNotification(data.exceptions.exception, "danger")
408
+ );
409
+ }
410
+ if (notifications.length > 0)
411
+ return notifications;
412
+ return null;
413
+ };
414
+ function parseServerNotificationType(type) {
415
+ switch (type) {
416
+ case "1":
417
+ return "success";
418
+ case "2":
419
+ return "warning";
420
+ case "3":
421
+ return "danger";
422
+ default:
423
+ return "warning";
424
+ }
425
+ }
426
+ const parseServerNotification = (serverNotification, type) => {
427
+ const messages = arrayOrArray(serverNotification);
428
+ return messages.map((current) => {
429
+ const returnNotification = {
430
+ message: current.text,
431
+ trace: current.content,
432
+ title: current.title,
433
+ type: current.type !== void 0 ? parseServerNotificationType(current.type) : type,
434
+ isOpen: true,
435
+ id: uniqueId()
436
+ };
437
+ return returnNotification;
438
+ });
439
+ };
440
+ const dispatchNotifications = (alert) => {
441
+ var _a, _b, _c, _d, _e, _f;
442
+ if (alert) {
443
+ if ((_a = alert.sysMessages) == null ? void 0 : _a.message)
444
+ parseServerNotification((_b = alert.sysMessages) == null ? void 0 : _b.message, "warning").forEach(
445
+ notify
446
+ );
447
+ if ((_c = alert.exceptions) == null ? void 0 : _c.exception)
448
+ parseServerNotification((_d = alert.exceptions) == null ? void 0 : _d.exception, "danger").forEach(
449
+ notify
450
+ );
451
+ if ((_e = alert.sysExceptions) == null ? void 0 : _e.exception)
452
+ parseServerNotification((_f = alert.sysExceptions) == null ? void 0 : _f.exception, "danger").forEach(
453
+ notify
454
+ );
455
+ }
456
+ };
457
+
458
+ export { DefaultNotifier, Notification, NotificationsList$1 as NotificationsList, defaultNotifier, dispatchNotifications, getNotificationMessageObj, notify, onCloseNotificationCallbacks, parseServerNotification };
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 'theme-ui';\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 'theme-ui';\nimport { getVariant, makeStyledComponent, spacing } from '@apia/theme';\nimport { keyframes } from '@emotion/react';\nimport { Notification } from './Notification';\nimport { defaultNotifier } from './defaultNotifier';\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 useSelector = defaultNotifier.getSelector();\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 = useSelector((current) => {\n return current;\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;AAC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AwB,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/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 { defaultNotifier } from './defaultNotifier';\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 useSelector = defaultNotifier.getSelector();\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 = useSelector((current) => {\n return current;\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,gDAAg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A,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.1.3",
9
+ "version": "0.2.4",
10
10
  "scripts": {
11
11
  "build": "rollup -c rollup.config.esb.mjs",
12
12
  "buildDev": "rollup -c rollup.config.esb.mjs --dev",
@@ -26,10 +26,10 @@
26
26
  "typescript": "^4.9.5"
27
27
  },
28
28
  "dependencies": {
29
- "@apia/icons": "^0.1.3",
30
- "@apia/store": "^0.1.0",
31
- "@apia/theme": "^0.1.3",
32
- "@apia/util": "^0.1.3",
29
+ "@apia/icons": "^0.2.4",
30
+ "@apia/store": "^0.2.4",
31
+ "@apia/theme": "^0.2.4",
32
+ "@apia/util": "^0.2.4",
33
33
  "@types/lodash-es": "^4.17.7",
34
34
  "@types/react-transition-group": "^4.4.5",
35
35
  "lodash-es": "^4.17.21",
@@ -38,8 +38,7 @@
38
38
  "peerDependencies": {
39
39
  "@emotion/react": "^11.10.6",
40
40
  "react": "^18.2.0",
41
- "react-dom": "^18.2.0",
42
- "theme-ui": "^0.15.5"
41
+ "react-dom": "^18.2.0"
43
42
  },
44
43
  "publishConfig": {
45
44
  "access": "public",
@@ -50,5 +49,5 @@
50
49
  "url": "http://corp-gitlab-01.domst.st.net/products/apia/ApiaNPMPackages.git",
51
50
  "directory": "packages/notifications"
52
51
  },
53
- "gitHead": "26592fdfe0290bfed776776bf9dbe5d3ac2c7341"
52
+ "gitHead": "f14ade3161fb978c89e9f0949e46aca54d2e1db3"
54
53
  }