@servicetitan/notifications 41.1.0 → 41.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 (106) hide show
  1. package/dist/api/notifications.api.d.ts +1 -1
  2. package/dist/api/notifications.api.d.ts.map +1 -1
  3. package/dist/api/notifications.api.js.map +1 -1
  4. package/dist/common.d.ts +1 -1
  5. package/dist/common.d.ts.map +1 -1
  6. package/dist/common.js.map +1 -1
  7. package/dist/components/notifications.d.ts +2 -2
  8. package/dist/components/notifications.d.ts.map +1 -1
  9. package/dist/components/notifications.js.map +1 -1
  10. package/dist/demo/action-button-preview.d.ts +1 -1
  11. package/dist/demo/action-button-preview.d.ts.map +1 -1
  12. package/dist/demo/action-button-preview.js.map +1 -1
  13. package/dist/demo/action-button.d.ts +1 -1
  14. package/dist/demo/action-button.d.ts.map +1 -1
  15. package/dist/demo/action-button.js.map +1 -1
  16. package/dist/demo/basic-preview.d.ts +1 -1
  17. package/dist/demo/basic-preview.d.ts.map +1 -1
  18. package/dist/demo/basic-preview.js.map +1 -1
  19. package/dist/demo/basic.d.ts +1 -1
  20. package/dist/demo/basic.d.ts.map +1 -1
  21. package/dist/demo/basic.js.map +1 -1
  22. package/dist/demo/container.d.ts +3 -3
  23. package/dist/demo/container.d.ts.map +1 -1
  24. package/dist/demo/container.js.map +1 -1
  25. package/dist/demo/duration-preview.d.ts +1 -1
  26. package/dist/demo/duration-preview.d.ts.map +1 -1
  27. package/dist/demo/duration-preview.js.map +1 -1
  28. package/dist/demo/duration.d.ts +1 -1
  29. package/dist/demo/duration.d.ts.map +1 -1
  30. package/dist/demo/duration.js.map +1 -1
  31. package/dist/demo/mock-notifications-api.d.ts +3 -2
  32. package/dist/demo/mock-notifications-api.d.ts.map +1 -1
  33. package/dist/demo/mock-notifications-api.js.map +1 -1
  34. package/dist/demo/multiline-message-preview.d.ts +1 -1
  35. package/dist/demo/multiline-message-preview.d.ts.map +1 -1
  36. package/dist/demo/multiline-message-preview.js.map +1 -1
  37. package/dist/demo/multiline-message.d.ts +1 -1
  38. package/dist/demo/multiline-message.d.ts.map +1 -1
  39. package/dist/demo/multiline-message.js.map +1 -1
  40. package/dist/demo/prevent-duplicates-preview.d.ts +1 -1
  41. package/dist/demo/prevent-duplicates-preview.d.ts.map +1 -1
  42. package/dist/demo/prevent-duplicates-preview.js.map +1 -1
  43. package/dist/demo/prevent-duplicates.d.ts +1 -1
  44. package/dist/demo/prevent-duplicates.d.ts.map +1 -1
  45. package/dist/demo/prevent-duplicates.js.map +1 -1
  46. package/dist/demo/progress-preview.d.ts +1 -1
  47. package/dist/demo/progress-preview.d.ts.map +1 -1
  48. package/dist/demo/progress-preview.js.map +1 -1
  49. package/dist/demo/progress.d.ts +1 -1
  50. package/dist/demo/progress.d.ts.map +1 -1
  51. package/dist/demo/progress.js.map +1 -1
  52. package/dist/demo/server-custom.d.ts +1 -1
  53. package/dist/demo/server-custom.d.ts.map +1 -1
  54. package/dist/demo/server-custom.js.map +1 -1
  55. package/dist/demo/server-default.d.ts +1 -1
  56. package/dist/demo/server-default.d.ts.map +1 -1
  57. package/dist/demo/server-default.js.map +1 -1
  58. package/dist/demo/server-on-load.d.ts +1 -1
  59. package/dist/demo/server-on-load.d.ts.map +1 -1
  60. package/dist/demo/server-on-load.js.map +1 -1
  61. package/dist/demo/status-variations-preview.d.ts +1 -1
  62. package/dist/demo/status-variations-preview.d.ts.map +1 -1
  63. package/dist/demo/status-variations-preview.js.map +1 -1
  64. package/dist/demo/status-variations.d.ts +1 -1
  65. package/dist/demo/status-variations.d.ts.map +1 -1
  66. package/dist/demo/status-variations.js.map +1 -1
  67. package/dist/intercept.d.ts +1 -1
  68. package/dist/intercept.d.ts.map +1 -1
  69. package/dist/intercept.js.map +1 -1
  70. package/dist/notifications-service.d.ts +1 -1
  71. package/dist/notifications-service.d.ts.map +1 -1
  72. package/dist/notifications-service.js.map +1 -1
  73. package/dist/notifications.stories.d.ts.map +1 -1
  74. package/dist/stores/notifications.store.d.ts +3 -3
  75. package/dist/stores/notifications.store.d.ts.map +1 -1
  76. package/dist/stores/notifications.store.js.map +1 -1
  77. package/package.json +5 -5
  78. package/src/__tests__/notifications-service.test.ts +3 -2
  79. package/src/api/notifications.api.ts +1 -1
  80. package/src/common.ts +1 -1
  81. package/src/components/__tests__/notifications.test.tsx +2 -1
  82. package/src/components/notifications.tsx +4 -10
  83. package/src/demo/action-button-preview.tsx +1 -1
  84. package/src/demo/action-button.tsx +1 -1
  85. package/src/demo/basic-preview.tsx +1 -1
  86. package/src/demo/basic.tsx +1 -1
  87. package/src/demo/container.tsx +5 -8
  88. package/src/demo/duration-preview.tsx +1 -1
  89. package/src/demo/duration.tsx +1 -1
  90. package/src/demo/mock-notifications-api.ts +3 -2
  91. package/src/demo/multiline-message-preview.tsx +1 -1
  92. package/src/demo/multiline-message.tsx +1 -1
  93. package/src/demo/prevent-duplicates-preview.tsx +1 -1
  94. package/src/demo/prevent-duplicates.tsx +1 -1
  95. package/src/demo/progress-preview.tsx +1 -1
  96. package/src/demo/progress.tsx +1 -1
  97. package/src/demo/server-custom.tsx +2 -1
  98. package/src/demo/server-default.tsx +1 -1
  99. package/src/demo/server-on-load.tsx +5 -6
  100. package/src/demo/status-variations-preview.tsx +1 -1
  101. package/src/demo/status-variations.tsx +1 -1
  102. package/src/intercept.ts +1 -1
  103. package/src/notifications-service.ts +2 -1
  104. package/src/notifications.stories.tsx +2 -1
  105. package/src/stores/__tests__/notifications.store.test.ts +6 -8
  106. package/src/stores/notifications.store.ts +10 -6
