@servicetitan/notifications 31.1.0 → 31.3.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 (75) hide show
  1. package/dist/api/notifications.api.js +4 -3
  2. package/dist/api/notifications.api.js.map +1 -1
  3. package/dist/common.js +4 -3
  4. package/dist/common.js.map +1 -1
  5. package/dist/components/notifications.js +42 -22
  6. package/dist/components/notifications.js.map +1 -1
  7. package/dist/demo/action-button-preview.js +41 -23
  8. package/dist/demo/action-button-preview.js.map +1 -1
  9. package/dist/demo/action-button.js +4 -1
  10. package/dist/demo/action-button.js.map +1 -1
  11. package/dist/demo/basic-preview.js +9 -5
  12. package/dist/demo/basic-preview.js.map +1 -1
  13. package/dist/demo/basic.js +4 -1
  14. package/dist/demo/basic.js.map +1 -1
  15. package/dist/demo/container.js +44 -45
  16. package/dist/demo/container.js.map +1 -1
  17. package/dist/demo/duration-preview.js +23 -9
  18. package/dist/demo/duration-preview.js.map +1 -1
  19. package/dist/demo/duration.js +4 -1
  20. package/dist/demo/duration.js.map +1 -1
  21. package/dist/demo/index.js +1 -0
  22. package/dist/demo/index.js.map +1 -1
  23. package/dist/demo/multiline-message-preview.js +9 -5
  24. package/dist/demo/multiline-message-preview.js.map +1 -1
  25. package/dist/demo/multiline-message.js +4 -1
  26. package/dist/demo/multiline-message.js.map +1 -1
  27. package/dist/demo/prevent-duplicates-preview.js +9 -5
  28. package/dist/demo/prevent-duplicates-preview.js.map +1 -1
  29. package/dist/demo/prevent-duplicates.js +4 -1
  30. package/dist/demo/prevent-duplicates.js.map +1 -1
  31. package/dist/demo/progress-preview.js +9 -5
  32. package/dist/demo/progress-preview.js.map +1 -1
  33. package/dist/demo/progress.js +4 -1
  34. package/dist/demo/progress.js.map +1 -1
  35. package/dist/demo/server-custom-preview.js +5 -4
  36. package/dist/demo/server-custom-preview.js.map +1 -1
  37. package/dist/demo/server-custom.js +13 -7
  38. package/dist/demo/server-custom.js.map +1 -1
  39. package/dist/demo/server-default.js +66 -61
  40. package/dist/demo/server-default.js.map +1 -1
  41. package/dist/demo/status-variations-preview.js +35 -13
  42. package/dist/demo/status-variations-preview.js.map +1 -1
  43. package/dist/demo/status-variations.js +4 -1
  44. package/dist/demo/status-variations.js.map +1 -1
  45. package/dist/index.js +7 -6
  46. package/dist/index.js.map +1 -1
  47. package/dist/intercept.js +1 -0
  48. package/dist/intercept.js.map +1 -1
  49. package/dist/notifications-channel.js +1 -0
  50. package/dist/notifications-channel.js.map +1 -1
  51. package/dist/notifications-service.js +71 -69
  52. package/dist/notifications-service.js.map +1 -1
  53. package/dist/stores/notifications.store.js +210 -218
  54. package/dist/stores/notifications.store.js.map +1 -1
  55. package/dist/utils/date-from-string.js +2 -1
  56. package/dist/utils/date-from-string.js.map +1 -1
  57. package/dist/utils/use-compatible-navigate.js +4 -3
  58. package/dist/utils/use-compatible-navigate.js.map +1 -1
  59. package/package.json +8 -8
  60. package/dist/__tests__/intercept.test.js +0 -13
  61. package/dist/__tests__/intercept.test.js.map +0 -1
  62. package/dist/__tests__/notifications-service.test.js +0 -42
  63. package/dist/__tests__/notifications-service.test.js.map +0 -1
  64. package/dist/components/__tests__/notifications.test.js +0 -93
  65. package/dist/components/__tests__/notifications.test.js.map +0 -1
  66. package/dist/notifications.stories.js +0 -20
  67. package/dist/notifications.stories.js.map +0 -1
  68. package/dist/stores/__mocks__/mock-notifications-channel.js +0 -36
  69. package/dist/stores/__mocks__/mock-notifications-channel.js.map +0 -1
  70. package/dist/stores/__tests__/notifications.store.test.js +0 -367
  71. package/dist/stores/__tests__/notifications.store.test.js.map +0 -1
  72. package/dist/utils/__tests__/date-from-string.test.js +0 -45
  73. package/dist/utils/__tests__/date-from-string.test.js.map +0 -1
  74. package/dist/utils/__tests__/use-compatible-navigate.test.js +0 -27
  75. package/dist/utils/__tests__/use-compatible-navigate.test.js.map +0 -1
@@ -2,11 +2,15 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Button } from '@servicetitan/anvil2';
3
3
  import { useDependencies } from '@servicetitan/react-ioc';
4
4
  import { NotificationsService } from '..';
