@select-org/select-post-builder 1.4.2 → 1.5.1

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/dist/index.d.ts CHANGED
@@ -41,6 +41,15 @@ declare type AppUserPayload = {
41
41
  email?: string;
42
42
  };
43
43
 
44
+ /**
45
+ * `rejected` is the token the API just answered 401 to. Resolve a different
46
+ * token to replay that request once, or the same token or `null` to fail it.
47
+ * Concurrent 401s each ask, so share one refresh between them.
48
+ */
49
+ export declare type AuthTokenRequest = {
50
+ readonly rejected?: string;
51
+ };
52
+
44
53
  declare type BasePollOptionItem = {
45
54
  key: string;
46
55
  option_id: string;
@@ -123,6 +132,12 @@ declare type BaseProps = {
123
132
  * "Send a group comment..."). Omit to keep the default.
124
133
  */
125
134
  placeholder?: string;
135
+ /**
136
+ * The editor focuses itself when created. Set false to focus without
137
+ * scrolling the page to it, e.g. a composer below server-rendered content.
138
+ * Defaults to true.
139
+ */
140
+ scrollOnAutoFocus?: boolean;
126
141
  };
127
142
 
128
143
  declare type CreatePostCallbackPayload = {
@@ -191,6 +206,12 @@ export declare enum EditorTypes {
191
206
  */
192
207
  export declare const ensurePollMinimum: (items: PollChoiceItem[]) => PollChoiceItem[];
193
208
 
209
+ /**
210
+ * The host's token source. The post builder calls it before every API request.
211
+ * Resolve `null` to send the request without credentials.
212
+ */
213
+ export declare type GetAuthToken = (request: AuthTokenRequest) => Promise<string | null>;
214
+
194
215
  declare interface ImageInfo {
195
216
  width: number;
196
217
  height: number;
@@ -259,7 +280,10 @@ export declare interface PostBuilderConfig {
259
280
  mfs: string;
260
281
  fileStore: string;
261
282
  };
262
- authToken: string;
283
+ /** Ignored when `getAuthToken` is given. */
284
+ authToken?: string;
285
+ /** A new function takes effect on the next request, without remounting editors. */
286
+ getAuthToken?: GetAuthToken;
263
287
  toI18N: (key: string) => string;
264
288
  i18nKeys?: Partial<PostBuilderI18nKeys>;
265
289
  logEvent: (name: string, properties: Record<string, unknown>) => void;
@@ -395,7 +419,7 @@ declare interface PostBuilderI18nKeys {
395
419
  uploadsInProgressKey: string;
396
420
  }
397
421
 
398
- export declare const PostBuilderProvider: ({ children, apiBaseURL, authToken, toI18N, i18nKeys, logEvent, allowSendWhileUploading, unauthenticatedMode, }: PostBuilderConfig) => JSX_2.Element;
422
+ export declare const PostBuilderProvider: ({ children, apiBaseURL, authToken, getAuthToken, toI18N, i18nKeys, logEvent, allowSendWhileUploading, unauthenticatedMode, }: PostBuilderConfig) => JSX_2.Element;
399
423
 
400
424
  declare type PostCreationData = {
401
425
  body: string;
@@ -538,22 +562,6 @@ declare module '@tiptap/core' {
538
562
  }
539
563
 
540
564
 
541
- declare module '@tiptap/core' {
542
- interface Commands<ReturnType> {
543
- iframe: {
544
- /**
545
- * Insert an iframe node into the document
546
- */
547
- setIframe: (options: {
548
- src: string;
549
- width?: string;
550
- height?: string;
551
- }) => ReturnType;
552
- };
553
- }
554
- }
555
-
556
-
557
565
  declare module '@tiptap/core' {
558
566
  interface Commands<ReturnType> {
559
567
  customLink: {
@@ -582,6 +590,22 @@ declare module '@tiptap/core' {
582
590
  }
583
591
 
584
592
 
593
+ declare module '@tiptap/core' {
594
+ interface Commands<ReturnType> {
595
+ iframe: {
596
+ /**
597
+ * Insert an iframe node into the document
598
+ */
599
+ setIframe: (options: {
600
+ src: string;
601
+ width?: string;
602
+ height?: string;
603
+ }) => ReturnType;
604
+ };
605
+ }
606
+ }
607
+
608
+
585
609
  declare module '@tiptap/core' {
586
610
  interface Commands<ReturnType> {
587
611
  smartMediaUpload: {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-DJc4w8wg.js");require("react");exports.EditorPlacement=e.EditorPlacement;exports.EditorTypes=e.EditorTypes;exports.PostBuilderEditor=e.PostBuilderEditor;exports.PostBuilderEvents=e.PostBuilderEvents;exports.PostBuilderProvider=e.PostBuilderProvider;exports.applyResolvedMediaItem=e.applyResolvedMediaItem;exports.applyResolvedMediaItemToHtml=e.applyResolvedMediaItemToHtml;exports.ensurePollMinimum=e.ensurePollMinimum;exports.pendingMediaUids=e.pendingMediaUids;exports.stripPendingMediaFromHtml=e.stripPendingMediaFromHtml;exports.stripPendingMediaFromJsonBody=e.stripPendingMediaFromJsonBody;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-Cm0meUNM.js");require("react");exports.EditorPlacement=e.EditorPlacement;exports.EditorTypes=e.EditorTypes;exports.PostBuilderEditor=e.PostBuilderEditor;exports.PostBuilderEvents=e.PostBuilderEvents;exports.PostBuilderProvider=e.PostBuilderProvider;exports.applyResolvedMediaItem=e.applyResolvedMediaItem;exports.applyResolvedMediaItemToHtml=e.applyResolvedMediaItemToHtml;exports.ensurePollMinimum=e.ensurePollMinimum;exports.pendingMediaUids=e.pendingMediaUids;exports.stripPendingMediaFromHtml=e.stripPendingMediaFromHtml;exports.stripPendingMediaFromJsonBody=e.stripPendingMediaFromJsonBody;
@@ -1,4 +1,4 @@
1
- import { E as a, a as d, P as o, b as r, c as t, d as l, e as m, f as n, p, s as P, h as M } from "./index-EgqA5cJ8.mjs";
1
+ import { E as a, a as d, P as o, b as r, c as t, d as l, e as m, f as n, p, s as P, h as M } from "./index-AwIv2BiW.mjs";
2
2
  import "react";
3
3
  export {
4
4
  a as EditorPlacement,
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { g as getDefaultExportFromCjs } from "./index-EgqA5cJ8.mjs";
2
+ import { g as getDefaultExportFromCjs } from "./index-AwIv2BiW.mjs";
3
3
  import React__default, { useEffect, useState, useRef } from "react";
4
4
  var lottie$2 = { exports: {} }, lottie$1 = lottie$2.exports, hasRequiredLottie;
5
5
  function requireLottie() {