@novasamatech/host-api 0.6.2-0 → 0.6.4

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.
@@ -322,6 +322,7 @@ export declare const hostApiProtocol: {
322
322
  }>;
323
323
  readonly product_chat_custom_message_render_subscribe: VersionedProtocolSubscription<{
324
324
  readonly v1: [Codec<{
325
+ messageId: string;
325
326
  messageType: string;
326
327
  payload: Uint8Array<ArrayBufferLike>;
327
328
  }>, Codec<import("./v1/customRenderer.js").CustomRendererNodeType>];
@@ -338,6 +338,7 @@ export declare const MessagePayload: EnumCodec<Record<"host_handshake_request",
338
338
  }>;
339
339
  }>> & Record<"host_chat_action_subscribe_interrupt", Codec<undefined>> & Record<"host_chat_action_subscribe_stop", Codec<undefined>> & Record<"product_chat_custom_message_render_subscribe_start", EnumCodec<{
340
340
  readonly v1: Codec<{
341
+ messageId: string;
341
342
  messageType: string;
342
343
  payload: Uint8Array<ArrayBufferLike>;
343
344
  }>;
@@ -1282,6 +1283,7 @@ export declare const Message: Codec<{
1282
1283
  value: {
1283
1284
  tag: "v1";
1284
1285
  value: {
1286
+ messageId: string;
1285
1287
  messageType: string;
1286
1288
  payload: Uint8Array<ArrayBufferLike>;
1287
1289
  };
@@ -459,6 +459,7 @@ export declare const ChatActionSubscribeV1_receive: Codec<{
459
459
  };
460
460
  }>;
461
461
  export declare const ChatCustomMessageRenderingV1_start: Codec<{
462
+ messageId: string;
462
463
  messageType: string;
463
464
  payload: Uint8Array<ArrayBufferLike>;
464
465
  }>;
@@ -120,5 +120,5 @@ export const ReceivedChatAction = Struct({
120
120
  export const ChatActionSubscribeV1_start = _void;
121
121
  export const ChatActionSubscribeV1_receive = ReceivedChatAction;
122
122
  // custom message rendering
123
- export const ChatCustomMessageRenderingV1_start = Struct({ messageType: str, payload: Bytes() });
123
+ export const ChatCustomMessageRenderingV1_start = Struct({ messageId: str, messageType: str, payload: Bytes() });
124
124
  export const ChatCustomMessageRenderingV1_receive = CustomRendererNode;
@@ -27,10 +27,18 @@ export declare const BorderStyle: Codec<{
27
27
  value: undefined;
28
28
  } | undefined;
29
29
  }>;
30
- export declare const Modifiers: Codec<{
31
- margin: [number | bigint, number | bigint, number | bigint | undefined, number | bigint | undefined] | undefined;
32
- padding: [number | bigint, number | bigint, number | bigint | undefined, number | bigint | undefined] | undefined;
33
- background: {
30
+ export declare const Modifier: Codec<{
31
+ tag: "width";
32
+ value: number | bigint;
33
+ } | {
34
+ tag: "margin";
35
+ value: [number | bigint, number | bigint, number | bigint | undefined, number | bigint | undefined];
36
+ } | {
37
+ tag: "padding";
38
+ value: [number | bigint, number | bigint, number | bigint | undefined, number | bigint | undefined];
39
+ } | {
40
+ tag: "background";
41
+ value: {
34
42
  color: "error" | "textPrimary" | "textSecondary" | "textTertiary" | "backgroundPrimary" | "backgroundSecondary" | "backgroundTertiary" | "success" | "warning";
35
43
  shape: {
36
44
  tag: "Rounded";
@@ -39,8 +47,10 @@ export declare const Modifiers: Codec<{
39
47
  tag: "Circle";
40
48
  value: undefined;
41
49
  } | undefined;
42
- } | undefined;
43
- border: {
50
+ };
51
+ } | {
52
+ tag: "border";
53
+ value: {
44
54
  width: number | bigint;
45
55
  color: "error" | "textPrimary" | "textSecondary" | "textTertiary" | "backgroundPrimary" | "backgroundSecondary" | "backgroundTertiary" | "success" | "warning";
46
56
  shape: {
@@ -50,13 +60,22 @@ export declare const Modifiers: Codec<{
50
60
  tag: "Circle";
51
61
  value: undefined;
52
62
  } | undefined;
53
- } | undefined;
54
- height: number | bigint | undefined;
55
- width: number | bigint | undefined;
56
- minWidth: number | bigint | undefined;
57
- minHeight: number | bigint | undefined;
58
- fillWidth: boolean | undefined;
59
- fillHeight: boolean | undefined;
63
+ };
64
+ } | {
65
+ tag: "height";
66
+ value: number | bigint;
67
+ } | {
68
+ tag: "minWidth";
69
+ value: number | bigint;
70
+ } | {
71
+ tag: "minHeight";
72
+ value: number | bigint;
73
+ } | {
74
+ tag: "fillWidth";
75
+ value: boolean;
76
+ } | {
77
+ tag: "fillHeight";
78
+ value: boolean;
60
79
  }>;
61
80
  type EnumVariants<T> = {
62
81
  [K in keyof T]: {
@@ -66,10 +85,18 @@ type EnumVariants<T> = {
66
85
  }[keyof T];
67
86
  type ComponentType<Props extends Codec<any>> = CodecType<ReturnType<typeof Component<Props>>>;
68
87
  declare function Component<Props extends Codec<any>>(props: Props): Codec<{
69
- modifiers: {
70
- margin: [number | bigint, number | bigint, number | bigint | undefined, number | bigint | undefined] | undefined;
71
- padding: [number | bigint, number | bigint, number | bigint | undefined, number | bigint | undefined] | undefined;
72
- background: {
88
+ modifiers: ({
89
+ tag: "width";
90
+ value: number | bigint;
91
+ } | {
92
+ tag: "margin";
93
+ value: [number | bigint, number | bigint, number | bigint | undefined, number | bigint | undefined];
94
+ } | {
95
+ tag: "padding";
96
+ value: [number | bigint, number | bigint, number | bigint | undefined, number | bigint | undefined];
97
+ } | {
98
+ tag: "background";
99
+ value: {
73
100
  color: "error" | "textPrimary" | "textSecondary" | "textTertiary" | "backgroundPrimary" | "backgroundSecondary" | "backgroundTertiary" | "success" | "warning";
74
101
  shape: {
75
102
  tag: "Rounded";
@@ -78,8 +105,10 @@ declare function Component<Props extends Codec<any>>(props: Props): Codec<{
78
105
  tag: "Circle";
79
106
  value: undefined;
80
107
  } | undefined;
81
- } | undefined;
82
- border: {
108
+ };
109
+ } | {
110
+ tag: "border";
111
+ value: {
83
112
  width: number | bigint;
84
113
  color: "error" | "textPrimary" | "textSecondary" | "textTertiary" | "backgroundPrimary" | "backgroundSecondary" | "backgroundTertiary" | "success" | "warning";
85
114
  shape: {
@@ -89,14 +118,23 @@ declare function Component<Props extends Codec<any>>(props: Props): Codec<{
89
118
  tag: "Circle";
90
119
  value: undefined;
91
120
  } | undefined;
92
- } | undefined;
93
- height: number | bigint | undefined;
94
- width: number | bigint | undefined;
95
- minWidth: number | bigint | undefined;
96
- minHeight: number | bigint | undefined;
97
- fillWidth: boolean | undefined;
98
- fillHeight: boolean | undefined;
99
- } | undefined;
121
+ };
122
+ } | {
123
+ tag: "height";
124
+ value: number | bigint;
125
+ } | {
126
+ tag: "minWidth";
127
+ value: number | bigint;
128
+ } | {
129
+ tag: "minHeight";
130
+ value: number | bigint;
131
+ } | {
132
+ tag: "fillWidth";
133
+ value: boolean;
134
+ } | {
135
+ tag: "fillHeight";
136
+ value: boolean;
137
+ })[];
100
138
  props: CodecType<Props>;
101
139
  children: CustomRendererNodeType[];
102
140
  }>;
@@ -116,16 +154,17 @@ export declare const TextProps: Codec<{
116
154
  color: "error" | "textPrimary" | "textSecondary" | "textTertiary" | "backgroundPrimary" | "backgroundSecondary" | "backgroundTertiary" | "success" | "warning" | undefined;
117
155
  }>;
118
156
  export declare const ButtonProps: Codec<{
157
+ text: string;
119
158
  variant: "primary" | "secondary" | "text" | undefined;
120
- enabled: boolean | undefined;
121
- loading: boolean | undefined;
159
+ enabled: boolean | void;
160
+ loading: boolean | void;
122
161
  clickAction: string | undefined;
123
162
  }>;
124
163
  export declare const TextFieldProps: Codec<{
125
- value: string | undefined;
164
+ text: string;
126
165
  placeholder: string | undefined;
127
166
  label: string | undefined;
128
- enabled: boolean | undefined;
167
+ enabled: boolean | void;
129
168
  valueChangeAction: string | undefined;
130
169
  }>;
131
170
  export type CustomRendererNodeType = EnumVariants<{
@@ -1,4 +1,4 @@
1
- import { Enum, Status, lazy } from '@novasamatech/scale';
1
+ import { Enum, OptionBool, Status, lazy } from '@novasamatech/scale';
2
2
  import { Option, Struct, Tuple, Vector, _void, bool, compact, str } from 'scale-ts';
3
3
  export const Size = compact;
4
4
  export const Dimensions = Tuple(Size, Size, Option(Size), Option(Size));
@@ -18,25 +18,25 @@ export const BorderStyle = Struct({
18
18
  color: ColorToken,
19
19
  shape: Option(Shape),
20
20
  });
21
- export const Modifiers = Struct({
22
- margin: Option(Dimensions),
23
- padding: Option(Dimensions),
24
- background: Option(Struct({
21
+ export const Modifier = Enum({
22
+ margin: Dimensions,
23
+ padding: Dimensions,
24
+ background: Struct({
25
25
  color: ColorToken,
26
26
  shape: Option(Shape),
27
- })),
28
- border: Option(BorderStyle),
29
- height: Option(Size),
30
- width: Option(Size),
31
- minWidth: Option(Size),
32
- minHeight: Option(Size),
33
- fillWidth: Option(bool),
34
- fillHeight: Option(bool),
27
+ }),
28
+ border: BorderStyle,
29
+ height: Size,
30
+ width: Size,
31
+ minWidth: Size,
32
+ minHeight: Size,
33
+ fillWidth: bool,
34
+ fillHeight: bool,
35
35
  });
36
36
  const Children = lazy(() => CustomRendererNode);
37
37
  function Component(props) {
38
38
  return Struct({
39
- modifiers: Option(Modifiers),
39
+ modifiers: Vector(Modifier),
40
40
  props: props,
41
41
  children: Vector(Children),
42
42
  });
@@ -57,16 +57,17 @@ export const TextProps = Struct({
57
57
  color: Option(ColorToken),
58
58
  });
59
59
  export const ButtonProps = Struct({
60
+ text: str,
60
61
  variant: Option(ButtonVariant),
61
- enabled: Option(bool),
62
- loading: Option(bool),
62
+ enabled: OptionBool,
63
+ loading: OptionBool,
63
64
  clickAction: Option(str),
64
65
  });
65
66
  export const TextFieldProps = Struct({
66
- value: Option(str),
67
+ text: str,
67
68
  placeholder: Option(str),
68
69
  label: Option(str),
69
- enabled: Option(bool),
70
+ enabled: OptionBool,
70
71
  valueChangeAction: Option(str),
71
72
  });
72
73
  export const CustomRendererNode = Enum({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@novasamatech/host-api",
3
3
  "type": "module",
4
- "version": "0.6.2-0",
4
+ "version": "0.6.4",
5
5
  "description": "Host API: transport implementation for host - product integration.",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -21,7 +21,7 @@
21
21
  "README.md"
22
22
  ],
23
23
  "dependencies": {
24
- "@novasamatech/scale": "0.6.2-0",
24
+ "@novasamatech/scale": "0.6.4",
25
25
  "@polkadot-api/utils": "^0.2.0",
26
26
  "nanoevents": "9.1.0",
27
27
  "nanoid": "5.1.6",