@maestro_io/maestro-web-sdk 2.2.1 → 2.2.2

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.
Files changed (31) hide show
  1. package/dist/MaestroEventDelegate.d.ts +3 -0
  2. package/dist/components/organisms/SegmentController/SegmentController.d.ts +1 -0
  3. package/dist/external/AxiosNetworkClient.d.ts +1 -1
  4. package/dist/external/ports/networkClient.d.ts +1 -1
  5. package/dist/index.d.ts +9 -1
  6. package/dist/interfaces/IMaestroEventDelegate.d.ts +11 -0
  7. package/dist/interfaces/IMaestroManager.d.ts +2 -1
  8. package/dist/maestro-web-sdk.umd.js +3 -3
  9. package/dist/maestro-web-sdk.umd.js.map +1 -1
  10. package/dist/modules/bets/types/BetsAnalyticsTypes.d.ts +25 -0
  11. package/dist/modules/bets/view/SixPack/SixPackView.d.ts +1 -0
  12. package/dist/modules/bets/view/UserBets/UserBetsView.d.ts +0 -1
  13. package/dist/modules/bets/view/components/PromoCodeBanner/PromoCodeBanner.d.ts +1 -0
  14. package/dist/modules/bets/view-model/BetsViewModel.d.ts +19 -1
  15. package/dist/modules/key-plays/view-model/KeyPlaysViewModel.d.ts +4 -0
  16. package/dist/modules/stats/interfaces/IStats.d.ts +1 -1
  17. package/dist/modules/stats/view/ActiveAthletes/ActiveAthletes.d.ts +1 -0
  18. package/dist/modules/stats/view/ActiveAthletes/CollapsedAthletes/CollapsedAthletes.d.ts +1 -1
  19. package/dist/modules/stats/view/ActiveAthletes/ExpandedAthletes/ExpandedAthletes.d.ts +1 -1
  20. package/dist/modules/stats/view/DriveSummary/DriveSummary.d.ts +1 -0
  21. package/dist/modules/stats/view/GameLeaders/GameLeaders.d.ts +1 -0
  22. package/dist/modules/stats/view/StatsItemView.d.ts +2 -0
  23. package/dist/modules/stats/view/StatsView.d.ts +1 -0
  24. package/dist/modules/stats/view-model/StatsViewModel.d.ts +6 -2
  25. package/dist/services/AnalyticsService/AnalyticsService.d.ts +65 -0
  26. package/dist/services/AnalyticsService/types.d.ts +65 -0
  27. package/dist/services/InsightsService/InsightsPayloadBuilder.d.ts +278 -0
  28. package/dist/services/InsightsService/InsightsService.d.ts +10 -0
  29. package/dist/services/NetworkManager/NetworkManager.d.ts +2 -17
  30. package/dist/services/NetworkManager/types.d.ts +0 -4
  31. package/package.json +1 -1
@@ -0,0 +1,25 @@
1
+ import { BaseMetadata } from '../../../services/AnalyticsService/types';
2
+ /**
3
+ * Valid bet types as specified in the analytics spec
4
+ */
5
+ export type BetType = 'straight' | 'parlay' | 'parlay_plus' | 'teaser' | 'boost';
6
+ /**
7
+ * Valid card types for bets module
8
+ */
9
+ export type BetCardType = '6-pack' | 'my bets > live' | 'my bets > settled' | 'my bets > upcoming' | 'hot-props' | 'promo' | 'disclaimer';
10
+ /**
11
+ * Metadata for bet panel view events
12
+ */
13
+ export interface BetPanelViewMetadata extends BaseMetadata {
14
+ in_game_bets: number;
15
+ total_bets: number;
16
+ }
17
+ /**
18
+ * Metadata for bet card click events
19
+ */
20
+ export interface BetCardClickMetadata extends BaseMetadata {
21
+ card: BetCardType;
22
+ in_game_bets: number;
23
+ total_bets: number;
24
+ bet_type: BetType | null;
25
+ }
@@ -15,6 +15,7 @@ export default class FocusableSixPackViewWrapper extends React.Component<Props>
15
15
  context: import("@/components/core/ScrollableContainer/ScrollableContainer").ScrollableContainerContextType;
