@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.
@@ -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',
@@ -799,7 +965,7 @@
799
965
  }),
800
966
  value: superCoinBalance,
801
967
  handleChipClick: supercoinsChipClick,
802
- type: 'supercoins'
968
+ type: 'supercoin'
803
969
  }), walletLoading ? jsxRuntime.jsx(ctDesignContainer.Container, {
804
970
  width: '50px',
805
971
  height: '32px',
@@ -824,34 +990,51 @@
824
990
  userName = _b.userName,
825
991
  userMobileNumber = _b.userMobileNumber,
826
992
  countryCode = _b.countryCode,
827
- userDetailsLoading = _b.userDetailsLoading;
993
+ userDetailsLoading = _b.userDetailsLoading,
994
+ loyaltyType = _b.loyaltyType,
995
+ isUserLoggedIn = _b.isUserLoggedIn,
996
+ ravenEventName = _b.ravenEventName,
997
+ ravenPageName = _b.ravenPageName,
998
+ _c = _b.ravenPayload,
999
+ ravenPayload = _c === void 0 ? {} : _c,
1000
+ ravenPushCallback = _b.ravenPushCallback;
828
1001
  var containerRef = useDropdownAnimation(isOpen).containerRef;
829
- var _c = react.useMemo(function () {
830
- var userGreeting = userName && "Hello ".concat(userName, "!");
831
- var phoneNumber = countryCode && userMobileNumber ? "".concat(countryCode, " ").concat(userMobileNumber) : '';
1002
+ var _d = react.useMemo(function () {
832
1003
  return {
833
- userGreeting: userGreeting,
834
- phoneNumber: phoneNumber
1004
+ userGreeting: userName ? "Hello ".concat(userName, "!") : '',
1005
+ phoneNumber: countryCode && userMobileNumber ? "".concat(countryCode, " ").concat(userMobileNumber) : ''
835
1006
  };
836
1007
  }, [userName, userMobileNumber, countryCode]),
837
- userGreeting = _c.userGreeting,
838
- phoneNumber = _c.phoneNumber;
839
- var handleRedirectClick = function (redirectLink) {
840
- return function () {
841
- window.location.href = redirectLink;
1008
+ userGreeting = _d.userGreeting,
1009
+ phoneNumber = _d.phoneNumber;
1010
+ var generateRavenPayload = function (actionName) {
1011
+ var _a;
1012
+ return {
1013
+ action_name: actionName.toLowerCase().replace(/[\s-]/g, '') + '_account_click',
1014
+ action_type: 'click',
1015
+ u_utm_source: (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic',
1016
+ loyalty_type: ravenLoyaltyTypes(loyaltyType)
842
1017
  };
843
1018
  };
844
- react.useEffect(function () {
1019
+ var handleAccountOptionsClick = react.useCallback(function (text, redirectLink) {
1020
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, generateRavenPayload(text), ravenPayload, ravenPushCallback, ravenPageName);
1021
+ window.location.href = redirectLink;
1022
+ }, [isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
1023
+ react.useCallback(function () {
1024
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, generateRavenPayload(SIGN_OUT_TEXT), ravenPayload, ravenPushCallback, ravenPageName);
1025
+ handleLogoutClick();
1026
+ }, [isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName, handleLogoutClick]);
1027
+ var positionAccountOptionsDiv = react.useCallback(function () {
845
1028
  var headerAccBtn = document.getElementById(HEADER_ACCOUNTS_OPTIONS_OPEN_BTN_ID);
846
1029
  var accountOptionsElem = document.getElementById(ACCOUNT_OPTIONS_CONTAINER_ID);
847
- var positionAccountOptionsDiv = function () {
848
- var headerBtnRight = headerAccBtn === null || headerAccBtn === void 0 ? void 0 : headerAccBtn.getBoundingClientRect().right;
849
- if (accountOptionsElem && headerBtnRight) {
850
- accountOptionsElem.style.left = "".concat(headerBtnRight - ACCOUNT_OPTIONS_CONTAINER_WIDTH, "px");
851
- }
852
- };
853
- positionAccountOptionsDiv();
1030
+ if (headerAccBtn && accountOptionsElem) {
1031
+ var headerBtnRight = headerAccBtn.getBoundingClientRect().right;
1032
+ accountOptionsElem.style.left = "".concat(headerBtnRight - ACCOUNT_OPTIONS_CONTAINER_WIDTH, "px");
1033
+ }
854
1034
  }, []);
1035
+ react.useEffect(function () {
1036
+ positionAccountOptionsDiv();
1037
+ }, [positionAccountOptionsDiv]);
855
1038
  var renderUserData = function () {
856
1039
  var renderContent = function (loading, content, variant, color) {
857
1040
  return jsxRuntime.jsx(ctDesignTypography.Typography, __assign({
@@ -898,7 +1081,7 @@
898
1081
  }, {
899
1082
  children: [jsxRuntime.jsx(ctDesignContainer.Container, __assign({
900
1083
  padding: '16px',
901
- height: '72px'
1084
+ height: '76px'
902
1085
  }, {
903
1086
  children: renderUserData()
904
1087
  })), jsxRuntime.jsx(RewardsSection, {}), jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
@@ -907,7 +1090,7 @@
907
1090
  padding: '8px',
908
1091
  backgroundColor: 'white',
909
1092
  rowGap: '8px',
910
- style: {
1093
+ css: {
911
1094
  borderBottomLeftRadius: 12,
912
1095
  borderBottomRightRadius: 12
913
1096
  }
@@ -921,12 +1104,14 @@
921
1104
  padding: '8px',
922
1105
  borderRadius: '8px',
923
1106
  cursor: 'pointer',
924
- onClick: handleRedirectClick(redirectionLink)
1107
+ onClick: function () {
1108
+ return handleAccountOptionsClick(text, redirectionLink);
1109
+ }
925
1110
  }, {
926
1111
  children: jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
927
1112
  display: 'flex',
928
1113
  cursor: 'pointer',
929
- style: {
1114
+ css: {
930
1115
  columnGap: '8px'
931
1116
  }
932
1117
  }, {
@@ -943,7 +1128,7 @@
943
1128
  }))
944
1129
  }), "account-option-".concat(text));
945
1130
  }), jsxRuntime.jsx(ctDesignDivider.Divider, {
946
- style: {
1131
+ css: {
947
1132
  borderBottom: '1px dashed #E6E6E6'
948
1133
  }
949
1134
  }), jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
@@ -974,18 +1159,26 @@
974
1159
  };
975
1160
 
976
1161
  var UserAccount = function () {
977
- var isNovacThemeEnabled = useHeaderContext().isNovacThemeEnabled;
978
- var _a = useHoverDropdown({
1162
+ var _a = useHeaderContext(),
1163
+ isNovacThemeEnabled = _a.isNovacThemeEnabled,
1164
+ ravenEventName = _a.ravenEventName,
1165
+ _b = _a.ravenPayload,
1166
+ ravenPayload = _b === void 0 ? {} : _b,
1167
+ ravenPushCallback = _a.ravenPushCallback,
1168
+ isUserLoggedIn = _a.isUserLoggedIn,
1169
+ loyaltyType = _a.loyaltyType,
1170
+ ravenPageName = _a.ravenPageName;
1171
+ var _c = useHoverDropdown({
979
1172
  openDelay: 0
980
1173
  }),
981
- isDropdownVisible = _a.isDropdownVisible,
982
- handleOnMouseEnter = _a.handleOnMouseEnter,
983
- handleOnMouseLeave = _a.handleOnMouseLeave,
984
- handleDropdownMouseEnter = _a.handleDropdownMouseEnter,
985
- handleDropdownMouseLeave = _a.handleDropdownMouseLeave;
986
- var _b = react.useState(false),
987
- scrolled = _b[0],
988
- setScrolled = _b[1];
1174
+ isDropdownVisible = _c.isDropdownVisible,
1175
+ handleOnMouseEnter = _c.handleOnMouseEnter,
1176
+ handleOnMouseLeave = _c.handleOnMouseLeave,
1177
+ handleDropdownMouseEnter = _c.handleDropdownMouseEnter,
1178
+ handleDropdownMouseLeave = _c.handleDropdownMouseLeave;
1179
+ var _d = react.useState(false),
1180
+ scrolled = _d[0],
1181
+ setScrolled = _d[1];
989
1182
  react.useEffect(function () {
990
1183
  var handleScroll = function () {
991
1184
  setScrolled(window.scrollY >= 100);
@@ -995,8 +1188,20 @@
995
1188
  return window.removeEventListener('scroll', handleScroll);
996
1189
  };
997
1190
  }, []);
998
- var effectiveNovacThemeEnabled = isNovacThemeEnabled && !scrolled;
999
- var hoverColor = effectiveNovacThemeEnabled ? '#FFB8A5' : '#FF4F17';
1191
+ var theme = isNovacThemeEnabled && !scrolled ? THEME_CONFIG.NOVAC : THEME_CONFIG.DEFAULT;
1192
+ var hoverColor = theme.hoverColor,
1193
+ typographyColor = theme.typographyColor;
1194
+ var triggerRavenEventOnHover = react.useCallback(function () {
1195
+ var _a;
1196
+ var utmSource = (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic';
1197
+ var defaultPayload = {
1198
+ action_name: "".concat(MY_ACCOUNT_TEXT.toLowerCase().replace(/[\s-]/g, ''), "_header_hover"),
1199
+ action_type: 'hover',
1200
+ u_utm_source: utmSource,
1201
+ loyalty_type: ravenLoyaltyTypes(loyaltyType)
1202
+ };
1203
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, defaultPayload, ravenPayload, ravenPushCallback, ravenPageName);
1204
+ }, [isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName, loyaltyType]);
1000
1205
  return jsxRuntime.jsxs(ctDesignContainer.Container, {
1001
1206
  children: [jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
1002
1207
  display: 'flex',
@@ -1005,18 +1210,19 @@
1005
1210
  borderRadius: '12px',
1006
1211
  height: '100%',
1007
1212
  cursor: 'pointer',
1008
- style: {
1213
+ css: {
1009
1214
  columnGap: 8,
1010
1215
  height: 64
1011
1216
  },
1012
1217
  onMouseEnter: function () {
1013
- return handleOnMouseEnter(0);
1218
+ handleOnMouseEnter(0);
1219
+ triggerRavenEventOnHover();
1014
1220
  },
1015
1221
  onMouseLeave: handleOnMouseLeave,
1016
1222
  id: HEADER_ACCOUNTS_OPTIONS_OPEN_BTN_ID
1017
1223
  }, {
1018
1224
  children: [jsxRuntime.jsx(ctDesignIcons.MyAccount, {
1019
- color: isDropdownVisible ? hoverColor : effectiveNovacThemeEnabled ? '#FFF' : '#1A1A1A'
1225
+ color: isDropdownVisible ? hoverColor : typographyColor
1020
1226
  }), jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
1021
1227
  display: 'flex',
1022
1228
  flexDirection: 'row',
@@ -1027,13 +1233,13 @@
1027
1233
  css: {
1028
1234
  cursor: 'pointer'
1029
1235
  },
1030
- colorCode: isDropdownVisible ? hoverColor : effectiveNovacThemeEnabled ? '#FFF' : '#1A1A1A'
1236
+ colorCode: isDropdownVisible ? hoverColor : typographyColor
1031
1237
  }, {
1032
- children: "My Account"
1238
+ children: MY_ACCOUNT_TEXT
1033
1239
  })), jsxRuntime.jsx(ctDesignIcons.ChevronDown, {
1034
1240
  width: 20,
1035
1241
  height: 20,
1036
- fill: isDropdownVisible ? hoverColor : effectiveNovacThemeEnabled ? '#FFF' : '#1A1A1A'
1242
+ fill: isDropdownVisible ? hoverColor : typographyColor
1037
1243
  })]
1038
1244
  }))]
1039
1245
  })), jsxRuntime.jsx(HeaderAnimatedMask, __assign({
@@ -1058,21 +1264,23 @@
1058
1264
  }));
1059
1265
  };
1060
1266
  var HeaderContent = function () {
1061
- var _a = useHeaderContext(),
1062
- onLoginButtonClick = _a.onLoginButtonClick,
1063
- _b = _a.showAllLobs,
1064
- showAllLobs = _b === void 0 ? false : _b,
1065
- isUserLoggedIn = _a.isUserLoggedIn;
1066
- _a.loyaltyType;
1067
- var _c = _a.isNovacThemeEnabled,
1068
- isNovacThemeEnabled = _c === void 0 ? false : _c;
1069
- _a.ravenPayload;
1070
- _a.ravenPushCallback;
1071
- _a.ravenPageName;
1072
- _a.ravenEventName;
1073
- var _e = react.useState(false),
1074
- scrolled = _e[0],
1075
- setScrolled = _e[1];
1267
+ var _a;
1268
+ var _b = useHeaderContext(),
1269
+ onLoginButtonClick = _b.onLoginButtonClick,
1270
+ _c = _b.showAllLobs,
1271
+ showAllLobs = _c === void 0 ? false : _c,
1272
+ isUserLoggedIn = _b.isUserLoggedIn,
1273
+ loyaltyType = _b.loyaltyType,
1274
+ _d = _b.isNovacThemeEnabled,
1275
+ isNovacThemeEnabled = _d === void 0 ? false : _d,
1276
+ _e = _b.ravenPayload,
1277
+ ravenPayload = _e === void 0 ? {} : _e,
1278
+ ravenPushCallback = _b.ravenPushCallback,
1279
+ ravenPageName = _b.ravenPageName,
1280
+ ravenEventName = _b.ravenEventName;
1281
+ var _f = react.useState(false),
1282
+ scrolled = _f[0],
1283
+ setScrolled = _f[1];
1076
1284
  react.useEffect(function () {
1077
1285
  var handleScroll = function () {
1078
1286
  setScrolled(window.scrollY >= 100);
@@ -1082,18 +1290,49 @@
1082
1290
  return window.removeEventListener('scroll', handleScroll);
1083
1291
  };
1084
1292
  }, []);
1085
- var effectiveNovacThemeEnabled = isNovacThemeEnabled && !scrolled;
1086
- var headerBackground = effectiveNovacThemeEnabled ? 'transparent' : '#F7FAFF';
1087
- var hoverColor = effectiveNovacThemeEnabled ? '#FFB8A5' : '#FF4F17';
1088
- var _f = useHoverDropdown({
1293
+ var theme = isNovacThemeEnabled && !scrolled ? THEME_CONFIG.NOVAC : THEME_CONFIG.DEFAULT;
1294
+ var headerBackground = theme.headerBackground,
1295
+ logoFill = theme.logoFill,
1296
+ loginButtonColorVariant = theme.loginButtonColorVariant,
1297
+ hoverColor = theme.hoverColor,
1298
+ fkcompanyColor = theme.fkcompanyColor,
1299
+ typographyColor = theme.typographyColor;
1300
+ var _g = useHoverDropdown({
1089
1301
  openDelay: 0
1090
1302
  }),
1091
- isDropdownVisible = _f.isDropdownVisible,
1092
- hoveredElemIndex = _f.hoveredElemIndex,
1093
- handleOnMouseEnter = _f.handleOnMouseEnter,
1094
- handleOnMouseLeave = _f.handleOnMouseLeave,
1095
- handleDropdownMouseEnter = _f.handleDropdownMouseEnter,
1096
- handleDropdownMouseLeave = _f.handleDropdownMouseLeave;
1303
+ isDropdownVisible = _g.isDropdownVisible,
1304
+ hoveredElemIndex = _g.hoveredElemIndex,
1305
+ handleOnMouseEnter = _g.handleOnMouseEnter,
1306
+ handleOnMouseLeave = _g.handleOnMouseLeave,
1307
+ handleDropdownMouseEnter = _g.handleDropdownMouseEnter,
1308
+ handleDropdownMouseLeave = _g.handleDropdownMouseLeave;
1309
+ var utmSource = (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic';
1310
+ var createPayload = react.useCallback(function (actionName, actionType) {
1311
+ return {
1312
+ action_name: actionName,
1313
+ action_type: actionType,
1314
+ u_utm_source: utmSource,
1315
+ loyalty_type: ravenLoyaltyTypes(loyaltyType)
1316
+ };
1317
+ }, [utmSource, loyaltyType]);
1318
+ var handleNavbarOptionsClick = react.useCallback(function (option) {
1319
+ if (option.isClickable && option.link) {
1320
+ var actionName = "".concat(option.text.toLowerCase().replace(/\s/g, ''), "_header_click");
1321
+ var payload = createPayload(actionName, 'click');
1322
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, payload, ravenPayload, ravenPushCallback, ravenPageName);
1323
+ window.location.href = option.link;
1324
+ }
1325
+ }, [createPayload, isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
1326
+ var handleHomeClick = react.useCallback(function () {
1327
+ var payload = createPayload('home_header_click', 'click');
1328
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, payload, ravenPayload, ravenPushCallback, ravenPageName);
1329
+ window.location.href = '/';
1330
+ }, [createPayload, isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
1331
+ var triggerRavenEventOnHover = react.useCallback(function (option) {
1332
+ var actionName = "".concat(option.text.toLowerCase().replace(/\s/g, ''), "_header_hover");
1333
+ var payload = createPayload(actionName, 'hover');
1334
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, payload, ravenPayload, ravenPushCallback, ravenPageName);
1335
+ }, [createPayload, isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
1097
1336
  return jsxRuntime.jsxs(jsxRuntime.Fragment, {
1098
1337
  children: [jsxRuntime.jsx(ctDesignContainer.Container, __assign({
1099
1338
  display: 'flex',
@@ -1108,7 +1347,7 @@
1108
1347
  css: {
1109
1348
  gap: '24px',
1110
1349
  flexShrink: 0,
1111
- borderBottom: effectiveNovacThemeEnabled ? '' : '1px solid #E6E6E6',
1350
+ borderBottom: headerBackground === 'transparent' ? '' : '1px solid #E6E6E6',
1112
1351
  transition: 'background-color 0.3s ease-in-out, border-bottom 0.3s ease-in-out'
1113
1352
  }
1114
1353
  }, {
@@ -1118,7 +1357,7 @@
1118
1357
  justifyContent: 'space-between',
1119
1358
  padding: '0 28px',
1120
1359
  flex: 1,
1121
- style: {
1360
+ css: {
1122
1361
  gap: '24px',
1123
1362
  maxWidth: 1440
1124
1363
  }
@@ -1129,13 +1368,10 @@
1129
1368
  alignItems: 'center',
1130
1369
  justifyContent: 'center',
1131
1370
  cursor: 'pointer',
1132
- paddingLeft: '16px',
1133
- onClick: function () {
1134
- window.location.href = '/';
1135
- }
1371
+ onClick: handleHomeClick
1136
1372
  }, {
1137
1373
  children: [jsxRuntime.jsx(ctDesignIcons.CTLogo, {
1138
- fillColor: effectiveNovacThemeEnabled ? '#FFF' : '#FF4F17'
1374
+ fillColor: logoFill
1139
1375
  }), jsxRuntime.jsx(ctDesignDivider.Divider, {
1140
1376
  css: {
1141
1377
  width: 12,
@@ -1145,7 +1381,7 @@
1145
1381
  borderBottom: '1px solid #e0e0e0'
1146
1382
  }
1147
1383
  }), jsxRuntime.jsx(ctDesignIcons.Fkcompany, {
1148
- color: effectiveNovacThemeEnabled ? '#FFF' : '#1A1A1A'
1384
+ color: fkcompanyColor
1149
1385
  })]
1150
1386
  })), jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
1151
1387
  display: 'flex',
@@ -1162,11 +1398,18 @@
1162
1398
  columnGap: '4px'
1163
1399
  }, {
1164
1400
  children: NAVBAR_OPTIONS.map(function (option, index) {
1401
+ var text = option.text,
1402
+ LeftIcon = option.lefticon,
1403
+ RightIcon = option.rightIcon,
1404
+ isHoverable = option.isHoverable;
1165
1405
  var isHovered = hoveredElemIndex === index;
1166
1406
  return jsxRuntime.jsxs(ctDesignContainer.Container, {
1167
1407
  children: [jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
1168
1408
  onMouseEnter: function () {
1169
- return handleOnMouseEnter(index);
1409
+ handleOnMouseEnter(index);
1410
+ if (option.isHoverable) {
1411
+ triggerRavenEventOnHover(option);
1412
+ }
1170
1413
  },
1171
1414
  onMouseLeave: handleOnMouseLeave,
1172
1415
  display: 'flex',
@@ -1178,13 +1421,11 @@
1178
1421
  columnGap: 8,
1179
1422
  height: '64px',
1180
1423
  onClick: function () {
1181
- if (option.link && option.isClickable) {
1182
- window.location.href = option.link;
1183
- }
1424
+ return handleNavbarOptionsClick(option);
1184
1425
  }
1185
1426
  }, {
1186
- children: [jsxRuntime.jsx(option.lefticon, {
1187
- color: isHovered ? hoverColor : effectiveNovacThemeEnabled ? '#FFF' : '#1A1A1A'
1427
+ children: [jsxRuntime.jsx(LeftIcon, {
1428
+ color: isHovered ? hoverColor : typographyColor
1188
1429
  }), jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
1189
1430
  display: 'flex',
1190
1431
  flexDirection: 'row',
@@ -1192,31 +1433,31 @@
1192
1433
  }, {
1193
1434
  children: [jsxRuntime.jsx(ctDesignTypography.Typography, __assign({
1194
1435
  variant: 'B2',
1195
- colorCode: isHovered ? hoverColor : effectiveNovacThemeEnabled ? '#FFF' : '#1A1A1A',
1436
+ colorCode: isHovered ? hoverColor : typographyColor,
1196
1437
  isClickable: true
1197
1438
  }, {
1198
- children: option.text
1199
- })), option.rightIcon && jsxRuntime.jsx(option.rightIcon, {
1439
+ children: text
1440
+ })), RightIcon && jsxRuntime.jsx(RightIcon, {
1200
1441
  width: 20,
1201
1442
  height: 20,
1202
- fill: isHovered ? hoverColor : effectiveNovacThemeEnabled ? '#FFF' : '#1A1A1A'
1443
+ fill: isHovered ? hoverColor : typographyColor
1203
1444
  })]
1204
1445
  }))]
1205
1446
  }), "nav-option-".concat(index)), jsxRuntime.jsx(HeaderAnimatedMask, __assign({
1206
- show: hoveredElemIndex === index && option.isHoverable && isDropdownVisible,
1447
+ show: hoveredElemIndex === index && isHoverable && isDropdownVisible,
1207
1448
  marginTop: '64px',
1208
1449
  handleDropdownMouseEnter: handleDropdownMouseEnter,
1209
1450
  handleDropdownMouseLeave: handleDropdownMouseLeave,
1210
1451
  onMaskClick: handleDropdownMouseLeave
1211
1452
  }, {
1212
1453
  children: jsxRuntime.jsx(BusinessDropdownContent, {
1213
- isOpen: hoveredElemIndex === index && option.isHoverable && isDropdownVisible
1454
+ isOpen: hoveredElemIndex === index && isHoverable && isDropdownVisible
1214
1455
  })
1215
1456
  }))]
1216
1457
  });
1217
1458
  })
1218
1459
  })), isUserLoggedIn && jsxRuntime.jsx(ctDesignDivider.Divider, {
1219
- style: {
1460
+ css: {
1220
1461
  width: 12,
1221
1462
  margin: '0 -18px',
1222
1463
  transform: 'rotate(90deg)',
@@ -1230,21 +1471,22 @@
1230
1471
  }, {
1231
1472
  children: jsxRuntime.jsx(UserAccount, {})
1232
1473
  })) : jsxRuntime.jsx(ctDesignButton.Button, __assign({
1233
- className: "fw-400 fs-14 ".concat(effectiveNovacThemeEnabled ? 'novac-login-button' : 'login-button'),
1474
+ variant: 'outline',
1475
+ color: loginButtonColorVariant,
1476
+ className: "".concat(headerBackground === 'transparent' ? 'novac-login-button' : 'login-button'),
1234
1477
  onClick: onLoginButtonClick,
1235
- style: {
1478
+ css: {
1236
1479
  width: 153,
1237
- height: 40,
1238
- border: effectiveNovacThemeEnabled ? '1px solid #FFF' : '1px solid #1A1A1A'
1480
+ height: 40
1239
1481
  },
1240
1482
  loading: false
1241
1483
  }, {
1242
1484
  children: jsxRuntime.jsx(ctDesignTypography.Typography, __assign({
1243
1485
  componentNode: 'span',
1244
1486
  variant: 'L2',
1245
- color: effectiveNovacThemeEnabled ? 'neutral' : 'primary'
1487
+ color: loginButtonColorVariant === ctDesignButton.ButtonColor.NEUTRAL ? 'neutral' : 'primary'
1246
1488
  }, {
1247
- children: "Login"
1489
+ children: LOG_IN_TEXT
1248
1490
  }))
1249
1491
  }))
1250
1492
  })]