@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.
@@ -50,23 +50,27 @@
50
50
  var NAVBAR_OPTIONS = [{
51
51
  lefticon: ctDesignIcons.Offers,
52
52
  text: 'Offers',
53
+ ravenActionName: 'offers',
53
54
  isHoverable: false,
54
55
  isClickable: true,
55
56
  link: OFFERS_URL
56
57
  }, {
57
58
  lefticon: ctDesignIcons.BusinessBag,
58
59
  text: 'Business',
60
+ ravenActionName: 'business',
59
61
  rightIcon: ctDesignIcons.ChevronDown,
60
62
  isHoverable: true
61
63
  }, {
62
64
  lefticon: ctDesignIcons.MyTrips,
63
65
  text: 'My Trips',
66
+ ravenActionName: 'mytrips',
64
67
  isHoverable: false,
65
68
  isClickable: true,
66
69
  link: MY_TRIPS_URL
67
70
  }, {
68
71
  lefticon: ctDesignIcons.SupportIcon,
69
72
  text: 'Support',
73
+ ravenActionName: 'support',
70
74
  isHoverable: false,
71
75
  isClickable: true,
72
76
  link: SUPPORT_URL
@@ -80,33 +84,36 @@
80
84
  };
81
85
  var LOB_DATA = [{
82
86
  title: LOBS.FLIGHTS,
83
- image: 'https://rukmini-ct.flixcart.com/f_auto,w_48,h_48,dpr_2/offermgmt-prod/offermgmt/images/banner/flight_uhp.png?cache=true',
87
+ image: 'https://rukmini-ct.flixcart.com/f_auto,w_32,h_32,dpr_4/offermgmt-prod/offermgmt/images/banner/Navbar_Flights.png?cache=true',
84
88
  link: '/flights'
85
89
  }, {
86
90
  title: LOBS.HOTELS,
87
- image: 'https://rukmini-ct.flixcart.com/f_auto,w_48,h_48,dpr_2/offermgmt-prod/offermgmt/images/banner/hotel_uhp.png?cache=true',
91
+ image: 'https://rukmini-ct.flixcart.com/f_auto,w_32,h_32,dpr_4/offermgmt-prod/offermgmt/images/banner/Navbar_Hotels.png?cache=true',
88
92
  link: '/hotels'
89
93
  }, {
90
94
  title: LOBS.BUSES,
91
- image: 'https://rukmini-ct.flixcart.com/f_auto,w_40,h_40,dpr_2/offermgmt-prod/offermgmt/images/banner/bus_uhp.png?cache=true',
95
+ image: 'https://rukmini-ct.flixcart.com/f_auto,w_32,h_32,dpr_4/offermgmt-prod/offermgmt/images/banner/Navbar_Buses.png?cache=true',
92
96
  link: '/bus'
93
97
  }, {
94
98
  title: LOBS.TRAIN,
95
- image: 'https://rukmini-ct.flixcart.com/f_auto,w_40,h_40,dpr_2/offermgmt-prod/offermgmt/images/banner/train_uhp.png?cache=true',
99
+ image: 'https://rukmini-ct.flixcart.com/f_auto,w_32,h_32,dpr_4/offermgmt-prod/offermgmt/images/banner/Navbar_Trains.png?cache=true',
96
100
  link: '/pages/trains/appOnly'
97
101
  }, {
98
102
  title: LOBS.PACKAGES,
99
- image: 'https://rukmini-ct.flixcart.com/f_auto,w_40,h_40,dpr_2/offermgmt-prod/offermgmt/images/banner/holiday_uhp.png?cache=true',
103
+ image: 'https://rukmini-ct.flixcart.com/f_auto,w_32,h_32,dpr_4/offermgmt-prod/offermgmt/images/banner/Navbar_Packages.png?cache=true',
100
104
  link: '/holidays'
101
105
  }];
102
106
  var bdConfig = [{
103
107
  title: 'AgentBox',
104
108
  subtitle: 'For travel agents',
105
- details: 'One-stop travel solution offering the best deals to our travel agency partners'
109
+ details: 'One-stop travel solution offering the best deals to our travel agency partners',
110
+ link: 'https://agency.cleartrip.com'
106
111
  }, {
107
112
  title: 'OutOfOffice',
108
113
  subtitle: 'For startups, corporates and SMEs',
109
- details: 'Manage corporate business travel, smartly'
114
+ details: 'Manage corporate business travel, smartly',
115
+ link: 'https://ooo.cleartrip.com/',
116
+ ravenActionName: 'ooo'
110
117
  }, {
111
118
  title: 'MICE',
112
119
  subtitle: 'For corporate events',
@@ -119,16 +126,35 @@
119
126
  link: 'https://business.cleartrip.com/api-customers/more-details'
120
127
  }];
121
128
  var BUSINESS_DROPDOWN_HEADING = 'Other business services';
122
- var RAVEN_PAGE_NAMES;
129
+ exports.RAVEN_PAGE_NAMES = void 0;
123
130
  (function (RAVEN_PAGE_NAMES) {
124
131
  RAVEN_PAGE_NAMES["UNIFIED_HOME"] = "unified_homepage";
125
- RAVEN_PAGE_NAMES["HOTELS_HOME"] = "hotels_homepage";
126
- RAVEN_PAGE_NAMES["FLIGHTS_HOME"] = "flights_homepage";
127
- })(RAVEN_PAGE_NAMES || (RAVEN_PAGE_NAMES = {}));
132
+ RAVEN_PAGE_NAMES["HOTELS_HOME"] = "hotel_home";
133
+ RAVEN_PAGE_NAMES["FLIGHTS_HOME"] = "flights_home";
134
+ })(exports.RAVEN_PAGE_NAMES || (exports.RAVEN_PAGE_NAMES = {}));
128
135
  var RAVEN_PLATFORMS;
