@kyyinfinite/zapo-message 0.0.0-stage → 1.0.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.
Files changed (191) hide show
  1. package/CHANGELOG.md +159 -0
  2. package/LICENSE +20 -0
  3. package/README.md +532 -2
  4. package/build.config.json +28 -0
  5. package/dist/airich/airich.d.ts +180 -0
  6. package/dist/airich/airich.js +548 -0
  7. package/dist/airich/context.d.ts +24 -0
  8. package/dist/airich/context.js +48 -0
  9. package/dist/airich/encode.d.ts +3 -0
  10. package/dist/airich/encode.js +16 -0
  11. package/dist/airich/index.d.ts +20 -0
  12. package/dist/airich/index.js +11 -0
  13. package/dist/airich/inline.d.ts +45 -0
  14. package/dist/airich/inline.js +152 -0
  15. package/dist/airich/nodes.d.ts +30 -0
  16. package/dist/airich/nodes.js +121 -0
  17. package/dist/airich/primitives.d.ts +144 -0
  18. package/dist/airich/primitives.js +230 -0
  19. package/dist/airich/protocol.d.ts +35 -0
  20. package/dist/airich/protocol.js +65 -0
  21. package/dist/airich/table.d.ts +22 -0
  22. package/dist/airich/table.js +35 -0
  23. package/dist/airich/tokenizer.d.ts +13 -0
  24. package/dist/airich/tokenizer.js +717 -0
  25. package/dist/airich/transport.d.ts +15 -0
  26. package/dist/airich/transport.js +56 -0
  27. package/dist/branding.d.ts +5 -0
  28. package/dist/branding.js +9 -0
  29. package/dist/btn/builders.d.ts +246 -0
  30. package/dist/btn/builders.js +710 -0
  31. package/dist/btn/media-slot.d.ts +28 -0
  32. package/dist/btn/media-slot.js +323 -0
  33. package/dist/btn/media-source.d.ts +38 -0
  34. package/dist/btn/media-source.js +116 -0
  35. package/dist/btn/sharp-loader.d.ts +5 -0
  36. package/dist/btn/sharp-loader.js +18 -0
  37. package/dist/btn/thumbnail.d.ts +21 -0
  38. package/dist/btn/thumbnail.js +124 -0
  39. package/dist/btn/validators.d.ts +40 -0
  40. package/dist/btn/validators.js +135 -0
  41. package/dist/btn.d.ts +1 -0
  42. package/dist/btn.js +1 -0
  43. package/dist/core/async-send.d.ts +20 -0
  44. package/dist/core/async-send.js +1 -0
  45. package/dist/core/base-builder.d.ts +20 -0
  46. package/dist/core/base-builder.js +67 -0
  47. package/dist/core/errors.d.ts +30 -0
  48. package/dist/core/errors.js +61 -0
  49. package/dist/download.d.ts +24 -0
  50. package/dist/download.js +123 -0
  51. package/dist/index.d.ts +38 -0
  52. package/dist/index.js +22 -0
  53. package/dist/integration/augment.d.ts +97 -0
  54. package/dist/integration/augment.js +1 -0
  55. package/dist/integration/auto.d.ts +8 -0
  56. package/dist/integration/auto.js +79 -0
  57. package/dist/integration/index.d.ts +4 -0
  58. package/dist/integration/index.js +2 -0
  59. package/dist/integration/methods.d.ts +25 -0
  60. package/dist/integration/methods.js +24 -0
  61. package/dist/interactive.d.ts +24 -0
  62. package/dist/interactive.js +121 -0
  63. package/dist/media-gate.d.ts +99 -0
  64. package/dist/media-gate.js +322 -0
  65. package/dist/message/album.d.ts +33 -0
  66. package/dist/message/album.js +107 -0
  67. package/dist/message/contact.d.ts +29 -0
  68. package/dist/message/contact.js +123 -0
  69. package/dist/message/forward.d.ts +23 -0
  70. package/dist/message/forward.js +77 -0
  71. package/dist/message/index.d.ts +26 -0
  72. package/dist/message/index.js +13 -0
  73. package/dist/message/link-preview.d.ts +28 -0
  74. package/dist/message/link-preview.js +98 -0
  75. package/dist/message/location.d.ts +24 -0
  76. package/dist/message/location.js +94 -0
  77. package/dist/message/media.d.ts +90 -0
  78. package/dist/message/media.js +123 -0
  79. package/dist/message/poll.d.ts +24 -0
  80. package/dist/message/poll.js +98 -0
  81. package/dist/message/reaction.d.ts +20 -0
  82. package/dist/message/reaction.js +71 -0
  83. package/dist/message/sticker.d.ts +29 -0
  84. package/dist/message/sticker.js +44 -0
  85. package/dist/message/target.d.ts +18 -0
  86. package/dist/message/target.js +24 -0
  87. package/dist/message/text.d.ts +17 -0
  88. package/dist/message/text.js +29 -0
  89. package/dist/message/vcard.d.ts +9 -0
  90. package/dist/message/vcard.js +23 -0
  91. package/dist/message/webp.d.ts +6 -0
  92. package/dist/message/webp.js +57 -0
  93. package/dist/payloads.d.ts +180 -0
  94. package/dist/payloads.js +1 -0
  95. package/dist/serialize.d.ts +41 -0
  96. package/dist/serialize.js +93 -0
  97. package/dist/status.d.ts +3 -0
  98. package/dist/status.js +21 -0
  99. package/dist/zapo-client.d.ts +44 -0
  100. package/dist/zapo-client.js +1 -0
  101. package/examples/airich.ts +59 -0
  102. package/examples/buttons.ts +48 -0
  103. package/examples/client-methods.ts +58 -0
  104. package/examples/hybrid.ts +133 -0
  105. package/examples/serialize.ts +61 -0
  106. package/package.json +271 -4
  107. package/scripts/check-no-comments.mjs +101 -0
  108. package/scripts/compare-golden.mjs +461 -0
  109. package/scripts/lib-config.mjs +9 -0
  110. package/scripts/smoke-auto.mjs +75 -0
  111. package/scripts/test-external-consumer.mjs +316 -0
  112. package/scripts/verify-package.mjs +78 -0
  113. package/src/airich/airich.ts +970 -0
  114. package/src/airich/context.ts +96 -0
  115. package/src/airich/encode.ts +25 -0
  116. package/src/airich/index.ts +98 -0
  117. package/src/airich/inline.ts +272 -0
  118. package/src/airich/nodes.ts +174 -0
  119. package/src/airich/primitives.ts +474 -0
  120. package/src/airich/protocol.ts +133 -0
  121. package/src/airich/table.ts +70 -0
  122. package/src/airich/tokenizer.ts +799 -0
  123. package/src/airich/transport.ts +106 -0
  124. package/src/branding.ts +23 -0
  125. package/src/btn/builders.ts +1073 -0
  126. package/src/btn/media-slot.ts +486 -0
  127. package/src/btn/media-source.ts +189 -0
  128. package/src/btn/sharp-loader.ts +23 -0
  129. package/src/btn/thumbnail.ts +182 -0
  130. package/src/btn/validators.ts +237 -0
  131. package/src/btn.ts +8 -0
  132. package/src/core/async-send.ts +28 -0
  133. package/src/core/base-builder.ts +104 -0
  134. package/src/core/errors.ts +82 -0
  135. package/src/download.ts +212 -0
  136. package/src/index.ts +229 -0
  137. package/src/integration/augment.ts +262 -0
  138. package/src/integration/auto.ts +103 -0
  139. package/src/integration/index.ts +8 -0
  140. package/src/integration/methods.ts +45 -0
  141. package/src/interactive.ts +188 -0
  142. package/src/media-gate.ts +499 -0
  143. package/src/message/album.ts +187 -0
  144. package/src/message/contact.ts +170 -0
  145. package/src/message/forward.ts +123 -0
  146. package/src/message/index.ts +83 -0
  147. package/src/message/link-preview.ts +148 -0
  148. package/src/message/location.ts +150 -0
  149. package/src/message/media.ts +323 -0
  150. package/src/message/poll.ts +158 -0
  151. package/src/message/reaction.ts +133 -0
  152. package/src/message/sticker.ts +100 -0
  153. package/src/message/target.ts +38 -0
  154. package/src/message/text.ts +61 -0
  155. package/src/message/vcard.ts +36 -0
  156. package/src/message/webp.ts +78 -0
  157. package/src/payloads.ts +204 -0
  158. package/src/serialize.ts +180 -0
  159. package/src/status.ts +29 -0
  160. package/src/zapo-client.ts +84 -0
  161. package/test/airich-inline.test.ts +200 -0
  162. package/test/airich-primitives.test.ts +226 -0
  163. package/test/airich-tokenizer.test.ts +145 -0
  164. package/test/airich.golden.test.ts +406 -0
  165. package/test/airich.test.ts +1006 -0
  166. package/test/btn-button.test.ts +416 -0
  167. package/test/btn-header.test.ts +646 -0
  168. package/test/btn-legacy.test.ts +342 -0
  169. package/test/btn-lifecycle.test.ts +295 -0
  170. package/test/btn-list.test.ts +261 -0
  171. package/test/btn-media-source.test.ts +150 -0
  172. package/test/btn-thumbnail.test.ts +160 -0
  173. package/test/builder-compat.test.ts +264 -0
  174. package/test/helpers.ts +27 -0
  175. package/test/hybrid-airich.test.ts +345 -0
  176. package/test/hybrid-client.test.ts +239 -0
  177. package/test/hybrid-errors.test.ts +557 -0
  178. package/test/hybrid-interactive.test.ts +455 -0
  179. package/test/hybrid.golden.test.ts +349 -0
  180. package/test/hybrid.test.ts +479 -0
  181. package/test/integration-auto.test.ts +159 -0
  182. package/test/integration.fakeserver.test.ts +440 -0
  183. package/test/media-gate.test.ts +215 -0
  184. package/test/message-album.test.ts +145 -0
  185. package/test/message-builders.test.ts +401 -0
  186. package/test/message-media.test.ts +303 -0
  187. package/test/message.fakeserver.test.ts +284 -0
  188. package/test/message.golden.test.ts +254 -0
  189. package/test/serializer.test.ts +448 -0
  190. package/tsconfig.json +26 -0
  191. package/tsconfig.test.json +10 -0
