eservices-core 1.0.520 → 1.0.521

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.
@@ -6,13 +6,14 @@ declare const _default: {
6
6
  id: number;
7
7
  type: "error" | "warning" | "info";
8
8
  msg: string;
9
- children?: {
10
- id: number;
11
- msg: string;
12
- }[];
9
+ children: string[];
10
+ timeout: number;
13
11
  }[];
14
12
  /**
15
- * @description Adding new card to store
13
+ * @description Adding new Notification Item.
14
+ * @param type Type of current notification
15
+ * @param msg {String} Text message of notification item.
16
+ * @param options Params for current notification item: children, timeout (Default 10) in seconds.
16
17
  */
17
18
  add(type: INotificationCard["type"], msg: string, { children, timeout }?: {
18
19
  children?: string[];
@@ -32,8 +33,5 @@ export interface INotificationCard {
32
33
  id: number;
33
34
  type: 'error' | 'warning' | 'info';
34
35
  msg: string;
35
- children?: {
36
- id: number;
37
- msg: string;
38
- }[];
36
+ children: string[];
39
37
  }
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * eservices-core v1.0.520
2
+ * eservices-core v1.0.521
3
3
  * (c) 2023 ESERVICES
4
4
  */
5
5
  'use strict';
@@ -1612,52 +1612,65 @@ var spinners = {
1612
1612
  WidgetSpinner: script$w
1613
1613
  };
1614
1614
 
1615
- var _a;
1616
- var NotificationSystem = new (_a = class NotificationSystem {
1617
- constructor() {
1618
- /**
1619
- * @description Array of current cards.
1620
- */
1621
- this.store = vue.reactive([]);
1622
- }
1615
+ /**
1616
+ * @description Notification system with array of cards.
1617
+ */
1618
+ var NotificationSystem = new class NotificationSystem {
1619
+ constructor() {
1623
1620
  /**
1624
- * @description Adding new card to store
1621
+ * @description Array of current cards.
1625
1622
  */
1626
- add(type, msg, { children, timeout = 10 } = {}) {
1627
- const cardId = NotificationSystem.cardId++;
1628
- this.store.push({
1629
- type, msg,
1630
- children: (children === null || children === void 0 ? void 0 : children.map((msg, id) => ({ msg, id }))) || [],
1631
- id: cardId
1632
- });
1633
- if (timeout)
1634
- setTimeout(() => this.remove(cardId), timeout * 1000);
1635
- }
1636
- /**
1637
- * @description Function remove item by id. Return true if card was founded, otherwise false.
1638
- * */
1639
- remove(id) {
1640
- const cardIndex = this.store.findIndex(card => card.id === id);
1641
- if (cardIndex === -1)
1642
- return false; // Item not founded in the store
1643
- this.store.splice(cardIndex, 1);
1644
- }
1645
- /**
1646
- * @description Removing child message, Throwing error if card of children not founded.
1647
- * */
1648
- removeChild(cardId, childId) {
1649
- var _a, _b;
1650
- const card = this.store.find(card => card.id === cardId);
1651
- if (!card)
1652
- throw new Error(`Undefined card with id: ${cardId}`);
1653
- const childIndex = (_a = card.children) === null || _a === void 0 ? void 0 : _a.findIndex(child => child.id === childId);
1654
- if (childIndex === undefined || childIndex === -1)
1655
- throw new Error(`Undefined children id: ${childId} in card ${cardId}`);
1656
- (_b = card.children) === null || _b === void 0 ? void 0 : _b.splice(childIndex, 1);
1657
- }
1658
- },
1659
- _a.cardId = 0,
1660
- _a);
1623
+ this.store = vue.reactive([]);
1624
+ }
1625
+ /**
1626
+ * @description Adding new Notification Item.
1627
+ * @param type Type of current notification
1628
+ * @param msg {String} Text message of notification item.
1629
+ * @param options Params for current notification item: children, timeout (Default 10) in seconds.
1630
+ */
1631
+ add(type, msg, { children, timeout = 10 } = {}) {
1632
+ const card = new NotificationCard(type, msg, children || [], timeout);
1633
+ this.store.push(card);
1634
+ if (timeout)
1635
+ setTimeout(() => this.remove(card.id), timeout * 1000);
1636
+ }
1637
+ /**
1638
+ * @description Function remove item by id. Return true if card was founded, otherwise false.
1639
+ * */
1640
+ remove(id) {
1641
+ const cardIndex = this.store.findIndex(card => card.id === id);
1642
+ if (cardIndex === -1)
1643
+ return false; // Item not founded in the store
1644
+ this.store.splice(cardIndex, 1);
1645
+ }
1646
+ /**
1647
+ * @description Removing child message, Throwing error if card of children not founded.
1648
+ * */
1649
+ removeChild(cardId, childId) {
1650
+ throw new Error('Removing children error.');
1651
+ /*
1652
+ const card = this.store.find(card => card.id === cardId);
1653
+ if (!card) throw new Error(`Undefined card with id: ${cardId}`);
1654
+
1655
+ const childIndex = card.children?.findIndex(child => child.id === childId);
1656
+ if (childIndex === undefined || childIndex === -1)
1657
+ throw new Error(`Undefined children id: ${childId} in card ${cardId}`);
1658
+
1659
+ card.children?.splice(childIndex, 1);
1660
+
1661
+ */
1662
+ }
1663
+ };
1664
+ class NotificationCard {
1665
+ constructor(type, msg, children, timeout) {
1666
+ this.type = type;
1667
+ this.msg = msg;
1668
+ this.children = children;
1669
+ this.timeout = timeout;
1670
+ this.id = NotificationCard.cardId++;
1671
+ }
1672
+ }
1673
+ NotificationCard.cardId = 1;
1661
1674
 
1662
1675
  const _hoisted_1$k = { class: "widget-error" };
1663
1676
  const _hoisted_2$a = { class: "widget-error-wrap" };
@@ -2167,7 +2180,7 @@ function requestHandler(callback, options = {}) {
2167
2180
  if (error instanceof CoreError)
2168
2181
  NotificationSystem.add('error', error.message, {
2169
2182
  children: error.details || [],
2170
- timeout: 12 * 1000
2183
+ timeout: 12
2171
2184
  });
2172
2185
  else {
2173
2186
  if (error === null || error === void 0 ? void 0 : error.message)
@@ -49,12 +49,12 @@ interface IWizardProcessResponse {
49
49
  statusCode: number;
50
50
  statusName: string;
51
51
  token: string;
52
- validationResults: IValidationItem[];
52
+ validationResults: IWizardValidationItem[];
53
53
  }
54
54
  export declare type IWizardFixedResponse = Omit<IWizardProcessResponse, 'createdEntites'> & {
55
55
  createdEntities: IWizardProcessResponse['createdEntites'];
56
56
  };
57
- export interface IValidationItem {
57
+ export interface IWizardValidationItem {
58
58
  message: string;
59
59
  name: string;
60
60
  statusCode: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eservices-core",
3
- "version": "1.0.520",
3
+ "version": "1.0.521",
4
4
  "description": "Core library",
5
5
  "author": "",
6
6
  "scripts": {