@proulr/sdui-contract 0.1.12 → 0.1.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proulr/sdui-contract",
3
- "version": "0.1.12",
3
+ "version": "0.1.15",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -13,6 +13,7 @@ export type SduiActionType =
13
13
  | 'api_call'
14
14
  | 'track'
15
15
  | 'toggle_search'
16
+ | 'native_capability'
16
17
  | 'refresh_screen'
17
18
  | 'sign_out'
18
19
  | 'noop';
@@ -45,6 +46,8 @@ export type SduiActionWire = {
45
46
  url?: string;
46
47
  /** Share sheet message for `share` (may include URL). */
47
48
  message?: string;
49
+ /** Native capability id for `native_capability` (e.g. `local_ui.toggle_search`). */
50
+ capability_id?: string;
48
51
  method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
49
52
  path?: string;
50
53
  body?: Record<string, unknown>;
@@ -107,6 +110,8 @@ export type SduiAction = {
107
110
  sheetId?: string;
108
111
  url?: string;
109
112
  message?: string;
113
+ /** Native capability id for `native_capability`. */
114
+ capabilityId?: string;
110
115
  method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
111
116
  path?: string;
112
117
  body?: Record<string, unknown>;
@@ -42,6 +42,24 @@ describe('decodeSduiScreenWire', () => {
42
42
  });
43
43
  });
44
44
 
45
+ it('decodes native_capability actions with capability_id', () => {
46
+ const screen = decodeSduiScreenWire({
47
+ schema_version: 1,
48
+ screen_id: 'demo.home',
49
+ blocks: [],
50
+ actions: {
51
+ toggle_search: {
52
+ type: 'native_capability',
53
+ capability_id: 'local_ui.toggle_search',
54
+ },
55
+ },
56
+ });
57
+ expect(screen.actions.toggle_search).toMatchObject({
58
+ type: 'native_capability',
59
+ capabilityId: 'local_ui.toggle_search',
60
+ });
61
+ });
62
+
45
63
  it('decodes meta.chrome into camelCase layout hints', () => {
46
64
  const screen = decodeSduiScreenWire({
47
65
  schema_version: 1,
@@ -43,6 +43,7 @@ function mapActionWire(wire: SduiActionWire): SduiAction {
43
43
  sheetId: wire.sheet_id,
44
44
  url: wire.url,
45
45
  message: wire.message,
46
+ capabilityId: wire.capability_id,
46
47
  method: wire.method,
47
48
  path: wire.path,
48
49
  body: wire.body,