@cleartrip/ct-design-header 1.2.0-SNAPSHOT-test-logo-left-padding.0 → 1.2.0-SNAPSHOT-header-0.2.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.
- package/dist/BusinessDropdown/index.d.ts.map +1 -1
- package/dist/Header.d.ts.map +1 -1
- package/dist/HeaderAnimatedMask /hooks.d.ts.map +1 -1
- package/dist/LobsHeader/index.d.ts.map +1 -1
- package/dist/RewardsSection/LoyaltyChips.d.ts.map +1 -1
- package/dist/RewardsSection/index.d.ts.map +1 -1
- package/dist/UserAccount/UserAccountDropdown.d.ts.map +1 -1
- package/dist/UserAccount/accountOptions.d.ts +1 -0
- package/dist/UserAccount/accountOptions.d.ts.map +1 -1
- package/dist/UserAccount/index.d.ts.map +1 -1
- package/dist/constants.d.ts +34 -31
- package/dist/constants.d.ts.map +1 -1
- package/dist/ct-design-header.browser.cjs.js +1 -1
- package/dist/ct-design-header.browser.cjs.js.map +1 -1
- package/dist/ct-design-header.browser.esm.js +1 -1
- package/dist/ct-design-header.browser.esm.js.map +1 -1
- package/dist/ct-design-header.cjs.js +415 -164
- package/dist/ct-design-header.cjs.js.map +1 -1
- package/dist/ct-design-header.esm.js +416 -165
- package/dist/ct-design-header.esm.js.map +1 -1
- package/dist/ct-design-header.umd.js +415 -164
- package/dist/ct-design-header.umd.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/type.d.ts +17 -1
- package/dist/type.d.ts.map +1 -1
- package/dist/utils.d.ts +8 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +8 -8
|
@@ -16,23 +16,27 @@ var SUPPORT_URL = '/support';
|
|
|
16
16
|
var NAVBAR_OPTIONS = [{
|
|
17
17
|
lefticon: ctDesignIcons.Offers,
|
|
18
18
|
text: 'Offers',
|
|
19
|
+
ravenActionName: 'offers',
|
|
19
20
|
isHoverable: false,
|
|
20
21
|
isClickable: true,
|
|
21
22
|
link: OFFERS_URL
|
|
22
23
|
}, {
|
|
23
24
|
lefticon: ctDesignIcons.BusinessBag,
|
|
24
25
|
text: 'Business',
|
|
26
|
+
ravenActionName: 'business',
|
|
25
27
|
rightIcon: ctDesignIcons.ChevronDown,
|
|
26
28
|
isHoverable: true
|
|
27
29
|
}, {
|
|
28
30
|
lefticon: ctDesignIcons.MyTrips,
|
|
29
31
|
text: 'My Trips',
|
|
32
|
+
ravenActionName: 'mytrips',
|
|
30
33
|
isHoverable: false,
|
|
31
34
|
isClickable: true,
|
|
32
35
|
link: MY_TRIPS_URL
|
|
33
36
|
}, {
|
|
34
37
|
lefticon: ctDesignIcons.SupportIcon,
|
|
35
38
|
text: 'Support',
|
|
39
|
+
ravenActionName: 'support',
|
|
36
40
|
isHoverable: false,
|
|
37
41
|
isClickable: true,
|
|
38
42
|
link: SUPPORT_URL
|
|
@@ -46,33 +50,36 @@ var LOBS = {
|
|
|
46
50
|
};
|
|
47
51
|
var LOB_DATA = [{
|
|
48
52
|
title: LOBS.FLIGHTS,
|
|
49
|
-
image: 'https://rukmini-ct.flixcart.com/f_auto,
|
|
53
|
+
image: 'https://rukmini-ct.flixcart.com/f_auto,w_32,h_32,dpr_4/offermgmt-prod/offermgmt/images/banner/Navbar_Flights.png?cache=true',
|
|
50
54
|
link: '/flights'
|
|
51
55
|
}, {
|
|
52
56
|
title: LOBS.HOTELS,
|
|
53
|
-
image: 'https://rukmini-ct.flixcart.com/f_auto,
|
|
57
|
+
image: 'https://rukmini-ct.flixcart.com/f_auto,w_32,h_32,dpr_4/offermgmt-prod/offermgmt/images/banner/Navbar_Hotels.png?cache=true',
|
|
54
58
|
link: '/hotels'
|
|
55
59
|
}, {
|
|
56
60
|
title: LOBS.BUSES,
|
|
57
|
-
image: 'https://rukmini-ct.flixcart.com/f_auto,
|
|
61
|
+
image: 'https://rukmini-ct.flixcart.com/f_auto,w_32,h_32,dpr_4/offermgmt-prod/offermgmt/images/banner/Navbar_Buses.png?cache=true',
|
|
58
62
|
link: '/bus'
|
|
59
63
|
}, {
|
|
60
64
|
title: LOBS.TRAIN,
|
|
61
|
-
image: 'https://rukmini-ct.flixcart.com/f_auto,
|
|
65
|
+
image: 'https://rukmini-ct.flixcart.com/f_auto,w_32,h_32,dpr_4/offermgmt-prod/offermgmt/images/banner/Navbar_Trains.png?cache=true',
|
|
62
66
|
link: '/pages/trains/appOnly'
|
|
63
67
|
}, {
|
|
64
68
|
title: LOBS.PACKAGES,
|
|
65
|
-
image: 'https://rukmini-ct.flixcart.com/f_auto,
|
|
69
|
+
image: 'https://rukmini-ct.flixcart.com/f_auto,w_32,h_32,dpr_4/offermgmt-prod/offermgmt/images/banner/Navbar_Packages.png?cache=true',
|
|
66
70
|
link: '/holidays'
|
|
67
71
|
}];
|
|
68
72
|
var bdConfig = [{
|
|
69
73
|
title: 'AgentBox',
|
|
70
74
|
subtitle: 'For travel agents',
|
|
71
|
-
details: 'One-stop travel solution offering the best deals to our travel agency partners'
|
|
75
|
+
details: 'One-stop travel solution offering the best deals to our travel agency partners',
|
|
76
|
+
link: 'https://agency.cleartrip.com'
|
|
72
77
|
}, {
|
|
73
78
|
title: 'OutOfOffice',
|
|
74
79
|
subtitle: 'For startups, corporates and SMEs',
|
|
75
|
-
details: 'Manage corporate business travel, smartly'
|
|
80
|
+
details: 'Manage corporate business travel, smartly',
|
|
81
|
+
link: 'https://ooo.cleartrip.com/',
|
|
82
|
+
ravenActionName: 'ooo'
|
|
76
83
|
}, {
|
|
77
84
|
title: 'MICE',
|
|
78
85
|
subtitle: 'For corporate events',
|
|
@@ -85,16 +92,35 @@ var bdConfig = [{
|
|
|
85
92
|
link: 'https://business.cleartrip.com/api-customers/more-details'
|
|
86
93
|
}];
|
|
87
94
|
var BUSINESS_DROPDOWN_HEADING = 'Other business services';
|
|
88
|
-
|
|
95
|
+
exports.RAVEN_PAGE_NAMES = void 0;
|
|
89
96
|
(function (RAVEN_PAGE_NAMES) {
|
|
90
97
|
RAVEN_PAGE_NAMES["UNIFIED_HOME"] = "unified_homepage";
|
|
91
|
-
RAVEN_PAGE_NAMES["HOTELS_HOME"] = "
|
|
92
|
-
RAVEN_PAGE_NAMES["FLIGHTS_HOME"] = "
|
|
93
|
-
})(RAVEN_PAGE_NAMES || (RAVEN_PAGE_NAMES = {}));
|
|
98
|
+
RAVEN_PAGE_NAMES["HOTELS_HOME"] = "hotel_home";
|
|
99
|
+
RAVEN_PAGE_NAMES["FLIGHTS_HOME"] = "flights_home";
|
|
100
|
+
})(exports.RAVEN_PAGE_NAMES || (exports.RAVEN_PAGE_NAMES = {}));
|
|
94
101
|
var RAVEN_PLATFORMS;
|
|
95
102
|
(function (RAVEN_PLATFORMS) {
|
|
96
103
|
RAVEN_PLATFORMS["DESKTOP"] = "desktop";
|
|
97
104
|
})(RAVEN_PLATFORMS || (RAVEN_PLATFORMS = {}));
|
|
105
|
+
var LOG_IN_TEXT = 'Log in';
|
|
106
|
+
var THEME_CONFIG = {
|
|
107
|
+
NOVAC: {
|
|
108
|
+
headerBackground: 'transparent',
|
|
109
|
+
hoverColor: '#FFB8A5',
|
|
110
|
+
logoFill: '#FFF',
|
|
111
|
+
fkcompanyColor: '#FFF',
|
|
112
|
+
typographyColor: '#FFF',
|
|
113
|
+
loginButtonColorVariant: ctDesignButton.ButtonColor.NEUTRAL
|
|
114
|
+
},
|
|
115
|
+
DEFAULT: {
|
|
116
|
+
headerBackground: '#F7FAFF',
|
|
117
|
+
hoverColor: '#FF4F17',
|
|
118
|
+
logoFill: '#FF4F17',
|
|
119
|
+
fkcompanyColor: '#1A1A1A',
|
|
120
|
+
typographyColor: '#1A1A1A',
|
|
121
|
+
loginButtonColorVariant: ctDesignButton.ButtonColor.PRIMARY
|
|
122
|
+
}
|
|
123
|
+
};
|
|
98
124
|
|
|
99
125
|
var HeaderContext = react.createContext(undefined);
|
|
100
126
|
var useHeaderContext = function () {
|
|
@@ -130,33 +156,33 @@ var LobsHeader = function () {
|
|
|
130
156
|
}
|
|
131
157
|
}, {
|
|
132
158
|
children: LOB_DATA.map(function (item, index) {
|
|
159
|
+
var title = item.title,
|
|
160
|
+
link = item.link,
|
|
161
|
+
image = item.image;
|
|
133
162
|
return jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
|
|
134
163
|
display: 'flex',
|
|
135
164
|
alignItems: 'center',
|
|
136
165
|
cursor: 'pointer',
|
|
137
166
|
css: {
|
|
138
167
|
gap: 8,
|
|
139
|
-
background: selectedLOB ===
|
|
140
|
-
borderRadius: selectedLOB ===
|
|
141
|
-
padding: selectedLOB ===
|
|
168
|
+
background: selectedLOB === title ? '#FFFFFF' : 'transparent',
|
|
169
|
+
borderRadius: selectedLOB === title ? '40px' : '0',
|
|
170
|
+
padding: selectedLOB === title ? '8px 16px 8px 8px' : '0'
|
|
142
171
|
},
|
|
143
172
|
onClick: function () {
|
|
144
|
-
window.location.href =
|
|
173
|
+
window.location.href = link;
|
|
145
174
|
}
|
|
146
175
|
}, {
|
|
147
176
|
children: [jsxRuntime.jsx("img", {
|
|
148
|
-
src:
|
|
149
|
-
alt:
|
|
177
|
+
src: image,
|
|
178
|
+
alt: title,
|
|
150
179
|
width: 32,
|
|
151
180
|
height: 32
|
|
152
181
|
}), jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({
|
|
153
|
-
variant:
|
|
154
|
-
style: {
|
|
155
|
-
fontWeight: selectedLOB === item.title ? 600 : 500
|
|
156
|
-
},
|
|
182
|
+
variant: selectedLOB === title ? ctDesignTypography.TypographyVariant.HM3 : ctDesignTypography.TypographyVariant.B1,
|
|
157
183
|
isClickable: true
|
|
158
184
|
}, {
|
|
159
|
-
children:
|
|
185
|
+
children: title
|
|
160
186
|
}))]
|
|
161
187
|
}), index);
|
|
162
188
|
})
|
|
@@ -357,11 +383,85 @@ var useDropdownAnimation = function (isOpen) {
|
|
|
357
383
|
};
|
|
358
384
|
};
|
|
359
385
|
|
|
386
|
+
var stringifyPayload = function (payload) {
|
|
387
|
+
var keys = Object.keys(payload);
|
|
388
|
+
var numericValues = [];
|
|
389
|
+
keys.forEach(function (key) {
|
|
390
|
+
if (numericValues.includes(key)) {
|
|
391
|
+
payload[key] = Number(payload[key]);
|
|
392
|
+
} else {
|
|
393
|
+
payload[key] = '' + payload[key];
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
return payload;
|
|
397
|
+
};
|
|
398
|
+
var isServer = function () {
|
|
399
|
+
return typeof window === 'undefined' || !window;
|
|
400
|
+
};
|
|
401
|
+
var getQueryParam = function (queryParam) {
|
|
402
|
+
if (isServer()) {
|
|
403
|
+
return '';
|
|
404
|
+
}
|
|
405
|
+
var urlParams = new URLSearchParams(window.location.search);
|
|
406
|
+
return urlParams.get(queryParam);
|
|
407
|
+
};
|
|
408
|
+
var ravenLoyaltyTypes = function (loyaltyType) {
|
|
409
|
+
switch (loyaltyType) {
|
|
410
|
+
case 'FkVip':
|
|
411
|
+
return 'fk_vip';
|
|
412
|
+
case 'FkPremium':
|
|
413
|
+
return 'fk_plus_premium';
|
|
414
|
+
case 'InsiderIcon':
|
|
415
|
+
return 'myntra_insidericon';
|
|
416
|
+
case 'InsiderElite':
|
|
417
|
+
return 'myntra_insiderelite';
|
|
418
|
+
default:
|
|
419
|
+
return '';
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
var ravenSDKTrigger = function (isUserLoggedIn, eventName, ravenPayload, customRavenPayload, ravenPushCallback, pageName) {
|
|
423
|
+
var _a;
|
|
424
|
+
if (typeof ravenPushCallback !== 'function') {
|
|
425
|
+
console.error('ravenPushCallback is not provided or is not a function');
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
var commonPayload = {
|
|
429
|
+
page_name: pageName,
|
|
430
|
+
platform: RAVEN_PLATFORMS.DESKTOP,
|
|
431
|
+
login_status: isUserLoggedIn ? 'yes' : 'no',
|
|
432
|
+
domain: (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.host
|
|
433
|
+
};
|
|
434
|
+
var newRavenPayload = stringifyPayload(ravenPayload);
|
|
435
|
+
var parsedCustomRavenPayload = stringifyPayload(customRavenPayload);
|
|
436
|
+
var finalPayload = tslib.__assign(tslib.__assign(tslib.__assign({}, commonPayload), newRavenPayload), parsedCustomRavenPayload);
|
|
437
|
+
try {
|
|
438
|
+
if (ravenPushCallback.length === 1) {
|
|
439
|
+
ravenPushCallback({
|
|
440
|
+
eventName: eventName,
|
|
441
|
+
eventData: finalPayload
|
|
442
|
+
});
|
|
443
|
+
} else {
|
|
444
|
+
ravenPushCallback(eventName, finalPayload);
|
|
445
|
+
}
|
|
446
|
+
} catch (err) {
|
|
447
|
+
console.error(err);
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
|
|
360
452
|
var BusinessDropdownContent = function (_a) {
|
|
361
453
|
var isOpen = _a.isOpen;
|
|
362
|
-
var _b =
|
|
363
|
-
|
|
364
|
-
|
|
454
|
+
var _b = useHeaderContext(),
|
|
455
|
+
isUserLoggedIn = _b.isUserLoggedIn,
|
|
456
|
+
ravenPushCallback = _b.ravenPushCallback,
|
|
457
|
+
ravenPageName = _b.ravenPageName,
|
|
458
|
+
ravenEventName = _b.ravenEventName,
|
|
459
|
+
loyaltyType = _b.loyaltyType,
|
|
460
|
+
_c = _b.ravenPayload,
|
|
461
|
+
ravenPayload = _c === void 0 ? {} : _c;
|
|
462
|
+
var _d = react.useState(0),
|
|
463
|
+
leftPosition = _d[0],
|
|
464
|
+
setLeftPosition = _d[1];
|
|
365
465
|
var containerRef = useDropdownAnimation(isOpen).containerRef;
|
|
366
466
|
react.useEffect(function () {
|
|
367
467
|
var updatePosition = function () {
|
|
@@ -380,6 +480,21 @@ var BusinessDropdownContent = function (_a) {
|
|
|
380
480
|
return window.removeEventListener('resize', updatePosition);
|
|
381
481
|
};
|
|
382
482
|
}, [containerRef, leftPosition]);
|
|
483
|
+
var handleBusinessDropdownClick = react.useCallback(function (link, title, ravenActionName) {
|
|
484
|
+
var _a;
|
|
485
|
+
var utmSource = (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic';
|
|
486
|
+
var actionName = ravenActionName ? "".concat(ravenActionName, "_business_click") : title ? "".concat(title.toLowerCase(), "_business_click") : '';
|
|
487
|
+
var defaultPayload = {
|
|
488
|
+
action_name: actionName,
|
|
489
|
+
action_type: 'click',
|
|
490
|
+
u_utm_source: utmSource,
|
|
491
|
+
loyalty_type: ravenLoyaltyTypes(loyaltyType)
|
|
492
|
+
};
|
|
493
|
+
if (link) {
|
|
494
|
+
ravenSDKTrigger(isUserLoggedIn, ravenEventName, defaultPayload, ravenPayload, ravenPushCallback, ravenPageName);
|
|
495
|
+
window.location.href = link;
|
|
496
|
+
}
|
|
497
|
+
}, [isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName, loyaltyType]);
|
|
383
498
|
return jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
|
|
384
499
|
ref: containerRef,
|
|
385
500
|
backgroundColor: '#fff',
|
|
@@ -400,10 +515,7 @@ var BusinessDropdownContent = function (_a) {
|
|
|
400
515
|
backgroundColor: '#FFF1EC'
|
|
401
516
|
}, {
|
|
402
517
|
children: jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({
|
|
403
|
-
variant: 'HM2'
|
|
404
|
-
css: {
|
|
405
|
-
lineHeight: '24px'
|
|
406
|
-
}
|
|
518
|
+
variant: 'HM2'
|
|
407
519
|
}, {
|
|
408
520
|
children: BUSINESS_DROPDOWN_HEADING
|
|
409
521
|
}))
|
|
@@ -417,32 +529,46 @@ var BusinessDropdownContent = function (_a) {
|
|
|
417
529
|
children: bdConfig.map(function (_a) {
|
|
418
530
|
var title = _a.title,
|
|
419
531
|
subtitle = _a.subtitle,
|
|
420
|
-
details = _a.details
|
|
532
|
+
details = _a.details,
|
|
533
|
+
link = _a.link,
|
|
534
|
+
ravenActionName = _a.ravenActionName;
|
|
421
535
|
return jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
|
|
422
536
|
cursor: 'pointer',
|
|
537
|
+
display: 'flex',
|
|
538
|
+
flexDirection: 'column',
|
|
423
539
|
width: '200px',
|
|
424
|
-
|
|
540
|
+
rowGap: '11px',
|
|
541
|
+
className: 'bd-hover-container',
|
|
542
|
+
onClick: function () {
|
|
543
|
+
return handleBusinessDropdownClick(link, title, ravenActionName);
|
|
544
|
+
}
|
|
425
545
|
}, {
|
|
426
546
|
children: [jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
|
|
427
547
|
display: 'flex',
|
|
428
|
-
flexDirection: '
|
|
429
|
-
|
|
430
|
-
columnGap: '8px'
|
|
548
|
+
flexDirection: 'column',
|
|
549
|
+
rowGap: '4px'
|
|
431
550
|
}, {
|
|
432
|
-
children: [jsxRuntime.
|
|
433
|
-
|
|
434
|
-
|
|
551
|
+
children: [jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
|
|
552
|
+
display: 'flex',
|
|
553
|
+
flexDirection: 'row',
|
|
554
|
+
alignItems: 'center',
|
|
555
|
+
columnGap: '8px'
|
|
435
556
|
}, {
|
|
436
|
-
children:
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
557
|
+
children: [jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({
|
|
558
|
+
variant: 'HM2',
|
|
559
|
+
className: 'color-orange-on-hover'
|
|
560
|
+
}, {
|
|
561
|
+
children: title
|
|
562
|
+
})), jsxRuntime.jsx(AnimatedArrow, {})]
|
|
563
|
+
})), jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({
|
|
564
|
+
variant: 'B3',
|
|
565
|
+
css: {
|
|
566
|
+
marginTop: '4px',
|
|
567
|
+
opacity: 0.75
|
|
568
|
+
}
|
|
569
|
+
}, {
|
|
570
|
+
children: subtitle
|
|
571
|
+
}))]
|
|
446
572
|
})), jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({
|
|
447
573
|
variant: 'P3',
|
|
448
574
|
color: 'subheading',
|
|
@@ -520,6 +646,7 @@ var ACCOUNT_OPTIONS_POPUP_CONFIG = [{
|
|
|
520
646
|
redirectionLink: 'accounts/personal-data-dashboard'
|
|
521
647
|
}];
|
|
522
648
|
var SIGN_OUT_TEXT = 'Logout';
|
|
649
|
+
var MY_ACCOUNT_TEXT = 'My Account';
|
|
523
650
|
var LOGGEDIN_USER_TEXT = 'You are logged in with';
|
|
524
651
|
var HEADER_ACCOUNTS_OPTIONS_OPEN_BTN_ID = 'header-acc-btn';
|
|
525
652
|
var ACCOUNT_OPTIONS_CONTAINER_ID = 'account-options';
|
|
@@ -531,13 +658,33 @@ var LoyaltyChip = function (_a) {
|
|
|
531
658
|
backgroundGradient = _a.backgroundGradient,
|
|
532
659
|
handleChipClick = _a.handleChipClick,
|
|
533
660
|
chevronFillColor = _a.chevronFillColor;
|
|
534
|
-
var _b =
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
661
|
+
var _b = useHeaderContext(),
|
|
662
|
+
loyaltyType = _b.loyaltyType,
|
|
663
|
+
isUserLoggedIn = _b.isUserLoggedIn,
|
|
664
|
+
ravenPushCallback = _b.ravenPushCallback,
|
|
665
|
+
ravenPageName = _b.ravenPageName,
|
|
666
|
+
_c = _b.ravenPayload,
|
|
667
|
+
ravenPayload = _c === void 0 ? {} : _c,
|
|
668
|
+
ravenEventName = _b.ravenEventName;
|
|
669
|
+
var _d = react.useState(false),
|
|
670
|
+
isHovered = _d[0],
|
|
671
|
+
setIsHovered = _d[1];
|
|
672
|
+
var handleClick = react.useCallback(function () {
|
|
673
|
+
var _a;
|
|
674
|
+
if (handleChipClick) {
|
|
675
|
+
handleChipClick();
|
|
676
|
+
} else {
|
|
677
|
+
var utmSource = (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic';
|
|
678
|
+
var defaultPayload = {
|
|
679
|
+
action_name: "loyalty_account_click",
|
|
680
|
+
action_type: 'click',
|
|
681
|
+
u_utm_source: utmSource,
|
|
682
|
+
loyaltyType: ravenLoyaltyTypes(loyaltyType)
|
|
683
|
+
};
|
|
684
|
+
ravenSDKTrigger(isUserLoggedIn, ravenEventName, defaultPayload, ravenPayload, ravenPushCallback, ravenPageName);
|
|
685
|
+
window.location.href = '/all-offers/loyalty-october';
|
|
686
|
+
}
|
|
687
|
+
}, [handleChipClick, loyaltyType, isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
|
|
541
688
|
return jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
|
|
542
689
|
display: 'flex',
|
|
543
690
|
position: 'relative',
|
|
@@ -562,7 +709,7 @@ var LoyaltyChip = function (_a) {
|
|
|
562
709
|
onClick: handleClick
|
|
563
710
|
}, {
|
|
564
711
|
children: [jsxRuntime.jsx(ctDesignContainer.Container, {
|
|
565
|
-
|
|
712
|
+
css: {
|
|
566
713
|
content: '""',
|
|
567
714
|
position: 'absolute',
|
|
568
715
|
inset: 0,
|
|
@@ -571,7 +718,7 @@ var LoyaltyChip = function (_a) {
|
|
|
571
718
|
zIndex: -2
|
|
572
719
|
}
|
|
573
720
|
}), jsxRuntime.jsx(ctDesignContainer.Container, {
|
|
574
|
-
|
|
721
|
+
css: {
|
|
575
722
|
content: '""',
|
|
576
723
|
position: 'absolute',
|
|
577
724
|
inset: 0,
|
|
@@ -592,7 +739,7 @@ var LoyaltyChip = function (_a) {
|
|
|
592
739
|
})), jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({
|
|
593
740
|
display: 'flex',
|
|
594
741
|
alignItems: 'center',
|
|
595
|
-
|
|
742
|
+
css: {
|
|
596
743
|
overflow: 'hidden',
|
|
597
744
|
maxWidth: isHovered ? 16 : 0,
|
|
598
745
|
transition: 'max-width 0.2s ease-in-out, opacity 0.2s ease-in-out',
|
|
@@ -657,24 +804,46 @@ var ExpandableItem = function (_a) {
|
|
|
657
804
|
handleChipClick = _a.handleChipClick,
|
|
658
805
|
value = _a.value,
|
|
659
806
|
type = _a.type;
|
|
660
|
-
var _b =
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
807
|
+
var _b = useHeaderContext(),
|
|
808
|
+
loyaltyType = _b.loyaltyType,
|
|
809
|
+
isUserLoggedIn = _b.isUserLoggedIn,
|
|
810
|
+
ravenPushCallback = _b.ravenPushCallback,
|
|
811
|
+
ravenPageName = _b.ravenPageName,
|
|
812
|
+
ravenEventName = _b.ravenEventName,
|
|
813
|
+
_c = _b.ravenPayload,
|
|
814
|
+
ravenPayload = _c === void 0 ? {} : _c;
|
|
815
|
+
var _d = react.useState(false),
|
|
816
|
+
isHovered = _d[0],
|
|
817
|
+
setIsHovered = _d[1];
|
|
818
|
+
var handleDefaultClick = react.useCallback(function () {
|
|
819
|
+
var _a;
|
|
820
|
+
if (handleChipClick) {
|
|
821
|
+
handleChipClick();
|
|
822
|
+
} else {
|
|
823
|
+
var utmSource = (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic';
|
|
824
|
+
var defaultPayload = {
|
|
825
|
+
action_name: "".concat(type, "_account_click"),
|
|
826
|
+
action_type: 'click',
|
|
827
|
+
u_utm_source: utmSource,
|
|
828
|
+
loyaltyType: ravenLoyaltyTypes(loyaltyType)
|
|
829
|
+
};
|
|
830
|
+
ravenSDKTrigger(isUserLoggedIn, ravenEventName, defaultPayload, ravenPayload, ravenPushCallback, ravenPageName);
|
|
831
|
+
var redirectUrls = {
|
|
832
|
+
supercoin: '/all-offers/supercoins/',
|
|
833
|
+
wallet: '/accounts/wallet'
|
|
834
|
+
};
|
|
835
|
+
if (redirectUrls[type]) {
|
|
836
|
+
window.location.href = redirectUrls[type];
|
|
837
|
+
}
|
|
668
838
|
}
|
|
669
|
-
|
|
670
|
-
};
|
|
839
|
+
}, [handleChipClick, type, loyaltyType, isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
|
|
671
840
|
return jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
|
|
672
841
|
display: 'flex',
|
|
673
842
|
alignItems: 'center',
|
|
674
843
|
justifyContent: 'center',
|
|
675
844
|
borderRadius: '8px',
|
|
676
845
|
cursor: 'pointer',
|
|
677
|
-
|
|
846
|
+
css: {
|
|
678
847
|
height: 32,
|
|
679
848
|
paddingLeft: 8,
|
|
680
849
|
paddingRight: isHovered ? 4 : 8,
|
|
@@ -705,7 +874,7 @@ var ExpandableItem = function (_a) {
|
|
|
705
874
|
})), jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({
|
|
706
875
|
display: 'flex',
|
|
707
876
|
alignItems: 'center',
|
|
708
|
-
|
|
877
|
+
css: {
|
|
709
878
|
overflow: 'hidden',
|
|
710
879
|
maxWidth: isHovered ? 16 : 0,
|
|
711
880
|
transition: 'max-width 0.2s ease-in-out, opacity 0.2s ease-in-out',
|
|
@@ -733,6 +902,12 @@ var RewardsSection = function () {
|
|
|
733
902
|
hideWalletChip = _b.hideWalletChip,
|
|
734
903
|
hideSupercoinsChip = _b.hideSupercoinsChip,
|
|
735
904
|
hideLoyaltyChip = _b.hideLoyaltyChip;
|
|
905
|
+
var shouldShowLoyalty = loyaltyLoading || selectedLoyaltyType && LOYALTY_DATA[selectedLoyaltyType] && !hideLoyaltyChip;
|
|
906
|
+
var shouldShowSupercoin = superCoinsLoading || !hideSupercoinsChip;
|
|
907
|
+
var shouldShowWallet = walletLoading || !hideWalletChip;
|
|
908
|
+
if (!shouldShowLoyalty && !shouldShowSupercoin && !shouldShowWallet) {
|
|
909
|
+
return null;
|
|
910
|
+
}
|
|
736
911
|
return jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
|
|
737
912
|
display: 'flex',
|
|
738
913
|
padding: '0 16px 16px 16px',
|
|
@@ -763,7 +938,7 @@ var RewardsSection = function () {
|
|
|
763
938
|
}),
|
|
764
939
|
value: superCoinBalance,
|
|
765
940
|
handleChipClick: supercoinsChipClick,
|
|
766
|
-
type: '
|
|
941
|
+
type: 'supercoin'
|
|
767
942
|
}), walletLoading ? jsxRuntime.jsx(ctDesignShimmer.Shimmer, {
|
|
768
943
|
width: '50px',
|
|
769
944
|
height: '32px',
|
|
@@ -787,34 +962,51 @@ var AccountDropdownContent = function (_a) {
|
|
|
787
962
|
userName = _b.userName,
|
|
788
963
|
userMobileNumber = _b.userMobileNumber,
|
|
789
964
|
countryCode = _b.countryCode,
|
|
790
|
-
userDetailsLoading = _b.userDetailsLoading
|
|
965
|
+
userDetailsLoading = _b.userDetailsLoading,
|
|
966
|
+
loyaltyType = _b.loyaltyType,
|
|
967
|
+
isUserLoggedIn = _b.isUserLoggedIn,
|
|
968
|
+
ravenEventName = _b.ravenEventName,
|
|
969
|
+
ravenPageName = _b.ravenPageName,
|
|
970
|
+
_c = _b.ravenPayload,
|
|
971
|
+
ravenPayload = _c === void 0 ? {} : _c,
|
|
972
|
+
ravenPushCallback = _b.ravenPushCallback;
|
|
791
973
|
var containerRef = useDropdownAnimation(isOpen).containerRef;
|
|
792
|
-
var
|
|
793
|
-
var userGreeting = userName && "Hello ".concat(userName, "!");
|
|
794
|
-
var phoneNumber = countryCode && userMobileNumber ? "".concat(countryCode, " ").concat(userMobileNumber) : '';
|
|
974
|
+
var _d = react.useMemo(function () {
|
|
795
975
|
return {
|
|
796
|
-
userGreeting:
|
|
797
|
-
phoneNumber:
|
|
976
|
+
userGreeting: userName ? "Hello ".concat(userName, "!") : '',
|
|
977
|
+
phoneNumber: countryCode && userMobileNumber ? "".concat(countryCode, " ").concat(userMobileNumber) : ''
|
|
798
978
|
};
|
|
799
979
|
}, [userName, userMobileNumber, countryCode]),
|
|
800
|
-
userGreeting =
|
|
801
|
-
phoneNumber =
|
|
802
|
-
var
|
|
803
|
-
|
|
804
|
-
|
|
980
|
+
userGreeting = _d.userGreeting,
|
|
981
|
+
phoneNumber = _d.phoneNumber;
|
|
982
|
+
var generateRavenPayload = function (actionName) {
|
|
983
|
+
var _a;
|
|
984
|
+
return {
|
|
985
|
+
action_name: actionName.toLowerCase().replace(/[\s-]/g, '') + '_account_click',
|
|
986
|
+
action_type: 'click',
|
|
987
|
+
u_utm_source: (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic',
|
|
988
|
+
loyalty_type: ravenLoyaltyTypes(loyaltyType)
|
|
805
989
|
};
|
|
806
990
|
};
|
|
807
|
-
react.
|
|
991
|
+
var handleAccountOptionsClick = react.useCallback(function (text, redirectLink) {
|
|
992
|
+
ravenSDKTrigger(isUserLoggedIn, ravenEventName, generateRavenPayload(text), ravenPayload, ravenPushCallback, ravenPageName);
|
|
993
|
+
window.location.href = redirectLink;
|
|
994
|
+
}, [isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
|
|
995
|
+
react.useCallback(function () {
|
|
996
|
+
ravenSDKTrigger(isUserLoggedIn, ravenEventName, generateRavenPayload(SIGN_OUT_TEXT), ravenPayload, ravenPushCallback, ravenPageName);
|
|
997
|
+
handleLogoutClick();
|
|
998
|
+
}, [isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName, handleLogoutClick]);
|
|
999
|
+
var positionAccountOptionsDiv = react.useCallback(function () {
|
|
808
1000
|
var headerAccBtn = document.getElementById(HEADER_ACCOUNTS_OPTIONS_OPEN_BTN_ID);
|
|
809
1001
|
var accountOptionsElem = document.getElementById(ACCOUNT_OPTIONS_CONTAINER_ID);
|
|
810
|
-
|
|
811
|
-
var headerBtnRight = headerAccBtn
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
}
|
|
815
|
-
};
|
|
816
|
-
positionAccountOptionsDiv();
|
|
1002
|
+
if (headerAccBtn && accountOptionsElem) {
|
|
1003
|
+
var headerBtnRight = headerAccBtn.getBoundingClientRect().right;
|
|
1004
|
+
accountOptionsElem.style.left = "".concat(headerBtnRight - ACCOUNT_OPTIONS_CONTAINER_WIDTH, "px");
|
|
1005
|
+
}
|
|
817
1006
|
}, []);
|
|
1007
|
+
react.useEffect(function () {
|
|
1008
|
+
positionAccountOptionsDiv();
|
|
1009
|
+
}, [positionAccountOptionsDiv]);
|
|
818
1010
|
var renderUserData = function () {
|
|
819
1011
|
var renderContent = function (loading, content, variant, color) {
|
|
820
1012
|
return jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({
|
|
@@ -859,7 +1051,7 @@ var AccountDropdownContent = function (_a) {
|
|
|
859
1051
|
}, {
|
|
860
1052
|
children: [jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({
|
|
861
1053
|
padding: '16px',
|
|
862
|
-
height: '
|
|
1054
|
+
height: '76px'
|
|
863
1055
|
}, {
|
|
864
1056
|
children: renderUserData()
|
|
865
1057
|
})), jsxRuntime.jsx(RewardsSection, {}), jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
|
|
@@ -868,7 +1060,7 @@ var AccountDropdownContent = function (_a) {
|
|
|
868
1060
|
padding: '8px',
|
|
869
1061
|
backgroundColor: 'white',
|
|
870
1062
|
rowGap: '8px',
|
|
871
|
-
|
|
1063
|
+
css: {
|
|
872
1064
|
borderBottomLeftRadius: 12,
|
|
873
1065
|
borderBottomRightRadius: 12
|
|
874
1066
|
}
|
|
@@ -882,12 +1074,14 @@ var AccountDropdownContent = function (_a) {
|
|
|
882
1074
|
padding: '8px',
|
|
883
1075
|
borderRadius: '8px',
|
|
884
1076
|
cursor: 'pointer',
|
|
885
|
-
onClick:
|
|
1077
|
+
onClick: function () {
|
|
1078
|
+
return handleAccountOptionsClick(text, redirectionLink);
|
|
1079
|
+
}
|
|
886
1080
|
}, {
|
|
887
1081
|
children: jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
|
|
888
1082
|
display: 'flex',
|
|
889
1083
|
cursor: 'pointer',
|
|
890
|
-
|
|
1084
|
+
css: {
|
|
891
1085
|
columnGap: '8px'
|
|
892
1086
|
}
|
|
893
1087
|
}, {
|
|
@@ -904,7 +1098,7 @@ var AccountDropdownContent = function (_a) {
|
|
|
904
1098
|
}))
|
|
905
1099
|
}), "account-option-".concat(text));
|
|
906
1100
|
}), jsxRuntime.jsx(ctDesignDivider.Divider, {
|
|
907
|
-
|
|
1101
|
+
css: {
|
|
908
1102
|
borderBottom: '1px dashed #E6E6E6'
|
|
909
1103
|
}
|
|
910
1104
|
}), jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
|
|
@@ -935,18 +1129,26 @@ var AccountDropdownContent = function (_a) {
|
|
|
935
1129
|
};
|
|
936
1130
|
|
|
937
1131
|
var UserAccount = function () {
|
|
938
|
-
var
|
|
939
|
-
|
|
1132
|
+
var _a = useHeaderContext(),
|
|
1133
|
+
isNovacThemeEnabled = _a.isNovacThemeEnabled,
|
|
1134
|
+
ravenEventName = _a.ravenEventName,
|
|
1135
|
+
_b = _a.ravenPayload,
|
|
1136
|
+
ravenPayload = _b === void 0 ? {} : _b,
|
|
1137
|
+
ravenPushCallback = _a.ravenPushCallback,
|
|
1138
|
+
isUserLoggedIn = _a.isUserLoggedIn,
|
|
1139
|
+
loyaltyType = _a.loyaltyType,
|
|
1140
|
+
ravenPageName = _a.ravenPageName;
|
|
1141
|
+
var _c = useHoverDropdown({
|
|
940
1142
|
openDelay: 0
|
|
941
1143
|
}),
|
|
942
|
-
isDropdownVisible =
|
|
943
|
-
handleOnMouseEnter =
|
|
944
|
-
handleOnMouseLeave =
|
|
945
|
-
handleDropdownMouseEnter =
|
|
946
|
-
handleDropdownMouseLeave =
|
|
947
|
-
var
|
|
948
|
-
scrolled =
|
|
949
|
-
setScrolled =
|
|
1144
|
+
isDropdownVisible = _c.isDropdownVisible,
|
|
1145
|
+
handleOnMouseEnter = _c.handleOnMouseEnter,
|
|
1146
|
+
handleOnMouseLeave = _c.handleOnMouseLeave,
|
|
1147
|
+
handleDropdownMouseEnter = _c.handleDropdownMouseEnter,
|
|
1148
|
+
handleDropdownMouseLeave = _c.handleDropdownMouseLeave;
|
|
1149
|
+
var _d = react.useState(false),
|
|
1150
|
+
scrolled = _d[0],
|
|
1151
|
+
setScrolled = _d[1];
|
|
950
1152
|
react.useEffect(function () {
|
|
951
1153
|
var handleScroll = function () {
|
|
952
1154
|
setScrolled(window.scrollY >= 100);
|
|
@@ -956,8 +1158,20 @@ var UserAccount = function () {
|
|
|
956
1158
|
return window.removeEventListener('scroll', handleScroll);
|
|
957
1159
|
};
|
|
958
1160
|
}, []);
|
|
959
|
-
var
|
|
960
|
-
var hoverColor =
|
|
1161
|
+
var theme = isNovacThemeEnabled && !scrolled ? THEME_CONFIG.NOVAC : THEME_CONFIG.DEFAULT;
|
|
1162
|
+
var hoverColor = theme.hoverColor,
|
|
1163
|
+
typographyColor = theme.typographyColor;
|
|
1164
|
+
var triggerRavenEventOnHover = react.useCallback(function () {
|
|
1165
|
+
var _a;
|
|
1166
|
+
var utmSource = (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic';
|
|
1167
|
+
var defaultPayload = {
|
|
1168
|
+
action_name: "".concat(MY_ACCOUNT_TEXT.toLowerCase().replace(/[\s-]/g, ''), "_header_hover"),
|
|
1169
|
+
action_type: 'hover',
|
|
1170
|
+
u_utm_source: utmSource,
|
|
1171
|
+
loyalty_type: ravenLoyaltyTypes(loyaltyType)
|
|
1172
|
+
};
|
|
1173
|
+
ravenSDKTrigger(isUserLoggedIn, ravenEventName, defaultPayload, ravenPayload, ravenPushCallback, ravenPageName);
|
|
1174
|
+
}, [isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName, loyaltyType]);
|
|
961
1175
|
return jsxRuntime.jsxs(ctDesignContainer.Container, {
|
|
962
1176
|
children: [jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
|
|
963
1177
|
display: 'flex',
|
|
@@ -966,18 +1180,19 @@ var UserAccount = function () {
|
|
|
966
1180
|
borderRadius: '12px',
|
|
967
1181
|
height: '100%',
|
|
968
1182
|
cursor: 'pointer',
|
|
969
|
-
|
|
1183
|
+
css: {
|
|
970
1184
|
columnGap: 8,
|
|
971
1185
|
height: 64
|
|
972
1186
|
},
|
|
973
1187
|
onMouseEnter: function () {
|
|
974
|
-
|
|
1188
|
+
handleOnMouseEnter(0);
|
|
1189
|
+
triggerRavenEventOnHover();
|
|
975
1190
|
},
|
|
976
1191
|
onMouseLeave: handleOnMouseLeave,
|
|
977
1192
|
id: HEADER_ACCOUNTS_OPTIONS_OPEN_BTN_ID
|
|
978
1193
|
}, {
|
|
979
1194
|
children: [jsxRuntime.jsx(ctDesignIcons.MyAccount, {
|
|
980
|
-
color: isDropdownVisible ? hoverColor :
|
|
1195
|
+
color: isDropdownVisible ? hoverColor : typographyColor
|
|
981
1196
|
}), jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
|
|
982
1197
|
display: 'flex',
|
|
983
1198
|
flexDirection: 'row',
|
|
@@ -988,13 +1203,13 @@ var UserAccount = function () {
|
|
|
988
1203
|
css: {
|
|
989
1204
|
cursor: 'pointer'
|
|
990
1205
|
},
|
|
991
|
-
colorCode: isDropdownVisible ? hoverColor :
|
|
1206
|
+
colorCode: isDropdownVisible ? hoverColor : typographyColor
|
|
992
1207
|
}, {
|
|
993
|
-
children:
|
|
1208
|
+
children: MY_ACCOUNT_TEXT
|
|
994
1209
|
})), jsxRuntime.jsx(ctDesignIcons.ChevronDown, {
|
|
995
1210
|
width: 20,
|
|
996
1211
|
height: 20,
|
|
997
|
-
fill: isDropdownVisible ? hoverColor :
|
|
1212
|
+
fill: isDropdownVisible ? hoverColor : typographyColor
|
|
998
1213
|
})]
|
|
999
1214
|
}))]
|
|
1000
1215
|
})), jsxRuntime.jsx(HeaderAnimatedMask, tslib.__assign({
|
|
@@ -1019,21 +1234,23 @@ var Header = function (props) {
|
|
|
1019
1234
|
}));
|
|
1020
1235
|
};
|
|
1021
1236
|
var HeaderContent = function () {
|
|
1022
|
-
var _a
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1237
|
+
var _a;
|
|
1238
|
+
var _b = useHeaderContext(),
|
|
1239
|
+
onLoginButtonClick = _b.onLoginButtonClick,
|
|
1240
|
+
_c = _b.showAllLobs,
|
|
1241
|
+
showAllLobs = _c === void 0 ? false : _c,
|
|
1242
|
+
isUserLoggedIn = _b.isUserLoggedIn,
|
|
1243
|
+
loyaltyType = _b.loyaltyType,
|
|
1244
|
+
_d = _b.isNovacThemeEnabled,
|
|
1245
|
+
isNovacThemeEnabled = _d === void 0 ? false : _d,
|
|
1246
|
+
_e = _b.ravenPayload,
|
|
1247
|
+
ravenPayload = _e === void 0 ? {} : _e,
|
|
1248
|
+
ravenPushCallback = _b.ravenPushCallback,
|
|
1249
|
+
ravenPageName = _b.ravenPageName,
|
|
1250
|
+
ravenEventName = _b.ravenEventName;
|
|
1251
|
+
var _f = react.useState(false),
|
|
1252
|
+
scrolled = _f[0],
|
|
1253
|
+
setScrolled = _f[1];
|
|
1037
1254
|
react.useEffect(function () {
|
|
1038
1255
|
var handleScroll = function () {
|
|
1039
1256
|
setScrolled(window.scrollY >= 100);
|
|
@@ -1043,18 +1260,49 @@ var HeaderContent = function () {
|
|
|
1043
1260
|
return window.removeEventListener('scroll', handleScroll);
|
|
1044
1261
|
};
|
|
1045
1262
|
}, []);
|
|
1046
|
-
var
|
|
1047
|
-
var headerBackground =
|
|
1048
|
-
|
|
1049
|
-
|
|
1263
|
+
var theme = isNovacThemeEnabled && !scrolled ? THEME_CONFIG.NOVAC : THEME_CONFIG.DEFAULT;
|
|
1264
|
+
var headerBackground = theme.headerBackground,
|
|
1265
|
+
logoFill = theme.logoFill,
|
|
1266
|
+
loginButtonColorVariant = theme.loginButtonColorVariant,
|
|
1267
|
+
hoverColor = theme.hoverColor,
|
|
1268
|
+
fkcompanyColor = theme.fkcompanyColor,
|
|
1269
|
+
typographyColor = theme.typographyColor;
|
|
1270
|
+
var _g = useHoverDropdown({
|
|
1050
1271
|
openDelay: 0
|
|
1051
1272
|
}),
|
|
1052
|
-
isDropdownVisible =
|
|
1053
|
-
hoveredElemIndex =
|
|
1054
|
-
handleOnMouseEnter =
|
|
1055
|
-
handleOnMouseLeave =
|
|
1056
|
-
handleDropdownMouseEnter =
|
|
1057
|
-
handleDropdownMouseLeave =
|
|
1273
|
+
isDropdownVisible = _g.isDropdownVisible,
|
|
1274
|
+
hoveredElemIndex = _g.hoveredElemIndex,
|
|
1275
|
+
handleOnMouseEnter = _g.handleOnMouseEnter,
|
|
1276
|
+
handleOnMouseLeave = _g.handleOnMouseLeave,
|
|
1277
|
+
handleDropdownMouseEnter = _g.handleDropdownMouseEnter,
|
|
1278
|
+
handleDropdownMouseLeave = _g.handleDropdownMouseLeave;
|
|
1279
|
+
var utmSource = (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic';
|
|
1280
|
+
var createPayload = react.useCallback(function (actionName, actionType) {
|
|
1281
|
+
return {
|
|
1282
|
+
action_name: actionName,
|
|
1283
|
+
action_type: actionType,
|
|
1284
|
+
u_utm_source: utmSource,
|
|
1285
|
+
loyalty_type: ravenLoyaltyTypes(loyaltyType)
|
|
1286
|
+
};
|
|
1287
|
+
}, [utmSource, loyaltyType]);
|
|
1288
|
+
var handleNavbarOptionsClick = react.useCallback(function (option) {
|
|
1289
|
+
if (option.isClickable && option.link) {
|
|
1290
|
+
var actionName = "".concat(option.text.toLowerCase().replace(/\s/g, ''), "_header_click");
|
|
1291
|
+
var payload = createPayload(actionName, 'click');
|
|
1292
|
+
ravenSDKTrigger(isUserLoggedIn, ravenEventName, payload, ravenPayload, ravenPushCallback, ravenPageName);
|
|
1293
|
+
window.location.href = option.link;
|
|
1294
|
+
}
|
|
1295
|
+
}, [createPayload, isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
|
|
1296
|
+
var handleHomeClick = react.useCallback(function () {
|
|
1297
|
+
var payload = createPayload('home_header_click', 'click');
|
|
1298
|
+
ravenSDKTrigger(isUserLoggedIn, ravenEventName, payload, ravenPayload, ravenPushCallback, ravenPageName);
|
|
1299
|
+
window.location.href = '/';
|
|
1300
|
+
}, [createPayload, isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
|
|
1301
|
+
var triggerRavenEventOnHover = react.useCallback(function (option) {
|
|
1302
|
+
var actionName = "".concat(option.text.toLowerCase().replace(/\s/g, ''), "_header_hover");
|
|
1303
|
+
var payload = createPayload(actionName, 'hover');
|
|
1304
|
+
ravenSDKTrigger(isUserLoggedIn, ravenEventName, payload, ravenPayload, ravenPushCallback, ravenPageName);
|
|
1305
|
+
}, [createPayload, isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
|
|
1058
1306
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1059
1307
|
children: [jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({
|
|
1060
1308
|
display: 'flex',
|
|
@@ -1069,7 +1317,7 @@ var HeaderContent = function () {
|
|
|
1069
1317
|
css: {
|
|
1070
1318
|
gap: '24px',
|
|
1071
1319
|
flexShrink: 0,
|
|
1072
|
-
borderBottom:
|
|
1320
|
+
borderBottom: headerBackground === 'transparent' ? '' : '1px solid #E6E6E6',
|
|
1073
1321
|
transition: 'background-color 0.3s ease-in-out, border-bottom 0.3s ease-in-out'
|
|
1074
1322
|
}
|
|
1075
1323
|
}, {
|
|
@@ -1079,7 +1327,7 @@ var HeaderContent = function () {
|
|
|
1079
1327
|
justifyContent: 'space-between',
|
|
1080
1328
|
padding: '0 28px',
|
|
1081
1329
|
flex: 1,
|
|
1082
|
-
|
|
1330
|
+
css: {
|
|
1083
1331
|
gap: '24px',
|
|
1084
1332
|
maxWidth: 1440
|
|
1085
1333
|
}
|
|
@@ -1090,13 +1338,10 @@ var HeaderContent = function () {
|
|
|
1090
1338
|
alignItems: 'center',
|
|
1091
1339
|
justifyContent: 'center',
|
|
1092
1340
|
cursor: 'pointer',
|
|
1093
|
-
|
|
1094
|
-
onClick: function () {
|
|
1095
|
-
window.location.href = '/';
|
|
1096
|
-
}
|
|
1341
|
+
onClick: handleHomeClick
|
|
1097
1342
|
}, {
|
|
1098
1343
|
children: [jsxRuntime.jsx(ctDesignIcons.CTLogo, {
|
|
1099
|
-
fillColor:
|
|
1344
|
+
fillColor: logoFill
|
|
1100
1345
|
}), jsxRuntime.jsx(ctDesignDivider.Divider, {
|
|
1101
1346
|
css: {
|
|
1102
1347
|
width: 12,
|
|
@@ -1106,7 +1351,7 @@ var HeaderContent = function () {
|
|
|
1106
1351
|
borderBottom: '1px solid #e0e0e0'
|
|
1107
1352
|
}
|
|
1108
1353
|
}), jsxRuntime.jsx(ctDesignIcons.Fkcompany, {
|
|
1109
|
-
color:
|
|
1354
|
+
color: fkcompanyColor
|
|
1110
1355
|
})]
|
|
1111
1356
|
})), jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
|
|
1112
1357
|
display: 'flex',
|
|
@@ -1123,11 +1368,18 @@ var HeaderContent = function () {
|
|
|
1123
1368
|
columnGap: '4px'
|
|
1124
1369
|
}, {
|
|
1125
1370
|
children: NAVBAR_OPTIONS.map(function (option, index) {
|
|
1371
|
+
var text = option.text,
|
|
1372
|
+
LeftIcon = option.lefticon,
|
|
1373
|
+
RightIcon = option.rightIcon,
|
|
1374
|
+
isHoverable = option.isHoverable;
|
|
1126
1375
|
var isHovered = hoveredElemIndex === index;
|
|
1127
1376
|
return jsxRuntime.jsxs(ctDesignContainer.Container, {
|
|
1128
1377
|
children: [jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
|
|
1129
1378
|
onMouseEnter: function () {
|
|
1130
|
-
|
|
1379
|
+
handleOnMouseEnter(index);
|
|
1380
|
+
if (option.isHoverable) {
|
|
1381
|
+
triggerRavenEventOnHover(option);
|
|
1382
|
+
}
|
|
1131
1383
|
},
|
|
1132
1384
|
onMouseLeave: handleOnMouseLeave,
|
|
1133
1385
|
display: 'flex',
|
|
@@ -1139,13 +1391,11 @@ var HeaderContent = function () {
|
|
|
1139
1391
|
columnGap: 8,
|
|
1140
1392
|
height: '64px',
|
|
1141
1393
|
onClick: function () {
|
|
1142
|
-
|
|
1143
|
-
window.location.href = option.link;
|
|
1144
|
-
}
|
|
1394
|
+
return handleNavbarOptionsClick(option);
|
|
1145
1395
|
}
|
|
1146
1396
|
}, {
|
|
1147
|
-
children: [jsxRuntime.jsx(
|
|
1148
|
-
color: isHovered ? hoverColor :
|
|
1397
|
+
children: [jsxRuntime.jsx(LeftIcon, {
|
|
1398
|
+
color: isHovered ? hoverColor : typographyColor
|
|
1149
1399
|
}), jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
|
|
1150
1400
|
display: 'flex',
|
|
1151
1401
|
flexDirection: 'row',
|
|
@@ -1153,31 +1403,31 @@ var HeaderContent = function () {
|
|
|
1153
1403
|
}, {
|
|
1154
1404
|
children: [jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({
|
|
1155
1405
|
variant: 'B2',
|
|
1156
|
-
colorCode: isHovered ? hoverColor :
|
|
1406
|
+
colorCode: isHovered ? hoverColor : typographyColor,
|
|
1157
1407
|
isClickable: true
|
|
1158
1408
|
}, {
|
|
1159
|
-
children:
|
|
1160
|
-
})),
|
|
1409
|
+
children: text
|
|
1410
|
+
})), RightIcon && jsxRuntime.jsx(RightIcon, {
|
|
1161
1411
|
width: 20,
|
|
1162
1412
|
height: 20,
|
|
1163
|
-
fill: isHovered ? hoverColor :
|
|
1413
|
+
fill: isHovered ? hoverColor : typographyColor
|
|
1164
1414
|
})]
|
|
1165
1415
|
}))]
|
|
1166
1416
|
}), "nav-option-".concat(index)), jsxRuntime.jsx(HeaderAnimatedMask, tslib.__assign({
|
|
1167
|
-
show: hoveredElemIndex === index &&
|
|
1417
|
+
show: hoveredElemIndex === index && isHoverable && isDropdownVisible,
|
|
1168
1418
|
marginTop: '64px',
|
|
1169
1419
|
handleDropdownMouseEnter: handleDropdownMouseEnter,
|
|
1170
1420
|
handleDropdownMouseLeave: handleDropdownMouseLeave,
|
|
1171
1421
|
onMaskClick: handleDropdownMouseLeave
|
|
1172
1422
|
}, {
|
|
1173
1423
|
children: jsxRuntime.jsx(BusinessDropdownContent, {
|
|
1174
|
-
isOpen: hoveredElemIndex === index &&
|
|
1424
|
+
isOpen: hoveredElemIndex === index && isHoverable && isDropdownVisible
|
|
1175
1425
|
})
|
|
1176
1426
|
}))]
|
|
1177
1427
|
});
|
|
1178
1428
|
})
|
|
1179
1429
|
})), isUserLoggedIn && jsxRuntime.jsx(ctDesignDivider.Divider, {
|
|
1180
|
-
|
|
1430
|
+
css: {
|
|
1181
1431
|
width: 12,
|
|
1182
1432
|
margin: '0 -18px',
|
|
1183
1433
|
transform: 'rotate(90deg)',
|
|
@@ -1191,21 +1441,22 @@ var HeaderContent = function () {
|
|
|
1191
1441
|
}, {
|
|
1192
1442
|
children: jsxRuntime.jsx(UserAccount, {})
|
|
1193
1443
|
})) : jsxRuntime.jsx(ctDesignButton.Button, tslib.__assign({
|
|
1194
|
-
|
|
1444
|
+
variant: 'outline',
|
|
1445
|
+
color: loginButtonColorVariant,
|
|
1446
|
+
className: "".concat(headerBackground === 'transparent' ? 'novac-login-button' : 'login-button'),
|
|
1195
1447
|
onClick: onLoginButtonClick,
|
|
1196
|
-
|
|
1448
|
+
css: {
|
|
1197
1449
|
width: 153,
|
|
1198
|
-
height: 40
|
|
1199
|
-
border: effectiveNovacThemeEnabled ? '1px solid #FFF' : '1px solid #1A1A1A'
|
|
1450
|
+
height: 40
|
|
1200
1451
|
},
|
|
1201
1452
|
loading: false
|
|
1202
1453
|
}, {
|
|
1203
1454
|
children: jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({
|
|
1204
1455
|
componentNode: 'span',
|
|
1205
1456
|
variant: 'L2',
|
|
1206
|
-
color:
|
|
1457
|
+
color: loginButtonColorVariant === ctDesignButton.ButtonColor.NEUTRAL ? 'neutral' : 'primary'
|
|
1207
1458
|
}, {
|
|
1208
|
-
children:
|
|
1459
|
+
children: LOG_IN_TEXT
|
|
1209
1460
|
}))
|
|
1210
1461
|
}))
|
|
1211
1462
|
})]
|