129
136
  (function (RAVEN_PLATFORMS) {
130
137
  RAVEN_PLATFORMS["DESKTOP"] = "desktop";
131
138
  })(RAVEN_PLATFORMS || (RAVEN_PLATFORMS = {}));
139
+ var LOG_IN_TEXT = 'Log in';
140
+ var THEME_CONFIG = {
141
+ NOVAC: {
142
+ headerBackground: 'transparent',
143
+ hoverColor: '#FFB8A5',
144
+ logoFill: '#FFF',
145
+ fkcompanyColor: '#FFF',
146
+ typographyColor: '#FFF',
147
+ loginButtonColorVariant: ctDesignButton.ButtonColor.NEUTRAL
148
+ },
149
+ DEFAULT: {
150
+ headerBackground: '#F7FAFF',
151
+ hoverColor: '#FF4F17',
152
+ logoFill: '#FF4F17',
153
+ fkcompanyColor: '#1A1A1A',
154
+ typographyColor: '#1A1A1A',
155
+ loginButtonColorVariant: ctDesignButton.ButtonColor.PRIMARY
156
+ }
157
+ };
132
158
 
133
159
  var HeaderContext = react.createContext(undefined);
134
160
  var useHeaderContext = function () {
@@ -164,33 +190,33 @@
164
190
  }
165
191
  }, {
166
192
  children: LOB_DATA.map(function (item, index) {
193
+ var title = item.title,
194
+ link = item.link,
195
+ image = item.image;
167
196
  return jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
168
197
  display: 'flex',
169
198
  alignItems: 'center',
170
199
  cursor: 'pointer',
171
200
  css: {
172
201
  gap: 8,
173
- background: selectedLOB === item.title ? '#FFFFFF' : 'transparent',
174
- borderRadius: selectedLOB === item.title ? '40px' : '0',
175
- padding: selectedLOB === item.title ? '8px 16px 8px 8px' : '0'
202
+ background: selectedLOB === title ? '#FFFFFF' : 'transparent',
203
+ borderRadius: selectedLOB === title ? '40px' : '0',
204
+ padding: selectedLOB === title ? '8px 16px 8px 8px' : '0'
176
205
  },
177
206
  onClick: function () {
178
- window.location.href = item.link;
207
+ window.location.href = link;
179
208
  }
180
209
  }, {
181
210
  children: [jsxRuntime.jsx("img", {
182
- src: item.image,
183
- alt: item.title,
211
+ src: image,
212
+ alt: title,
184
213
  width: 32,
185
214
  height: 32
186
215
  }), jsxRuntime.jsx(ctDesignTypography.Typography, __assign({
187
- variant: 'P1',
188
- style: {
189
- fontWeight: selectedLOB === item.title ? 600 : 500
190
- },
216
+ variant: selectedLOB === title ? ctDesignTypography.TypographyVariant.HM3 : ctDesignTypography.TypographyVariant.B1,
191
217
  isClickable: true
192
218
  }, {
193
- children: item.title
219
+ children: title
194
220
  }))]
195
221
  }), index);
196
222
  })
@@ -391,11 +417,85 @@
391
417
  };
392
418
  };
393
419
 