@@ -0,0 +1,45 @@
1
+ export interface InlineHyperlinkEntity {
2
+ key: string;
3
+ metadata: {
4
+ display_name: string;
5
+ is_trusted: boolean;
6
+ url: string;
7
+ __typename: "GenAIInlineLinkItem";
8
+ };
9
+ }
10
+ export interface InlineCitationEntity {
11
+ key: string;
12
+ metadata: {
13
+ reference_id: number;
14
+ reference_url: string;
15
+ reference_title: string;
16
+ reference_display_name: string;
17
+ sources: [];
18
+ __typename: "GenAISearchCitationItem";
19
+ };
20
+ }
21
+ export interface InlineLatexEntity {
22
+ key: string;
23
+ metadata: {
24
+ latex_expression: string;
25
+ latex_image: {
26
+ url: string;
27
+ width: number;
28
+ height: number;
29
+ };
30
+ font_height: number;
31
+ padding: number;
32
+ __typename: "GenAILatexItem";
33
+ };
34
+ }
35
+ export type InlineEntity = InlineHyperlinkEntity | InlineCitationEntity | InlineLatexEntity;
36
+ export interface ParsedInline {
37
+ text: string;
38
+ entities: InlineEntity[];
39
+ }
40
+ export interface ParseInlineOptions {
41
+ hyperlink?: boolean | undefined;
42
+ citation?: boolean | undefined;
43
+ latex?: boolean | undefined;
44
+ }
45
+ export declare const parseInline: (text: string, { hyperlink, citation, latex }?: ParseInlineOptions) => ParsedInline;
@@ -0,0 +1,152 @@
1
+ const SCHEME_RE = /^([a-zA-Z][a-zA-Z0-9+.-]*):/;
2
+ const ALLOWED_SCHEMES = new Set(["http", "https", "mailto", "tel", "ftp"]);
3
+ const isValidUrl = (url) => {
4
+ if (!url)
5
+ return false;
6
+ const scheme = SCHEME_RE.exec(url);
7
+ if (scheme)
8
+ return ALLOWED_SCHEMES.has((scheme[1] ?? "").toLowerCase());
9
+ return !/\s/.test(url) && url.includes(".") && !url.startsWith(".");
10
+ };
11
+ const scanClose = (text, from, open, close) => {
12
+ let depth = 1;
13
+ let end = from;
14
+ while (end < text.length && depth) {
15
+ const char = text[end] ?? "";
16
+ if (char === open && (text[end - 1] ?? "") !== "\\")
17
+ depth++;
18
+ else if (char === close && (text[end - 1] ?? "") !== "\\") {
19
+ depth--;
20
+ if (!depth)
21
+ return end + 1;
22
+ }
23
+ end++;
24
+ }
25
+ return -1;
26
+ };
27
+ const toHyperlinkEntity = ({ key, text, url, is_trusted, }) => ({
28
+ key,
29
+ metadata: {
30
+ display_name: text,
31
+ is_trusted,
32
+ url,
33
+ __typename: "GenAIInlineLinkItem",
34
+ },
35
+ });
36
+ const toCitationEntity = ({ key, reference_id, url, }) => ({
37
+ key,
38
+ metadata: {
39
+ reference_id,
40
+ reference_url: url,
41
+ reference_title: url,
42
+ reference_display_name: url,
43
+ sources: [],
44
+ __typename: "GenAISearchCitationItem",
45
+ },
46
+ });
47
+ const toLatexEntity = ({ key, text, url, width, height, font_height, padding, }) => ({
48
+ key,
49
+ metadata: {
50
+ latex_expression: text,
51
+ latex_image: {
52
+ url,
53
+ width: Number(width) || 100,
54
+ height: Number(height) || 100,
55
+ },
56
+ font_height: Number(font_height) || 83.333333333333,
57
+ padding: Number(padding) || 15,
58
+ __typename: "GenAILatexItem",
59
+ },
60
+ });
61
+ export const parseInline = (text, { hyperlink = true, citation = true, latex = true } = {}) => {
62
+ const entities = [];
63
+ const stack = [];
64
+ let result = "";
65
+ let last = 0;
66
+ let citationIndex = 1;
67
+ let hyperlinkIndex = 0;
68
+ let latexIndex = 0;
69
+ for (let i = 0; i < text.length; i++) {
70
+ if ((text[i] ?? "") === "[" && (text[i - 1] ?? "") !== "\\") {
71
+ stack.push(i);
72
+ continue;
73
+ }
74
+ if ((text[i] ?? "") !== "]" ||
75
+ (text[i - 1] ?? "") === "\\" ||
76
+ ((text[i + 1] ?? "") !== "(" && (text[i + 1] ?? "") !== "<"))
77
+ continue;
78
+ const start = stack.pop();
79
+ if (start == null)
80
+ continue;
81
+ const open = text[i + 1] ?? "";
82
+ const close = open === "(" ? ")" : ">";
83
+ const isLatex = open === "<";
84
+ const end = scanClose(text, i + 2, open, close);
85
+ if (end === -1) {
86
+ stack.push(start);
87
+ continue;
88
+ }
89
+ const raw = text.slice(start + 1, i).trim();
90
+ let url = text.slice(i + 2, end - 1).trim();
91
+ if (isLatex) {
92
+ if (!latex || !isValidUrl(url)) {
93
+ if (latex)
94
+ stack.push(start);
95
+ continue;
96
+ }
97
+ const [expr = "", width = null, height = null, font_height = null, padding = null,] = raw.split("|");
98
+ const key = `ZAPOK_LATEX_${latexIndex++}`;
99
+ const tag = `{{${key}}}${expr || "image"}{{/${key}}}`;
100
+ const data = {
101
+ key,
102
+ text: expr,
103
+ url,
104
+ width,
105
+ height,
106
+ font_height,
107
+ padding,
108
+ };
109
+ result += text.slice(last, start) + tag;
110
+ last = end;
111
+ entities.push(toLatexEntity(data));
112
+ i = end - 1;
113
+ continue;
114
+ }
115
+ if (raw) {
116
+ if (!hyperlink || !isValidUrl(url)) {
117
+ if (hyperlink)
118
+ stack.push(start);
119
+ continue;
120
+ }
121
+ const trusted = !url.startsWith("!");
122
+ if (!trusted)
123
+ url = url.slice(1);
124
+ if (!isValidUrl(url)) {
125
+ stack.push(start);
126
+ continue;
127
+ }
128
+ const key = `ZAPOK_HYPERLINK_${hyperlinkIndex++}`;
129
+ const tag = `{{${key}}}${url}{{/${key}}}`;
130
+ const data = { key, text: raw, url, is_trusted: trusted };
131
+ result += text.slice(last, start) + tag;
132
+ last = end;
133
+ entities.push(toHyperlinkEntity(data));
134
+ i = end - 1;
135
+ continue;
136
+ }
137
+ if (!citation || !isValidUrl(url)) {
138
+ if (citation)
139
+ stack.push(start);
140
+ continue;
141
+ }
142
+ const key = `ZAPOK_CITATION_${citationIndex - 1}`;
143
+ const tag = `{{${key}}}${url}{{/${key}}}`;
144
+ const data = { key, reference_id: citationIndex++, url };
145
+ result += text.slice(last, start) + tag;
146
+ last = end;
147
+ entities.push(toCitationEntity(data));
148
+ i = end - 1;
149
+ }
150
+ result += text.slice(last);
151
+ return { text: result, entities };
152
+ };
@@ -0,0 +1,30 @@
1
+ import type { SubmessagePayload } from "../payloads.js";
2
+ import type { UnifiedResponseSection } from "./protocol.js";
3
+ export interface RichNode {
4
+ id: string | null;
5
+ section: UnifiedResponseSection | null;
6
+ submessage: SubmessagePayload | null;
7
+ }
8
+ export interface MakeNodeInput {
9
+ id?: string | null | undefined;
10
+ section?: UnifiedResponseSection | null | undefined;
11
+ submessage?: SubmessagePayload | null | undefined;
12
+ }
13
+ export declare class NodeStore {
14
+ #private;
15
+ constructor();
16
+ get nodes(): RichNode[];
17
+ get size(): number;
18
+ ids(): string[];
19
+ has(id: unknown): boolean;
20
+ get(id: string): RichNode;
21
+ indexOf(node: RichNode): number;
22
+ makeNode({ id, section, submessage }: MakeNodeInput): RichNode;
23
+ push(node: RichNode): RichNode;
24
+ pushAll(nodes: RichNode[]): void;
25
+ removeAt(index: number): RichNode;
26
+ removeNode(node: RichNode): RichNode;
27
+ insertAt(index: number, node: RichNode): RichNode;
28
+ replaceAt(index: number, node: RichNode): RichNode;
29
+ clear(): void;
30
+ }
@@ -0,0 +1,121 @@
1
+ import { ValidationError, ItemNotFoundError, DuplicateIdError, InvalidTargetError, } from "../core/errors.js";
2
+ const assertNodeId = (id) => {
3
+ if (id === undefined || id === null || id === "")
4
+ return;
5
+ if (typeof id !== "string")
6
+ throw new ValidationError(`id node harus string non-empty, dapat ${typeof id}`);
7
+ if (!id.trim())
8
+ throw new ValidationError("id node tidak boleh string kosong");
9
+ };
10
+ export class NodeStore {
11
+ #nodes;
12
+ #index;
13
+ constructor() {
14
+ this.#nodes = [];
15
+ this.#index = new Map();
16
+ }
17
+ get nodes() {
18
+ return this.#nodes;
19
+ }
20
+ get size() {
21
+ return this.#nodes.length;
22
+ }
23
+ ids() {
24
+ return this.#nodes
25
+ .filter((node) => node.id)
26
+ .map((node) => node.id);
27
+ }
28
+ has(id) {
29
+ return typeof id === "string" && this.#index.has(id);
30
+ }
31
+ get(id) {
32
+ if (typeof id !== "string" || !id.trim()) {
33
+ throw new ValidationError("id node harus string non-empty");
34
+ }
35
+ const node = this.#index.get(id);
36
+ if (!node)
37
+ throw new ItemNotFoundError(id, this.ids());
38
+ return node;
39
+ }
40
+ indexOf(node) {
41
+ return this.#nodes.indexOf(node);
42
+ }
43
+ #register(node, id) {
44
+ if (id === undefined || id === null || id === "")
45
+ return;
46
+ assertNodeId(id);
47
+ if (this.#index.has(id))
48
+ throw new DuplicateIdError(id);
49
+ node.id = id;
50
+ this.#index.set(id, node);
51
+ }
52
+ #unregister(node) {
53
+ if (node.id && this.#index.get(node.id) === node)
54
+ this.#index.delete(node.id);
55
+ }
56
+ makeNode({ id, section, submessage }) {
57
+ assertNodeId(id);
58
+ return {
59
+ id: id ?? null,
60
+ section: section ?? null,
61
+ submessage: submessage ?? null,
62
+ };
63
+ }
64
+ push(node) {
65
+ this.#register(node, node.id);
66
+ this.#nodes.push(node);
67
+ return node;
68
+ }
69
+ pushAll(nodes) {
70
+ for (const node of nodes)
71
+ this.push(node);
72
+ }
73
+ removeAt(index) {
74
+ if (!Number.isInteger(index) || index < 0 || index >= this.#nodes.length) {
75
+ throw new InvalidTargetError(`index node ${index} di luar rentang (0-${this.#nodes.length - 1})`, { index });
76
+ }
77
+ const [removed] = this.#nodes.splice(index, 1);
78
+ this.#unregister(removed);
79
+ return removed;
80
+ }
81
+ removeNode(node) {
82
+ const index = this.#nodes.indexOf(node);
83
+ if (index === -1)
84
+ throw new InvalidTargetError("node tidak ada di daftar node", {});
85
+ return this.removeAt(index);
86
+ }
87
+ insertAt(index, node) {
88
+ if (!Number.isInteger(index) || index < 0 || index > this.#nodes.length) {
89
+ throw new InvalidTargetError(`index sisip ${index} di luar rentang (0-${this.#nodes.length})`, { index });
90
+ }
91
+ this.#register(node, node.id);
92
+ this.#nodes.splice(index, 0, node);
93
+ return node;
94
+ }
95
+ replaceAt(index, node) {
96
+ if (!Number.isInteger(index) || index < 0 || index >= this.#nodes.length) {
97
+ throw new InvalidTargetError(`index node ${index} di luar rentang (0-${this.#nodes.length - 1})`, { index });
98
+ }
99
+ const old = this.#nodes[index];
100
+ const newId = node.id;
101
+ if (newId && newId !== old.id) {
102
+ assertNodeId(newId);
103
+ if (this.#index.has(newId))
104
+ throw new DuplicateIdError(newId);
105
+ }
106
+ this.#unregister(old);
107
+ if (!newId && old.id) {
108
+ node.id = old.id;
109
+ this.#index.set(node.id, node);
110
+ }
111
+ else if (node.id) {
112
+ this.#index.set(node.id, node);
113
+ }
114
+ this.#nodes.splice(index, 1, node);
115
+ return node;
116
+ }
117
+ clear() {
118
+ this.#nodes = [];
119
+ this.#index = new Map();
120
+ }
121
+ }
@@ -0,0 +1,144 @@
1
+ import { type UnifiedResponseSection } from "./protocol.js";
2
+ export declare const EXPERIMENTAL_PRIMITIVES: {
3
+ readonly source: "GenAISearchResultPrimitive";
4
+ readonly image: "GenAIImaginePrimitive";
5
+ readonly video: "GenAIImaginePrimitive";
6
+ readonly footerAction: "GenAIFooterActionPrimitive";
7
+ readonly widget: "GenAI3PExtWidgetPrimitive";
8
+ readonly product: "GenAIProductItemCardPrimitive";
9
+ readonly post: "GenAIPostPrimitive";
10
+ readonly reels: "GenAIReelPrimitive";
11
+ readonly html: "GenAIaeacdsnwHtmlPrimitive";
12
+ };
13
+ export interface SourceObjectItem {
14
+ favicon?: string;
15
+ icon?: string;
16
+ url?: string;
17
+ title?: string;
18
+ subtitle?: string;
19
+ }
20
+ export type SourceInput = string | (string | undefined)[] | SourceObjectItem;
21
+ export interface SourceSectionOptions {
22
+ layout?: string | undefined;
23
+ }
24
+ export declare const sourceSection: (sources: SourceInput[], { layout: layoutName }?: SourceSectionOptions) => UnifiedResponseSection;
25
+ export interface ImageSectionOptions {
26
+ width?: number | undefined;
27
+ height?: number | undefined;
28
+ status?: string | undefined;
29
+ update_text?: string | undefined;
30
+ }
31
+ export declare const imageSection: (url: string, { width, height, status, update_text: updateText, }?: ImageSectionOptions) => UnifiedResponseSection;
32
+ export interface VideoSectionOptions {
33
+ mime_type?: string | undefined;
34
+ file_length?: number | undefined;
35
+ duration?: number | undefined;
36
+ status?: string | undefined;
37
+ }
38
+ export declare const videoSection: (url: string, { mime_type: mimeType, file_length: fileLength, duration, status, }?: VideoSectionOptions) => UnifiedResponseSection;
39
+ export interface FooterActionItem {
40
+ text?: string;
41
+ cta_text?: string;
42
+ type?: string;
43
+ cta_type?: string;
44
+ url?: string;
45
+ cta_url?: string;
46
+ }
47
+ export interface SectionLayoutOptions {
48
+ layout?: string | undefined;
49
+ }
50
+ export declare const footerActionSection: (data: FooterActionItem | FooterActionItem[], { layout: layoutName }?: SectionLayoutOptions) => UnifiedResponseSection;
51
+ export interface WidgetActionToast {
52
+ label?: string;
53
+ }
54
+ export interface WidgetAction {
55
+ label?: string;
56
+ state?: string;
57
+ kind?: string;
58
+ tool_call_id?: string;
59
+ id?: string;
60
+ toast?: WidgetActionToast;
61
+ }
62
+ export interface WidgetItem {
63
+ title?: string;
64
+ header?: Record<string, unknown>;
65
+ sections?: unknown[];
66
+ actions?: WidgetAction[];
67
+ body?: Record<string, unknown>;
68
+ }
69
+ export declare const widgetSection: (data: WidgetItem | WidgetItem[], { layout: layoutName }?: SectionLayoutOptions) => UnifiedResponseSection;
70
+ export interface ProductItem {
71
+ title?: string;
72
+ brand?: string;
73
+ price?: string;
74
+ sale_price?: string;
75
+ product_url?: string;
76
+ url?: string;
77
+ image_url?: string;
78
+ image?: string;
79
+ icon_url?: string;
80
+ icon?: string;
81
+ }
82
+ export declare const productSection: (data: ProductItem | ProductItem[], { layout: layoutName }?: SectionLayoutOptions) => UnifiedResponseSection;
83
+ export interface PostItem {
84
+ title?: string;
85
+ subtitle?: string;
86
+ username?: string;
87
+ profile_picture_url?: string;
88
+ profile_url?: string;
89
+ profile?: string;
90
+ is_verified?: boolean;
91
+ verified?: boolean;
92
+ thumbnail_url?: string;
93
+ thumbnail?: string;
94
+ post_caption?: string;
95
+ caption?: string;
96
+ likes_count?: number;
97
+ like?: number;
98
+ comments_count?: number;
99
+ comment?: number;
100
+ shares_count?: number;
101
+ share?: number;
102
+ post_url?: string;
103
+ url?: string;
104
+ post_deeplink?: string;
105
+ deeplink?: string;
106
+ source_app?: string;
107
+ source?: string;
108
+ footer_label?: string;
109
+ footer?: string;
110
+ footer_icon?: string;
111
+ icon?: string;
112
+ orientation?: string;
113
+ post_type?: string;
114
+ }
115
+ export declare const postSection: (data: PostItem | PostItem[], { layout: layoutName }?: SectionLayoutOptions) => UnifiedResponseSection;
116
+ export interface ReelsItem {
117
+ videoUrl?: string;
118
+ url?: string;
119
+ thumbnailUrl?: string;
120
+ thumbnail?: string;
121
+ username?: string;
122
+ profileIconUrl?: string;
123
+ profile?: string;
124
+ reels_title?: string;
125
+ title?: string;
126
+ likes_count?: number;
127
+ like?: number;
128
+ shares_count?: number;
129
+ share?: number;
130
+ view_count?: number;
131
+ view?: number;
132
+ reel_source?: string;
133
+ source?: string;
134
+ is_verified?: boolean;
135
+ verified?: boolean;
136
+ }
137
+ export interface ReelsSectionOptions {
138
+ layout?: string | undefined;
139
+ }
140
+ export declare const reelsSection: (data: ReelsItem | ReelsItem[], { layout: layoutName }?: ReelsSectionOptions) => UnifiedResponseSection;
141
+ export interface HtmlSectionOptions {
142
+ trusted_sources?: unknown[] | undefined;
143
+ }
144
+ export declare const htmlSection: (html: string, { trusted_sources: trustedSources }?: HtmlSectionOptions) => UnifiedResponseSection;