@shiva004/surveys 0.12.2 → 0.12.4
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/elements.js +7625 -6892
- package/dist/flags/OpenFeatureFlags.d.ts +21 -0
- package/dist/flags/openfeature.d.ts +36 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +7718 -6985
- package/dist/openfeature/context/index.d.ts +1 -0
- package/dist/openfeature/context/use-context-mutator.d.ts +27 -0
- package/dist/openfeature/declarative/FeatureFlag.d.ts +68 -0
- package/dist/openfeature/declarative/index.d.ts +1 -0
- package/dist/openfeature/evaluation/index.d.ts +1 -0
- package/dist/openfeature/evaluation/use-feature-flag.d.ts +113 -0
- package/dist/openfeature/index.d.ts +8 -0
- package/dist/openfeature/internal/context.d.ts +21 -0
- package/dist/openfeature/internal/errors.d.ts +3 -0
- package/dist/openfeature/internal/hook-flag-query.d.ts +16 -0
- package/dist/openfeature/internal/index.d.ts +4 -0
- package/dist/openfeature/internal/is-equal.d.ts +11 -0
- package/dist/openfeature/internal/options.d.ts +15 -0
- package/dist/openfeature/internal/suspense.d.ts +18 -0
- package/dist/openfeature/internal/use.d.ts +19 -0
- package/dist/openfeature/options.d.ts +46 -0
- package/dist/openfeature/provider/index.d.ts +5 -0
- package/dist/openfeature/provider/provider.d.ts +27 -0
- package/dist/openfeature/provider/test-provider.d.ts +35 -0
- package/dist/openfeature/provider/use-open-feature-client-status.d.ts +7 -0
- package/dist/openfeature/provider/use-open-feature-client.d.ts +7 -0
- package/dist/openfeature/provider/use-open-feature-provider.d.ts +8 -0
- package/dist/openfeature/provider/use-when-provider-ready.d.ts +14 -0
- package/dist/openfeature/query/index.d.ts +1 -0
- package/dist/openfeature/query/query.d.ts +48 -0
- package/dist/openfeature/sdk/api.d.ts +43 -0
- package/dist/openfeature/sdk/client.d.ts +46 -0
- package/dist/openfeature/sdk/errors.d.ts +38 -0
- package/dist/openfeature/sdk/events.d.ts +10 -0
- package/dist/openfeature/sdk/index.d.ts +8 -0
- package/dist/openfeature/sdk/providers.d.ts +46 -0
- package/dist/openfeature/sdk/types.d.ts +168 -0
- package/dist/openfeature/tracking/index.d.ts +1 -0
- package/dist/openfeature/tracking/use-track.d.ts +15 -0
- package/dist/recorder/RouteRecorderWatcher.d.ts +7 -10
- package/dist/recorder/sessionStore.d.ts +7 -3
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/recorder/capture.d.ts +0 -30
- package/dist/recorder/db.d.ts +0 -6
- package/dist/recorder/recorder.d.ts +0 -45
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { EventEmitter } from './events';
|
|
2
|
+
import { ProviderStatus, type Client, type ClientMetadata, type EvaluationContext, type EvaluationDetails, type EventHandler, type EventOptions, type FlagEvaluationOptions, type Hook, type JsonValue, type Logger, type Provider, type ProviderEvents, type TrackingEventDetails } from './types';
|
|
3
|
+
export type ClientAccessors = {
|
|
4
|
+
provider: () => Provider;
|
|
5
|
+
status: () => ProviderStatus;
|
|
6
|
+
emitter: () => EventEmitter;
|
|
7
|
+
context: (domain?: string) => EvaluationContext;
|
|
8
|
+
apiHooks: () => Hook[];
|
|
9
|
+
logger: () => Logger;
|
|
10
|
+
};
|
|
11
|
+
export declare const registerStatusEvents: (m: Partial<Record<ProviderStatus, ProviderEvents>>) => Partial<Record<ProviderStatus, ProviderEvents>>;
|
|
12
|
+
/**
|
|
13
|
+
* Client bound to a domain. Everything it needs is read through accessors, so it always sees the
|
|
14
|
+
* current provider / status / context even if they are replaced after the client was created.
|
|
15
|
+
*/
|
|
16
|
+
export declare class OpenFeatureClient implements Client {
|
|
17
|
+
private readonly a;
|
|
18
|
+
private readonly options;
|
|
19
|
+
private _hooks;
|
|
20
|
+
constructor(a: ClientAccessors, options: {
|
|
21
|
+
domain?: string;
|
|
22
|
+
version?: string;
|
|
23
|
+
});
|
|
24
|
+
get metadata(): ClientMetadata;
|
|
25
|
+
get providerStatus(): ProviderStatus;
|
|
26
|
+
addHandler<E extends ProviderEvents>(eventType: E, handler: EventHandler<E>, options?: EventOptions): void;
|
|
27
|
+
removeHandler<E extends ProviderEvents>(eventType: E, handler: EventHandler<E>): void;
|
|
28
|
+
addHooks(...hooks: Hook[]): this;
|
|
29
|
+
getHooks(): Hook[];
|
|
30
|
+
clearHooks(): this;
|
|
31
|
+
getBooleanValue(k: string, d: boolean, o?: FlagEvaluationOptions): boolean;
|
|
32
|
+
getBooleanDetails(k: string, d: boolean, o?: FlagEvaluationOptions): EvaluationDetails<boolean>;
|
|
33
|
+
getStringValue<T extends string = string>(k: string, d: T, o?: FlagEvaluationOptions): T;
|
|
34
|
+
getStringDetails<T extends string = string>(k: string, d: T, o?: FlagEvaluationOptions): EvaluationDetails<T>;
|
|
35
|
+
getNumberValue<T extends number = number>(k: string, d: T, o?: FlagEvaluationOptions): T;
|
|
36
|
+
getNumberDetails<T extends number = number>(k: string, d: T, o?: FlagEvaluationOptions): EvaluationDetails<T>;
|
|
37
|
+
getObjectValue<T extends JsonValue = JsonValue>(k: string, d: T, o?: FlagEvaluationOptions): T;
|
|
38
|
+
getObjectDetails<T extends JsonValue = JsonValue>(k: string, d: T, o?: FlagEvaluationOptions): EvaluationDetails<T>;
|
|
39
|
+
track(name: string, details?: TrackingEventDetails): void;
|
|
40
|
+
/** The heart of a flag read: hooks -> provider -> hooks, never throws. */
|
|
41
|
+
private evaluate;
|
|
42
|
+
private runAll;
|
|
43
|
+
private get provider();
|
|
44
|
+
private shortCircuitIfNotReady;
|
|
45
|
+
private errorDetails;
|
|
46
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ErrorCode } from './types';
|
|
2
|
+
export declare abstract class OpenFeatureError extends Error {
|
|
3
|
+
abstract code: ErrorCode;
|
|
4
|
+
constructor(message?: string);
|
|
5
|
+
}
|
|
6
|
+
export declare class GeneralError extends OpenFeatureError {
|
|
7
|
+
code: ErrorCode;
|
|
8
|
+
constructor(m?: string);
|
|
9
|
+
}
|
|
10
|
+
export declare class FlagNotFoundError extends OpenFeatureError {
|
|
11
|
+
code: ErrorCode;
|
|
12
|
+
constructor(m?: string);
|
|
13
|
+
}
|
|
14
|
+
export declare class ParseError extends OpenFeatureError {
|
|
15
|
+
code: ErrorCode;
|
|
16
|
+
constructor(m?: string);
|
|
17
|
+
}
|
|
18
|
+
export declare class TypeMismatchError extends OpenFeatureError {
|
|
19
|
+
code: ErrorCode;
|
|
20
|
+
constructor(m?: string);
|
|
21
|
+
}
|
|
22
|
+
export declare class TargetingKeyMissingError extends OpenFeatureError {
|
|
23
|
+
code: ErrorCode;
|
|
24
|
+
constructor(m?: string);
|
|
25
|
+
}
|
|
26
|
+
export declare class InvalidContextError extends OpenFeatureError {
|
|
27
|
+
code: ErrorCode;
|
|
28
|
+
constructor(m?: string);
|
|
29
|
+
}
|
|
30
|
+
export declare class ProviderNotReadyError extends OpenFeatureError {
|
|
31
|
+
code: ErrorCode;
|
|
32
|
+
constructor(m?: string);
|
|
33
|
+
}
|
|
34
|
+
export declare class ProviderFatalError extends OpenFeatureError {
|
|
35
|
+
code: ErrorCode;
|
|
36
|
+
constructor(m?: string);
|
|
37
|
+
}
|
|
38
|
+
export declare const instantiateErrorByErrorCode: (code: ErrorCode, message?: string) => OpenFeatureError;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ConfigChangeDetails, EventHandler, ProviderEventEmitter, ProviderEvents } from './types';
|
|
2
|
+
/** Tiny event emitter: used by providers (`provider.events`) and by the API (one per domain). */
|
|
3
|
+
export declare class EventEmitter implements ProviderEventEmitter {
|
|
4
|
+
private handlers;
|
|
5
|
+
addHandler(event: ProviderEvents, handler: EventHandler): void;
|
|
6
|
+
removeHandler(event: ProviderEvents, handler: EventHandler): void;
|
|
7
|
+
getHandlers(event: ProviderEvents): EventHandler[];
|
|
8
|
+
emit(event: ProviderEvents, details?: ConfigChangeDetails): void;
|
|
9
|
+
}
|
|
10
|
+
export declare const OpenFeatureEventEmitter: typeof EventEmitter;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Local OpenFeature client SDK (what the React layer needs from @openfeature/web-sdk + @openfeature/core). */
|
|
2
|
+
export * from './types';
|
|
3
|
+
export * from './errors';
|
|
4
|
+
export * from './events';
|
|
5
|
+
export { OpenFeature, OpenFeatureAPI } from './api';
|
|
6
|
+
export { OpenFeatureClient } from './client';
|
|
7
|
+
export { NOOP_PROVIDER, TypedInMemoryProvider, InMemoryProvider, withFrameworkMetadata } from './providers';
|
|
8
|
+
export type { InMemoryFlagConfiguration, InMemoryFlag, FlagVariants } from './providers';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { EventEmitter } from './events';
|
|
2
|
+
import { type EvaluationContext, type JsonValue, type Logger, type Provider, type ResolutionDetails } from './types';
|
|
3
|
+
/** Default provider: always answers with the default value. */
|
|
4
|
+
declare class NoopFeatureProvider implements Provider {
|
|
5
|
+
readonly metadata: {
|
|
6
|
+
readonly name: "No-op Provider";
|
|
7
|
+
};
|
|
8
|
+
resolveBooleanEvaluation(_: string, d: boolean): ResolutionDetails<boolean>;
|
|
9
|
+
resolveStringEvaluation(_: string, d: string): ResolutionDetails<string>;
|
|
10
|
+
resolveNumberEvaluation(_: string, d: number): ResolutionDetails<number>;
|
|
11
|
+
resolveObjectEvaluation<T extends JsonValue>(_: string, d: T): ResolutionDetails<T>;
|
|
12
|
+
private noOp;
|
|
13
|
+
}
|
|
14
|
+
export declare const NOOP_PROVIDER: NoopFeatureProvider;
|
|
15
|
+
export type FlagVariants<V extends string = string> = {
|
|
16
|
+
variants: Record<V, JsonValue>;
|
|
17
|
+
defaultVariant: V;
|
|
18
|
+
};
|
|
19
|
+
export type InMemoryFlag = FlagVariants & {
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
contextEvaluator?: (ctx: EvaluationContext) => string;
|
|
22
|
+
};
|
|
23
|
+
export type InMemoryFlagConfiguration = Record<string, InMemoryFlag>;
|
|
24
|
+
export declare class TypedInMemoryProvider implements Provider {
|
|
25
|
+
readonly events: EventEmitter;
|
|
26
|
+
readonly runsOn: "client";
|
|
27
|
+
readonly metadata: {
|
|
28
|
+
readonly name: "in-memory";
|
|
29
|
+
};
|
|
30
|
+
/** Optional: assigned by subclasses that want a delayed start. */
|
|
31
|
+
initialize?: Provider['initialize'];
|
|
32
|
+
private config;
|
|
33
|
+
constructor(config?: InMemoryFlagConfiguration);
|
|
34
|
+
putConfiguration(config: InMemoryFlagConfiguration): Promise<void>;
|
|
35
|
+
resolveBooleanEvaluation(k: string, d: boolean, c?: EvaluationContext, l?: Logger): ResolutionDetails<boolean>;
|
|
36
|
+
resolveStringEvaluation(k: string, d: string, c?: EvaluationContext, l?: Logger): ResolutionDetails<string>;
|
|
37
|
+
resolveNumberEvaluation(k: string, d: number, c?: EvaluationContext, l?: Logger): ResolutionDetails<number>;
|
|
38
|
+
resolveObjectEvaluation<T extends JsonValue>(k: string, d: T, c?: EvaluationContext, l?: Logger): ResolutionDetails<T>;
|
|
39
|
+
private resolve;
|
|
40
|
+
}
|
|
41
|
+
export declare const InMemoryProvider: typeof TypedInMemoryProvider;
|
|
42
|
+
/** Wraps a client so `metadata.framework` is set (the React layer passes 'react'). */
|
|
43
|
+
export declare function withFrameworkMetadata<T extends {
|
|
44
|
+
metadata: object;
|
|
45
|
+
}>(client: T, framework: string): T;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
export type PrimitiveValue = null | boolean | string | number;
|
|
2
|
+
export type JsonObject = {
|
|
3
|
+
[key: string]: JsonValue;
|
|
4
|
+
};
|
|
5
|
+
export type JsonArray = JsonValue[];
|
|
6
|
+
export type JsonValue = PrimitiveValue | JsonObject | JsonArray;
|
|
7
|
+
export type FlagValue = boolean | string | number | JsonValue;
|
|
8
|
+
export type FlagValueType = 'boolean' | 'string' | 'number' | 'object';
|
|
9
|
+
/** Override-able key types (same names as the SDK). */
|
|
10
|
+
export type BooleanFlagKey = string;
|
|
11
|
+
export type StringFlagKey = string;
|
|
12
|
+
export type NumberFlagKey = string;
|
|
13
|
+
export type ObjectFlagKey = string;
|
|
14
|
+
export type ConstrainedFlagKey<T> = T extends boolean ? BooleanFlagKey : T extends number ? NumberFlagKey : T extends string ? StringFlagKey : T extends JsonValue ? ObjectFlagKey : never;
|
|
15
|
+
export type EvaluationContextValue = PrimitiveValue | Date | {
|
|
16
|
+
[key: string]: EvaluationContextValue;
|
|
17
|
+
} | EvaluationContextValue[];
|
|
18
|
+
export type EvaluationContext = {
|
|
19
|
+
targetingKey?: string;
|
|
20
|
+
} & Record<string, EvaluationContextValue>;
|
|
21
|
+
export declare const StandardResolutionReasons: {
|
|
22
|
+
readonly STATIC: "STATIC";
|
|
23
|
+
readonly DEFAULT: "DEFAULT";
|
|
24
|
+
readonly TARGETING_MATCH: "TARGETING_MATCH";
|
|
25
|
+
readonly SPLIT: "SPLIT";
|
|
26
|
+
readonly CACHED: "CACHED";
|
|
27
|
+
readonly DISABLED: "DISABLED";
|
|
28
|
+
readonly UNKNOWN: "UNKNOWN";
|
|
29
|
+
readonly STALE: "STALE";
|
|
30
|
+
readonly ERROR: "ERROR";
|
|
31
|
+
};
|
|
32
|
+
export type ResolutionReason = keyof typeof StandardResolutionReasons | (string & Record<never, never>);
|
|
33
|
+
export declare enum ErrorCode {
|
|
34
|
+
PROVIDER_NOT_READY = "PROVIDER_NOT_READY",
|
|
35
|
+
PROVIDER_FATAL = "PROVIDER_FATAL",
|
|
36
|
+
FLAG_NOT_FOUND = "FLAG_NOT_FOUND",
|
|
37
|
+
PARSE_ERROR = "PARSE_ERROR",
|
|
38
|
+
TYPE_MISMATCH = "TYPE_MISMATCH",
|
|
39
|
+
TARGETING_KEY_MISSING = "TARGETING_KEY_MISSING",
|
|
40
|
+
INVALID_CONTEXT = "INVALID_CONTEXT",
|
|
41
|
+
GENERAL = "GENERAL"
|
|
42
|
+
}
|
|
43
|
+
export type FlagMetadata = Record<string, string | number | boolean>;
|
|
44
|
+
export type ResolutionDetails<U> = {
|
|
45
|
+
value: U;
|
|
46
|
+
variant?: string;
|
|
47
|
+
flagMetadata?: FlagMetadata;
|
|
48
|
+
reason?: ResolutionReason;
|
|
49
|
+
errorCode?: ErrorCode;
|
|
50
|
+
errorMessage?: string;
|
|
51
|
+
};
|
|
52
|
+
export type EvaluationDetails<T extends FlagValue> = {
|
|
53
|
+
flagKey: string;
|
|
54
|
+
flagMetadata: Readonly<FlagMetadata>;
|
|
55
|
+
} & ResolutionDetails<T>;
|
|
56
|
+
export declare enum ProviderStatus {
|
|
57
|
+
NOT_READY = "NOT_READY",
|
|
58
|
+
READY = "READY",
|
|
59
|
+
ERROR = "ERROR",
|
|
60
|
+
STALE = "STALE",
|
|
61
|
+
FATAL = "FATAL",
|
|
62
|
+
RECONCILING = "RECONCILING"
|
|
63
|
+
}
|
|
64
|
+
export declare enum ProviderEvents {
|
|
65
|
+
Ready = "PROVIDER_READY",
|
|
66
|
+
Error = "PROVIDER_ERROR",
|
|
67
|
+
ConfigurationChanged = "PROVIDER_CONFIGURATION_CHANGED",
|
|
68
|
+
ContextChanged = "PROVIDER_CONTEXT_CHANGED",
|
|
69
|
+
Reconciling = "PROVIDER_RECONCILING",
|
|
70
|
+
Stale = "PROVIDER_STALE"
|
|
71
|
+
}
|
|
72
|
+
export { ProviderEvents as ClientProviderEvents };
|
|
73
|
+
export type EventDetails = {
|
|
74
|
+
providerName?: string;
|
|
75
|
+
clientName?: string;
|
|
76
|
+
domain?: string;
|
|
77
|
+
message?: string;
|
|
78
|
+
};
|
|
79
|
+
export type ConfigChangeDetails = EventDetails & {
|
|
80
|
+
flagsChanged?: string[];
|
|
81
|
+
};
|
|
82
|
+
export type EventHandler<E extends ProviderEvents = ProviderEvents> = (eventDetails?: E extends ProviderEvents.ConfigurationChanged ? ConfigChangeDetails : EventDetails) => Promise<unknown> | unknown;
|
|
83
|
+
export type EventOptions = {
|
|
84
|
+
signal?: AbortSignal;
|
|
85
|
+
};
|
|
86
|
+
export type HookHints = Readonly<Record<string, unknown>>;
|
|
87
|
+
export interface Logger {
|
|
88
|
+
error(...args: unknown[]): void;
|
|
89
|
+
warn(...args: unknown[]): void;
|
|
90
|
+
info(...args: unknown[]): void;
|
|
91
|
+
debug(...args: unknown[]): void;
|
|
92
|
+
}
|
|
93
|
+
export interface HookContext<T extends FlagValue = FlagValue> {
|
|
94
|
+
readonly flagKey: string;
|
|
95
|
+
readonly defaultValue: T;
|
|
96
|
+
readonly flagValueType: FlagValueType;
|
|
97
|
+
readonly context: Readonly<EvaluationContext>;
|
|
98
|
+
readonly clientMetadata: ClientMetadata;
|
|
99
|
+
readonly providerMetadata: {
|
|
100
|
+
name: string;
|
|
101
|
+
};
|
|
102
|
+
readonly logger: Logger;
|
|
103
|
+
}
|
|
104
|
+
export interface Hook {
|
|
105
|
+
before?(ctx: HookContext, hints?: HookHints): void;
|
|
106
|
+
after?(ctx: HookContext, details: EvaluationDetails<FlagValue>, hints?: HookHints): void;
|
|
107
|
+
error?(ctx: HookContext, err: unknown, hints?: HookHints): void;
|
|
108
|
+
finally?(ctx: HookContext, details: EvaluationDetails<FlagValue>, hints?: HookHints): void;
|
|
109
|
+
}
|
|
110
|
+
export interface FlagEvaluationOptions {
|
|
111
|
+
hooks?: Hook[];
|
|
112
|
+
hookHints?: HookHints;
|
|
113
|
+
}
|
|
114
|
+
export type TrackingEventDetails = {
|
|
115
|
+
value?: number;
|
|
116
|
+
} & Record<string, unknown>;
|
|
117
|
+
export interface Tracking {
|
|
118
|
+
track(trackingEventName: string, trackingEventDetails?: TrackingEventDetails): void;
|
|
119
|
+
}
|
|
120
|
+
export interface ProviderEventEmitter {
|
|
121
|
+
addHandler(event: ProviderEvents, handler: EventHandler): void;
|
|
122
|
+
removeHandler(event: ProviderEvents, handler: EventHandler): void;
|
|
123
|
+
emit(event: ProviderEvents, details?: ConfigChangeDetails): void;
|
|
124
|
+
}
|
|
125
|
+
export interface Provider {
|
|
126
|
+
readonly metadata: {
|
|
127
|
+
readonly name: string;
|
|
128
|
+
};
|
|
129
|
+
readonly runsOn?: 'client';
|
|
130
|
+
readonly hooks?: Hook[];
|
|
131
|
+
readonly events?: ProviderEventEmitter;
|
|
132
|
+
initialize?(context?: EvaluationContext, domain?: string): Promise<void>;
|
|
133
|
+
onClose?(): Promise<void>;
|
|
134
|
+
onContextChange?(oldContext: EvaluationContext, newContext: EvaluationContext): Promise<void> | void;
|
|
135
|
+
track?(trackingEventName: string, context: EvaluationContext, trackingEventDetails: TrackingEventDetails): void;
|
|
136
|
+
resolveBooleanEvaluation(flagKey: string, defaultValue: boolean, context: EvaluationContext, logger: Logger): ResolutionDetails<boolean>;
|
|
137
|
+
resolveStringEvaluation(flagKey: string, defaultValue: string, context: EvaluationContext, logger: Logger): ResolutionDetails<string>;
|
|
138
|
+
resolveNumberEvaluation(flagKey: string, defaultValue: number, context: EvaluationContext, logger: Logger): ResolutionDetails<number>;
|
|
139
|
+
resolveObjectEvaluation<T extends JsonValue>(flagKey: string, defaultValue: T, context: EvaluationContext, logger: Logger): ResolutionDetails<T>;
|
|
140
|
+
}
|
|
141
|
+
export interface ClientMetadata {
|
|
142
|
+
name?: string;
|
|
143
|
+
domain?: string;
|
|
144
|
+
version?: string;
|
|
145
|
+
framework?: string;
|
|
146
|
+
sdk: string;
|
|
147
|
+
paradigm: 'client';
|
|
148
|
+
providerMetadata: {
|
|
149
|
+
name: string;
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
export interface Client extends Tracking {
|
|
153
|
+
readonly metadata: ClientMetadata;
|
|
154
|
+
readonly providerStatus: ProviderStatus;
|
|
155
|
+
addHandler<E extends ProviderEvents>(eventType: E, handler: EventHandler<E>, options?: EventOptions): void;
|
|
156
|
+
removeHandler<E extends ProviderEvents>(eventType: E, handler: EventHandler<E>): void;
|
|
157
|
+
addHooks(...hooks: Hook[]): this;
|
|
158
|
+
getHooks(): Hook[];
|
|
159
|
+
clearHooks(): this;
|
|
160
|
+
getBooleanValue(flagKey: BooleanFlagKey, defaultValue: boolean, options?: FlagEvaluationOptions): boolean;
|
|
161
|
+
getBooleanDetails(flagKey: BooleanFlagKey, defaultValue: boolean, options?: FlagEvaluationOptions): EvaluationDetails<boolean>;
|
|
162
|
+
getStringValue<T extends string = string>(flagKey: StringFlagKey, defaultValue: T, options?: FlagEvaluationOptions): T;
|
|
163
|
+
getStringDetails<T extends string = string>(flagKey: StringFlagKey, defaultValue: T, options?: FlagEvaluationOptions): EvaluationDetails<T>;
|
|
164
|
+
getNumberValue<T extends number = number>(flagKey: NumberFlagKey, defaultValue: T, options?: FlagEvaluationOptions): T;
|
|
165
|
+
getNumberDetails<T extends number = number>(flagKey: NumberFlagKey, defaultValue: T, options?: FlagEvaluationOptions): EvaluationDetails<T>;
|
|
166
|
+
getObjectValue<T extends JsonValue = JsonValue>(flagKey: ObjectFlagKey, defaultValue: T, options?: FlagEvaluationOptions): T;
|
|
167
|
+
getObjectDetails<T extends JsonValue = JsonValue>(flagKey: ObjectFlagKey, defaultValue: T, options?: FlagEvaluationOptions): EvaluationDetails<T>;
|
|
168
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './use-track';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Tracking } from '../sdk';
|
|
2
|
+
export type Track = {
|
|
3
|
+
/**
|
|
4
|
+
* Context-aware tracking function for the parent `<OpenFeatureProvider/>`.
|
|
5
|
+
* Track a user action or application state, usually representing a business objective or outcome.
|
|
6
|
+
* @param trackingEventName an identifier for the event
|
|
7
|
+
* @param trackingEventDetails the details of the tracking event
|
|
8
|
+
*/
|
|
9
|
+
track: Tracking['track'];
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Get a context-aware tracking function.
|
|
13
|
+
* @returns {Track} context-aware tracking
|
|
14
|
+
*/
|
|
15
|
+
export declare function useTrack(): Track;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import 'rrweb/dist/rrweb.min.css';
|
|
3
3
|
import './rrw.css';
|
|
4
|
+
import { type RecordingSummary } from './sessionStore';
|
|
5
|
+
export type { RecordingSummary };
|
|
4
6
|
type LogEventType = 'session_start' | 'session_resume' | 'session_stop' | 'click' | 'route' | 'api' | 'error' | 'promise_rejection' | 'tab_visibility' | 'network' | 'console_error' | 'console_warn' | 'resource_error' | 'submit' | 'change' | 'page_view' | 'page_unload' | 'dblclick' | 'rage_click' | 'contextmenu' | 'key' | 'clipboard' | 'scroll' | 'resize' | 'focus' | 'long_task' | 'csp_violation';
|
|
5
7
|
export interface LogEvent {
|
|
6
8
|
sessionId: string;
|
|
@@ -19,15 +21,6 @@ export interface RrEvent {
|
|
|
19
21
|
data: unknown;
|
|
20
22
|
timestamp: number;
|
|
21
23
|
}
|
|
22
|
-
export interface RecordingSummary {
|
|
23
|
-
sessionId: string;
|
|
24
|
-
startedAt: number;
|
|
25
|
-
endedAt: number;
|
|
26
|
-
durationMs: number;
|
|
27
|
-
timezone: string;
|
|
28
|
-
eventCount: number;
|
|
29
|
-
interrupted?: boolean;
|
|
30
|
-
}
|
|
31
24
|
export interface FinishedRecording {
|
|
32
25
|
rr: RrEvent[];
|
|
33
26
|
summary: RecordingSummary;
|
|
@@ -40,6 +33,11 @@ export declare const formatLocalTime: (value?: Date | number) => string;
|
|
|
40
33
|
export declare const toLocalISO: (value?: Date | number) => string;
|
|
41
34
|
export declare const formatDisplayTime: (value: Date | number) => string;
|
|
42
35
|
type ModuleMap = Record<string, string> | ((pathname: string) => string);
|
|
36
|
+
/** An error of any kind, or an API call that failed. */
|
|
37
|
+
export declare const isFailure: (e: {
|
|
38
|
+
type: string;
|
|
39
|
+
detail: unknown;
|
|
40
|
+
}) => boolean;
|
|
43
41
|
export declare const downloadLogJson: (f: FinishedRecording) => void;
|
|
44
42
|
export declare const downloadReplayJson: (f: FinishedRecording) => void;
|
|
45
43
|
/** Live info about the recording that is running right now (null when none). Used by the All Sessions table. */
|
|
@@ -72,4 +70,3 @@ export interface RouteRecorderWatcherProps {
|
|
|
72
70
|
}) => void | Promise<void>;
|
|
73
71
|
}
|
|
74
72
|
export declare const RouteRecorderWatcher: React.FC<RouteRecorderWatcherProps>;
|
|
75
|
-
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** The basic facts of one recording. A live or recovered session carries just these. */
|
|
1
2
|
export interface RecordingSummary {
|
|
2
3
|
sessionId: string;
|
|
3
4
|
startedAt: number;
|
|
@@ -6,17 +7,20 @@ export interface RecordingSummary {
|
|
|
6
7
|
timezone: string;
|
|
7
8
|
eventCount: number;
|
|
8
9
|
interrupted?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** What the archive stores and the All Sessions table lists: the summary plus the counters shown in the table. */
|
|
12
|
+
export interface ArchivedRecording extends RecordingSummary {
|
|
9
13
|
errors: number;
|
|
10
14
|
pages: number;
|
|
11
15
|
clicks: number;
|
|
12
16
|
rageClicks?: number;
|
|
13
17
|
}
|
|
14
|
-
export declare const saveRecording: (summary:
|
|
15
|
-
export declare const listRecordings: () => Promise<
|
|
18
|
+
export declare const saveRecording: (summary: ArchivedRecording, rr: unknown[], events: unknown[]) => Promise<void>;
|
|
19
|
+
export declare const listRecordings: () => Promise<ArchivedRecording[]>;
|
|
16
20
|
export declare const getRecordingData: (id: string) => Promise<{
|
|
17
21
|
rr: unknown[];
|
|
18
22
|
events: unknown[];
|
|
19
23
|
} | null>;
|
|
20
24
|
export declare const deleteRecording: (id: string, announce?: boolean) => Promise<void>;
|
|
21
25
|
/** Live list of archived recordings for React components. */
|
|
22
|
-
export declare const useRecordings: () =>
|
|
26
|
+
export declare const useRecordings: () => ArchivedRecording[];
|