@selwise/widget 1.0.1 → 1.0.3

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.
@@ -0,0 +1 @@
1
+ /*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */
@@ -0,0 +1,59 @@
1
+ export interface WidgetConfig {
2
+ siteKey: string;
3
+ apiUrl?: string;
4
+ exposeGlobal?: boolean;
5
+ }
6
+
7
+ export interface ConsentState {
8
+ necessary: boolean;
9
+ analytics: boolean;
10
+ marketing: boolean;
11
+ preferences: boolean;
12
+ }
13
+
14
+ export interface SelwiseDataLayer {
15
+ event?: string;
16
+ [key: string]: unknown;
17
+ }
18
+
19
+ export interface TrackArgs {
20
+ entityType?: string;
21
+ entityId?: string;
22
+ metadata?: Record<string, any>;
23
+ }
24
+
25
+ export declare class Selwise {
26
+ readonly siteKey: string;
27
+ readonly apiUrl: string;
28
+ readonly trackingConfig: any;
29
+
30
+ constructor();
31
+
32
+ init(config: Partial<WidgetConfig>): Promise<void>;
33
+ destroy(): void;
34
+ track(name: string, args?: TrackArgs): void;
35
+ trackOrder(order: Record<string, any>): Promise<void>;
36
+ identify(
37
+ userId: string,
38
+ metadata?: Record<string, any>
39
+ ): Promise<{ success: boolean; merged?: boolean }>;
40
+ setTraits(traits: Record<string, any>): Promise<boolean>;
41
+ getSiteUserId(): string | undefined;
42
+ getVisitorId(): string;
43
+ getSessionId(): string;
44
+ getJourneyId(): string | null;
45
+ getJourneyState(): { journeyId: string | null; age: number | null; isValid: boolean };
46
+ endJourney(): void;
47
+ getVariant(experimentId: string): any;
48
+ getExperimentVariant(experimentId: string): string | null;
49
+ getActiveExperiments(): any[];
50
+ pushDataLayer(data: SelwiseDataLayer): void;
51
+ getDataLayer(): SelwiseDataLayer[];
52
+ getConsentState(): ConsentState | null;
53
+ grantConsent(categories?: Partial<ConsentState>): void;
54
+ revokeConsent(categories?: (keyof ConsentState)[]): void;
55
+ }
56
+
57
+ export declare function resolveApiUrl(input?: string | null): string;
58
+
59
+ export default Selwise;
@@ -0,0 +1,59 @@
1
+ export interface WidgetConfig {
2
+ siteKey: string;
3
+ apiUrl?: string;
4
+ exposeGlobal?: boolean;
5
+ }
6
+
7
+ export interface ConsentState {
8
+ necessary: boolean;
9
+ analytics: boolean;
10
+ marketing: boolean;
11
+ preferences: boolean;
12
+ }
13
+
14
+ export interface SelwiseDataLayer {
15
+ event?: string;
16
+ [key: string]: unknown;
17
+ }
18
+
19
+ export interface TrackArgs {
20
+ entityType?: string;
21
+ entityId?: string;
22
+ metadata?: Record<string, any>;
23
+ }
24
+
25
+ export declare class Selwise {
26
+ readonly siteKey: string;
27
+ readonly apiUrl: string;
28
+ readonly trackingConfig: any;
29
+
30
+ constructor();
31
+
32
+ init(config: Partial<WidgetConfig>): Promise<void>;
33
+ destroy(): void;
34
+ track(name: string, args?: TrackArgs): void;
35
+ trackOrder(order: Record<string, any>): Promise<void>;
36
+ identify(
37
+ userId: string,
38
+ metadata?: Record<string, any>
39
+ ): Promise<{ success: boolean; merged?: boolean }>;
40
+ setTraits(traits: Record<string, any>): Promise<boolean>;
41
+ getSiteUserId(): string | undefined;
42
+ getVisitorId(): string;
43
+ getSessionId(): string;
44
+ getJourneyId(): string | null;
45
+ getJourneyState(): { journeyId: string | null; age: number | null; isValid: boolean };
46
+ endJourney(): void;
47
+ getVariant(experimentId: string): any;
48
+ getExperimentVariant(experimentId: string): string | null;
49
+ getActiveExperiments(): any[];
50
+ pushDataLayer(data: SelwiseDataLayer): void;
51
+ getDataLayer(): SelwiseDataLayer[];
52
+ getConsentState(): ConsentState | null;
53
+ grantConsent(categories?: Partial<ConsentState>): void;
54
+ revokeConsent(categories?: (keyof ConsentState)[]): void;
55
+ }
56
+
57
+ export declare function resolveApiUrl(input?: string | null): string;
58
+
59
+ export default Selwise;