@servicetitan/docs-anvil-uikit-contrib 28.5.1 → 29.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,13 +22,13 @@ import { CodeDemo, DemoCodeBlock } from '@site/src/components/code-demo';
22
22
 
23
23
  There're a lot of cases when a user should be notified in the result of various events. It could be from a simple one-time notification about the result of the network request to informing about the state of a complex long-running process launched on the worker.
24
24
 
25
- Notification Center was created to simplify and generalize everything related to user notifications. It provides few touchpoints: `NotificationCenter` to send various notification types from the backend, `NotificationsService` to show messages on the frontend, and `register` function to configure rendering of notifications arrived from the backend.
25
+ Notification Center was created to simplify and generalize everything related to user notifications. It provides few touchpoints: `NotificationCenter` to send various notification types from the backend, `NotificationsService` to show messages on the frontend, and `intercept` function to pre-process notifications received from the backend.
26
26
 
27
27
  ## Examples
28
28
 
29
29
  ### Client-side notifications
30
30
 
31
- To initiate notifications from the client side it's enough to call one of the `NotificationsService` methods. They accept `options` - a configuration of the visible part of notification which should cover most of the use cases and `preventDuplicates` flag used to avoid rendering of notifications that are already visible to a user.
31
+ To initiate notifications from the client side it's enough to call one of the `NotificationsService` methods. They accept `options` - a configuration of the visible part of notification which should cover most of the use cases and `preventDuplicates` flag used to avoid rerendering a notification that is already visible.
32
32
 
33
33
  #### Basic
34
34
 
@@ -146,9 +146,7 @@ export const defaultServerCode = `
146
146
 
147
147
  #### Custom notification component
148
148
 
149
- But if you need to show something more specific, then you can create a custom notification type and register renderer for it, which should determine what would be shown to a user depending on a notification status.
150
-
151
- **_It's required to register all your custom renderers in the `custom-notifications.ts` file on the module level, which should be imported in your module file._**
149
+ But if you need to show something more specific, then you can create a custom notification type and [intercept](#intercept) it, which should determine what would be shown to the user.
152
150
 
153
151
  export const customServerCode = `
154
152
  public class CustomPayload : INotificationPayload
@@ -162,7 +160,7 @@ export const customServerCode = `
162
160
  "CustomServerNotification",
163
161
  initialPayload: new CustomPayload {
164
162
  Username = "Jane",
165
- Message = "Hello, your order completed."
163
+ Message = "Your order is completed."
166
164
  }
167
165
  );
168
166
  `
@@ -303,17 +301,21 @@ interface FunctionAction {
303
301
  }
304
302
  ```
305
303
 
306
- ### register
304
+ ### intercept
307
305
 
308
- ```ts
309
- register(type: string, mapper: NotificationMapper): void;
306
+ Use `intercept` to suppress or transform a server-side notification.
310
307
 
311
- type NotificationMapper = React.ComponentType<{
312
- notification: Notification;
313
- onClose(): void;
314
- }>;
308
+ ```ts
309
+ intercept(type: string, fn?: NotificationInterceptor): void;
315
310
  ```
316
311
 
312
+ #### Parameters
313
+
314
+ | Name | Type | Description |
315
+ | :----- | :------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
316
+ | `type` | `string` | The notification to intercept. |
317
+ | `fn` | `(notification: Notification, dismiss: () => void) => Notification` | Function that transforms or suppresses the notification. It is passed the notification and a callback you can save and use later to dismiss the notification.<br/><br/>To transform a notification, return a new `Notification` object that replaces the original. To suppress it, return `undefined`. To stop intercepting, set this argument to `undefined`. |
318
+
317
319
  ## FAQ
318
320
 
319
321
  ### What is the delivery logic, what happens if user has several windows open?
@@ -326,4 +328,4 @@ Unclosed notifications will be shown again on application reopen.
326
328
 
327
329
  ### How will be displayed a large number of notifications?
328
330
 
329
- Only 5 notifications will be shown at a time, the rest will appear after displayed ones closing.
331
+ Only a few notifications are shown at a time. The remainder are revealed when the user closes visible ones.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/docs-anvil-uikit-contrib",
3
- "version": "28.5.1",
3
+ "version": "29.0.0",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,5 +16,5 @@
16
16
  "cli": {
17
17
  "webpack": false
18
18
  },
19
- "gitHead": "1820e5b017bb456161b9342d57a7a48efb362ccb"
19
+ "gitHead": "a7bd8d2fe17dbd2ee6499c8623cc777a6abd4dcc"
20
20
  }