customer-module-frontend 2.6.7-beta.2 → 2.7.0-beta.1

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
@@ -1,3 +1,63 @@
1
+ # customer-module-frontend
2
+
3
+ The Hiver customer module (contacts, accounts, conversations) as an embeddable
4
+ React library, published to npm and mounted by a host application.
5
+
6
+ ## Integrating with a host
7
+
8
+ The library renders against the host's own API surface. Two optional fields on
9
+ the mount config decide how.
10
+
11
+ **Additive only.** Both fields are optional, and with both absent every code
12
+ path is the one that shipped in `2.6.2` — Omni hosts require no action.
13
+
14
+ ### `CustomerModuleConfig.platform?: 'GMAIL' | 'HIVERWEB'`
15
+
16
+ Absent (as `outlook-ui` supplies it) keeps the existing behaviour. `'GMAIL'`
17
+ opts the response interceptor into the envelope normaliser, because the proxied
18
+ API returns a bare page body where the library expects
19
+ `{ status, message, data }`.
20
+
21
+ The discriminator is read per response, never cached on the shared `apiClient`
22
+ singleton, so one page can hold a GMAIL config and a HIVERWEB config without
23
+ either leaking into the other.
24
+
25
+ ### `CustomerModuleCallbacks.cmApiCallback?: HostTransport`
26
+
27
+ When supplied it is installed as the axios adapter, and the host owns the wire:
28
+ base URL, auth headers, credentials, CSRF. The library forwards only what it
29
+ owns — the path, the params, the body, and the two per-request options
30
+ (`responseType`, `paramsSerializer`) that silently change behaviour when a
31
+ transport drops them.
32
+
33
+ Omit it and the library issues the request itself, unchanged.
34
+
35
+ A transport is expected to resolve with an axios-shaped response carrying the
36
+ real HTTP `status` — including for failures. The adapter applies
37
+ `validateStatus` itself, so a relayed `401`/`422`/`5xx` rejects the request and
38
+ reaches the library's error handling. A transport that rejects natively is
39
+ re-wrapped as an `AxiosError` so its status survives.
40
+
41
+ Any existing `ApiCallback` satisfies `HostTransport`.
42
+
43
+ ### Bundled dependencies
44
+
45
+ `react-router-dom` is bundled rather than declared external, so consumers do not
46
+ have to provide it. The library mounts its own `<MemoryRouter>` and never reads
47
+ a host Router context.
48
+
49
+ ## Development
50
+
51
+ ```bash
52
+ yarn install
53
+ yarn dev # vite dev server
54
+ yarn build # tsc -b && vite build
55
+ yarn test # vitest run
56
+ yarn lint # eslint .
57
+ ```
58
+
59
+ ---
60
+
1
61
  # React + TypeScript + Vite
2
62
 
3
63
  This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.