@select-org/select-post-builder 1.4.2 → 1.5.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.
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;
@@ -191,6 +200,12 @@ export declare enum EditorTypes {
191
200
  */
192
201
  export declare const ensurePollMinimum: (items: PollChoiceItem[]) => PollChoiceItem[];
193
202
 
203
+ /**
204
+ * The host's token source. The post builder calls it before every API request.
205
+ * Resolve `null` to send the request without credentials.
206
+ */
207
+ export declare type GetAuthToken = (request: AuthTokenRequest) => Promise<string | null>;
208
+
194
209
  declare interface ImageInfo {
195
210
  width: number;
196
211
  height: number;
@@ -259,7 +274,10 @@ export declare interface PostBuilderConfig {
259
274
  mfs: string;
260
275
  fileStore: string;
261
276
  };
262
- authToken: string;
277
+ /** Ignored when `getAuthToken` is given. */
278
+ authToken?: string;
279
+ /** A new function takes effect on the next request, without remounting editors. */
280
+ getAuthToken?: GetAuthToken;
263
281
  toI18N: (key: string) => string;
264
282
  i18nKeys?: Partial<PostBuilderI18nKeys>;
265
283
  logEvent: (name: string, properties: Record<string, unknown>) => void;
@@ -395,7 +413,7 @@ declare interface PostBuilderI18nKeys {
395
413
  uploadsInProgressKey: string;
396
414
  }
397
415
 
398
- export declare const PostBuilderProvider: ({ children, apiBaseURL, authToken, toI18N, i18nKeys, logEvent, allowSendWhileUploading, unauthenticatedMode, }: PostBuilderConfig) => JSX_2.Element;
416
+ export declare const PostBuilderProvider: ({ children, apiBaseURL, authToken, getAuthToken, toI18N, i18nKeys, logEvent, allowSendWhileUploading, unauthenticatedMode, }: PostBuilderConfig) => JSX_2.Element;
399
417
 
400
418
  declare type PostCreationData = {
401
419
  body: string;
@@ -538,22 +556,6 @@ declare module '@tiptap/core' {
538
556
  }
539
557
 
540
558
 
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
559
  declare module '@tiptap/core' {
558
560
  interface Commands<ReturnType> {
559
561
  customLink: {
@@ -582,6 +584,22 @@ declare module '@tiptap/core' {
582
584
  }
583
585
 
584
586
 
587
+ declare module '@tiptap/core' {
588
+ interface Commands<ReturnType> {
589
+ iframe: {
590
+ /**
591
+ * Insert an iframe node into the document
592
+ */
593
+ setIframe: (options: {
594
+ src: string;
595
+ width?: string;
596
+ height?: string;
597
+ }) => ReturnType;
598
+ };
599
+ }
600
+ }
601
+
602
+
585
603
  declare module '@tiptap/core' {
586
604
  interface Commands<ReturnType> {
587
605
  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-8pZEwyr_.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-D7pfEQso.mjs";
2
2
  import "react";
3
3
  export {
4
4
  a as EditorPlacement,