@@ -1,4 +1,4 @@
1
- import { AxiosPromise, CancelToken } from 'axios';
1
+ import type { AxiosPromise, CancelToken } from 'axios';
2
2
  export declare abstract class NotificationsApi {
3
3
  abstract getNotifications(read: boolean, cancelToken?: CancelToken): AxiosPromise<Notification[]>;
4
4
  abstract changeIsReadProperty(id: number, read: boolean, version: number, cancelToken?: CancelToken): AxiosPromise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"notifications.api.d.ts","sourceRoot":"","sources":["../../src/api/notifications.api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAElD,8BAAsB,gBAAgB;IAClC,QAAQ,CAAC,gBAAgB,CACrB,IAAI,EAAE,OAAO,EACb,WAAW,CAAC,EAAE,WAAW,GAC1B,YAAY,CAAC,YAAY,EAAE,CAAC;IAE/B,QAAQ,CAAC,oBAAoB,CACzB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,WAAW,GAC1B,YAAY,CAAC,IAAI,CAAC;IAErB,QAAQ,CAAC,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,YAAY,CAAC,YAAY,CAAC;CAC9F;AAED,MAAM,WAAW,YAAY;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,yBAAyB,CAAC;IAClC,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,UAAU,EAAE,IAAI,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,oBAAY,yBAAyB;IACjC,IAAI,IAAI;IACR,UAAU,IAAI;IACd,OAAO,IAAI;IACX,OAAO,IAAI;CACd;AAED,MAAM,WAAW,gCAAgC;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;KAChB,CAAC;CACL"}
1
+ {"version":3,"file":"notifications.api.d.ts","sourceRoot":"","sources":["../../src/api/notifications.api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEvD,8BAAsB,gBAAgB;IAClC,QAAQ,CAAC,gBAAgB,CACrB,IAAI,EAAE,OAAO,EACb,WAAW,CAAC,EAAE,WAAW,GAC1B,YAAY,CAAC,YAAY,EAAE,CAAC;IAE/B,QAAQ,CAAC,oBAAoB,CACzB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,WAAW,GAC1B,YAAY,CAAC,IAAI,CAAC;IAErB,QAAQ,CAAC,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,YAAY,CAAC,YAAY,CAAC;CAC9F;AAED,MAAM,WAAW,YAAY;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,yBAAyB,CAAC;IAClC,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,UAAU,EAAE,IAAI,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,oBAAY,yBAAyB;IACjC,IAAI,IAAI;IACR,UAAU,IAAI;IACd,OAAO,IAAI;IACX,OAAO,IAAI;CACd;AAED,MAAM,WAAW,gCAAgC;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;KAChB,CAAC;CACL"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/api/notifications.api.ts"],"sourcesContent":["import { AxiosPromise, CancelToken } from 'axios';\n\nexport abstract class NotificationsApi {\n abstract getNotifications(\n read: boolean,\n cancelToken?: CancelToken\n ): AxiosPromise<Notification[]>;\n\n abstract changeIsReadProperty(\n id: number,\n read: boolean,\n version: number,\n cancelToken?: CancelToken\n ): AxiosPromise<void>;\n\n abstract getNotification(id: number, cancelToken?: CancelToken): AxiosPromise<Notification>;\n}\n\nexport interface Notification {\n id: number;\n userId: number;\n type: string;\n status: NotificationProcessStatus;\n isRead: boolean;\n createdOn: Date;\n modifiedOn: Date;\n version: number;\n payload?: string;\n}\n\nexport enum NotificationProcessStatus {\n Info = 0,\n InProgress = 1,\n Success = 2,\n Failure = 3,\n}\n\nexport interface DefaultServerNotificationPayload {\n title: string;\n message?: string;\n duration?: number;\n progress?: number;\n action?: {\n label: string;\n link: string;\n };\n}\n"],"names":["NotificationsApi","NotificationProcessStatus"],"mappings":"AAEA,OAAO,MAAeA;AActB;AAcA,OAAO,IAAA,AAAKC,mDAAAA;;;;;WAAAA;MAKX"}
1
+ {"version":3,"sources":["../../src/api/notifications.api.ts"],"sourcesContent":["import type { AxiosPromise, CancelToken } from 'axios';\n\nexport abstract class NotificationsApi {\n abstract getNotifications(\n read: boolean,\n cancelToken?: CancelToken\n ): AxiosPromise<Notification[]>;\n\n abstract changeIsReadProperty(\n id: number,\n read: boolean,\n version: number,\n cancelToken?: CancelToken\n ): AxiosPromise<void>;\n\n abstract getNotification(id: number, cancelToken?: CancelToken): AxiosPromise<Notification>;\n}\n\nexport interface Notification {\n id: number;\n userId: number;\n type: string;\n status: NotificationProcessStatus;\n isRead: boolean;\n createdOn: Date;\n modifiedOn: Date;\n version: number;\n payload?: string;\n}\n\nexport enum NotificationProcessStatus {\n Info = 0,\n InProgress = 1,\n Success = 2,\n Failure = 3,\n}\n\nexport interface DefaultServerNotificationPayload {\n title: string;\n message?: string;\n duration?: number;\n progress?: number;\n action?: {\n label: string;\n link: string;\n };\n}\n"],"names":["NotificationsApi","NotificationProcessStatus"],"mappings":"AAEA,OAAO,MAAeA;AActB;AAcA,OAAO,IAAA,AAAKC,mDAAAA;;;;;WAAAA;MAKX"}
package/dist/common.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Notification as ServerNotification } from './api/notifications.api';
1
+ import type { Notification as ServerNotification } from './api/notifications.api';
2
2
  export interface Notification<T extends Record<keyof any, any> = Record<keyof any, any>> extends Omit<ServerNotification, 'payload'> {
3
3
  payload: T;
4
4
  }
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,IAAI,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7E,MAAM,WAAW,YAAY,CACzB,CAAC,SAAS,MAAM,CAAC,MAAM,GAAG,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,EAAE,GAAG,CAAC,CAC3D,SAAQ,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC;IACzC,OAAO,EAAE,CAAC,CAAC;CACd;AAED,MAAM,WAAW,0BAA0B;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,UAAU,GAAG,cAAc,CAAC;CACxC;AAED,oBAAY,MAAM;IACd,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,KAAK,aAAa;CACrB;AAED,MAAM,WAAW,UAAU;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,cAAc,GAAG,MAAM,IAAI,UAAU,CAEtF;AAED,wBAAgB,OAAO,CACnB,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,EACtC,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,WAGzC"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,IAAI,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElF,MAAM,WAAW,YAAY,CACzB,CAAC,SAAS,MAAM,CAAC,MAAM,GAAG,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,EAAE,GAAG,CAAC,CAC3D,SAAQ,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC;IACzC,OAAO,EAAE,CAAC,CAAC;CACd;AAED,MAAM,WAAW,0BAA0B;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,UAAU,GAAG,cAAc,CAAC;CACxC;AAED,oBAAY,MAAM;IACd,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,KAAK,aAAa;CACrB;AAED,MAAM,WAAW,UAAU;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,cAAc,GAAG,MAAM,IAAI,UAAU,CAEtF;AAED,wBAAgB,OAAO,CACnB,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,EACtC,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,WAGzC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/common.ts"],"sourcesContent":["import { Notification as ServerNotification } from './api/notifications.api';\n\nexport interface Notification<\n T extends Record<keyof any, any> = Record<keyof any, any>,\n> extends Omit<ServerNotification, 'payload'> {\n payload: T;\n}\n\nexport interface DefaultNotificationOptions {\n status?: Status;\n title: string;\n message?: string;\n duration?: number;\n progress?: number;\n action?: LinkAction | FunctionAction;\n}\n\nexport enum Status {\n Info = 'info',\n Success = 'success',\n Warning = 'warning',\n Error = 'critical',\n}\n\nexport interface LinkAction {\n label: string;\n link: string;\n external?: boolean;\n}\n\nexport interface FunctionAction {\n label: string;\n onClick: () => void;\n}\n\nexport function isLinkAction(action: LinkAction | FunctionAction): action is LinkAction {\n return Object.hasOwn(action, 'link');\n}\n\nexport function isNewer(\n prev: Pick<Notification, 'modifiedOn'>,\n next: Pick<Notification, 'modifiedOn'>\n) {\n return next.modifiedOn && (!prev.modifiedOn || prev.modifiedOn < next.modifiedOn);\n}\n"],"names":["Status","isLinkAction","action","Object","hasOwn","isNewer","prev","next","modifiedOn"],"mappings":"AAiBA,OAAO,IAAA,AAAKA,gCAAAA;;;;;WAAAA;MAKX;AAaD,OAAO,SAASC,aAAaC,MAAmC;IAC5D,OAAOC,OAAOC,MAAM,CAACF,QAAQ;AACjC;AAEA,OAAO,SAASG,QACZC,IAAsC,EACtCC,IAAsC;IAEtC,OAAOA,KAAKC,UAAU,IAAK,CAAA,CAACF,KAAKE,UAAU,IAAIF,KAAKE,UAAU,GAAGD,KAAKC,UAAU,AAAD;AACnF"}
1
+ {"version":3,"sources":["../src/common.ts"],"sourcesContent":["import type { Notification as ServerNotification } from './api/notifications.api';\n\nexport interface Notification<\n T extends Record<keyof any, any> = Record<keyof any, any>,\n> extends Omit<ServerNotification, 'payload'> {\n payload: T;\n}\n\nexport interface DefaultNotificationOptions {\n status?: Status;\n title: string;\n message?: string;\n duration?: number;\n progress?: number;\n action?: LinkAction | FunctionAction;\n}\n\nexport enum Status {\n Info = 'info',\n Success = 'success',\n Warning = 'warning',\n Error = 'critical',\n}\n\nexport interface LinkAction {\n label: string;\n link: string;\n external?: boolean;\n}\n\nexport interface FunctionAction {\n label: string;\n onClick: () => void;\n}\n\nexport function isLinkAction(action: LinkAction | FunctionAction): action is LinkAction {\n return Object.hasOwn(action, 'link');\n}\n\nexport function isNewer(\n prev: Pick<Notification, 'modifiedOn'>,\n next: Pick<Notification, 'modifiedOn'>\n) {\n return next.modifiedOn && (!prev.modifiedOn || prev.modifiedOn < next.modifiedOn);\n}\n"],"names":["Status","isLinkAction","action","Object","hasOwn","isNewer","prev","next","modifiedOn"],"mappings":"AAiBA,OAAO,IAAA,AAAKA,gCAAAA;;;;;WAAAA;MAKX;AAaD,OAAO,SAASC,aAAaC,MAAmC;IAC5D,OAAOC,OAAOC,MAAM,CAACF,QAAQ;AACjC;AAEA,OAAO,SAASG,QACZC,IAAsC,EACtCC,IAAsC;IAEtC,OAAOA,KAAKC,UAAU,IAAK,CAAA,CAACF,KAAKE,UAAU,IAAIF,KAAKE,UAAU,GAAGD,KAAKC,UAAU,AAAD;AACnF"}
@@ -1,5 +1,5 @@
1
- import { interfaces } from '@servicetitan/react-ioc';
2
- import { FC, PropsWithChildren } from 'react';
1
+ import type { interfaces } from '@servicetitan/react-ioc';
2
+ import type { FC, PropsWithChildren } from 'react';
3
3
  import { NotificationsApi } from '../api/notifications.api';
