@servicetitan/notifications 28.5.0 → 29.0.0

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.
Files changed (182) hide show
  1. package/dist/__tests__/intercept.test.d.ts +2 -0
  2. package/dist/__tests__/intercept.test.d.ts.map +1 -0
  3. package/dist/__tests__/intercept.test.js +13 -0
  4. package/dist/__tests__/intercept.test.js.map +1 -0
  5. package/dist/__tests__/notifications-service.test.d.ts +2 -0
  6. package/dist/__tests__/notifications-service.test.d.ts.map +1 -0
  7. package/dist/__tests__/notifications-service.test.js +42 -0
  8. package/dist/__tests__/notifications-service.test.js.map +1 -0
  9. package/dist/api/notifications.api.d.ts +2 -2
  10. package/dist/api/notifications.api.d.ts.map +1 -1
  11. package/dist/common.d.ts +4 -22
  12. package/dist/common.d.ts.map +1 -1
  13. package/dist/common.js +4 -11
  14. package/dist/common.js.map +1 -1
  15. package/dist/components/__tests__/notifications.test.d.ts +2 -0
  16. package/dist/components/__tests__/notifications.test.d.ts.map +1 -0
  17. package/dist/components/__tests__/notifications.test.js +93 -0
  18. package/dist/components/__tests__/notifications.test.js.map +1 -0
  19. package/dist/components/notifications.d.ts +8 -1
  20. package/dist/components/notifications.d.ts.map +1 -1
  21. package/dist/components/notifications.js +43 -23
  22. package/dist/components/notifications.js.map +1 -1
  23. package/dist/demo/action-button-preview.d.ts.map +1 -1
  24. package/dist/demo/action-button-preview.js +2 -2
  25. package/dist/demo/action-button-preview.js.map +1 -1
  26. package/dist/demo/basic-preview.d.ts.map +1 -1
  27. package/dist/demo/basic-preview.js +1 -1
  28. package/dist/demo/basic-preview.js.map +1 -1
  29. package/dist/demo/container.d.ts +1 -3
  30. package/dist/demo/container.d.ts.map +1 -1
  31. package/dist/demo/container.js.map +1 -1
  32. package/dist/demo/duration-preview.d.ts.map +1 -1
  33. package/dist/demo/duration-preview.js +2 -2
  34. package/dist/demo/duration-preview.js.map +1 -1
  35. package/dist/demo/multiline-message-preview.d.ts.map +1 -1
  36. package/dist/demo/multiline-message-preview.js +2 -2
  37. package/dist/demo/multiline-message-preview.js.map +1 -1
  38. package/dist/demo/prevent-duplicates-preview.d.ts.map +1 -1
  39. package/dist/demo/prevent-duplicates-preview.js +2 -2
  40. package/dist/demo/prevent-duplicates-preview.js.map +1 -1
  41. package/dist/demo/progress-preview.d.ts.map +1 -1
  42. package/dist/demo/progress-preview.js +2 -2
  43. package/dist/demo/progress-preview.js.map +1 -1
  44. package/dist/demo/server-custom-preview.d.ts +1 -1
  45. package/dist/demo/server-custom-preview.d.ts.map +1 -1
  46. package/dist/demo/server-custom-preview.js +21 -7
  47. package/dist/demo/server-custom-preview.js.map +1 -1
  48. package/dist/demo/server-custom.d.ts +0 -1
  49. package/dist/demo/server-custom.d.ts.map +1 -1
  50. package/dist/demo/server-custom.js +25 -21
  51. package/dist/demo/server-custom.js.map +1 -1
  52. package/dist/demo/server-default.d.ts.map +1 -1
  53. package/dist/demo/server-default.js +1 -1
  54. package/dist/demo/server-default.js.map +1 -1
  55. package/dist/demo/status-variations-preview.d.ts.map +1 -1
  56. package/dist/demo/status-variations-preview.js +2 -2
  57. package/dist/demo/status-variations-preview.js.map +1 -1
  58. package/dist/demo/status-variations.d.ts.map +1 -1
  59. package/dist/demo/status-variations.js.map +1 -1
  60. package/dist/index.d.ts +3 -4
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +3 -4
  63. package/dist/index.js.map +1 -1
  64. package/dist/intercept.d.ts +4 -0
  65. package/dist/intercept.d.ts.map +1 -0
  66. package/dist/intercept.js +5 -0
  67. package/dist/intercept.js.map +1 -0
  68. package/dist/notifications-channel.d.ts +2 -6
  69. package/dist/notifications-channel.d.ts.map +1 -1
  70. package/dist/notifications-channel.js.map +1 -1
  71. package/dist/notifications-service.d.ts +10 -8
  72. package/dist/notifications-service.d.ts.map +1 -1
  73. package/dist/notifications-service.js.map +1 -1
  74. package/dist/notifications.stories.d.ts +14 -0
  75. package/dist/notifications.stories.d.ts.map +1 -0
  76. package/dist/notifications.stories.js +20 -0
  77. package/dist/notifications.stories.js.map +1 -0
  78. package/dist/stores/__mocks__/mock-notifications-channel.d.ts +11 -0
  79. package/dist/stores/__mocks__/mock-notifications-channel.d.ts.map +1 -0
  80. package/dist/stores/__mocks__/mock-notifications-channel.js +36 -0
  81. package/dist/stores/__mocks__/mock-notifications-channel.js.map +1 -0
  82. package/dist/stores/__tests__/notifications.store.test.d.ts +2 -0
  83. package/dist/stores/__tests__/notifications.store.test.d.ts.map +1 -0
  84. package/dist/stores/__tests__/notifications.store.test.js +360 -0
  85. package/dist/stores/__tests__/notifications.store.test.js.map +1 -0
  86. package/dist/stores/notifications.store.d.ts +20 -8
  87. package/dist/stores/notifications.store.d.ts.map +1 -1
  88. package/dist/stores/notifications.store.js +156 -45
  89. package/dist/stores/notifications.store.js.map +1 -1
  90. package/dist/utils/__tests__/date-from-string.test.d.ts +2 -0
  91. package/dist/utils/__tests__/date-from-string.test.d.ts.map +1 -0
  92. package/dist/utils/__tests__/date-from-string.test.js +39 -0
  93. package/dist/utils/__tests__/date-from-string.test.js.map +1 -0
  94. package/dist/utils/__tests__/use-compatible-navigate.test.d.ts +2 -0
  95. package/dist/utils/__tests__/use-compatible-navigate.test.d.ts.map +1 -0
  96. package/dist/utils/__tests__/use-compatible-navigate.test.js +27 -0
  97. package/dist/utils/__tests__/use-compatible-navigate.test.js.map +1 -0
  98. package/dist/utils/date-from-string.d.ts.map +1 -0
  99. package/dist/utils/date-from-string.js +19 -0
  100. package/dist/utils/date-from-string.js.map +1 -0
  101. package/package.json +6 -6
  102. package/src/__tests__/intercept.test.ts +18 -0
  103. package/src/__tests__/notifications-service.test.ts +62 -0
  104. package/src/api/notifications.api.ts +2 -2
  105. package/src/common.ts +12 -27
  106. package/src/components/__tests__/notifications.test.tsx +107 -0
  107. package/src/components/notifications.tsx +59 -36
  108. package/src/demo/action-button-preview.tsx +4 -6
  109. package/src/demo/basic-preview.tsx +2 -4
  110. package/src/demo/container.tsx +1 -4
  111. package/src/demo/duration-preview.tsx +4 -6
  112. package/src/demo/multiline-message-preview.tsx +3 -9
  113. package/src/demo/prevent-duplicates-preview.tsx +3 -9
  114. package/src/demo/progress-preview.tsx +3 -9
  115. package/src/demo/server-custom-preview.tsx +17 -14
  116. package/src/demo/server-custom.tsx +30 -29
  117. package/src/demo/server-default.tsx +1 -3
  118. package/src/demo/status-variations-preview.tsx +4 -6
  119. package/src/demo/status-variations.tsx +0 -1
  120. package/src/index.ts +13 -4
  121. package/src/intercept.ts +14 -0
  122. package/src/notifications-channel.ts +2 -6
  123. package/src/notifications-service.ts +14 -42
  124. package/src/stores/__mocks__/mock-notifications-channel.ts +31 -0
  125. package/src/stores/__tests__/notifications.store.test.ts +458 -0
  126. package/src/stores/notifications.store.ts +178 -53
  127. package/src/utils/__tests__/date-from-string.test.ts +53 -0
  128. package/src/utils/__tests__/use-compatible-navigate.test.ts +43 -0
  129. package/src/utils/date-from-string.ts +22 -0
  130. package/dist/components/__tests__/container.test.d.ts +0 -2
  131. package/dist/components/__tests__/container.test.d.ts.map +0 -1
  132. package/dist/components/__tests__/container.test.js +0 -59
  133. package/dist/components/__tests__/container.test.js.map +0 -1
  134. package/dist/components/container.d.ts +0 -3
  135. package/dist/components/container.d.ts.map +0 -1
  136. package/dist/components/container.js +0 -26
  137. package/dist/components/container.js.map +0 -1
  138. package/dist/components/default-notification.d.ts +0 -7
  139. package/dist/components/default-notification.d.ts.map +0 -1
  140. package/dist/components/default-notification.js +0 -26
  141. package/dist/components/default-notification.js.map +0 -1
  142. package/dist/components/default-notification.module.css +0 -3
  143. package/dist/components/no-ssr.d.ts +0 -5
  144. package/dist/components/no-ssr.d.ts.map +0 -1
  145. package/dist/components/no-ssr.js +0 -9
  146. package/dist/components/no-ssr.js.map +0 -1
  147. package/dist/components/notifications-unwrapped.d.ts +0 -3
  148. package/dist/components/notifications-unwrapped.d.ts.map +0 -1
  149. package/dist/components/notifications-unwrapped.js +0 -27
  150. package/dist/components/notifications-unwrapped.js.map +0 -1
  151. package/dist/components/shadow-dom.d.ts +0 -3
  152. package/dist/components/shadow-dom.d.ts.map +0 -1
  153. package/dist/components/shadow-dom.js +0 -41
  154. package/dist/components/shadow-dom.js.map +0 -1
  155. package/dist/components/use-style-sheets.d.ts +0 -2
  156. package/dist/components/use-style-sheets.d.ts.map +0 -1
  157. package/dist/components/use-style-sheets.js +0 -15
  158. package/dist/components/use-style-sheets.js.map +0 -1
  159. package/dist/create-element.d.ts +0 -2
  160. package/dist/create-element.d.ts.map +0 -1
  161. package/dist/create-element.js +0 -8
  162. package/dist/create-element.js.map +0 -1
  163. package/dist/date-from-string.d.ts.map +0 -1
  164. package/dist/date-from-string.js +0 -27
  165. package/dist/date-from-string.js.map +0 -1
  166. package/dist/register.d.ts +0 -3
  167. package/dist/register.d.ts.map +0 -1
  168. package/dist/register.js +0 -5
  169. package/dist/register.js.map +0 -1
  170. package/src/components/__tests__/container.test.tsx +0 -71
  171. package/src/components/container.tsx +0 -35
  172. package/src/components/default-notification.module.css +0 -3
  173. package/src/components/default-notification.module.css.d.ts +0 -4
  174. package/src/components/default-notification.tsx +0 -59
  175. package/src/components/no-ssr.tsx +0 -11
  176. package/src/components/notifications-unwrapped.tsx +0 -51
  177. package/src/components/shadow-dom.tsx +0 -53
  178. package/src/components/use-style-sheets.ts +0 -19
  179. package/src/create-element.ts +0 -12
  180. package/src/date-from-string.ts +0 -30
  181. package/src/register.ts +0 -6
  182. /package/dist/{date-from-string.d.ts → utils/date-from-string.d.ts} +0 -0
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Button } from '@servicetitan/anvil2';
2
3
  import { useDependencies } from '@servicetitan/react-ioc';
