@mrrocket/sdk 0.26.0 → 0.27.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;
@@ -292,7 +303,11 @@ declare const createApi: (c: Conn) => {
292
303
  articles: (q?: string, signal?: AbortSignal) => Promise<{
293
304
  articles: ArticleSummary[];
294
305
  }>;
295
- article: (id: string, signal?: AbortSignal) => Promise<Article>;
306
+ /**
307
+ * One article as blocks. `blocks` names the newer kinds of block this widget draws ("table", 0.27.0): MRRocket
308
+ * sends those only when asked, so a widget that draws none (older versions, the apps) keeps getting lines of text.
309
+ */
310
+ article: (id: string, signal?: AbortSignal, blocks?: string) => Promise<Article>;
296
311
  messengerLook: (signal?: AbortSignal) => Promise<MessengerLook>;
297
312
  rateArticle: (id: string, helpful: boolean) => Promise<{
298
313
  counted: boolean;
@@ -842,7 +857,7 @@ interface PaywallHost {
842
857
 
843
858
  type VariantId = string;
844
859
  /** 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";
860
+ declare const SDK_VERSION = "0.27.0";
846
861
  /** One variant of an experiment. `changes` replaces texts that the page marks with `<Text id>`. */
847
862
  interface VariantConfig {
848
863
  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;
@@ -292,7 +303,11 @@ declare const createApi: (c: Conn) => {
292
303
  articles: (q?: string, signal?: AbortSignal) => Promise<{
293
304
  articles: ArticleSummary[];
294
305
  }>;
295
- article: (id: string, signal?: AbortSignal) => Promise<Article>;
306
+ /**
307
+ * One article as blocks. `blocks` names the newer kinds of block this widget draws ("table", 0.27.0): MRRocket
308
+ * sends those only when asked, so a widget that draws none (older versions, the apps) keeps getting lines of text.
309
+ */
310
+ article: (id: string, signal?: AbortSignal, blocks?: string) => Promise<Article>;
296
311
  messengerLook: (signal?: AbortSignal) => Promise<MessengerLook>;
297
312
  rateArticle: (id: string, helpful: boolean) => Promise<{
298
313
  counted: boolean;
@@ -842,7 +857,7 @@ interface PaywallHost {
842
857
 
843
858
  type VariantId = string;
844
859
  /** 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";
860
+ declare const SDK_VERSION = "0.27.0";
846
861
  /** One variant of an experiment. `changes` replaces texts that the page marks with `<Text id>`. */
847
862
  interface VariantConfig {
848
863
  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.27.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
  };