@spotto/contract 1.0.70-alpha.30 → 1.0.70-alpha.31

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.
@@ -1,3 +1,4 @@
1
+ import { GroupHomeLayout } from '../../../users/home-layout';
1
2
  /**
2
3
  * Membership and scope are replaced wholesale; an empty array clears either
3
4
  * (a scope-less group abstains from location scope). `allLocations: false`
@@ -9,4 +10,11 @@ export interface UpdateUsergroupRequest {
9
10
  members?: string[];
10
11
  locationScope?: string[];
11
12
  allLocations?: boolean;
13
+ /**
14
+ * Replaced wholesale, like membership and scope. `null` CLEARS it — the
15
+ * group stops provisioning a layout, and members lose the row from their
16
+ * switcher. An empty widget list is a different thing: a layout that exists
17
+ * and happens to be empty.
18
+ */
19
+ homeLayout?: GroupHomeLayout | null;
12
20
  }
@@ -1,4 +1,5 @@
1
1
  import { IEntityMeta } from '../../shared';
2
+ import { GroupHomeLayout } from '../../users/home-layout';
2
3
  import { GetUsergroupsQuery } from './query';
3
4
  export interface GetUsergroupResponse {
4
5
  id: string;
@@ -26,6 +27,14 @@ export interface GetUsergroupResponse {
26
27
  * org's SSO config.
27
28
  */
28
29
  ssoManaged?: boolean;
30
+ /**
31
+ * The Home layout this group provisions to its members, if it has one.
32
+ * Members receive it on `GET /users/current` as a `ProvisionedHomeLayout`;
33
+ * this is the authored form, and the group document is where it lives —
34
+ * there is exactly one copy, read at response time, so an edit here reaches
35
+ * every member on their next warm.
36
+ */
37
+ homeLayout?: GroupHomeLayout;
29
38
  meta?: IEntityMeta;
30
39
  }
31
40
  export interface GetUsergroupsResponse {
@@ -1,3 +1,4 @@
1
+ import { GroupHomeLayout } from '../../users/home-layout';
1
2
  export interface PostUsergroupRequest {
2
3
  name: string;
3
4
  /** User ids. The actor's own id is rejected — nobody edits their own
@@ -8,4 +9,6 @@ export interface PostUsergroupRequest {
8
9
  * organisation" is `allLocations: true`. */
9
10
  locationScope?: string[];
10
11
  allLocations?: boolean;
12
+ /** A Home layout to provision to this group's members. */
13
+ homeLayout?: GroupHomeLayout;
11
14
  }
@@ -2,7 +2,7 @@ import { IEntityMeta, IEmbeddedEntity } from '../shared';
2
2
  import { Preferences } from '../organisations/constants';
3
3
  import { Integrations } from '../integrations/constants';
4
4
  import { System } from '../system';
5
- import { StoredHomeLayout } from './home-layout';
5
+ import { ProvisionedHomeLayout, StoredHomeLayout } from './home-layout';
6
6
  import { PermissionGrantLevel, UsergroupsScope } from '../usergroups/shared';
7
7
  /** One entry of the §1.7 field access list — every org field appears. */
8
8
  export interface FieldAccessEntry {
@@ -44,6 +44,21 @@ export interface CurrentUserResponse {
44
44
  * saves, and readers have to handle it rather than assume it away.
45
45
  */
46
46
  homeLayout?: StoredHomeLayout;
47
+ /**
48
+ * Home layouts PROVISIONED by the usergroups this caller belongs to,
49
+ * resolved server-side — the client is never told which groups those are,
50
+ * exactly as it is never told anything else about membership (it receives
51
+ * `fieldAccess`/`actionAccess`/`usergroupsScope`, the effects, and not the
52
+ * graph that produced them).
53
+ *
54
+ * Read-only for the member, and deliberately NOT inside `homeLayout`: that
55
+ * field is written back wholesale, so anything delivered in it would be
56
+ * copied into the member's own set by their next save.
57
+ *
58
+ * Omitted entirely when the usergroups toggle is off, and when the caller's
59
+ * groups provision nothing — an empty array is never emitted.
60
+ */
61
+ groupHomeLayouts?: ProvisionedHomeLayout[];
47
62
  /**
48
63
  * UI-only visibility lists (usergroups feature) — COMPLETE: every org
49
64
  * field appears with the caller's effective level (grant-less ⇒ EDIT;
@@ -225,6 +225,50 @@ export interface HomeLayout {
225
225
  * per-device memory decides, as it did before this existed. */
226
226
  deviceDefaults?: HomeLayoutDeviceDefaults;
227
227
  }
228
+ /**
229
+ * A layout PROVISIONED BY A USERGROUP, as stored on the group document.
230
+ *
231
+ * Deliberately not a `NamedHomeLayout`. It carries no `id` because the group's
232
+ * id identifies it — one layout per group, so the group IS the identity — and
233
+ * no `name` because the group's name labels it; a second name would be a name
234
+ * inside a name, free to drift from the one members actually see.
235
+ *
236
+ * It is otherwise the same thing: the same widgets, validated by the same
237
+ * rules, rendered by the same canvas. The member sees it alongside their own
238
+ * layouts and can switch to it, but not edit, rename or delete it — it is
239
+ * provisioning, on the same footing as a location scope or a field grant. The
240
+ * escape hatch is duplicating it into their own set, where it becomes theirs
241
+ * and stops tracking the group's.
242
+ */
243
+ export interface GroupHomeLayout {
244
+ /** Icon name, on the same terms as `NamedHomeLayout.icon`. */
245
+ icon?: string;
246
+ /** Colour name, on the same terms as `NamedHomeLayout.colour`. */
247
+ colour?: string;
248
+ /** Flat, ordered widget list; geometry lives on each widget's `gridPos`. */
249
+ widgets: HomeWidget[];
250
+ }
251
+ /**
252
+ * One group's layout as delivered to a member on `GET /users/current`,
253
+ * resolved server-side from the groups they belong to.
254
+ *
255
+ * Emitted SEPARATELY from `homeLayout` and never inside it. That separation is
256
+ * load-bearing, not tidiness: `homeLayout` is the field the client writes back
257
+ * wholesale, so a provisioned layout arriving inside it would be copied into
258
+ * the member's own set by their next save — silently, permanently, and without
259
+ * anyone asking for it.
260
+ *
261
+ * The client renders these from the group's identity: `groupId` is the layout's
262
+ * id (which is what a per-device landing preference stores, and what stops
263
+ * naming one once you leave the group), and `groupName` is its label.
264
+ */
265
+ export interface ProvisionedHomeLayout {
266
+ /** The group's id — also the layout's id, client-side. */
267
+ groupId: string;
268
+ /** The group's name, which is what the member sees the layout called. */
269
+ groupName: string;
270
+ layout: GroupHomeLayout;
271
+ }
228
272
  /**
229
273
  * The pre-v5 shape: a single, unnamed layout.
230
274
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@spotto/contract",
3
3
  "license": "ISC",
4
- "version": "1.0.70-alpha.30",
4
+ "version": "1.0.70-alpha.31",
5
5
  "description": "Spotto's API Contract type definitions",
6
6
  "main": "./dist/index.js",
7
7
  "files": [
@@ -18,5 +18,5 @@
18
18
  "@types/geojson": "^7946.0.11",
19
19
  "shx": "^0.3.4"
20
20
  },
21
- "gitHead": "9caf97c8f4e52cb486fbab552b004095df38d579"
21
+ "gitHead": "2f2d0cfd5dc8390336198bc9c5d58119df51f908"
22
22
  }