4
4
  export interface NotificationsProps extends PropsWithChildren<{}> {
5
5
  apiService?: interfaces.Newable<NotificationsApi>;
@@ -1 +1 @@
1
- {"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../src/components/notifications.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,UAAU,EAAmB,MAAM,yBAAyB,CAAC;AAChF,OAAO,EACH,EAAE,EACF,iBAAiB,EAMpB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAK5D,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB,CAAC,EAAE,CAAC;IAC7D,UAAU,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACrD;AAED,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAWhD,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACX;;;OAGG;IACH,IAAI,uBAAuB,EAAE,MAAM,GAAG,SAAS,CAAC;CACnD"}
1
+ {"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../src/components/notifications.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAGnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAK5D,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB,CAAC,EAAE,CAAC;IAC7D,UAAU,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACrD;AAED,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAWhD,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACX;;;OAGG;IACH,IAAI,uBAAuB,EAAE,MAAM,GAAG,SAAS,CAAC;CACnD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/notifications.tsx"],"sourcesContent":["import { Toaster } from '@servicetitan/anvil2';\nimport { Provider, interfaces, useDependencies } from '@servicetitan/react-ioc';\nimport {\n FC,\n PropsWithChildren,\n useCallback,\n useEffect,\n useRef,\n useState,\n useSyncExternalStore,\n} from 'react';\n\nimport { NotificationsApi } from '../api/notifications.api';\nimport { NotificationsStore } from '../stores/notifications.store';\nimport { useCompatibleNavigate } from '../utils/use-compatible-navigate';\nimport { NotificationsService } from '../notifications-service';\n\nexport interface NotificationsProps extends PropsWithChildren<{}> {\n apiService?: interfaces.Newable<NotificationsApi>;\n}\n\nexport const Notifications: FC<NotificationsProps> = ({ apiService, children }) => (\n <Provider\n singletons={[\n ...(apiService ? [{ provide: NotificationsApi, useClass: apiService }] : []),\n NotificationsStore,\n NotificationsService,\n ]}\n >\n <NotificationsUnwrapped />\n {children}\n </Provider>\n);\n\ndeclare global {\n /**\n * This variable ensures there is one and only one \\<Toaster />.\n * It contains the unique id of the instance that owns the Toaster.\n */\n var STNotificationsActiveId: string | undefined;\n}\n\nconst NotificationsUnwrapped: FC = () => {\n // Configure and clean up store\n\n const [store] = useDependencies(NotificationsStore);\n const navigate = useCompatibleNavigate();\n useEffect(() => {\n store.navigate = navigate;\n return () => {\n store.dispose();\n };\n }, [store, navigate]);\n\n // Use useSyncExternalStore to ensure we re-render when the active id changes\n\n const [thisId] = useState(() => makeId());\n const syncExternalStoreCallback = useRef<Function>();\n const subscribe = useCallback((callback: Function) => {\n syncExternalStoreCallback.current = callback;\n return () => (syncExternalStoreCallback.current = undefined);\n }, []);\n const activeId = useSyncExternalStore(subscribe, () => globalThis.STNotificationsActiveId);\n\n // Set and clean up active id\n\n useEffect(() => {\n if (globalThis.STNotificationsActiveId === undefined) {\n globalThis.STNotificationsActiveId = thisId;\n syncExternalStoreCallback.current?.();\n }\n return () => {\n if (globalThis.STNotificationsActiveId === thisId) {\n globalThis.STNotificationsActiveId = undefined;\n syncExternalStoreCallback.current?.();\n }\n };\n }, [syncExternalStoreCallback, thisId]);\n\n return activeId === thisId ? (\n <Toaster id={'st-notifications-' + thisId} onToastEvent={store.onToastEvent} />\n ) : null;\n};\n\nfunction makeId() {\n return Math.round(1e8 * Math.random()).toString(36);\n}\n"],"names":["Toaster","Provider","useDependencies","useCallback","useEffect","useRef","useState","useSyncExternalStore","NotificationsApi","NotificationsStore","useCompatibleNavigate","NotificationsService","Notifications","apiService","children","singletons","provide","useClass","NotificationsUnwrapped","store","navigate","dispose","thisId","makeId","syncExternalStoreCallback","subscribe","callback","current","undefined","activeId","globalThis","STNotificationsActiveId","id","onToastEvent","Math","round","random","toString"],"mappings":";AAAA,SAASA,OAAO,QAAQ,uBAAuB;AAC/C,SAASC,QAAQ,EAAcC,eAAe,QAAQ,0BAA0B;AAChF,SAGIC,WAAW,EACXC,SAAS,EACTC,MAAM,EACNC,QAAQ,EACRC,oBAAoB,QACjB,QAAQ;AAEf,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,SAASC,kBAAkB,QAAQ,gCAAgC;AACnE,SAASC,qBAAqB,QAAQ,mCAAmC;AACzE,SAASC,oBAAoB,QAAQ,2BAA2B;AAMhE,OAAO,MAAMC,gBAAwC,CAAC,EAAEC,UAAU,EAAEC,QAAQ,EAAE,iBAC1E,MAACb;QACGc,YAAY;eACJF,aAAa;gBAAC;oBAAEG,SAASR;oBAAkBS,UAAUJ;gBAAW;aAAE,GAAG,EAAE;YAC3EJ;YACAE;SACH;;0BAED,KAACO;YACAJ;;OAEP;AAUF,MAAMI,yBAA6B;IAC/B,+BAA+B;IAE/B,MAAM,CAACC,MAAM,GAAGjB,gBAAgBO;IAChC,MAAMW,WAAWV;IACjBN,UAAU;QACNe,MAAMC,QAAQ,GAAGA;QACjB,OAAO;YACHD,MAAME,OAAO;QACjB;IACJ,GAAG;QAACF;QAAOC;KAAS;IAEpB,6EAA6E;IAE7E,MAAM,CAACE,OAAO,GAAGhB,SAAS,IAAMiB;IAChC,MAAMC,4BAA4BnB;IAClC,MAAMoB,YAAYtB,YAAY,CAACuB;QAC3BF,0BAA0BG,OAAO,GAAGD;QACpC,OAAO,IAAOF,0BAA0BG,OAAO,GAAGC;IACtD,GAAG,EAAE;IACL,MAAMC,WAAWtB,qBAAqBkB,WAAW,IAAMK,WAAWC,uBAAuB;IAEzF,6BAA6B;IAE7B3B,UAAU;QACN,IAAI0B,WAAWC,uBAAuB,KAAKH,WAAW;gBAElDJ;YADAM,WAAWC,uBAAuB,GAAGT;aACrCE,qCAAAA,0BAA0BG,OAAO,cAAjCH,yDAAAA,wCAAAA;QACJ;QACA,OAAO;YACH,IAAIM,WAAWC,uBAAuB,KAAKT,QAAQ;oBAE/CE;gBADAM,WAAWC,uBAAuB,GAAGH;iBACrCJ,qCAAAA,0BAA0BG,OAAO,cAAjCH,yDAAAA,wCAAAA;YACJ;QACJ;IACJ,GAAG;QAACA;QAA2BF;KAAO;IAEtC,OAAOO,aAAaP,uBAChB,KAACtB;QAAQgC,IAAI,sBAAsBV;QAAQW,cAAcd,MAAMc,YAAY;SAC3E;AACR;AAEA,SAASV;IACL,OAAOW,KAAKC,KAAK,CAAC,MAAMD,KAAKE,MAAM,IAAIC,QAAQ,CAAC;AACpD"}
1
+ {"version":3,"sources":["../../src/components/notifications.tsx"],"sourcesContent":["import { Toaster } from '@servicetitan/anvil2';\nimport type { interfaces } from '@servicetitan/react-ioc';\nimport { Provider, useDependencies } from '@servicetitan/react-ioc';\nimport type { FC, PropsWithChildren } from 'react';\nimport { useCallback, useEffect, useRef, useState, useSyncExternalStore } from 'react';\n\nimport { NotificationsApi } from '../api/notifications.api';\nimport { NotificationsStore } from '../stores/notifications.store';\nimport { useCompatibleNavigate } from '../utils/use-compatible-navigate';\nimport { NotificationsService } from '../notifications-service';\n\nexport interface NotificationsProps extends PropsWithChildren<{}> {\n apiService?: interfaces.Newable<NotificationsApi>;\n}\n\nexport const Notifications: FC<NotificationsProps> = ({ apiService, children }) => (\n <Provider\n singletons={[\n ...(apiService ? [{ provide: NotificationsApi, useClass: apiService }] : []),\n NotificationsStore,\n NotificationsService,\n ]}\n >\n <NotificationsUnwrapped />\n {children}\n </Provider>\n);\n\ndeclare global {\n /**\n * This variable ensures there is one and only one \\<Toaster />.\n * It contains the unique id of the instance that owns the Toaster.\n */\n var STNotificationsActiveId: string | undefined;\n}\n\nconst NotificationsUnwrapped: FC = () => {\n // Configure and clean up store\n\n const [store] = useDependencies(NotificationsStore);\n const navigate = useCompatibleNavigate();\n useEffect(() => {\n store.navigate = navigate;\n return () => {\n store.dispose();\n };\n }, [store, navigate]);\n\n // Use useSyncExternalStore to ensure we re-render when the active id changes\n\n const [thisId] = useState(() => makeId());\n const syncExternalStoreCallback = useRef<Function>();\n const subscribe = useCallback((callback: Function) => {\n syncExternalStoreCallback.current = callback;\n return () => (syncExternalStoreCallback.current = undefined);\n }, []);\n const activeId = useSyncExternalStore(subscribe, () => globalThis.STNotificationsActiveId);\n\n // Set and clean up active id\n\n useEffect(() => {\n if (globalThis.STNotificationsActiveId === undefined) {\n globalThis.STNotificationsActiveId = thisId;\n syncExternalStoreCallback.current?.();\n }\n return () => {\n if (globalThis.STNotificationsActiveId === thisId) {\n globalThis.STNotificationsActiveId = undefined;\n syncExternalStoreCallback.current?.();\n }\n };\n }, [syncExternalStoreCallback, thisId]);\n\n return activeId === thisId ? (\n <Toaster id={'st-notifications-' + thisId} onToastEvent={store.onToastEvent} />\n ) : null;\n};\n\nfunction makeId() {\n return Math.round(1e8 * Math.random()).toString(36);\n}\n"],"names":["Toaster","Provider","useDependencies","useCallback","useEffect","useRef","useState","useSyncExternalStore","NotificationsApi","NotificationsStore","useCompatibleNavigate","NotificationsService","Notifications","apiService","children","singletons","provide","useClass","NotificationsUnwrapped","store","navigate","dispose","thisId","makeId","syncExternalStoreCallback","subscribe","callback","current","undefined","activeId","globalThis","STNotificationsActiveId","id","onToastEvent","Math","round","random","toString"],"mappings":";AAAA,SAASA,OAAO,QAAQ,uBAAuB;AAE/C,SAASC,QAAQ,EAAEC,eAAe,QAAQ,0BAA0B;AAEpE,SAASC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,oBAAoB,QAAQ,QAAQ;AAEvF,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,SAASC,kBAAkB,QAAQ,gCAAgC;AACnE,SAASC,qBAAqB,QAAQ,mCAAmC;AACzE,SAASC,oBAAoB,QAAQ,2BAA2B;AAMhE,OAAO,MAAMC,gBAAwC,CAAC,EAAEC,UAAU,EAAEC,QAAQ,EAAE,iBAC1E,MAACb;QACGc,YAAY;eACJF,aAAa;gBAAC;oBAAEG,SAASR;oBAAkBS,UAAUJ;gBAAW;aAAE,GAAG,EAAE;YAC3EJ;YACAE;SACH;;0BAED,KAACO;YACAJ;;OAEP;AAUF,MAAMI,yBAA6B;IAC/B,+BAA+B;IAE/B,MAAM,CAACC,MAAM,GAAGjB,gBAAgBO;IAChC,MAAMW,WAAWV;IACjBN,UAAU;QACNe,MAAMC,QAAQ,GAAGA;QACjB,OAAO;YACHD,MAAME,OAAO;QACjB;IACJ,GAAG;QAACF;QAAOC;KAAS;IAEpB,6EAA6E;IAE7E,MAAM,CAACE,OAAO,GAAGhB,SAAS,IAAMiB;IAChC,MAAMC,4BAA4BnB;IAClC,MAAMoB,YAAYtB,YAAY,CAACuB;QAC3BF,0BAA0BG,OAAO,GAAGD;QACpC,OAAO,IAAOF,0BAA0BG,OAAO,GAAGC;IACtD,GAAG,EAAE;IACL,MAAMC,WAAWtB,qBAAqBkB,WAAW,IAAMK,WAAWC,uBAAuB;IAEzF,6BAA6B;IAE7B3B,UAAU;QACN,IAAI0B,WAAWC,uBAAuB,KAAKH,WAAW;gBAElDJ;YADAM,WAAWC,uBAAuB,GAAGT;aACrCE,qCAAAA,0BAA0BG,OAAO,cAAjCH,yDAAAA,wCAAAA;QACJ;QACA,OAAO;YACH,IAAIM,WAAWC,uBAAuB,KAAKT,QAAQ;oBAE/CE;gBADAM,WAAWC,uBAAuB,GAAGH;iBACrCJ,qCAAAA,0BAA0BG,OAAO,cAAjCH,yDAAAA,wCAAAA;YACJ;QACJ;IACJ,GAAG;QAACA;QAA2BF;KAAO;IAEtC,OAAOO,aAAaP,uBAChB,KAACtB;QAAQgC,IAAI,sBAAsBV;QAAQW,cAAcd,MAAMc,YAAY;SAC3E;AACR;AAEA,SAASV;IACL,OAAOW,KAAKC,KAAK,CAAC,MAAMD,KAAKE,MAAM,IAAIC,QAAQ,CAAC;AACpD"}
@@ -1,3 +1,3 @@
1
- import { FC } from 'react';
1
+ import type { FC } from 'react';
2
2
  export declare const ActionButtonPreview: FC;
3
3
  //# sourceMappingURL=action-button-preview.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"action-button-preview.d.ts","sourceRoot":"","sources":["../../src/demo/action-button-preview.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAI3B,eAAO,MAAM,mBAAmB,EAAE,EAsCjC,CAAC"}