5
- export const PreventDuplicatesPreview = () => {
5
+ export const PreventDuplicatesPreview = ()=>{
6
6
  const [notifications] = useDependencies(NotificationsService);
7
- const handleClick = () => notifications.show({
8
- title: 'Equal notifications will be skipped.',
9
- }, true);
10
- return _jsx(Button, { onClick: handleClick, children: "Show" });
7
+ const handleClick = ()=>notifications.show({
8
+ title: 'Equal notifications will be skipped.'
9
+ }, true);
10
+ return /*#__PURE__*/ _jsx(Button, {
11
+ onClick: handleClick,
12
+ children: "Show"
13
+ });
11
14
  };
15
+
12
16
  //# sourceMappingURL=prevent-duplicates-preview.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prevent-duplicates-preview.js","sourceRoot":"","sources":["../../src/demo/prevent-duplicates-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,wBAAwB,GAAO,GAAG,EAAE;IAC7C,MAAM,CAAC,aAAa,CAAC,GAAG,eAAe,CAAC,oBAAoB,CAAC,CAAC;IAE9D,MAAM,WAAW,GAAG,GAAG,EAAE,CACrB,aAAa,CAAC,IAAI,CACd;QACI,KAAK,EAAE,sCAAsC;KAChD,EACD,IAAI,CACP,CAAC;IAEN,OAAO,KAAC,MAAM,IAAC,OAAO,EAAE,WAAW,qBAAe,CAAC;AACvD,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../src/demo/prevent-duplicates-preview.tsx"],"sourcesContent":["import { Button } from '@servicetitan/anvil2';\nimport { useDependencies } from '@servicetitan/react-ioc';\nimport { FC } from 'react';\n\nimport { NotificationsService } from '..';\n\nexport const PreventDuplicatesPreview: FC = () => {\n const [notifications] = useDependencies(NotificationsService);\n\n const handleClick = () =>\n notifications.show(\n {\n title: 'Equal notifications will be skipped.',\n },\n true\n );\n\n return <Button onClick={handleClick}>Show</Button>;\n};\n"],"names":["Button","useDependencies","NotificationsService","PreventDuplicatesPreview","notifications","handleClick","show","title","onClick"],"mappings":";AAAA,SAASA,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,eAAe,QAAQ,0BAA0B;AAG1D,SAASC,oBAAoB,QAAQ,KAAK;AAE1C,OAAO,MAAMC,2BAA+B;IACxC,MAAM,CAACC,cAAc,GAAGH,gBAAgBC;IAExC,MAAMG,cAAc,IAChBD,cAAcE,IAAI,CACd;YACIC,OAAO;QACX,GACA;IAGR,qBAAO,KAACP;QAAOQ,SAASH;kBAAa;;AACzC,EAAE"}
@@ -1,5 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Container } from './container';
3
3
  import { PreventDuplicatesPreview } from './prevent-duplicates-preview';
4
- export const PreventDuplicatesExample = () => (_jsx(Container, { children: () => _jsx(PreventDuplicatesPreview, {}) }));
4
+ export const PreventDuplicatesExample = ()=>/*#__PURE__*/ _jsx(Container, {
5
+ children: ()=>/*#__PURE__*/ _jsx(PreventDuplicatesPreview, {})
6
+ });
7
+
5
8
  //# sourceMappingURL=prevent-duplicates.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prevent-duplicates.js","sourceRoot":"","sources":["../../src/demo/prevent-duplicates.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAExE,MAAM,CAAC,MAAM,wBAAwB,GAAO,GAAG,EAAE,CAAC,CAC9C,KAAC,SAAS,cAAE,GAAG,EAAE,CAAC,KAAC,wBAAwB,KAAG,GAAa,CAC9D,CAAC"}
1
+ {"version":3,"sources":["../../src/demo/prevent-duplicates.tsx"],"sourcesContent":["import { FC } from 'react';\n\nimport { Container } from './container';\nimport { PreventDuplicatesPreview } from './prevent-duplicates-preview';\n\nexport const PreventDuplicatesExample: FC = () => (\n <Container>{() => <PreventDuplicatesPreview />}</Container>\n);\n"],"names":["Container","PreventDuplicatesPreview","PreventDuplicatesExample"],"mappings":";AAEA,SAASA,SAAS,QAAQ,cAAc;AACxC,SAASC,wBAAwB,QAAQ,+BAA+B;AAExE,OAAO,MAAMC,2BAA+B,kBACxC,KAACF;kBAAW,kBAAM,KAACC;OACrB"}
@@ -2,12 +2,16 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Button } from '@servicetitan/anvil2';
3
3
  import { useDependencies } from '@servicetitan/react-ioc';
4
4
  import { NotificationsService } from '..';
