New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@bucketco/react-sdk

Package Overview
Dependencies
Maintainers
0
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bucketco/react-sdk - npm Package Compare versions

Comparing version

to
3.1.2

82

dist/src/index.d.ts

@@ -5,7 +5,67 @@ import { default as React, ReactNode } from 'react';

export type { CheckEvent, CompanyContext, RawFeatures, TrackEvent, UserContext, };
export type EmptyFeatureRemoteConfig = {
key: undefined;
payload: undefined;
};
export type FeatureType = {
config?: {
payload: any;
};
};
/**
* A remotely managed configuration value for a feature.
*/
export type FeatureRemoteConfig = {
/**
* The key of the matched configuration value.
*/
key: string;
/**
* The optional user-supplied payload data.
*/
payload: any;
} | EmptyFeatureRemoteConfig;
/**
* Describes a feature
*/
export interface Feature<TConfig extends FeatureType["config"] | undefined = EmptyFeatureRemoteConfig> {
/**
* The key of the feature.
*/
key: string;
/**
* If the feature is enabled.
*/
isEnabled: boolean;
/**
* If the feature is loading.
*/
isLoading: boolean;
config: TConfig extends undefined ? EmptyFeatureRemoteConfig : TConfig & {
key: string;
};
/**
* Track feature usage in Bucket.
*/
track(): Promise<Response | undefined> | undefined;
/**
* Request feedback from the user.
*/
requestFeedback: (opts: RequestFeedbackOptions) => void;
}
export interface Features {
}
type MaterializedFeatures = keyof Features extends never ? Record<string, any> : Features;
export type FeatureKey = keyof MaterializedFeatures;
/**
* Describes a collection of evaluated feature.
*
* @remarks
* This types falls back to a generic Record<string, Feature> if the Features interface
* has not been extended.
*
*/
export type TypedFeatures = keyof Features extends never ? Record<string, Feature> : {
[TypedFeatureKey in keyof Features]: Features[TypedFeatureKey] extends FeatureType ? Feature<Features[TypedFeatureKey]["config"]> : Feature;
};
export type FeatureKey = keyof TypedFeatures;
/**
* Props for the BucketProvider.

@@ -37,17 +97,3 @@ */

export declare function BucketProvider({ children, user, company, otherContext, loadingComponent, newBucketClient, ...config }: BucketProps): React.JSX.Element;
type RequestFeedbackOptions = Omit<RequestFeedbackData, "featureKey" | "featureId">;
type EmptyConfig = {
key: undefined;
payload: undefined;
};
export type Feature<TKey extends FeatureKey> = {
isEnabled: boolean;
isLoading: boolean;
config: MaterializedFeatures[TKey] extends boolean ? EmptyConfig : {
key: string;
payload: MaterializedFeatures[TKey];
} | EmptyConfig;
track: () => void;
requestFeedback: (opts: RequestFeedbackOptions) => void;
};
export type RequestFeedbackOptions = Omit<RequestFeedbackData, "featureKey" | "featureId">;
/**

@@ -64,3 +110,3 @@ * Returns the state of a given feature for the current context, e.g.

*/
export declare function useFeature<TKey extends FeatureKey>(key: TKey): Feature<typeof key>;
export declare function useFeature<TKey extends FeatureKey>(key: TKey): TypedFeatures[TKey];
/**

@@ -67,0 +113,0 @@ * Returns a function to send an event when a user performs an action

{
"name": "@bucketco/react-sdk",
"version": "3.1.1",
"version": "3.1.2",
"license": "MIT",

@@ -69,3 +69,3 @@ "repository": {

},
"gitHead": "10eae8456d53e5fe8b238646ce977e941b00541b"
"gitHead": "cbca2686a2577324babd01a78190e9942d773356"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet