@servicetitan/docs-uikit 36.3.1 → 36.4.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.
@@ -46,7 +46,7 @@ This breaking change affects local development, even if you do not update the `@
46
46
 
47
47
  Removed support for hard-coded npm tokens in `.npmrc` files. The new `startup install` removes hard-coded authentication tokens from project `.npmrc` files and, in development environments, automatically adds a token to npm's per-user configuration that grants access to ServiceTitan's private packages.
48
48
 
49
- Projects that previously relied on hard-coded tokens must update their Github and Teamcity workflows to instead use the organization secret as described in the [startup install documentation](./startup/install#configuring-npm-token-in-ci):
49
+ Projects that previously relied on hard-coded tokens must update their Github and Teamcity workflows to instead use the organization secret as described in the [startup install documentation](./install#configuring-npm-token-in-ci):
50
50
 
51
51
  - Option 1: Inject the organization secret into `.npmrc`.
52
52
  - Option 2: Configure `.npmrc` to get the organization secret from an environment variable.
@@ -87,7 +87,8 @@ Shared uikit skills for ServiceTitan repos.
87
87
 
88
88
  #### Skills
89
89
 
90
- | Name | Description |
91
- | :------------------ | :------------------------------------------------------------------------------------------------------- |
92
- | `spell-check` | Check for spelling errors in code changes |
93
- | `switching-to-pnpm` | Migrate a project from npm to pnpm (see [migration guide](/docs/frontend/switching-to-pnpm)) |
90
+ | Name | Description |
91
+ | :---------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------ |
92
+ | `spell-check` | Check for spelling errors in code changes |
93
+ | `switching-to-pnpm` | Migrate a project from npm to pnpm (see [migration guide](/docs/frontend/switching-to-pnpm)) |
94
+ | `updating-mfe-check-workflow` | Diagnose and fix `mfe-check-shared-dependencies` workflow failures after the FAR-1776 reusable-workflow rewrite (validates each `mfe-path`/`host-path`) |
@@ -2,37 +2,71 @@
2
2
  title: DataDog RUM
3
3
  ---
4
4
 
5
+ import Tabs from '@theme/Tabs';
6
+ import TabItem from '@theme/TabItem';
7
+
5
8
  #### [CHANGELOG (@servicetitan/datadog-rum)](https://github.com/servicetitan/uikit/blob/master/packages/datadog-rum/CHANGELOG.md)
6
9
 
7
- [`@servicetitan/datadog-rum`](https://github.com/servicetitan/uikit/tree/master/packages/datadog-rum) helps configure DataDog RUM JS SDK in standalone applications. It enriches RUM events with information useful for application and MFE monitoring, and troubleshooting.
10
+ [`@servicetitan/datadog-rum`](https://github.com/servicetitan/uikit/tree/master/packages/datadog-rum) configures DataDog RUM JS SDK and enriches its events for application and MFE monitoring and troubleshooting. It supports standalone applications and hosts that share a single RUM session with the MFEs they load.
8
11
 
9
- ## Configuration snippet
12
+ When a host loads MFEs (for example, the Monolith loading Task Hub), each MFE can register its own enrichment, tracing URLs, and persistent context through `init`. This avoids the failure mode where calling `datadogRum.init()` from more than one place would leak duplicate sessions and silently drop the second call's setup.
10
13
 
11
- ```tsx
12
- import { beforeSend, DatadogProvider } from '@servicetitan/datadog-rum';
13
- import { datadogRum } from '@datadog/browser-rum';
14
+ RUM events go through three enrichment stages: built-in attribution (MFE name, version, Cloudflare Ray ID), application-level handler, and per-service handlers.
14
15
 