5
- export const ProgressPreview = () => {
5
+ export const ProgressPreview = ()=>{
6
6
  const [notifications] = useDependencies(NotificationsService);
7
- const handleClick = () => notifications.show({
8
- title: 'This message contains progress.',
9
- progress: 25,
7
+ const handleClick = ()=>notifications.show({
8
+ title: 'This message contains progress.',
9
+ progress: 25
10
+ });
11
+ return /*#__PURE__*/ _jsx(Button, {
12
+ onClick: handleClick,
13
+ children: "Show"
10
14
  });
11
- return _jsx(Button, { onClick: handleClick, children: "Show" });
12
15
  };
16
+
13
17
  //# sourceMappingURL=progress-preview.js.map
@@ -1 +1 @@
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
+ {"version":3,"sources":["../../src/demo/progress-preview.tsx"],"sourcesContent":["import { Button } from '@servicetitan/anvil2';\nimport { useDependencies } from '@servicetitan/react-ioc';\nimport { FC } from 'react';\n\nimport { NotificationsService } from '..';\n\nexport const ProgressPreview: FC = () => {\n const [notifications] = useDependencies(NotificationsService);\n\n const handleClick = () =>\n notifications.show({\n title: 'This message contains progress.',\n progress: 25,\n });\n\n return <Button onClick={handleClick}>Show</Button>;\n};\n"],"names":["Button","useDependencies","NotificationsService","ProgressPreview","notifications","handleClick","show","title","progress","onClick"],"mappings":";AAAA,SAASA,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,eAAe,QAAQ,0BAA0B;AAG1D,SAASC,oBAAoB,QAAQ,KAAK;AAE1C,OAAO,MAAMC,kBAAsB;IAC/B,MAAM,CAACC,cAAc,GAAGH,gBAAgBC;IAExC,MAAMG,cAAc,IAChBD,cAAcE,IAAI,CAAC;YACfC,OAAO;YACPC,UAAU;QACd;IAEJ,qBAAO,KAACR;QAAOS,SAASJ;kBAAa;;AACzC,EAAE"}
@@ -1,5 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Container } from './container';
3
3
  import { ProgressPreview } from './progress-preview';
4
- export const ProgressExample = () => _jsx(Container, { children: () => _jsx(ProgressPreview, {}) });
4
+ export const ProgressExample = ()=>/*#__PURE__*/ _jsx(Container, {
5
+ children: ()=>/*#__PURE__*/ _jsx(ProgressPreview, {})
6
+ });
7
+
5
8
  //# sourceMappingURL=progress.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"progress.js","sourceRoot":"","sources":["../../src/demo/progress.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,CAAC,MAAM,eAAe,GAAO,GAAG,EAAE,CAAC,KAAC,SAAS,cAAE,GAAG,EAAE,CAAC,KAAC,eAAe,KAAG,GAAa,CAAC"}
1
+ {"version":3,"sources":["../../src/demo/progress.tsx"],"sourcesContent":["import { FC } from 'react';\n\nimport { Container } from './container';\nimport { ProgressPreview } from './progress-preview';\n\nexport const ProgressExample: FC = () => <Container>{() => <ProgressPreview />}</Container>;\n"],"names":["Container","ProgressPreview","ProgressExample"],"mappings":";AAEA,SAASA,SAAS,QAAQ,cAAc;AACxC,SAASC,eAAe,QAAQ,qBAAqB;AAErD,OAAO,MAAMC,kBAAsB,kBAAM,KAACF;kBAAW,kBAAM,KAACC;OAAgC"}
@@ -1,6 +1,6 @@
1
1
  import { intercept } from '../intercept';
2
2
  export function setupIntercept() {
3
- intercept('CustomServerNotification', notification => {
3
+ intercept('CustomServerNotification', (notification)=>{
4
4
  const { username, ...payload } = notification.payload;
5
5
  return {
6
6
  ...notification,
@@ -9,10 +9,11 @@ export function setupIntercept() {
9
9
  title: `Hi ${username}!`,
10
10
  action: {
11
11
  label: 'Thanks!',
12
- onClick: () => window.alert("You're welcome!"),
13
- },
14
- },
12
+ onClick: ()=>window.alert("You're welcome!")
13
+ }
14
+ }
15
15
  };
16
16
  });
17
17
  }
18
+
18
19
  //# 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,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,UAAU,cAAc;IAC1B,SAAS,CAAuB,0BAA0B,EAAE,YAAY,CAAC,EAAE;QACvE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,GAAG,YAAY,CAAC,OAAO,CAAC;QAEtD,OAAO;YACH,GAAG,YAAY;YACf,OAAO,EAAE;gBACL,GAAG,OAAO;gBACV,KAAK,EAAE,MAAM,QAAQ,GAAG;gBACxB,MAAM,EAAE;oBACJ,KAAK,EAAE,SAAS;oBAChB,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC;iBACjD;aACJ;SACJ,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC"}
1
+ {"version":3,"sources":["../../src/demo/server-custom-preview.tsx"],"sourcesContent":["import { intercept } from '../intercept';\n\nexport function setupIntercept() {\n intercept<{ username: string }>('CustomServerNotification', notification => {\n const { username, ...payload } = notification.payload;\n\n return {\n ...notification,\n payload: {\n ...payload,\n title: `Hi ${username}!`,\n action: {\n label: 'Thanks!',\n onClick: () => window.alert(\"You're welcome!\"),\n },\n },\n };\n });\n}\n"],"names":["intercept","setupIntercept","notification","username","payload","title","action","label","onClick","window","alert"],"mappings":"AAAA,SAASA,SAAS,QAAQ,eAAe;AAEzC,OAAO,SAASC;IACZD,UAAgC,4BAA4BE,CAAAA;QACxD,MAAM,EAAEC,QAAQ,EAAE,GAAGC,SAAS,GAAGF,aAAaE,OAAO;QAErD,OAAO;YACH,GAAGF,YAAY;YACfE,SAAS;gBACL,GAAGA,OAAO;gBACVC,OAAO,CAAC,GAAG,EAAEF,SAAS,CAAC,CAAC;gBACxBG,QAAQ;oBACJC,OAAO;oBACPC,SAAS,IAAMC,OAAOC,KAAK,CAAC;gBAChC;YACJ;QACJ;IACJ;AACJ"}
@@ -4,10 +4,11 @@ import { useEffect } from 'react';
4
4
  import { NotificationProcessStatus } from '..';
5
5
  import { Container } from './container';
6
6
  import { setupIntercept } from './server-custom-preview';
7
- export const ServerCustomExample = () => {
7
+ export const ServerCustomExample = ()=>{
8
8
  useEffect(setupIntercept, []);
9
- return (_jsx(Container, { children: publisher => {
10
- const handleClick = () => {
9
+ return /*#__PURE__*/ _jsx(Container, {
10
+ children: (publisher)=>{
11
+ const handleClick = ()=>{
11
12
  const notification = {
12
13
  id: Date.now(),
13
14
  userId: 0,
@@ -19,12 +20,17 @@ export const ServerCustomExample = () => {
19
20
  version: NotificationProcessStatus.Info,
20
21
  payload: JSON.stringify({
21
22
  username: 'Jane',
22
- message: 'Your order is completed.',
23
- }),
23
+ message: 'Your order is completed.'
24
+ })
24
25
  };
25
26
  publisher.fire(notification);
26
27
  };
27
- return _jsx(Button, { onClick: handleClick, children: "Show" });
28
- } }));
28
+ return /*#__PURE__*/ _jsx(Button, {
29
+ onClick: handleClick,
30
+ children: "Show"
31
+ });
32
+ }
33
+ });
29
34
  };
35
+
30
36
  //# sourceMappingURL=server-custom.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"server-custom.js","sourceRoot":"","sources":["../../src/demo/server-custom.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAM,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,yBAAyB,EAAE,MAAM,IAAI,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,MAAM,CAAC,MAAM,mBAAmB,GAAO,GAAG,EAAE;IACxC,SAAS,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;IAE9B,OAAO,CACH,KAAC,SAAS,cACL,SAAS,CAAC,EAAE;YACT,MAAM,WAAW,GAAG,GAAG,EAAE;gBACrB,MAAM,YAAY,GAAG;oBACjB,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;oBACd,MAAM,EAAE,CAAC;oBACT,IAAI,EAAE,0BAA0B;oBAChC,MAAM,EAAE,yBAAyB,CAAC,IAAI;oBACtC,MAAM,EAAE,KAAK;oBACb,SAAS,EAAE,IAAI,IAAI,EAAE;oBACrB,UAAU,EAAE,IAAI,IAAI,EAAE;oBACtB,OAAO,EAAE,yBAAyB,CAAC,IAAI;oBACvC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;wBACpB,QAAQ,EAAE,MAAM;wBAChB,OAAO,EAAE,0BAA0B;qBACtC,CAAC;iBACL,CAAC;gBAEF,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACjC,CAAC,CAAC;YAEF,OAAO,KAAC,MAAM,IAAC,OAAO,EAAE,WAAW,qBAAe,CAAC;QACvD,CAAC,GACO,CACf,CAAC;AACN,CAAC,CAAC"}
1
+ {"version":3,"sources":["../../src/demo/server-custom.tsx"],"sourcesContent":["import { Button } from '@servicetitan/anvil2';\nimport { FC, useEffect } from 'react';\n\nimport { NotificationProcessStatus } from '..';\nimport { Container } from './container';\nimport { setupIntercept } from './server-custom-preview';\n\nexport const ServerCustomExample: FC = () => {\n useEffect(setupIntercept, []);\n\n return (\n <Container>\n {publisher => {\n const handleClick = () => {\n const notification = {\n id: Date.now(),\n userId: 0,\n type: 'CustomServerNotification',\n status: NotificationProcessStatus.Info,\n isRead: false,\n createdOn: new Date(),\n modifiedOn: new Date(),\n version: NotificationProcessStatus.Info,\n payload: JSON.stringify({\n username: 'Jane',\n message: 'Your order is completed.',\n }),\n };\n\n publisher.fire(notification);\n };\n\n return <Button onClick={handleClick}>Show</Button>;\n }}\n </Container>\n );\n};\n"],"names":["Button","useEffect","NotificationProcessStatus","Container","setupIntercept","ServerCustomExample","publisher","handleClick","notification","id","Date","now","userId","type","status","Info","isRead","createdOn","modifiedOn","version","payload","JSON","stringify","username","message","fire","onClick"],"mappings":";AAAA,SAASA,MAAM,QAAQ,uBAAuB;AAC9C,SAAaC,SAAS,QAAQ,QAAQ;AAEtC,SAASC,yBAAyB,QAAQ,KAAK;AAC/C,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,cAAc,QAAQ,0BAA0B;AAEzD,OAAO,MAAMC,sBAA0B;IACnCJ,UAAUG,gBAAgB,EAAE;IAE5B,qBACI,KAACD;kBACIG,CAAAA;YACG,MAAMC,cAAc;gBAChB,MAAMC,eAAe;oBACjBC,IAAIC,KAAKC,GAAG;oBACZC,QAAQ;oBACRC,MAAM;oBACNC,QAAQZ,0BAA0Ba,IAAI;oBACtCC,QAAQ;oBACRC,WAAW,IAAIP;oBACfQ,YAAY,IAAIR;oBAChBS,SAASjB,0BAA0Ba,IAAI;oBACvCK,SAASC,KAAKC,SAAS,CAAC;wBACpBC,UAAU;wBACVC,SAAS;oBACb;gBACJ;gBAEAlB,UAAUmB,IAAI,CAACjB;YACnB;YAEA,qBAAO,KAACR;gBAAO0B,SAASnB;0BAAa;;QACzC;;AAGZ,EAAE"}
@@ -2,70 +2,75 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Button } from '@servicetitan/anvil2';
3
3
  import { NotificationProcessStatus } from '..';
4
4
  import { Container } from './container';
5
- export const ServerDefaultExample = () => (_jsx(Container, { children: publisher => {
6
- const handleClick = () => {
7
- let notification = {
8
- id: Date.now(),
9
- userId: 0,
10
- type: 'DefaultServerNotification',
11
- status: NotificationProcessStatus.Info,
12
- isRead: false,
13
- createdOn: new Date(),
14
- modifiedOn: new Date(),
15
- version: NotificationProcessStatus.Info,
16
- payload: JSON.stringify({
17
- title: 'Server Notification',
18
- message: 'Task was pushed into queue.',
19
- }),
20
- };
21
- publisher.fire(notification);
22
- setTimeout(() => {
23
- let progress = 0;
24
- notification = {
25
- ...notification,
26
- status: NotificationProcessStatus.InProgress,
5
+ export const ServerDefaultExample = ()=>/*#__PURE__*/ _jsx(Container, {
6
+ children: (publisher)=>{
7
+ const handleClick = ()=>{
8
+ let notification = {
9
+ id: Date.now(),
10
+ userId: 0,
11
+ type: 'DefaultServerNotification',
12
+ status: NotificationProcessStatus.Info,
27
13
  isRead: false,
14
+ createdOn: new Date(),
28
15
  modifiedOn: new Date(),
29
- version: NotificationProcessStatus.InProgress,
16
+ version: NotificationProcessStatus.Info,
30
17
  payload: JSON.stringify({
31
- ...JSON.parse(notification.payload),
32
- progress,
33
- message: 'Task is running.',
34
- }),
18
+ title: 'Server Notification',
19
+ message: 'Task was pushed into queue.'
20
+ })
35
21
  };
36
22
  publisher.fire(notification);
37
- const intervalId = setInterval(() => {
38
- if (progress < 100) {
39
- progress += 5;
40
- notification = {
41
- ...notification,
42
- modifiedOn: new Date(),
43
- payload: JSON.stringify({
44
- ...JSON.parse(notification.payload),
45
- progress,
46
- }),
47
- };
48
- publisher.fire(notification);
49
- }
50
- else {
51
- notification = {
52
- ...notification,
53
- status: NotificationProcessStatus.Success,
54
- isRead: false,
55
- modifiedOn: new Date(),
56
- version: NotificationProcessStatus.Success,
57
- payload: JSON.stringify({
58
- ...JSON.parse(notification.payload),
59
- message: 'Task was successfully completed.',
60
- progress: undefined,
61
- }),
62
- };
63
- publisher.fire(notification);
64
- clearInterval(intervalId);
65
- }
66
- }, 250);
67
- }, 2000);
68
- };
69
- return _jsx(Button, { onClick: handleClick, children: "Show" });
70
- } }));
23
+ setTimeout(()=>{
24
+ let progress = 0;
25
+ notification = {
26
+ ...notification,
27
+ status: NotificationProcessStatus.InProgress,
28
+ isRead: false,
29
+ modifiedOn: new Date(),
30
+ version: NotificationProcessStatus.InProgress,
31
+ payload: JSON.stringify({
32
+ ...JSON.parse(notification.payload),
33
+ progress,
34
+ message: 'Task is running.'
35
+ })
36
+ };
37
+ publisher.fire(notification);
38
+ const intervalId = setInterval(()=>{
39
+ if (progress < 100) {
40
+ progress += 5;
41
+ notification = {
42
+ ...notification,
43
+ modifiedOn: new Date(),
44
+ payload: JSON.stringify({
45
+ ...JSON.parse(notification.payload),
46
+ progress
47
+ })
48
+ };
49
+ publisher.fire(notification);
50
+ } else {
51
+ notification = {
52
+ ...notification,
53
+ status: NotificationProcessStatus.Success,
54
+ isRead: false,
55
+ modifiedOn: new Date(),
56
+ version: NotificationProcessStatus.Success,
57
+ payload: JSON.stringify({
58
+ ...JSON.parse(notification.payload),
59
+ message: 'Task was successfully completed.',
60
+ progress: undefined
61
+ })
62
+ };
63
+ publisher.fire(notification);
64
+ clearInterval(intervalId);
65
+ }
66
+ }, 250);
67
+ }, 2000);
68
+ };
69
+ return /*#__PURE__*/ _jsx(Button, {
70
+ onClick: handleClick,
71
+ children: "Show"
72
+ });
73
+ }
74
+ });
75
+
71
76
  //# sourceMappingURL=server-default.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"server-default.js","sourceRoot":"","sources":["../../src/demo/server-default.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,IAAI,CAAC;AAC/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,EAAE,IAAI,IAAI,EAAE;gBACtB,OAAO,EAAE,yBAAyB,CAAC,IAAI;gBACvC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;oBACpB,KAAK,EAAE,qBAAqB;oBAC5B,OAAO,EAAE,6BAA6B;iBACzC,CAAC;aACL,CAAC;YAEF,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAE7B,UAAU,CAAC,GAAG,EAAE;gBACZ,IAAI,QAAQ,GAAG,CAAC,CAAC;gBAEjB,YAAY,GAAG;oBACX,GAAG,YAAY;oBACf,MAAM,EAAE,yBAAyB,CAAC,UAAU;oBAC5C,MAAM,EAAE,KAAK;oBACb,UAAU,EAAE,IAAI,IAAI,EAAE;oBACtB,OAAO,EAAE,yBAAyB,CAAC,UAAU;oBAC7C,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;wBACpB,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC;wBACnC,QAAQ;wBACR,OAAO,EAAE,kBAAkB;qBAC9B,CAAC;iBACL,CAAC;gBAEF,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;gBAE7B,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE;oBAChC,IAAI,QAAQ,GAAG,GAAG,EAAE,CAAC;wBACjB,QAAQ,IAAI,CAAC,CAAC;wBAEd,YAAY,GAAG;4BACX,GAAG,YAAY;4BACf,UAAU,EAAE,IAAI,IAAI,EAAE;4BACtB,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;gCACpB,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC;gCACnC,QAAQ;6BACX,CAAC;yBACL,CAAC;wBAEF,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;oBACjC,CAAC;yBAAM,CAAC;wBACJ,YAAY,GAAG;4BACX,GAAG,YAAY;4BACf,MAAM,EAAE,yBAAyB,CAAC,OAAO;4BACzC,MAAM,EAAE,KAAK;4BACb,UAAU,EAAE,IAAI,IAAI,EAAE;4BACtB,OAAO,EAAE,yBAAyB,CAAC,OAAO;4BAC1C,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;gCACpB,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC;gCACnC,OAAO,EAAE,kCAAkC;gCAC3C,QAAQ,EAAE,SAAS;6BACtB,CAAC;yBACL,CAAC;wBAEF,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;wBAE7B,aAAa,CAAC,UAAU,CAAC,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
+ {"version":3,"sources":["../../src/demo/server-default.tsx"],"sourcesContent":["import { Button } from '@servicetitan/anvil2';\nimport { FC } from 'react';\n\nimport { NotificationProcessStatus } from '..';\nimport { Container } from './container';\n\nexport const ServerDefaultExample: FC = () => (\n <Container>\n {publisher => {\n const handleClick = () => {\n let notification = {\n id: Date.now(),\n userId: 0,\n type: 'DefaultServerNotification',\n status: NotificationProcessStatus.Info,\n isRead: false,\n createdOn: new Date(),\n modifiedOn: new Date(),\n version: NotificationProcessStatus.Info,\n payload: JSON.stringify({\n title: 'Server Notification',\n message: 'Task was pushed into queue.',\n }),\n };\n\n publisher.fire(notification);\n\n setTimeout(() => {\n let progress = 0;\n\n notification = {\n ...notification,\n status: NotificationProcessStatus.InProgress,\n isRead: false,\n modifiedOn: new Date(),\n version: NotificationProcessStatus.InProgress,\n payload: JSON.stringify({\n ...JSON.parse(notification.payload),\n progress,\n message: 'Task is running.',\n }),\n };\n\n publisher.fire(notification);\n\n const intervalId = setInterval(() => {\n if (progress < 100) {\n progress += 5;\n\n notification = {\n ...notification,\n modifiedOn: new Date(),\n payload: JSON.stringify({\n ...JSON.parse(notification.payload),\n progress,\n }),\n };\n\n publisher.fire(notification);\n } else {\n notification = {\n ...notification,\n status: NotificationProcessStatus.Success,\n isRead: false,\n modifiedOn: new Date(),\n version: NotificationProcessStatus.Success,\n payload: JSON.stringify({\n ...JSON.parse(notification.payload),\n message: 'Task was successfully completed.',\n progress: undefined,\n }),\n };\n\n publisher.fire(notification);\n\n clearInterval(intervalId);\n }\n }, 250);\n }, 2000);\n };\n\n return <Button onClick={handleClick}>Show</Button>;\n }}\n </Container>\n);\n"],"names":["Button","NotificationProcessStatus","Container","ServerDefaultExample","publisher","handleClick","notification","id","Date","now","userId","type","status","Info","isRead","createdOn","modifiedOn","version","payload","JSON","stringify","title","message","fire","setTimeout","progress","InProgress","parse","intervalId","setInterval","Success","undefined","clearInterval","onClick"],"mappings":";AAAA,SAASA,MAAM,QAAQ,uBAAuB;AAG9C,SAASC,yBAAyB,QAAQ,KAAK;AAC/C,SAASC,SAAS,QAAQ,cAAc;AAExC,OAAO,MAAMC,uBAA2B,kBACpC,KAACD;kBACIE,CAAAA;YACG,MAAMC,cAAc;gBAChB,IAAIC,eAAe;oBACfC,IAAIC,KAAKC,GAAG;oBACZC,QAAQ;oBACRC,MAAM;oBACNC,QAAQX,0BAA0BY,IAAI;oBACtCC,QAAQ;oBACRC,WAAW,IAAIP;oBACfQ,YAAY,IAAIR;oBAChBS,SAAShB,0BAA0BY,IAAI;oBACvCK,SAASC,KAAKC,SAAS,CAAC;wBACpBC,OAAO;wBACPC,SAAS;oBACb;gBACJ;gBAEAlB,UAAUmB,IAAI,CAACjB;gBAEfkB,WAAW;oBACP,IAAIC,WAAW;oBAEfnB,eAAe;wBACX,GAAGA,YAAY;wBACfM,QAAQX,0BAA0ByB,UAAU;wBAC5CZ,QAAQ;wBACRE,YAAY,IAAIR;wBAChBS,SAAShB,0BAA0ByB,UAAU;wBAC7CR,SAASC,KAAKC,SAAS,CAAC;4BACpB,GAAGD,KAAKQ,KAAK,CAACrB,aAAaY,OAAO,CAAC;4BACnCO;4BACAH,SAAS;wBACb;oBACJ;oBAEAlB,UAAUmB,IAAI,CAACjB;oBAEf,MAAMsB,aAAaC,YAAY;wBAC3B,IAAIJ,WAAW,KAAK;4BAChBA,YAAY;4BAEZnB,eAAe;gCACX,GAAGA,YAAY;gCACfU,YAAY,IAAIR;gCAChBU,SAASC,KAAKC,SAAS,CAAC;oCACpB,GAAGD,KAAKQ,KAAK,CAACrB,aAAaY,OAAO,CAAC;oCACnCO;gCACJ;4BACJ;4BAEArB,UAAUmB,IAAI,CAACjB;wBACnB,OAAO;4BACHA,eAAe;gCACX,GAAGA,YAAY;gCACfM,QAAQX,0BAA0B6B,OAAO;gCACzChB,QAAQ;gCACRE,YAAY,IAAIR;gCAChBS,SAAShB,0BAA0B6B,OAAO;gCAC1CZ,SAASC,KAAKC,SAAS,CAAC;oCACpB,GAAGD,KAAKQ,KAAK,CAACrB,aAAaY,OAAO,CAAC;oCACnCI,SAAS;oCACTG,UAAUM;gCACd;4BACJ;4BAEA3B,UAAUmB,IAAI,CAACjB;4BAEf0B,cAAcJ;wBAClB;oBACJ,GAAG;gBACP,GAAG;YACP;YAEA,qBAAO,KAAC5B;gBAAOiC,SAAS5B;0BAAa;;QACzC;OAEN"}
@@ -2,20 +2,42 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Button, Flex } from '@servicetitan/anvil2';
3
3
  import { useDependencies } from '@servicetitan/react-ioc';
