@@ -302,6 +302,20 @@ export const ProductActionType = {
302302 AddToWishlist : 9 as const ,
303303 RemoveFromWishlist : 10 as const ,
304304
305+ // Rokt Brain commerce-adjacent types
306+ ViewCart : 11 as const ,
307+ AddShippingInfo : 12 as const ,
308+ AddPaymentInfo : 13 as const ,
309+ PaymentMethodSelected : 14 as const ,
310+ PaymentAttempted : 15 as const ,
311+ PaymentSucceeded : 16 as const ,
312+ PaymentFailed : 17 as const ,
313+ RefundInitiated : 18 as const ,
314+
315+ isRoktCommerceType : ( id : number ) : boolean => {
316+ return id >= ProductActionType . ViewCart && id <= ProductActionType . RefundInitiated ;
317+ } ,
318+
305319 getName : ( id : number ) : string => {
306320 switch ( id ) {
307321 case ProductActionType . AddToCart :
@@ -324,6 +338,22 @@ export const ProductActionType = {
324338 return 'Add to Wishlist' ;
325339 case ProductActionType . RemoveFromWishlist :
326340 return 'Remove from Wishlist' ;
341+ case ProductActionType . ViewCart :
342+ return 'View Cart' ;
343+ case ProductActionType . AddShippingInfo :
344+ return 'Add Shipping Info' ;
345+ case ProductActionType . AddPaymentInfo :
346+ return 'Add Payment Info' ;
347+ case ProductActionType . PaymentMethodSelected :
348+ return 'Payment Method Selected' ;
349+ case ProductActionType . PaymentAttempted :
350+ return 'Payment Attempted' ;
351+ case ProductActionType . PaymentSucceeded :
352+ return 'Payment Succeeded' ;
353+ case ProductActionType . PaymentFailed :
354+ return 'Payment Failed' ;
355+ case ProductActionType . RefundInitiated :
356+ return 'Refund Initiated' ;
327357 default :
328358 return 'Unknown' ;
329359 }
@@ -352,12 +382,56 @@ export const ProductActionType = {
352382 return 'add_to_wishlist' ;
353383 case ProductActionType . RemoveFromWishlist :
354384 return 'remove_from_wishlist' ;
385+ case ProductActionType . ViewCart :
386+ return 'view_cart' ;
387+ case ProductActionType . AddShippingInfo :
388+ return 'add_shipping_info' ;
389+ case ProductActionType . AddPaymentInfo :
390+ return 'add_payment_info' ;
391+ case ProductActionType . PaymentMethodSelected :
392+ return 'payment_method_selected' ;
393+ case ProductActionType . PaymentAttempted :
394+ return 'payment_attempted' ;
395+ case ProductActionType . PaymentSucceeded :
396+ return 'payment_succeeded' ;
397+ case ProductActionType . PaymentFailed :
398+ return 'payment_failed' ;
399+ case ProductActionType . RefundInitiated :
400+ return 'refund_initiated' ;
355401 default :
356402 return 'unknown' ;
357403 }
358404 } ,
359405} ;
360406
407+ export type RoktEventName =
408+ | 'sign_up'
409+ | 'subscribe'
410+ | 'start_trial'
411+ | 'generate_lead'
412+ | 'search'
413+ | 'upsell'
414+ | 'earn_virtual_currency'
415+ | 'dwell_time'
416+ | 'hover'
417+ | 'scroll'
418+ | 'click_to_expand'
419+ | ( string & { } ) ;
420+
421+ export const RoktEvents = {
422+ SignUp : 'sign_up' as const ,
423+ Subscribe : 'subscribe' as const ,
424+ StartTrial : 'start_trial' as const ,
425+ GenerateLead : 'generate_lead' as const ,
426+ Search : 'search' as const ,
427+ Upsell : 'upsell' as const ,
428+ EarnVirtualCurrency : 'earn_virtual_currency' as const ,
429+ DwellTime : 'dwell_time' as const ,
430+ Hover : 'hover' as const ,
431+ Scroll : 'scroll' as const ,
432+ ClickToExpand : 'click_to_expand' as const ,
433+ } ;
434+
361435export const PromotionActionType = {
362436 Unknown : 0 as const ,
363437 PromotionView : 1 as const ,
@@ -544,5 +618,6 @@ export default {
544618 ApplicationTransitionType,
545619 ProductActionType,
546620 PromotionActionType,
621+ RoktEvents,
547622 Environment : Constants . Environment ,
548623} as const ;
0 commit comments