16
16
  onBecameFocused: (layout: Layout) => void;
17
17
  onArrowPress: (d: Direction, _props: any) => void;
18
+ onEnterPress: () => void;
18
19
  render(): React.JSX.Element;
19
20
  }
20
21
  export {};
@@ -17,7 +17,6 @@ declare class UserBetsView extends React.Component<UserBetsViewProps, {
17
17
  segmentItems: (SegmentItem & {
18
18
  type: Segments;
19
19
  })[];
20
- onSegmentChange: (segment: Segments) => void;
21
20
  renderBet: (bet: IUserBet) => React.JSX.Element | null;
22
21
  renderBets: () => React.JSX.Element | (React.JSX.Element | null)[];
23
22
  get bets(): IUserBet[] | null;
@@ -18,5 +18,6 @@ export default class FocusablePromoCodeBannerWrapper extends React.Component<Pro
18
18
  context: import("@/components/core/ScrollableContainer/ScrollableContainer").ScrollableContainerContextType;
19
19
  onBecameFocused: (layout: Layout) => void;
20
20
  onArrowPress: (d: Direction, _props: any) => void;
21
+ onEnterPress: () => void;
21
22
  render(): React.JSX.Element;
22
23
  }
@@ -3,6 +3,7 @@ import { ITeam, IUserBet, IBetLeg } from '../interfaces/IBets';
3
3
  import { ViewModel } from '../../../view-models/ViewModel';
4
4
  import { TestUseCase } from '@/interfaces/IMaestroEvent';
5
5
  import IMaestroEventDelegate from '@/interfaces/IMaestroEventDelegate';
