@croct/sdk 0.21.0 → 0.22.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.
@@ -67,6 +67,14 @@ type Order = {
67
67
  installments?: number;
68
68
  status?: OrderStatus;
69
69
  };
70
+ type Point = {
71
+ x: number;
72
+ y: number;
73
+ };
74
+ type Size = {
75
+ width: number;
76
+ height: number;
77
+ };
70
78
  type Gender = 'male' | 'female' | 'neutral' | 'unknown';
71
79
  declare const pageEventTypes: readonly ["pageLoaded", "pageOpened"];
72
80
  declare const tabEventTypes: readonly ["tabOpened", "tabUrlChanged", "tabVisibilityChanged"];
@@ -74,8 +82,9 @@ declare const cartEventTypes: readonly ["cartModified", "cartViewed", "checkoutS
74
82
  declare const ecommerceEventTypes: readonly ["cartModified", "cartViewed", "checkoutStarted", "orderPlaced", "productViewed"];
75
83
  declare const identifiedUserEventTypes: string[];
76
84
  declare const userEventTypes: readonly [...string[], "userProfileChanged"];
85
+ declare const interactionEventTypes: readonly ["userClicked", "userScrolled"];
77
86
  declare const miscEventTypes: readonly ["nothingChanged", "sessionAttributesChanged", "goalCompleted", "interestShown", "postViewed", "eventOccurred", "linkOpened", "leadGenerated"];
78
- declare const eventTypes: readonly ["pageLoaded", "pageOpened", "cartModified", "cartViewed", "checkoutStarted", "orderPlaced", "productViewed", ...string[], "userProfileChanged", "nothingChanged", "sessionAttributesChanged", "goalCompleted", "interestShown", "postViewed", "eventOccurred", "linkOpened", "leadGenerated"];
87
+ declare const eventTypes: readonly ["pageLoaded", "pageOpened", "cartModified", "cartViewed", "checkoutStarted", "orderPlaced", "productViewed", ...string[], "userProfileChanged", "userClicked", "userScrolled", "nothingChanged", "sessionAttributesChanged", "goalCompleted", "interestShown", "postViewed", "eventOccurred", "linkOpened", "leadGenerated"];
79
88
  interface BaseEvent {
80
89
  type: string;
81
90
  }
@@ -195,6 +204,19 @@ interface PageLoaded extends BasePageEvent {
195
204
  lastModifiedTime: number;
196
205
  }
197
206
  type PageEvent = PageLoaded | PageOpened;
207
+ interface UserClicked extends BaseEvent {
208
+ type: 'userClicked';
209
+ point: Point;
210
+ surfaceSize?: Size;
211
+ }
212
+ interface UserScrolled extends BaseEvent {
213
+ type: 'userScrolled';
214
+ start?: Point;
215
+ end: Point;
216
+ surfaceSize?: Size;
217
+ viewportSize?: Size;
218
+ }
219
+ type InteractionEvent = UserClicked | UserScrolled;
198
220
  interface NothingChanged extends BaseEvent {
199
221
  type: 'nothingChanged';
200
222
  sinceTime: number;
@@ -256,6 +278,8 @@ type EventMap = {
256
278
  userSignedOut: UserSignedOut;
257
279
  userSignedUp: UserSignedUp;
258
280
  userProfileChanged: UserProfileChanged;
281
+ userClicked: UserClicked;
282
+ userScrolled: UserScrolled;
259
283
  productViewed: ProductViewed;
260
284
  cartViewed: CartViewed;
261
285
  cartModified: CartModified;
@@ -302,6 +326,7 @@ declare function isCartPartialEvent(event: PartialTrackingEvent): event is CartP
302
326
  type TrackingEventContext = {
303
327
  tabId: string;
304
328
  url: string;
329
+ timeZone?: string;
305
330
  metadata?: {
306
331
  [key: string]: string;
307
332
  };
@@ -318,4 +343,4 @@ type Beacon = {
318
343
  payload: BeaconPayload;
319
344
  };
320
345
 
321
- export { type Beacon, type BeaconPayload, type Cart, type CartEvent, type CartEventType, type CartItem, type CartModified, type CartViewed, type CheckoutStarted, type EcommerceEvent, type EventOccurred, type ExternalTrackingEvent, type ExternalTrackingEventPayload, type ExternalTrackingEventType, type Gender, type GoalCompleted, type IdentifiedUserEvent, type InterestShown, type LeadGenerated, type LinkOpened, type MiscEvent, type NothingChanged, type Order, type OrderItem, type OrderPlaced, type OrderStatus, type PageEvent, type PageEventType, type PageLoaded, type PageOpened, type PartialTrackingEvent, type PostDetails, type PostViewed, type ProductDetails, type ProductViewed, type SessionAttributesChanged, type TabEvent, type TabEventType, type TabOpened, type TabUrlChanged, type TabVisibilityChanged, type TrackingEvent, type TrackingEventContext, type TrackingEventType, type UserEvent, type UserProfile, type UserProfileChanged, type UserSignedIn, type UserSignedOut, type UserSignedUp, cartEventTypes, ecommerceEventTypes, eventTypes, identifiedUserEventTypes, isCartPartialEvent, isIdentifiedUserEvent, miscEventTypes, pageEventTypes, tabEventTypes, userEventTypes };
346
+ export { type Beacon, type BeaconPayload, type Cart, type CartEvent, type CartEventType, type CartItem, type CartModified, type CartViewed, type CheckoutStarted, type EcommerceEvent, type EventOccurred, type ExternalTrackingEvent, type ExternalTrackingEventPayload, type ExternalTrackingEventType, type Gender, type GoalCompleted, type IdentifiedUserEvent, type InteractionEvent, type InterestShown, type LeadGenerated, type LinkOpened, type MiscEvent, type NothingChanged, type Order, type OrderItem, type OrderPlaced, type OrderStatus, type PageEvent, type PageEventType, type PageLoaded, type PageOpened, type PartialTrackingEvent, type Point, type PostDetails, type PostViewed, type ProductDetails, type ProductViewed, type SessionAttributesChanged, type Size, type TabEvent, type TabEventType, type TabOpened, type TabUrlChanged, type TabVisibilityChanged, type TrackingEvent, type TrackingEventContext, type TrackingEventType, type UserClicked, type UserEvent, type UserProfile, type UserProfileChanged, type UserScrolled, type UserSignedIn, type UserSignedOut, type UserSignedUp, cartEventTypes, ecommerceEventTypes, eventTypes, identifiedUserEventTypes, interactionEventTypes, isCartPartialEvent, isIdentifiedUserEvent, miscEventTypes, pageEventTypes, tabEventTypes, userEventTypes };
package/trackingEvents.js CHANGED
@@ -26,6 +26,10 @@ const userEventTypes = [
26
26
  ...identifiedUserEventTypes,
27
27
  "userProfileChanged"
28
28
  ];
29
+ const interactionEventTypes = [
30
+ "userClicked",
31
+ "userScrolled"
32
+ ];
29
33
  const miscEventTypes = [
30
34
  "nothingChanged",
31
35
  "sessionAttributesChanged",
@@ -40,6 +44,7 @@ const eventTypes = [
40
44
  ...pageEventTypes,
41
45
  ...ecommerceEventTypes,
42
46
  ...userEventTypes,
47
+ ...interactionEventTypes,
43
48
  ...miscEventTypes
44
49
  ];
45
50
  function isIdentifiedUserEvent(event) {
@@ -53,6 +58,7 @@ export {
53
58
  ecommerceEventTypes,
54
59
  eventTypes,
55
60
  identifiedUserEventTypes,
61
+ interactionEventTypes,
56
62
  isCartPartialEvent,
57
63
  isIdentifiedUserEvent,
58
64
  miscEventTypes,