@wisemen/wise-crm-web 2.0.0-alpha.43 → 2.0.0-alpha.45

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.
package/README.md CHANGED
@@ -2,6 +2,30 @@
2
2
 
3
3
  Vue 3 CRM package: business, individual and deal overviews, detail views, dialogs and widgets.
4
4
 
5
+ ## Tenant config
6
+
7
+ Everything in the CRM depends on the tenant config, fetched by `useWiseCrmConfig().init()`. When that call fails, only the CRM is unavailable: the rest of the host app keeps working.
8
+
9
+ - **Retries:** network errors, 5xx and gateway pages are retried 3 times (after 1s, 2s and 4s). A 4xx fails straight away.
10
+ - **Guarded components:** every exported component and dialog shows its own loading state, and an error state with a "Try again" button when the config is unavailable. A successful retry updates all of them at once.
11
+ - **Don't gate the host app on the CRM:** render your `RouterView` without waiting for the config.
12
+ - **Reporting:** pass `onError` to forward failures to your own logging. `init()` never rejects.
13
+
14
+ ```ts
15
+ const wiseCrm = useWiseCrmConfig()
16
+
17
+ wiseCrm.init({
18
+ // ...
19
+ onError: (error) => telemetry.recordException(error),
20
+ })
21
+
22
+ wiseCrm.status.value // 'loading' | 'ready' | 'error'
23
+ wiseCrm.error.value // the last fetch error, or null
24
+ wiseCrm.retry() // fetch the config once more
25
+ ```
26
+
27
+ Outside the guarded components, `getConfig()` throws until `status` is `'ready'`. Check `status` first, in a computed so it updates once the config arrives. `useWiseCrm().getEntityConfig()` returns `null` until then.
28
+
5
29
  ## Extending the detail views
6
30
 
7
31
  The detail views can be extended with content from the host app in three places.
@@ -29,7 +53,7 @@ useWiseCrmRoutes({
29
53
 
30
54
  ### Custom sidebar sections
31
55
 
32
- Accordion sections rendered at the end of the sidebar's Overview tab, after the built-in sections. They show in both the detail view and the quick-view dialog. Register them through the `business` / `individual` options of `useWiseCrmConfig().init()`:
56
+ Accordion sections rendered at the end of the sidebar's Overview tab, after the built-in sections. Register them through the `business` / `individual` options of `useWiseCrmConfig().init()`:
33
57
 
34
58
  ```ts
35
59
  import type { WiseCrmSidebarSection } from '@wisemen/wise-crm-web'
@@ -91,7 +115,7 @@ A section that becomes visible after the sidebar has mounted still opens by defa
91
115
 
92
116
  ### Custom header badges
93
117
 
94
- Badges rendered in the header of the business, individual and deal sidebars. Business and individual badges follow the built-in entity badge; deal badges get their own row below the deal number and client. They show in both the detail view and the quick-view dialog. Register them through `headerBadges` on the `business` / `individual` / `deals` options of `useWiseCrmConfig().init()`:
118
+ Badges rendered in the header of the business, individual and deal sidebars. Business and individual badges follow the built-in entity badge; deal badges get their own row below the deal number and client. Register them through `headerBadges` on the `business` / `individual` / `deals` options of `useWiseCrmConfig().init()`:
95
119
 
96
120
  ```ts
97
121
  useWiseCrmConfig().init({