3
- import { ButtonGroup, Button } from '@servicetitan/design-system';
4
4
  import { NotificationsService } from '..';
5
5
  export const ProgressPreview = () => {
6
6
  const [notifications] = useDependencies(NotificationsService);
@@ -8,6 +8,6 @@ export const ProgressPreview = () => {
8
8
  title: 'This message contains progress.',
9
9
  progress: 25,
10
10
  });
11
- return (_jsx(ButtonGroup, { children: _jsx(Button, { onClick: handleClick, children: "Show" }) }));
11
+ return _jsx(Button, { onClick: handleClick, children: "Show" });
12
12
  };
13
13
  //# sourceMappingURL=progress-preview.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"progress-preview.js","sourceRoot":"","sources":["../../src/demo/progress-preview.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAElE,OAAO,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;AAE1C,MAAM,CAAC,MAAM,eAAe,GAAO,GAAG,EAAE;IACpC,MAAM,CAAC,aAAa,CAAC,GAAG,eAAe,CAAC,oBAAoB,CAAC,CAAC;IAE9D,MAAM,WAAW,GAAG,GAAG,EAAE,CACrB,aAAa,CAAC,IAAI,CAAC;QACf,KAAK,EAAE,iCAAiC;QACxC,QAAQ,EAAE,EAAE;KACf,CAAC,CAAC;IAEP,OAAO,CACH,KAAC,WAAW,cACR,KAAC,MAAM,IAAC,OAAO,EAAE,WAAW,qBAAe,GACjC,CACjB,CAAC;AACN,CAAC,CAAC"}
