namirasoft-account-react 1.3.12 → 1.3.14

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.
@@ -11,6 +11,6 @@ export declare class Messenger {
11
11
  onSuccess(text: string): void;
12
12
  onWarning(text: string): void;
13
13
  onError(error: Error | string): void;
14
- delNotification(id: number): void;
14
+ delNotification(id: string): void;
15
15
  getNotifications(): NSNotificationProps[];
16
16
  }
package/dist/Messenger.js CHANGED
@@ -19,14 +19,12 @@ class Messenger {
19
19
  this.getNotifications = this.getNotifications.bind(this);
20
20
  }
21
21
  notify(message) {
22
- var _a;
23
22
  let state = this.state;
24
23
  if (!state)
25
24
  state = {};
26
25
  if (!state.notifications)
27
26
  state.notifications = [];
28
- let id = parseInt((_a = message.id) !== null && _a !== void 0 ? _a : `${Messenger.Counter++}`);
29
- state.notifications[id] = message;
27
+ state.notifications.push(message);
30
28
  this.setState(state);
31
29
  setTimeout(() => {
32
30
  message.onClose();
@@ -34,20 +32,20 @@ class Messenger {
34
32
  window.scrollTo({ top: 0, left: 0, behavior: 'smooth' });
35
33
  }
36
34
  onInformation(text) {
37
- let id = Messenger.Counter++;
38
- this.notify({ id: id.toString(), text, type: namirasoft_site_react_1.NotificationType.Information, color: namirasoft_site_react_1.NSNotificationColor.GRAY, onClose: () => this.delNotification(id) });
35
+ let id = Messenger.Counter++ + "";
36
+ this.notify({ id, text, type: namirasoft_site_react_1.NotificationType.Information, color: namirasoft_site_react_1.NSNotificationColor.GRAY, onClose: () => this.delNotification(id) });
39
37
  }
40
38
  onSuccess(text) {
41
- let id = Messenger.Counter++;
42
- this.notify({ id: id.toString(), text, type: namirasoft_site_react_1.NotificationType.Success, color: namirasoft_site_react_1.NSNotificationColor.GREEN, onClose: () => this.delNotification(id) });
39
+ let id = Messenger.Counter++ + "";
40
+ this.notify({ id, text, type: namirasoft_site_react_1.NotificationType.Success, color: namirasoft_site_react_1.NSNotificationColor.GREEN, onClose: () => this.delNotification(id) });
43
41
  }
44
42
  onWarning(text) {
45
- let id = Messenger.Counter++;
46
- this.notify({ id: id.toString(), text, type: namirasoft_site_react_1.NotificationType.Warning, color: namirasoft_site_react_1.NSNotificationColor.YELLOW, onClose: () => this.delNotification(id) });
43
+ let id = Messenger.Counter++ + "";
44
+ this.notify({ id, text, type: namirasoft_site_react_1.NotificationType.Warning, color: namirasoft_site_react_1.NSNotificationColor.YELLOW, onClose: () => this.delNotification(id) });
47
45
  }
48
46
  onError(error) {
49
47
  var _a;
50
- let id = Messenger.Counter++;
48
+ let id = Messenger.Counter++ + "";
51
49
  let text = "";
52
50
  if (error instanceof Error) {
53
51
  text = error.message;
@@ -57,14 +55,14 @@ class Messenger {
57
55
  }
58
56
  else
59
57
  text = error;
60
- this.notify({ id: id.toString(), text, type: namirasoft_site_react_1.NotificationType.Error, color: namirasoft_site_react_1.NSNotificationColor.RED, onClose: () => this.delNotification(id) });
58
+ this.notify({ id, text, type: namirasoft_site_react_1.NotificationType.Error, color: namirasoft_site_react_1.NSNotificationColor.RED, onClose: () => this.delNotification(id) });
61
59
  }
62
60
  delNotification(id) {
63
61
  let state = this.state;
64
62
  if (!state)
65
63
  state = {};
66
64
  if (state.notifications)
67
- delete state.notifications[id];
65
+ state.notifications = state.notifications.filter(x => x.id !== id);
68
66
  this.setState(state);
69
67
  }
70
68
  getNotifications() {
@@ -1 +1 @@
1
- {"version":3,"file":"Messenger.js","sourceRoot":"","sources":["../src/Messenger.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,iEAAmG;AAEnG,MAAa,SAAS;IAKlB,YAAY,KAA+B,EAAE,QAAwE;QAEjH,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,C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mB,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACrI,CAAC;IACD,eAAe,CAAC,EAAU;QAEtB,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACvB,IAAI,CAAC,KAAK;YACN,KAAK,GAAG,EAAE,CAAC;QACf,IAAI,KAAK,CAAC,aAAa;YACnB,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACvE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;IACD,gBAAgB;;QAEZ,OAAO,MAAA,MAAA,IAAI,CAAC,KAAK,0CAAE,aAAa,mCAAI,EAAE,CAAC;IAC3C,CAAC;;AA1EL,8BA2EC;AAzEkB,iBAAO,GAAW,CAAC,CAAC"}
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "framework": "npm",
9
9
  "application": "package",
10
10
  "private": false,
11
- "version": "1.3.12",
11
+ "version": "1.3.14",
12
12
  "author": "Amir Abolhasani",
13
13
  "license": "MIT",
14
14
  "main": "./dist/index.js",
@@ -22,7 +22,7 @@
22
22
  "device-uuid": "^1.0.4",
23
23
  "namirasoft-account": "^1.3.8",
24
24
  "namirasoft-core": "^1.3.19",
25
- "namirasoft-site-react": "^1.3.65",
25
+ "namirasoft-site-react": "^1.3.66",
26
26
  "query-string": "^9.0.0",
27
27
  "react": "^18.2.0",
28
28
  "react-router-dom": "^6.22.3",
package/src/Messenger.ts CHANGED
@@ -26,8 +26,7 @@ export class Messenger
26
26
  state = {};
27
27
  if (!state.notifications)
28
28
  state.notifications = [];
29
- let id = parseInt(message.id ?? `${Messenger.Counter++}`);
30
- state.notifications[id] = message;
29
+ state.notifications.push(message);
31
30
  this.setState(state);
32
31
  setTimeout(() =>
33
32
  {
@@ -37,22 +36,22 @@ export class Messenger
37
36
  }
38
37
  onInformation(text: string)
39
38
  {
40
- let id = Messenger.Counter++;
41
- this.notify({ id: id.toString(), text, type: NotificationType.Information, color: NSNotificationColor.GRAY, onClose: () => this.delNotification(id) });
39
+ let id = Messenger.Counter++ + "";
40
+ this.notify({ id, text, type: NotificationType.Information, color: NSNotificationColor.GRAY, onClose: () => this.delNotification(id) });
42
41
  }
43
42
  onSuccess(text: string)
44
43
  {
45
- let id = Messenger.Counter++;
46
- this.notify({ id: id.toString(), text, type: NotificationType.Success, color: NSNotificationColor.GREEN, onClose: () => this.delNotification(id) });
44
+ let id = Messenger.Counter++ + "";
45
+ this.notify({ id, text, type: NotificationType.Success, color: NSNotificationColor.GREEN, onClose: () => this.delNotification(id) });
47
46
  }
48
47
  onWarning(text: string)
49
48
  {
50
- let id = Messenger.Counter++;
51
- this.notify({ id: id.toString(), text, type: NotificationType.Warning, color: NSNotificationColor.YELLOW, onClose: () => this.delNotification(id) });
49
+ let id = Messenger.Counter++ + "";
50
+ this.notify({ id, text, type: NotificationType.Warning, color: NSNotificationColor.YELLOW, onClose: () => this.delNotification(id) });
52
51
  }
53
52
  onError(error: Error | string)
54
53
  {
55
- let id = Messenger.Counter++;
54
+ let id = Messenger.Counter++ + "";
56
55
  let text: string = "";
57
56
  if (error instanceof Error)
58
57
  {
@@ -63,15 +62,15 @@ export class Messenger
63
62
  }
64
63
  else
65
64
  text = error;
66
- this.notify({ id: id.toString(), text, type: NotificationType.Error, color: NSNotificationColor.RED, onClose: () => this.delNotification(id) });
65
+ this.notify({ id, text, type: NotificationType.Error, color: NSNotificationColor.RED, onClose: () => this.delNotification(id) });
67
66
  }
68
- delNotification(id: number): void
67
+ delNotification(id: string): void
69
68
  {
70
69
  let state = this.state;
71
70
  if (!state)
72
71
  state = {};
73
72
  if (state.notifications)
74
- delete state.notifications[id];
73
+ state.notifications = state.notifications.filter(x => x.id !== id);
75
74
  this.setState(state);
76
75
  }
77
76
  getNotifications(): NSNotificationProps[]