6
+ import { BetCardType, BetType } from '../types/BetsAnalyticsTypes';
6
7
  declare const BET_ITEM_TYPE: {
7
8
  readonly ODDS: "odds";
8
9
  readonly USER_BETS: "userBets";
@@ -108,6 +109,7 @@ export declare class BetsViewModel extends ViewModel {
108
109
  private eventId;
109
110
  private delegate;
110
111
  private betsService;
112
+ private analyticsService;
111
113
  private pollingInterval;
112
114
  private pollingTask;
113
115
  private lastNonPersonalizedResponseHash;
@@ -128,6 +130,22 @@ export declare class BetsViewModel extends ViewModel {
128
130
  * Clean up resources when the ViewModel is no longer needed
129
131
  */
130
132
  cleanup(): void;
133
+ /**
134
+ * Track panel view event
135
+ */
136
+ private trackPanelView;
137
+ /**
138
+ * Track card click event
139
+ */
140
+ trackCardClick(cardType: BetCardType, betType?: BetType | null): Promise<void>;
141
+ /**
142
+ * Get base metadata for analytics events
143
+ */
144
+ private getBaseMetadata;
145
+ /**
146
+ * Get user bet counts for analytics
147
+ */
148
+ private getUserBetCounts;
131
149
  /**
132
150
  * Refresh polling for bet data
133
151
  */
@@ -181,7 +199,7 @@ export declare class BetsViewModel extends ViewModel {
181
199
  */
182
200
  shouldHideWagers(): boolean;
183
201
  /**
184
- * Update hideWagers Observable from current settings (reactive approach)
202
+ * Update hideWagers Observable from current settings
185
203
  */
186
204
  private updateHideWagersFromSettings;
187
205
  private refreshBetItemsWithNewSettings;
@@ -1,6 +1,7 @@
1
1
  import IMaestroKeyPlaysResponse from '../interfaces/IKeyPlaysResponse';
2
2
  import IKeyPlay, { KeyPlayLoadFailureStatus, KeyPlaysErrorState } from '../interfaces/IKeyPlays';
3
3
  import { Observable } from '@/helpers/Observable';
4
+ import AnalyticsService from '@/services/AnalyticsService/AnalyticsService';
4
5
  type KeyPlayItem = {
5
6
  title: string;
6
7
  items: IKeyPlay[];
@@ -15,6 +16,8 @@ declare class KeyPlaysViewModel {
15
16
  }>;
16
17
  items: Observable<KeyPlayItem[]>;
17
18
  filteredItems: Observable<KeyPlayItem[]>;
19
+ analyticsService: AnalyticsService;
20
+ constructor();
18
21
  onUpdatePlayerTimeCode(playerTimeCode: number | null): void;
19
22
  private filterItemsByPlayerTimeCode;
20
23
  private shouldShowKeyPlay;
@@ -22,6 +25,7 @@ declare class KeyPlaysViewModel {
22
25
  setKeyPlays(items: IMaestroKeyPlaysResponse | null, playerTimeCode: number | null): Promise<void>;
23
26
  private cleanErrors;
24
27
  playKeyPlay(atIndex: number): Promise<void>;
28
+ init(): Promise<void>;
25
29
  parseNetworkResponse(response: IMaestroKeyPlaysResponse): KeyPlayItem[];
26
30
  get allItems(): IKeyPlay[];
27
31
  clipID(forKeyPlayAtIndex: number): string | undefined;
@@ -15,7 +15,7 @@ export interface Team {
15
15
  shortDisplayName?: string;
16
16
  color?: string;
17
17
  alternateColor?: string;
18
- logo: string;
18
+ logo?: string;
19
19
  statistics?: TeamStatistic[];
20
20
  homeAway?: string;
21
21
  record?: string;
@@ -5,6 +5,7 @@ import { ActiveAthletesItem } from '../../view-model/StatsViewModel';
5
5
  export type ActiveAthletesProps = {
6
6
  item: ActiveAthletesItem;
7
7
  onBecameFocused: (layout: Layout) => void;
8
+ onEnterPress: () => void;
8
9
  };
9
10
  declare class ActiveAthletes extends React.Component<ActiveAthletesProps, {
10
11
  expanded: boolean;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import './CollapsedAthletes.styles.css';
3
3
  import { ActiveAthletesProps } from '../ActiveAthletes';
4
- declare const CollapsedAthletes: (props: ActiveAthletesProps) => React.JSX.Element;
4
+ declare const CollapsedAthletes: (props: Pick<ActiveAthletesProps, 'item'>) => React.JSX.Element;
5
5
  export default CollapsedAthletes;
@@ -5,6 +5,6 @@ import { Direction } from '@/external/spatial-navigation/utils';
5
5
  type Props = {
6
6
  onArrowPress: (index: number) => (direction: Direction) => void;
7
7
  onBackPress: () => void;
8
- } & ActiveAthletesProps;
8
+ } & Pick<ActiveAthletesProps, 'item' | 'onBecameFocused' | 'onEnterPress'>;
9
9
  declare const ExpandedAthletes: (props: Props) => React.JSX.Element;
10
10
  export default ExpandedAthletes;
@@ -5,6 +5,7 @@ import './DriveSummary.styles.css';
5
5
  import { DriveSummaryItem } from '../../view-model/StatsViewModel';
6
6
  type DriveSummaryProps = {
7
7
  item: DriveSummaryItem;
8
+ onItemEnterPress: () => void;
8
9
  };
9
10
  export default class DriveSummary extends React.Component<DriveSummaryProps & WithFocusableProps> {
10
11
  static contextTypes: {
@@ -4,6 +4,7 @@ import { GameLeadersStatsItem } from '../../view-model/StatsViewModel';
4
4
  import { Direction, Layout } from '@/external/spatial-navigation/utils';
5
5
  export type GameLeaderProps = {
6
6
  item: GameLeadersStatsItem;
7
+ onEnterPress: () => void;
7
8
  };
8
9
  declare class GameLeaders extends React.Component<GameLeaderProps> {
9
10
  static contextTypes: {
@@ -3,6 +3,7 @@ import { StatsItem } from '../view-model/StatsViewModel';
3
3
  import { Direction, Layout } from '@/external/spatial-navigation/utils';
4
4
  type Props = {
5
5
  item: StatsItem;
6
+ onEnterPress: (item: StatsItem) => void;
6
7
  };
7
8
  declare class StatsItemView extends React.Component<Props> {
8
9
  static contextTypes: {
@@ -13,6 +14,7 @@ declare class StatsItemView extends React.Component<Props> {
13
14
  context: import("@/components/core/ScrollableContainer/ScrollableContainer").ScrollableContainerContextType;
14
15
  onBecameFocused: (layout: Layout) => void;
15
16
  onArrowPress: (d: Direction) => void;
17
+ onEnterPress: (item: StatsItem) => () => void;
16
18
  renderItem(): React.JSX.Element | null;
17
19
  render(): React.JSX.Element;
18
20
  }
@@ -15,6 +15,7 @@ declare class StatsView extends Component<{}, StatsViewState> {
15
15
  componentDidMount(): void;
16
16
  componentWillUnmount(): void;
17
17
  renderItems: () => React.JSX.Element[] | null;
18
+ onEnterPress: (item: StatsItem) => void;
18
19
  render(): React.JSX.Element;
19
20
  }
20
21
  export default StatsView;
@@ -4,6 +4,7 @@ import { DrivePlay, Team } from '../interfaces/IStats';
4
4
  import { AthletesStatisticsItem } from '../view/components/AthletesStatistics/AthletesStatistics';
5
5
  import StatsService from '@/services/StatsService';
6
6
  import IMaestroEventDelegate from '@/interfaces/IMaestroEventDelegate';
7
+ import AnalyticsService from '@/services/AnalyticsService/AnalyticsService';
7
8
  declare const STATS_ERROR_STATE: {
8
9
  readonly NONE: "none";
9
10
  readonly TAB_LOAD_FAILURE: "tabLoadFailure";
@@ -28,11 +29,11 @@ export type HeaderTeamStatItem = {
28
29
  type RecentGamesPreviousGame = {
29
30
  score: string;
30
31
  gameResult: string;
31
- teamLogo: string;
32
+ teamLogo?: string;
32
33
  homeAway: string;
33
34
  };
34
35
  type RecentGamesTeam = {
35
- logo: string;
36
+ logo?: string;
36
37
  name?: string;
37
38
  events: RecentGamesPreviousGame[];
38
39
  };
@@ -110,7 +111,9 @@ export declare class StatsViewModel extends ViewModel {
110
111
  eventId: string;
111
112
  statsItems: Observable<StatsItem[]>;
112
113
  errorState: Observable<BetsErrorState>;
114
+ currentGameState: Observable<string>;
113
115
  statsService: StatsService;
116
+ analyticsService: AnalyticsService;
114
117
  private pollingInterval;
115
118
  private useMockData;
116
119
  private pollingTask;
@@ -123,6 +126,7 @@ export declare class StatsViewModel extends ViewModel {
123
126
  * Initialize the ViewModel and start data fetching
124
127
  */
125
128
  init(): Promise<void>;
129
+ onEngage: (type: StatsItem['type']) => void;
126
130
  /**
127
131
  * Clean up resources when the ViewModel is no longer needed
128
132
  */
@@ -0,0 +1,65 @@
1
+ import InsightsPayloadBuilder from '../InsightsService/InsightsPayloadBuilder';
2
+ import InsightsService from '../InsightsService/InsightsService';
3
+ import { Metadata } from './types';
4
+ type KeyPlaysClickedAction = {
5
+ panel_id: string;
6
+ panel_name: string;
7
+ panel_type: string;
8
+ name: 'key_play_clicked';
9
+ metadata: {
10
+ league: string;
11
+ event: string;
12
+ airing: string;
13
+ sport: string;
14
+ action: string;
15
+ clip: string;
16
+ key_play: string;
17
+ };
18
+ };
19
+ type BetsItemClickedAction = {
20
+ panel_id: string;
21
+ panel_name: string;
22
+ panel_type: string;
23
+ name: 'bets_item_clicked';
24
+ metadata: {
25
+ league: string;
26
+ event: string;
27
+ airing: string;
28
+ sport: string;
29
+ card: string;
30
+ bet_type: string | null;
31
+ in_game_bets: number;
32
+ total_bets: number;
33
+ };
34
+ };
35
+ type StatsItemClickedAction = {
36
+ panel_id: string;
37
+ panel_name: string;
38
+ panel_type: string;
39
+ name: 'stats_item_clicked';
40
+ metadata: {
41
+ league: string;
42
+ event: string;
43
+ airing: string;
44
+ sport: string;
45
+ card: string[];
46
+ game_state: string[];
47
+ };
48
+ };
49
+ type PanelClickPayload = KeyPlaysClickedAction | BetsItemClickedAction | StatsItemClickedAction;
50
+ type PanelViewPayload = {
51
+ panel_type: string;
52
+ panel_id: string;
53
+ panel_name: string;
54
+ metadata: Metadata;
55
+ };
56
+ declare class AnalyticsService {
57
+ insightsService: InsightsService;
58
+ insightsPayloadBuilder: InsightsPayloadBuilder;
59
+ constructor();
60
+ private trackAction;
61
+ private trackImpression;
62
+ panelView({ panel_type, panel_id, panel_name, metadata, }: PanelViewPayload): Promise<void>;
63
+ panelClick({ panel_type, panel_id, panel_name, metadata, name, }: PanelClickPayload): Promise<void>;
64
+ }
65
+ export default AnalyticsService;
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Generic metadata type that accepts any object extending BaseMetadata
3
+ */
4
+ export type Metadata = BaseMetadata & {
5
+ [key: string]: any;
6
+ };
7
+ export type Kingdom = 'panel';
8
+ export type Phylum = 'view' | 'engage';
9
+ /**
10
+ * Base metadata analytics events should include
11
+ */
12
+ export interface BaseMetadata {
13
+ league: string;
14
+ event: string;
15
+ airing: string;
16
+ sport: string;
17
+ }
18
+ export type PanelViewAction = {
19
+ name: 'panel_selected';
20
+ e0_kingdom: Kingdom;
21
+ e1_phylum: Phylum;
22
+ /**
23
+ * Panel Type
24
+ */
25
+ e2_class: string;
26
+ /**
27
+ * Panel ID
28
+ */
29
+ e3_order: string;
30
+ /**
31
+ * Panel Name
32
+ */
33
+ e4_family: string;
34
+ e5_genus?: string;
35
+ e6_species?: string;
36
+ /**
37
+ * Additional metadata for the panel view action.
38
+ */
39
+ metadata: Metadata;
40
+ };
41
+ export type ImpressionTrackEvent = PanelViewAction;
42
+ export type PanelClickAction = {
43
+ name: string;
44
+ e0_kingdom: 'panel';
45
+ e1_phylum: 'engage';
46
+ /**
47
+ * Panel Type
48
+ */
49
+ e2_class: string;
50
+ /**
51
+ * Panel ID.
52
+ */
53
+ e3_order: string;
54
+ /**
55
+ * Panel Name
56
+ */
57
+ e4_family: string;
58
+ e5_genus?: string;
59
+ e6_species?: string;
60
+ /**
61
+ * Additional metadata for the panel click action.
62
+ */
63
+ metadata: Metadata;
64
+ };
65
+ export type ActionTrackEvent = PanelClickAction;
@@ -0,0 +1,278 @@
1
+ import { ICacheManager } from '@/external/ports/cacheManager';
2
+ import InsightsService from './InsightsService';
3
+ type EventData = {
4
+ url?: string;
5
+ metadata?: Record<string, unknown>;
6
+ ontology: {
7
+ kingdom: string;
8
+ phylum: string;
9
+ class: string;
10
+ order?: string;
11
+ family: string;
12
+ genus?: string;
13
+ species?: string;
14
+ };
15
+ };
16
+ export default class InsightsPayloadBuilder {
17
+ currentTime: number;
18
+ serverOffsetTime: number;
19
+ insightsService: InsightsService;
20
+ cacheManager: ICacheManager;
21
+ constructor();
22
+ getPayload(event: EventData): Promise<{
23
+ /**
24
+ * @description Event Domain. NAMESPACE env var.
25
+ * @example maestro
26
+ */
27
+ e_d: string;
28
+ /**
29
+ * @description Event stringified metadata. defaults to null.
30
+ * @example "{\"key\":\"value\"}"
31
+ */
32
+ e_m: string | null;
33
+ /**
34
+ * @description Event time accounting for offset.
35
+ */
36
+ e_t: number;
37
+ /**
38
+ * @description Event URL. defaults to undefined.
39
+ */
40
+ e_u: string | undefined;
41
+ /**
42
+ * @description Event ontology kingdom. This is the highest level of the ontology and can be used to identify the event type.
43
+ * @example 'panel', 'engage', 'espn_key_plays'
44
+ */
45
+ e0: string;
46
+ /**
47
+ * @description Event phylum.
48
+ * @example 'view', 'click', 'play clip'
49
+ */
50
+ e1: string;
51
+ /**
52
+ * @description Event class.
53
+ * @example 'panel_type'
54
+ */
55
+ e2: string;
56
+ /**
57
+ * @description Event order.
58
+ * @example 'panel_id'
59
+ */
60
+ e3: string | undefined;
61
+ /**
62
+ * @description Event family.
63
+ * @example 'panel_name'
64
+ */
65
+ e4: string;
66
+ /**
67
+ * @description Event genus. This is a more specific level of the ontology and can be used to identify the event type.
68
+ */
69
+ e5: string | undefined;
70
+ /**
71
+ * @description Event species. This is the most specific level of the ontology and can be used to identify the event type.
72
+ */
73
+ e6: string | undefined;
74
+ /**
75
+ * @description Current timestamp.
76
+ */
77
+ t: number;
78
+ /**
79
+ * @description User avatar URL. Stored in user profile. defaults to null
80
+ * @example GET 'https://api.maestro.io/userprofile/v1'
81
+ */
82
+ u_a: null;
83
+ /**
84
+ * @description User account created date in milliseconds since epoch. defaults to null
85
+ * @example account.created
86
+ */
87
+ u_c: null;
88
+ /**
89
+ * @description Logged User email. defaults to null
90
+ * @example account.email
91
+ */
92
+ u_e: null;
93
+ /**
94
+ * @description Logged User ID. defaults to null
95
+ * @example account._id
96
+ */
97
+ u_id: null;
98
+ /**
99
+ * @description Logged User is logged in or not. defaults to false
100
+ */
101
+ u_li: boolean;
102
+ /**
103
+ * @description Logged User name. defaults to null
104
+ * @example account.name
105
+ */
106
+ u_n: null;
107
+ /**
108
+ * @description Logged User new user or not. Usually we compare server time and account.created. If it was created less than 1 day ago it's a new user. defaults to false
109
+ * @example Math.abs((serverTime || Date.now()) - account.created) < msIn.day
110
+ */
111
+ u_nu: boolean;
112
+ /**
113
+ * @description Logged User service. defaults to null
114
+ * @example account.service
115
+ */
116
+ u_s: null;
117
+ /**
118
+ * @description Logged User UID. defaults to null
119
+ * @example account.uid
120
+ */
121
+ u_u: null;
122
+ /**
123
+ * @description Logged User name. defaults to null
124
+ * @example account.name
125
+ */
126
+ u_un: null;
127
+ /**
128
+ * @description Site domain.
129
+ * @example site.settings.domain.url. 'maestro.tv/site_slug'
130
+ */
131
+ si_d: string;
132
+ /**
133
+ * @description Site ID.
134
+ * @example site._id
135
+ */
136
+ si_id: string;
137
+ /**
138
+ * @description Site package ID.
139
+ * @example `${site.package.id}-sapphire`
140
+ */
141
+ si_pid: string;
142
+ /**
143
+ * @description Site package version.
144
+ * @example `${site.package.version}-sapphire`
145
+ */
146
+ si_pv: string;
147
+ /**
148
+ * @description Site slug.
149
+ * @example site.slug
150
+ */
151
+ si_s: string;
152
+ /**
153
+ * @description Session ID, which can be used to track the session across requests. You might wanna keep this fixed for the session you're in using a local storage or something related.
154
+ */
155
+ se_id: string;
156
+ /**
157
+ * @description Session created timestamp. Usually set when the first event is fired
158
+ * @example new Date().getTime()
159
+ */
160
+ se_s: number;
161
+ /**
162
+ * @description Referrer domain, which can be used to track the domain from which the user came. Defaults to "$direct"
163
+ * @example 'example.com'.
164
+ */
165
+ r_d: string;
166
+ /**
167
+ * @description Referrer source, which can be used to track the source from which the user came (queryParam.r). Defaults to null
168
+ * @example const urlParams = new URLSearchParams(window.location.search);
169
+ * urlParams.get('r') || null
170
+ */
171
+ r_s: null;
172
+ /**
173
+ * @description Referrer URL, which can be used to track the full URL from which the user came. Defaults to "$direct"
174
+ * @example document.referrer
175
+ */
176
+ r_u: string;
177
+ /**
178
+ * @description Metadata version, used to track changes in the metadata structure.
179
+ * @example '1.00.0'
180
+ */
181
+ m_iv: string;
182
+ /**
183
+ * @description Unique identifier for the insights ID. Stored in site's document.
184
+ * @example site.settings.services.insights_id
185
+ */
186
+ i_id: string;
187
+ /**
188
+ * @description Device created timestamp. You might wanna keep this fixed for the device you're in using a local storage or something related
189
+ * @example new Date().getTime()
190
+ */
191
+ d_ct: number;
192
+ /**
193
+ * @description New device or not. If you want to keep track of new devices, you can use a local storage or something related
194
+ * @example localStorage.getItem('isNewDevice') === 'true'
195
+ */
196
+ d_nd: boolean;
197
+ /**
198
+ * @description Navigator Platform (more Web API specific).
199
+ * @example 'MacIntel', 'Win32', 'Linux x86_64'
200
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Navigator/platform
201
+ */
202
+ d_np: string;
203
+ /**
204
+ * @description A unique identifier for the device, which can be used to track the device across sessions. You might wanna save this into a local storage or something related.
205
+ * @example localStorage.getItem('devicePermanentId') || generateUniqueId()
206
+ */
207
+ d_pid: any;
208
+ /**
209
+ * @description Device screen height in pixels.
210
+ * @example window.screen.height
211
+ */
212
+ d_sh: number;
213
+ /**
214
+ * @description Device screen width in pixels.
215
+ * @example window.screen.width
216
+ */
217
+ d_sw: number;
218
+ /**
219
+ * @description Device tab ID, which can be used to track the device across tabs.
220
+ */
221
+ d_tid: string;
222
+ /**
223
+ * @description Device time in milliseconds since epoch.
224
+ */
225
+ d_tim: number;
226
+ /**
227
+ * @description Device time offset in milliseconds. You might wanna keep this fixed for the device you're in using a local storage or something related.
228
+ */
229
+ d_tof: number;
230
+ /**
231
+ * @description Device user agent string.
232
+ * @example navigator.userAgent ('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3')
233
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgent
234
+ */
235
+ d_ua: string;
236
+ /**
237
+ * @description MongoDB page collection name (e.g. 'pages')
238
+ * @example object.collection
239
+ */
240
+ p_c: string;
241
+ /**
242
+ * @description MongoDB page document ID (e.g. 'pageId')
243
+ * @example object._id
244
+ */
245
+ p_id: string;
246
+ /**
247
+ * @description MongoDB page name (e.g. 'Home', 'Product Page')
248
+ * @example object.data.name || object.seo.title
249
+ */
250
+ p_n: string;
251
+ /**
252
+ * @description MongoDB page slug (e.g. 'home', 'product-page')
253
+ * @example object.slug
254
+ */
255
+ p_s: string;
256
+ /**
257
+ * @description MongoDB page type (e.g. 'landing', 'channel')
258
+ * @example object.type
259
+ */
260
+ p_t: string;
261
+ }>;
262
+ private getEventInsights;
263
+ private getPageInsights;
264
+ private getDevicePermanentID;
265
+ private getDeviceCreated;
266
+ private getTabID;
267
+ private getDeviceInsights;
268
+ private randomId;
269
+ private getDeviceOffset;
270
+ private getInsightsInsights;
271
+ private getMetadataInsights;
272
+ private getReferrerInsights;
273
+ private getSessionID;
274
+ private getSessionInsights;
275
+ private getSiteInsights;
276
+ private getUserInsights;
277
+ }
278
+ export {};
@@ -0,0 +1,10 @@
1
+ export default class InsightsService {
2
+ private client;
3
+ constructor();
4
+ action(payload: Record<string, unknown>): Promise<void>;
5
+ getServerTime(): Promise<{
6
+ time: number;
7
+ diff: number;
8
+ }>;
9
+ private randomId;
10
+ }