@get-bb/plugin-sdk 0.4.108 → 0.5.8

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.
@@ -7,7 +7,7 @@
7
7
 
8
8
  import { ReactNode, ComponentType } from 'react';
9
9
  import { RenderResult } from '@testing-library/react';
10
- import { ExperimentalSidebarFooterItemRegistration, PluginProviderIconRegistration, PluginHomepageSectionRegistration, PluginSettingsSectionRegistration, ExperimentalAppOverlayRegistration, PluginNavPanelRegistration, PluginThreadPanelActionRegistration, PluginNewThreadPanelActionRegistration, ComposerCustomization, PluginPendingInteractionRegistration, PluginSidebarFooterActionRegistration, ExperimentalSidebarNavigationRegistration, PluginThreadListRegistration, PluginThreadHeaderActionRegistration, ExperimentalPluginBrowserToolbarActionRegistration, PluginFileOpenerRegistration, PluginSourceCodeRendererRegistration, PluginDiffRendererRegistration, PluginMessageDirectiveRegistration, PluginMessageActionRegistration, ExperimentalIconRegistration, PluginTimelineRendererRegistration, PluginEnvironmentProviderInputsRegistration, PluginMachineProviderInputsRegistration, PluginContentScriptRegistration, PluginComposerScope, PluginComposerTextEffect, PluginComposerMention, ExperimentalComposerSubmitOptions, ExperimentalComposerSelection, PluginComposerThreadRowStatus, ExperimentalOpenFixedTabOptions, JsonValue, BbNavigate, ExperimentalFileOpenOptions, PluginAppDefinition, PluginRpcContract, StandardSchemaV1InferInput, PluginRpcResult, PluginRealtimeConnectionState, PluginSidebarThreadsState, PluginProvidersState, PluginCodeThemeState, BranchesState, CheckoutState, PluginSidebarPullRequest, PluginSidebarThreadActions } from '@get-bb/plugin-sdk';
10
+ import { ExperimentalSidebarFooterItemRegistration, PluginProviderIconRegistration, PluginHomepageSectionRegistration, PluginSettingsSectionRegistration, ExperimentalAppOverlayRegistration, PluginNavPanelRegistration, PluginThreadPanelActionRegistration, PluginNewThreadPanelActionRegistration, ComposerCustomization, PluginPendingInteractionRegistration, PluginSidebarFooterActionRegistration, ExperimentalSidebarNavigationRegistration, PluginThreadListRegistration, PluginThreadHeaderActionRegistration, ExperimentalPluginBrowserToolbarActionRegistration, PluginFileOpenerRegistration, PluginSourceCodeRendererRegistration, PluginDiffRendererRegistration, PluginMessageDirectiveRegistration, PluginMessageActionRegistration, ExperimentalIconRegistration, PluginTimelineRendererRegistration, PluginEnvironmentProviderInputsRegistration, PluginMachineProviderInputsRegistration, PluginContentScriptRegistration, PluginComposerScope, PluginComposerTextEffect, PluginComposerMention, ExperimentalComposerSubmitOptions, ExperimentalComposerSelection, PluginComposerThreadRowStatus, ExperimentalOpenFixedTabOptions, JsonValue, BbNavigate, ExperimentalFileOpenOptions, PluginAppDefinition, PluginRpcContract, StandardSchemaV1InferInput, PluginRpcResult, PluginBrowserBbSdk, PluginRealtimeConnectionState, PluginSidebarThreadsState, PluginProvidersState, PluginCodeThemeState, BranchesState, CheckoutState, PluginSidebarPullRequest, PluginSidebarThreadRowStatus, PluginSidebarThreadShortcut, PluginSidebarSplitLayout, PluginEnvironmentProvidersState, PluginSidebarThreadActions } from '@get-bb/plugin-sdk';
11
11
 
12
12
  type ExperimentalSidebarFooterCommandKind = "close" | "open" | "toggle";
