@wisemen/wise-crm-web 2.0.0-alpha.40 → 2.0.0-alpha.42
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 +63 -1
- package/dist/{BusinessDetailView-CzYmbWDI.js → BusinessDetailView-DCLbk1zs.js} +2 -2
- package/dist/{CrmDetailView.vue_vue_type_script_setup_true_lang-Cnn_HfDr.js → CrmDetailView.vue_vue_type_script_setup_true_lang-hKRJ0iTD.js} +1 -1
- package/dist/{DealCommunicationTabView-DJ3O_RbV.js → DealCommunicationTabView-DLpKFEzi.js} +1 -1
- package/dist/{DealDetailView-DC4_nsQh.js → DealDetailView-fnpBvgUj.js} +499 -478
- package/dist/{IndividualDetailView-B7tg3Zc7.js → IndividualDetailView-4OENIyX3.js} +2 -2
- package/dist/{index-BM5Kw4_U.js → index-D0Wq9rrv.js} +2519 -2421
- package/dist/index.d.ts +67 -9
- package/dist/index.js +6 -6
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Vue 3 CRM package: business, individual and deal overviews, detail views, dialog
|
|
|
4
4
|
|
|
5
5
|
## Extending the detail views
|
|
6
6
|
|
|
7
|
-
The
|
|
7
|
+
The detail views can be extended with content from the host app in three places.
|
|
8
8
|
|
|
9
9
|
### Custom tabs
|
|
10
10
|
|
|
@@ -88,3 +88,65 @@ Individual sections receive `individualUuid: WiseCrmIndividualUuid` instead. A c
|
|
|
88
88
|
```
|
|
89
89
|
|
|
90
90
|
A section that becomes visible after the sidebar has mounted still opens by default.
|
|
91
|
+
|
|
92
|
+
### Custom header badges
|
|
93
|
+
|
|
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()`:
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
useWiseCrmConfig().init({
|
|
98
|
+
// ...
|
|
99
|
+
options: {
|
|
100
|
+
business: {
|
|
101
|
+
headerBadges: [
|
|
102
|
+
{
|
|
103
|
+
key: 'open-invoices',
|
|
104
|
+
color: 'warning',
|
|
105
|
+
icon: FileAttachment01Icon,
|
|
106
|
+
getData: async ({ uuid }) => {
|
|
107
|
+
const count = await InvoiceService.getOpenCountForBusiness(uuid)
|
|
108
|
+
|
|
109
|
+
return count > 0 ? t('crm.business.badges.open_invoices', { count }) : null
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
deals: {
|
|
115
|
+
// ...
|
|
116
|
+
headerBadges: [...],
|
|
117
|
+
},
|
|
118
|
+
individual: {
|
|
119
|
+
headerBadges: [...],
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
})
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
| Field | Description |
|
|
126
|
+
| ------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
|
|
127
|
+
| `key` | Unique per entity; used to cache the badge's data. |
|
|
128
|
+
| `getData` | Receives `{ uuid }` and resolves to the badge label, or to `{ label, color?, variant?, icon?, dot? }` when the style depends on the data. Resolve to `null` or an empty label to hide the badge. |
|
|
129
|
+
| `color`, `variant`, `icon`, `dot` | Optional, passed to `UIBadge`. Defaults match the built-in badges (`gray`, `translucent`). |
|
|
130
|
+
|
|
131
|
+
Styles returned from `getData` override the ones on the badge, for example to color a score by its value:
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
{
|
|
135
|
+
key: 'credit-score',
|
|
136
|
+
getData: async ({ uuid }) => {
|
|
137
|
+
const { score, isHealthy } = await CreditService.getForBusiness(uuid)
|
|
138
|
+
|
|
139
|
+
return {
|
|
140
|
+
label: t('crm.business.badges.credit_score', { score }),
|
|
141
|
+
color: isHealthy ? 'success' : 'error',
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Type the arrays with `WiseCrmBusinessHeaderBadge`, `WiseCrmIndividualHeaderBadge` or `WiseCrmDealHeaderBadge`; `uuid` is then a `WiseCrmBusinessUuid`, `WiseCrmIndividualUuid` or `WiseCrmDealUuid`.
|
|
148
|
+
|
|
149
|
+
- The label is rendered as is, so translate it in `getData`. Badges refetch when the locale changes. Long labels are truncated with a tooltip.
|
|
150
|
+
- A skeleton is shown while `getData` is pending.
|
|
151
|
+
- When `getData` throws, the badge is hidden and the error is logged; it is not retried.
|
|
152
|
+
- Badges are not refetched when the entity is edited in the CRM, since the host app's data usually only follows through an event. To refresh them, for example on a websocket event, invalidate the `wiseCrmHeaderBadge` query key.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineComponent as n, openBlock as o, createBlock as r, unref as s, withCtx as a, createVNode as u } from "vue";
|
|
2
2
|
import { useRouteParams as m } from "@vueuse/router";
|
|
3
|
-
import { _ as p } from "./index-
|
|
3
|
+
import { _ as p } from "./index-D0Wq9rrv.js";
|
|
4
4
|
import { br as c } from "./uuid.util-SYJY4Bt5.js";
|
|
5
|
-
import { _ } from "./CrmDetailView.vue_vue_type_script_setup_true_lang-
|
|
5
|
+
import { _ } from "./CrmDetailView.vue_vue_type_script_setup_true_lang-hKRJ0iTD.js";
|
|
6
6
|
const x = /* @__PURE__ */ n({
|
|
7
7
|
__name: "BusinessDetailView",
|
|
8
8
|
props: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as v, ref as h, unref as e, openBlock as d, createElementBlock as u, createElementVNode as t, renderSlot as x, createVNode as r, withCtx as f, Fragment as y, renderList as g, createBlock as w, toValue as m, createCommentVNode as b } from "vue";
|
|
2
2
|
import { onKeyStroke as C } from "@vueuse/core";
|
|
3
3
|
import { UITabsRouterLink as k, UITabsRouterLinkItem as R, UIIconButton as B } from "@wisemen/vue-core-design-system";
|
|
4
|
-
import { h as E, j as I, $ as T,
|
|
4
|
+
import { h as E, j as I, $ as T, ad as V } from "./index-D0Wq9rrv.js";
|
|
5
5
|
import { useRoute as $, RouterView as j } from "vue-router";
|
|
6
6
|
class A {
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent as y, openBlock as t, createElementBlock as _, createElementVNode as s, createBlock as o, resolveDynamicComponent as x, unref as e, toDisplayString as p, createVNode as r, withCtx as n, createCommentVNode as f, Fragment as b, renderList as w, normalizeClass as k, computed as I } from "vue";
|
|
2
2
|
import { useRouteParams as U } from "@vueuse/router";
|
|
3
3
|
import { useOffsetInfiniteQuery as M } from "@wisemen/vue-core-api-utils";
|
|
4
|
-
import { M as z, u as E, a as L, T as j, b as B, W as F, F as T, c as S, D as h, g as A, d as D, m as N, e as V, A as H } from "./index-
|
|
4
|
+
import { M as z, u as E, a as L, T as j, b as B, W as F, F as T, c as S, D as h, g as A, d as D, m as N, e as V, A as H } from "./index-D0Wq9rrv.js";
|
|
5
5
|
import { UIIconButton as Q, UIEmptyState as q, UIBadge as P } from "@wisemen/vue-core-design-system";
|
|
6
6
|
import { AnimatePresence as W, Motion as O } from "motion-v";
|
|
7
7
|
import { AccordionRoot as R, AccordionItem as G, AccordionHeader as J, AccordionTrigger as K, AccordionContent as X } from "reka-ui";
|