4
4
  import { NotificationsService } from '..';
5
- export const StatusVariationsPreview = () => {
5
+ export const StatusVariationsPreview = ()=>{
6
6
  const [notifications] = useDependencies(NotificationsService);
7
- const handleInfoClick = () => notifications.info({
8
- title: "You've successfully clicked the 'Info' button.",
7
+ const handleInfoClick = ()=>notifications.info({
8
+ title: "You've successfully clicked the 'Info' button."
9
+ });
10
+ const handleSuccessClick = ()=>notifications.success({
11
+ title: "You've successfully clicked the 'Success' button."
12
+ });
13
+ const handleWarningClick = ()=>notifications.warning({
14
+ title: "You've successfully clicked the 'Warning' button."
15
+ });
16
+ const handleErrorClick = ()=>notifications.error({
17
+ title: "You've successfully clicked the 'Error' button."
18
+ });
19
+ return /*#__PURE__*/ _jsxs(Flex, {
20
+ direction: "row",
21
+ gap: "2",
22
+ children: [
23
+ /*#__PURE__*/ _jsx(Button, {
24
+ onClick: handleInfoClick,
25
+ children: "Info"
26
+ }),
27
+ /*#__PURE__*/ _jsx(Button, {
28
+ onClick: handleSuccessClick,
29
+ children: "Success"
30
+ }),
31
+ /*#__PURE__*/ _jsx(Button, {
32
+ onClick: handleWarningClick,
33
+ children: "Warning"
34
+ }),
35
+ /*#__PURE__*/ _jsx(Button, {
36
+ onClick: handleErrorClick,
37
+ children: "Error"
38
+ })
39
+ ]
9
40
  });
10
- const handleSuccessClick = () => notifications.success({
11
- title: "You've successfully clicked the 'Success' button.",
12
- });
13
- const handleWarningClick = () => notifications.warning({
14
- title: "You've successfully clicked the 'Warning' button.",
15
- });
16
- const handleErrorClick = () => notifications.error({
17
- title: "You've successfully clicked the 'Error' button.",
18
- });
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
41
  };
42
+
21
43
  //# 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":";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
+ {"version":3,"sources":["../../src/demo/status-variations-preview.tsx"],"sourcesContent":["import { Button, Flex } from '@servicetitan/anvil2';\nimport { useDependencies } from '@servicetitan/react-ioc';\nimport { FC } from 'react';\n\nimport { NotificationsService } from '..';\n\nexport const StatusVariationsPreview: FC = () => {\n const [notifications] = useDependencies(NotificationsService);\n\n const handleInfoClick = () =>\n notifications.info({\n title: \"You've successfully clicked the 'Info' button.\",\n });\n\n const handleSuccessClick = () =>\n notifications.success({\n title: \"You've successfully clicked the 'Success' button.\",\n });\n\n const handleWarningClick = () =>\n notifications.warning({\n title: \"You've successfully clicked the 'Warning' button.\",\n });\n\n const handleErrorClick = () =>\n notifications.error({\n title: \"You've successfully clicked the 'Error' button.\",\n });\n\n return (\n <Flex direction=\"row\" gap=\"2\">\n <Button onClick={handleInfoClick}>Info</Button>\n <Button onClick={handleSuccessClick}>Success</Button>\n <Button onClick={handleWarningClick}>Warning</Button>\n <Button onClick={handleErrorClick}>Error</Button>\n </Flex>\n );\n};\n"],"names":["Button","Flex","useDependencies","NotificationsService","StatusVariationsPreview","notifications","handleInfoClick","info","title","handleSuccessClick","success","handleWarningClick","warning","handleErrorClick","error","direction","gap","onClick"],"mappings":";AAAA,SAASA,MAAM,EAAEC,IAAI,QAAQ,uBAAuB;AACpD,SAASC,eAAe,QAAQ,0BAA0B;AAG1D,SAASC,oBAAoB,QAAQ,KAAK;AAE1C,OAAO,MAAMC,0BAA8B;IACvC,MAAM,CAACC,cAAc,GAAGH,gBAAgBC;IAExC,MAAMG,kBAAkB,IACpBD,cAAcE,IAAI,CAAC;YACfC,OAAO;QACX;IAEJ,MAAMC,qBAAqB,IACvBJ,cAAcK,OAAO,CAAC;YAClBF,OAAO;QACX;IAEJ,MAAMG,qBAAqB,IACvBN,cAAcO,OAAO,CAAC;YAClBJ,OAAO;QACX;IAEJ,MAAMK,mBAAmB,IACrBR,cAAcS,KAAK,CAAC;YAChBN,OAAO;QACX;IAEJ,qBACI,MAACP;QAAKc,WAAU;QAAMC,KAAI;;0BACtB,KAAChB;gBAAOiB,SAASX;0BAAiB;;0BAClC,KAACN;gBAAOiB,SAASR;0BAAoB;;0BACrC,KAACT;gBAAOiB,SAASN;0BAAoB;;0BACrC,KAACX;gBAAOiB,SAASJ;0BAAkB;;;;AAG/C,EAAE"}
@@ -1,5 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Container } from './container';
3
3
  import { StatusVariationsPreview } from './status-variations-preview';
4
- export const StatusVariationsExample = () => (_jsx(Container, { children: () => _jsx(StatusVariationsPreview, {}) }));
4
+ export const StatusVariationsExample = ()=>/*#__PURE__*/ _jsx(Container, {
5
+ children: ()=>/*#__PURE__*/ _jsx(StatusVariationsPreview, {})
6
+ });
7
+
5
8
  //# sourceMappingURL=status-variations.js.map
@@ -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;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"}
1
+ {"version":3,"sources":["../../src/demo/status-variations.tsx"],"sourcesContent":["import { FC } from 'react';\n\nimport { Container } from './container';\nimport { StatusVariationsPreview } from './status-variations-preview';\n\nexport const StatusVariationsExample: FC = () => (\n <Container>{() => <StatusVariationsPreview />}</Container>\n);\n"],"names":["Container","StatusVariationsPreview","StatusVariationsExample"],"mappings":";AAEA,SAASA,SAAS,QAAQ,cAAc;AACxC,SAASC,uBAAuB,QAAQ,8BAA8B;AAEtE,OAAO,MAAMC,0BAA8B,kBACvC,KAACF;kBAAW,kBAAM,KAACC;OACrB"}
package/dist/index.js CHANGED
@@ -1,7 +1,8 @@
1
- export { NotificationsApi, NotificationProcessStatus, } from './api/notifications.api';
2
- export { Notifications } from './components/notifications';
3
- export { Status, } from './common';
4
- export { intercept } from './intercept';
5
- export { NOTIFICATIONS_CHANNEL_TOKEN } from './notifications-channel';
6
- export { NotificationsService } from './notifications-service';
1
+ export { NotificationsApi, NotificationProcessStatus, DefaultServerNotificationPayload } from './api/notifications.api';
2
+ export { Notifications, NotificationsProps } from './components/notifications';
3
+ export { DefaultNotificationOptions, LinkAction, FunctionAction, Notification, Status } from './common';
4
+ export { intercept, NotificationInterceptor } from './intercept';
5
+ export { NotificationsChannel, NOTIFICATIONS_CHANNEL_TOKEN } from './notifications-channel';
6
+ export { INotificationsService, NotificationsService } from './notifications-service';
7
+
7
8
  //# 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,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"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n NotificationsApi,\n NotificationProcessStatus,\n DefaultServerNotificationPayload,\n} from './api/notifications.api';\nexport { Notifications, NotificationsProps } from './components/notifications';\nexport {\n DefaultNotificationOptions,\n LinkAction,\n FunctionAction,\n Notification,\n Status,\n} from './common';\nexport { intercept, NotificationInterceptor } from './intercept';\nexport { NotificationsChannel, NOTIFICATIONS_CHANNEL_TOKEN } from './notifications-channel';\nexport { INotificationsService, NotificationsService } from './notifications-service';\n"],"names":["NotificationsApi","NotificationProcessStatus","DefaultServerNotificationPayload","Notifications","NotificationsProps","DefaultNotificationOptions","LinkAction","FunctionAction","Notification","Status","intercept","NotificationInterceptor","NotificationsChannel","NOTIFICATIONS_CHANNEL_TOKEN","INotificationsService","NotificationsService"],"mappings":"AAAA,SACIA,gBAAgB,EAChBC,yBAAyB,EACzBC,gCAAgC,QAC7B,0BAA0B;AACjC,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,6BAA6B;AAC/E,SACIC,0BAA0B,EAC1BC,UAAU,EACVC,cAAc,EACdC,YAAY,EACZC,MAAM,QACH,WAAW;AAClB,SAASC,SAAS,EAAEC,uBAAuB,QAAQ,cAAc;AACjE,SAASC,oBAAoB,EAAEC,2BAA2B,QAAQ,0BAA0B;AAC5F,SAASC,qBAAqB,EAAEC,oBAAoB,QAAQ,0BAA0B"}
package/dist/intercept.js CHANGED
@@ -2,4 +2,5 @@ import { NotificationsStore } from './stores/notifications.store';
2
2
  export function intercept(type, fn) {
3
3
  NotificationsStore.intercept(type, fn);
4
4
  }
5
+
5
6
  //# sourceMappingURL=intercept.js.map
@@ -1 +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
+ {"version":3,"sources":["../src/intercept.ts"],"sourcesContent":["import { DefaultNotificationOptions, Notification } from './common';\nimport { NotificationsStore } from './stores/notifications.store';\n\nexport type NotificationInterceptor<T extends Record<keyof any, any> = {}> = (\n notification: Notification<T>,\n dismiss: () => void\n) => Notification<DefaultNotificationOptions> | undefined;\n\nexport function intercept<T extends Record<keyof any, any> = {}>(\n type: string,\n fn?: NotificationInterceptor<T>\n) {\n NotificationsStore.intercept(type, fn);\n}\n"],"names":["NotificationsStore","intercept","type","fn"],"mappings":"AACA,SAASA,kBAAkB,QAAQ,+BAA+B;AAOlE,OAAO,SAASC,UACZC,IAAY,EACZC,EAA+B;IAE/BH,mBAAmBC,SAAS,CAACC,MAAMC;AACvC"}
@@ -1,3 +1,4 @@
1
1
  import { symbolToken } from '@servicetitan/react-ioc';
2
2
  export const NOTIFICATIONS_CHANNEL_TOKEN = symbolToken('NOTIFICATIONS_CHANNEL_TOKEN');
3
+
3
4
  //# sourceMappingURL=notifications-channel.js.map
@@ -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;AAgBtD,MAAM,CAAC,MAAM,2BAA2B,GAAG,WAAW,CAClD,6BAA6B,CAChC,CAAC"}
1
+ {"version":3,"sources":["../src/notifications-channel.ts"],"sourcesContent":["import { symbolToken } from '@servicetitan/react-ioc';\n\ntype EventCallback = (data: any, context: any) => void;\n\ninterface EventsDispatcher {\n bind(eventName: string, callback: EventCallback, context?: any): this;\n unbind(eventName?: string | null, callback?: EventCallback | null, context?: any): this;\n}\n\ninterface Publisher extends EventsDispatcher {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n global_emitter: EventsDispatcher;\n}\n\nexport type NotificationsChannel = () => Publisher;\n\nexport const NOTIFICATIONS_CHANNEL_TOKEN = symbolToken<NotificationsChannel>(\n 'NOTIFICATIONS_CHANNEL_TOKEN'\n);\n"],"names":["symbolToken","NOTIFICATIONS_CHANNEL_TOKEN"],"mappings":"AAAA,SAASA,WAAW,QAAQ,0BAA0B;AAgBtD,OAAO,MAAMC,8BAA8BD,YACvC,+BACF"}