@getlimelight/sdk 0.3.1 → 0.4.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.mts +80 -1
- package/dist/index.d.ts +80 -1
- package/dist/index.js +409 -42
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +409 -42
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/index.d.mts
CHANGED
|
@@ -286,6 +286,70 @@ interface ComponentProfileSnapshot {
|
|
|
286
286
|
propChanges?: PropChangeSnapshot;
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
+
/**
|
|
290
|
+
* Supported state management libraries
|
|
291
|
+
*/
|
|
292
|
+
declare enum StateLibrary {
|
|
293
|
+
ZUSTAND = "zustand",
|
|
294
|
+
REDUX = "redux"
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* State event phases
|
|
298
|
+
*/
|
|
299
|
+
declare enum StatePhase {
|
|
300
|
+
INIT = "STATE:INIT",
|
|
301
|
+
UPDATE = "STATE:UPDATE"
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Action info captured during state updates
|
|
305
|
+
*/
|
|
306
|
+
interface StateAction {
|
|
307
|
+
/**
|
|
308
|
+
* Action type/name
|
|
309
|
+
* - Redux: action.type
|
|
310
|
+
* - Zustand: inferred from stack trace or 'set'
|
|
311
|
+
*/
|
|
312
|
+
type: string;
|
|
313
|
+
/**
|
|
314
|
+
* Action payload
|
|
315
|
+
* - Redux: action.payload
|
|
316
|
+
* - Zustand: partial state passed to set()
|
|
317
|
+
*/
|
|
318
|
+
payload?: unknown;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Base shape for state events
|
|
322
|
+
*/
|
|
323
|
+
interface BaseStateEvent {
|
|
324
|
+
phase: StatePhase;
|
|
325
|
+
sessionId: string;
|
|
326
|
+
timestamp: number;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Initial state snapshot sent when store is registered
|
|
330
|
+
*/
|
|
331
|
+
interface StateInitEvent extends BaseStateEvent {
|
|
332
|
+
phase: StatePhase.INIT;
|
|
333
|
+
data: {
|
|
334
|
+
storeId: string;
|
|
335
|
+
library: StateLibrary;
|
|
336
|
+
state: unknown;
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* State update event sent on every state change
|
|
341
|
+
*/
|
|
342
|
+
interface StateUpdateEvent extends BaseStateEvent {
|
|
343
|
+
phase: StatePhase.UPDATE;
|
|
344
|
+
data: {
|
|
345
|
+
storeId: string;
|
|
346
|
+
library: StateLibrary;
|
|
347
|
+
state: unknown;
|
|
348
|
+
action: StateAction;
|
|
349
|
+
stackTrace?: string;
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
|
|
289
353
|
/**
|
|
290
354
|
* Configuration options for Limelight SDK.
|
|
291
355
|
*
|
|
@@ -349,6 +413,20 @@ interface LimelightConfig {
|
|
|
349
413
|
* Flag to enable or disable render inspection.
|
|
350
414
|
*/
|
|
351
415
|
enableRenderInspector?: boolean;
|
|
416
|
+
/**
|
|
417
|
+
* Zustand store hooks or Redux stores, keyed by display name
|
|
418
|
+
* @example { user: useUserStore, cart: useCartStore }
|
|
419
|
+
*/
|
|
420
|
+
stores?: Record<string, unknown>;
|
|
421
|
+
/**
|
|
422
|
+
* Flag to enable or disable state inspection
|
|
423
|
+
* @default true (if stores are provided)
|
|
424
|
+
*/
|
|
425
|
+
enableStateInspector?: boolean;
|
|
426
|
+
/**
|
|
427
|
+
* Flag to enable or disable internal logging for the Limelight SDK
|
|
428
|
+
*/
|
|
429
|
+
internalLoggingEnabled?: boolean;
|
|
352
430
|
/**
|
|
353
431
|
* A callback function to modify or filter events before they are sent to the server
|
|
354
432
|
*/
|
|
@@ -372,7 +450,7 @@ interface ConnectionEvent {
|
|
|
372
450
|
/**
|
|
373
451
|
* Union type representing all possible Limelight messages.
|
|
374
452
|
*/
|
|
375
|
-
type LimelightMessage = NetworkRequest | NetworkResponse | NetworkErrorEvent | ConsoleEvent | ConnectionEvent | RenderSnapshot | TransactionEvent;
|
|
453
|
+
type LimelightMessage = NetworkRequest | NetworkResponse | NetworkErrorEvent | ConsoleEvent | ConnectionEvent | RenderSnapshot | TransactionEvent | StateInitEvent | StateUpdateEvent;
|
|
376
454
|
|
|
377
455
|
/**
|
|
378
456
|
* Represents a single frame in a stack trace.
|
|
@@ -406,6 +484,7 @@ declare class LimelightClient {
|
|
|
406
484
|
private xhrInterceptor;
|
|
407
485
|
private consoleInterceptor;
|
|
408
486
|
private renderInterceptor;
|
|
487
|
+
private stateInterceptor;
|
|
409
488
|
constructor();
|
|
410
489
|
/**
|
|
411
490
|
* Configures the Limelight client with the provided settings.
|
package/dist/index.d.ts
CHANGED
|
@@ -286,6 +286,70 @@ interface ComponentProfileSnapshot {
|
|
|
286
286
|
propChanges?: PropChangeSnapshot;
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
+
/**
|
|
290
|
+
* Supported state management libraries
|
|
291
|
+
*/
|
|
292
|
+
declare enum StateLibrary {
|
|
293
|
+
ZUSTAND = "zustand",
|
|
294
|
+
REDUX = "redux"
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* State event phases
|
|
298
|
+
*/
|
|
299
|
+
declare enum StatePhase {
|
|
300
|
+
INIT = "STATE:INIT",
|
|
301
|
+
UPDATE = "STATE:UPDATE"
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Action info captured during state updates
|
|
305
|
+
*/
|
|
306
|
+
interface StateAction {
|
|
307
|
+
/**
|
|
308
|
+
* Action type/name
|
|
309
|
+
* - Redux: action.type
|
|
310
|
+
* - Zustand: inferred from stack trace or 'set'
|
|
311
|
+
*/
|
|
312
|
+
type: string;
|
|
313
|
+
/**
|
|
314
|
+
* Action payload
|
|
315
|
+
* - Redux: action.payload
|
|
316
|
+
* - Zustand: partial state passed to set()
|
|
317
|
+
*/
|
|
318
|
+
payload?: unknown;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Base shape for state events
|
|
322
|
+
*/
|
|
323
|
+
interface BaseStateEvent {
|
|
324
|
+
phase: StatePhase;
|
|
325
|
+
sessionId: string;
|
|
326
|
+
timestamp: number;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Initial state snapshot sent when store is registered
|
|
330
|
+
*/
|
|
331
|
+
interface StateInitEvent extends BaseStateEvent {
|
|
332
|
+
phase: StatePhase.INIT;
|
|
333
|
+
data: {
|
|
334
|
+
storeId: string;
|
|
335
|
+
library: StateLibrary;
|
|
336
|
+
state: unknown;
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* State update event sent on every state change
|
|
341
|
+
*/
|
|
342
|
+
interface StateUpdateEvent extends BaseStateEvent {
|
|
343
|
+
phase: StatePhase.UPDATE;
|
|
344
|
+
data: {
|
|
345
|
+
storeId: string;
|
|
346
|
+
library: StateLibrary;
|
|
347
|
+
state: unknown;
|
|
348
|
+
action: StateAction;
|
|
349
|
+
stackTrace?: string;
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
|
|
289
353
|
/**
|
|
290
354
|
* Configuration options for Limelight SDK.
|
|
291
355
|
*
|
|
@@ -349,6 +413,20 @@ interface LimelightConfig {
|
|
|
349
413
|
* Flag to enable or disable render inspection.
|
|
350
414
|
*/
|
|
351
415
|
enableRenderInspector?: boolean;
|
|
416
|
+
/**
|
|
417
|
+
* Zustand store hooks or Redux stores, keyed by display name
|
|
418
|
+
* @example { user: useUserStore, cart: useCartStore }
|
|
419
|
+
*/
|
|
420
|
+
stores?: Record<string, unknown>;
|
|
421
|
+
/**
|
|
422
|
+
* Flag to enable or disable state inspection
|
|
423
|
+
* @default true (if stores are provided)
|
|
424
|
+
*/
|
|
425
|
+
enableStateInspector?: boolean;
|
|
426
|
+
/**
|
|
427
|
+
* Flag to enable or disable internal logging for the Limelight SDK
|
|
428
|
+
*/
|
|
429
|
+
internalLoggingEnabled?: boolean;
|
|
352
430
|
/**
|
|
353
431
|
* A callback function to modify or filter events before they are sent to the server
|
|
354
432
|
*/
|
|
@@ -372,7 +450,7 @@ interface ConnectionEvent {
|
|
|
372
450
|
/**
|
|
373
451
|
* Union type representing all possible Limelight messages.
|
|
374
452
|
*/
|
|
375
|
-
type LimelightMessage = NetworkRequest | NetworkResponse | NetworkErrorEvent | ConsoleEvent | ConnectionEvent | RenderSnapshot | TransactionEvent;
|
|
453
|
+
type LimelightMessage = NetworkRequest | NetworkResponse | NetworkErrorEvent | ConsoleEvent | ConnectionEvent | RenderSnapshot | TransactionEvent | StateInitEvent | StateUpdateEvent;
|
|
376
454
|
|
|
377
455
|
/**
|
|
378
456
|
* Represents a single frame in a stack trace.
|
|
@@ -406,6 +484,7 @@ declare class LimelightClient {
|
|
|
406
484
|
private xhrInterceptor;
|
|
407
485
|
private consoleInterceptor;
|
|
408
486
|
private renderInterceptor;
|
|
487
|
+
private stateInterceptor;
|
|
409
488
|
constructor();
|
|
410
489
|
/**
|
|
411
490
|
* Configures the Limelight client with the provided settings.
|