15
- const isEnabled = /.*go\d*\.servicetitan\.com/.test(window.location.hostname);
16
+ ## End-to-end example
17
+
18
+ <Tabs
19
+ defaultValue="host"
20
+ values={[
21
+ { label: 'Host', value: 'host' },
22
+ { label: 'MFE', value: 'mfe' },
23
+ ]}
24
+ >
25
+ <TabItem value="host">
26
+
27
+ ```ts title="datadog-entry.ts"
28
+ import { init, type RumServiceRegistration } from '@servicetitan/datadog-rum';
29
+
30
+ export const isEnabled = /.*go\d*\.servicetitan\.com/.test(window.location.hostname);
31
+
32
+ let desktopRegistration: RumServiceRegistration | undefined;
16
33
 
17
34
  if (isEnabled) {
18
- datadogRum.init({
19
- applicationId: '<APPLICATION_ID>',
20
- clientToken: '<CLIENT_TOKEN>',
21
- site: 'datadoghq.com',
22
- service: '<SERVICE_NAME>',
23
- env: '<ENV_NAME>',
24
- version: '<APPLICATION_VERSION>',
25
- sessionSampleRate: 100,
26
- sessionReplaySampleRate: 0,
27
- defaultPrivacyLevel: 'mask-user-input',
28
- beforeSend: beforeSend(),
35
+ desktopRegistration = init({
36
+ service: {
37
+ name: 'desktop',
38
+ beforeSend: event => {
39
+ // enrich with 'desktop' service-specific context
40
+ },
41
+ },
42
+ application: {
43
+ applicationId: '<APPLICATION_ID>',
44
+ clientToken: '<CLIENT_TOKEN>',
45
+ env: window.location.hostname,
46
+ version: '<APPLICATION_VERSION>',
47
+ // Host-wide noise suppression. Locked at init, applies app-wide.
48
+ excludedActivityUrls: [/fullstory\.com/, /pendo\.io/, /\/Log\/Send/],
49
+ beforeSend: event => {
50
+ // optional: drop or transform events application-wide
51
+ return true;
52
+ },
53
+ },
29
54
  });
55
+
56
+ // Attach session-lifetime context to every 'desktop'-tagged event
57
+ desktopRegistration.setServiceContext({ logicalEnvironment: 'go5' });
30
58
  }
59
+ ```
60
+
61
+ ```tsx title="root.tsx"
62
+ import { DatadogProvider } from '@servicetitan/datadog-rum';
63
+ import { isEnabled } from './datadog-entry';
31
64
 
32
65
  const Root = () => {
33
66
  const user = useCurrentUser(); // application-specific hook that identifies the user
34
67
 
35
68
  return (
69
+ // Identify the current user to Datadog RUM
36
70
  <DatadogProvider isEnabled={isEnabled} user={user}>
37
71
  <Application />
38
72
  </DatadogProvider>
@@ -40,21 +74,227 @@ const Root = () => {
40
74
  };
41
75
  ```
42
76
 
43
- ## DatadogProvider
77
+ </TabItem>
78
+ <TabItem value="mfe">
44
79
 