13
13
  interface ExperimentalSidebarFooterRuntimeSnapshot {
@@ -56,6 +56,21 @@ interface RpcCall {
56
56
  method: string;
57
57
  input: unknown;
58
58
  }
59
+ /** One recorded `useSdk()` call, as `"<area>.<method>"` plus its arguments. */
60
+ interface SdkCall {
61
+ method: string;
62
+ args: unknown[];
63
+ }
64
+ type PluginSdkFakeTree<T> = {
65
+ [Key in keyof T]?: T[Key] extends (...args: never[]) => unknown ? T[Key] : PluginSdkFakeTree<T[Key]>;
66
+ };
67
+ /**
68
+ * Nested partial fakes for `useSdk()`, mirroring the client's areas and
69
+ * sub-areas (`{ threads: { queuedMessages: { create } } }`). Provide only the
70
+ * methods the slot calls; a call to anything else throws with the missing
71
+ * dot-path so the test fails loudly instead of returning undefined.
72
+ */
73
+ type PluginSdkTestFakes = PluginSdkFakeTree<PluginBrowserBbSdk>;
59
74
  type NavigateCall = {
60
75
  method: "toThread";
61
76
  threadId: string;
@@ -260,6 +275,35 @@ interface RenderSlotOptions<Contract extends PluginRpcContract = PluginRpcContra
260
275
  * by thread id. Omitted → every thread reports none.
261
276
  */
262
277
  sidebarPullRequests?: Record<string, PluginSidebarPullRequest>;
278
+ /**
279
+ * Thread ids `useSidebarThreadDraft()` and `useSidebarThreadDraftIds()`
280
+ * report as holding an unsent draft. Omitted → none.
281
+ */
282
+ sidebarDraftThreadIds?: readonly string[];
283
+ /**
284
+ * Row statuses `useSidebarThreadRowStatus()` reports, keyed by thread id.
285
+ * Omitted → every thread reports null.
286
+ */
287
+ sidebarRowStatuses?: Record<string, PluginSidebarThreadRowStatus>;
288
+ /**
289
+ * Shortcuts `useSidebarThreadShortcut()` reports, keyed by thread id, as
290
+ * if the app command modifier were held. Omitted → every thread reports
291
+ * null.
292
+ */
293
+ sidebarShortcuts?: Record<string, PluginSidebarThreadShortcut>;
294
+ /** The split layout `useSidebarSplitLayout()` reports. Omitted → null. */
295
+ sidebarSplitLayout?: PluginSidebarSplitLayout;
296
+ /**
297
+ * The environment provider catalog `useEnvironmentProviders()` reports.
298
+ * Omitted → a ready, empty list. Pass `{ status: "loading" }` to test that
299
+ * branch.
300
+ */
301
+ environmentProviders?: Partial<PluginEnvironmentProvidersState>;
302
+ /**
303
+ * Fakes for `useSdk()`, one partial object per area. Calls are recorded
304
+ * in `inspection.sdkCalls`; a call to a method you did not provide throws.
305
+ */
306
+ sdk?: PluginSdkTestFakes;
263
307
  /** Host acceptance for `useBbNavigate().openThreadPanel`. */
264
308
  openThreadPanel?: (options: Parameters<BbNavigate["openThreadPanel"]>[0]) => boolean;
265
309
  /** Host acceptance for URL intents from the hook or `UrlLink`. */
@@ -301,6 +345,8 @@ interface RenderedSlotInspectionState {
301
345
  readonly experimental_fixedTabOpenCalls: ExperimentalFixedTabOpenCall[];
302
346
  /** Every `experimental_useSidebarThreadActions()` call, in order. */
303
347
  readonly sidebarActionCalls: SidebarActionCall[];
348
+ /** Every `useSdk()` call, in order, as `"<area>.<method>"`. */
349
+ readonly sdkCalls: SdkCall[];
304
350
  /** Everything written through `useComposer()`. */
305
351
  readonly composer: ComposerLog;
306
352
  }
@@ -323,4 +369,4 @@ declare function renderSlot<Props extends object, Contract extends PluginRpcCont
323
369
  }, props: Props, options?: RenderSlotOptions<Contract>): RenderedSlot;
324
370
 
325
371
  export { installTestPluginRuntime, loadPluginApp, mountPluginContentScripts, renderSlot };
326
- export type { CapturedPluginApp, ComposerLog, ContentScriptTestMountOptions, ContentScriptThreadRowStatusCall, ExperimentalFixedTabOpenCall, MountedPluginContentScripts, NavigateCall, PluginAppSource, PluginRpcTestHandlers, RenderSlotOptions, RenderedSlot, RenderedSlotBehaviorDrivers, RenderedSlotInspectionState, RenderedSlotLifecycleControls, RpcCall, SidebarActionCall };
372
+ export type { CapturedPluginApp, ComposerLog, ContentScriptTestMountOptions, ContentScriptThreadRowStatusCall, ExperimentalFixedTabOpenCall, MountedPluginContentScripts, NavigateCall, PluginAppSource, PluginRpcTestHandlers, PluginSdkTestFakes, RenderSlotOptions, RenderedSlot, RenderedSlotBehaviorDrivers, RenderedSlotInspectionState, RenderedSlotLifecycleControls, RpcCall, SdkCall, SidebarActionCall };