@mrrocket/sdk 0.26.0 → 0.28.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.
@@ -107,6 +107,8 @@ interface ChatMessage {
107
107
  from: "visitor" | "team" | "ai" | "auto";
108
108
  body: string;
109
109
  at: string;
110
+ /** A team reply's sender, by first name (servers from 2026-11-19 on): "Lukas · Team". */
111
+ name?: string;
110
112
  /** Help articles an answer drew on (servers from SDK 0.9 on). */
111
113
  articles?: {
112
114
  id: string;
@@ -143,6 +145,15 @@ type ArticleBlock = {
143
145
  text: string;
144
146
  } | {
145
147
  type: "hr";
148
+ }
149
+ /**
150
+ * A table (0.27.0): `head` is its first row when it has one (else empty), every row has the same number of cells.
151
+ * Sent only to a widget that asks for it (`article(id, signal, "table")`); every other one gets the rows as a list.
152
+ */
153
+ | {
154
+ type: "table";
155
+ head: ArticleSpan[][];
156
+ rows: ArticleSpan[][][];
146
157
  };
147
158
  interface Article {
148
159
  id: string;
@@ -205,10 +216,12 @@ interface ChatSummary {
205
216
  }
206
217
  /** One chat (the one asked for, else the visitor's newest, open or closed) and its messages. */
207
218
  interface ChatThread {
219
+ /** `typing`: the team's AI agent is writing an answer in it right now (server 2026-11-27; older servers leave it out). */
208
220
  conversation: {
209
221
  id: string;
210
222
  status: "open" | "solved";
211
223
  seenAt?: string;
224
+ typing?: boolean;
212
225
  } | null;
213
226
  messages: ChatMessage[];
214
227
  /** All the visitor's conversations, the latest activity first (0.19). */
@@ -292,7 +305,11 @@ declare const createApi: (c: Conn) => {
292
305
  articles: (q?: string, signal?: AbortSignal) => Promise<{
293
306
  articles: ArticleSummary[];
294
307
  }>;
295
- article: (id: string, signal?: AbortSignal) => Promise<Article>;
308
+ /**
309
+ * One article as blocks. `blocks` names the newer kinds of block this widget draws ("table", 0.27.0): MRRocket
310
+ * sends those only when asked, so a widget that draws none (older versions, the apps) keeps getting lines of text.
311
+ */
312
+ article: (id: string, signal?: AbortSignal, blocks?: string) => Promise<Article>;
296
313
  messengerLook: (signal?: AbortSignal) => Promise<MessengerLook>;
297
314
  rateArticle: (id: string, helpful: boolean) => Promise<{
298
315
  counted: boolean;
@@ -842,7 +859,7 @@ interface PaywallHost {
842
859
 
843
860
  type VariantId = string;
844
861
  /** This build of the SDK. Sent with the config request so MRRocket knows what the site runs (error tracking, flags). */
845
- declare const SDK_VERSION = "0.26.0";
862
+ declare const SDK_VERSION = "0.28.0";
846
863
  /** One variant of an experiment. `changes` replaces texts that the page marks with `<Text id>`. */
847
864
  interface VariantConfig {
848
865
  id: VariantId;
@@ -107,6 +107,8 @@ interface ChatMessage {
107
107
  from: "visitor" | "team" | "ai" | "auto";
108
108
  body: string;
109
109
  at: string;
110
+ /** A team reply's sender, by first name (servers from 2026-11-19 on): "Lukas · Team". */
111
+ name?: string;
110
112
  /** Help articles an answer drew on (servers from SDK 0.9 on). */
111
113
  articles?: {
112
114
  id: string;
@@ -143,6 +145,15 @@ type ArticleBlock = {
143
145
  text: string;
144
146
  } | {
145
147
  type: "hr";
148
+ }
149
+ /**
150
+ * A table (0.27.0): `head` is its first row when it has one (else empty), every row has the same number of cells.
151
+ * Sent only to a widget that asks for it (`article(id, signal, "table")`); every other one gets the rows as a list.
152
+ */
153
+ | {
154
+ type: "table";
155
+ head: ArticleSpan[][];
156
+ rows: ArticleSpan[][][];
146
157
  };
147
158
  interface Article {
148
159
  id: string;
@@ -205,10 +216,12 @@ interface ChatSummary {
205
216
  }
206
217
  /** One chat (the one asked for, else the visitor's newest, open or closed) and its messages. */
207
218
  interface ChatThread {
219
+ /** `typing`: the team's AI agent is writing an answer in it right now (server 2026-11-27; older servers leave it out). */
208
220
  conversation: {
209
221
  id: string;
210
222
  status: "open" | "solved";
211
223
  seenAt?: string;
224
+ typing?: boolean;
212
225
  } | null;
213
226
  messages: ChatMessage[];
214
227
  /** All the visitor's conversations, the latest activity first (0.19). */
@@ -292,7 +305,11 @@ declare const createApi: (c: Conn) => {
292
305
  articles: (q?: string, signal?: AbortSignal) => Promise<{
293
306
  articles: ArticleSummary[];
294
307
  }>;
295
- article: (id: string, signal?: AbortSignal) => Promise<Article>;
308
+ /**
309
+ * One article as blocks. `blocks` names the newer kinds of block this widget draws ("table", 0.27.0): MRRocket
310
+ * sends those only when asked, so a widget that draws none (older versions, the apps) keeps getting lines of text.
311
+ */
312
+ article: (id: string, signal?: AbortSignal, blocks?: string) => Promise<Article>;
296
313
  messengerLook: (signal?: AbortSignal) => Promise<MessengerLook>;
297
314
  rateArticle: (id: string, helpful: boolean) => Promise<{
298
315
  counted: boolean;
@@ -842,7 +859,7 @@ interface PaywallHost {
842
859
 
843
860
  type VariantId = string;
844
861
  /** This build of the SDK. Sent with the config request so MRRocket knows what the site runs (error tracking, flags). */
845
- declare const SDK_VERSION = "0.26.0";
862
+ declare const SDK_VERSION = "0.28.0";
846
863
  /** One variant of an experiment. `changes` replaces texts that the page marks with `<Text id>`. */
847
864
  interface VariantConfig {
848
865
  id: VariantId;
@@ -114,7 +114,7 @@ var onLocale = (fn) => {
114
114
  };
115
115
 
116
116
  // src/core.ts
117
- var SDK_VERSION = "0.26.0";
117
+ var SDK_VERSION = "0.28.0";
118
118
  var propOf = (person, name) => {
119
119
  const want = name.trim().toLowerCase();
120
120
  for (const [k, v] of Object.entries(person)) if (k.toLowerCase() === want) return v;
@@ -1340,7 +1340,11 @@ var createApi = (c) => {
1340
1340
  /** Where a sent file of this visitor's chat is read (an image's src, a PDF's link). */
1341
1341
  attachmentUrl: (id) => `${base}/messages/attachments/${encodeURIComponent(id)}?${qs(me, "")}`,
1342
1342
  articles: (q, signal) => call(`${base}/articles?${qs({ key: c.apiKey, q })}`, void 0, signal),
1343
- article: (id, signal) => call(`${base}/articles/${encodeURIComponent(id)}?${qs(me)}`, void 0, signal),
1343
+ /**
1344
+ * One article as blocks. `blocks` names the newer kinds of block this widget draws ("table", 0.27.0): MRRocket
1345
+ * sends those only when asked, so a widget that draws none (older versions, the apps) keeps getting lines of text.
1346
+ */
1347
+ article: (id, signal, blocks) => call(`${base}/articles/${encodeURIComponent(id)}?${qs({ ...me, blocks })}`, void 0, signal),
1344
1348
  messengerLook: (signal) => call(`${base}/messenger?${qs({ key: c.apiKey })}`, void 0, signal),
1345
1349
  rateArticle: (id, helpful) => post(`/articles/${encodeURIComponent(id)}/rate`, { helpful })
1346
1350
  };