45
- `DatadogProvider` is a higher-order component that supplies RUM SDK with:
80
+ ```tsx title="task-hub.tsx"
81
+ import { useEffect } from 'react';
82
+ import { useRumService } from '@servicetitan/datadog-rum';
83
+
84
+ const BFF_PATTERNS = [/\/api\/task-hub\//, /\/bff\//];
85
+
86
+ export const TaskHub = () => {
87
+ // Registers on mount; disposes automatically on unmount.
88
+ const { setServiceContext } = useRumService({
89
+ name: 'task-hub',
90
+ allowedTracingUrls: {
91
+ tracecontext: [url => BFF_PATTERNS.some(regex => regex.test(url))],
92
+ },
93
+ beforeSend: (event, context) => {
94
+ // attach MFE-specific context (transform-only — return value is ignored)
95
+ },
96
+ });
97
+
98
+ const orgId = useCurrentOrgId();
99
+
100
+ // Add persistent metadata to every event from this MFE
101
+ useEffect(() => {
102
+ setServiceContext({ logicalEnvironment: 'go5', orgId });
103
+ }, [orgId, setServiceContext]);
104
+
105
+ return <TaskHubApp />;
106
+ };
107
+ ```
108
+
109
+ For non-React entry points, use the imperative form:
110
+
111
+ ```ts title="task-hub-bootstrap.ts"
112
+ import { init } from '@servicetitan/datadog-rum';
113
+
114
+ const { cleanup, setServiceContext } = init({
115
+ service: {
116
+ name: 'task-hub',
117
+ allowedTracingUrls: {
118
+ tracecontext: [url => /\/api\/task-hub\//.test(url)],
119
+ },
120
+ beforeSend: (event, context) => {
121
+ // attach MFE-specific context
122
+ },
123
+ },
124
+ application: {
125
+ // optional — first caller wins; ignored if a host already initialized
126
+ applicationId: '<TASK_HUB_APPLICATION_ID>',
127
+ clientToken: '<TASK_HUB_CLIENT_TOKEN>',
128
+ env: window.location.hostname,
129
+ },
130
+ });
131
+
132
+ // Add persistent metadata to every event from this MFE
133
+ setServiceContext({ logicalEnvironment: 'go5', orgId: '123' });
134
+
135
+ // Tear down on MFE unmount
136
+ cleanup();
137
+ ```
138
+
139
+ </TabItem>
140
+ </Tabs>
141
+
142
+ ## API
143
+
144
+ | Name | Description |
145
+ | :------------------------------------ | :---------------------------------------------------------- |
146
+ | [`init`](#init) | Registers a service and optionally initializes the SDK |
147
+ | [`useRumService`](#userumservice) | React hook that registers a service and disposes on unmount |
148
+ | [`DatadogProvider`](#datadogprovider) | Identifies the current user to RUM (React component) |
149
+ | [`setUser`](#setuser) | Sets the current session user |
150
+ | [`beforeSend`](#beforesend) | Legacy event-enrichment helper |
151
+
152
+ Each app or MFE has a **service name** used to attribute every RUM event to its source. For MFEs loaded from unpkg, this name is inferred at event time from the package slug (`'task-hub'` for `@servicetitan/task-hub`) and is the key for per-service `beforeSend`, `allowedTracingUrls`, and persistent context lookups. The name you pass to [`init`](#init) or [`useRumService`](#userumservice) must exactly match this slug — i.e. the unscoped name in the MFE's `package.json`. A mismatch silently prevents per-service handlers from running for that MFE's events. `setServiceContext` is exposed as a property of the registration returned by [`init`](#init) and [`useRumService`](#userumservice), so the name is captured once at registration time and cannot drift.
153
+
154
+ ### `init`
155
+
156
+ Registers a service and, optionally, initializes the Datadog RUM SDK. Returns a [`RumServiceRegistration`](#rumserviceregistration) — `{ cleanup, setServiceContext }`, both bound to this service.
157
+
158
+ Any caller — host or MFE — may pass `application`. The first call that includes it initializes the SDK and becomes the SDK initializer; subsequent callers' `application` config is ignored with a warning. Callers that omit `application` register their service without attempting SDK init.
159
+
160
+ ```ts
161
+ import { init } from '@servicetitan/datadog-rum';
162
+
163
+ const { cleanup, setServiceContext } = init({
164
+ service: {
165
+ name: 'task-hub',
166
+ allowedTracingUrls: {
167
+ tracecontext: [url => /\/api\/task-hub\//.test(url)],
168
+ },
169
+ beforeSend: event => {
170
+ // transform-only (return value ignored)
171
+ },
172
+ },
173
+ application: {
174
+ applicationId: '<APPLICATION_ID>',
175
+ clientToken: '<CLIENT_TOKEN>',
176
+ env: window.location.hostname,
177
+ version: '<APPLICATION_VERSION>',
178
+ excludedActivityUrls: [/fullstory\.com/, /pendo\.io/, /\/Log\/Send/],
179
+ beforeSend: event => {
180
+ return true; // return false to drop the event app-wide
181
+ },
182
+ },
183
+ });
184
+
185
+ // Attach session-lifetime context merged into every 'task-hub'-tagged event
186
+ setServiceContext({ logicalEnvironment: 'go5', orgId: '123' });
187
+
188
+ // On teardown (e.g. MFE unmount):
189
+ cleanup();
190
+ ```
191
+
192
+ #### Parameters
193
+
194
+ `init` accepts an [`InitRumOptions`](#initrumoptions) object and returns a [`RumServiceRegistration`](#rumserviceregistration).
195
+
196
+ ##### `InitRumOptions` {#initrumoptions}
197
+
198
+ | Name | Type | Description |
199
+ | :------------ | :------------------------------------------ | :------------------------------------------------------------------------ |
200
+ | `service` | [`ServiceConfig`](#serviceconfig) | Per-service handlers and tracing URL matchers |
201
+ | `application` | [`ApplicationConfig`](#applicationconfig) | (optional) SDK initialization config; first caller wins |
202
+
203
+ ##### `RumServiceRegistration` {#rumserviceregistration}
204
+
205
+ | Name | Type | Description |
206
+ | :------------------ | :-------------------------------- | :------------------------------------------------------------------------------------------------------- |
207
+ | `cleanup` | `() => void` | Removes this service's `beforeSend`, `allowedTracingUrls`, and persistent context. Idempotent. |
208
+ | `setServiceContext` | `(context: Context) => void` | Sets session-lifetime context merged into every event whose `event.service` matches this service's name. Replace semantics: a second call replaces the previous bag with no merge. |
209
+
210
+ ##### `ServiceConfig` {#serviceconfig}
211
+
212
+ | Name | Type | Description |
213
+ | :------------------- | :----------------------------------------------------- | :--------------------------------------------------------------------------------------------------- |
214
+ | `name` | `string` | Service name. For MFEs loaded from unpkg, must exactly match the unscoped `package.json` `name` (e.g. `'task-hub'` for `@servicetitan/task-hub`). |
215
+ | `beforeSend` | `ServiceBeforeSendHandler` | (optional) Transform-only per-service handler. Return value is **ignored** — services cannot drop events. |
216
+ | `allowedTracingUrls` | `Partial<Record<PropagatorType, TracingMatchOption[]>>` | (optional) URL matchers grouped by propagator type |
217
+
218
+ :::caution
219
+ A service's `beforeSend` cannot drop events. This is intentional: services share a session with the host and any other MFEs, so a bug in one service must not silently hide its own events from the host's monitoring. Use `application.beforeSend` for app-wide drop decisions.
220
+ :::
221
+
222
+ ##### `ApplicationConfig` {#applicationconfig}
223
+
224
+ Same shape as `datadogRum.init` config, minus `allowedTracingUrls` (built from service registrations) and `service` (derived from `service.name`), plus:
225
+
226
+ | Name | Type | Description |
227
+ | :----------- | :------------------ | :------------------------------------------------------------------------------ |
228
+ | `beforeSend` | `ApplicationBeforeSendHandler` | (optional) Application-level handler; runs for all events before service handlers. Return `false` to drop the event app-wide. |
229
+
230
+ Opinionated defaults (overridable):
231
+
232
+ - `sessionSampleRate: 100`
233
+ - `sessionReplaySampleRate: 0`
234
+ - `defaultPrivacyLevel: 'mask-user-input'`
235
+
236
+ Where:
237
+
238
+ - `PropagatorType` is `'datadog' | 'tracecontext' | 'b3' | 'b3multi'`.
239
+ - `TracingMatchOption` is `string` (prefix match), `RegExp`, or `(url: string) => boolean`.
240
+ - `ApplicationBeforeSendHandler` is `(event: RumEvent, context: RumEventDomainContext) => boolean | void`.
241
+ - `ServiceBeforeSendHandler` is `(event: RumEvent, context: RumEventDomainContext) => void`.
242
+
243
+ :::caution
244
+ `excludedActivityUrls` tells RUM which URLs not to count toward view-loading time. The exclusion applies app-wide; the first `application` config locks the list, so the host should set the complete list there. If an MFE set it, its choices would distort view metrics for the host and any other MFEs sharing the session.
245
+ :::
246
+
247
+ ### `useRumService`
248
+
249
+ React hook that wraps [`init`](#init) for service-only registration. The service is registered on mount and disposed on unmount; the config is captured on first render — changing it across renders does not re-register.
250
+
251
+ Returns a `RumService` — `{ setServiceContext }`, bound to this service. The handle is identity-stable across renders, so it can safely appear in dependency arrays.
252
+
253
+ On unmount the service's `beforeSend`, `allowedTracingUrls`, and any context previously set via `setServiceContext` are removed atomically. The SDK is **not** shut down — other services remain registered.
254
+
255
+ ```tsx
256
+ import { useEffect } from 'react';
257
+ import { useRumService } from '@servicetitan/datadog-rum';
258
+
259
+ const TaskHub = () => {
260
+ const { setServiceContext } = useRumService({
261
+ name: 'task-hub',
262
+ allowedTracingUrls: { tracecontext: [/\/api\/task-hub\//] },
263
+ beforeSend: event => {
264
+ // transform-only
265
+ },
266
+ });
267
+
268
+ const orgId = useCurrentOrgId();
269
+ useEffect(() => {
270
+ setServiceContext({ logicalEnvironment: 'go5', orgId });
271
+ }, [orgId, setServiceContext]);
272
+
273
+ return <TaskHubApp />;
274
+ };
275
+ ```
276
+
277
+ The hook accepts a [`ServiceConfig`](#serviceconfig) — the same shape used by `init`'s `service` field. It does **not** accept `application` config, since SDK initialization shouldn't be tied to a component's lifecycle.
278
+
279
+ ### `DatadogProvider`
280
+
281
+ `DatadogProvider` provides the RUM SDK with:
46
282
 
47
283
  - Information about the user session
48
- - Sanitized view event names (`@view.name`) when hash-based routing is used
284
+ - Sanitized view event names (`@view.name`) for hash-based routing
285
+
286
+ :::note
287
+ `DatadogProvider` sets the user via [`setUser`](#setuser), so the same gating rules apply.
288
+ :::
49
289
 
50
- ### Usage
290
+ #### Usage
51
291
 
52
- Wrap your application with `DatadogProvider` close to the root. E.g.,
292
+ Wrap your application with `DatadogProvider` close to the root. For example,
53
293
 
54
294
  ```tsx
55
295
  import { DatadogProvider } from '@servicetitan/datadog-rum';
56
296
 
57
- const Root = () =>
297
+ const Root = () => {
58
298
  return (
59
299
  <DatadogProvider isEnabled={isEnabled} user={user}>
60
300
  ...
@@ -63,7 +303,7 @@ const Root = () =>
63
303
  };
64
304
  ```
65
305
 
66
- If your application uses hash-based routing, `DatadogProvider` should be placed inside `HashRouter`. E.g.,
306
+ If your application uses hash-based routing, place `DatadogProvider` inside `HashRouter`. For example,
67
307
 
68
308
  ```tsx
69
309
  import { HashRouter } from 'react-router-dom';
@@ -80,35 +320,57 @@ const Root = () => {
80
320
  };
81
321
  ```
82
322
 
83
- ### Parameters
323
+ #### Parameters
324
+
325
+ | Name | Type | Description |
326
+ | :---------- | :-------------------- | :------------------------------------------ |
327
+ | `isEnabled` | `boolean` | Activates the provider's instrumentation |
328
+ | `user` | [`RumUser`](#rumuser) | (optional) User session information |
329
+ | `options` | [`Options`](#options) | (optional) Additional configuration options |
84
330
 
85
- | Name | Type | Description |
86
- | :---------- | :-------- | :------------------------------------------ |
87
- | `isEnabled` | `boolean` | Enables DD RUM instrumentation |
88
- | `user` | `User` | (optional) User session information |
89
- | `options` | `Options` | (optional) Additional configuration options |
331
+ ##### `RumUser` {#rumuser}
90
332
 
91
- #### `User`
333
+ ```ts
334
+ import type { RumUser } from '@servicetitan/datadog-rum';
335
+ ```
92
336
 
93
337
  | Name | Type | Description |
94
338
  | :-------------- | :----------------------------- | :----------------------------------- |
95
339
  | `id` | `string` | User ID |
96
- | `[key: string]` | `string \| number \| string[]` | (optional) Arbitrary user attributes |
340
+ | `[key: string]` | `string \| number \| string[]` | (optional) Session-wide user attributes |
341
+
342
+ ##### `Options`
343
+
344
+ | Name | Type | Description |
345
+ | :------------ | :-------- | :----------------------------------------------------------- |
346
+ | `hashRouting` | `boolean` | Tracks hash-based routes as RUM views (with sanitized names) |
97
347
 
98
- #### `Options`
348
+ ### `setUser`
349
+
350
+ Sets the session user (see [`RumUser`](#rumuser) for the accepted shape). Behavior depends on initialization state:
351
+
352
+ - **SDK initialized via `init`**: only the bundle whose `init` call initialized the SDK may set the user. That bundle can re-set freely (for example, login, logout, identity switch). Calls from any other bundle are silent no-ops.
353
+ - **SDK initialized directly via `datadogRum.init`**: `setUser` delegates straight to `datadogRum.setUser` without gating.
354
+ - **Neither initialized**: no-op.
355
+
356
+ ```ts
357
+ import { setUser } from '@servicetitan/datadog-rum';
358
+
359
+ setUser({ id: '7', email: 'user@example.com' });
360
+ ```
99
361
 
100
- | Name | Type | Description |
101
- | :------------ | :-------- | :------------------------------------------ |
102
- | `hashRouting` | `boolean` | Sanitizes view names for hash-based routing |
362
+ ### `beforeSend`
103
363
 
104
- ## `beforeSend`
364
+ :::caution
365
+ This is the legacy API, kept for backward compatibility. New applications should use [`init`](#init), which lets MFEs share a host's RUM session.
366
+ :::
105
367
 
106
- `beforeSend` is a callback function for enriching RUM events. Supported functionality:
368
+ `beforeSend` is a callback that enriches RUM events:
107
369
 
108
370
  - Adds MFE name and version for error and resource events coming from MFEs (`@error.service`, `@resource.service`, `@error.version`, and `@resource.version`)
109
371
  - Adds Cloudflare Ray ID for resource events (`@resource.cfRay`)
110
372
 
111
- ### Usage
373
+ #### Usage
112
374
 
113
375
  ```ts
114
376
  import { beforeSend } from '@servicetitan/datadog-rum';
@@ -127,7 +389,7 @@ if (isEnabled) {
127
389
  sessionSampleRate: 100,
128
390
  sessionReplaySampleRate: 0,
129
391
  defaultPrivacyLevel: 'mask-user-input',
130
- beforeSend: beforeSend(), // <--beforeSend() returns handler that enriches events
392
+ beforeSend: beforeSend(), // beforeSend() returns a handler that enriches events
131
393
  });
132
394
  }
133
395
  ```
package/docs/install.mdx CHANGED
@@ -58,9 +58,9 @@ pnpm support is experimental. It has been validated against several internal rep
58
58
  | `--token` | Only configure the npm authentication token. Don't install dependencies. |
59
59
  | `--fix` | Update the lock file without installing packages. |
60
60
 
61
- ## Install Script Protection (Preview)
61
+ ## Install Script Protection
62
62
 
63
- In npm projects `@servicetitan/install` runs all install scripts by default. A future release will flip this default to block untrusted packages from running any install script (`preinstall`, `install`, and `postinstall`), protecting against supply chain attacks. To help teams prepare, `@servicetitan/install` warns about installed packages with untrusted install scripts:
63
+ In npm projects `@servicetitan/install` blocks untrusted packages from running any install script (`preinstall`, `install`, and `postinstall`), protecting against supply chain attacks. When an installed package has an untrusted install script, `@servicetitan/install` skips it and warns:
64
64
 
65
65
  ```
66
66
  WARNING: The following packages have untrusted install scripts.
@@ -70,20 +70,24 @@ Review and add trusted packages to --allow-scripts:
70
70
 
71
71
  :::caution
72
72
  Audit each package in the warning. Verify it is trustworthy or remove the dependency.
73
- :::
74
73
 
75
- :::tip
76
74
  Not sure what an install script does? Ask Claude: "What does the install script for _X_ do?". Claude reads the package source and summarizes the behavior, so you can decide whether to trust it.
77
75
  :::
78
76
 
79
- To disable all install scripts, including the default allowlist, use `--no-allow-scripts`:
77
+ To allow a package to run its install script, use [`--allow-scripts`](#options):
78
+
79
+ ```sh
80
+ npx --yes @servicetitan/install --allow-scripts some-package
81
+ ```
82
+
83
+ To disable all install scripts, including the default allowlist, use [`--no-allow-scripts`](#options):
80
84
 
81
85
  ```sh
82
86
  npx --yes @servicetitan/install --no-allow-scripts
83
87
  ```
84
88
 
85
89
  :::tip
86
- `@servicetitan/install` checks for untrusted install scripts when the lockfile changes. If you see the warning after adding a new dependency, verify the package is trustworthy or remove it.
90
+ `@servicetitan/install` checks for untrusted install scripts on every install. If you see the warning after adding a new dependency, verify the package is trustworthy or remove it.
87
91
  :::
88
92
 
89
93
  ### Pnpm projects
@@ -42,7 +42,7 @@ export const DispatchModule: React.FC = () => <LazyDispatch />;
42
42
  | :----------------------- | :---------------------------------------- | :----------------------------------------------------------------- | :------------------------------------------------------------- |
43
43
  | `loader` | `() => Promise<React.ComponentType<any>>` | Function doing dynamic import of a module | Yes |
44
44
  | `name` | `string` | Module name | Yes |
45
- | `loadingComponent` | `React.ComponentType<any>` | Component to display while loading is in progress | No, defaults to `DefaultLoading` |
45
+ | `loadingComponent` | `React.ComponentType<any>` | Component to display while loading is in progress | No, defaults to `DefaultLoading` |
46
46
  | `loadingErrorComponent` | `React.ComponentType<any>` | Component to display if module loading fails | No, defaults to `DefaultLoadingError` |
47
47
  | `errorFallbackComponent` | `React.ComponentType<any>` | Component to pass to `@servicetitan/error-boundary` module wrapper | No, uses default component from `@servicetitan/error-boundary` |
48
48
 
@@ -6,7 +6,7 @@ A host is an application, or MFE, that uses [`Loader`](../web-components/loader)
6
6
 
7
7
  ## Configuration
8
8
 
9
- Set `cli.webpack.expose-shared-dependencies` to `true` in the application's `package.json`.
9
+ Set `cli.expose-shared-dependencies` to `true` in the application's `package.json`.
10
10
 
11
11
  :::caution
12
12
  `expose-shared-dependencies` only applies to applications. MFEs that load other MFEs do not need this setting or any additional configuration.
@@ -15,13 +15,15 @@ Set `cli.webpack.expose-shared-dependencies` to `true` in the application's `pac
15
15
  ```json title="package.json"
16
16
  {
17
17
  "cli": {
18
- "webpack": {
19
- "expose-shared-dependencies": true
20
- }
18
+ "expose-shared-dependencies": true
21
19
  }
22
20
  }
23
21
  ```
24
22
 
23
+ :::note
24
+ In versions before **36.4.0**, this setting was under `cli.webpack.expose-shared-dependencies`. The old location still works for backward compatibility.
25
+ :::
26
+
25
27
  ### Design system
26
28
 
27
29
  If the host uses `@servicetitan/design-system` remove all imports of design system styles from the code; `startup` handles that automatically. Alternatively, to customize the design system styles, move the imports to a file named `design-system.css` in the root directory of the application's source folder (the `rootDir` in `tsconfig.json`). E.g.,
@@ -27,7 +27,11 @@ By default, MFEs and hosts share the following dependencies (see [here](https://
27
27
  MFE's are not required to use all the default dependencies; `startup` and `Loader` ignore any that aren't used.
28
28
  :::
29
29
 
30
- To customize which dependencies are shared, set `cli.webpack.shared-dependencies` to an object that maps dependencies to `SharedDependencies.{name}`. By convention `{name}` is the camel-cased package name.
30
+ To customize which dependencies are shared, set `cli.shared-dependencies` to an object that maps dependencies to `SharedDependencies.{name}`. By convention `{name}` is the camel-cased package name.
31
+
32
+ :::note
33
+ In versions before **36.4.0**, this setting was under `cli.webpack.shared-dependencies`. The old location still works for backward compatibility.
34
+ :::
31
35
 
32
36
  - Use the special **defaults** key with the empty string to incorporate the default list.
33
37
  - To exclude a default dependency, map it to the empty string.
@@ -39,11 +43,9 @@ To add a dependency, use the special **defaults** key to first include the defau
39
43
  ```json title="package.json"
40
44
  {
41
45
  "cli": {
42
- "webpack": {
43
- "shared-dependencies": {
44
- "defaults": "", // add default list
45
- "lodash": "SharedDependencies.Lodash" // add lodash
46
- }
46
+ "shared-dependencies": {
47
+ "defaults": "", // add default list
48
+ "lodash": "SharedDependencies.Lodash" // add lodash
47
49
  }
48
50
  }
49
51
  }
@@ -65,11 +67,9 @@ To omit an default dependency, map it to the empty string. For example, to omit
65
67
  ```json title="package.json"
66
68
  {
67
69
  "cli": {
68
- "webpack": {
69
- "shared-dependencies": {
70
- "defaults": "", // add default list
71
- "@servicetitan/design-system": "" // drop @servicetitan/design-system
72
- }
70
+ "shared-dependencies": {
71
+ "defaults": "", // add default list
72
+ "@servicetitan/design-system": "" // drop @servicetitan/design-system
73
73
  }
74
74
  }
75
75
  }
@@ -82,12 +82,10 @@ To completely customize the list of shared dependencies, omit the **defaults** k
82
82
  ```json title="package.json"
83
83
  {
84
84
  "cli": {
85
- "webpack": {
86
- "shared-dependencies": {
87
- "@servicetitan/anvil2": "SharedDependencies.ServiceTitan.Anvil2",
88
- "react": "SharedDependencies.React",
89
- "react-dom": "SharedDependencies.ReactDOM"
90
- }
85
+ "shared-dependencies": {
86
+ "@servicetitan/anvil2": "SharedDependencies.ServiceTitan.Anvil2",
87
+ "react": "SharedDependencies.React",
88
+ "react-dom": "SharedDependencies.ReactDOM"
91
89
  }
92
90
  }
93
91
  }