1
+ {"version":3,"file":"progress-preview.js","sourceRoot":"","sources":["../../src/demo/progress-preview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;AAE1C,MAAM,CAAC,MAAM,eAAe,GAAO,GAAG,EAAE;IACpC,MAAM,CAAC,aAAa,CAAC,GAAG,eAAe,CAAC,oBAAoB,CAAC,CAAC;IAE9D,MAAM,WAAW,GAAG,GAAG,EAAE,CACrB,aAAa,CAAC,IAAI,CAAC;QACf,KAAK,EAAE,iCAAiC;QACxC,QAAQ,EAAE,EAAE;KACf,CAAC,CAAC;IAEP,OAAO,KAAC,MAAM,IAAC,OAAO,EAAE,WAAW,qBAAe,CAAC;AACvD,CAAC,CAAC"}
@@ -1,2 +1,2 @@
1
- export {};
1
+ export declare function setupIntercept(): void;
2
2
  //# sourceMappingURL=server-custom-preview.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server-custom-preview.d.ts","sourceRoot":"","sources":["../../src/demo/server-custom-preview.tsx"],"names":[],"mappings":""}
1
+ {"version":3,"file":"server-custom-preview.d.ts","sourceRoot":"","sources":["../../src/demo/server-custom-preview.tsx"],"names":[],"mappings":"AAEA,wBAAgB,cAAc,SAgB7B"}
@@ -1,8 +1,22 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Toast, Avatar, Stack } from '@servicetitan/design-system';
3
- import { register } from '..';
4
- register('CustomServerNotification', ({ notification, onClose }) => {
5
- const { username, message } = notification.payload;
6
- return (_jsx(Toast, { title: "You have a new message", portal: false, onClose: onClose, children: _jsxs(Stack, { alignItems: "center", children: [_jsx(Avatar, { name: username, className: "m-r-1" }), _jsx(Stack.Item, { fill: true, children: message })] }) }));
7
- });
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { intercept } from '../intercept';
13
+ export function setupIntercept() {
14
+ intercept('CustomServerNotification', notification => {
15
+ const _a = notification.payload, { username } = _a, payload = __rest(_a, ["username"]);
16
+ return Object.assign(Object.assign({}, notification), { payload: Object.assign(Object.assign({}, payload), { title: `Hi ${username}!`, action: {
17
+ label: 'Thanks!',
18
+ onClick: () => window.alert("You're welcome!"),
19
+ } }) });
20
+ });
21
+ }
8
22
  //# sourceMappingURL=server-custom-preview.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"server-custom-preview.js","sourceRoot":"","sources":["../../src/demo/server-custom-preview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAEnE,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAE9B,QAAQ,CAAC,0BAA0B,EAAE,CAAC,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,EAAE;IAC/D,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,YAAY,CAAC,OAAO,CAAC;IAEnD,OAAO,CACH,KAAC,KAAK,IAAC,KAAK,EAAC,wBAAwB,EAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,YACjE,MAAC,KAAK,IAAC,UAAU,EAAC,QAAQ,aACtB,KAAC,MAAM,IAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAC,OAAO,GAAG,EAC5C,KAAC,KAAK,CAAC,IAAI,IAAC,IAAI,kBAAE,OAAO,GAAc,IACnC,GACJ,CACX,CAAC;AACN,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"server-custom-preview.js","sourceRoot":"","sources":["../../src/demo/server-custom-preview.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,UAAU,cAAc;IAC1B,SAAS,CAAuB,0BAA0B,EAAE,YAAY,CAAC,EAAE;QACvE,MAAM,KAA2B,YAAY,CAAC,OAAO,EAA/C,EAAE,QAAQ,OAAqC,EAAhC,OAAO,cAAtB,YAAwB,CAAuB,CAAC;QAEtD,uCACO,YAAY,KACf,OAAO,kCACA,OAAO,KACV,KAAK,EAAE,MAAM,QAAQ,GAAG,EACxB,MAAM,EAAE;oBACJ,KAAK,EAAE,SAAS;oBAChB,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC;iBACjD,OAEP;IACN,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,4 +1,3 @@
1
1
  import { FC } from 'react';
2
- import './server-custom-preview';
3
2
  export declare const ServerCustomExample: FC;
4
3
  //# sourceMappingURL=server-custom.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server-custom.d.ts","sourceRoot":"","sources":["../../src/demo/server-custom.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAQ3B,OAAO,yBAAyB,CAAC;AAEjC,eAAO,MAAM,mBAAmB,EAAE,EAyBjC,CAAC"}
