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