@cleartrip/ct-design-header 1.2.0-SNAPSHOT-header-v0.9.0.0 → 1.2.0-SNAPSHOT-header-v0.11.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.
@@ -2,8 +2,8 @@ import { __assign, __spreadArray } from 'tslib';
2
2
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import { createContext, useContext, useState, useRef, useEffect, useCallback, useMemo } from 'react';
4
4
  import { Container } from '@cleartrip/ct-design-container';
5
- import { Typography } from '@cleartrip/ct-design-typography';
6
- import { Button } from '@cleartrip/ct-design-button';
5
+ import { Typography, TypographyVariant } from '@cleartrip/ct-design-typography';
6
+ import { ButtonColor, Button } from '@cleartrip/ct-design-button';
7
7
  import { Divider } from '@cleartrip/ct-design-divider';
8
8
  import { Offers, BusinessBag, ChevronDown, MyTrips, SupportIcon, ArrowRight, MyAccount, SavedCard, Travellers, HiFive, Wallet, SettingsCog, PrivacyRights, HeaderChevronRight, FkVip, FkPremium, InsiderIcon, InsiderElite, CtLoyalty, Supercoin, Signout, CTLogo, Fkcompany } from '@cleartrip/ct-design-icons';
9
9
 
@@ -13,23 +13,27 @@ var SUPPORT_URL = '/support';
13
13
  var NAVBAR_OPTIONS = [{
14
14
  lefticon: Offers,
15
15
  text: 'Offers',
16
+ ravenActionName: 'offers',
16
17
  isHoverable: false,
17
18
  isClickable: true,
18
19
  link: OFFERS_URL
19
20
  }, {
20
21
  lefticon: BusinessBag,
21
22
  text: 'Business',
23
+ ravenActionName: 'business',
22
24
  rightIcon: ChevronDown,
23
25
  isHoverable: true
24
26
  }, {
25
27
  lefticon: MyTrips,
26
28
  text: 'My Trips',
29
+ ravenActionName: 'mytrips',
27
30
  isHoverable: false,
28
31
  isClickable: true,
29
32
  link: MY_TRIPS_URL
30
33
  }, {
31
34
  lefticon: SupportIcon,
32
35
  text: 'Support',
36
+ ravenActionName: 'support',
33
37
  isHoverable: false,
34
38
  isClickable: true,
35
39
  link: SUPPORT_URL
@@ -43,33 +47,36 @@ var LOBS = {
43
47
  };
44
48
  var LOB_DATA = [{
45
49
  title: LOBS.FLIGHTS,
46
- image: 'https://rukmini-ct.flixcart.com/f_auto,w_48,h_48,dpr_2/offermgmt-prod/offermgmt/images/banner/flight_uhp.png?cache=true',
50
+ image: 'https://rukmini-ct.flixcart.com/f_auto,w_32,h_32,dpr_4/offermgmt-prod/offermgmt/images/banner/Navbar_Flights.png?cache=true',
47
51
  link: '/flights'
48
52
  }, {
49
53
  title: LOBS.HOTELS,
50
- image: 'https://rukmini-ct.flixcart.com/f_auto,w_48,h_48,dpr_2/offermgmt-prod/offermgmt/images/banner/hotel_uhp.png?cache=true',
54
+ image: 'https://rukmini-ct.flixcart.com/f_auto,w_32,h_32,dpr_4/offermgmt-prod/offermgmt/images/banner/Navbar_Hotels.png?cache=true',
51
55
  link: '/hotels'
52
56
  }, {
53
57
  title: LOBS.BUSES,
54
- image: 'https://rukmini-ct.flixcart.com/f_auto,w_40,h_40,dpr_2/offermgmt-prod/offermgmt/images/banner/bus_uhp.png?cache=true',
58
+ image: 'https://rukmini-ct.flixcart.com/f_auto,w_32,h_32,dpr_4/offermgmt-prod/offermgmt/images/banner/Navbar_Buses.png?cache=true',
55
59
  link: '/bus'
56
60
  }, {
57
61
  title: LOBS.TRAIN,
58
- image: 'https://rukmini-ct.flixcart.com/f_auto,w_40,h_40,dpr_2/offermgmt-prod/offermgmt/images/banner/train_uhp.png?cache=true',
62
+ image: 'https://rukmini-ct.flixcart.com/f_auto,w_32,h_32,dpr_4/offermgmt-prod/offermgmt/images/banner/Navbar_Trains.png?cache=true',
59
63
  link: '/pages/trains/appOnly'
60
64
  }, {
61
65
  title: LOBS.PACKAGES,
62
- image: 'https://rukmini-ct.flixcart.com/f_auto,w_40,h_40,dpr_2/offermgmt-prod/offermgmt/images/banner/holiday_uhp.png?cache=true',
66
+ image: 'https://rukmini-ct.flixcart.com/f_auto,w_32,h_32,dpr_4/offermgmt-prod/offermgmt/images/banner/Navbar_Packages.png?cache=true',
63
67
  link: '/holidays'
64
68
  }];
65
69
  var bdConfig = [{
66
70
  title: 'AgentBox',
67
71
  subtitle: 'For travel agents',
68
- details: 'One-stop travel solution offering the best deals to our travel agency partners'
72
+ details: 'One-stop travel solution offering the best deals to our travel agency partners',
73
+ link: 'https://agency.cleartrip.com'
69
74
  }, {
70
75
  title: 'OutOfOffice',
71
76
  subtitle: 'For startups, corporates and SMEs',
72
- details: 'Manage corporate business travel, smartly'
77
+ details: 'Manage corporate business travel, smartly',
78
+ link: 'https://ooo.cleartrip.com/',
79
+ ravenActionName: 'ooo'
73
80
  }, {
74
81
  title: 'MICE',
75
82
  subtitle: 'For corporate events',
@@ -85,13 +92,32 @@ var BUSINESS_DROPDOWN_HEADING = 'Other business services';
85
92
  var RAVEN_PAGE_NAMES;
86
93
  (function (RAVEN_PAGE_NAMES) {
87
94
  RAVEN_PAGE_NAMES["UNIFIED_HOME"] = "unified_homepage";
88
- RAVEN_PAGE_NAMES["HOTELS_HOME"] = "hotels_homepage";
89
- RAVEN_PAGE_NAMES["FLIGHTS_HOME"] = "flights_homepage";
95
+ RAVEN_PAGE_NAMES["HOTELS_HOME"] = "hotel_home";
96
+ RAVEN_PAGE_NAMES["FLIGHTS_HOME"] = "flights_home";
90
97
  })(RAVEN_PAGE_NAMES || (RAVEN_PAGE_NAMES = {}));
91
98
  var RAVEN_PLATFORMS;
92
99
  (function (RAVEN_PLATFORMS) {
93
100
  RAVEN_PLATFORMS["DESKTOP"] = "desktop";
94
101
  })(RAVEN_PLATFORMS || (RAVEN_PLATFORMS = {}));
102
+ var LOG_IN_TEXT = 'Log in';
103
+ var THEME_CONFIG = {
104
+ NOVAC: {
105
+ headerBackground: 'transparent',
106
+ hoverColor: '#FFB8A5',
107
+ logoFill: '#FFF',
108
+ fkcompanyColor: '#FFF',
109
+ typographyColor: '#FFF',
110
+ loginButtonColorVariant: ButtonColor.NEUTRAL
111
+ },
112
+ DEFAULT: {
113
+ headerBackground: '#F7FAFF',
114
+ hoverColor: '#FF4F17',
115
+ logoFill: '#FF4F17',
116
+ fkcompanyColor: '#1A1A1A',
117
+ typographyColor: '#1A1A1A',
118
+ loginButtonColorVariant: ButtonColor.PRIMARY
119
+ }
120
+ };
95
121
 
96
122
  var HeaderContext = createContext(undefined);
97
123
  var useHeaderContext = function () {
@@ -127,33 +153,33 @@ var LobsHeader = function () {
127
153
  }
128
154
  }, {
129
155
  children: LOB_DATA.map(function (item, index) {
156
+ var title = item.title,
157
+ link = item.link,
158
+ image = item.image;
130
159
  return jsxs(Container, __assign({
131
160
  display: 'flex',
132
161
  alignItems: 'center',
133
162
  cursor: 'pointer',
134
163
  css: {
135
164
  gap: 8,
136
- background: selectedLOB === item.title ? '#FFFFFF' : 'transparent',
137
- borderRadius: selectedLOB === item.title ? '40px' : '0',
138
- padding: selectedLOB === item.title ? '8px 16px 8px 8px' : '0'
165
+ background: selectedLOB === title ? '#FFFFFF' : 'transparent',
166
+ borderRadius: selectedLOB === title ? '40px' : '0',
167
+ padding: selectedLOB === title ? '8px 16px 8px 8px' : '0'
139
168
  },
140
169
  onClick: function () {
141
- window.location.href = item.link;
170
+ window.location.href = link;
142
171
  }
143
172
  }, {
144
173
  children: [jsx("img", {
145
- src: item.image,
146
- alt: item.title,
174
+ src: image,
175
+ alt: title,
147
176
  width: 32,
148
177
  height: 32
149
178
  }), jsx(Typography, __assign({
150
- variant: 'P1',
151
- style: {
152
- fontWeight: selectedLOB === item.title ? 600 : 500
153
- },
179
+ variant: selectedLOB === title ? TypographyVariant.HM3 : TypographyVariant.B1,
154
180
  isClickable: true
155
181
  }, {
156
- children: item.title
182
+ children: title
157
183
  }))]
158
184
  }), index);
159
185
  })
@@ -354,11 +380,85 @@ var useDropdownAnimation = function (isOpen) {
354
380
  };
355
381
  };
356
382
 
383
+ var stringifyPayload = function (payload) {
384
+ var keys = Object.keys(payload);
385
+ var numericValues = [];
386
+ keys.forEach(function (key) {
387
+ if (numericValues.includes(key)) {
388
+ payload[key] = Number(payload[key]);
389
+ } else {
390
+ payload[key] = '' + payload[key];
391
+ }
392
+ });
393
+ return payload;
394
+ };
395
+ var isServer = function () {
396
+ return typeof window === 'undefined' || !window;
397
+ };
398
+ var getQueryParam = function (queryParam) {
399
+ if (isServer()) {
400
+ return '';
401
+ }
402
+ var urlParams = new URLSearchParams(window.location.search);
403
+ return urlParams.get(queryParam);
404
+ };
405
+ var ravenLoyaltyTypes = function (loyaltyType) {
406
+ switch (loyaltyType) {
407
+ case 'FkVip':
408
+ return 'fk_vip';
409
+ case 'FkPremium':
410
+ return 'fk_plus_premium';
411
+ case 'InsiderIcon':
412
+ return 'myntra_insidericon';
413
+ case 'InsiderElite':
414
+ return 'myntra_insiderelite';
415
+ default:
416
+ return '';
417
+ }
418
+ };
419
+ var ravenSDKTrigger = function (isUserLoggedIn, eventName, ravenPayload, customRavenPayload, ravenPushCallback, pageName) {
420
+ var _a;
421
+ if (typeof ravenPushCallback !== 'function') {
422
+ console.error('ravenPushCallback is not provided or is not a function');
423
+ return;
424
+ }
425
+ var commonPayload = {
426
+ page_name: pageName,
427
+ platform: RAVEN_PLATFORMS.DESKTOP,
428
+ login_status: isUserLoggedIn ? 'yes' : 'no',
429
+ domain: (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.host
430
+ };
431
+ var newRavenPayload = stringifyPayload(ravenPayload);
432
+ var parsedCustomRavenPayload = stringifyPayload(customRavenPayload);
433
+ var finalPayload = __assign(__assign(__assign({}, commonPayload), newRavenPayload), parsedCustomRavenPayload);
434
+ try {
435
+ if (ravenPushCallback.length === 1) {
436
+ ravenPushCallback({
437
+ eventName: eventName,
438
+ eventData: finalPayload
439
+ });
440
+ } else {
441
+ ravenPushCallback(eventName, finalPayload);
442
+ }
443
+ } catch (err) {
444
+ console.error(err);
445
+ return;
446
+ }
447
+ };
448
+
357
449
  var BusinessDropdownContent = function (_a) {
358
450
  var isOpen = _a.isOpen;
359
- var _b = useState(0),
360
- leftPosition = _b[0],
361
- setLeftPosition = _b[1];
451
+ var _b = useHeaderContext(),
452
+ isUserLoggedIn = _b.isUserLoggedIn,
453
+ ravenPushCallback = _b.ravenPushCallback,
454
+ ravenPageName = _b.ravenPageName,
455
+ ravenEventName = _b.ravenEventName,
456
+ loyaltyType = _b.loyaltyType,
457
+ _c = _b.ravenPayload,
458
+ ravenPayload = _c === void 0 ? {} : _c;
459
+ var _d = useState(0),
460
+ leftPosition = _d[0],
461
+ setLeftPosition = _d[1];
362
462
  var containerRef = useDropdownAnimation(isOpen).containerRef;
363
463
  useEffect(function () {
364
464
  var updatePosition = function () {
@@ -377,6 +477,21 @@ var BusinessDropdownContent = function (_a) {
377
477
  return window.removeEventListener('resize', updatePosition);
378
478
  };
379
479
  }, [containerRef, leftPosition]);
480
+ var handleBusinessDropdownClick = useCallback(function (link, title, ravenActionName) {
481
+ var _a;
482
+ var utmSource = (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic';
483
+ var actionName = ravenActionName ? "".concat(ravenActionName, "_business_click") : title ? "".concat(title.toLowerCase(), "_business_click") : '';
484
+ var defaultPayload = {
485
+ action_name: actionName,
486
+ action_type: 'click',
487
+ u_utm_source: utmSource,
488
+ loyalty_type: ravenLoyaltyTypes(loyaltyType)
489
+ };
490
+ if (link) {
491
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, defaultPayload, ravenPayload, ravenPushCallback, ravenPageName);
492
+ window.location.href = link;
493
+ }
494
+ }, [isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName, loyaltyType]);
380
495
  return jsxs(Container, __assign({
381
496
  ref: containerRef,
382
497
  backgroundColor: '#fff',
@@ -397,10 +512,7 @@ var BusinessDropdownContent = function (_a) {
397
512
  backgroundColor: '#FFF1EC'
398
513
  }, {
399
514
  children: jsx(Typography, __assign({
400
- variant: 'HM2',
401
- css: {
402
- lineHeight: '24px'
403
- }
515
+ variant: 'HM2'
404
516
  }, {
405
517
  children: BUSINESS_DROPDOWN_HEADING
406
518
  }))
@@ -414,11 +526,16 @@ var BusinessDropdownContent = function (_a) {
414
526
  children: bdConfig.map(function (_a) {
415
527
  var title = _a.title,
416
528
  subtitle = _a.subtitle,
417
- details = _a.details;
529
+ details = _a.details,
530
+ link = _a.link,
531
+ ravenActionName = _a.ravenActionName;
418
532
  return jsxs(Container, __assign({
419
533
  cursor: 'pointer',
420
534
  width: '200px',
421
- className: 'bd-hover-container'
535
+ className: 'bd-hover-container',
536
+ onClick: function () {
537
+ return handleBusinessDropdownClick(link, title, ravenActionName);
538
+ }
422
539
  }, {
423
540
  children: [jsxs(Container, __assign({
424
541
  display: 'flex',
@@ -517,6 +634,7 @@ var ACCOUNT_OPTIONS_POPUP_CONFIG = [{
517
634
  redirectionLink: 'accounts/personal-data-dashboard'
518
635
  }];
519
636
  var SIGN_OUT_TEXT = 'Logout';
637
+ var MY_ACCOUNT_TEXT = 'My Account';
520
638
  var LOGGEDIN_USER_TEXT = 'You are logged in with';
521
639
  var HEADER_ACCOUNTS_OPTIONS_OPEN_BTN_ID = 'header-acc-btn';
522
640
  var ACCOUNT_OPTIONS_CONTAINER_ID = 'account-options';
@@ -528,13 +646,33 @@ var LoyaltyChip = function (_a) {
528
646
  backgroundGradient = _a.backgroundGradient,
529
647
  handleChipClick = _a.handleChipClick,
530
648
  chevronFillColor = _a.chevronFillColor;
531
- var _b = useState(false),
532
- isHovered = _b[0],
533
- setIsHovered = _b[1];
534
- var handleClick = function () {
535
- window.location.href = '/';
536
- handleChipClick && handleChipClick();
537
- };
649
+ var _b = useHeaderContext(),
650
+ loyaltyType = _b.loyaltyType,
651
+ isUserLoggedIn = _b.isUserLoggedIn,
652
+ ravenPushCallback = _b.ravenPushCallback,
653
+ ravenPageName = _b.ravenPageName,
654
+ _c = _b.ravenPayload,
655
+ ravenPayload = _c === void 0 ? {} : _c,
656
+ ravenEventName = _b.ravenEventName;
657
+ var _d = useState(false),
658
+ isHovered = _d[0],
659
+ setIsHovered = _d[1];
660
+ var handleClick = useCallback(function () {
661
+ var _a;
662
+ if (handleChipClick) {
663
+ handleChipClick();
664
+ } else {
665
+ var utmSource = (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic';
666
+ var defaultPayload = {
667
+ action_name: "loyalty_account_click",
668
+ action_type: 'click',
669
+ u_utm_source: utmSource,
670
+ loyaltyType: ravenLoyaltyTypes(loyaltyType)
671
+ };
672
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, defaultPayload, ravenPayload, ravenPushCallback, ravenPageName);
673
+ window.location.href = '/all-offers/loyalty-october';
674
+ }
675
+ }, [handleChipClick, loyaltyType, isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
538
676
  return jsxs(Container, __assign({
539
677
  display: 'flex',
540
678
  position: 'relative',
@@ -559,7 +697,7 @@ var LoyaltyChip = function (_a) {
559
697
  onClick: handleClick
560
698
  }, {
561
699
  children: [jsx(Container, {
562
- style: {
700
+ css: {
563
701
  content: '""',
564
702
  position: 'absolute',
565
703
  inset: 0,
@@ -568,7 +706,7 @@ var LoyaltyChip = function (_a) {
568
706
  zIndex: -2
569
707
  }
570
708
  }), jsx(Container, {
571
- style: {
709
+ css: {
572
710
  content: '""',
573
711
  position: 'absolute',
574
712
  inset: 0,
@@ -589,7 +727,7 @@ var LoyaltyChip = function (_a) {
589
727
  })), jsx(Container, __assign({
590
728
  display: 'flex',
591
729
  alignItems: 'center',
592
- style: {
730
+ css: {
593
731
  overflow: 'hidden',
594
732
  maxWidth: isHovered ? 16 : 0,
595
733
  transition: 'max-width 0.2s ease-in-out, opacity 0.2s ease-in-out',
@@ -654,24 +792,46 @@ var ExpandableItem = function (_a) {
654
792
  handleChipClick = _a.handleChipClick,
655
793
  value = _a.value,
656
794
  type = _a.type;
657
- var _b = useState(false),
658
- isHovered = _b[0],
659
- setIsHovered = _b[1];
660
- var handleDefaultClick = function () {
661
- if (type === 'supercoins') {
662
- window.location.href = '/supercoins';
663
- } else if (type === 'wallet') {
664
- window.location.href = '/wallet';
795
+ var _b = useHeaderContext(),
796
+ loyaltyType = _b.loyaltyType,
797
+ isUserLoggedIn = _b.isUserLoggedIn,
798
+ ravenPushCallback = _b.ravenPushCallback,
799
+ ravenPageName = _b.ravenPageName,
800
+ ravenEventName = _b.ravenEventName,
801
+ _c = _b.ravenPayload,
802
+ ravenPayload = _c === void 0 ? {} : _c;
803
+ var _d = useState(false),
804
+ isHovered = _d[0],
805
+ setIsHovered = _d[1];
806
+ var handleDefaultClick = useCallback(function () {
807
+ var _a;
808
+ if (handleChipClick) {
809
+ handleChipClick();
810
+ } else {
811
+ var utmSource = (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic';
812
+ var defaultPayload = {
813
+ action_name: "".concat(type, "_account_click"),
814
+ action_type: 'click',
815
+ u_utm_source: utmSource,
816
+ loyaltyType: ravenLoyaltyTypes(loyaltyType)
817
+ };
818
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, defaultPayload, ravenPayload, ravenPushCallback, ravenPageName);
819
+ var redirectUrls = {
820
+ supercoin: '/all-offers/supercoins/',
821
+ wallet: '/accounts/wallet'
822
+ };
823
+ if (redirectUrls[type]) {
824
+ window.location.href = redirectUrls[type];
825
+ }
665
826
  }
666
- handleChipClick && handleChipClick();
667
- };
827
+ }, [handleChipClick, type, loyaltyType, isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
668
828
  return jsxs(Container, __assign({
669
829
  display: 'flex',
670
830
  alignItems: 'center',
671
831
  justifyContent: 'center',
672
832
  borderRadius: '8px',
673
833
  cursor: 'pointer',
674
- style: {
834
+ css: {
675
835
  height: 32,
676
836
  paddingLeft: 8,
677
837
  paddingRight: isHovered ? 4 : 8,
@@ -702,7 +862,7 @@ var ExpandableItem = function (_a) {
702
862
  })), jsx(Container, __assign({
703
863
  display: 'flex',
704
864
  alignItems: 'center',
705
- style: {
865
+ css: {
706
866
  overflow: 'hidden',
707
867
  maxWidth: isHovered ? 16 : 0,
708
868
  transition: 'max-width 0.2s ease-in-out, opacity 0.2s ease-in-out',
@@ -730,6 +890,12 @@ var RewardsSection = function () {
730
890
  hideWalletChip = _b.hideWalletChip,
731
891
  hideSupercoinsChip = _b.hideSupercoinsChip,
732
892
  hideLoyaltyChip = _b.hideLoyaltyChip;
893
+ var shouldShowLoyalty = loyaltyLoading || selectedLoyaltyType && LOYALTY_DATA[selectedLoyaltyType] && !hideLoyaltyChip;
894
+ var shouldShowSupercoin = superCoinsLoading || !hideSupercoinsChip;
895
+ var shouldShowWallet = walletLoading || !hideWalletChip;
896
+ if (!shouldShowLoyalty && !shouldShowSupercoin && !shouldShowWallet) {
897
+ return null;
898
+ }
733
899
  return jsxs(Container, __assign({
734
900
  display: 'flex',
735
901
  padding: '0 16px 16px 16px',
@@ -762,7 +928,7 @@ var RewardsSection = function () {
762
928
  }),
763
929
  value: superCoinBalance,
764
930
  handleChipClick: supercoinsChipClick,
765
- type: 'supercoins'
931
+ type: 'supercoin'
766
932
  }), walletLoading ? jsx(Container, {
767
933
  width: '50px',
768
934
  height: '32px',
@@ -787,34 +953,51 @@ var AccountDropdownContent = function (_a) {
787
953
  userName = _b.userName,
788
954
  userMobileNumber = _b.userMobileNumber,
789
955
  countryCode = _b.countryCode,
790
- userDetailsLoading = _b.userDetailsLoading;
956
+ userDetailsLoading = _b.userDetailsLoading,
957
+ loyaltyType = _b.loyaltyType,
958
+ isUserLoggedIn = _b.isUserLoggedIn,
959
+ ravenEventName = _b.ravenEventName,
960
+ ravenPageName = _b.ravenPageName,
961
+ _c = _b.ravenPayload,
962
+ ravenPayload = _c === void 0 ? {} : _c,
963
+ ravenPushCallback = _b.ravenPushCallback;
791
964
  var containerRef = useDropdownAnimation(isOpen).containerRef;
792
- var _c = useMemo(function () {
793
- var userGreeting = userName && "Hello ".concat(userName, "!");
794
- var phoneNumber = countryCode && userMobileNumber ? "".concat(countryCode, " ").concat(userMobileNumber) : '';
965
+ var _d = useMemo(function () {
795
966
  return {
796
- userGreeting: userGreeting,
797
- phoneNumber: phoneNumber
967
+ userGreeting: userName ? "Hello ".concat(userName, "!") : '',
968
+ phoneNumber: countryCode && userMobileNumber ? "".concat(countryCode, " ").concat(userMobileNumber) : ''
798
969
  };
799
970
  }, [userName, userMobileNumber, countryCode]),
800
- userGreeting = _c.userGreeting,
801
- phoneNumber = _c.phoneNumber;
802
- var handleRedirectClick = function (redirectLink) {
803
- return function () {
804
- window.location.href = redirectLink;
971
+ userGreeting = _d.userGreeting,
972
+ phoneNumber = _d.phoneNumber;
973
+ var generateRavenPayload = function (actionName) {
974
+ var _a;
975
+ return {
976
+ action_name: actionName.toLowerCase().replace(/[\s-]/g, '') + '_account_click',
977
+ action_type: 'click',
978
+ u_utm_source: (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic',
979
+ loyalty_type: ravenLoyaltyTypes(loyaltyType)
805
980
  };
806
981
  };
807
- useEffect(function () {
982
+ var handleAccountOptionsClick = useCallback(function (text, redirectLink) {
983
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, generateRavenPayload(text), ravenPayload, ravenPushCallback, ravenPageName);
984
+ window.location.href = redirectLink;
985
+ }, [isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
986
+ useCallback(function () {
987
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, generateRavenPayload(SIGN_OUT_TEXT), ravenPayload, ravenPushCallback, ravenPageName);
988
+ handleLogoutClick();
989
+ }, [isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName, handleLogoutClick]);
990
+ var positionAccountOptionsDiv = useCallback(function () {
808
991
  var headerAccBtn = document.getElementById(HEADER_ACCOUNTS_OPTIONS_OPEN_BTN_ID);
809
992
  var accountOptionsElem = document.getElementById(ACCOUNT_OPTIONS_CONTAINER_ID);
810
- var positionAccountOptionsDiv = function () {
811
- var headerBtnRight = headerAccBtn === null || headerAccBtn === void 0 ? void 0 : headerAccBtn.getBoundingClientRect().right;
812
- if (accountOptionsElem && headerBtnRight) {
813
- accountOptionsElem.style.left = "".concat(headerBtnRight - ACCOUNT_OPTIONS_CONTAINER_WIDTH, "px");
814
- }
815
- };
816
- positionAccountOptionsDiv();
993
+ if (headerAccBtn && accountOptionsElem) {
994
+ var headerBtnRight = headerAccBtn.getBoundingClientRect().right;
995
+ accountOptionsElem.style.left = "".concat(headerBtnRight - ACCOUNT_OPTIONS_CONTAINER_WIDTH, "px");
996
+ }
817
997
  }, []);
998
+ useEffect(function () {
999
+ positionAccountOptionsDiv();
1000
+ }, [positionAccountOptionsDiv]);
818
1001
  var renderUserData = function () {
819
1002
  var renderContent = function (loading, content, variant, color) {
820
1003
  return jsx(Typography, __assign({
@@ -861,7 +1044,7 @@ var AccountDropdownContent = function (_a) {
861
1044
  }, {
862
1045
  children: [jsx(Container, __assign({
863
1046
  padding: '16px',
864
- height: '72px'
1047
+ height: '76px'
865
1048
  }, {
866
1049
  children: renderUserData()
867
1050
  })), jsx(RewardsSection, {}), jsxs(Container, __assign({
@@ -870,7 +1053,7 @@ var AccountDropdownContent = function (_a) {
870
1053
  padding: '8px',
871
1054
  backgroundColor: 'white',
872
1055
  rowGap: '8px',
873
- style: {
1056
+ css: {
874
1057
  borderBottomLeftRadius: 12,
875
1058
  borderBottomRightRadius: 12
876
1059
  }
@@ -884,12 +1067,14 @@ var AccountDropdownContent = function (_a) {
884
1067
  padding: '8px',
885
1068
  borderRadius: '8px',
886
1069
  cursor: 'pointer',
887
- onClick: handleRedirectClick(redirectionLink)
1070
+ onClick: function () {
1071
+ return handleAccountOptionsClick(text, redirectionLink);
1072
+ }
888
1073
  }, {
889
1074
  children: jsxs(Container, __assign({
890
1075
  display: 'flex',
891
1076
  cursor: 'pointer',
892
- style: {
1077
+ css: {
893
1078
  columnGap: '8px'
894
1079
  }
895
1080
  }, {
@@ -906,7 +1091,7 @@ var AccountDropdownContent = function (_a) {
906
1091
  }))
907
1092
  }), "account-option-".concat(text));
908
1093
  }), jsx(Divider, {
909
- style: {
1094
+ css: {
910
1095
  borderBottom: '1px dashed #E6E6E6'
911
1096
  }
912
1097
  }), jsxs(Container, __assign({
@@ -937,18 +1122,26 @@ var AccountDropdownContent = function (_a) {
937
1122
  };
938
1123
 
939
1124
  var UserAccount = function () {
940
- var isNovacThemeEnabled = useHeaderContext().isNovacThemeEnabled;
941
- var _a = useHoverDropdown({
1125
+ var _a = useHeaderContext(),
1126
+ isNovacThemeEnabled = _a.isNovacThemeEnabled,
1127
+ ravenEventName = _a.ravenEventName,
1128
+ _b = _a.ravenPayload,
1129
+ ravenPayload = _b === void 0 ? {} : _b,
1130
+ ravenPushCallback = _a.ravenPushCallback,
1131
+ isUserLoggedIn = _a.isUserLoggedIn,
1132
+ loyaltyType = _a.loyaltyType,
1133
+ ravenPageName = _a.ravenPageName;
1134
+ var _c = useHoverDropdown({
942
1135
  openDelay: 0
943
1136
  }),
944
- isDropdownVisible = _a.isDropdownVisible,
945
- handleOnMouseEnter = _a.handleOnMouseEnter,
946
- handleOnMouseLeave = _a.handleOnMouseLeave,
947
- handleDropdownMouseEnter = _a.handleDropdownMouseEnter,
948
- handleDropdownMouseLeave = _a.handleDropdownMouseLeave;
949
- var _b = useState(false),
950
- scrolled = _b[0],
951
- setScrolled = _b[1];
1137
+ isDropdownVisible = _c.isDropdownVisible,
1138
+ handleOnMouseEnter = _c.handleOnMouseEnter,
1139
+ handleOnMouseLeave = _c.handleOnMouseLeave,
1140
+ handleDropdownMouseEnter = _c.handleDropdownMouseEnter,
1141
+ handleDropdownMouseLeave = _c.handleDropdownMouseLeave;
1142
+ var _d = useState(false),
1143
+ scrolled = _d[0],
1144
+ setScrolled = _d[1];
952
1145
  useEffect(function () {
953
1146
  var handleScroll = function () {
954
1147
  setScrolled(window.scrollY >= 100);
@@ -958,8 +1151,20 @@ var UserAccount = function () {
958
1151
  return window.removeEventListener('scroll', handleScroll);
959
1152
  };
960
1153
  }, []);
961
- var effectiveNovacThemeEnabled = isNovacThemeEnabled && !scrolled;
962
- var hoverColor = effectiveNovacThemeEnabled ? '#FFB8A5' : '#FF4F17';
1154
+ var theme = isNovacThemeEnabled && !scrolled ? THEME_CONFIG.NOVAC : THEME_CONFIG.DEFAULT;
1155
+ var hoverColor = theme.hoverColor,
1156
+ typographyColor = theme.typographyColor;
1157
+ var triggerRavenEventOnHover = useCallback(function () {
1158
+ var _a;
1159
+ var utmSource = (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic';
1160
+ var defaultPayload = {
1161
+ action_name: "".concat(MY_ACCOUNT_TEXT.toLowerCase().replace(/[\s-]/g, ''), "_header_hover"),
1162
+ action_type: 'hover',
1163
+ u_utm_source: utmSource,
1164
+ loyalty_type: ravenLoyaltyTypes(loyaltyType)
1165
+ };
1166
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, defaultPayload, ravenPayload, ravenPushCallback, ravenPageName);
1167
+ }, [isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName, loyaltyType]);
963
1168
  return jsxs(Container, {
964
1169
  children: [jsxs(Container, __assign({
965
1170
  display: 'flex',
@@ -968,18 +1173,19 @@ var UserAccount = function () {
968
1173
  borderRadius: '12px',
969
1174
  height: '100%',
970
1175
  cursor: 'pointer',
971
- style: {
1176
+ css: {
972
1177
  columnGap: 8,
973
1178
  height: 64
974
1179
  },
975
1180
  onMouseEnter: function () {
976
- return handleOnMouseEnter(0);
1181
+ handleOnMouseEnter(0);
1182
+ triggerRavenEventOnHover();
977
1183
  },
978
1184
  onMouseLeave: handleOnMouseLeave,
979
1185
  id: HEADER_ACCOUNTS_OPTIONS_OPEN_BTN_ID
980
1186
  }, {
981
1187
  children: [jsx(MyAccount, {
982
- color: isDropdownVisible ? hoverColor : effectiveNovacThemeEnabled ? '#FFF' : '#1A1A1A'
1188
+ color: isDropdownVisible ? hoverColor : typographyColor
983
1189
  }), jsxs(Container, __assign({
984
1190
  display: 'flex',
985
1191
  flexDirection: 'row',
@@ -990,13 +1196,13 @@ var UserAccount = function () {
990
1196
  css: {
991
1197
  cursor: 'pointer'
992
1198
  },
993
- colorCode: isDropdownVisible ? hoverColor : effectiveNovacThemeEnabled ? '#FFF' : '#1A1A1A'
1199
+ colorCode: isDropdownVisible ? hoverColor : typographyColor
994
1200
  }, {
995
- children: "My Account"
1201
+ children: MY_ACCOUNT_TEXT
996
1202
  })), jsx(ChevronDown, {
997
1203
  width: 20,
998
1204
  height: 20,
999
- fill: isDropdownVisible ? hoverColor : effectiveNovacThemeEnabled ? '#FFF' : '#1A1A1A'
1205
+ fill: isDropdownVisible ? hoverColor : typographyColor
1000
1206
  })]
1001
1207
  }))]
1002
1208
  })), jsx(HeaderAnimatedMask, __assign({
@@ -1021,21 +1227,23 @@ var Header = function (props) {
1021
1227
  }));
1022
1228
  };
1023
1229
  var HeaderContent = function () {
1024
- var _a = useHeaderContext(),
1025
- onLoginButtonClick = _a.onLoginButtonClick,
1026
- _b = _a.showAllLobs,
1027
- showAllLobs = _b === void 0 ? false : _b,
1028
- isUserLoggedIn = _a.isUserLoggedIn;
1029
- _a.loyaltyType;
1030
- var _c = _a.isNovacThemeEnabled,
1031
- isNovacThemeEnabled = _c === void 0 ? false : _c;
1032
- _a.ravenPayload;
1033
- _a.ravenPushCallback;
1034
- _a.ravenPageName;
1035
- _a.ravenEventName;
1036
- var _e = useState(false),
1037
- scrolled = _e[0],
1038
- setScrolled = _e[1];
1230
+ var _a;
1231
+ var _b = useHeaderContext(),
1232
+ onLoginButtonClick = _b.onLoginButtonClick,
1233
+ _c = _b.showAllLobs,
1234
+ showAllLobs = _c === void 0 ? false : _c,
1235
+ isUserLoggedIn = _b.isUserLoggedIn,
1236
+ loyaltyType = _b.loyaltyType,
1237
+ _d = _b.isNovacThemeEnabled,
1238
+ isNovacThemeEnabled = _d === void 0 ? false : _d,
1239
+ _e = _b.ravenPayload,
1240
+ ravenPayload = _e === void 0 ? {} : _e,
1241
+ ravenPushCallback = _b.ravenPushCallback,
1242
+ ravenPageName = _b.ravenPageName,
1243
+ ravenEventName = _b.ravenEventName;
1244
+ var _f = useState(false),
1245
+ scrolled = _f[0],
1246
+ setScrolled = _f[1];
1039
1247
  useEffect(function () {
1040
1248
  var handleScroll = function () {
1041
1249
  setScrolled(window.scrollY >= 100);
@@ -1045,18 +1253,49 @@ var HeaderContent = function () {
1045
1253
  return window.removeEventListener('scroll', handleScroll);
1046
1254
  };
1047
1255
  }, []);
1048
- var effectiveNovacThemeEnabled = isNovacThemeEnabled && !scrolled;
1049
- var headerBackground = effectiveNovacThemeEnabled ? 'transparent' : '#F7FAFF';
1050
- var hoverColor = effectiveNovacThemeEnabled ? '#FFB8A5' : '#FF4F17';
1051
- var _f = useHoverDropdown({
1256
+ var theme = isNovacThemeEnabled && !scrolled ? THEME_CONFIG.NOVAC : THEME_CONFIG.DEFAULT;
1257
+ var headerBackground = theme.headerBackground,
1258
+ logoFill = theme.logoFill,
1259
+ loginButtonColorVariant = theme.loginButtonColorVariant,
1260
+ hoverColor = theme.hoverColor,
1261
+ fkcompanyColor = theme.fkcompanyColor,
1262
+ typographyColor = theme.typographyColor;
1263
+ var _g = useHoverDropdown({
1052
1264
  openDelay: 0
1053
1265
  }),
1054
- isDropdownVisible = _f.isDropdownVisible,
1055
- hoveredElemIndex = _f.hoveredElemIndex,
1056
- handleOnMouseEnter = _f.handleOnMouseEnter,
1057
- handleOnMouseLeave = _f.handleOnMouseLeave,
1058
- handleDropdownMouseEnter = _f.handleDropdownMouseEnter,
1059
- handleDropdownMouseLeave = _f.handleDropdownMouseLeave;
1266
+ isDropdownVisible = _g.isDropdownVisible,
1267
+ hoveredElemIndex = _g.hoveredElemIndex,
1268
+ handleOnMouseEnter = _g.handleOnMouseEnter,
1269
+ handleOnMouseLeave = _g.handleOnMouseLeave,
1270
+ handleDropdownMouseEnter = _g.handleDropdownMouseEnter,
1271
+ handleDropdownMouseLeave = _g.handleDropdownMouseLeave;
1272
+ var utmSource = (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic';
1273
+ var createPayload = useCallback(function (actionName, actionType) {
1274
+ return {
1275
+ action_name: actionName,
1276
+ action_type: actionType,
1277
+ u_utm_source: utmSource,
1278
+ loyalty_type: ravenLoyaltyTypes(loyaltyType)
1279
+ };
1280
+ }, [utmSource, loyaltyType]);
1281
+ var handleNavbarOptionsClick = useCallback(function (option) {
1282
+ if (option.isClickable && option.link) {
1283
+ var actionName = "".concat(option.text.toLowerCase().replace(/\s/g, ''), "_header_click");
1284
+ var payload = createPayload(actionName, 'click');
1285
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, payload, ravenPayload, ravenPushCallback, ravenPageName);
1286
+ window.location.href = option.link;
1287
+ }
1288
+ }, [createPayload, isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
1289
+ var handleHomeClick = useCallback(function () {
1290
+ var payload = createPayload('home_header_click', 'click');
1291
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, payload, ravenPayload, ravenPushCallback, ravenPageName);
1292
+ window.location.href = '/';
1293
+ }, [createPayload, isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
1294
+ var triggerRavenEventOnHover = useCallback(function (option) {
1295
+ var actionName = "".concat(option.text.toLowerCase().replace(/\s/g, ''), "_header_hover");
1296
+ var payload = createPayload(actionName, 'hover');
1297
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, payload, ravenPayload, ravenPushCallback, ravenPageName);
1298
+ }, [createPayload, isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
1060
1299
  return jsxs(Fragment, {
1061
1300
  children: [jsx(Container, __assign({
1062
1301
  display: 'flex',
@@ -1071,7 +1310,7 @@ var HeaderContent = function () {
1071
1310
  css: {
1072
1311
  gap: '24px',
1073
1312
  flexShrink: 0,
1074
- borderBottom: effectiveNovacThemeEnabled ? '' : '1px solid #E6E6E6',
1313
+ borderBottom: headerBackground === 'transparent' ? '' : '1px solid #E6E6E6',
1075
1314
  transition: 'background-color 0.3s ease-in-out, border-bottom 0.3s ease-in-out'
1076
1315
  }
1077
1316
  }, {
@@ -1081,7 +1320,7 @@ var HeaderContent = function () {
1081
1320
  justifyContent: 'space-between',
1082
1321
  padding: '0 28px',
1083
1322
  flex: 1,
1084
- style: {
1323
+ css: {
1085
1324
  gap: '24px',
1086
1325
  maxWidth: 1440
1087
1326
  }
@@ -1092,13 +1331,10 @@ var HeaderContent = function () {
1092
1331
  alignItems: 'center',
1093
1332
  justifyContent: 'center',
1094
1333
  cursor: 'pointer',
1095
- paddingLeft: '16px',
1096
- onClick: function () {
1097
- window.location.href = '/';
1098
- }
1334
+ onClick: handleHomeClick
1099
1335
  }, {
1100
1336
  children: [jsx(CTLogo, {
1101
- fillColor: effectiveNovacThemeEnabled ? '#FFF' : '#FF4F17'
1337
+ fillColor: logoFill
1102
1338
  }), jsx(Divider, {
1103
1339
  css: {
1104
1340
  width: 12,
@@ -1108,7 +1344,7 @@ var HeaderContent = function () {
1108
1344
  borderBottom: '1px solid #e0e0e0'
1109
1345
  }
1110
1346
  }), jsx(Fkcompany, {
1111
- color: effectiveNovacThemeEnabled ? '#FFF' : '#1A1A1A'
1347
+ color: fkcompanyColor
1112
1348
  })]
1113
1349
  })), jsxs(Container, __assign({
1114
1350
  display: 'flex',
@@ -1125,11 +1361,18 @@ var HeaderContent = function () {
1125
1361
  columnGap: '4px'
1126
1362
  }, {
1127
1363
  children: NAVBAR_OPTIONS.map(function (option, index) {
1364
+ var text = option.text,
1365
+ LeftIcon = option.lefticon,
1366
+ RightIcon = option.rightIcon,
1367
+ isHoverable = option.isHoverable;
1128
1368
  var isHovered = hoveredElemIndex === index;
1129
1369
  return jsxs(Container, {
1130
1370
  children: [jsxs(Container, __assign({
1131
1371
  onMouseEnter: function () {
1132
- return handleOnMouseEnter(index);
1372
+ handleOnMouseEnter(index);
1373
+ if (option.isHoverable) {
1374
+ triggerRavenEventOnHover(option);
1375
+ }
1133
1376
  },
1134
1377
  onMouseLeave: handleOnMouseLeave,
1135
1378
  display: 'flex',
@@ -1141,13 +1384,11 @@ var HeaderContent = function () {
1141
1384
  columnGap: 8,
1142
1385
  height: '64px',
1143
1386
  onClick: function () {
1144
- if (option.link && option.isClickable) {
1145
- window.location.href = option.link;
1146
- }
1387
+ return handleNavbarOptionsClick(option);
1147
1388
  }
1148
1389
  }, {
1149
- children: [jsx(option.lefticon, {
1150
- color: isHovered ? hoverColor : effectiveNovacThemeEnabled ? '#FFF' : '#1A1A1A'
1390
+ children: [jsx(LeftIcon, {
1391
+ color: isHovered ? hoverColor : typographyColor
1151
1392
  }), jsxs(Container, __assign({
1152
1393
  display: 'flex',
1153
1394
  flexDirection: 'row',
@@ -1155,31 +1396,31 @@ var HeaderContent = function () {
1155
1396
  }, {
1156
1397
  children: [jsx(Typography, __assign({
1157
1398
  variant: 'B2',
1158
- colorCode: isHovered ? hoverColor : effectiveNovacThemeEnabled ? '#FFF' : '#1A1A1A',
1399
+ colorCode: isHovered ? hoverColor : typographyColor,
1159
1400
  isClickable: true
1160
1401
  }, {
1161
- children: option.text
1162
- })), option.rightIcon && jsx(option.rightIcon, {
1402
+ children: text
1403
+ })), RightIcon && jsx(RightIcon, {
1163
1404
  width: 20,
1164
1405
  height: 20,
1165
- fill: isHovered ? hoverColor : effectiveNovacThemeEnabled ? '#FFF' : '#1A1A1A'
1406
+ fill: isHovered ? hoverColor : typographyColor
1166
1407
  })]
1167
1408
  }))]
1168
1409
  }), "nav-option-".concat(index)), jsx(HeaderAnimatedMask, __assign({
1169
- show: hoveredElemIndex === index && option.isHoverable && isDropdownVisible,
1410
+ show: hoveredElemIndex === index && isHoverable && isDropdownVisible,
1170
1411
  marginTop: '64px',
1171
1412
  handleDropdownMouseEnter: handleDropdownMouseEnter,
1172
1413
  handleDropdownMouseLeave: handleDropdownMouseLeave,
1173
1414
  onMaskClick: handleDropdownMouseLeave
1174
1415
  }, {
1175
1416
  children: jsx(BusinessDropdownContent, {
1176
- isOpen: hoveredElemIndex === index && option.isHoverable && isDropdownVisible
1417
+ isOpen: hoveredElemIndex === index && isHoverable && isDropdownVisible
1177
1418
  })
1178
1419
  }))]
1179
1420
  });
1180
1421
  })
1181
1422
  })), isUserLoggedIn && jsx(Divider, {
1182
- style: {
1423
+ css: {
1183
1424
  width: 12,
1184
1425
  margin: '0 -18px',
1185
1426
  transform: 'rotate(90deg)',
@@ -1193,21 +1434,22 @@ var HeaderContent = function () {
1193
1434
  }, {
1194
1435
  children: jsx(UserAccount, {})
1195
1436
  })) : jsx(Button, __assign({
1196
- className: "fw-400 fs-14 ".concat(effectiveNovacThemeEnabled ? 'novac-login-button' : 'login-button'),
1437
+ variant: 'outline',
1438
+ color: loginButtonColorVariant,
1439
+ className: "".concat(headerBackground === 'transparent' ? 'novac-login-button' : 'login-button'),
1197
1440
  onClick: onLoginButtonClick,
1198
- style: {
1441
+ css: {
1199
1442
  width: 153,
1200
- height: 40,
1201
- border: effectiveNovacThemeEnabled ? '1px solid #FFF' : '1px solid #1A1A1A'
1443
+ height: 40
1202
1444
  },
1203
1445
  loading: false
1204
1446
  }, {
1205
1447
  children: jsx(Typography, __assign({
1206
1448
  componentNode: 'span',
1207
1449
  variant: 'L2',
1208
- color: effectiveNovacThemeEnabled ? 'neutral' : 'primary'
1450
+ color: loginButtonColorVariant === ButtonColor.NEUTRAL ? 'neutral' : 'primary'
1209
1451
  }, {
1210
- children: "Login"
1452
+ children: LOG_IN_TEXT
1211
1453
  }))
1212
1454
  }))
1213
1455
  })]
@@ -1217,5 +1459,5 @@ var HeaderContent = function () {
1217
1459
  });
1218
1460
  };
1219
1461
 
1220
- export { Header, LOBS_VALUES, LoyaltyType };
1462
+ export { Header, LOBS_VALUES, LoyaltyType, RAVEN_PAGE_NAMES };
1221
1463
  //# sourceMappingURL=ct-design-header.esm.js.map