1
+ {"version":3,"file":"server-custom.d.ts","sourceRoot":"","sources":["../../src/demo/server-custom.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAa,MAAM,OAAO,CAAC;AAMtC,eAAO,MAAM,mBAAmB,EAAE,EA6BjC,CAAC"}
@@ -1,26 +1,30 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Button } from '@servicetitan/design-system';
2
+ import { Button } from '@servicetitan/anvil2';
3
+ import { useEffect } from 'react';
3
4
  import { NotificationProcessStatus } from '..';
4
5
  import { Container } from './container';
5
- import './server-custom-preview';
6
- export const ServerCustomExample = () => (_jsx(Container, { children: publisher => {
7
- const handleClick = () => {
8
- const notification = {
9
- id: Date.now(),
10
- userId: 0,
11
- type: 'CustomServerNotification',
12
- status: NotificationProcessStatus.Info,
13
- isRead: false,
14
- createdOn: new Date(),
15
- modifiedOn: new Date(),
16
- version: NotificationProcessStatus.Info,
17
- payload: JSON.stringify({
18
- username: 'Jane',
19
- message: 'Hello, your order completed.',
20
- }),
6
+ import { setupIntercept } from './server-custom-preview';
7
+ export const ServerCustomExample = () => {
8
+ useEffect(setupIntercept, []);
9
+ return (_jsx(Container, { children: publisher => {
10
+ const handleClick = () => {
11
+ const notification = {
12
+ id: Date.now(),
13
+ userId: 0,
14
+ type: 'CustomServerNotification',
15
+ status: NotificationProcessStatus.Info,
16
+ isRead: false,
17
+ createdOn: new Date(),
18
+ modifiedOn: new Date(),
19
+ version: NotificationProcessStatus.Info,
20
+ payload: JSON.stringify({
21
+ username: 'Jane',
22
+ message: 'Your order is completed.',
23
+ }),
24
+ };
25
+ publisher.fire(notification);
21
26
  };
22
- publisher.fire(notification);
23
- };
24
- return _jsx(Button, { onClick: handleClick, children: "Show" });
25
- } }));
27
+ return _jsx(Button, { onClick: handleClick, children: "Show" });
28
+ } }));
29
+ };
26
30
  //# sourceMappingURL=server-custom.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"server-custom.js","sourceRoot":"","sources":["../../src/demo/server-custom.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAErD,OAAO,EAAE,yBAAyB,EAAE,MAAM,IAAI,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,yBAAyB,CAAC;AAEjC,MAAM,CAAC,MAAM,mBAAmB,GAAO,GAAG,EAAE,CAAC,CACzC,KAAC,SAAS,cACL,SAAS,CAAC,EAAE;QACT,MAAM,WAAW,GAAG,GAAG,EAAE;YACrB,MAAM,YAAY,GAAG;gBACjB,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;gBACd,MAAM,EAAE,CAAC;gBACT,IAAI,EAAE,0BAA0B;gBAChC,MAAM,EAAE,yBAAyB,CAAC,IAAI;gBACtC,MAAM,EAAE,KAAK;gBACb,SAAS,EAAE,IAAI,IAAI,EAAE;gBACrB,UAAU,EAAE,IAAI,IAAI,EAAE;gBACtB,OAAO,EAAE,yBAAyB,CAAC,IAAI;gBACvC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;oBACpB,QAAQ,EAAE,MAAM;oBAChB,OAAO,EAAE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AE,WAAW,qBAAe,CAAC;QACvD,CAAC,GACO,CACf,CAAC;AACN,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"server-default.d.ts","sourceRoot":"","sources":["../../src/demo/server-default.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAQ3B,eAAO,MAAM,oBAAoB,EAAE,EA8ElC,CAAC"}
1
+ {"version":3,"file":"server-default.d.ts","sourceRoot":"","sources":["../../src/demo/server-default.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAK3B,eAAO,MAAM,oBAAoB,EAAE,EA8ElC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Button } from '@servicetitan/design-system';
2
+ import { Button } from '@servicetitan/anvil2';
3
3
  import { NotificationProcessStatus } from '..';
4
4
  import { Container } from './container';
5
5
  export const ServerDefaultExample = () => (_jsx(Container, { children: publisher => {
@@ -1 +1 @@
1
- {"version":3,"file":"server-default.js","sourceRoot":"","sources":["../../src/demo/server-default.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAErD,OAAO,EAAE,yBAAyB,EAAE,MAAM,IAAI,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,CAAC,MAAM,oBAAoB,GAAO,GAAG,EAAE,CAAC,CAC1C,KAAC,SAAS,cACL,SAAS,CAAC,EAAE;QACT,MAAM,WAAW,GAAG,GAAG,EAAE;YACrB,IAAI,YAAY,GAAG;gBACf,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;gBACd,MAAM,EAAE,CAAC;gBACT,IAAI,EAAE,2BAA2B;gBACjC,MAAM,EAAE,yBAAyB,CAAC,IAAI;gBACtC,MAAM,EAAE,KAAK;gBACb,SAAS,EAAE,IAAI,IAAI,EAAE;gBACrB,UAAU,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C,CAAC;oBAC9B,CAAC;gBACL,CAAC,EAAE,GAAG,CAAC,CAAC;YACZ,CAAC,EAAE,IAAI,CAAC,CAAC;QACb,CAAC,CAAC;QAEF,OAAO,KAAC,MAAM,IAAC,OAAO,EAAE,WAAW,qBAAe,CAAC;IACvD,CAAC,GACO,CACf,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"status-variations-preview.d.ts","sourceRoot":"","sources":["../../src/demo/status-variations-preview.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAQ3B,eAAO,MAAM,uBAAuB,EAAE,EA+BrC,CAAC"}
1
+ {"version":3,"file":"status-variations-preview.d.ts","sourceRoot":"","sources":["../../src/demo/status-variations-preview.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAI3B,eAAO,MAAM,uBAAuB,EAAE,EA+BrC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, Flex } from '@servicetitan/anvil2';
2
3
  import { useDependencies } from '@servicetitan/react-ioc';
3
- import { ButtonGroup, Button } from '@servicetitan/design-system';
4
4
  import { NotificationsService } from '..';
5
5
  export const StatusVariationsPreview = () => {
6
6
  const [notifications] = useDependencies(NotificationsService);
@@ -16,6 +16,6 @@ export const StatusVariationsPreview = () => {
16
16
  const handleErrorClick = () => notifications.error({
17
17
  title: "You've successfully clicked the 'Error' button.",
18
18
  });
19
- return (_jsxs(ButtonGroup, { children: [_jsx(Button, { onClick: handleInfoClick, children: "Info" }), _jsx(Button, { onClick: handleSuccessClick, children: "Success" }), _jsx(Button, { onClick: handleWarningClick, children: "Warning" }), _jsx(Button, { onClick: handleErrorClick, children: "Error" })] }));
19
+ return (_jsxs(Flex, { direction: "row", gap: "2", children: [_jsx(Button, { onClick: handleInfoClick, children: "Info" }), _jsx(Button, { onClick: handleSuccessClick, children: "Success" }), _jsx(Button, { onClick: handleWarningClick, children: "Warning" }), _jsx(Button, { onClick: handleErrorClick, children: "Error" })] }));
20
20
  };
21
21
  //# sourceMappingURL=status-variations-preview.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"status-variations-preview.js","sourceRoot":"","sources":["../../src/demo/status-variations-preview.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAElE,OAAO,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;AAE1C,MAAM,CAAC,MAAM,uBAAuB,GAAO,GAAG,EAAE;IAC5C,MAAM,CAAC,aAAa,CAAC,GAAG,eAAe,CAAC,oBAAoB,CAAC,CAAC;IAE9D,MAAM,eAAe,GAAG,GAAG,EAAE,CACzB,aAAa,CAAC,IAAI,CAAC;QACf,KAAK,EAAE,gDAAgD;KAC1D,CAAC,CAAC;IAEP,MAAM,kBAAkB,GAAG,GAAG,EAAE,CAC5B,aAAa,CAAC,OAAO,CAAC;QAClB,KAAK,EAAE,mDAAmD;KAC7D,CAAC,CAAC;IAEP,MAAM,kBAAkB,GAAG,GAAG,EAAE,CAC5B,aAAa,CAAC,OAAO,CAAC;QAClB,KAAK,EAAE,mDAAmD;KAC7D,CAAC,CAAC;IAEP,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAC1B,aAAa,CAAC,KAAK,CAAC;QAChB,KAAK,EAAE,iDAAiD;KAC3D,CAAC,CAAC;IAEP,OAAO,CACH,MAAC,WAAW,eACR,KAAC,MAAM,IAAC,OAAO,EAAE,eAAe,qBAAe,EAC/C,KAAC,MAAM,IAAC,OAAO,EAAE,kBAAkB,wBAAkB,EACrD,KAAC,MAAM,IAAC,OAAO,EAAE,kBAAkB,wBAAkB,EACrD,KAAC,MAAM,IAAC,OAAO,EAAE,gBAAgB,sBAAgB,IACvC,CACjB,CAAC;AACN,CAAC,CAAC"}
1
+ {"version":3,"file":"status-variations-preview.js","sourceRoot":"","sources":["../../src/demo/status-variations-preview.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;AAE1C,MAAM,CAAC,MAAM,uBAAuB,GAAO,GAAG,EAAE;IAC5C,MAAM,CAAC,aAAa,CAAC,GAAG,eAAe,CAAC,oBAAoB,CAAC,CAAC;IAE9D,MAAM,eAAe,GAAG,GAAG,EAAE,CACzB,aAAa,CAAC,IAAI,CAAC;QACf,KAAK,EAAE,gDAAgD;KAC1D,CAAC,CAAC;IAEP,MAAM,kBAAkB,GAAG,GAAG,EAAE,CAC5B,aAAa,CAAC,OAAO,CAAC;QAClB,KAAK,EAAE,mDAAmD;KAC7D,CAAC,CAAC;IAEP,MAAM,kBAAkB,GAAG,GAAG,EAAE,CAC5B,aAAa,CAAC,OAAO,CAAC;QAClB,KAAK,EAAE,mDAAmD;KAC7D,CAAC,CAAC;IAEP,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAC1B,aAAa,CAAC,KAAK,CAAC;QAChB,KAAK,EAAE,iDAAiD;KAC3D,CAAC,CAAC;IAEP,OAAO,CACH,MAAC,IAAI,IAAC,SAAS,EAAC,KAAK,EAAC,GAAG,EAAC,GAAG,aACzB,KAAC,MAAM,IAAC,OAAO,EAAE,eAAe,qBAAe,EAC/C,KAAC,MAAM,IAAC,OAAO,EAAE,kBAAkB,wBAAkB,EACrD,KAAC,MAAM,IAAC,OAAO,EAAE,kBAAkB,wBAAkB,EACrD,KAAC,MAAM,IAAC,OAAO,EAAE,gBAAgB,sBAAgB,IAC9C,CACV,CAAC;AACN,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"status-variations.d.ts","sourceRoot":"","sources":["../../src/demo/status-variations.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAM3B,eAAO,MAAM,uBAAuB,EAAE,EAErC,CAAC"}
1
+ {"version":3,"file":"status-variations.d.ts","sourceRoot":"","sources":["../../src/demo/status-variations.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAK3B,eAAO,MAAM,uBAAuB,EAAE,EAErC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"status-variations.js","sourceRoot":"","sources":["../../src/demo/status-variations.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,MAAM,CAAC,MAAM,uBAAuB,GAAO,GAAG,EAAE,CAAC,CAC7C,KAAC,SAAS,cAAE,GAAG,EAAE,CAAC,KAAC,uBAAuB,KAAG,GAAa,CAC7D,CAAC"}
1
+ {"version":3,"file":"status-variations.js","sourceRoot":"","sources":["../../src/demo/status-variations.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,MAAM,CAAC,MAAM,uBAAuB,GAAO,GAAG,EAAE,CAAC,CAC7C,KAAC,SAAS,cAAE,GAAG,EAAE,CAAC,KAAC,uBAAuB,KAAG,GAAa,CAC7D,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,8 +1,7 @@
1
- export { NotificationProcessStatus } from './api/notifications.api';
2
- export { DefaultNotification, DefaultNotificationProps } from './components/default-notification';
1
+ export { NotificationsApi, NotificationProcessStatus, DefaultServerNotificationPayload, } from './api/notifications.api';
3
2
  export { Notifications, NotificationsProps } from './components/notifications';
4
- export { DefaultNotificationOptions, Status } from './common';
3
+ export { DefaultNotificationOptions, LinkAction, FunctionAction, Notification, Status, } from './common';
4
+ export { intercept, NotificationInterceptor } from './intercept';
5
5
  export { NotificationsChannel, NOTIFICATIONS_CHANNEL_TOKEN } from './notifications-channel';
6
6
  export { INotificationsService, NotificationsService } from './notifications-service';
7
- export { register } from './register';
8
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EAAE,0BAA0B,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAC5F,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,gBAAgB,EAChB,yBAAyB,EACzB,gCAAgC,GACnC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EACH,0BAA0B,EAC1B,UAAU,EACV,cAAc,EACd,YAAY,EACZ,MAAM,GACT,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAC5F,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC"}
package/dist/index.js CHANGED
@@ -1,8 +1,7 @@
1
- export { NotificationProcessStatus } from './api/notifications.api';
2
- export { DefaultNotification } from './components/default-notification';
1
+ export { NotificationsApi, NotificationProcessStatus, } from './api/notifications.api';
3
2
  export { Notifications } from './components/notifications';
4
- export { Status } from './common';
3
+ export { Status, } from './common';
4
+ export { intercept } from './intercept';
5
5
  export { NOTIFICATIONS_CHANNEL_TOKEN } from './notifications-channel';
6
6
  export { NotificationsService } from './notifications-service';
7
- export { register } from './register';
8
7
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAA4B,MAAM,mCAAmC,CAAC;AAClG,OAAO,EAAE,aAAa,EAAsB,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EAA8B,MAAM,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,EAAwB,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAC5F,OAAO,EAAyB,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,gBAAgB,EAChB,yBAAyB,GAE5B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAsB,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EAKH,MAAM,GACT,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,SAAS,EAA2B,MAAM,aAAa,CAAC;AACjE,OAAO,EAAwB,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAC5F,OAAO,EAAyB,oBAAoB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { DefaultNotificationOptions, Notification } from './common';
2
+ export type NotificationInterceptor<T extends Record<keyof any, any> = {}> = (notification: Notification<T>, dismiss: () => void) => Notification<DefaultNotificationOptions> | undefined;
3
+ export declare function intercept<T extends Record<keyof any, any> = {}>(type: string, fn?: NotificationInterceptor<T>): void;
4
+ //# sourceMappingURL=intercept.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intercept.d.ts","sourceRoot":"","sources":["../src/intercept.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGpE,MAAM,MAAM,uBAAuB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,IAAI,CACzE,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,EAC7B,OAAO,EAAE,MAAM,IAAI,KAClB,YAAY,CAAC,0BAA0B,CAAC,GAAG,SAAS,CAAC;AAE1D,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,EAC3D,IAAI,EAAE,MAAM,EACZ,EAAE,CAAC,EAAE,uBAAuB,CAAC,CAAC,CAAC,QAGlC"}
@@ -0,0 +1,5 @@
1
+ import { NotificationsStore } from './stores/notifications.store';
2
+ export function intercept(type, fn) {
3
+ NotificationsStore.intercept(type, fn);
4
+ }
5
+ //# sourceMappingURL=intercept.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intercept.js","sourceRoot":"","sources":["../src/intercept.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAOlE,MAAM,UAAU,SAAS,CACrB,IAAY,EACZ,EAA+B;IAE/B,kBAAkB,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AAC3C,CAAC"}
@@ -1,6 +1,4 @@
1
- interface EventCallback {
2
- (context: any, data: any): void;
3
- }
1
+ type EventCallback = (data: any, context: any) => void;
4
2
  interface EventsDispatcher {
5
3
  bind(eventName: string, callback: EventCallback, context?: any): this;
6
4
  unbind(eventName?: string | null, callback?: EventCallback | null, context?: any): this;
@@ -8,9 +6,7 @@ interface EventsDispatcher {
8
6
  interface Publisher extends EventsDispatcher {
9
7
  global_emitter: EventsDispatcher;
10
8
  }
11
- export interface NotificationsChannel {
12
- (): Publisher;
13
- }
9
+ export type NotificationsChannel = () => Publisher;
14
10
  export declare const NOTIFICATIONS_CHANNEL_TOKEN: import("@servicetitan/react-ioc").SymbolToken<NotificationsChannel>;
15
11
  export {};
16
12
  //# sourceMappingURL=notifications-channel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"notifications-channel.d.ts","sourceRoot":"","sources":["../src/notifications-channel.ts"],"names":[],"mappings":"AAEA,UAAU,aAAa;IACnB,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,IAAI,CAAC;CACnC;AAED,UAAU,gBAAgB;IACtB,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;IACtE,MAAM,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,CAAC,EAAE,aAAa,GAAG,IAAI,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;CAC3F;AAED,UAAU,SAAU,SAAQ,gBAAgB;IAExC,cAAc,EAAE,gBAAgB,CAAC;CACpC;AAED,MAAM,WAAW,oBAAoB;IACjC,IAAI,SAAS,CAAC;CACjB;AAED,eAAO,MAAM,2BAA2B,qEAEvC,CAAC"}
1
+ {"version":3,"file":"notifications-channel.d.ts","sourceRoot":"","sources":["../src/notifications-channel.ts"],"names":[],"mappings":"AAEA,KAAK,aAAa,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,KAAK,IAAI,CAAC;AAEvD,UAAU,gBAAgB;IACtB,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;IACtE,MAAM,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,CAAC,EAAE,aAAa,GAAG,IAAI,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;CAC3F;AAED,UAAU,SAAU,SAAQ,gBAAgB;IAExC,cAAc,EAAE,gBAAgB,CAAC;CACpC;AAED,MAAM,MAAM,oBAAoB,GAAG,MAAM,SAAS,CAAC;AAEnD,eAAO,MAAM,2BAA2B,qEAEvC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"notifications-channel.js","sourceRoot":"","sources":["../src/notifications-channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAoBtD,MAAM,CAAC,MAAM,2BAA2B,GAAG,WAAW,CAClD,6BAA6B,CAChC,CAAC"}
1
+ {"version":3,"file":"notifications-channel.js","sourceRoot":"","sources":["../src/notifications-channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAgBtD,MAAM,CAAC,MAAM,2BAA2B,GAAG,WAAW,CAClD,6BAA6B,CAChC,CAAC"}
@@ -1,21 +1,23 @@
1
1
  import { DefaultNotificationOptions } from './common';
2
2
  import { NotificationsStore } from './stores/notifications.store';
3
+ type OptionsWithoutStatus = Omit<DefaultNotificationOptions, 'status'>;
3
4
  export interface INotificationsService {
4
5
  initialize(userId?: number): Promise<void>;
5
6
  show(options: DefaultNotificationOptions, preventDuplicates?: boolean): void;
6
- info(options: Omit<DefaultNotificationOptions, 'status'>, preventDuplicates?: boolean): void;
7
- success(options: Omit<DefaultNotificationOptions, 'status'>, preventDuplicates?: boolean): void;
8
- warning(options: Omit<DefaultNotificationOptions, 'status'>, preventDuplicates?: boolean): void;
9
- error(options: Omit<DefaultNotificationOptions, 'status'>, preventDuplicates?: boolean): void;
7
+ info(options: OptionsWithoutStatus, preventDuplicates?: boolean): void;
8
+ success(options: OptionsWithoutStatus, preventDuplicates?: boolean): void;
9
+ warning(options: OptionsWithoutStatus, preventDuplicates?: boolean): void;
10
+ error(options: OptionsWithoutStatus, preventDuplicates?: boolean): void;
10
11
  }
11
12
  export declare class NotificationsService implements INotificationsService {
12
13
  private readonly store;
13
14
  constructor(store: NotificationsStore);
14
15
  initialize: (userId?: number) => Promise<void>;
15
16
  show: (options: DefaultNotificationOptions, preventDuplicates?: boolean) => void;
16
- info: (options: Omit<DefaultNotificationOptions, 'status'>, preventDuplicates?: boolean) => void;
17
- success: (options: Omit<DefaultNotificationOptions, 'status'>, preventDuplicates?: boolean) => void;
18
- warning: (options: Omit<DefaultNotificationOptions, 'status'>, preventDuplicates?: boolean) => void;
19
- error: (options: Omit<DefaultNotificationOptions, 'status'>, preventDuplicates?: boolean) => void;
17
+ info: (options: OptionsWithoutStatus, preventDuplicates?: boolean) => void;
18
+ success: (options: OptionsWithoutStatus, preventDuplicates?: boolean) => void;
19
+ warning: (options: OptionsWithoutStatus, preventDuplicates?: boolean) => void;
20
+ error: (options: OptionsWithoutStatus, preventDuplicates?: boolean) => void;
20
21
  }
22
+ export {};
21
23
  //# sourceMappingURL=notifications-service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"notifications-service.d.ts","sourceRoot":"","sources":["../src/notifications-service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAU,MAAM,UAAU,CAAC;AAE9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAElE,MAAM,WAAW,qBAAqB;IAClC,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,IAAI,CAAC,OAAO,EAAE,0BAA0B,EAAE,iBAAiB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC7E,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,0BAA0B,EAAE,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E,IAAI,CAAC,KAAK,CAAC,GAAG,iCAAM,OAAO,KAAE,MAAM,EAAE,MAAM,CAAC,KAAK,KAAI,iBAAiB,CAAC,CAAC;YAC5E,CAAC;WAAC;IAxBmF,CAAC;CAyBzF,CAAA;AA1BY,oBAAoB;IADhC,UAAU,EAAE;IAEI,WAAA,MAAM,CAAC,kBAAkB,CAAC,CAAA;qCAAyB,kBAAkB;GADzE,oBAAoB,CA0BhC"}
@@ -0,0 +1,14 @@
1
+ declare const _default: {
2
+ title: string;
3
+ };
4
+ export default _default;
5
+ export declare const Basic: () => import("react/jsx-runtime").JSX.Element;
6
+ export declare const StatusVariations: () => import("react/jsx-runtime").JSX.Element;
7
+ export declare const Duration: () => import("react/jsx-runtime").JSX.Element;
8
+ export declare const ActionButton: () => import("react/jsx-runtime").JSX.Element;
9
+ export declare const Progress: () => import("react/jsx-runtime").JSX.Element;
10
+ export declare const PreventDuplicates: () => import("react/jsx-runtime").JSX.Element;
11
+ export declare const MultilineMessage: () => import("react/jsx-runtime").JSX.Element;
12
+ export declare const ServerDefault: () => import("react/jsx-runtime").JSX.Element;
13
+ export declare const ServerCustom: () => import("react/jsx-runtime").JSX.Element;
14
+ //# sourceMappingURL=notifications.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notifications.stories.d.ts","sourceRoot":"","sources":["../src/notifications.stories.tsx"],"names":[],"mappings":";;;AAgBA,wBAEE;AAEF,eAAO,MAAM,KAAK,+CAAoC,CAAC;AACvD,eAAO,MAAM,gBAAgB,+CAAqD,CAAC;AACnF,eAAO,MAAM,QAAQ,+CAAoC,CAAC;AAC1D,eAAO,MAAM,YAAY,+CAA6C,CAAC;AACvE,eAAO,MAAM,QAAQ,+CAAoC,CAAC;AAC1D,eAAO,MAAM,iBAAiB,+CAAuD,CAAC;AACtF,eAAO,MAAM,gBAAgB,+CAAqD,CAAC;AACnF,eAAO,MAAM,aAAa,+CAA+C,CAAC;AAC1E,eAAO,MAAM,YAAY,+CAA6C,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { BrowserRouter } from 'react-router-dom';
3
+ import { Text, Frame, Page } from '@servicetitan/design-system';
4
+ import { BasicExample, StatusVariationsExample, DurationExample, ActionButtonExample, ProgressExample, PreventDuplicatesExample, MultilineMessageExample, ServerDefaultExample, ServerCustomExample, } from './demo';
5
+ export default {
6
+ title: 'Notifications/Demos',
7
+ };
8
+ export const Basic = wrap('Basic usage', BasicExample);
9
+ export const StatusVariations = wrap('Status Variations', StatusVariationsExample);
10
+ export const Duration = wrap('Duration', DurationExample);
11
+ export const ActionButton = wrap('Action Button', ActionButtonExample);
12
+ export const Progress = wrap('Progress', ProgressExample);
13
+ export const PreventDuplicates = wrap('Prevent Duplicates', PreventDuplicatesExample);
14
+ export const MultilineMessage = wrap('Multiline Message', MultilineMessageExample);
15
+ export const ServerDefault = wrap('Server Default', ServerDefaultExample);
16
+ export const ServerCustom = wrap('Server Custom', ServerCustomExample);
17
+ function wrap(name, Component) {
18
+ return () => (_jsx(BrowserRouter, { children: _jsx(Frame, { children: _jsxs(Page, { children: [_jsx(Text, { size: 4, className: "m-b-half", children: name }), _jsx(Component, {})] }) }) }));
19
+ }
20
+ //# sourceMappingURL=notifications.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notifications.stories.js","sourceRoot":"","sources":["../src/notifications.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAEhE,OAAO,EACH,YAAY,EACZ,uBAAuB,EACvB,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,wBAAwB,EACxB,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,GACtB,MAAM,QAAQ,CAAC;AAEhB,eAAe;IACX,KAAK,EAAE,qBAAqB;CAC/B,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;AACvD,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC,mBAAmB,EAAE,uBAAuB,CAAC,CAAC;AACnF,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;AAC1D,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,mBAAmB,CAAC,CAAC;AACvE,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;AAC1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,oBAAoB,EAAE,wBAAwB,CAAC,CAAC;AACtF,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC,mBAAmB,EAAE,uBAAuB,CAAC,CAAC;AACnF,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,EAAE,oBAAoB,CAAC,CAAC;AAC1E,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,mBAAmB,CAAC,CAAC;AAEvE,SAAS,IAAI,CAAC,IAAY,EAAE,SAAa;IACrC,OAAO,GAAG,EAAE,CAAC,CACT,KAAC,aAAa,cACV,KAAC,KAAK,cACF,MAAC,IAAI,eACD,KAAC,IAAI,IAAC,IAAI,EAAE,CAAC,EAAE,SAAS,EAAC,UAAU,YAC9B,IAAI,GACF,EAEP,KAAC,SAAS,KAAG,IACV,GACH,GACI,CACnB,CAAC;AACN,CAAC"}
@@ -0,0 +1,11 @@
1
+ type EventCallback = (data: any, context: any) => void;
2
+ export declare class MockNotificationsChannel {
3
+ private readonly bindings;
4
+ constructor();
5
+ get global_emitter(): this;
6
+ unbind(event: string, fn: EventCallback, _context?: any): this;
7
+ emit(event: string, data: any): void;
8
+ private readonly bindEvent;
9
+ }
10
+ export {};
11
+ //# sourceMappingURL=mock-notifications-channel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock-notifications-channel.d.ts","sourceRoot":"","sources":["../../../src/stores/__mocks__/mock-notifications-channel.ts"],"names":[],"mappings":"AAAA,KAAK,aAAa,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,KAAK,IAAI,CAAC;AAEvD,qBAAa,wBAAwB;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA6B;;IAQtD,IAAI,cAAc,SAEjB;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,aAAa,EAAE,QAAQ,CAAC,EAAE,GAAG;IAOvD,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG;IAI7B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAGxB;CACL"}
@@ -0,0 +1,36 @@
1
+ export class MockNotificationsChannel {
2
+ constructor() {
3
+ Object.defineProperty(this, "bindings", {
4
+ enumerable: true,
5
+ configurable: true,
6
+ writable: true,
7
+ value: void 0
8
+ });
9
+ Object.defineProperty(this, "bindEvent", {
10
+ enumerable: true,
11
+ configurable: true,
12
+ writable: true,
13
+ value: (event, fn, _context) => {
14
+ this.bindings.set(event, fn);
15
+ return this;
16
+ }
17
+ });
18
+ this.bindings = new Map();
19
+ Object.assign(this, { bind: this.bindEvent });
20
+ }
21
+ // eslint-disable-next-line @typescript-eslint/naming-convention
22
+ get global_emitter() {
23
+ return this;
24
+ }
25
+ unbind(event, fn, _context) {
26
+ if (this.bindings.get(event) === fn) {
27
+ this.bindings.delete(event);
28
+ }
29
+ return this;
30
+ }
31
+ emit(event, data) {
32
+ var _a;
33
+ (_a = this.bindings.get(event)) === null || _a === void 0 ? void 0 : _a(data, undefined);
34
+ }
35
+ }
36
+ //# sourceMappingURL=mock-notifications-channel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock-notifications-channel.js","sourceRoot":"","sources":["../../../src/stores/__mocks__/mock-notifications-channel.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,wBAAwB;IAGjC;QAFiB;;;;;WAAqC;QAuBrC;;;;mBAAY,CAAC,KAAa,EAAE,EAAiB,EAAE,QAAc,EAAE,EAAE;gBAC9E,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;gBAC7B,OAAO,IAAI,CAAC;YAChB,CAAC;WAAC;QAvBE,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAC;QAC1B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,gEAAgE;IAChE,IAAI,cAAc;QACd,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,KAAa,EAAE,EAAiB,EAAE,QAAc;QACnD,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;YAClC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAI,CAAC,KAAa,EAAE,IAAS;;QACzB,MAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,0CAAG,IAAI,EAAE,SAAS,CAAC,CAAC;IAChD,CAAC;CAMJ"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=notifications.store.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notifications.store.test.d.ts","sourceRoot":"","sources":["../../../src/stores/__tests__/notifications.store.test.ts"],"names":[],"mappings":""}