420
+ var stringifyPayload = function (payload) {
421
+ var keys = Object.keys(payload);
422
+ var numericValues = [];
423
+ keys.forEach(function (key) {
424
+ if (numericValues.includes(key)) {
425
+ payload[key] = Number(payload[key]);
426
+ } else {
427
+ payload[key] = '' + payload[key];
428
+ }
429
+ });
430
+ return payload;
431
+ };
432
+ var isServer = function () {
433
+ return typeof window === 'undefined' || !window;
434
+ };
435
+ var getQueryParam = function (queryParam) {
436
+ if (isServer()) {
437
+ return '';
438
+ }
439
+ var urlParams = new URLSearchParams(window.location.search);
440
+ return urlParams.get(queryParam);
441
+ };
442
+ var ravenLoyaltyTypes = function (loyaltyType) {
443
+ switch (loyaltyType) {
444
+ case 'FkVip':
445
+ return 'fk_vip';
446
+ case 'FkPremium':
447
+ return 'fk_plus_premium';
448
+ case 'InsiderIcon':
449
+ return 'myntra_insidericon';
450
+ case 'InsiderElite':
451
+ return 'myntra_insiderelite';
452
+ default:
453
+ return '';
454
+ }
455
+ };
456
+ var ravenSDKTrigger = function (isUserLoggedIn, eventName, ravenPayload, customRavenPayload, ravenPushCallback, pageName) {
457
+ var _a;
458
+ if (typeof ravenPushCallback !== 'function') {
459
+ console.error('ravenPushCallback is not provided or is not a function');
460
+ return;
461
+ }
462
+ var commonPayload = {
463
+ page_name: pageName,
464
+ platform: RAVEN_PLATFORMS.DESKTOP,
465
+ login_status: isUserLoggedIn ? 'yes' : 'no',
466
+ domain: (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.host
467
+ };
468
+ var newRavenPayload = stringifyPayload(ravenPayload);
469
+ var parsedCustomRavenPayload = stringifyPayload(customRavenPayload);
470
+ var finalPayload = __assign(__assign(__assign({}, commonPayload), newRavenPayload), parsedCustomRavenPayload);
471
+ try {
472
+ if (ravenPushCallback.length === 1) {
473
+ ravenPushCallback({
474
+ eventName: eventName,
475
+ eventData: finalPayload
476
+ });
477
+ } else {
478
+ ravenPushCallback(eventName, finalPayload);
479
+ }
480
+ } catch (err) {
481
+ console.error(err);
482
+ return;
483
+ }
484
+ };
485
+
394
486
  var BusinessDropdownContent = function (_a) {
395
487
  var isOpen = _a.isOpen;
396
- var _b = react.useState(0),
397
- leftPosition = _b[0],
398
- setLeftPosition = _b[1];
488
+ var _b = useHeaderContext(),
489
+ isUserLoggedIn = _b.isUserLoggedIn,
490
+ ravenPushCallback = _b.ravenPushCallback,
491
+ ravenPageName = _b.ravenPageName,
492
+ ravenEventName = _b.ravenEventName,
493
+ loyaltyType = _b.loyaltyType,
494
+ _c = _b.ravenPayload,
495
+ ravenPayload = _c === void 0 ? {} : _c;
496
+ var _d = react.useState(0),
497
+ leftPosition = _d[0],
498
+ setLeftPosition = _d[1];
399
499
  var containerRef = useDropdownAnimation(isOpen).containerRef;
400
500
  react.useEffect(function () {
401
501
  var updatePosition = function () {
@@ -414,6 +514,21 @@
414
514
  return window.removeEventListener('resize', updatePosition);
415
515
  };
416
516
  }, [containerRef, leftPosition]);
517
+ var handleBusinessDropdownClick = react.useCallback(function (link, title, ravenActionName) {
518
+ var _a;
519
+ var utmSource = (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic';
520
+ var actionName = ravenActionName ? "".concat(ravenActionName, "_business_click") : title ? "".concat(title.toLowerCase(), "_business_click") : '';
521
+ var defaultPayload = {
522
+ action_name: actionName,
523
+ action_type: 'click',
524
+ u_utm_source: utmSource,
525
+ loyalty_type: ravenLoyaltyTypes(loyaltyType)
526
+ };
527
+ if (link) {
528
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, defaultPayload, ravenPayload, ravenPushCallback, ravenPageName);
529
+ window.location.href = link;
530
+ }
531
+ }, [isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName, loyaltyType]);
417
532
  return jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
418
533
  ref: containerRef,
419
534
  backgroundColor: '#fff',
@@ -434,10 +549,7 @@
434
549
  backgroundColor: '#FFF1EC'
435
550
  }, {
436
551
  children: jsxRuntime.jsx(ctDesignTypography.Typography, __assign({
437
- variant: 'HM2',
438
- css: {
439
- lineHeight: '24px'
440
- }
552
+ variant: 'HM2'
441
553
  }, {
442
554
  children: BUSINESS_DROPDOWN_HEADING
443
555
  }))
@@ -451,11 +563,16 @@
451
563
  children: bdConfig.map(function (_a) {
452
564
  var title = _a.title,
453
565
  subtitle = _a.subtitle,
454
- details = _a.details;
566
+ details = _a.details,
567
+ link = _a.link,
568
+ ravenActionName = _a.ravenActionName;
455
569
  return jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
456
570
  cursor: 'pointer',
457
571
  width: '200px',
458
- className: 'bd-hover-container'
572
+ className: 'bd-hover-container',
573
+ onClick: function () {
574
+ return handleBusinessDropdownClick(link, title, ravenActionName);
575
+ }
459
576
  }, {
460
577
  children: [jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
461
578
  display: 'flex',
@@ -554,6 +671,7 @@
554
671
  redirectionLink: 'accounts/personal-data-dashboard'
555
672
  }];
556
673
  var SIGN_OUT_TEXT = 'Logout';
674
+ var MY_ACCOUNT_TEXT = 'My Account';
557
675
  var LOGGEDIN_USER_TEXT = 'You are logged in with';
558
676
  var HEADER_ACCOUNTS_OPTIONS_OPEN_BTN_ID = 'header-acc-btn';
559
677
  var ACCOUNT_OPTIONS_CONTAINER_ID = 'account-options';
@@ -565,13 +683,33 @@
565
683
  backgroundGradient = _a.backgroundGradient,
566
684
  handleChipClick = _a.handleChipClick,
567
685
  chevronFillColor = _a.chevronFillColor;
568
- var _b = react.useState(false),
569
- isHovered = _b[0],
570
- setIsHovered = _b[1];
571
- var handleClick = function () {
572
- window.location.href = '/';
573
- handleChipClick && handleChipClick();
574
- };
686
+ var _b = useHeaderContext(),
687
+ loyaltyType = _b.loyaltyType,
688
+ isUserLoggedIn = _b.isUserLoggedIn,
689
+ ravenPushCallback = _b.ravenPushCallback,
690
+ ravenPageName = _b.ravenPageName,
691
+ _c = _b.ravenPayload,
692
+ ravenPayload = _c === void 0 ? {} : _c,
693
+ ravenEventName = _b.ravenEventName;
694
+ var _d = react.useState(false),
695
+ isHovered = _d[0],
696
+ setIsHovered = _d[1];
697
+ var handleClick = react.useCallback(function () {
698
+ var _a;
699
+ if (handleChipClick) {
700
+ handleChipClick();
701
+ } else {
702
+ var utmSource = (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic';
703
+ var defaultPayload = {
704
+ action_name: "loyalty_account_click",
705
+ action_type: 'click',
706
+ u_utm_source: utmSource,
707
+ loyaltyType: ravenLoyaltyTypes(loyaltyType)
708
+ };
709
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, defaultPayload, ravenPayload, ravenPushCallback, ravenPageName);
710
+ window.location.href = '/all-offers/loyalty-october';
711
+ }
712
+ }, [handleChipClick, loyaltyType, isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
575
713
  return jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
576
714
  display: 'flex',
577
715
  position: 'relative',
@@ -596,7 +734,7 @@
596
734
  onClick: handleClick
597
735
  }, {
598
736
  children: [jsxRuntime.jsx(ctDesignContainer.Container, {
599
- style: {
737
+ css: {
600
738
  content: '""',
601
739
  position: 'absolute',
602
740
  inset: 0,
@@ -605,7 +743,7 @@
605
743
  zIndex: -2
606
744
  }
607
745
  }), jsxRuntime.jsx(ctDesignContainer.Container, {
608
- style: {
746
+ css: {
609
747
  content: '""',
610
748
  position: 'absolute',
611
749
  inset: 0,
@@ -626,7 +764,7 @@
626
764
  })), jsxRuntime.jsx(ctDesignContainer.Container, __assign({
627
765
  display: 'flex',
628
766
  alignItems: 'center',
629
- style: {
767
+ css: {
630
768
  overflow: 'hidden',
631
769
  maxWidth: isHovered ? 16 : 0,
632
770
  transition: 'max-width 0.2s ease-in-out, opacity 0.2s ease-in-out',
@@ -691,24 +829,46 @@
691
829
  handleChipClick = _a.handleChipClick,
692
830
  value = _a.value,
693
831
  type = _a.type;
694
- var _b = react.useState(false),
695
- isHovered = _b[0],
696
- setIsHovered = _b[1];
697
- var handleDefaultClick = function () {
698
- if (type === 'supercoins') {
699
- window.location.href = '/supercoins';
700
- } else if (type === 'wallet') {
701
- window.location.href = '/wallet';
832
+ var _b = useHeaderContext(),
833
+ loyaltyType = _b.loyaltyType,
834
+ isUserLoggedIn = _b.isUserLoggedIn,
835
+ ravenPushCallback = _b.ravenPushCallback,
836
+ ravenPageName = _b.ravenPageName,
837
+ ravenEventName = _b.ravenEventName,
838
+ _c = _b.ravenPayload,
839
+ ravenPayload = _c === void 0 ? {} : _c;
840
+ var _d = react.useState(false),
841
+ isHovered = _d[0],
842
+ setIsHovered = _d[1];
843
+ var handleDefaultClick = react.useCallback(function () {
844
+ var _a;
845
+ if (handleChipClick) {
846
+ handleChipClick();
847
+ } else {
848
+ var utmSource = (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic';
849
+ var defaultPayload = {
850
+ action_name: "".concat(type, "_account_click"),
851
+ action_type: 'click',
852
+ u_utm_source: utmSource,
853
+ loyaltyType: ravenLoyaltyTypes(loyaltyType)
854
+ };
855
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, defaultPayload, ravenPayload, ravenPushCallback, ravenPageName);
856
+ var redirectUrls = {
857
+ supercoin: '/all-offers/supercoins/',
858
+ wallet: '/accounts/wallet'
859
+ };
860
+ if (redirectUrls[type]) {
861
+ window.location.href = redirectUrls[type];
862
+ }
702
863
  }
703
- handleChipClick && handleChipClick();
704
- };
864
+ }, [handleChipClick, type, loyaltyType, isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
705
865
  return jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
706
866
  display: 'flex',
707
867
  alignItems: 'center',
708
868
  justifyContent: 'center',
709
869
  borderRadius: '8px',
710
870
  cursor: 'pointer',
711
- style: {
871
+ css: {
712
872
  height: 32,
713
873
  paddingLeft: 8,
714
874
  paddingRight: isHovered ? 4 : 8,
@@ -739,7 +899,7 @@
739
899
  })), jsxRuntime.jsx(ctDesignContainer.Container, __assign({
740
900
  display: 'flex',
741
901
  alignItems: 'center',
742
- style: {
902
+ css: {
743
903
  overflow: 'hidden',
744
904
  maxWidth: isHovered ? 16 : 0,
745
905
  transition: 'max-width 0.2s ease-in-out, opacity 0.2s ease-in-out',
@@ -767,6 +927,12 @@
767
927
  hideWalletChip = _b.hideWalletChip,
768
928
  hideSupercoinsChip = _b.hideSupercoinsChip,
769
929
  hideLoyaltyChip = _b.hideLoyaltyChip;
930
+ var shouldShowLoyalty = loyaltyLoading || selectedLoyaltyType && LOYALTY_DATA[selectedLoyaltyType] && !hideLoyaltyChip;
931
+ var shouldShowSupercoin = superCoinsLoading || !hideSupercoinsChip;
932
+ var shouldShowWallet = walletLoading || !hideWalletChip;
933
+ if (!shouldShowLoyalty && !shouldShowSupercoin && !shouldShowWallet) {
934
+ return null;
935
+ }
770
936
  return jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
771
937
  display: 'flex',
772
938
  padding: '0 16px 16px 16px',
@@ -797,7 +963,7 @@
797
963
  }),
798
964
  value: superCoinBalance,
799
965
  handleChipClick: supercoinsChipClick,
800
- type: 'supercoins'
966
+ type: 'supercoin'
801
967
  }), walletLoading ? jsxRuntime.jsx(ctDesignShimmer.Shimmer, {
802
968
  width: '50px',
803
969
  height: '32px',
@@ -821,34 +987,51 @@
821
987
  userName = _b.userName,
822
988
  userMobileNumber = _b.userMobileNumber,
823
989
  countryCode = _b.countryCode,
824
- userDetailsLoading = _b.userDetailsLoading;
990
+ userDetailsLoading = _b.userDetailsLoading,
991
+ loyaltyType = _b.loyaltyType,
992
+ isUserLoggedIn = _b.isUserLoggedIn,
993
+ ravenEventName = _b.ravenEventName,
994
+ ravenPageName = _b.ravenPageName,
995
+ _c = _b.ravenPayload,
996
+ ravenPayload = _c === void 0 ? {} : _c,
997
+ ravenPushCallback = _b.ravenPushCallback;
825
998
  var containerRef = useDropdownAnimation(isOpen).containerRef;
826
- var _c = react.useMemo(function () {
827
- var userGreeting = userName && "Hello ".concat(userName, "!");
828
- var phoneNumber = countryCode && userMobileNumber ? "".concat(countryCode, " ").concat(userMobileNumber) : '';
999
+ var _d = react.useMemo(function () {
829
1000
  return {
830
- userGreeting: userGreeting,
831
- phoneNumber: phoneNumber
1001
+ userGreeting: userName ? "Hello ".concat(userName, "!") : '',
1002
+ phoneNumber: countryCode && userMobileNumber ? "".concat(countryCode, " ").concat(userMobileNumber) : ''
832
1003
  };
833
1004
  }, [userName, userMobileNumber, countryCode]),
834
- userGreeting = _c.userGreeting,
835
- phoneNumber = _c.phoneNumber;
836
- var handleRedirectClick = function (redirectLink) {
837
- return function () {
838
- window.location.href = redirectLink;
1005
+ userGreeting = _d.userGreeting,
1006
+ phoneNumber = _d.phoneNumber;
1007
+ var generateRavenPayload = function (actionName) {
1008
+ var _a;
1009
+ return {
1010
+ action_name: actionName.toLowerCase().replace(/[\s-]/g, '') + '_account_click',
1011
+ action_type: 'click',
1012
+ u_utm_source: (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic',
1013
+ loyalty_type: ravenLoyaltyTypes(loyaltyType)
839
1014
  };
840
1015
  };
841
- react.useEffect(function () {
1016
+ var handleAccountOptionsClick = react.useCallback(function (text, redirectLink) {
1017
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, generateRavenPayload(text), ravenPayload, ravenPushCallback, ravenPageName);
1018
+ window.location.href = redirectLink;
1019
+ }, [isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
1020
+ react.useCallback(function () {
1021
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, generateRavenPayload(SIGN_OUT_TEXT), ravenPayload, ravenPushCallback, ravenPageName);
1022
+ handleLogoutClick();
1023
+ }, [isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName, handleLogoutClick]);
1024
+ var positionAccountOptionsDiv = react.useCallback(function () {
842
1025
  var headerAccBtn = document.getElementById(HEADER_ACCOUNTS_OPTIONS_OPEN_BTN_ID);
843
1026
  var accountOptionsElem = document.getElementById(ACCOUNT_OPTIONS_CONTAINER_ID);
844
- var positionAccountOptionsDiv = function () {
845
- var headerBtnRight = headerAccBtn === null || headerAccBtn === void 0 ? void 0 : headerAccBtn.getBoundingClientRect().right;
846
- if (accountOptionsElem && headerBtnRight) {
847
- accountOptionsElem.style.left = "".concat(headerBtnRight - ACCOUNT_OPTIONS_CONTAINER_WIDTH, "px");
848
- }
849
- };
850
- positionAccountOptionsDiv();
1027
+ if (headerAccBtn && accountOptionsElem) {
1028
+ var headerBtnRight = headerAccBtn.getBoundingClientRect().right;
1029
+ accountOptionsElem.style.left = "".concat(headerBtnRight - ACCOUNT_OPTIONS_CONTAINER_WIDTH, "px");
1030
+ }
851
1031
  }, []);
1032
+ react.useEffect(function () {
1033
+ positionAccountOptionsDiv();
1034
+ }, [positionAccountOptionsDiv]);
852
1035
  var renderUserData = function () {
853
1036
  var renderContent = function (loading, content, variant, color) {
854
1037
  return jsxRuntime.jsx(ctDesignTypography.Typography, __assign({
@@ -893,7 +1076,7 @@
893
1076
  }, {
894
1077
  children: [jsxRuntime.jsx(ctDesignContainer.Container, __assign({
895
1078
  padding: '16px',
896
- height: '72px'
1079
+ height: '76px'
897
1080
  }, {
898
1081
  children: renderUserData()
899
1082
  })), jsxRuntime.jsx(RewardsSection, {}), jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
@@ -902,7 +1085,7 @@
902
1085
  padding: '8px',
903
1086
  backgroundColor: 'white',
904
1087
  rowGap: '8px',
905
- style: {
1088
+ css: {
906
1089
  borderBottomLeftRadius: 12,
907
1090
  borderBottomRightRadius: 12
908
1091
  }
@@ -916,12 +1099,14 @@
916
1099
  padding: '8px',
917
1100
  borderRadius: '8px',
918
1101
  cursor: 'pointer',
919
- onClick: handleRedirectClick(redirectionLink)
1102
+ onClick: function () {
1103
+ return handleAccountOptionsClick(text, redirectionLink);
1104
+ }
920
1105
  }, {
921
1106
  children: jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
922
1107
  display: 'flex',
923
1108
  cursor: 'pointer',
924
- style: {
1109
+ css: {
925
1110
  columnGap: '8px'
926
1111
  }
927
1112
  }, {
@@ -938,7 +1123,7 @@
938
1123
  }))
939
1124
  }), "account-option-".concat(text));
940
1125
  }), jsxRuntime.jsx(ctDesignDivider.Divider, {
941
- style: {
1126
+ css: {
942
1127
  borderBottom: '1px dashed #E6E6E6'
943
1128
  }
944
1129
  }), jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
@@ -969,18 +1154,26 @@
969
1154
  };
970
1155
 
971
1156
  var UserAccount = function () {
972
- var isNovacThemeEnabled = useHeaderContext().isNovacThemeEnabled;
973
- var _a = useHoverDropdown({
1157
+ var _a = useHeaderContext(),
1158
+ isNovacThemeEnabled = _a.isNovacThemeEnabled,
1159
+ ravenEventName = _a.ravenEventName,
1160
+ _b = _a.ravenPayload,
1161
+ ravenPayload = _b === void 0 ? {} : _b,
1162
+ ravenPushCallback = _a.ravenPushCallback,
1163
+ isUserLoggedIn = _a.isUserLoggedIn,
1164
+ loyaltyType = _a.loyaltyType,
1165
+ ravenPageName = _a.ravenPageName;
1166
+ var _c = useHoverDropdown({
974
1167
  openDelay: 0
975
1168
  }),
976
- isDropdownVisible = _a.isDropdownVisible,
977
- handleOnMouseEnter = _a.handleOnMouseEnter,
978
- handleOnMouseLeave = _a.handleOnMouseLeave,
979
- handleDropdownMouseEnter = _a.handleDropdownMouseEnter,
980
- handleDropdownMouseLeave = _a.handleDropdownMouseLeave;
981
- var _b = react.useState(false),
982
- scrolled = _b[0],
983
- setScrolled = _b[1];
1169
+ isDropdownVisible = _c.isDropdownVisible,
1170
+ handleOnMouseEnter = _c.handleOnMouseEnter,
1171
+ handleOnMouseLeave = _c.handleOnMouseLeave,
1172
+ handleDropdownMouseEnter = _c.handleDropdownMouseEnter,
1173
+ handleDropdownMouseLeave = _c.handleDropdownMouseLeave;
1174
+ var _d = react.useState(false),
1175
+ scrolled = _d[0],
1176
+ setScrolled = _d[1];
984
1177
  react.useEffect(function () {
985
1178
  var handleScroll = function () {
986
1179
  setScrolled(window.scrollY >= 100);
@@ -990,8 +1183,20 @@
990
1183
  return window.removeEventListener('scroll', handleScroll);
991
1184
  };
992
1185
  }, []);
993
- var effectiveNovacThemeEnabled = isNovacThemeEnabled && !scrolled;
994
- var hoverColor = effectiveNovacThemeEnabled ? '#FFB8A5' : '#FF4F17';
1186
+ var theme = isNovacThemeEnabled && !scrolled ? THEME_CONFIG.NOVAC : THEME_CONFIG.DEFAULT;
1187
+ var hoverColor = theme.hoverColor,
1188
+ typographyColor = theme.typographyColor;
1189
+ var triggerRavenEventOnHover = react.useCallback(function () {
1190
+ var _a;
1191
+ var utmSource = (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic';
1192
+ var defaultPayload = {
1193
+ action_name: "".concat(MY_ACCOUNT_TEXT.toLowerCase().replace(/[\s-]/g, ''), "_header_hover"),
1194
+ action_type: 'hover',
1195
+ u_utm_source: utmSource,
1196
+ loyalty_type: ravenLoyaltyTypes(loyaltyType)
1197
+ };
1198
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, defaultPayload, ravenPayload, ravenPushCallback, ravenPageName);
1199
+ }, [isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName, loyaltyType]);
995
1200
  return jsxRuntime.jsxs(ctDesignContainer.Container, {
996
1201
  children: [jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
997
1202
  display: 'flex',
@@ -1000,18 +1205,19 @@
1000
1205
  borderRadius: '12px',
1001
1206
  height: '100%',
1002
1207
  cursor: 'pointer',
1003
- style: {
1208
+ css: {
1004
1209
  columnGap: 8,
1005
1210
  height: 64
1006
1211
  },
1007
1212
  onMouseEnter: function () {
1008
- return handleOnMouseEnter(0);
1213
+ handleOnMouseEnter(0);
1214
+ triggerRavenEventOnHover();
1009
1215
  },
1010
1216
  onMouseLeave: handleOnMouseLeave,
1011
1217
  id: HEADER_ACCOUNTS_OPTIONS_OPEN_BTN_ID
1012
1218
  }, {
1013
1219
  children: [jsxRuntime.jsx(ctDesignIcons.MyAccount, {
1014
- color: isDropdownVisible ? hoverColor : effectiveNovacThemeEnabled ? '#FFF' : '#1A1A1A'
1220
+ color: isDropdownVisible ? hoverColor : typographyColor
1015
1221
  }), jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
1016
1222
  display: 'flex',
1017
1223
  flexDirection: 'row',
@@ -1022,13 +1228,13 @@
1022
1228
  css: {
1023
1229
  cursor: 'pointer'
1024
1230
  },
1025
- colorCode: isDropdownVisible ? hoverColor : effectiveNovacThemeEnabled ? '#FFF' : '#1A1A1A'
1231
+ colorCode: isDropdownVisible ? hoverColor : typographyColor
1026
1232
  }, {
1027
- children: "My Account"
1233
+ children: MY_ACCOUNT_TEXT
1028
1234
  })), jsxRuntime.jsx(ctDesignIcons.ChevronDown, {
1029
1235
  width: 20,
1030
1236
  height: 20,
1031
- fill: isDropdownVisible ? hoverColor : effectiveNovacThemeEnabled ? '#FFF' : '#1A1A1A'
1237
+ fill: isDropdownVisible ? hoverColor : typographyColor
1032
1238
  })]
1033
1239
  }))]
1034
1240
  })), jsxRuntime.jsx(HeaderAnimatedMask, __assign({
@@ -1053,21 +1259,23 @@
1053
1259
  }));
1054
1260
  };
1055
1261
  var HeaderContent = function () {
1056
- var _a = useHeaderContext(),
1057
- onLoginButtonClick = _a.onLoginButtonClick,
1058
- _b = _a.showAllLobs,
1059
- showAllLobs = _b === void 0 ? false : _b,
1060
- isUserLoggedIn = _a.isUserLoggedIn;
1061
- _a.loyaltyType;
1062
- var _c = _a.isNovacThemeEnabled,
1063
- isNovacThemeEnabled = _c === void 0 ? false : _c;
1064
- _a.ravenPayload;
1065
- _a.ravenPushCallback;
1066
- _a.ravenPageName;
1067
- _a.ravenEventName;
1068
- var _e = react.useState(false),
1069
- scrolled = _e[0],
1070
- setScrolled = _e[1];
1262
+ var _a;
1263
+ var _b = useHeaderContext(),
1264
+ onLoginButtonClick = _b.onLoginButtonClick,
1265
+ _c = _b.showAllLobs,
1266
+ showAllLobs = _c === void 0 ? false : _c,
1267
+ isUserLoggedIn = _b.isUserLoggedIn,
1268
+ loyaltyType = _b.loyaltyType,
1269
+ _d = _b.isNovacThemeEnabled,
1270
+ isNovacThemeEnabled = _d === void 0 ? false : _d,
1271
+ _e = _b.ravenPayload,
1272
+ ravenPayload = _e === void 0 ? {} : _e,
1273
+ ravenPushCallback = _b.ravenPushCallback,
1274
+ ravenPageName = _b.ravenPageName,
1275
+ ravenEventName = _b.ravenEventName;
1276
+ var _f = react.useState(false),
1277
+ scrolled = _f[0],
1278
+ setScrolled = _f[1];
1071
1279
  react.useEffect(function () {
1072
1280
  var handleScroll = function () {
1073
1281
  setScrolled(window.scrollY >= 100);
@@ -1077,18 +1285,49 @@
1077
1285
  return window.removeEventListener('scroll', handleScroll);
1078
1286
  };
1079
1287
  }, []);
1080
- var effectiveNovacThemeEnabled = isNovacThemeEnabled && !scrolled;
1081
- var headerBackground = effectiveNovacThemeEnabled ? 'transparent' : '#F7FAFF';
1082
- var hoverColor = effectiveNovacThemeEnabled ? '#FFB8A5' : '#FF4F17';
1083
- var _f = useHoverDropdown({
1288
+ var theme = isNovacThemeEnabled && !scrolled ? THEME_CONFIG.NOVAC : THEME_CONFIG.DEFAULT;
1289
+ var headerBackground = theme.headerBackground,
1290
+ logoFill = theme.logoFill,
1291
+ loginButtonColorVariant = theme.loginButtonColorVariant,
1292
+ hoverColor = theme.hoverColor,
1293
+ fkcompanyColor = theme.fkcompanyColor,
1294
+ typographyColor = theme.typographyColor;
1295
+ var _g = useHoverDropdown({
1084
1296
  openDelay: 0
1085
1297
  }),
1086
- isDropdownVisible = _f.isDropdownVisible,
1087
- hoveredElemIndex = _f.hoveredElemIndex,
1088
- handleOnMouseEnter = _f.handleOnMouseEnter,
1089
- handleOnMouseLeave = _f.handleOnMouseLeave,
1090
- handleDropdownMouseEnter = _f.handleDropdownMouseEnter,
1091
- handleDropdownMouseLeave = _f.handleDropdownMouseLeave;
1298
+ isDropdownVisible = _g.isDropdownVisible,
1299
+ hoveredElemIndex = _g.hoveredElemIndex,
1300
+ handleOnMouseEnter = _g.handleOnMouseEnter,
1301
+ handleOnMouseLeave = _g.handleOnMouseLeave,
1302
+ handleDropdownMouseEnter = _g.handleDropdownMouseEnter,
1303
+ handleDropdownMouseLeave = _g.handleDropdownMouseLeave;
1304
+ var utmSource = (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic';
1305
+ var createPayload = react.useCallback(function (actionName, actionType) {
1306
+ return {
1307
+ action_name: actionName,
1308
+ action_type: actionType,
1309
+ u_utm_source: utmSource,
1310
+ loyalty_type: ravenLoyaltyTypes(loyaltyType)
1311
+ };
1312
+ }, [utmSource, loyaltyType]);
1313
+ var handleNavbarOptionsClick = react.useCallback(function (option) {
1314
+ if (option.isClickable && option.link) {
1315
+ var actionName = "".concat(option.text.toLowerCase().replace(/\s/g, ''), "_header_click");
1316
+ var payload = createPayload(actionName, 'click');
1317
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, payload, ravenPayload, ravenPushCallback, ravenPageName);
1318
+ window.location.href = option.link;
1319
+ }
1320
+ }, [createPayload, isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
1321
+ var handleHomeClick = react.useCallback(function () {
1322
+ var payload = createPayload('home_header_click', 'click');
1323
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, payload, ravenPayload, ravenPushCallback, ravenPageName);
1324
+ window.location.href = '/';
1325
+ }, [createPayload, isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
1326
+ var triggerRavenEventOnHover = react.useCallback(function (option) {
1327
+ var actionName = "".concat(option.text.toLowerCase().replace(/\s/g, ''), "_header_hover");
1328
+ var payload = createPayload(actionName, 'hover');
1329
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, payload, ravenPayload, ravenPushCallback, ravenPageName);
1330
+ }, [createPayload, isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
1092
1331
  return jsxRuntime.jsxs(jsxRuntime.Fragment, {
1093
1332
  children: [jsxRuntime.jsx(ctDesignContainer.Container, __assign({
1094
1333
  display: 'flex',
@@ -1103,7 +1342,7 @@
1103
1342
  css: {
1104
1343
  gap: '24px',
1105
1344
  flexShrink: 0,
1106
- borderBottom: effectiveNovacThemeEnabled ? '' : '1px solid #E6E6E6',
1345
+ borderBottom: headerBackground === 'transparent' ? '' : '1px solid #E6E6E6',
1107
1346
  transition: 'background-color 0.3s ease-in-out, border-bottom 0.3s ease-in-out'
1108
1347
  }
1109
1348
  }, {
@@ -1113,7 +1352,7 @@
1113
1352
  justifyContent: 'space-between',
1114
1353
  padding: '0 28px',
1115
1354
  flex: 1,
1116
- style: {
1355
+ css: {
1117
1356
  gap: '24px',
1118
1357
  maxWidth: 1440
1119
1358
  }
@@ -1124,13 +1363,10 @@
1124
1363
  alignItems: 'center',
1125
1364
  justifyContent: 'center',
1126
1365
  cursor: 'pointer',
1127
- paddingLeft: '16px',
1128
- onClick: function () {
1129
- window.location.href = '/';
1130
- }
1366
+ onClick: handleHomeClick
1131
1367
  }, {
1132
1368
  children: [jsxRuntime.jsx(ctDesignIcons.CTLogo, {
1133
- fillColor: effectiveNovacThemeEnabled ? '#FFF' : '#FF4F17'
1369
+ fillColor: logoFill
1134
1370
  }), jsxRuntime.jsx(ctDesignDivider.Divider, {
1135
1371
  css: {
1136
1372
  width: 12,
@@ -1140,7 +1376,7 @@
1140
1376
  borderBottom: '1px solid #e0e0e0'
1141
1377
  }
1142
1378
  }), jsxRuntime.jsx(ctDesignIcons.Fkcompany, {
1143
- color: effectiveNovacThemeEnabled ? '#FFF' : '#1A1A1A'
1379
+ color: fkcompanyColor
1144
1380
  })]
1145
1381
  })), jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
1146
1382
  display: 'flex',
@@ -1157,11 +1393,18 @@
1157
1393
  columnGap: '4px'
1158
1394
  }, {
1159
1395
  children: NAVBAR_OPTIONS.map(function (option, index) {
1396
+ var text = option.text,
1397
+ LeftIcon = option.lefticon,
1398
+ RightIcon = option.rightIcon,
1399
+ isHoverable = option.isHoverable;
1160
1400
  var isHovered = hoveredElemIndex === index;
1161
1401
  return jsxRuntime.jsxs(ctDesignContainer.Container, {
1162
1402
  children: [jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
1163
1403
  onMouseEnter: function () {
1164
- return handleOnMouseEnter(index);
1404
+ handleOnMouseEnter(index);
1405
+ if (option.isHoverable) {
1406
+ triggerRavenEventOnHover(option);
1407
+ }
1165
1408
  },
1166
1409
  onMouseLeave: handleOnMouseLeave,
1167
1410
  display: 'flex',
@@ -1173,13 +1416,11 @@
1173
1416
  columnGap: 8,
1174
1417
  height: '64px',
1175
1418
  onClick: function () {
1176
- if (option.link && option.isClickable) {
1177
- window.location.href = option.link;
1178
- }
1419
+ return handleNavbarOptionsClick(option);
1179
1420
  }
1180
1421
  }, {
1181
- children: [jsxRuntime.jsx(option.lefticon, {
1182
- color: isHovered ? hoverColor : effectiveNovacThemeEnabled ? '#FFF' : '#1A1A1A'
1422
+ children: [jsxRuntime.jsx(LeftIcon, {
1423
+ color: isHovered ? hoverColor : typographyColor
1183
1424
  }), jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
1184
1425
  display: 'flex',
1185
1426
  flexDirection: 'row',
@@ -1187,31 +1428,31 @@
1187
1428
  }, {
1188
1429
  children: [jsxRuntime.jsx(ctDesignTypography.Typography, __assign({
1189
1430
  variant: 'B2',
1190
- colorCode: isHovered ? hoverColor : effectiveNovacThemeEnabled ? '#FFF' : '#1A1A1A',
1431
+ colorCode: isHovered ? hoverColor : typographyColor,
1191
1432
  isClickable: true
1192
1433
  }, {
1193
- children: option.text
1194
- })), option.rightIcon && jsxRuntime.jsx(option.rightIcon, {
1434
+ children: text
1435
+ })), RightIcon && jsxRuntime.jsx(RightIcon, {
1195
1436
  width: 20,
1196
1437
  height: 20,
1197
- fill: isHovered ? hoverColor : effectiveNovacThemeEnabled ? '#FFF' : '#1A1A1A'
1438
+ fill: isHovered ? hoverColor : typographyColor
1198
1439
  })]
1199
1440
  }))]
1200
1441
  }), "nav-option-".concat(index)), jsxRuntime.jsx(HeaderAnimatedMask, __assign({
1201
- show: hoveredElemIndex === index && option.isHoverable && isDropdownVisible,
1442
+ show: hoveredElemIndex === index && isHoverable && isDropdownVisible,
1202
1443
  marginTop: '64px',
1203
1444
  handleDropdownMouseEnter: handleDropdownMouseEnter,
1204
1445
  handleDropdownMouseLeave: handleDropdownMouseLeave,
1205
1446
  onMaskClick: handleDropdownMouseLeave
1206
1447
  }, {
1207
1448
  children: jsxRuntime.jsx(BusinessDropdownContent, {
1208
- isOpen: hoveredElemIndex === index && option.isHoverable && isDropdownVisible
1449
+ isOpen: hoveredElemIndex === index && isHoverable && isDropdownVisible
1209
1450
  })
1210
1451
  }))]
1211
1452
  });
1212
1453
  })
1213
1454
  })), isUserLoggedIn && jsxRuntime.jsx(ctDesignDivider.Divider, {
1214
- style: {
1455
+ css: {
1215
1456
  width: 12,
1216
1457
  margin: '0 -18px',
1217
1458
  transform: 'rotate(90deg)',
@@ -1225,21 +1466,22 @@
1225
1466
  }, {
1226
1467
  children: jsxRuntime.jsx(UserAccount, {})
1227
1468
  })) : jsxRuntime.jsx(ctDesignButton.Button, __assign({
1228
- className: "fw-400 fs-14 ".concat(effectiveNovacThemeEnabled ? 'novac-login-button' : 'login-button'),
1469
+ variant: 'outline',
1470
+ color: loginButtonColorVariant,
1471
+ className: "".concat(headerBackground === 'transparent' ? 'novac-login-button' : 'login-button'),
1229
1472
  onClick: onLoginButtonClick,
1230
- style: {
1473
+ css: {
1231
1474
  width: 153,
1232
- height: 40,
1233
- border: effectiveNovacThemeEnabled ? '1px solid #FFF' : '1px solid #1A1A1A'
1475
+ height: 40
1234
1476
  },
1235
1477
  loading: false
1236
1478
  }, {
1237
1479
  children: jsxRuntime.jsx(ctDesignTypography.Typography, __assign({
1238
1480
  componentNode: 'span',
1239
1481
  variant: 'L2',
1240
- color: effectiveNovacThemeEnabled ? 'neutral' : 'primary'
1482
+ color: loginButtonColorVariant === ctDesignButton.ButtonColor.NEUTRAL ? 'neutral' : 'primary'
1241
1483
  }, {
1242
- children: "Login"
1484
+ children: LOG_IN_TEXT
1243
1485
  }))
1244
1486
  }))
1245
1487
  })]