@liquidcommerce/elements-sdk 2.2.2 → 2.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/README.md +1608 -557
- package/dist/index.esm.js +10170 -8144
- package/dist/types/core/auth.service.d.ts +10 -4
- package/dist/types/core/base-component.service.d.ts +3 -0
- package/dist/types/core/circuit-breaker.service.d.ts +54 -0
- package/dist/types/core/client/client-action.service.d.ts +13 -11
- package/dist/types/core/client/client-config.service.d.ts +5 -3
- package/dist/types/core/command/common-command.service.d.ts +2 -1
- package/dist/types/core/debug-panel/debug-panel.service.d.ts +43 -0
- package/dist/types/core/debug-panel/debug-panel.styles.d.ts +1 -0
- package/dist/types/core/fingerprint.service.d.ts +4 -9
- package/dist/types/core/google-tag-manager.service.d.ts +127 -2
- package/dist/types/core/logger/logger-factory.d.ts +3 -0
- package/dist/types/core/logger/logger.service.d.ts +8 -5
- package/dist/types/core/pubsub/interfaces/core.interface.d.ts +2 -3
- package/dist/types/core/pubsub/interfaces/product.interface.d.ts +0 -5
- package/dist/types/core/store/interfaces/cart.interface.d.ts +0 -1
- package/dist/types/core/store/interfaces/checkout.interface.d.ts +0 -1
- package/dist/types/core/store/interfaces/core.interface.d.ts +2 -2
- package/dist/types/core/store/interfaces/product.interface.d.ts +0 -1
- package/dist/types/core/store/store.service.d.ts +1 -0
- package/dist/types/core/telemetry/telemetry.interface.d.ts +80 -0
- package/dist/types/core/telemetry/telemetry.service.d.ts +27 -0
- package/dist/types/enums/core.enum.d.ts +0 -1
- package/dist/types/enums/debug.enum.d.ts +6 -0
- package/dist/types/enums/index.d.ts +1 -0
- package/dist/types/interfaces/core.interface.d.ts +2 -2
- package/dist/types/modules/address/address.command.d.ts +1 -3
- package/dist/types/modules/cart/cart.commands.d.ts +1 -1
- package/dist/types/modules/cart/cart.component.d.ts +1 -2
- package/dist/types/modules/cart/components/cart-footer.component.d.ts +1 -0
- package/dist/types/modules/cart/components/cart-item.component.d.ts +2 -6
- package/dist/types/modules/checkout/checkout.commands.d.ts +3 -2
- package/dist/types/modules/checkout/checkout.component.d.ts +1 -2
- package/dist/types/modules/checkout/components/checkout-summary-section.component.d.ts +2 -0
- package/dist/types/modules/checkout/components/information/checkout-delivery-information-form.component.d.ts +1 -1
- package/dist/types/modules/checkout/components/summary/checkout-item-quantity.component.d.ts +0 -2
- package/dist/types/modules/checkout/components/summary/checkout-item.component.d.ts +2 -1
- package/dist/types/modules/checkout/components/summary/checkout-items.component.d.ts +1 -0
- package/dist/types/modules/checkout/components/summary/checkout-place-order-button.component.d.ts +0 -1
- package/dist/types/modules/checkout/constant.d.ts +0 -1
- package/dist/types/modules/product/components/index.d.ts +1 -0
- package/dist/types/modules/product/components/product-add-to-cart-section.component.d.ts +1 -0
- package/dist/types/modules/product/components/product-interactions.component.d.ts +4 -1
- package/dist/types/modules/product/components/product-price.component.d.ts +1 -0
- package/dist/types/modules/product/components/product-retailers.component.d.ts +1 -0
- package/dist/types/modules/product/product.commands.d.ts +1 -1
- package/dist/types/modules/ui-components/engraving/engraving-form.component.d.ts +13 -11
- package/dist/types/modules/ui-components/engraving/engraving-view.component.d.ts +4 -9
- package/dist/types/static/icon/index.d.ts +0 -1
- package/dist/types/utils/format.d.ts +2 -1
- package/docs/ACTIONS.md +1235 -0
- package/docs/BROWSER_SUPPORT.md +279 -0
- package/docs/CONFIGURATION.md +613 -0
- package/docs/DOCUMENTATION_INDEX.md +311 -0
- package/docs/EVENTS.md +532 -0
- package/docs/PROXY.md +228 -0
- package/docs/THEMING.md +592 -0
- package/docs/TROUBLESHOOTING.md +755 -0
- package/package.json +17 -17
- package/umd/elements.js +1 -1
- package/dist/types/static/icon/completed.icon.d.ts +0 -2
|
@@ -4,6 +4,11 @@ export interface IAuthConfig {
|
|
|
4
4
|
env: ElementsEnv;
|
|
5
5
|
baseUrl: string;
|
|
6
6
|
}
|
|
7
|
+
export interface IHttpRequestOptions {
|
|
8
|
+
headers?: Record<string, string>;
|
|
9
|
+
body?: any;
|
|
10
|
+
critical?: boolean;
|
|
11
|
+
}
|
|
7
12
|
export declare class AuthService {
|
|
8
13
|
private readonly apiKey;
|
|
9
14
|
private readonly baseUrl;
|
|
@@ -14,6 +19,7 @@ export declare class AuthService {
|
|
|
14
19
|
private readonly httpClient;
|
|
15
20
|
private readonly logger;
|
|
16
21
|
private readonly clientConfig;
|
|
22
|
+
private readonly circuitBreaker;
|
|
17
23
|
private constructor();
|
|
18
24
|
static getInstance(config: IAuthConfig): AuthService;
|
|
19
25
|
authenticate(): Promise<boolean>;
|
|
@@ -22,8 +28,8 @@ export declare class AuthService {
|
|
|
22
28
|
private request;
|
|
23
29
|
private buildUrl;
|
|
24
30
|
private getProxyHeaders;
|
|
25
|
-
get<T = any>(path: string,
|
|
26
|
-
post<T = any>(path: string,
|
|
27
|
-
put<T = any>(path: string,
|
|
28
|
-
delete<T = any>(path: string,
|
|
31
|
+
get<T = any>(path: string, options?: IHttpRequestOptions): Promise<T>;
|
|
32
|
+
post<T = any>(path: string, options?: IHttpRequestOptions): Promise<T>;
|
|
33
|
+
put<T = any>(path: string, options?: IHttpRequestOptions): Promise<T>;
|
|
34
|
+
delete<T = any>(path: string, options?: IHttpRequestOptions): Promise<T>;
|
|
29
35
|
}
|
|
@@ -2,6 +2,7 @@ import { ClientConfigService } from '@/core/client/client-config.service';
|
|
|
2
2
|
import { LoggerFactory } from '@/core/logger/logger-factory';
|
|
3
3
|
import { PubSubService } from '@/core/pubsub';
|
|
4
4
|
import { type StorePaths, StoreService } from '@/core/store';
|
|
5
|
+
import { TelemetryService } from '@/core/telemetry/telemetry.service';
|
|
5
6
|
import type { ComponentType } from '@/enums';
|
|
6
7
|
import type { ConfigsKeyType, ConfigsType } from '@/interfaces/configs';
|
|
7
8
|
import { ThemeProviderService } from '@/modules/theme-provider';
|
|
@@ -30,6 +31,7 @@ export declare abstract class BaseComponent<TParams = Record<string, any>, TConf
|
|
|
30
31
|
protected readonly pubSub: PubSubService;
|
|
31
32
|
protected readonly logger: ReturnType<typeof LoggerFactory.get>;
|
|
32
33
|
protected readonly clientConfig: ClientConfigService;
|
|
34
|
+
protected readonly telemetry: TelemetryService;
|
|
33
35
|
private initialized;
|
|
34
36
|
private isDestroyed;
|
|
35
37
|
private renderScheduled;
|
|
@@ -65,6 +67,7 @@ export declare abstract class BaseComponent<TParams = Record<string, any>, TConf
|
|
|
65
67
|
private render;
|
|
66
68
|
private logRenderInfo;
|
|
67
69
|
protected rerender(context?: string): void;
|
|
70
|
+
private captureComponentError;
|
|
68
71
|
private updateHostClasses;
|
|
69
72
|
addHostClasses(...classes: string[]): void;
|
|
70
73
|
removeHostClasses(...classes: string[]): void;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export declare enum CircuitBreakerState {
|
|
2
|
+
CLOSED = "CLOSED",
|
|
3
|
+
OPEN = "OPEN",
|
|
4
|
+
HALF_OPEN = "HALF_OPEN"
|
|
5
|
+
}
|
|
6
|
+
export interface ICircuitBreakerConfig {
|
|
7
|
+
failureThreshold: number;
|
|
8
|
+
recoveryTimeout: number;
|
|
9
|
+
halfOpenMaxCalls: number;
|
|
10
|
+
successThreshold: number;
|
|
11
|
+
timeout: number;
|
|
12
|
+
countClientErrorsAsFailures: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface ICircuitBreakerStats {
|
|
15
|
+
state: CircuitBreakerState;
|
|
16
|
+
failures: number;
|
|
17
|
+
successes: number;
|
|
18
|
+
totalCalls: number;
|
|
19
|
+
rejectedCalls: number;
|
|
20
|
+
lastFailureTime: number | null;
|
|
21
|
+
lastSuccessTime: number | null;
|
|
22
|
+
isHealthy: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface ICircuitBreakerExecuteOptions {
|
|
25
|
+
critical?: boolean;
|
|
26
|
+
fallback?: () => any | Promise<any>;
|
|
27
|
+
}
|
|
28
|
+
export declare class CircuitBreakerService {
|
|
29
|
+
private state;
|
|
30
|
+
private failures;
|
|
31
|
+
private successes;
|
|
32
|
+
private totalCalls;
|
|
33
|
+
private rejectedCalls;
|
|
34
|
+
private lastFailureTime;
|
|
35
|
+
private lastSuccessTime;
|
|
36
|
+
private halfOpenCallsInProgress;
|
|
37
|
+
private nextAttemptTime;
|
|
38
|
+
private readonly config;
|
|
39
|
+
private readonly logger;
|
|
40
|
+
constructor(config?: Partial<ICircuitBreakerConfig>);
|
|
41
|
+
static getInstance(config?: Partial<ICircuitBreakerConfig>): CircuitBreakerService;
|
|
42
|
+
execute<T>(fn: () => Promise<T>, context?: string, options?: ICircuitBreakerExecuteOptions): Promise<T>;
|
|
43
|
+
executeWithFallback<T>(fn: () => Promise<T>, fallback: () => T | Promise<T>, context?: string, critical?: boolean): Promise<T>;
|
|
44
|
+
getStats(): ICircuitBreakerStats;
|
|
45
|
+
reset(): void;
|
|
46
|
+
forceOpen(context?: string): void;
|
|
47
|
+
forceClose(context?: string): void;
|
|
48
|
+
private executeWithTimeout;
|
|
49
|
+
private onSuccess;
|
|
50
|
+
private onFailure;
|
|
51
|
+
private openCircuit;
|
|
52
|
+
private halfOpenCircuit;
|
|
53
|
+
private closeCircuit;
|
|
54
|
+
}
|
|
@@ -9,18 +9,19 @@ export interface IProductActions {
|
|
|
9
9
|
export interface IAddressActions {
|
|
10
10
|
setAddressByPlacesId: (placesId: string) => Promise<void>;
|
|
11
11
|
setAddressManually: (address: Omit<IAddress, 'id'>, coordinates: ICoords) => Promise<void>;
|
|
12
|
-
clear: () => void
|
|
12
|
+
clear: () => Promise<void>;
|
|
13
13
|
getDetails: () => IAddressData | null;
|
|
14
14
|
}
|
|
15
|
+
export interface IAddProductParams {
|
|
16
|
+
identifier: string;
|
|
17
|
+
fulfillmentType: FulfillmentType;
|
|
18
|
+
quantity: number;
|
|
19
|
+
}
|
|
15
20
|
export interface ICartActions {
|
|
16
21
|
openCart: () => void;
|
|
17
22
|
closeCart: () => void;
|
|
18
23
|
toggleCart: () => void;
|
|
19
|
-
addProduct: (params:
|
|
20
|
-
identifier: string;
|
|
21
|
-
fulfillmentType: FulfillmentType;
|
|
22
|
-
quantity: number;
|
|
23
|
-
}>, openCart?: boolean) => Promise<void>;
|
|
24
|
+
addProduct: (params: IAddProductParams[], openCart?: boolean) => Promise<void>;
|
|
24
25
|
applyPromoCode: (promoCode: string) => Promise<void>;
|
|
25
26
|
removePromoCode: () => Promise<void>;
|
|
26
27
|
resetCart: () => Promise<void>;
|
|
@@ -30,11 +31,7 @@ export interface ICheckoutActions {
|
|
|
30
31
|
openCheckout: () => void;
|
|
31
32
|
closeCheckout: () => void;
|
|
32
33
|
toggleCheckout: () => void;
|
|
33
|
-
addProduct: (params:
|
|
34
|
-
identifier: string;
|
|
35
|
-
fulfillmentType: FulfillmentType;
|
|
36
|
-
quantity: number;
|
|
37
|
-
}>, openCheckout?: boolean) => Promise<void>;
|
|
34
|
+
addProduct: (params: IAddProductParams[], openCheckout?: boolean) => Promise<void>;
|
|
38
35
|
applyPromoCode: (promoCode: string) => Promise<void>;
|
|
39
36
|
removePromoCode: () => Promise<void>;
|
|
40
37
|
applyGiftCard: (code: string) => Promise<void>;
|
|
@@ -54,8 +51,13 @@ export declare class ClientActionService {
|
|
|
54
51
|
private readonly api;
|
|
55
52
|
private readonly themeProvider;
|
|
56
53
|
private readonly logger;
|
|
54
|
+
private pendingCartParams;
|
|
55
|
+
private pendingCartOpenFlag;
|
|
57
56
|
constructor();
|
|
58
57
|
static getInstance(): ClientActionService;
|
|
58
|
+
private setupAddressUpdateListener;
|
|
59
|
+
private retryPendingCartOperation;
|
|
60
|
+
private clearPendingCartOperation;
|
|
59
61
|
private getLocation;
|
|
60
62
|
private productActions;
|
|
61
63
|
private addressActions;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ElementsEnv } from '@/enums';
|
|
1
|
+
import { type DebugMode, type ElementsEnv } from '@/enums';
|
|
2
2
|
import type { IPromoTicker } from '@/interfaces/configs';
|
|
3
3
|
import type { IClientCustomThemeConfig, IElementsProxyConfig } from '@/interfaces/core.interface';
|
|
4
4
|
export type DeviceType = 'desktop' | 'tablet' | 'mobile';
|
|
@@ -6,8 +6,9 @@ export interface IClientConfigs {
|
|
|
6
6
|
apiKey: string;
|
|
7
7
|
env: ElementsEnv;
|
|
8
8
|
isBuilder: boolean;
|
|
9
|
-
|
|
9
|
+
debugMode: DebugMode;
|
|
10
10
|
baseUrl: string;
|
|
11
|
+
partnerCode?: string;
|
|
11
12
|
customTheme: IClientCustomThemeConfig | null;
|
|
12
13
|
proxy: IElementsProxyConfig | null;
|
|
13
14
|
deviceType: DeviceType;
|
|
@@ -20,7 +21,7 @@ export interface IClientConfigs {
|
|
|
20
21
|
export interface IClientConfigInput {
|
|
21
22
|
env?: ElementsEnv;
|
|
22
23
|
isBuilder?: boolean;
|
|
23
|
-
|
|
24
|
+
debugMode?: DebugMode;
|
|
24
25
|
customTheme?: IClientCustomThemeConfig;
|
|
25
26
|
proxy?: IElementsProxyConfig;
|
|
26
27
|
promoTicker?: IPromoTicker[];
|
|
@@ -37,6 +38,7 @@ export declare class ClientConfigService {
|
|
|
37
38
|
isProduction(): boolean;
|
|
38
39
|
isBuilder(): boolean;
|
|
39
40
|
isDebuggingEnabled(): boolean;
|
|
41
|
+
isDebugPanelEnabled(): boolean;
|
|
40
42
|
debuggingDisabled(): boolean;
|
|
41
43
|
hasCustomTheme(): boolean;
|
|
42
44
|
isMobile(): boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { ICart } from '@/interfaces/cloud';
|
|
1
2
|
import { BaseCommand } from './base-command.service';
|
|
2
3
|
export declare class CommonCommands extends BaseCommand {
|
|
3
4
|
static getInstance(): CommonCommands;
|
|
5
|
+
syncCartFromResponse(cartApi: ICart, publishEvent?: boolean): void;
|
|
4
6
|
loadCart(): Promise<void>;
|
|
5
|
-
private persistSessionData;
|
|
6
7
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface IDebugLogEntry {
|
|
2
|
+
id: string;
|
|
3
|
+
timestamp: number;
|
|
4
|
+
type: 'event' | 'gtm' | 'logger';
|
|
5
|
+
level: 'debug' | 'info' | 'warn' | 'error';
|
|
6
|
+
message: string;
|
|
7
|
+
data?: any;
|
|
8
|
+
context?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class DebugPanelService {
|
|
11
|
+
private panelElement;
|
|
12
|
+
private panelContainer;
|
|
13
|
+
private floatingButton;
|
|
14
|
+
private logContainer;
|
|
15
|
+
private logs;
|
|
16
|
+
private isVisible;
|
|
17
|
+
private showEvents;
|
|
18
|
+
private showGtmEvents;
|
|
19
|
+
private showLogs;
|
|
20
|
+
static getInstance(): DebugPanelService;
|
|
21
|
+
initialize(): void;
|
|
22
|
+
toggleVisibility(): void;
|
|
23
|
+
destroy(): void;
|
|
24
|
+
private interceptLoggerService;
|
|
25
|
+
private interceptLoggerInstance;
|
|
26
|
+
private interceptPubSubEvents;
|
|
27
|
+
private interceptGtmEvents;
|
|
28
|
+
private addLogEntry;
|
|
29
|
+
private renderLogs;
|
|
30
|
+
private clearLogs;
|
|
31
|
+
private createPanel;
|
|
32
|
+
private createPanelContent;
|
|
33
|
+
private createHeader;
|
|
34
|
+
private createToggles;
|
|
35
|
+
private createResizeHandle;
|
|
36
|
+
private setupShadowEventListeners;
|
|
37
|
+
private createFloatingButton;
|
|
38
|
+
private showPanelContent;
|
|
39
|
+
private hidePanelContent;
|
|
40
|
+
private createLogElement;
|
|
41
|
+
private formatJsonData;
|
|
42
|
+
private escapeHtml;
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DEBUG_PANEL_STYLES = "\n :host {\n position: fixed;\n z-index: 2147483647;\n display: block;\n }\n\n .panel {\n position: relative;\n background: rgba(15, 23, 42, 0.95);\n backdrop-filter: blur(10px);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 12px;\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n font-size: 12px;\n color: #e2e8f0;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n user-select: none;\n transition: all 0.2s ease;\n width: 100%;\n height: 100%;\n }\n\n .panel:hover {\n border-color: rgba(148, 163, 184, 0.4);\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);\n }\n\n .header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 12px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.5);\n cursor: move;\n }\n\n .icon {\n font-size: 14px;\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 20px;\n }\n\n .title-container {\n display: flex;\n flex-direction: column;\n gap: 2px;\n flex: 1;\n margin: 0 12px;\n }\n\n .title {\n font-weight: 600;\n color: #f1f5f9;\n font-size: 13px;\n }\n\n\n .subtitle {\n font-size: 10px;\n color: #94a3b8;\n }\n\n .minimize {\n background: none;\n border: none;\n color: #94a3b8;\n font-size: 18px;\n cursor: pointer;\n padding: 4px;\n border-radius: 4px;\n transition: all 0.2s ease;\n line-height: 1;\n font-weight: bold;\n }\n\n .minimize:hover {\n background: rgba(148, 163, 184, 0.1);\n color: #cbd5e1;\n }\n\n .toggles {\n display: flex;\n gap: 12px;\n padding: 8px 16px;\n border-bottom: 1px solid rgba(148, 163, 184, 0.2);\n background: rgba(30, 41, 59, 0.3);\n align-items: center;\n }\n\n .toggle {\n display: flex;\n align-items: center;\n gap: 6px;\n cursor: pointer;\n font-size: 11px;\n color: #cbd5e1;\n transition: color 0.2s ease;\n }\n\n .toggle:hover {\n color: #f1f5f9;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 12px;\n height: 12px;\n accent-color: #3b82f6;\n cursor: pointer;\n }\n\n .clear-btn {\n background: none;\n border: none;\n color: #ef4444;\n font-size: 14px;\n padding: 0;\n cursor: pointer;\n transition: all 0.2s ease;\n margin-left: auto;\n min-width: 20px;\n height: 20px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .clear-btn:hover {\n transform: scale(1.1);\n color: #dc2626;\n }\n\n .logs {\n flex: 1;\n overflow-y: auto;\n overflow-x: hidden;\n padding: 8px;\n background: rgba(15, 23, 42, 0.8);\n min-height: 0;\n max-height: 100%;\n }\n\n .log-entry {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n padding: 8px 12px;\n margin-bottom: 2px;\n border-radius: 6px;\n font-size: 11px;\n line-height: 1.4;\n transition: background-color 0.2s ease;\n user-select: text;\n }\n\n .log-entry:hover {\n background-color: rgba(148, 163, 184, 0.1);\n }\n\n /* Event type background colors */\n .log-entry.event {\n background: rgba(59, 130, 246, 0.1);\n }\n\n .log-entry.action {\n background: rgba(16, 185, 129, 0.1);\n }\n\n .log-entry.gtm {\n background: rgba(245, 158, 11, 0.1);\n }\n\n .log-entry.logger {\n background: rgba(139, 92, 246, 0.1);\n }\n\n\n .log-meta {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 2px;\n min-width: 50px;\n }\n\n .log-type {\n font-weight: 600;\n font-size: 9px;\n padding: 2px 0;\n border-radius: 3px;\n white-space: nowrap;\n text-align: center;\n line-height: 1;\n font-weight: bold;\n letter-spacing: 0.5px;\n }\n\n .log-timestamp {\n color: #64748b;\n font-size: 9px;\n white-space: nowrap;\n line-height: 1;\n }\n\n .log-type.event {\n background: rgba(59, 130, 246, 0.2);\n color: #60a5fa;\n }\n\n .log-type.action {\n color: #34d399;\n }\n\n .log-type.gtm {\n color: #fbbf24;\n }\n\n .log-type.logger {\n color: #a78bfa;\n }\n\n .log-message {\n flex: 1;\n word-break: break-word;\n user-select: text;\n }\n\n .log-context {\n color: #94a3b8;\n font-size: 10px;\n margin-top: 2px;\n font-style: italic;\n }\n\n .log-data {\n background: rgba(30, 41, 59, 0.6);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 4px;\n padding: 8px;\n margin-top: 6px;\n font-size: 10px;\n color: #cbd5e1;\n max-height: 120px;\n overflow-y: auto;\n font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;\n user-select: text;\n }\n\n .log-data pre {\n margin: 0;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .resize-handle {\n position: absolute;\n bottom: 0;\n right: 0;\n width: 12px;\n height: 12px;\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.3) 30%, rgba(148, 163, 184, 0.3) 70%, transparent 70%);\n cursor: nw-resize;\n border-radius: 0 0 12px 0;\n }\n\n .resize-handle:hover {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.7) 30%, rgba(148, 163, 184, 0.7) 70%, transparent 70%);\n transform: scale(1.1);\n }\n\n .resize-handle:active {\n background: linear-gradient(-45deg, transparent 30%, rgba(148, 163, 184, 0.9) 30%, rgba(148, 163, 184, 0.9) 70%, transparent 70%);\n }\n\n /* Scrollbar styling */\n .logs::-webkit-scrollbar {\n width: 6px;\n }\n\n .logs::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 3px;\n }\n\n .logs::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n .log-data::-webkit-scrollbar {\n width: 4px;\n }\n\n .log-data::-webkit-scrollbar-track {\n background: rgba(30, 41, 59, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb {\n background: rgba(148, 163, 184, 0.3);\n border-radius: 2px;\n }\n\n .log-data::-webkit-scrollbar-thumb:hover {\n background: rgba(148, 163, 184, 0.5);\n }\n\n /* Floating button styles */\n .floating-btn {\n position: absolute;\n top: 20px;\n left: 20px;\n width: 40px;\n height: 40px;\n background: rgba(15, 23, 42, 0.95);\n border: 1px solid rgba(148, 163, 184, 0.2);\n border-radius: 50%;\n display: none;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n font-size: 18px;\n user-select: none;\n z-index: 1;\n }\n\n .floating-btn:hover {\n background: rgba(30, 41, 59, 0.95);\n border-color: rgba(148, 163, 184, 0.4);\n }\n\n /* Mobile Responsiveness */\n @media (max-width: 768px) {\n .panel {\n font-size: 11px;\n border-radius: 8px;\n }\n\n .header {\n padding: 8px 12px;\n }\n\n .title {\n font-size: 12px;\n }\n\n .subtitle {\n font-size: 9px;\n }\n\n .toggles {\n padding: 6px 12px;\n gap: 8px;\n flex-wrap: wrap;\n }\n\n .toggle {\n font-size: 10px;\n }\n\n .toggle input[type=\"checkbox\"] {\n width: 10px;\n height: 10px;\n }\n\n .logs {\n padding: 6px;\n }\n\n .log-entry {\n padding: 6px 8px;\n font-size: 10px;\n }\n\n .log-type {\n font-size: 8px;\n }\n\n .log-timestamp {\n font-size: 8px;\n }\n\n .log-data {\n font-size: 9px;\n padding: 6px;\n max-height: 80px;\n }\n\n .floating-btn {\n width: 36px;\n height: 36px;\n font-size: 16px;\n top: 15px;\n left: 15px;\n }\n }\n\n @media (max-width: 480px) {\n .panel {\n font-size: 10px;\n border-radius: 6px;\n }\n\n .header {\n padding: 6px 10px;\n }\n\n .title {\n font-size: 11px;\n }\n\n .subtitle {\n font-size: 8px;\n }\n\n .toggles {\n padding: 4px 10px;\n gap: 6px;\n }\n\n .toggle {\n font-size: 9px;\n }\n\n .logs {\n padding: 4px;\n }\n\n .log-entry {\n padding: 4px 6px;\n font-size: 9px;\n gap: 4px;\n }\n\n .log-meta {\n min-width: 40px;\n }\n\n .log-type {\n font-size: 7px;\n }\n\n .log-timestamp {\n font-size: 7px;\n }\n\n .log-data {\n font-size: 8px;\n padding: 4px;\n max-height: 60px;\n }\n\n .floating-btn {\n width: 32px;\n height: 32px;\n font-size: 14px;\n top: 10px;\n left: 10px;\n }\n }\n";
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
interface FingerprintData {
|
|
2
2
|
screen: string;
|
|
3
|
-
webgl: string;
|
|
4
|
-
canvas: string;
|
|
5
3
|
browser: string;
|
|
6
4
|
timezone: string;
|
|
7
|
-
audio: string;
|
|
8
5
|
}
|
|
9
6
|
export declare class FingerPrintService {
|
|
10
7
|
private readonly keyPrefix;
|
|
11
8
|
private isLocalStorageAvailable;
|
|
9
|
+
private cachedFingerprint;
|
|
12
10
|
static getInstance(): FingerPrintService;
|
|
13
11
|
getId(partnerCode: string): Promise<string>;
|
|
14
|
-
getFingerprintData():
|
|
12
|
+
getFingerprintData(): FingerprintData;
|
|
15
13
|
isLocalStorageWebApiAvailable(): boolean;
|
|
16
14
|
private _createComposedId;
|
|
17
15
|
private _checkLocalStorageAvailability;
|
|
@@ -19,13 +17,10 @@ export declare class FingerPrintService {
|
|
|
19
17
|
private _generateFingerprint;
|
|
20
18
|
private _getScreen;
|
|
21
19
|
private _getColorGamut;
|
|
22
|
-
private _getWebGL;
|
|
23
|
-
private _getCanvas;
|
|
24
20
|
private _getBrowser;
|
|
25
21
|
private _getBrowserEngine;
|
|
22
|
+
private _isWebView;
|
|
26
23
|
private _getTimezone;
|
|
27
|
-
private
|
|
28
|
-
private _hash;
|
|
29
|
-
private _simpleHash;
|
|
24
|
+
private _fastHash;
|
|
30
25
|
}
|
|
31
26
|
export {};
|
|
@@ -35,6 +35,7 @@ interface BaseItem {
|
|
|
35
35
|
upc?: string;
|
|
36
36
|
grouping_id?: string;
|
|
37
37
|
product_id?: string;
|
|
38
|
+
item_size?: string;
|
|
38
39
|
}
|
|
39
40
|
interface PurchaseData {
|
|
40
41
|
transaction_id: string;
|
|
@@ -83,11 +84,135 @@ export declare class GoogleTagManagerService {
|
|
|
83
84
|
email?: string;
|
|
84
85
|
birth_date?: string;
|
|
85
86
|
customer_id?: string;
|
|
87
|
+
}, amounts?: {
|
|
88
|
+
subtotal?: number;
|
|
89
|
+
total_before_discounts?: number;
|
|
90
|
+
discounts?: number;
|
|
91
|
+
gift_cards?: number;
|
|
92
|
+
net_total?: number;
|
|
86
93
|
}): void;
|
|
87
94
|
addPaymentInfo(items: BaseItem[], paymentType?: string, coupon?: string): void;
|
|
88
|
-
addPaymentInfoWithoutItems(value: number, paymentType?: string, coupon?: string
|
|
89
|
-
|
|
95
|
+
addPaymentInfoWithoutItems(value: number, paymentType?: string, coupon?: string, amounts?: {
|
|
96
|
+
subtotal?: number;
|
|
97
|
+
total_before_discounts?: number;
|
|
98
|
+
discounts?: number;
|
|
99
|
+
gift_cards?: number;
|
|
100
|
+
net_total?: number;
|
|
101
|
+
}): void;
|
|
102
|
+
purchase(purchaseData: PurchaseData & {
|
|
103
|
+
subtotal?: number;
|
|
104
|
+
total_before_discounts?: number;
|
|
105
|
+
discounts?: number;
|
|
106
|
+
gift_cards?: number;
|
|
107
|
+
net_total?: number;
|
|
108
|
+
}): void;
|
|
109
|
+
promoCodeAttempt(code: string): void;
|
|
110
|
+
promoCodeApplied(code: string, discountAmount?: number): void;
|
|
111
|
+
promoCodeFailed(code: string, reason?: string): void;
|
|
112
|
+
giftCardAttempt(code: string): void;
|
|
113
|
+
giftCardApplied(code: string, appliedAmount?: number): void;
|
|
114
|
+
giftCardFailed(code: string, reason?: string): void;
|
|
90
115
|
increaseQuantity(item: BaseItem): void;
|
|
91
116
|
decreaseQuantity(item: BaseItem): void;
|
|
117
|
+
addressUpdated(addressData: {
|
|
118
|
+
googlePlacesId: string;
|
|
119
|
+
formattedAddress: string;
|
|
120
|
+
address: {
|
|
121
|
+
one?: string;
|
|
122
|
+
two?: string;
|
|
123
|
+
city?: string;
|
|
124
|
+
state?: string;
|
|
125
|
+
zip?: string;
|
|
126
|
+
country?: string;
|
|
127
|
+
};
|
|
128
|
+
coordinates?: {
|
|
129
|
+
lat: number;
|
|
130
|
+
long: number;
|
|
131
|
+
};
|
|
132
|
+
}): void;
|
|
133
|
+
addressFailed(errorData: {
|
|
134
|
+
googlePlacesId?: string;
|
|
135
|
+
formattedAddress?: string;
|
|
136
|
+
address?: {
|
|
137
|
+
one?: string;
|
|
138
|
+
two?: string;
|
|
139
|
+
city?: string;
|
|
140
|
+
state?: string;
|
|
141
|
+
zip?: string;
|
|
142
|
+
country?: string;
|
|
143
|
+
};
|
|
144
|
+
error: string;
|
|
145
|
+
}): void;
|
|
146
|
+
productNoAvailability(productData: {
|
|
147
|
+
productId: string;
|
|
148
|
+
productName: string;
|
|
149
|
+
productBrand?: string;
|
|
150
|
+
productCategory?: string;
|
|
151
|
+
productCategory2?: string;
|
|
152
|
+
productCategory3?: string;
|
|
153
|
+
productType?: string;
|
|
154
|
+
productSubtype?: string;
|
|
155
|
+
productPrice?: number;
|
|
156
|
+
upc?: string;
|
|
157
|
+
groupingId?: string;
|
|
158
|
+
address?: {
|
|
159
|
+
one?: string;
|
|
160
|
+
two?: string;
|
|
161
|
+
city?: string;
|
|
162
|
+
state?: string;
|
|
163
|
+
zip?: string;
|
|
164
|
+
country?: string;
|
|
165
|
+
};
|
|
166
|
+
reason: string;
|
|
167
|
+
}): void;
|
|
168
|
+
productSizeNoAvailability(productData: {
|
|
169
|
+
productId: string;
|
|
170
|
+
productName: string;
|
|
171
|
+
productBrand?: string;
|
|
172
|
+
productCategory?: string;
|
|
173
|
+
productCategory2?: string;
|
|
174
|
+
productCategory3?: string;
|
|
175
|
+
productType?: string;
|
|
176
|
+
productSubtype?: string;
|
|
177
|
+
productPrice?: number;
|
|
178
|
+
sizeId: string;
|
|
179
|
+
sizeName?: string;
|
|
180
|
+
upc?: string;
|
|
181
|
+
groupingId?: string;
|
|
182
|
+
address?: {
|
|
183
|
+
one?: string;
|
|
184
|
+
two?: string;
|
|
185
|
+
city?: string;
|
|
186
|
+
state?: string;
|
|
187
|
+
zip?: string;
|
|
188
|
+
country?: string;
|
|
189
|
+
};
|
|
190
|
+
reason: string;
|
|
191
|
+
}): void;
|
|
192
|
+
productFulfillmentNoAvailability(productData: {
|
|
193
|
+
productId: string;
|
|
194
|
+
productName: string;
|
|
195
|
+
productBrand?: string;
|
|
196
|
+
productCategory?: string;
|
|
197
|
+
productCategory2?: string;
|
|
198
|
+
productCategory3?: string;
|
|
199
|
+
productType?: string;
|
|
200
|
+
productSubtype?: string;
|
|
201
|
+
productPrice?: number;
|
|
202
|
+
sizeId?: string;
|
|
203
|
+
sizeName?: string;
|
|
204
|
+
fulfillmentType: string;
|
|
205
|
+
upc?: string;
|
|
206
|
+
groupingId?: string;
|
|
207
|
+
address?: {
|
|
208
|
+
one?: string;
|
|
209
|
+
two?: string;
|
|
210
|
+
city?: string;
|
|
211
|
+
state?: string;
|
|
212
|
+
zip?: string;
|
|
213
|
+
country?: string;
|
|
214
|
+
};
|
|
215
|
+
reason: string;
|
|
216
|
+
}): void;
|
|
92
217
|
}
|
|
93
218
|
export {};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import type { TelemetryService } from '@/core/telemetry/telemetry.service';
|
|
1
2
|
import { LoggerService } from './logger.service';
|
|
2
3
|
export declare class LoggerFactory {
|
|
3
4
|
private static instances;
|
|
4
5
|
private static enableLoggingGlobally;
|
|
6
|
+
private static telemetryService;
|
|
5
7
|
private static getInstances;
|
|
6
8
|
static get(context: string): LoggerService;
|
|
7
9
|
static setEnableLogging(enable: boolean): void;
|
|
10
|
+
static setTelemetryService(telemetry: TelemetryService): void;
|
|
8
11
|
}
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
import type { TelemetryService } from '@/core/telemetry/telemetry.service';
|
|
1
2
|
export declare class LoggerService {
|
|
2
3
|
private readonly prefix;
|
|
3
4
|
private readonly colors;
|
|
4
5
|
private readonly context;
|
|
5
6
|
private enableLogging;
|
|
7
|
+
private telemetryService;
|
|
6
8
|
private constructor();
|
|
7
9
|
static getInstance(context: string): LoggerService;
|
|
8
10
|
setEnableLogging(enable: boolean): void;
|
|
11
|
+
setTelemetryService(telemetry: TelemetryService): void;
|
|
9
12
|
private getPrefix;
|
|
10
|
-
debug(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
error(...args: any[]): void;
|
|
13
|
+
debug(message: string, data?: Record<string, any>): void;
|
|
14
|
+
info(message: string, data?: Record<string, any>): void;
|
|
15
|
+
warn(message: string, data?: Record<string, any>): void;
|
|
16
|
+
error(message: string, error?: Error | Record<string, any>): void;
|
|
15
17
|
group(label: string, collapsed?: boolean): void;
|
|
16
18
|
groupEnd(): void;
|
|
19
|
+
private sendToTelemetry;
|
|
17
20
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IAddressActionEventData, ICartFailedEventData, ICartItemAddedEventData, ICartItemEngravingUpdatedEventData, ICartItemQuantityChangedEventData, ICartItemRemovedEventData, ICartLoadedEventData, ICartProductAddEventData, ICartProductAddFailedEventData, ICartPromoCodeEventData, ICartPromoCodeFailedEventData, ICartUpdatedEventData, ICheckoutFailedEventData, ICheckoutFormUpdatedEventData, ICheckoutGiftCardEventData, ICheckoutGiftCardFailedEventData, ICheckoutItemEngravingUpdatedEventData, ICheckoutItemQuantityChangedEventData, ICheckoutItemRemovedEventData, ICheckoutLoadedEventData, ICheckoutMarketingPreferencesToggleEventData, ICheckoutProductAddEventData, ICheckoutProductAddFailedEventData, ICheckoutPromoCodeEventData, ICheckoutPromoCodeFailedEventData, ICheckoutSubmitCompletedEventData, ICheckoutSubmitFailedEventData, ICheckoutSubmitStartedEventData, ICheckoutTipUpdatedEventData, ICheckoutToggleEventData, IElementsClientIsReadyEventData, IProductAddToCartEventData,
|
|
1
|
+
import type { IAddressActionEventData, ICartFailedEventData, ICartItemAddedEventData, ICartItemEngravingUpdatedEventData, ICartItemQuantityChangedEventData, ICartItemRemovedEventData, ICartLoadedEventData, ICartProductAddEventData, ICartProductAddFailedEventData, ICartPromoCodeEventData, ICartPromoCodeFailedEventData, ICartUpdatedEventData, ICheckoutFailedEventData, ICheckoutFormUpdatedEventData, ICheckoutGiftCardEventData, ICheckoutGiftCardFailedEventData, ICheckoutItemEngravingUpdatedEventData, ICheckoutItemQuantityChangedEventData, ICheckoutItemRemovedEventData, ICheckoutLoadedEventData, ICheckoutMarketingPreferencesToggleEventData, ICheckoutProductAddEventData, ICheckoutProductAddFailedEventData, ICheckoutPromoCodeEventData, ICheckoutPromoCodeFailedEventData, ICheckoutSubmitCompletedEventData, ICheckoutSubmitFailedEventData, ICheckoutSubmitStartedEventData, ICheckoutTipUpdatedEventData, ICheckoutToggleEventData, IElementsClientIsReadyEventData, IProductAddToCartEventData, IProductFulfillmentChangedEventData, IProductFulfillmentTypeChangedEventData, IProductLoadedEventData, IProductQuantityChangedEventData, IProductSizeChangedEventData } from '@/core/pubsub';
|
|
2
2
|
import { ELEMENTS_ACTIONS_EVENT } from '@/enums';
|
|
3
3
|
export interface IEventMetadata {
|
|
4
4
|
eventId: string;
|
|
@@ -21,7 +21,6 @@ export interface IElementsActionsEventsMap {
|
|
|
21
21
|
[ELEMENTS_ACTIONS_EVENT.PRODUCT_SIZE_CHANGED]: IProductSizeChangedEventData;
|
|
22
22
|
[ELEMENTS_ACTIONS_EVENT.PRODUCT_FULFILLMENT_TYPE_CHANGED]: IProductFulfillmentTypeChangedEventData;
|
|
23
23
|
[ELEMENTS_ACTIONS_EVENT.PRODUCT_FULFILLMENT_CHANGED]: IProductFulfillmentChangedEventData;
|
|
24
|
-
[ELEMENTS_ACTIONS_EVENT.PRODUCT_ENGRAVING_UPDATED]: IProductEngravingUpdatedEventData;
|
|
25
24
|
[ELEMENTS_ACTIONS_EVENT.CART_CLOSED]: boolean;
|
|
26
25
|
[ELEMENTS_ACTIONS_EVENT.CART_OPENED]: boolean;
|
|
27
26
|
[ELEMENTS_ACTIONS_EVENT.CART_UPDATED]: ICartUpdatedEventData;
|
|
@@ -71,7 +70,7 @@ export interface IElementsActionsEventsMap {
|
|
|
71
70
|
export type SpecificActionEvent = keyof IElementsActionsEventsMap;
|
|
72
71
|
export interface IFormEventData {
|
|
73
72
|
fieldName: string;
|
|
74
|
-
fieldValue
|
|
73
|
+
fieldValue?: string;
|
|
75
74
|
}
|
|
76
75
|
export interface IElementsFormsEventsMap {
|
|
77
76
|
customer: IFormEventData;
|
|
@@ -84,8 +84,3 @@ export interface IProductFulfillmentChangedEventData {
|
|
|
84
84
|
previousFulfillmentId: string;
|
|
85
85
|
previousFulfillmentType: FulfillmentType;
|
|
86
86
|
}
|
|
87
|
-
export interface IProductEngravingUpdatedEventData {
|
|
88
|
-
identifier: string;
|
|
89
|
-
engravingLines: string[];
|
|
90
|
-
previousEngravingLines: string[];
|
|
91
|
-
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IAddressStore, ICheckoutBillingStore, ICheckoutCustomerStore, ICheckoutItemStore, ICheckoutMarketingPreferencesStore, ICheckoutPaymentStore, ICheckoutStore, IProductSizeStore, IProductStore } from '@/core/store';
|
|
1
|
+
import type { IAddressStore, ICartPromoCodeStore, ICheckoutBillingStore, ICheckoutCustomerStore, ICheckoutGiftRecipientStore, ICheckoutItemStore, ICheckoutMarketingPreferencesStore, ICheckoutPaymentStore, ICheckoutPromoCodeStore, ICheckoutReadyForSubmitStore, ICheckoutStore, ICheckoutStripeFormStatusStore, IProductSizeStore, IProductStore } from '@/core/store';
|
|
2
2
|
import type { ComponentType } from '@/enums';
|
|
3
3
|
import type { ICartItemStore, ICartStore, ICartTotalsStore, IRetailerFulfillmentStore, IRetailerStore } from './cart.interface';
|
|
4
4
|
export interface IDrawerContentConfig {
|
|
@@ -23,7 +23,7 @@ export interface IPersistedStore {
|
|
|
23
23
|
p: string;
|
|
24
24
|
c: string;
|
|
25
25
|
}
|
|
26
|
-
export type StorePaths = keyof IGlobalStore | `products.${string}` | `products.${string}.${keyof IProductStore}` | `products.${string}.sizes.${string}` | `products.${string}.sizes.${string}.${keyof IProductSizeStore}` | `address.${keyof IAddressStore}` | `cart.${keyof ICartStore}` | `cart.items.${string}` | `cart.items.${string}.${keyof ICartItemStore}` | `cart.totals.${keyof ICartTotalsStore}` | `cart.retailers.${string}` | `cart.items.${string}.${keyof IRetailerStore}` | `cart.fulfillments.${string}` | `cart.fulfillments.${string}.${keyof IRetailerFulfillmentStore}` | `cart.promoCode.${keyof
|
|
26
|
+
export type StorePaths = keyof IGlobalStore | `products.${string}` | `products.${string}.${keyof IProductStore}` | `products.${string}.sizes.${string}` | `products.${string}.sizes.${string}.${keyof IProductSizeStore}` | `address.${keyof IAddressStore}` | `cart.${keyof ICartStore}` | `cart.items.${string}` | `cart.items.${string}.${keyof ICartItemStore}` | `cart.totals.${keyof ICartTotalsStore}` | `cart.retailers.${string}` | `cart.items.${string}.${keyof IRetailerStore}` | `cart.fulfillments.${string}` | `cart.fulfillments.${string}.${keyof IRetailerFulfillmentStore}` | `cart.promoCode.${keyof ICartPromoCodeStore}` | `ui.${keyof IUIStore}` | `ui.drawer.${keyof IDrawerStore}` | `checkout.${keyof ICheckoutStore}` | `checkout.customer.${keyof ICheckoutCustomerStore}` | `checkout.marketingPreferences.${keyof ICheckoutMarketingPreferencesStore}` | `checkout.payment.${keyof ICheckoutPaymentStore}` | `checkout.billing.${keyof ICheckoutBillingStore}` | `checkout.giftRecipient.${keyof ICheckoutGiftRecipientStore}` | `checkout.giftCards.${string}` | `checkout.promoCode.${keyof ICheckoutPromoCodeStore}` | `checkout.items.${string}` | `checkout.items.${string}.${keyof ICheckoutItemStore}` | `checkout.readyForSubmit.${keyof ICheckoutReadyForSubmitStore}` | `checkout.onDemandFulfillmentTipInfo.${string}` | `checkout.readyForSubmit.${string}` | `checkout.stripeFormStatus.${keyof ICheckoutStripeFormStatusStore}`;
|
|
27
27
|
interface MiddlewareContext {
|
|
28
28
|
action: string;
|
|
29
29
|
payload: any;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { DeviceType } from '@/core/client/client-config.service';
|
|
2
|
+
import type { ComponentType, ElementsEnv } from '@/enums';
|
|
3
|
+
export type TelemetryLevel = 'debug' | 'log' | 'info' | 'warn' | 'error' | 'fatal';
|
|
4
|
+
export interface ITelemetryConfig {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
endpoint: string;
|
|
7
|
+
batchSize: number;
|
|
8
|
+
batchInterval: number;
|
|
9
|
+
includeDebugLogs: boolean;
|
|
10
|
+
includeWarnings: boolean;
|
|
11
|
+
includeErrors: boolean;
|
|
12
|
+
maxQueueSize: number;
|
|
13
|
+
}
|
|
14
|
+
export interface ITelemetryEventOptions {
|
|
15
|
+
context?: string;
|
|
16
|
+
error?: Error;
|
|
17
|
+
component?: ITelemetryComponentContext;
|
|
18
|
+
data?: Record<string, any>;
|
|
19
|
+
}
|
|
20
|
+
export interface ITelemetryEvent {
|
|
21
|
+
eventId: string;
|
|
22
|
+
timestamp: number;
|
|
23
|
+
level: TelemetryLevel;
|
|
24
|
+
message: string;
|
|
25
|
+
context?: string;
|
|
26
|
+
error?: ITelemetryError;
|
|
27
|
+
component?: ITelemetryComponentContext;
|
|
28
|
+
data?: Record<string, any>;
|
|
29
|
+
metadata: {
|
|
30
|
+
sdk: ITelemetrySDKContext;
|
|
31
|
+
user: ITelemetryUserContext;
|
|
32
|
+
browser: ITelemetryBrowserContext;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export interface ITelemetryError {
|
|
36
|
+
name: string;
|
|
37
|
+
message: string;
|
|
38
|
+
stack?: string;
|
|
39
|
+
code?: string | number;
|
|
40
|
+
statusCode?: number;
|
|
41
|
+
}
|
|
42
|
+
export interface ITelemetrySDKContext {
|
|
43
|
+
version: string;
|
|
44
|
+
env: ElementsEnv;
|
|
45
|
+
isBuilder: boolean;
|
|
46
|
+
partnerCode?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface ITelemetryComponentContext {
|
|
49
|
+
type: ComponentType;
|
|
50
|
+
tagName: string;
|
|
51
|
+
renderCount?: number;
|
|
52
|
+
renderTrigger?: string;
|
|
53
|
+
renderDuration?: number;
|
|
54
|
+
useShadowDom?: boolean;
|
|
55
|
+
}
|
|
56
|
+
export interface ITelemetryUserContext {
|
|
57
|
+
deviceId: string;
|
|
58
|
+
sessionId?: string;
|
|
59
|
+
isLocalStorageAvailable: boolean;
|
|
60
|
+
}
|
|
61
|
+
export interface ITelemetryBrowserContext {
|
|
62
|
+
userAgent: string;
|
|
63
|
+
deviceType: DeviceType;
|
|
64
|
+
url: string;
|
|
65
|
+
referrer?: string;
|
|
66
|
+
timezone?: string;
|
|
67
|
+
}
|
|
68
|
+
export interface ITelemetryBatchPayload {
|
|
69
|
+
batchId: string;
|
|
70
|
+
timestamp: number;
|
|
71
|
+
events: ITelemetryEvent[];
|
|
72
|
+
}
|
|
73
|
+
export interface ITelemetryStats {
|
|
74
|
+
totalEvents: number;
|
|
75
|
+
eventsByLevel: Record<TelemetryLevel, number>;
|
|
76
|
+
batchesSent: number;
|
|
77
|
+
failedBatches: number;
|
|
78
|
+
queuedEvents: number;
|
|
79
|
+
droppedEvents: number;
|
|
80
|
+
}
|