1
+ {"version":3,"file":"action-button-preview.d.ts","sourceRoot":"","sources":["../../src/demo/action-button-preview.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,eAAO,MAAM,mBAAmB,EAAE,EAsCjC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/demo/action-button-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 ActionButtonPreview: FC = () => {\n const [notifications] = useDependencies(NotificationsService);\n\n const handleWithLinkClick = () =>\n notifications.show({\n title: 'The action button will move you to the \"Table (Master/Detail)\" page.',\n action: {\n label: 'Click me!',\n link: '/table-master-detail',\n },\n });\n\n const handleWithExternalLinkClick = () =>\n notifications.show({\n title: 'The action button will move you to the \"Table (State Caching)\" page.',\n action: {\n label: 'Click me!',\n link: '/table-state-caching',\n external: true,\n },\n });\n\n const handleWithHandlerClick = () =>\n notifications.show({\n title: 'The action button will show you an alert message.',\n action: {\n label: 'Click me!',\n onClick: () => alert(\"You've clicked the action button\"),\n },\n });\n\n return (\n <Flex direction=\"row\" gap=\"2\">\n <Button onClick={handleWithLinkClick}>With Link</Button>\n <Button onClick={handleWithExternalLinkClick}>With Link (new tab)</Button>\n <Button onClick={handleWithHandlerClick}>With Handler</Button>\n </Flex>\n );\n};\n"],"names":["Button","Flex","useDependencies","NotificationsService","ActionButtonPreview","notifications","handleWithLinkClick","show","title","action","label","link","handleWithExternalLinkClick","external","handleWithHandlerClick","onClick","alert","direction","gap"],"mappings":";AAAA,SAASA,MAAM,EAAEC,IAAI,QAAQ,uBAAuB;AACpD,SAASC,eAAe,QAAQ,0BAA0B;AAG1D,SAASC,oBAAoB,QAAQ,KAAK;AAE1C,OAAO,MAAMC,sBAA0B;IACnC,MAAM,CAACC,cAAc,GAAGH,gBAAgBC;IAExC,MAAMG,sBAAsB,IACxBD,cAAcE,IAAI,CAAC;YACfC,OAAO;YACPC,QAAQ;gBACJC,OAAO;gBACPC,MAAM;YACV;QACJ;IAEJ,MAAMC,8BAA8B,IAChCP,cAAcE,IAAI,CAAC;YACfC,OAAO;YACPC,QAAQ;gBACJC,OAAO;gBACPC,MAAM;gBACNE,UAAU;YACd;QACJ;IAEJ,MAAMC,yBAAyB,IAC3BT,cAAcE,IAAI,CAAC;YACfC,OAAO;YACPC,QAAQ;gBACJC,OAAO;gBACPK,SAAS,IAAMC,MAAM;YACzB;QACJ;IAEJ,qBACI,MAACf;QAAKgB,WAAU;QAAMC,KAAI;;0BACtB,KAAClB;gBAAOe,SAAST;0BAAqB;;0BACtC,KAACN;gBAAOe,SAASH;0BAA6B;;0BAC9C,KAACZ;gBAAOe,SAASD;0BAAwB;;;;AAGrD,EAAE"}
1
+ {"version":3,"sources":["../../src/demo/action-button-preview.tsx"],"sourcesContent":["import { Button, Flex } from '@servicetitan/anvil2';\nimport { useDependencies } from '@servicetitan/react-ioc';\nimport type { FC } from 'react';\n\nimport { NotificationsService } from '..';\n\nexport const ActionButtonPreview: FC = () => {\n const [notifications] = useDependencies(NotificationsService);\n\n const handleWithLinkClick = () =>\n notifications.show({\n title: 'The action button will move you to the \"Table (Master/Detail)\" page.',\n action: {\n label: 'Click me!',\n link: '/table-master-detail',\n },\n });\n\n const handleWithExternalLinkClick = () =>\n notifications.show({\n title: 'The action button will move you to the \"Table (State Caching)\" page.',\n action: {\n label: 'Click me!',\n link: '/table-state-caching',\n external: true,\n },\n });\n\n const handleWithHandlerClick = () =>\n notifications.show({\n title: 'The action button will show you an alert message.',\n action: {\n label: 'Click me!',\n onClick: () => alert(\"You've clicked the action button\"),\n },\n });\n\n return (\n <Flex direction=\"row\" gap=\"2\">\n <Button onClick={handleWithLinkClick}>With Link</Button>\n <Button onClick={handleWithExternalLinkClick}>With Link (new tab)</Button>\n <Button onClick={handleWithHandlerClick}>With Handler</Button>\n </Flex>\n );\n};\n"],"names":["Button","Flex","useDependencies","NotificationsService","ActionButtonPreview","notifications","handleWithLinkClick","show","title","action","label","link","handleWithExternalLinkClick","external","handleWithHandlerClick","onClick","alert","direction","gap"],"mappings":";AAAA,SAASA,MAAM,EAAEC,IAAI,QAAQ,uBAAuB;AACpD,SAASC,eAAe,QAAQ,0BAA0B;AAG1D,SAASC,oBAAoB,QAAQ,KAAK;AAE1C,OAAO,MAAMC,sBAA0B;IACnC,MAAM,CAACC,cAAc,GAAGH,gBAAgBC;IAExC,MAAMG,sBAAsB,IACxBD,cAAcE,IAAI,CAAC;YACfC,OAAO;YACPC,QAAQ;gBACJC,OAAO;gBACPC,MAAM;YACV;QACJ;IAEJ,MAAMC,8BAA8B,IAChCP,cAAcE,IAAI,CAAC;YACfC,OAAO;YACPC,QAAQ;gBACJC,OAAO;gBACPC,MAAM;gBACNE,UAAU;YACd;QACJ;IAEJ,MAAMC,yBAAyB,IAC3BT,cAAcE,IAAI,CAAC;YACfC,OAAO;YACPC,QAAQ;gBACJC,OAAO;gBACPK,SAAS,IAAMC,MAAM;YACzB;QACJ;IAEJ,qBACI,MAACf;QAAKgB,WAAU;QAAMC,KAAI;;0BACtB,KAAClB;gBAAOe,SAAST;0BAAqB;;0BACtC,KAACN;gBAAOe,SAASH;0BAA6B;;0BAC9C,KAACZ;gBAAOe,SAASD;0BAAwB;;;;AAGrD,EAAE"}
@@ -1,3 +1,3 @@
1
- import { FC } from 'react';
1
+ import type { FC } from 'react';
2
2
  export declare const ActionButtonExample: FC;
3
3
  //# sourceMappingURL=action-button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"action-button.d.ts","sourceRoot":"","sources":["../../src/demo/action-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAK3B,eAAO,MAAM,mBAAmB,EAAE,EAAiE,CAAC"}
1
+ {"version":3,"file":"action-button.d.ts","sourceRoot":"","sources":["../../src/demo/action-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAKhC,eAAO,MAAM,mBAAmB,EAAE,EAAiE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/demo/action-button.tsx"],"sourcesContent":["import { FC } from 'react';\n\nimport { Container } from './container';\nimport { ActionButtonPreview } from './action-button-preview';\n\nexport const ActionButtonExample: FC = () => <Container>{() => <ActionButtonPreview />}</Container>;\n"],"names":["Container","ActionButtonPreview","ActionButtonExample"],"mappings":";AAEA,SAASA,SAAS,QAAQ,cAAc;AACxC,SAASC,mBAAmB,QAAQ,0BAA0B;AAE9D,OAAO,MAAMC,sBAA0B,kBAAM,KAACF;kBAAW,kBAAM,KAACC;OAAoC"}
1
+ {"version":3,"sources":["../../src/demo/action-button.tsx"],"sourcesContent":["import type { FC } from 'react';\n\nimport { Container } from './container';\nimport { ActionButtonPreview } from './action-button-preview';\n\nexport const ActionButtonExample: FC = () => <Container>{() => <ActionButtonPreview />}</Container>;\n"],"names":["Container","ActionButtonPreview","ActionButtonExample"],"mappings":";AAEA,SAASA,SAAS,QAAQ,cAAc;AACxC,SAASC,mBAAmB,QAAQ,0BAA0B;AAE9D,OAAO,MAAMC,sBAA0B,kBAAM,KAACF;kBAAW,kBAAM,KAACC;OAAoC"}
@@ -1,3 +1,3 @@
1
- import { FC } from 'react';
1
+ import type { FC } from 'react';
2
2
  export declare const BasicPreview: FC;
3
3
  //# sourceMappingURL=basic-preview.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"basic-preview.d.ts","sourceRoot":"","sources":["../../src/demo/basic-preview.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAI3B,eAAO,MAAM,YAAY,EAAE,EAU1B,CAAC"}
1
+ {"version":3,"file":"basic-preview.d.ts","sourceRoot":"","sources":["../../src/demo/basic-preview.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,eAAO,MAAM,YAAY,EAAE,EAU1B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/demo/basic-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 BasicPreview: FC = () => {\n const [notifications] = useDependencies(NotificationsService);\n\n const handleClick = () =>\n notifications.show({\n title: 'Congratulations!',\n message: \"You've successfully clicked the button.\",\n });\n\n return <Button onClick={handleClick}>Show</Button>;\n};\n"],"names":["Button","useDependencies","NotificationsService","BasicPreview","notifications","handleClick","show","title","message","onClick"],"mappings":";AAAA,SAASA,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,eAAe,QAAQ,0BAA0B;AAG1D,SAASC,oBAAoB,QAAQ,KAAK;AAE1C,OAAO,MAAMC,eAAmB;IAC5B,MAAM,CAACC,cAAc,GAAGH,gBAAgBC;IAExC,MAAMG,cAAc,IAChBD,cAAcE,IAAI,CAAC;YACfC,OAAO;YACPC,SAAS;QACb;IAEJ,qBAAO,KAACR;QAAOS,SAASJ;kBAAa;;AACzC,EAAE"}
1
+ {"version":3,"sources":["../../src/demo/basic-preview.tsx"],"sourcesContent":["import { Button } from '@servicetitan/anvil2';\nimport { useDependencies } from '@servicetitan/react-ioc';\nimport type { FC } from 'react';\n\nimport { NotificationsService } from '..';\n\nexport const BasicPreview: FC = () => {\n const [notifications] = useDependencies(NotificationsService);\n\n const handleClick = () =>\n notifications.show({\n title: 'Congratulations!',\n message: \"You've successfully clicked the button.\",\n });\n\n return <Button onClick={handleClick}>Show</Button>;\n};\n"],"names":["Button","useDependencies","NotificationsService","BasicPreview","notifications","handleClick","show","title","message","onClick"],"mappings":";AAAA,SAASA,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,eAAe,QAAQ,0BAA0B;AAG1D,SAASC,oBAAoB,QAAQ,KAAK;AAE1C,OAAO,MAAMC,eAAmB;IAC5B,MAAM,CAACC,cAAc,GAAGH,gBAAgBC;IAExC,MAAMG,cAAc,IAChBD,cAAcE,IAAI,CAAC;YACfC,OAAO;YACPC,SAAS;QACb;IAEJ,qBAAO,KAACR;QAAOS,SAASJ;kBAAa;;AACzC,EAAE"}
@@ -1,3 +1,3 @@
1
- import { FC } from 'react';
1
+ import type { FC } from 'react';
2
2
  export declare const BasicExample: FC;
3
3
  //# sourceMappingURL=basic.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../src/demo/basic.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAK3B,eAAO,MAAM,YAAY,EAAE,EAA0D,CAAC"}
1
+ {"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../src/demo/basic.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAKhC,eAAO,MAAM,YAAY,EAAE,EAA0D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/demo/basic.tsx"],"sourcesContent":["import { FC } from 'react';\n\nimport { Container } from './container';\nimport { BasicPreview } from './basic-preview';\n\nexport const BasicExample: FC = () => <Container>{() => <BasicPreview />}</Container>;\n"],"names":["Container","BasicPreview","BasicExample"],"mappings":";AAEA,SAASA,SAAS,QAAQ,cAAc;AACxC,SAASC,YAAY,QAAQ,kBAAkB;AAE/C,OAAO,MAAMC,eAAmB,kBAAM,KAACF;kBAAW,kBAAM,KAACC;OAA6B"}
1
+ {"version":3,"sources":["../../src/demo/basic.tsx"],"sourcesContent":["import type { FC } from 'react';\n\nimport { Container } from './container';\nimport { BasicPreview } from './basic-preview';\n\nexport const BasicExample: FC = () => <Container>{() => <BasicPreview />}</Container>;\n"],"names":["Container","BasicPreview","BasicExample"],"mappings":";AAEA,SAASA,SAAS,QAAQ,cAAc;AACxC,SAASC,YAAY,QAAQ,kBAAkB;AAE/C,OAAO,MAAMC,eAAmB,kBAAM,KAACF;kBAAW,kBAAM,KAACC;OAA6B"}
@@ -1,6 +1,6 @@
1
- import { FC } from 'react';
2
- import { Notification } from '../api/notifications.api';
3
- import { NotificationsProps } from '..';
1
+ import type { FC } from 'react';
2
+ import type { Notification } from '../api/notifications.api';
3
+ import type { NotificationsProps } from '..';
4
4
  type EventCallback = (notification: Notification) => void;
