Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

typedoc
typedoc --treatWarningsAsErrors

# We need to fix the links in the generated markdown files.
# Typedoc generates anchors for properties in tables which can collide with anchors for types.
Expand Down
5 changes: 3 additions & 2 deletions packages/browser-sdk/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
RequestFeedbackOptions,
} from "./feedback/feedback";
import * as feedbackLib from "./feedback/ui";
import { ToolbarPosition } from "./toolbar/Toolbar";
import { ToolbarPosition } from "./ui/types";
import { API_BASE_URL, APP_BASE_URL, SSE_REALTIME_BASE_URL } from "./config";
import { BucketContext, CompanyContext, UserContext } from "./context";
import { HookArgs, HooksManager } from "./hooksManager";
Expand Down Expand Up @@ -145,7 +145,7 @@ export type PayloadContext = {
/**
* BucketClient configuration.
*/
interface Config {
export interface Config {
/**
* Base URL of Bucket servers.
*/
Expand Down Expand Up @@ -499,6 +499,7 @@ export class BucketClient {
* @param type Type of event to remove.
* @param handler The same function that was passed to `on`.
*
* @returns A function to remove the hook.
*/
off<THookType extends keyof HookArgs>(
type: THookType,
Expand Down
1 change: 0 additions & 1 deletion packages/browser-sdk/src/feedback/feedback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export type RequestFeedbackData = Omit<
* copy of the feedback in your own application or CRM.
*
* @param {Object} data
* @param data.
*/
onAfterSubmit?: (data: FeedbackSubmission) => void;

Expand Down
3 changes: 0 additions & 3 deletions packages/browser-sdk/src/hooksManager.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { CheckEvent, RawFeatures } from "./feature/features";
import { CompanyContext, UserContext } from "./context";

/**
* @internal
*/
export interface HookArgs {
/**
* Deprecated: Use `check` instead.
Expand Down
18 changes: 16 additions & 2 deletions packages/browser-sdk/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
export type { Feature, InitOptions, ToolbarOptions } from "./client";
export type {
Config,
Feature,
FeatureRemoteConfig,
InitOptions,
ToolbarOptions,
} from "./client";
export { BucketClient } from "./client";
export type { BucketContext, CompanyContext, UserContext } from "./context";
export type {
CheckEvent,
FallbackFeatureOverride,
FetchedFeature,
RawFeature,
RawFeatures,
} from "./feature/features";
Expand All @@ -28,6 +35,13 @@ export type {
OnScoreSubmitResult,
OpenFeedbackFormOptions,
} from "./feedback/ui/types";
export type { TrackEvent } from "./hooksManager";
export type { HookArgs, TrackEvent } from "./hooksManager";
export type { Logger } from "./logger";
export { feedbackContainerId, propagatedEvents } from "./ui/constants";
export type {
DialogPlacement,
Offset,
PopoverPlacement,
Position,
ToolbarPosition,
} from "./ui/types";
6 changes: 1 addition & 5 deletions packages/browser-sdk/src/toolbar/Toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { BucketClient } from "../client";
import { toolbarContainerId } from "../ui/constants";
import { Dialog, DialogContent, DialogHeader, useDialog } from "../ui/Dialog";
import { Logo } from "../ui/icons/Logo";
import { DialogPlacement, Offset } from "../ui/types";
import { ToolbarPosition } from "../ui/types";
import { parseUnanchoredPosition } from "../ui/utils";

import { FeatureSearch, FeaturesTable } from "./Features";
Expand All @@ -22,10 +22,6 @@ export type FeatureItem = {
localOverride: boolean | null;
isEnabled: boolean;
};
export interface ToolbarPosition {
placement: DialogPlacement;
offset?: Offset;
}

type Feature = {
key: string;
Expand Down
3 changes: 2 additions & 1 deletion packages/browser-sdk/src/toolbar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import { h, render } from "preact";

import { BucketClient } from "../client";
import { toolbarContainerId } from "../ui/constants";
import { ToolbarPosition } from "../ui/types";
import { attachContainer } from "../ui/utils";

import Toolbar, { ToolbarPosition } from "./Toolbar";
import Toolbar from "./Toolbar";

type showToolbarToggleOptions = {
bucketClient: BucketClient;
Expand Down
5 changes: 5 additions & 0 deletions packages/browser-sdk/src/ui/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,8 @@ export type Position =
anchor: HTMLElement | null;
placement?: PopoverPlacement;
};

export interface ToolbarPosition {
placement: DialogPlacement;
offset?: Offset;
}
8 changes: 1 addition & 7 deletions packages/node-sdk/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,12 +413,7 @@ export class BucketClient {
/**
* Tracks an event in Bucket.

* @param event - The event to track.
* @param userId - The userId of the user who performed the event
* @param opts - The options.
* @param opts.attributes - The attributes of the event (optional).
* @param opts.meta - The meta context associated with tracking (optional).
* @param opts.companyId - Optional company ID for the event (optional).
* @param options.companyId - Optional company ID for the event (optional).
*
* @throws An error if the user is not set or the event is invalid or the options are invalid.
* @remarks
Expand Down Expand Up @@ -1228,7 +1223,6 @@ export class BoundBucketClient {
* @param client - The `BucketClient` to use.
* @param options - The options for the client.
* @param options.enableTracking - Whether to enable tracking for the client.
* @param options.context - The context for the client.
*
* @internal
*/
Expand Down
6 changes: 6 additions & 0 deletions packages/node-sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,24 @@ export type {
ClientOptions,
Context,
ContextWithTracking,
EmptyFeatureRemoteConfig,
Feature,
FeatureOverride,
FeatureOverrides,
FeatureOverridesFn,
FeatureRemoteConfig,
Features,
FullFeatureOverride,
HttpClient,
HttpClientResponse,
IdType,
LOG_LEVELS,
Logger,
LogLevel,
RawFeature,
RawFeatureRemoteConfig,
TrackingMeta,
TrackOptions,
TypedFeatureKey,
TypedFeatures,
} from "./types";
8 changes: 4 additions & 4 deletions packages/node-sdk/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export interface RawFeature {
missingContextFields?: string[];
}

type EmptyFeatureRemoteConfig = { key: undefined; payload: undefined };
export type EmptyFeatureRemoteConfig = { key: undefined; payload: undefined };

/**
* A remotely managed configuration value for a feature.
Expand Down Expand Up @@ -171,15 +171,15 @@ export interface Feature<
track(): Promise<void>;
}

type FullFeatureOverride = {
export type FullFeatureOverride = {
isEnabled: boolean;
config?: {
key: string;
payload: any;
};
};

type FeatureOverride = FullFeatureOverride | boolean;
export type FeatureOverride = FullFeatureOverride | boolean;

/**
* Describes a collection of evaluated features.
Expand All @@ -205,7 +205,7 @@ export type TypedFeatures = keyof Features extends never
: Feature;
};

type TypedFeatureKey = keyof TypedFeatures;
export type TypedFeatureKey = keyof TypedFeatures;

/**
* Describes the feature overrides.
Expand Down
6 changes: 3 additions & 3 deletions packages/react-sdk/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export interface Features {}

const SDK_VERSION = `react-sdk/${version}`;

type MaterializedFeatures = keyof Features extends never
export type MaterializedFeatures = keyof Features extends never
? Record<string, any>
: Features;

Expand Down Expand Up @@ -167,12 +167,12 @@ export function BucketProvider({
);
}

type RequestFeedbackOptions = Omit<
export type RequestFeedbackOptions = Omit<
RequestFeedbackData,
"featureKey" | "featureId"
>;

type EmptyConfig = {
export type EmptyConfig = {
key: undefined;
payload: undefined;
};
Expand Down