5
5
  declare class Publisher {
6
6
  global_emitter: {
@@ -1 +1 @@
1
- {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/demo/container.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,EAAE,EAAE,MAAM,OAAO,CAAC;AAI/C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAGH,kBAAkB,EAErB,MAAM,IAAI,CAAC;AAEZ,KAAK,aAAa,GAAG,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;AAE1D,cAAM,SAAS;IAEX,cAAc;;;MAGZ;IAEF,OAAO,CAAC,YAAY,CAAC,CAAgB;IAErC,IAAI,GAAI,IAAI,MAAM,EAAE,UAAU,aAAa,UAEzC;IAEF,MAAM,aAAY;IAElB,IAAI,GAAI,cAAc,YAAY,UAIhC;CACL;AAYD,UAAU,cAAc;IACpB,UAAU,CAAC,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;IAC9C,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC;CAC/C;AAED,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CAkBxC,CAAC"}
1
+ {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/demo/container.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAKhC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,IAAI,CAAC;AAG7C,KAAK,aAAa,GAAG,CAAC,YAAY,EAAE,YAAY,KAAK,IAAI,CAAC;AAE1D,cAAM,SAAS;IAEX,cAAc;;;MAGZ;IAEF,OAAO,CAAC,YAAY,CAAC,CAAgB;IAErC,IAAI,GAAI,IAAI,MAAM,EAAE,UAAU,aAAa,UAEzC;IAEF,MAAM,aAAY;IAElB,IAAI,GAAI,cAAc,YAAY,UAIhC;CACL;AAYD,UAAU,cAAc;IACpB,UAAU,CAAC,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;IAC9C,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC;CAC/C;AAED,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CAkBxC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/demo/container.tsx"],"sourcesContent":["import { useEffect, useMemo, FC } from 'react';\n\nimport { Provider, useDependencies } from '@servicetitan/react-ioc';\n\nimport { Notification } from '../api/notifications.api';\nimport {\n NOTIFICATIONS_CHANNEL_TOKEN,\n Notifications,\n NotificationsProps,\n NotificationsService,\n} from '..';\n\ntype EventCallback = (notification: Notification) => void;\n\nclass Publisher {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n global_emitter = {\n bind: () => {},\n unbind: () => {},\n };\n\n private subscription?: EventCallback;\n\n bind = (_0: string, callback: EventCallback) => {\n this.subscription = callback;\n };\n\n unbind = () => {};\n\n fire = (notification: Notification) => {\n if (this.subscription) {\n this.subscription(notification);\n }\n };\n}\n\nconst NotificationsInitializer: FC = () => {\n const [notifications] = useDependencies(NotificationsService);\n\n useEffect(() => {\n notifications.initialize();\n }, [notifications]);\n\n return null;\n};\n\ninterface ContainerProps {\n apiService?: NotificationsProps['apiService'];\n children(publisher: Publisher): JSX.Element;\n}\n\nexport const Container: FC<ContainerProps> = ({ apiService, children }) => {\n const publisherInstance = useMemo(() => new Publisher(), []);\n\n return (\n <Provider\n singletons={[\n {\n provide: NOTIFICATIONS_CHANNEL_TOKEN,\n useValue: () => publisherInstance,\n },\n ]}\n >\n <Notifications apiService={apiService}>\n <NotificationsInitializer />\n {children(publisherInstance)}\n </Notifications>\n </Provider>\n );\n};\n"],"names":["useEffect","useMemo","Provider","useDependencies","NOTIFICATIONS_CHANNEL_TOKEN","Notifications","NotificationsService","Publisher","global_emitter","bind","unbind","subscription","_0","callback","fire","notification","NotificationsInitializer","notifications","initialize","Container","apiService","children","publisherInstance","singletons","provide","useValue"],"mappings":";;;;;;;;;;;;;;AAAA,SAASA,SAAS,EAAEC,OAAO,QAAY,QAAQ;AAE/C,SAASC,QAAQ,EAAEC,eAAe,QAAQ,0BAA0B;AAGpE,SACIC,2BAA2B,EAC3BC,aAAa,EAEbC,oBAAoB,QACjB,KAAK;AAIZ,MAAMC;;QACF,gEAAgE;QAChEC,uBAAAA,kBAAiB;YACbC,MAAM,KAAO;YACbC,QAAQ,KAAO;QACnB;QAEA,uBAAQC,gBAAR,KAAA;QAEAF,uBAAAA,QAAO,CAACG,IAAYC;YAChB,IAAI,CAACF,YAAY,GAAGE;QACxB;QAEAH,uBAAAA,UAAS,KAAO;QAEhBI,uBAAAA,QAAO,CAACC;YACJ,IAAI,IAAI,CAACJ,YAAY,EAAE;gBACnB,IAAI,CAACA,YAAY,CAACI;YACtB;QACJ;;AACJ;AAEA,MAAMC,2BAA+B;IACjC,MAAM,CAACC,cAAc,GAAGd,gBAAgBG;IAExCN,UAAU;QACNiB,cAAcC,UAAU;IAC5B,GAAG;QAACD;KAAc;IAElB,OAAO;AACX;AAOA,OAAO,MAAME,YAAgC,CAAC,EAAEC,UAAU,EAAEC,QAAQ,EAAE;IAClE,MAAMC,oBAAoBrB,QAAQ,IAAM,IAAIM,aAAa,EAAE;IAE3D,qBACI,KAACL;QACGqB,YAAY;YACR;gBACIC,SAASpB;gBACTqB,UAAU,IAAMH;YACpB;SACH;kBAED,cAAA,MAACjB;YAAce,YAAYA;;8BACvB,KAACJ;gBACAK,SAASC;;;;AAI1B,EAAE"}
1
+ {"version":3,"sources":["../../src/demo/container.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useEffect, useMemo } from 'react';\n\nimport { Provider, useDependencies } from '@servicetitan/react-ioc';\n\nimport type { Notification } from '../api/notifications.api';\nimport type { NotificationsProps } from '..';\nimport { NOTIFICATIONS_CHANNEL_TOKEN, Notifications, NotificationsService } from '..';\n\ntype EventCallback = (notification: Notification) => void;\n\nclass Publisher {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n global_emitter = {\n bind: () => {},\n unbind: () => {},\n };\n\n private subscription?: EventCallback;\n\n bind = (_0: string, callback: EventCallback) => {\n this.subscription = callback;\n };\n\n unbind = () => {};\n\n fire = (notification: Notification) => {\n if (this.subscription) {\n this.subscription(notification);\n }\n };\n}\n\nconst NotificationsInitializer: FC = () => {\n const [notifications] = useDependencies(NotificationsService);\n\n useEffect(() => {\n notifications.initialize();\n }, [notifications]);\n\n return null;\n};\n\ninterface ContainerProps {\n apiService?: NotificationsProps['apiService'];\n children(publisher: Publisher): JSX.Element;\n}\n\nexport const Container: FC<ContainerProps> = ({ apiService, children }) => {\n const publisherInstance = useMemo(() => new Publisher(), []);\n\n return (\n <Provider\n singletons={[\n {\n provide: NOTIFICATIONS_CHANNEL_TOKEN,\n useValue: () => publisherInstance,\n },\n ]}\n >\n <Notifications apiService={apiService}>\n <NotificationsInitializer />\n {children(publisherInstance)}\n </Notifications>\n </Provider>\n );\n};\n"],"names":["useEffect","useMemo","Provider","useDependencies","NOTIFICATIONS_CHANNEL_TOKEN","Notifications","NotificationsService","Publisher","global_emitter","bind","unbind","subscription","_0","callback","fire","notification","NotificationsInitializer","notifications","initialize","Container","apiService","children","publisherInstance","singletons","provide","useValue"],"mappings":";;;;;;;;;;;;;;AACA,SAASA,SAAS,EAAEC,OAAO,QAAQ,QAAQ;AAE3C,SAASC,QAAQ,EAAEC,eAAe,QAAQ,0BAA0B;AAIpE,SAASC,2BAA2B,EAAEC,aAAa,EAAEC,oBAAoB,QAAQ,KAAK;AAItF,MAAMC;;QACF,gEAAgE;QAChEC,uBAAAA,kBAAiB;YACbC,MAAM,KAAO;YACbC,QAAQ,KAAO;QACnB;QAEA,uBAAQC,gBAAR,KAAA;QAEAF,uBAAAA,QAAO,CAACG,IAAYC;YAChB,IAAI,CAACF,YAAY,GAAGE;QACxB;QAEAH,uBAAAA,UAAS,KAAO;QAEhBI,uBAAAA,QAAO,CAACC;YACJ,IAAI,IAAI,CAACJ,YAAY,EAAE;gBACnB,IAAI,CAACA,YAAY,CAACI;YACtB;QACJ;;AACJ;AAEA,MAAMC,2BAA+B;IACjC,MAAM,CAACC,cAAc,GAAGd,gBAAgBG;IAExCN,UAAU;QACNiB,cAAcC,UAAU;IAC5B,GAAG;QAACD;KAAc;IAElB,OAAO;AACX;AAOA,OAAO,MAAME,YAAgC,CAAC,EAAEC,UAAU,EAAEC,QAAQ,EAAE;IAClE,MAAMC,oBAAoBrB,QAAQ,IAAM,IAAIM,aAAa,EAAE;IAE3D,qBACI,KAACL;QACGqB,YAAY;YACR;gBACIC,SAASpB;gBACTqB,UAAU,IAAMH;YACpB;SACH;kBAED,cAAA,MAACjB;YAAce,YAAYA;;8BACvB,KAACJ;gBACAK,SAASC;;;;AAI1B,EAAE"}
@@ -1,3 +1,3 @@
1
- import { FC } from 'react';
1
+ import type { FC } from 'react';
2
2
  export declare const DurationPreview: FC;
3
3
  //# sourceMappingURL=duration-preview.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"duration-preview.d.ts","sourceRoot":"","sources":["../../src/demo/duration-preview.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAI3B,eAAO,MAAM,eAAe,EAAE,EAqB7B,CAAC"}
1
+ {"version":3,"file":"duration-preview.d.ts","sourceRoot":"","sources":["../../src/demo/duration-preview.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,eAAO,MAAM,eAAe,EAAE,EAqB7B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/demo/duration-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 DurationPreview: FC = () => {\n const [notifications] = useDependencies(NotificationsService);\n\n const handleOneSecondClick = () =>\n notifications.show({\n title: 'This message will be closed in 1 second.',\n duration: 1000,\n });\n\n const handleUnlimitedClick = () =>\n notifications.show({\n title: \"This message won't be closed automatically.\",\n duration: 0,\n });\n\n return (\n <Flex direction=\"row\" gap=\"2\">\n <Button onClick={handleOneSecondClick}>1 second</Button>\n <Button onClick={handleUnlimitedClick}>Unlimited</Button>\n </Flex>\n );\n};\n"],"names":["Button","Flex","useDependencies","NotificationsService","DurationPreview","notifications","handleOneSecondClick","show","title","duration","handleUnlimitedClick","direction","gap","onClick"],"mappings":";AAAA,SAASA,MAAM,EAAEC,IAAI,QAAQ,uBAAuB;AACpD,SAASC,eAAe,QAAQ,0BAA0B;AAG1D,SAASC,oBAAoB,QAAQ,KAAK;AAE1C,OAAO,MAAMC,kBAAsB;IAC/B,MAAM,CAACC,cAAc,GAAGH,gBAAgBC;IAExC,MAAMG,uBAAuB,IACzBD,cAAcE,IAAI,CAAC;YACfC,OAAO;YACPC,UAAU;QACd;IAEJ,MAAMC,uBAAuB,IACzBL,cAAcE,IAAI,CAAC;YACfC,OAAO;YACPC,UAAU;QACd;IAEJ,qBACI,MAACR;QAAKU,WAAU;QAAMC,KAAI;;0BACtB,KAACZ;gBAAOa,SAASP;0BAAsB;;0BACvC,KAACN;gBAAOa,SAASH;0BAAsB;;;;AAGnD,EAAE"}
1
+ {"version":3,"sources":["../../src/demo/duration-preview.tsx"],"sourcesContent":["import { Button, Flex } from '@servicetitan/anvil2';\nimport { useDependencies } from '@servicetitan/react-ioc';\nimport type { FC } from 'react';\n\nimport { NotificationsService } from '..';\n\nexport const DurationPreview: FC = () => {\n const [notifications] = useDependencies(NotificationsService);\n\n const handleOneSecondClick = () =>\n notifications.show({\n title: 'This message will be closed in 1 second.',\n duration: 1000,\n });\n\n const handleUnlimitedClick = () =>\n notifications.show({\n title: \"This message won't be closed automatically.\",\n duration: 0,\n });\n\n return (\n <Flex direction=\"row\" gap=\"2\">\n <Button onClick={handleOneSecondClick}>1 second</Button>\n <Button onClick={handleUnlimitedClick}>Unlimited</Button>\n </Flex>\n );\n};\n"],"names":["Button","Flex","useDependencies","NotificationsService","DurationPreview","notifications","handleOneSecondClick","show","title","duration","handleUnlimitedClick","direction","gap","onClick"],"mappings":";AAAA,SAASA,MAAM,EAAEC,IAAI,QAAQ,uBAAuB;AACpD,SAASC,eAAe,QAAQ,0BAA0B;AAG1D,SAASC,oBAAoB,QAAQ,KAAK;AAE1C,OAAO,MAAMC,kBAAsB;IAC/B,MAAM,CAACC,cAAc,GAAGH,gBAAgBC;IAExC,MAAMG,uBAAuB,IACzBD,cAAcE,IAAI,CAAC;YACfC,OAAO;YACPC,UAAU;QACd;IAEJ,MAAMC,uBAAuB,IACzBL,cAAcE,IAAI,CAAC;YACfC,OAAO;YACPC,UAAU;QACd;IAEJ,qBACI,MAACR;QAAKU,WAAU;QAAMC,KAAI;;0BACtB,KAACZ;gBAAOa,SAASP;0BAAsB;;0BACvC,KAACN;gBAAOa,SAASH;0BAAsB;;;;AAGnD,EAAE"}
@@ -1,3 +1,3 @@
1
- import { FC } from 'react';
1
+ import type { FC } from 'react';
2
2
  export declare const DurationExample: FC;
3
3
  //# sourceMappingURL=duration.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../../src/demo/duration.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAK3B,eAAO,MAAM,eAAe,EAAE,EAA6D,CAAC"}
1
+ {"version":3,"file":"duration.d.ts","sourceRoot":"","sources":["../../src/demo/duration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAKhC,eAAO,MAAM,eAAe,EAAE,EAA6D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/demo/duration.tsx"],"sourcesContent":["import { FC } from 'react';\n\nimport { Container } from './container';\nimport { DurationPreview } from './duration-preview';\n\nexport const DurationExample: FC = () => <Container>{() => <DurationPreview />}</Container>;\n"],"names":["Container","DurationPreview","DurationExample"],"mappings":";AAEA,SAASA,SAAS,QAAQ,cAAc;AACxC,SAASC,eAAe,QAAQ,qBAAqB;AAErD,OAAO,MAAMC,kBAAsB,kBAAM,KAACF;kBAAW,kBAAM,KAACC;OAAgC"}
1
+ {"version":3,"sources":["../../src/demo/duration.tsx"],"sourcesContent":["import type { FC } from 'react';\n\nimport { Container } from './container';\nimport { DurationPreview } from './duration-preview';\n\nexport const DurationExample: FC = () => <Container>{() => <DurationPreview />}</Container>;\n"],"names":["Container","DurationPreview","DurationExample"],"mappings":";AAEA,SAASA,SAAS,QAAQ,cAAc;AACxC,SAASC,eAAe,QAAQ,qBAAqB;AAErD,OAAO,MAAMC,kBAAsB,kBAAM,KAACF;kBAAW,kBAAM,KAACC;OAAgC"}
@@ -1,5 +1,6 @@
1
- import { AxiosPromise, CancelToken } from 'axios';
2
- import { Notification, NotificationsApi } from '../api/notifications.api';
1
+ import type { AxiosPromise, CancelToken } from 'axios';
2
+ import type { Notification } from '../api/notifications.api';
3
+ import { NotificationsApi } from '../api/notifications.api';
3
4
  export declare class MockNotificationsApi extends NotificationsApi {
4
5
  private readonly localStorageKey;
5
6
  add(notification: Notification): void;
@@ -1 +1 @@
1
- {"version":3,"file":"mock-notifications-api.d.ts","sourceRoot":"","sources":["../../src/demo/mock-notifications-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE1E,qBAAa,oBAAqB,SAAQ,gBAAgB;IACtD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAwC;IAExE,GAAG,CAAC,YAAY,EAAE,YAAY;IAI9B,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,WAAW,GAAG,YAAY,CAAC,YAAY,CAAC;IAInF,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,WAAW,GAAG,YAAY,CAAC,YAAY,EAAE,CAAC;IAI1F,oBAAoB,CAChB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,MAAM,EAChB,YAAY,CAAC,EAAE,WAAW,GAC3B,YAAY,CAAC,IAAI,CAAC;IAOrB,OAAO,KAAK,aAAa,GAIxB;IAED,OAAO,KAAK,aAAa,QAMxB;CACJ"}
1
+ {"version":3,"file":"mock-notifications-api.d.ts","sourceRoot":"","sources":["../../src/demo/mock-notifications-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,qBAAa,oBAAqB,SAAQ,gBAAgB;IACtD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAwC;IAExE,GAAG,CAAC,YAAY,EAAE,YAAY;IAI9B,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,WAAW,GAAG,YAAY,CAAC,YAAY,CAAC;IAInF,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,WAAW,GAAG,YAAY,CAAC,YAAY,EAAE,CAAC;IAI1F,oBAAoB,CAChB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,MAAM,EAChB,YAAY,CAAC,EAAE,WAAW,GAC3B,YAAY,CAAC,IAAI,CAAC;IAOrB,OAAO,KAAK,aAAa,GAIxB;IAED,OAAO,KAAK,aAAa,QAMxB;CACJ"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/demo/mock-notifications-api.ts"],"sourcesContent":["import { AxiosPromise, CancelToken } from 'axios';\nimport { Notification, NotificationsApi } from '../api/notifications.api';\n\nexport class MockNotificationsApi extends NotificationsApi {\n private readonly localStorageKey = 'MockNotificationsApi.notifications';\n\n add(notification: Notification) {\n this.notifications = [...this.notifications, notification];\n }\n\n getNotification(id: number, _cancelToken?: CancelToken): AxiosPromise<Notification> {\n return Promise.resolve({ data: this.notifications.find(el => el.id === id) } as any);\n }\n\n getNotifications(_read: boolean, _cancelToken?: CancelToken): AxiosPromise<Notification[]> {\n return Promise.resolve({ data: this.notifications } as any);\n }\n\n changeIsReadProperty(\n id: number,\n read: boolean,\n _version: number,\n _cancelToken?: CancelToken\n ): AxiosPromise<void> {\n if (read) {\n this.notifications = this.notifications.filter(el => el.id !== id);\n }\n return Promise.resolve({} as any);\n }\n\n private get notifications() {\n const value = localStorage.getItem(this.localStorageKey);\n const result: Notification[] = value ? JSON.parse(value) : [];\n return result;\n }\n\n private set notifications(notifications: Notification[]) {\n if (notifications.length) {\n localStorage.setItem(this.localStorageKey, JSON.stringify(notifications));\n } else {\n localStorage.removeItem(this.localStorageKey);\n }\n }\n}\n"],"names":["NotificationsApi","MockNotificationsApi","add","notification","notifications","getNotification","id","_cancelToken","Promise","resolve","data","find","el","getNotifications","_read","changeIsReadProperty","read","_version","filter","value","localStorage","getItem","localStorageKey","result","JSON","parse","length","setItem","stringify","removeItem"],"mappings":";;;;;;;;;;;;;AACA,SAAuBA,gBAAgB,QAAQ,2BAA2B;AAE1E,OAAO,MAAMC,6BAA6BD;IAGtCE,IAAIC,YAA0B,EAAE;QAC5B,IAAI,CAACC,aAAa,GAAG;eAAI,IAAI,CAACA,aAAa;YAAED;SAAa;IAC9D;IAEAE,gBAAgBC,EAAU,EAAEC,YAA0B,EAA8B;QAChF,OAAOC,QAAQC,OAAO,CAAC;YAAEC,MAAM,IAAI,CAACN,aAAa,CAACO,IAAI,CAACC,CAAAA,KAAMA,GAAGN,EAAE,KAAKA;QAAI;IAC/E;IAEAO,iBAAiBC,KAAc,EAAEP,YAA0B,EAAgC;QACvF,OAAOC,QAAQC,OAAO,CAAC;YAAEC,MAAM,IAAI,CAACN,aAAa;QAAC;IACtD;IAEAW,qBACIT,EAAU,EACVU,IAAa,EACbC,QAAgB,EAChBV,YAA0B,EACR;QAClB,IAAIS,MAAM;YACN,IAAI,CAACZ,aAAa,GAAG,IAAI,CAACA,aAAa,CAACc,MAAM,CAACN,CAAAA,KAAMA,GAAGN,EAAE,KAAKA;QACnE;QACA,OAAOE,QAAQC,OAAO,CAAC,CAAC;IAC5B;IAEA,IAAYL,gBAAgB;QACxB,MAAMe,QAAQC,aAAaC,OAAO,CAAC,IAAI,CAACC,eAAe;QACvD,MAAMC,SAAyBJ,QAAQK,KAAKC,KAAK,CAACN,SAAS,EAAE;QAC7D,OAAOI;IACX;IAEA,IAAYnB,cAAcA,aAA6B,EAAE;QACrD,IAAIA,cAAcsB,MAAM,EAAE;YACtBN,aAAaO,OAAO,CAAC,IAAI,CAACL,eAAe,EAAEE,KAAKI,SAAS,CAACxB;QAC9D,OAAO;YACHgB,aAAaS,UAAU,CAAC,IAAI,CAACP,eAAe;QAChD;IACJ;;QAvCG,gBACH,uBAAiBA,mBAAkB;;AAuCvC"}
1
+ {"version":3,"sources":["../../src/demo/mock-notifications-api.ts"],"sourcesContent":["import type { AxiosPromise, CancelToken } from 'axios';\nimport type { Notification } from '../api/notifications.api';\nimport { NotificationsApi } from '../api/notifications.api';\n\nexport class MockNotificationsApi extends NotificationsApi {\n private readonly localStorageKey = 'MockNotificationsApi.notifications';\n\n add(notification: Notification) {\n this.notifications = [...this.notifications, notification];\n }\n\n getNotification(id: number, _cancelToken?: CancelToken): AxiosPromise<Notification> {\n return Promise.resolve({ data: this.notifications.find(el => el.id === id) } as any);\n }\n\n getNotifications(_read: boolean, _cancelToken?: CancelToken): AxiosPromise<Notification[]> {\n return Promise.resolve({ data: this.notifications } as any);\n }\n\n changeIsReadProperty(\n id: number,\n read: boolean,\n _version: number,\n _cancelToken?: CancelToken\n ): AxiosPromise<void> {\n if (read) {\n this.notifications = this.notifications.filter(el => el.id !== id);\n }\n return Promise.resolve({} as any);\n }\n\n private get notifications() {\n const value = localStorage.getItem(this.localStorageKey);\n const result: Notification[] = value ? JSON.parse(value) : [];\n return result;\n }\n\n private set notifications(notifications: Notification[]) {\n if (notifications.length) {\n localStorage.setItem(this.localStorageKey, JSON.stringify(notifications));\n } else {\n localStorage.removeItem(this.localStorageKey);\n }\n }\n}\n"],"names":["NotificationsApi","MockNotificationsApi","add","notification","notifications","getNotification","id","_cancelToken","Promise","resolve","data","find","el","getNotifications","_read","changeIsReadProperty","read","_version","filter","value","localStorage","getItem","localStorageKey","result","JSON","parse","length","setItem","stringify","removeItem"],"mappings":";;;;;;;;;;;;;AAEA,SAASA,gBAAgB,QAAQ,2BAA2B;AAE5D,OAAO,MAAMC,6BAA6BD;IAGtCE,IAAIC,YAA0B,EAAE;QAC5B,IAAI,CAACC,aAAa,GAAG;eAAI,IAAI,CAACA,aAAa;YAAED;SAAa;IAC9D;IAEAE,gBAAgBC,EAAU,EAAEC,YAA0B,EAA8B;QAChF,OAAOC,QAAQC,OAAO,CAAC;YAAEC,MAAM,IAAI,CAACN,aAAa,CAACO,IAAI,CAACC,CAAAA,KAAMA,GAAGN,EAAE,KAAKA;QAAI;IAC/E;IAEAO,iBAAiBC,KAAc,EAAEP,YAA0B,EAAgC;QACvF,OAAOC,QAAQC,OAAO,CAAC;YAAEC,MAAM,IAAI,CAACN,aAAa;QAAC;IACtD;IAEAW,qBACIT,EAAU,EACVU,IAAa,EACbC,QAAgB,EAChBV,YAA0B,EACR;QAClB,IAAIS,MAAM;YACN,IAAI,CAACZ,aAAa,GAAG,IAAI,CAACA,aAAa,CAACc,MAAM,CAACN,CAAAA,KAAMA,GAAGN,EAAE,KAAKA;QACnE;QACA,OAAOE,QAAQC,OAAO,CAAC,CAAC;IAC5B;IAEA,IAAYL,gBAAgB;QACxB,MAAMe,QAAQC,aAAaC,OAAO,CAAC,IAAI,CAACC,eAAe;QACvD,MAAMC,SAAyBJ,QAAQK,KAAKC,KAAK,CAACN,SAAS,EAAE;QAC7D,OAAOI;IACX;IAEA,IAAYnB,cAAcA,aAA6B,EAAE;QACrD,IAAIA,cAAcsB,MAAM,EAAE;YACtBN,aAAaO,OAAO,CAAC,IAAI,CAACL,eAAe,EAAEE,KAAKI,SAAS,CAACxB;QAC9D,OAAO;YACHgB,aAAaS,UAAU,CAAC,IAAI,CAACP,eAAe;QAChD;IACJ;;QAvCG,gBACH,uBAAiBA,mBAAkB;;AAuCvC"}
@@ -1,3 +1,3 @@
1
- import { FC } from 'react';
1
+ import type { FC } from 'react';
2
2
  export declare const MultilineMessagePreview: FC;
3
3
  //# sourceMappingURL=multiline-message-preview.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"multiline-message-preview.d.ts","sourceRoot":"","sources":["../../src/demo/multiline-message-preview.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAI3B,eAAO,MAAM,uBAAuB,EAAE,EAUrC,CAAC"}
1
+ {"version":3,"file":"multiline-message-preview.d.ts","sourceRoot":"","sources":["../../src/demo/multiline-message-preview.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,eAAO,MAAM,uBAAuB,EAAE,EAUrC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/demo/multiline-message-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 MultilineMessagePreview: FC = () => {\n const [notifications] = useDependencies(NotificationsService);\n\n const handleClick = () =>\n notifications.show({\n title: 'Notification with multiline message',\n message: '1. First\\n2. Second\\n3. Third',\n });\n\n return <Button onClick={handleClick}>Show</Button>;\n};\n"],"names":["Button","useDependencies","NotificationsService","MultilineMessagePreview","notifications","handleClick","show","title","message","onClick"],"mappings":";AAAA,SAASA,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,eAAe,QAAQ,0BAA0B;AAG1D,SAASC,oBAAoB,QAAQ,KAAK;AAE1C,OAAO,MAAMC,0BAA8B;IACvC,MAAM,CAACC,cAAc,GAAGH,gBAAgBC;IAExC,MAAMG,cAAc,IAChBD,cAAcE,IAAI,CAAC;YACfC,OAAO;YACPC,SAAS;QACb;IAEJ,qBAAO,KAACR;QAAOS,SAASJ;kBAAa;;AACzC,EAAE"}
1
+ {"version":3,"sources":["../../src/demo/multiline-message-preview.tsx"],"sourcesContent":["import { Button } from '@servicetitan/anvil2';\nimport { useDependencies } from '@servicetitan/react-ioc';\nimport type { FC } from 'react';\n\nimport { NotificationsService } from '..';\n\nexport const MultilineMessagePreview: FC = () => {\n const [notifications] = useDependencies(NotificationsService);\n\n const handleClick = () =>\n notifications.show({\n title: 'Notification with multiline message',\n message: '1. First\\n2. Second\\n3. Third',\n });\n\n return <Button onClick={handleClick}>Show</Button>;\n};\n"],"names":["Button","useDependencies","NotificationsService","MultilineMessagePreview","notifications","handleClick","show","title","message","onClick"],"mappings":";AAAA,SAASA,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,eAAe,QAAQ,0BAA0B;AAG1D,SAASC,oBAAoB,QAAQ,KAAK;AAE1C,OAAO,MAAMC,0BAA8B;IACvC,MAAM,CAACC,cAAc,GAAGH,gBAAgBC;IAExC,MAAMG,cAAc,IAChBD,cAAcE,IAAI,CAAC;YACfC,OAAO;YACPC,SAAS;QACb;IAEJ,qBAAO,KAACR;QAAOS,SAASJ;kBAAa;;AACzC,EAAE"}
@@ -1,3 +1,3 @@
1
- import { FC } from 'react';
1
+ import type { FC } from 'react';
2
2
  export declare const MultilineMessageExample: FC;
3
3
  //# sourceMappingURL=multiline-message.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"multiline-message.d.ts","sourceRoot":"","sources":["../../src/demo/multiline-message.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAK3B,eAAO,MAAM,uBAAuB,EAAE,EAErC,CAAC"}
1
+ {"version":3,"file":"multiline-message.d.ts","sourceRoot":"","sources":["../../src/demo/multiline-message.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAKhC,eAAO,MAAM,uBAAuB,EAAE,EAErC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/demo/multiline-message.tsx"],"sourcesContent":["import { FC } from 'react';\n\nimport { Container } from './container';\nimport { MultilineMessagePreview } from './multiline-message-preview';\n\nexport const MultilineMessageExample: FC = () => (\n <Container>{() => <MultilineMessagePreview />}</Container>\n);\n"],"names":["Container","MultilineMessagePreview","MultilineMessageExample"],"mappings":";AAEA,SAASA,SAAS,QAAQ,cAAc;AACxC,SAASC,uBAAuB,QAAQ,8BAA8B;AAEtE,OAAO,MAAMC,0BAA8B,kBACvC,KAACF;kBAAW,kBAAM,KAACC;OACrB"}
1
+ {"version":3,"sources":["../../src/demo/multiline-message.tsx"],"sourcesContent":["import type { FC } from 'react';\n\nimport { Container } from './container';\nimport { MultilineMessagePreview } from './multiline-message-preview';\n\nexport const MultilineMessageExample: FC = () => (\n <Container>{() => <MultilineMessagePreview />}</Container>\n);\n"],"names":["Container","MultilineMessagePreview","MultilineMessageExample"],"mappings":";AAEA,SAASA,SAAS,QAAQ,cAAc;AACxC,SAASC,uBAAuB,QAAQ,8BAA8B;AAEtE,OAAO,MAAMC,0BAA8B,kBACvC,KAACF;kBAAW,kBAAM,KAACC;OACrB"}
@@ -1,3 +1,3 @@
1
- import { FC } from 'react';
1
+ import type { FC } from 'react';
2
2
  export declare const PreventDuplicatesPreview: FC;
3
3
  //# sourceMappingURL=prevent-duplicates-preview.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prevent-duplicates-preview.d.ts","sourceRoot":"","sources":["../../src/demo/prevent-duplicates-preview.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAI3B,eAAO,MAAM,wBAAwB,EAAE,EAYtC,CAAC"}
1
+ {"version":3,"file":"prevent-duplicates-preview.d.ts","sourceRoot":"","sources":["../../src/demo/prevent-duplicates-preview.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,eAAO,MAAM,wBAAwB,EAAE,EAYtC,CAAC"}
@@ -1 +1 @@
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
+ {"version":3,"sources":["../../src/demo/prevent-duplicates-preview.tsx"],"sourcesContent":["import { Button } from '@servicetitan/anvil2';\nimport { useDependencies } from '@servicetitan/react-ioc';\nimport type { 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,3 +1,3 @@
1
- import { FC } from 'react';
1
+ import type { FC } from 'react';
2
2
  export declare const PreventDuplicatesExample: FC;
3
3
  //# sourceMappingURL=prevent-duplicates.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prevent-duplicates.d.ts","sourceRoot":"","sources":["../../src/demo/prevent-duplicates.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAK3B,eAAO,MAAM,wBAAwB,EAAE,EAEtC,CAAC"}
1
+ {"version":3,"file":"prevent-duplicates.d.ts","sourceRoot":"","sources":["../../src/demo/prevent-duplicates.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAKhC,eAAO,MAAM,wBAAwB,EAAE,EAEtC,CAAC"}
@@ -1 +1 @@
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"}
1
+ {"version":3,"sources":["../../src/demo/prevent-duplicates.tsx"],"sourcesContent":["import type { 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"}
@@ -1,3 +1,3 @@
1
- import { FC } from 'react';
1
+ import type { FC } from 'react';
2
2
  export declare const ProgressPreview: FC;
3
3
  //# sourceMappingURL=progress-preview.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"progress-preview.d.ts","sourceRoot":"","sources":["../../src/demo/progress-preview.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAI3B,eAAO,MAAM,eAAe,EAAE,EAU7B,CAAC"}
1
+ {"version":3,"file":"progress-preview.d.ts","sourceRoot":"","sources":["../../src/demo/progress-preview.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,eAAO,MAAM,eAAe,EAAE,EAU7B,CAAC"}
@@ -1 +1 @@
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
+ {"version":3,"sources":["../../src/demo/progress-preview.tsx"],"sourcesContent":["import { Button } from '@servicetitan/anvil2';\nimport { useDependencies } from '@servicetitan/react-ioc';\nimport type { 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,3 +1,3 @@
1
- import { FC } from 'react';
1
+ import type { FC } from 'react';
2
2
  export declare const ProgressExample: FC;
3
3
  //# sourceMappingURL=progress.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/demo/progress.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAK3B,eAAO,MAAM,eAAe,EAAE,EAA6D,CAAC"}
1
+ {"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/demo/progress.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAKhC,eAAO,MAAM,eAAe,EAAE,EAA6D,CAAC"}
@@ -1 +1 @@
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
+ {"version":3,"sources":["../../src/demo/progress.tsx"],"sourcesContent":["import type { 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,3 +1,3 @@
1
- import { FC } from 'react';
1
+ import type { FC } from 'react';
2
2
  export declare const ServerCustomExample: FC;
3
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":"AACA,OAAO,EAAE,EAAE,EAAa,MAAM,OAAO,CAAC;AAMtC,eAAO,MAAM,mBAAmB,EAAE,EA6BjC,CAAC"}
1
+ {"version":3,"file":"server-custom.d.ts","sourceRoot":"","sources":["../../src/demo/server-custom.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAOhC,eAAO,MAAM,mBAAmB,EAAE,EA6BjC,CAAC"}
@@ -1 +1 @@
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"}
1
+ {"version":3,"sources":["../../src/demo/server-custom.tsx"],"sourcesContent":["import { Button } from '@servicetitan/anvil2';\nimport type { FC } from 'react';\nimport { 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;AAE9C,SAASC,SAAS,QAAQ,QAAQ;AAElC,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"}
@@ -1,3 +1,3 @@
1
- import { FC } from 'react';
1
+ import type { FC } from 'react';
2
2
  export declare const ServerDefaultExample: FC;
3
3
  //# sourceMappingURL=server-default.d.ts.map
@@ -1 +1 @@
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
+ {"version":3,"file":"server-default.d.ts","sourceRoot":"","sources":["../../src/demo/server-default.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAKhC,eAAO,MAAM,oBAAoB,EAAE,EA8ElC,CAAC"}
@@ -1 +1 @@
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"}
1
+ {"version":3,"sources":["../../src/demo/server-default.tsx"],"sourcesContent":["import { Button } from '@servicetitan/anvil2';\nimport type { 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"}
@@ -1,3 +1,3 @@
1
- import { FC } from 'react';
1
+ import type { FC } from 'react';
2
2
  export declare const ServerOnLoadExample: FC;
3
3
  //# sourceMappingURL=server-on-load.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server-on-load.d.ts","sourceRoot":"","sources":["../../src/demo/server-on-load.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAW,MAAM,OAAO,CAAC;AAuBpC,eAAO,MAAM,mBAAmB,EAAE,EA+DjC,CAAC"}
1
+ {"version":3,"file":"server-on-load.d.ts","sourceRoot":"","sources":["../../src/demo/server-on-load.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAsBhC,eAAO,MAAM,mBAAmB,EAAE,EA+DjC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/demo/server-on-load.tsx"],"sourcesContent":["import { Button, Flex } from '@servicetitan/anvil2';\nimport { FC, useMemo } from 'react';\n\nimport {\n DefaultServerNotificationPayload,\n NotificationProcessStatus,\n} from '../api/notifications.api';\nimport { Container } from './container';\nimport { MockNotificationsApi } from './mock-notifications-api';\nimport { LinkAction } from '../common';\n\nconst BASIC =\n \"This toast disappears automatically.\\n\\nIt won't reappear when the page is reloaded, unless the reload happens before the toast disappears.\";\nconst WITH_ACTION =\n 'This toast does not disappear automatically.\\n\\nUntil the user clicks the action or closes it, the toast reappears whenever the page is reloaded.';\nconst WITH_ACTION_AND_DURATION =\n \"This toast does not disappear automatically.\\n\\nHowever, it won't reappear when the page is reloaded, unless the reload happens before the toast duration expires.\";\n\nconst action: LinkAction = {\n label: 'Click me!',\n link: '/table-master-detail',\n external: true,\n};\n\nexport const ServerOnLoadExample: FC = () => {\n const api = useMemo(() => new MockNotificationsApi(), []);\n\n const handleAdd = (payload: DefaultServerNotificationPayload) => {\n const date = new Date();\n api.add({\n id: date.getTime(),\n userId: 0,\n type: 'PendingServerNotification',\n status: NotificationProcessStatus.Info,\n isRead: false,\n version: 1,\n createdOn: date,\n modifiedOn: date,\n payload: JSON.stringify(payload),\n });\n window.location.reload();\n };\n\n return (\n <Container apiService={MockNotificationsApi}>\n {() => (\n <Flex direction=\"column\" gap=\"4\">\n <Flex direction=\"row\" gap=\"2\">\n <Button\n onClick={() => {\n handleAdd({\n title: 'Server Notification',\n message: BASIC,\n });\n }}\n >\n Basic\n </Button>\n <Button\n onClick={() => {\n handleAdd({\n title: 'Server Notification (With Action)',\n message: WITH_ACTION,\n action,\n });\n }}\n >\n With Action\n </Button>\n <Button\n onClick={() => {\n handleAdd({\n title: 'Server Notification (With Action and Duration)',\n message: WITH_ACTION_AND_DURATION,\n action,\n duration: 8000,\n });\n }}\n >\n With Action and Duration\n </Button>\n </Flex>\n <Button onClick={() => window.location.reload()}>Reload Page</Button>\n </Flex>\n )}\n </Container>\n );\n};\n"],"names":["Button","Flex","useMemo","NotificationProcessStatus","Container","MockNotificationsApi","BASIC","WITH_ACTION","WITH_ACTION_AND_DURATION","action","label","link","external","ServerOnLoadExample","api","handleAdd","payload","date","Date","add","id","getTime","userId","type","status","Info","isRead","version","createdOn","modifiedOn","JSON","stringify","window","location","reload","apiService","direction","gap","onClick","title","message","duration"],"mappings":";AAAA,SAASA,MAAM,EAAEC,IAAI,QAAQ,uBAAuB;AACpD,SAAaC,OAAO,QAAQ,QAAQ;AAEpC,SAEIC,yBAAyB,QACtB,2BAA2B;AAClC,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,oBAAoB,QAAQ,2BAA2B;AAGhE,MAAMC,QACF;AACJ,MAAMC,cACF;AACJ,MAAMC,2BACF;AAEJ,MAAMC,SAAqB;IACvBC,OAAO;IACPC,MAAM;IACNC,UAAU;AACd;AAEA,OAAO,MAAMC,sBAA0B;IACnC,MAAMC,MAAMZ,QAAQ,IAAM,IAAIG,wBAAwB,EAAE;IAExD,MAAMU,YAAY,CAACC;QACf,MAAMC,OAAO,IAAIC;QACjBJ,IAAIK,GAAG,CAAC;YACJC,IAAIH,KAAKI,OAAO;YAChBC,QAAQ;YACRC,MAAM;YACNC,QAAQrB,0BAA0BsB,IAAI;YACtCC,QAAQ;YACRC,SAAS;YACTC,WAAWX;YACXY,YAAYZ;YACZD,SAASc,KAAKC,SAAS,CAACf;QAC5B;QACAgB,OAAOC,QAAQ,CAACC,MAAM;IAC1B;IAEA,qBACI,KAAC9B;QAAU+B,YAAY9B;kBAClB,kBACG,MAACJ;gBAAKmC,WAAU;gBAASC,KAAI;;kCACzB,MAACpC;wBAAKmC,WAAU;wBAAMC,KAAI;;0CACtB,KAACrC;gCACGsC,SAAS;oCACLvB,UAAU;wCACNwB,OAAO;wCACPC,SAASlC;oCACb;gCACJ;0CACH;;0CAGD,KAACN;gCACGsC,SAAS;oCACLvB,UAAU;wCACNwB,OAAO;wCACPC,SAASjC;wCACTE;oCACJ;gCACJ;0CACH;;0CAGD,KAACT;gCACGsC,SAAS;oCACLvB,UAAU;wCACNwB,OAAO;wCACPC,SAAShC;wCACTC;wCACAgC,UAAU;oCACd;gCACJ;0CACH;;;;kCAIL,KAACzC;wBAAOsC,SAAS,IAAMN,OAAOC,QAAQ,CAACC,MAAM;kCAAI;;;;;AAKrE,EAAE"}
1
+ {"version":3,"sources":["../../src/demo/server-on-load.tsx"],"sourcesContent":["import { Button, Flex } from '@servicetitan/anvil2';\nimport type { FC } from 'react';\nimport { useMemo } from 'react';\n\nimport type { DefaultServerNotificationPayload } from '../api/notifications.api';\nimport { NotificationProcessStatus } from '../api/notifications.api';\nimport { Container } from './container';\nimport { MockNotificationsApi } from './mock-notifications-api';\nimport type { LinkAction } from '../common';\n\nconst BASIC =\n \"This toast disappears automatically.\\n\\nIt won't reappear when the page is reloaded, unless the reload happens before the toast disappears.\";\nconst WITH_ACTION =\n 'This toast does not disappear automatically.\\n\\nUntil the user clicks the action or closes it, the toast reappears whenever the page is reloaded.';\nconst WITH_ACTION_AND_DURATION =\n \"This toast does not disappear automatically.\\n\\nHowever, it won't reappear when the page is reloaded, unless the reload happens before the toast duration expires.\";\n\nconst action: LinkAction = {\n label: 'Click me!',\n link: '/table-master-detail',\n external: true,\n};\n\nexport const ServerOnLoadExample: FC = () => {\n const api = useMemo(() => new MockNotificationsApi(), []);\n\n const handleAdd = (payload: DefaultServerNotificationPayload) => {\n const date = new Date();\n api.add({\n id: date.getTime(),\n userId: 0,\n type: 'PendingServerNotification',\n status: NotificationProcessStatus.Info,\n isRead: false,\n version: 1,\n createdOn: date,\n modifiedOn: date,\n payload: JSON.stringify(payload),\n });\n window.location.reload();\n };\n\n return (\n <Container apiService={MockNotificationsApi}>\n {() => (\n <Flex direction=\"column\" gap=\"4\">\n <Flex direction=\"row\" gap=\"2\">\n <Button\n onClick={() => {\n handleAdd({\n title: 'Server Notification',\n message: BASIC,\n });\n }}\n >\n Basic\n </Button>\n <Button\n onClick={() => {\n handleAdd({\n title: 'Server Notification (With Action)',\n message: WITH_ACTION,\n action,\n });\n }}\n >\n With Action\n </Button>\n <Button\n onClick={() => {\n handleAdd({\n title: 'Server Notification (With Action and Duration)',\n message: WITH_ACTION_AND_DURATION,\n action,\n duration: 8000,\n });\n }}\n >\n With Action and Duration\n </Button>\n </Flex>\n <Button onClick={() => window.location.reload()}>Reload Page</Button>\n </Flex>\n )}\n </Container>\n );\n};\n"],"names":["Button","Flex","useMemo","NotificationProcessStatus","Container","MockNotificationsApi","BASIC","WITH_ACTION","WITH_ACTION_AND_DURATION","action","label","link","external","ServerOnLoadExample","api","handleAdd","payload","date","Date","add","id","getTime","userId","type","status","Info","isRead","version","createdOn","modifiedOn","JSON","stringify","window","location","reload","apiService","direction","gap","onClick","title","message","duration"],"mappings":";AAAA,SAASA,MAAM,EAAEC,IAAI,QAAQ,uBAAuB;AAEpD,SAASC,OAAO,QAAQ,QAAQ;AAGhC,SAASC,yBAAyB,QAAQ,2BAA2B;AACrE,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,oBAAoB,QAAQ,2BAA2B;AAGhE,MAAMC,QACF;AACJ,MAAMC,cACF;AACJ,MAAMC,2BACF;AAEJ,MAAMC,SAAqB;IACvBC,OAAO;IACPC,MAAM;IACNC,UAAU;AACd;AAEA,OAAO,MAAMC,sBAA0B;IACnC,MAAMC,MAAMZ,QAAQ,IAAM,IAAIG,wBAAwB,EAAE;IAExD,MAAMU,YAAY,CAACC;QACf,MAAMC,OAAO,IAAIC;QACjBJ,IAAIK,GAAG,CAAC;YACJC,IAAIH,KAAKI,OAAO;YAChBC,QAAQ;YACRC,MAAM;YACNC,QAAQrB,0BAA0BsB,IAAI;YACtCC,QAAQ;YACRC,SAAS;YACTC,WAAWX;YACXY,YAAYZ;YACZD,SAASc,KAAKC,SAAS,CAACf;QAC5B;QACAgB,OAAOC,QAAQ,CAACC,MAAM;IAC1B;IAEA,qBACI,KAAC9B;QAAU+B,YAAY9B;kBAClB,kBACG,MAACJ;gBAAKmC,WAAU;gBAASC,KAAI;;kCACzB,MAACpC;wBAAKmC,WAAU;wBAAMC,KAAI;;0CACtB,KAACrC;gCACGsC,SAAS;oCACLvB,UAAU;wCACNwB,OAAO;wCACPC,SAASlC;oCACb;gCACJ;0CACH;;0CAGD,KAACN;gCACGsC,SAAS;oCACLvB,UAAU;wCACNwB,OAAO;wCACPC,SAASjC;wCACTE;oCACJ;gCACJ;0CACH;;0CAGD,KAACT;gCACGsC,SAAS;oCACLvB,UAAU;wCACNwB,OAAO;wCACPC,SAAShC;wCACTC;wCACAgC,UAAU;oCACd;gCACJ;0CACH;;;;kCAIL,KAACzC;wBAAOsC,SAAS,IAAMN,OAAOC,QAAQ,CAACC,MAAM;kCAAI;;;;;AAKrE,EAAE"}
@@ -1,3 +1,3 @@
1
- import { FC } from 'react';
1
+ import type { FC } from 'react';
2
2
  export declare const StatusVariationsPreview: FC;
3
3
  //# sourceMappingURL=status-variations-preview.d.ts.map
@@ -1 +1 @@
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
+ {"version":3,"file":"status-variations-preview.d.ts","sourceRoot":"","sources":["../../src/demo/status-variations-preview.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,eAAO,MAAM,uBAAuB,EAAE,EA+BrC,CAAC"}
@@ -1 +1 @@
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
+ {"version":3,"sources":["../../src/demo/status-variations-preview.tsx"],"sourcesContent":["import { Button, Flex } from '@servicetitan/anvil2';\nimport { useDependencies } from '@servicetitan/react-ioc';\nimport type { 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"}