@cleartrip/ct-design-header 1.2.0-SNAPSHOT-rnwStable4Dec25v3.0 → 1.2.0-SNAPSHOT-041225.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.
@@ -6,537 +6,718 @@ import { Typography, TypographyVariant } from '@cleartrip/ct-design-typography';
6
6
  import { ButtonColor, Button, ButtonVariant } from '@cleartrip/ct-design-button';
7
7
  import { Divider } from '@cleartrip/ct-design-divider';
8
8
  import { Offers, BusinessBag, ChevronDown, MyTrips, SupportIcon, ArrowRight, MyAccount, SavedCard, Travellers, HiFive, Wallet, SettingsCog, PrivacyRights, HeaderChevronRight, FkBlackIcon, FkGold, InsiderIcon, InsiderElite, CtLoyalty, Supercoin, Signout, CTLogo, Fkcompany } from '@cleartrip/ct-design-icons';
9
- import styled from '@emotion/styled';
10
- import { keyframes } from '@emotion/react';
9
+ import styled, { keyframes } from 'styled-components';
11
10
 
12
11
  var OFFERS_URL = 'all-offers/?categories=flights';
13
12
  var MY_TRIPS_URL = '/account/trips';
14
13
  var SUPPORT_URL = '/support';
15
- var NAVBAR_OPTIONS = [
16
- {
17
- lefticon: Offers,
18
- text: 'Offers',
19
- ravenActionName: 'offers',
20
- isHoverable: false,
21
- isClickable: true,
22
- link: OFFERS_URL,
23
- },
24
- {
25
- lefticon: BusinessBag,
26
- text: 'Business',
27
- ravenActionName: 'business',
28
- rightIcon: ChevronDown,
29
- isHoverable: true,
30
- },
31
- {
32
- lefticon: MyTrips,
33
- text: 'My Trips',
34
- ravenActionName: 'mytrips',
35
- isHoverable: false,
36
- isClickable: true,
37
- link: MY_TRIPS_URL,
38
- },
39
- {
40
- lefticon: SupportIcon,
41
- text: 'Support',
42
- ravenActionName: 'support',
43
- isHoverable: false,
44
- isClickable: true,
45
- link: SUPPORT_URL,
46
- },
47
- ];
14
+ var NAVBAR_OPTIONS = [{
15
+ lefticon: Offers,
16
+ text: 'Offers',
17
+ ravenActionName: 'offers',
18
+ isHoverable: false,
19
+ isClickable: true,
20
+ link: OFFERS_URL
21
+ }, {
22
+ lefticon: BusinessBag,
23
+ text: 'Business',
24
+ ravenActionName: 'business',
25
+ rightIcon: ChevronDown,
26
+ isHoverable: true
27
+ }, {
28
+ lefticon: MyTrips,
29
+ text: 'My Trips',
30
+ ravenActionName: 'mytrips',
31
+ isHoverable: false,
32
+ isClickable: true,
33
+ link: MY_TRIPS_URL
34
+ }, {
35
+ lefticon: SupportIcon,
36
+ text: 'Support',
37
+ ravenActionName: 'support',
38
+ isHoverable: false,
39
+ isClickable: true,
40
+ link: SUPPORT_URL
41
+ }];
48
42
  var LOBS = {
49
- FLIGHTS: 'Flights',
50
- HOTELS: 'Hotels',
51
- TRAIN: 'Trains',
52
- PACKAGES: 'Packages',
53
- BUSES: 'Buses',
43
+ FLIGHTS: 'Flights',
44
+ HOTELS: 'Hotels',
45
+ TRAIN: 'Trains',
46
+ HOLIDAYS: 'Holidays',
47
+ BUSES: 'Buses'
54
48
  };
55
- var LOB_DATA = [
56
- {
57
- title: LOBS.FLIGHTS,
58
- image: 'https://rukmini-ct.flixcart.com/f_auto,w_32,h_32,dpr_4/offermgmt-prod/offermgmt/images/banner/Navbar_Flights.png?cache=true',
59
- link: '/flights',
60
- },
61
- {
62
- title: LOBS.HOTELS,
63
- image: 'https://rukmini-ct.flixcart.com/f_auto,w_32,h_32,dpr_4/offermgmt-prod/offermgmt/images/banner/Navbar_Hotels.png?cache=true',
64
- link: '/hotels',
65
- },
66
- {
67
- title: LOBS.BUSES,
68
- image: 'https://rukmini-ct.flixcart.com/f_auto,w_32,h_32,dpr_4/offermgmt-prod/offermgmt/images/banner/Navbar_Buses.png?cache=true',
69
- link: '/bus',
70
- },
71
- {
72
- title: LOBS.PACKAGES,
73
- image: 'https://rukmini-ct.flixcart.com/f_auto,w_32,h_32,dpr_4/offermgmt-prod/offermgmt/images/banner/Navbar_Packages.png?cache=true',
74
- link: '/holidays',
75
- },
76
- ];
77
- var bdConfig = [
78
- {
79
- title: 'AgentBox',
80
- subtitle: 'For travel agents',
81
- details: 'One-stop travel solution offering the best deals to our travel agency partners',
82
- link: 'https://agency.cleartrip.com',
83
- },
84
- {
85
- title: 'OutOfOffice',
86
- subtitle: 'For startups, corporates and SMEs',
87
- details: 'Manage corporate business travel, smartly',
88
- link: 'https://ooo.cleartrip.com/',
89
- ravenActionName: 'ooo',
90
- },
91
- {
92
- title: 'MICE',
93
- subtitle: 'For corporate events',
94
- details: 'An end-to-end management solution for all your corporate events',
95
- link: 'https://business.cleartrip.com/',
96
- },
97
- {
98
- title: 'API',
99
- subtitle: 'For developers',
100
- details: 'Unlock seamless integration and scale with our powerful, reliable APIs',
101
- link: 'https://business.cleartrip.com/api-customers/more-details',
102
- },
103
- ];
49
+ var LOB_DATA = [{
50
+ title: LOBS.FLIGHTS,
51
+ image: 'https://rukmini-ct.flixcart.com/f_auto,w_32,h_32,dpr_4/offermgmt-prod/offermgmt/images/banner/Navbar_Flights.png?cache=true',
52
+ link: '/flights'
53
+ }, {
54
+ title: LOBS.HOTELS,
55
+ image: 'https://rukmini-ct.flixcart.com/f_auto,w_32,h_32,dpr_4/offermgmt-prod/offermgmt/images/banner/Navbar_Hotels.png?cache=true',
56
+ link: '/hotels'
57
+ }, {
58
+ title: LOBS.BUSES,
59
+ image: 'https://rukmini-ct.flixcart.com/f_auto,w_32,h_32,dpr_4/offermgmt-prod/offermgmt/images/banner/Navbar_Buses.png?cache=true',
60
+ link: '/bus'
61
+ }, {
62
+ title: LOBS.HOLIDAYS,
63
+ image: 'https://rukmini-ct.flixcart.com/f_auto,w_32,h_32,dpr_4/offermgmt-prod/offermgmt/images/banner/Navbar_Packages.png?cache=true',
64
+ link: '/holidays'
65
+ }];
66
+ var bdConfig = [{
67
+ title: 'AgentBox',
68
+ subtitle: 'For travel agents',
69
+ details: 'One-stop travel solution offering the best deals to our travel agency partners',
70
+ link: 'https://agency.cleartrip.com'
71
+ }, {
72
+ title: 'OutOfOffice',
73
+ subtitle: 'For startups, corporates and SMEs',
74
+ details: 'Manage corporate business travel, smartly',
75
+ link: 'https://ooo.cleartrip.com/',
76
+ ravenActionName: 'ooo'
77
+ }, {
78
+ title: 'MICE',
79
+ subtitle: 'For corporate events',
80
+ details: 'An end-to-end management solution for all your corporate events',
81
+ link: 'https://business.cleartrip.com/'
82
+ }, {
83
+ title: 'API',
84
+ subtitle: 'For developers',
85
+ details: 'Unlock seamless integration and scale with our powerful, reliable APIs',
86
+ link: 'https://business.cleartrip.com/api-customers/more-details'
87
+ }];
104
88
  var BUSINESS_DROPDOWN_HEADING = 'Other business services';
105
89
  var RAVEN_PAGE_NAMES;
106
90
  (function (RAVEN_PAGE_NAMES) {
107
- RAVEN_PAGE_NAMES["UNIFIED_HOME"] = "unified_homepage";
108
- RAVEN_PAGE_NAMES["HOTELS_HOME"] = "hotel_home";
109
- RAVEN_PAGE_NAMES["FLIGHTS_HOME"] = "flights_home";
91
+ RAVEN_PAGE_NAMES["UNIFIED_HOME"] = "unified_homepage";
92
+ RAVEN_PAGE_NAMES["HOTELS_HOME"] = "hotel_home";
93
+ RAVEN_PAGE_NAMES["FLIGHTS_HOME"] = "flights_home";
110
94
  })(RAVEN_PAGE_NAMES || (RAVEN_PAGE_NAMES = {}));
111
95
  var RAVEN_PLATFORMS;
112
96
  (function (RAVEN_PLATFORMS) {
113
- RAVEN_PLATFORMS["DESKTOP"] = "desktop";
97
+ RAVEN_PLATFORMS["DESKTOP"] = "desktop";
114
98
  })(RAVEN_PLATFORMS || (RAVEN_PLATFORMS = {}));
115
99
  var LOG_IN_TEXT = 'Log in';
116
100
  var THEME_CONFIG = {
117
- NOVAC: {
118
- headerBackground: 'transparent',
119
- hoverColor: '#FDBA12',
120
- logoFill: '#FFF',
121
- fkcompanyColor: '#FFF',
122
- typographyColor: '#FFF',
123
- loginButtonColorVariant: ButtonColor.NEUTRAL,
124
- },
125
- DEFAULT: {
126
- headerBackground: '#FFFFFF',
127
- hoverColor: '#FF4F17',
128
- logoFill: '#FF4F17',
129
- fkcompanyColor: '#1A1A1A',
130
- typographyColor: '#1A1A1A',
131
- loginButtonColorVariant: ButtonColor.PRIMARY,
132
- },
101
+ NOVAC: {
102
+ headerBackground: 'transparent',
103
+ hoverColor: '#FDBA12',
104
+ logoFill: '#FFF',
105
+ fkcompanyColor: '#FFF',
106
+ typographyColor: '#FFF',
107
+ loginButtonColorVariant: ButtonColor.NEUTRAL
108
+ },
109
+ DEFAULT: {
110
+ headerBackground: '#FFFFFF',
111
+ hoverColor: '#FF4F17',
112
+ logoFill: '#FF4F17',
113
+ fkcompanyColor: '#1A1A1A',
114
+ typographyColor: '#1A1A1A',
115
+ loginButtonColorVariant: ButtonColor.PRIMARY
116
+ }
133
117
  };
134
118
 
135
119
  var HeaderContext = createContext(undefined);
136
120
  var useHeaderContext = function () {
137
- var context = useContext(HeaderContext);
138
- if (!context) {
139
- throw new Error('useHeaderContext must be used within a HeaderProvider');
140
- }
141
- return context;
121
+ var context = useContext(HeaderContext);
122
+ if (!context) {
123
+ throw new Error('useHeaderContext must be used within a HeaderProvider');
124
+ }
125
+ return context;
142
126
  };
143
127
  var HeaderProvider = function (_a) {
144
- var value = _a.value, children = _a.children;
145
- return jsx(HeaderContext.Provider, __assign({ value: value }, { children: children }));
128
+ var value = _a.value,
129
+ children = _a.children;
130
+ return jsx(HeaderContext.Provider, __assign({
131
+ value: value
132
+ }, {
133
+ children: children
134
+ }));
135
+ };
136
+
137
+ var stringifyPayload = function (payload) {
138
+ var keys = Object.keys(payload);
139
+ var numericValues = [];
140
+ keys.forEach(function (key) {
141
+ if (numericValues.includes(key)) {
142
+ payload[key] = Number(payload[key]);
143
+ } else {
144
+ payload[key] = '' + payload[key];
145
+ }
146
+ });
147
+ return payload;
148
+ };
149
+ var isServer = function () {
150
+ return typeof window === 'undefined' || !window;
151
+ };
152
+ var getQueryParam = function (queryParam) {
153
+ if (isServer()) {
154
+ return '';
155
+ }
156
+ var urlParams = new URLSearchParams(window.location.search);
157
+ return urlParams.get(queryParam);
158
+ };
159
+ var ravenLoyaltyTypes = function (loyaltyType) {
160
+ switch (loyaltyType) {
161
+ case 'FkVip':
162
+ return 'fk_vip';
163
+ case 'FkPremium':
164
+ return 'fk_plus_premium';
165
+ case 'InsiderIcon':
166
+ return 'myntra_insidericon';
167
+ case 'InsiderElite':
168
+ return 'myntra_insiderelite';
169
+ default:
170
+ return '';
171
+ }
172
+ };
173
+ var ravenSDKTrigger = function (isUserLoggedIn, eventName, ravenPayload, customRavenPayload, ravenPushCallback, pageName) {
174
+ var _a;
175
+ if (typeof ravenPushCallback !== 'function') {
176
+ console.error('ravenPushCallback is not provided or is not a function');
177
+ return;
178
+ }
179
+ var commonPayload = {
180
+ page_name: pageName,
181
+ platform: RAVEN_PLATFORMS.DESKTOP,
182
+ login_status: isUserLoggedIn ? 'yes' : 'no',
183
+ domain: (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.hostname
184
+ };
185
+ var newRavenPayload = stringifyPayload(ravenPayload);
186
+ var parsedCustomRavenPayload = stringifyPayload(customRavenPayload);
187
+ var finalPayload = __assign(__assign(__assign({}, commonPayload), newRavenPayload), parsedCustomRavenPayload);
188
+ try {
189
+ if (ravenPushCallback.length === 1) {
190
+ ravenPushCallback({
191
+ eventName: eventName,
192
+ eventData: finalPayload
193
+ });
194
+ } else {
195
+ ravenPushCallback(eventName, finalPayload);
196
+ }
197
+ } catch (err) {
198
+ console.error(err);
199
+ return;
200
+ }
146
201
  };
147
202
 
148
203
  var LobsHeader = function () {
149
- var selectedLOB = useHeaderContext().selectedLOB;
150
- return (jsx(Container, __assign({ display: 'flex', alignItems: 'center', justifyContent: 'center', padding: '16px', background: '#F7FAFF', top: '64px', zIndex: 2, css: {
151
- gap: 24,
152
- } }, { children: LOB_DATA.map(function (item, index) {
153
- var title = item.title, link = item.link, image = item.image;
154
- var isSelected = selectedLOB === title;
155
- return (jsx("a", __assign({ href: isSelected ? undefined : link, style: { textDecoration: 'none', pointerEvents: isSelected ? 'none' : 'auto' } }, { children: jsxs(Container, __assign({ display: 'flex', alignItems: 'center', width: '116px', height: '48px', justifyContent: 'center', cursor: 'pointer', css: {
156
- gap: 8,
157
- background: isSelected ? '#FFFFFF' : 'transparent',
158
- border: isSelected ? '1px solid #E6E6E6' : '',
159
- borderRadius: '40px',
160
- padding: '8px 16px 8px 8px',
161
- transition: 'background 0.2s ease',
162
- } }, { children: [jsx("img", { src: image, alt: title, width: 32, height: 32 }), jsx(Typography, __assign({ variant: isSelected ? TypographyVariant.HM3 : TypographyVariant.B1, isClickable: true }, { children: title }))] }), index) })));
163
- }) })));
204
+ var _a = useHeaderContext(),
205
+ selectedLOB = _a.selectedLOB,
206
+ isUserLoggedIn = _a.isUserLoggedIn,
207
+ ravenEventName = _a.ravenEventName,
208
+ ravenPageName = _a.ravenPageName,
209
+ _b = _a.ravenPayload,
210
+ ravenPayload = _b === void 0 ? {} : _b,
211
+ ravenPushCallback = _a.ravenPushCallback;
212
+ var handleClick = function (title, isSelected) {
213
+ if (!isSelected) {
214
+ var payload = {
215
+ action_name: "".concat(title.toLowerCase(), "_tab_click"),
216
+ action_type: 'click'
217
+ };
218
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, payload, ravenPayload, ravenPushCallback, ravenPageName);
219
+ }
220
+ };
221
+ return jsx(Container, __assign({
222
+ display: 'flex',
223
+ alignItems: 'center',
224
+ justifyContent: 'center',
225
+ padding: '16px',
226
+ background: '#F7FAFF',
227
+ top: '64px',
228
+ zIndex: 2,
229
+ css: {
230
+ gap: 24
231
+ }
232
+ }, {
233
+ children: LOB_DATA.map(function (item, index) {
234
+ var title = item.title,
235
+ link = item.link,
236
+ image = item.image;
237
+ var isSelected = selectedLOB === title;
238
+ return jsx("a", __assign({
239
+ href: isSelected ? undefined : link,
240
+ style: {
241
+ textDecoration: 'none',
242
+ pointerEvents: isSelected ? 'none' : 'auto'
243
+ },
244
+ onClick: function () {
245
+ return handleClick(title, isSelected);
246
+ }
247
+ }, {
248
+ children: jsxs(Container, __assign({
249
+ display: 'flex',
250
+ alignItems: 'center',
251
+ width: '116px',
252
+ height: '48px',
253
+ justifyContent: 'center',
254
+ cursor: 'pointer',
255
+ css: {
256
+ gap: 8,
257
+ background: isSelected ? '#FFFFFF' : 'transparent',
258
+ border: isSelected ? '1px solid #E6E6E6' : '',
259
+ borderRadius: '40px',
260
+ padding: '8px 16px 8px 8px',
261
+ transition: 'background 0.2s ease'
262
+ }
263
+ }, {
264
+ children: [jsx("img", {
265
+ src: image,
266
+ alt: title,
267
+ width: 32,
268
+ height: 32
269
+ }), jsx(Typography, __assign({
270
+ variant: isSelected ? TypographyVariant.HM3 : TypographyVariant.B1,
271
+ isClickable: true
272
+ }, {
273
+ children: title
274
+ }))]
275
+ }))
276
+ }), index);
277
+ })
278
+ }));
164
279
  };
165
280
 
166
281
  var useDelayedUnmount = function (show, unmountDelay) {
167
- var _a = useState(show), showComponent = _a[0], setShowComponent = _a[1];
168
- var timerRef = useRef();
169
- useEffect(function () {
170
- if (!show) {
171
- timerRef.current = setTimeout(function () {
172
- setShowComponent(false);
173
- }, unmountDelay);
174
- }
175
- else {
176
- setShowComponent(show);
177
- }
178
- return function () {
179
- (timerRef === null || timerRef === void 0 ? void 0 : timerRef.current) && clearTimeout(timerRef.current);
180
- };
181
- }, [show]);
182
- return showComponent;
282
+ var _a = useState(show),
283
+ showComponent = _a[0],
284
+ setShowComponent = _a[1];
285
+ var timerRef = useRef();
286
+ useEffect(function () {
287
+ if (!show) {
288
+ timerRef.current = setTimeout(function () {
289
+ setShowComponent(false);
290
+ }, unmountDelay);
291
+ } else {
292
+ setShowComponent(show);
293
+ }
294
+ return function () {
295
+ (timerRef === null || timerRef === void 0 ? void 0 : timerRef.current) && clearTimeout(timerRef.current);
296
+ };
297
+ }, [show]);
298
+ return showComponent;
183
299
  };
184
300
  var useMountTransition = function (isMounted, unmountDelay) {
185
- var _a = useState(false), hasTransitionedIn = _a[0], setHasTransitionedIn = _a[1];
186
- var timeoutIdRef = useRef();
187
- useEffect(function () {
188
- if (isMounted && !hasTransitionedIn) {
189
- setTimeout(function () {
190
- setHasTransitionedIn(true);
191
- }, 0);
192
- }
193
- else if (!isMounted && hasTransitionedIn) {
194
- timeoutIdRef.current = setTimeout(function () { return setHasTransitionedIn(false); }, unmountDelay);
195
- }
196
- return function () {
197
- if (timeoutIdRef && timeoutIdRef.current) {
198
- clearTimeout(timeoutIdRef.current);
199
- }
200
- };
201
- }, [unmountDelay, isMounted]);
202
- return hasTransitionedIn;
301
+ var _a = useState(false),
302
+ hasTransitionedIn = _a[0],
303
+ setHasTransitionedIn = _a[1];
304
+ var timeoutIdRef = useRef();
305
+ useEffect(function () {
306
+ if (isMounted && !hasTransitionedIn) {
307
+ setTimeout(function () {
308
+ setHasTransitionedIn(true);
309
+ }, 0);
310
+ } else if (!isMounted && hasTransitionedIn) {
311
+ timeoutIdRef.current = setTimeout(function () {
312
+ return setHasTransitionedIn(false);
313
+ }, unmountDelay);
314
+ }
315
+ return function () {
316
+ if (timeoutIdRef && timeoutIdRef.current) {
317
+ clearTimeout(timeoutIdRef.current);
318
+ }
319
+ };
320
+ }, [unmountDelay, isMounted]);
321
+ return hasTransitionedIn;
203
322
  };
204
323
 
205
324
  function HeaderAnimatedMask(_a) {
206
- var children = _a.children, onMaskClick = _a.onMaskClick, show = _a.show, marginTop = _a.marginTop, handleDropdownMouseEnter = _a.handleDropdownMouseEnter, handleDropdownMouseLeave = _a.handleDropdownMouseLeave;
207
- useEffect(function () {
208
- if (show) {
209
- document.body.style.overflow = 'hidden';
210
- }
211
- return function () {
212
- document.body.style.overflow = 'initial';
213
- };
214
- }, [show]);
215
- var showFlagProxy = useDelayedUnmount(show, 300);
216
- var triggerTransition = useMountTransition(show, 100);
217
- var triggerOpenTransition = triggerTransition;
218
- return (jsxs(Fragment, { children: [showFlagProxy && (jsx(Container, { id: 'mask-container', css: {
219
- position: 'fixed',
220
- backgroundColor: '#000',
221
- opacity: triggerOpenTransition ? 0.4 : 0,
222
- width: '100%',
223
- height: '100vh',
224
- left: 0,
225
- top: marginTop || 0,
226
- zIndex: 9,
227
- transition: 'opacity 300ms ease-in',
228
- }, onClick: onMaskClick })), showFlagProxy && (jsx(Container, __assign({ onMouseEnter: handleDropdownMouseEnter, onMouseLeave: handleDropdownMouseLeave }, { children: children })))] }));
325
+ var children = _a.children,
326
+ onMaskClick = _a.onMaskClick,
327
+ show = _a.show,
328
+ marginTop = _a.marginTop,
329
+ handleDropdownMouseEnter = _a.handleDropdownMouseEnter,
330
+ handleDropdownMouseLeave = _a.handleDropdownMouseLeave;
331
+ useEffect(function () {
332
+ if (show) {
333
+ document.body.style.overflow = 'hidden';
334
+ }
335
+ return function () {
336
+ document.body.style.overflow = 'initial';
337
+ };
338
+ }, [show]);
339
+ var showFlagProxy = useDelayedUnmount(show, 300);
340
+ var triggerTransition = useMountTransition(show, 100);
341
+ var triggerOpenTransition = triggerTransition;
342
+ return jsxs(Fragment, {
343
+ children: [showFlagProxy && jsx(Container, {
344
+ id: 'mask-container',
345
+ css: {
346
+ position: 'fixed',
347
+ backgroundColor: '#000',
348
+ opacity: triggerOpenTransition ? 0.4 : 0,
349
+ width: '100%',
350
+ height: '100vh',
351
+ left: 0,
352
+ top: marginTop || 0,
353
+ zIndex: 9,
354
+ transition: 'opacity 300ms ease-in'
355
+ },
356
+ onClick: onMaskClick
357
+ }), showFlagProxy && jsx(Container, __assign({
358
+ onMouseEnter: handleDropdownMouseEnter,
359
+ onMouseLeave: handleDropdownMouseLeave
360
+ }, {
361
+ children: children
362
+ }))]
363
+ });
229
364
  }
230
365
 
231
366
  var MIN_CLOSE_DELAY = 150;
232
367
  var useHoverDropdown = function (_a) {
233
- var _b = _a === void 0 ? {} : _a, _c = _b.closeDelay, closeDelayArg = _c === void 0 ? 0 : _c, _d = _b.openDelay, openDelay = _d === void 0 ? 500 : _d;
234
- var closeDelay = Math.max(closeDelayArg, MIN_CLOSE_DELAY);
235
- var _e = useState(false), isDropdownVisible = _e[0], setIsDropdownVisible = _e[1];
236
- var _f = useState(null), hoveredElemIndex = _f[0], setHoveredElemIndex = _f[1];
237
- var timeoutRef = useRef(null);
238
- var openTimeoutRef = useRef(null);
239
- var cancelElementHover = useRef(false);
240
- var handleOnMouseEnter = useCallback(function (index) {
241
- if (timeoutRef.current)
242
- clearTimeout(timeoutRef.current);
243
- if (openTimeoutRef.current)
244
- clearTimeout(openTimeoutRef.current);
245
- cancelElementHover.current = false;
246
- openTimeoutRef.current = setTimeout(function () {
247
- setIsDropdownVisible(true);
248
- if (!cancelElementHover.current) {
249
- setHoveredElemIndex(index);
250
- }
251
- }, openDelay);
252
- }, [openDelay]);
253
- var handleOnMouseLeave = useCallback(function () {
254
- cancelElementHover.current = true;
255
- timeoutRef.current = setTimeout(function () {
256
- setIsDropdownVisible(false);
257
- setHoveredElemIndex(null);
258
- }, closeDelay);
259
- }, [closeDelay]);
260
- var handleDropdownMouseEnter = useCallback(function () {
261
- if (timeoutRef.current)
262
- clearTimeout(timeoutRef.current);
263
- }, []);
264
- var handleDropdownMouseLeave = useCallback(function () {
265
- cancelElementHover.current = true;
266
- (timeoutRef === null || timeoutRef === void 0 ? void 0 : timeoutRef.current) && clearTimeout(timeoutRef.current);
267
- timeoutRef.current = setTimeout(function () {
268
- setIsDropdownVisible(false);
269
- setHoveredElemIndex(null);
270
- }, closeDelay);
271
- }, []);
272
- useEffect(function () {
273
- var handleMouseLeaveWindow = function (event) {
274
- if (event.clientY <= 0) {
275
- setIsDropdownVisible(false);
276
- setHoveredElemIndex(null);
277
- }
278
- };
279
- window.addEventListener('mouseleave', handleMouseLeaveWindow);
280
- return function () {
281
- window.removeEventListener('mouseleave', handleMouseLeaveWindow);
282
- };
283
- }, []);
284
- return {
285
- isDropdownVisible: isDropdownVisible,
286
- hoveredElemIndex: hoveredElemIndex,
287
- handleOnMouseEnter: handleOnMouseEnter,
288
- handleOnMouseLeave: handleOnMouseLeave,
289
- handleDropdownMouseEnter: handleDropdownMouseEnter,
290
- handleDropdownMouseLeave: handleDropdownMouseLeave,
368
+ var _b = _a === void 0 ? {} : _a,
369
+ _c = _b.closeDelay,
370
+ closeDelayArg = _c === void 0 ? 0 : _c,
371
+ _d = _b.openDelay,
372
+ openDelay = _d === void 0 ? 500 : _d;
373
+ var closeDelay = Math.max(closeDelayArg, MIN_CLOSE_DELAY);
374
+ var _e = useState(false),
375
+ isDropdownVisible = _e[0],
376
+ setIsDropdownVisible = _e[1];
377
+ var _f = useState(null),
378
+ hoveredElemIndex = _f[0],
379
+ setHoveredElemIndex = _f[1];
380
+ var timeoutRef = useRef(null);
381
+ var openTimeoutRef = useRef(null);
382
+ var cancelElementHover = useRef(false);
383
+ var handleOnMouseEnter = useCallback(function (index) {
384
+ if (timeoutRef.current) clearTimeout(timeoutRef.current);
385
+ if (openTimeoutRef.current) clearTimeout(openTimeoutRef.current);
386
+ cancelElementHover.current = false;
387
+ openTimeoutRef.current = setTimeout(function () {
388
+ setIsDropdownVisible(true);
389
+ if (!cancelElementHover.current) {
390
+ setHoveredElemIndex(index);
391
+ }
392
+ }, openDelay);
393
+ }, [openDelay]);
394
+ var handleOnMouseLeave = useCallback(function () {
395
+ cancelElementHover.current = true;
396
+ timeoutRef.current = setTimeout(function () {
397
+ setIsDropdownVisible(false);
398
+ setHoveredElemIndex(null);
399
+ }, closeDelay);
400
+ }, [closeDelay]);
401
+ var handleDropdownMouseEnter = useCallback(function () {
402
+ if (timeoutRef.current) clearTimeout(timeoutRef.current);
403
+ }, []);
404
+ var handleDropdownMouseLeave = useCallback(function () {
405
+ cancelElementHover.current = true;
406
+ (timeoutRef === null || timeoutRef === void 0 ? void 0 : timeoutRef.current) && clearTimeout(timeoutRef.current);
407
+ timeoutRef.current = setTimeout(function () {
408
+ setIsDropdownVisible(false);
409
+ setHoveredElemIndex(null);
410
+ }, closeDelay);
411
+ }, []);
412
+ useEffect(function () {
413
+ var handleMouseLeaveWindow = function (event) {
414
+ if (event.clientY <= 0) {
415
+ setIsDropdownVisible(false);
416
+ setHoveredElemIndex(null);
417
+ }
291
418
  };
419
+ window.addEventListener('mouseleave', handleMouseLeaveWindow);
420
+ return function () {
421
+ window.removeEventListener('mouseleave', handleMouseLeaveWindow);
422
+ };
423
+ }, []);
424
+ return {
425
+ isDropdownVisible: isDropdownVisible,
426
+ hoveredElemIndex: hoveredElemIndex,
427
+ handleOnMouseEnter: handleOnMouseEnter,
428
+ handleOnMouseLeave: handleOnMouseLeave,
429
+ handleDropdownMouseEnter: handleDropdownMouseEnter,
430
+ handleDropdownMouseLeave: handleDropdownMouseLeave
431
+ };
292
432
  };
293
433
 
294
434
  var useDropdownAnimation = function (isOpen) {
295
- var containerRef = useRef(null);
296
- var openDropdown = function () {
297
- if (containerRef.current) {
298
- var fullHeight_1 = containerRef.current.scrollHeight;
299
- containerRef.current.style.maxHeight = "".concat(fullHeight_1 / 2, "px");
300
- containerRef.current.style.opacity = '0';
301
- requestAnimationFrame(function () {
302
- if (containerRef.current) {
303
- containerRef.current.style.transition = 'max-height 0.3s ease-in-out, opacity 0.3s ease-in-out';
304
- containerRef.current.style.maxHeight = "".concat(fullHeight_1, "px");
305
- containerRef.current.style.opacity = '1';
306
- }
307
- });
308
- }
309
- };
310
- var closeDropdown = function () {
435
+ var containerRef = useRef(null);
436
+ var openDropdown = function () {
437
+ if (containerRef.current) {
438
+ var fullHeight_1 = containerRef.current.scrollHeight;
439
+ containerRef.current.style.maxHeight = "".concat(fullHeight_1 / 2, "px");
440
+ containerRef.current.style.opacity = '0';
441
+ requestAnimationFrame(function () {
311
442
  if (containerRef.current) {
312
- var fullHeight = containerRef.current.scrollHeight;
313
- containerRef.current.style.transition = 'max-height 0.3s ease-in-out, opacity 0.3s ease-in-out';
314
- containerRef.current.style.maxHeight = "".concat(fullHeight / 2, "px");
315
- containerRef.current.style.opacity = '0';
316
- setTimeout(function () {
317
- if (containerRef.current) {
318
- containerRef.current.style.maxHeight = '0px';
319
- }
320
- }, 300);
321
- }
322
- };
323
- useEffect(function () {
324
- if (isOpen) {
325
- openDropdown();
326
- }
327
- else {
328
- closeDropdown();
443
+ containerRef.current.style.transition = 'max-height 0.3s ease-in-out, opacity 0.3s ease-in-out';
444
+ containerRef.current.style.maxHeight = "".concat(fullHeight_1, "px");
445
+ containerRef.current.style.opacity = '1';
329
446
  }
330
- }, [isOpen]);
331
- return { containerRef: containerRef };
332
- };
333
-
334
- var stringifyPayload = function (payload) {
335
- var keys = Object.keys(payload);
336
- var numericValues = [];
337
- keys.forEach(function (key) {
338
- if (numericValues.includes(key)) {
339
- payload[key] = Number(payload[key]);
340
- }
341
- else {
342
- payload[key] = '' + payload[key];
343
- }
344
- });
345
- return payload;
346
- };
347
- var isServer = function () {
348
- return typeof window === 'undefined' || !window;
349
- };
350
- var getQueryParam = function (queryParam) {
351
- if (isServer()) {
352
- return '';
447
+ });
353
448
  }
354
- var urlParams = new URLSearchParams(window.location.search);
355
- return urlParams.get(queryParam);
356
- };
357
- var ravenLoyaltyTypes = function (loyaltyType) {
358
- switch (loyaltyType) {
359
- case 'FkVip':
360
- return 'fk_vip';
361
- case 'FkPremium':
362
- return 'fk_plus_premium';
363
- case 'InsiderIcon':
364
- return 'myntra_insidericon';
365
- case 'InsiderElite':
366
- return 'myntra_insiderelite';
367
- default:
368
- return '';
369
- }
370
- };
371
- var ravenSDKTrigger = function (isUserLoggedIn, eventName, ravenPayload, customRavenPayload, ravenPushCallback, pageName) {
372
- var _a;
373
- if (typeof ravenPushCallback !== 'function') {
374
- console.error('ravenPushCallback is not provided or is not a function');
375
- return;
376
- }
377
- var commonPayload = {
378
- page_name: pageName,
379
- platform: RAVEN_PLATFORMS.DESKTOP,
380
- login_status: isUserLoggedIn ? 'yes' : 'no',
381
- domain: (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.host,
382
- };
383
- var newRavenPayload = stringifyPayload(ravenPayload);
384
- var parsedCustomRavenPayload = stringifyPayload(customRavenPayload);
385
- var finalPayload = __assign(__assign(__assign({}, commonPayload), newRavenPayload), parsedCustomRavenPayload);
386
- try {
387
- if (ravenPushCallback.length === 1) {
388
- ravenPushCallback({ eventName: eventName, eventData: finalPayload });
389
- }
390
- else {
391
- ravenPushCallback(eventName, finalPayload);
449
+ };
450
+ var closeDropdown = function () {
451
+ if (containerRef.current) {
452
+ var fullHeight = containerRef.current.scrollHeight;
453
+ containerRef.current.style.transition = 'max-height 0.3s ease-in-out, opacity 0.3s ease-in-out';
454
+ containerRef.current.style.maxHeight = "".concat(fullHeight / 2, "px");
455
+ containerRef.current.style.opacity = '0';
456
+ setTimeout(function () {
457
+ if (containerRef.current) {
458
+ containerRef.current.style.maxHeight = '0px';
392
459
  }
460
+ }, 300);
393
461
  }
394
- catch (err) {
395
- console.error(err);
396
- return;
462
+ };
463
+ useEffect(function () {
464
+ if (isOpen) {
465
+ openDropdown();
466
+ } else {
467
+ closeDropdown();
397
468
  }
469
+ }, [isOpen]);
470
+ return {
471
+ containerRef: containerRef
472
+ };
398
473
  };
399
474
 
400
475
  var accountOptionHoverStyles = {
401
- transition: 'background-color 0.2s ease-in-out',
402
- '&:hover': {
403
- backgroundColor: '#ECF3FF',
404
- },
476
+ transition: 'background-color 0.2s ease-in-out',
477
+ '&:hover': {
478
+ backgroundColor: '#ECF3FF'
479
+ }
405
480
  };
406
481
  var logoutButtonHoverStyles = {
407
- transition: 'background-color 0.2s ease-in-out',
408
- '&:hover': {
409
- backgroundColor: '#FBEFEF',
410
- },
482
+ transition: 'background-color 0.2s ease-in-out',
483
+ '&:hover': {
484
+ backgroundColor: '#FBEFEF'
485
+ }
411
486
  };
412
487
  var moveRight = keyframes(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n from {\n transform: translateX(-20px);\n }\n to {\n transform: translateX(0px);\n }\n"], ["\n from {\n transform: translateX(-20px);\n }\n to {\n transform: translateX(0px);\n }\n"])));
413
488
  var moveRightAgain = keyframes(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n from {\n transform: translateX(-20.01px);\n }\n to {\n transform: translateX(0px);\n }\n"], ["\n from {\n transform: translateX(-20.01px);\n }\n to {\n transform: translateX(0px);\n }\n"])));
414
489
  var arrowContainerStyles = {
415
- display: 'flex',
416
- backgroundColor: 'black',
417
- transition: 'background-color 200ms ease',
418
- 'flex-direction': 'row',
419
- justifyContent: 'center',
420
- width: '20px',
421
- height: '20px',
422
- overflow: 'hidden',
423
- borderRadius: '50%',
490
+ display: 'flex',
491
+ backgroundColor: 'black',
492
+ transition: 'background-color 200ms ease',
493
+ 'flex-direction': 'row',
494
+ justifyContent: 'center',
495
+ width: '20px',
496
+ height: '20px',
497
+ overflow: 'hidden',
498
+ borderRadius: '50%'
424
499
  };
425
500
  var getLoginButtonBgColorStyles = function (saleThemeEnabled) {
426
- if (saleThemeEnabled) {
427
- return {
428
- backgroundColor: 'transparent !important',
429
- '&:hover': {
430
- backgroundColor: 'rgba(255, 255, 255, 0.25)!important',
431
- },
432
- };
433
- }
434
- else {
435
- return {
436
- backgroundColor: 'transparent !important',
437
- '&:hover': {
438
- backgroundColor: '#F3F3F3 !important',
439
- },
440
- };
441
- }
501
+ if (saleThemeEnabled) {
502
+ return {
503
+ backgroundColor: 'transparent !important',
504
+ '&:hover': {
505
+ backgroundColor: 'rgba(255, 255, 255, 0.25)!important'
506
+ }
507
+ };
508
+ } else {
509
+ return {
510
+ backgroundColor: 'transparent !important',
511
+ '&:hover': {
512
+ backgroundColor: '#F3F3F3 !important'
513
+ }
514
+ };
515
+ }
442
516
  };
443
517
  var templateObject_1$1, templateObject_2;
444
518
 
445
519
  var AnimatedArrow = function () {
446
- return (jsx(Container, __assign({ className: 'bd-arrow-container-js', css: arrowContainerStyles }, { children: __spreadArray([], Array(3), true).map(function (_, index) { return (jsx(Container, __assign({ className: 'bd-arrow-wrapper-js', display: 'flex', alignItems: 'center' }, { children: jsx(ArrowRight, {}) }), index)); }) })));
520
+ return jsx(Container, __assign({
521
+ className: 'bd-arrow-container-js',
522
+ css: arrowContainerStyles
523
+ }, {
524
+ children: __spreadArray([], Array(3), true).map(function (_, index) {
525
+ return jsx(Container, __assign({
526
+ className: 'bd-arrow-wrapper-js',
527
+ display: 'flex',
528
+ alignItems: 'center'
529
+ }, {
530
+ children: jsx(ArrowRight, {})
531
+ }), index);
532
+ })
533
+ }));
447
534
  };
448
- var BDHoverContainer = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n cursor: pointer;\n width: 200px;\n &:hover {\n .bd-arrow-container-js {\n background-color: rgba(255, 79, 23, 1);\n transition: color 200ms ease;\n }\n .bd-arrow-wrapper-js {\n animation: ", " 200ms linear;\n display: flex;\n }\n .color-orange-on-hover-js {\n color: rgba(255, 79, 23, 1);\n transition: background-color 200ms ease;\n }\n }\n &:not(:hover) .bd-arrow-wrapper-js {\n animation: ", " 200ms linear backwards;\n }\n"], ["\n cursor: pointer;\n width: 200px;\n &:hover {\n .bd-arrow-container-js {\n background-color: rgba(255, 79, 23, 1);\n transition: color 200ms ease;\n }\n .bd-arrow-wrapper-js {\n animation: ", " 200ms linear;\n display: flex;\n }\n .color-orange-on-hover-js {\n color: rgba(255, 79, 23, 1);\n transition: background-color 200ms ease;\n }\n }\n &:not(:hover) .bd-arrow-wrapper-js {\n animation: ", " 200ms linear backwards;\n }\n"])), moveRight, moveRightAgain);
535
+ var BDHoverContainer = /*#__PURE__*/styled.div.withConfig({
536
+ displayName: "BusinessDropdown__BDHoverContainer",
537
+ componentId: "sc-1tsshe4-0"
538
+ })(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n cursor: pointer;\n width: 200px;\n &:hover {\n .bd-arrow-container-js {\n background-color: rgba(255, 79, 23, 1);\n transition: color 200ms ease;\n }\n .bd-arrow-wrapper-js {\n animation: ", " 200ms linear;\n display: flex;\n }\n .color-orange-on-hover-js {\n color: rgba(255, 79, 23, 1);\n transition: background-color 200ms ease;\n }\n }\n &:not(:hover) .bd-arrow-wrapper-js {\n animation: ", " 200ms linear backwards;\n }\n"], ["\n cursor: pointer;\n width: 200px;\n &:hover {\n .bd-arrow-container-js {\n background-color: rgba(255, 79, 23, 1);\n transition: color 200ms ease;\n }\n .bd-arrow-wrapper-js {\n animation: ", " 200ms linear;\n display: flex;\n }\n .color-orange-on-hover-js {\n color: rgba(255, 79, 23, 1);\n transition: background-color 200ms ease;\n }\n }\n &:not(:hover) .bd-arrow-wrapper-js {\n animation: ", " 200ms linear backwards;\n }\n"])), moveRight, moveRightAgain);
449
539
  var BusinessDropdownContent = function (_a) {
450
- var isOpen = _a.isOpen;
451
- var _b = useHeaderContext(), isUserLoggedIn = _b.isUserLoggedIn, ravenPushCallback = _b.ravenPushCallback, ravenPageName = _b.ravenPageName, ravenEventName = _b.ravenEventName, loyaltyType = _b.loyaltyType, _c = _b.ravenPayload, ravenPayload = _c === void 0 ? {} : _c;
452
- var _d = useState(0), leftPosition = _d[0], setLeftPosition = _d[1];
453
- var containerRef = useDropdownAnimation(isOpen).containerRef;
454
- useEffect(function () {
455
- var updatePosition = function () {
456
- if (containerRef.current) {
457
- var screenWidth = window.innerWidth;
458
- var containerWidth = containerRef.current.offsetWidth || 0;
459
- var newLeft = (screenWidth - containerWidth) / 2;
460
- if (newLeft !== leftPosition) {
461
- setLeftPosition(newLeft);
540
+ var isOpen = _a.isOpen;
541
+ var _b = useHeaderContext(),
542
+ isUserLoggedIn = _b.isUserLoggedIn,
543
+ ravenPushCallback = _b.ravenPushCallback,
544
+ ravenPageName = _b.ravenPageName,
545
+ ravenEventName = _b.ravenEventName,
546
+ loyaltyType = _b.loyaltyType,
547
+ _c = _b.ravenPayload,
548
+ ravenPayload = _c === void 0 ? {} : _c;
549
+ var _d = useState(0),
550
+ leftPosition = _d[0],
551
+ setLeftPosition = _d[1];
552
+ var containerRef = useDropdownAnimation(isOpen).containerRef;
553
+ useEffect(function () {
554
+ var updatePosition = function () {
555
+ if (containerRef.current) {
556
+ var screenWidth = window.innerWidth;
557
+ var containerWidth = containerRef.current.offsetWidth || 0;
558
+ var newLeft = (screenWidth - containerWidth) / 2;
559
+ if (newLeft !== leftPosition) {
560
+ setLeftPosition(newLeft);
561
+ }
562
+ }
563
+ };
564
+ updatePosition();
565
+ window.addEventListener('resize', updatePosition);
566
+ return function () {
567
+ return window.removeEventListener('resize', updatePosition);
568
+ };
569
+ }, [containerRef, leftPosition]);
570
+ var handleBusinessDropdownClick = useCallback(function (link, title, ravenActionName) {
571
+ var _a;
572
+ var utmSource = (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic';
573
+ var actionName = ravenActionName ? "".concat(ravenActionName, "_business_click") : title ? "".concat(title.toLowerCase(), "_business_click") : '';
574
+ var defaultPayload = {
575
+ action_name: actionName,
576
+ action_type: 'click',
577
+ u_utm_source: utmSource,
578
+ loyalty_type: ravenLoyaltyTypes(loyaltyType)
579
+ };
580
+ if (link) {
581
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, defaultPayload, ravenPayload, ravenPushCallback, ravenPageName);
582
+ window.location.href = link;
583
+ }
584
+ }, [isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName, loyaltyType]);
585
+ return jsxs(Container, __assign({
586
+ ref: containerRef,
587
+ backgroundColor: '#fff',
588
+ top: '76px',
589
+ position: 'fixed',
590
+ left: "".concat(leftPosition, "px"),
591
+ borderRadius: 24,
592
+ boxShadow: '0px 8px 24px 0px rgba(26, 26, 26, 0.10)',
593
+ width: 'fit-content',
594
+ zIndex: 1002,
595
+ css: {
596
+ overflow: 'hidden',
597
+ opacity: 0
598
+ }
599
+ }, {
600
+ children: [jsx(Container, __assign({
601
+ padding: '20px 24px 20px 24px',
602
+ backgroundColor: '#FFF1EC'
603
+ }, {
604
+ children: jsx(Typography, __assign({
605
+ variant: 'HM2'
606
+ }, {
607
+ children: BUSINESS_DROPDOWN_HEADING
608
+ }))
609
+ })), jsx(Container, __assign({
610
+ display: 'flex',
611
+ flexDirection: 'row',
612
+ padding: '24px',
613
+ columnGap: '48px',
614
+ width: 'fit-content'
615
+ }, {
616
+ children: bdConfig.map(function (_a) {
617
+ var title = _a.title,
618
+ subtitle = _a.subtitle,
619
+ details = _a.details,
620
+ link = _a.link,
621
+ ravenActionName = _a.ravenActionName;
622
+ return jsxs(BDHoverContainer, __assign({
623
+ className: 'bd-hover-container-js',
624
+ onClick: function () {
625
+ return handleBusinessDropdownClick(link, title, ravenActionName);
626
+ }
627
+ }, {
628
+ children: [jsxs(Container, __assign({
629
+ display: 'flex',
630
+ flexDirection: 'column',
631
+ rowGap: '4px'
632
+ }, {
633
+ children: [jsxs(Container, __assign({
634
+ display: 'flex',
635
+ flexDirection: 'row',
636
+ alignItems: 'center',
637
+ columnGap: '8px'
638
+ }, {
639
+ children: [jsx(Typography, __assign({
640
+ variant: 'HM2',
641
+ className: 'color-orange-on-hover-js',
642
+ css: {
643
+ transition: 'color 200ms ease'
462
644
  }
645
+ }, {
646
+ children: title
647
+ })), jsx(AnimatedArrow, {})]
648
+ })), jsx(Typography, __assign({
649
+ variant: 'B3',
650
+ css: {
651
+ marginTop: '4px',
652
+ opacity: 0.75
653
+ }
654
+ }, {
655
+ children: subtitle
656
+ }))]
657
+ })), jsx(Typography, __assign({
658
+ variant: 'P3',
659
+ color: 'subheading',
660
+ css: {
661
+ marginTop: '12px'
463
662
  }
464
- };
465
- updatePosition();
466
- window.addEventListener('resize', updatePosition);
467
- return function () { return window.removeEventListener('resize', updatePosition); };
468
- }, [containerRef, leftPosition]);
469
- var handleBusinessDropdownClick = useCallback(function (link, title, ravenActionName) {
470
- var _a;
471
- var utmSource = (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic';
472
- var actionName = ravenActionName
473
- ? "".concat(ravenActionName, "_business_click")
474
- : title
475
- ? "".concat(title.toLowerCase(), "_business_click")
476
- : '';
477
- var defaultPayload = {
478
- action_name: actionName,
479
- action_type: 'click',
480
- u_utm_source: utmSource,
481
- loyalty_type: ravenLoyaltyTypes(loyaltyType),
482
- };
483
- if (link) {
484
- ravenSDKTrigger(isUserLoggedIn, ravenEventName, defaultPayload, ravenPayload, ravenPushCallback, ravenPageName);
485
- window.location.href = link;
486
- }
487
- }, [isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName, loyaltyType]);
488
- return (jsxs(Container, __assign({ ref: containerRef, backgroundColor: '#fff', top: '76px', position: 'fixed', left: "".concat(leftPosition, "px"), borderRadius: 24, boxShadow: '0px 8px 24px 0px rgba(26, 26, 26, 0.10)', width: 'fit-content', zIndex: 1002, css: {
489
- overflow: 'hidden',
490
- opacity: 0,
491
- } }, { children: [jsx(Container, __assign({ padding: '20px 24px 20px 24px', backgroundColor: '#FFF1EC' }, { children: jsx(Typography, __assign({ variant: 'HM2' }, { children: BUSINESS_DROPDOWN_HEADING })) })), jsx(Container, __assign({ display: 'flex', flexDirection: 'row', padding: '24px', columnGap: '48px', width: 'fit-content' }, { children: bdConfig.map(function (_a) {
492
- var title = _a.title, subtitle = _a.subtitle, details = _a.details, link = _a.link, ravenActionName = _a.ravenActionName;
493
- return (jsxs(BDHoverContainer, __assign({ className: 'bd-hover-container-js', onClick: function () { return handleBusinessDropdownClick(link, title, ravenActionName); } }, { children: [jsxs(Container, __assign({ display: 'flex', flexDirection: 'column', rowGap: '4px' }, { children: [jsxs(Container, __assign({ display: 'flex', flexDirection: 'row', alignItems: 'center', columnGap: '8px' }, { children: [jsx(Typography, __assign({ variant: 'HM2', className: 'color-orange-on-hover-js', css: { transition: 'color 200ms ease' } }, { children: title })), jsx(AnimatedArrow, {})] })), jsx(Typography, __assign({ variant: 'B3', css: { marginTop: '4px', opacity: 0.75 } }, { children: subtitle }))] })), jsx(Typography, __assign({ variant: 'P3', color: 'subheading', css: { marginTop: '12px' } }, { children: details }))] }), title));
494
- }) }))] })));
663
+ }, {
664
+ children: details
665
+ }))]
666
+ }), title);
667
+ })
668
+ }))]
669
+ }));
495
670
  };
496
671
  var templateObject_1;
497
672
 
498
- var ACCOUNT_OPTIONS_POPUP_CONFIG = [
499
- {
500
- text: 'My Profile',
501
- icon: jsx(MyAccount, { width: 24, height: 24 }),
502
- redirectionLink: '/accounts/profile',
503
- },
504
- {
505
- text: 'My Trips',
506
- icon: jsx(MyTrips, { width: 24, height: 24 }),
507
- redirectionLink: '/accounts/trips',
508
- },
509
- {
510
- text: 'Saved Cards',
511
- icon: jsx(SavedCard, {}),
512
- redirectionLink: '/accounts/expressway',
513
- },
514
- {
515
- text: 'Saved Travellers',
516
- icon: jsx(Travellers, { width: 24, height: 24 }),
517
- redirectionLink: '/account/travellers',
518
- },
519
- {
520
- text: 'Hi-Five',
521
- icon: jsx(HiFive, {}),
522
- redirectionLink: '/accounts/hi-five?src=fh',
523
- },
524
- {
525
- text: 'Wallet',
526
- icon: jsx(Wallet, { width: 24, height: 24 }),
527
- redirectionLink: '/accounts/wallet',
528
- },
529
- {
530
- text: 'Settings',
531
- icon: jsx(SettingsCog, { width: 24, height: 24 }),
532
- redirectionLink: '/account/settings',
533
- },
534
- {
535
- text: 'Privacy Rights',
536
- icon: jsx(PrivacyRights, {}),
537
- redirectionLink: 'accounts/personal-data-dashboard',
538
- },
539
- ];
673
+ var ACCOUNT_OPTIONS_POPUP_CONFIG = [{
674
+ text: 'My Profile',
675
+ icon: jsx(MyAccount, {
676
+ width: 24,
677
+ height: 24
678
+ }),
679
+ redirectionLink: '/accounts/profile'
680
+ }, {
681
+ text: 'My Trips',
682
+ icon: jsx(MyTrips, {
683
+ width: 24,
684
+ height: 24
685
+ }),
686
+ redirectionLink: '/accounts/trips'
687
+ }, {
688
+ text: 'Saved Cards',
689
+ icon: jsx(SavedCard, {}),
690
+ redirectionLink: '/accounts/expressway'
691
+ }, {
692
+ text: 'Saved Travellers',
693
+ icon: jsx(Travellers, {
694
+ width: 24,
695
+ height: 24
696
+ }),
697
+ redirectionLink: '/account/travellers'
698
+ }, {
699
+ text: 'Hi-Five',
700
+ icon: jsx(HiFive, {}),
701
+ redirectionLink: '/accounts/hi-five?src=fh'
702
+ }, {
703
+ text: 'Wallet',
704
+ icon: jsx(Wallet, {
705
+ width: 24,
706
+ height: 24
707
+ }),
708
+ redirectionLink: '/accounts/wallet'
709
+ }, {
710
+ text: 'Settings',
711
+ icon: jsx(SettingsCog, {
712
+ width: 24,
713
+ height: 24
714
+ }),
715
+ redirectionLink: '/account/settings'
716
+ }, {
717
+ text: 'Privacy Rights',
718
+ icon: jsx(PrivacyRights, {}),
719
+ redirectionLink: 'accounts/personal-data-dashboard'
720
+ }];
540
721
  var SIGN_OUT_TEXT = 'Logout';
541
722
  var MY_ACCOUNT_TEXT = 'My Account';
542
723
  var LOGGEDIN_USER_TEXT = 'You are logged in with';
@@ -545,326 +726,816 @@ var ACCOUNT_OPTIONS_CONTAINER_ID = 'account-options';
545
726
  var ACCOUNT_OPTIONS_CONTAINER_WIDTH = 328;
546
727
 
547
728
  var LoyaltyChip = function (_a) {
548
- var icon = _a.icon, borderGradient = _a.borderGradient, backgroundGradient = _a.backgroundGradient, handleChipClick = _a.handleChipClick, chevronFillColor = _a.chevronFillColor;
549
- var _b = useHeaderContext(), loyaltyType = _b.loyaltyType, isUserLoggedIn = _b.isUserLoggedIn, ravenPushCallback = _b.ravenPushCallback, ravenPageName = _b.ravenPageName, _c = _b.ravenPayload, ravenPayload = _c === void 0 ? {} : _c, ravenEventName = _b.ravenEventName;
550
- var _d = useState(false), isHovered = _d[0], setIsHovered = _d[1];
551
- var handleClick = useCallback(function () {
552
- var _a;
553
- if (handleChipClick) {
554
- handleChipClick();
555
- }
556
- else {
557
- var utmSource = (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic';
558
- var defaultPayload = {
559
- action_name: "loyalty_account_click",
560
- action_type: 'click',
561
- u_utm_source: utmSource,
562
- loyaltyType: ravenLoyaltyTypes(loyaltyType),
563
- };
564
- ravenSDKTrigger(isUserLoggedIn, ravenEventName, defaultPayload, ravenPayload, ravenPushCallback, ravenPageName);
565
- window.location.href = '/all-offers/loyalty-october';
566
- }
567
- }, [handleChipClick, loyaltyType, isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
568
- return (jsxs(Container, __assign({ display: 'flex', position: 'relative', alignItems: 'center', justifyContent: 'center', borderRadius: '8px', cursor: 'pointer', paddingLeft: '8px', paddingRight: isHovered ? '4px' : '8px', css: {
569
- overflow: 'hidden',
570
- height: 32,
571
- paddingLeft: 8,
572
- transition: 'padding-right 0.2s ease-in-out',
573
- }, onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onClick: handleClick }, { children: [jsx(Container, { css: {
574
- content: '""',
575
- position: 'absolute',
576
- inset: 0,
577
- borderRadius: 'inherit',
578
- background: backgroundGradient,
579
- zIndex: -2,
580
- } }), jsx(Container, { css: {
581
- content: '""',
582
- position: 'absolute',
583
- inset: 0,
584
- borderRadius: 'inherit',
585
- padding: '1px',
586
- background: borderGradient,
587
- WebkitMask: 'linear-gradient(white, white) content-box, linear-gradient(white, white)',
588
- WebkitMaskComposite: 'destination-out',
589
- maskComposite: 'exclude',
590
- zIndex: -1,
591
- } }), jsx(Container, __assign({ display: 'flex', alignItems: 'center', position: 'relative' }, { children: icon })), jsx(Container, __assign({ display: 'flex', alignItems: 'center', css: {
592
- overflow: 'hidden',
593
- maxWidth: isHovered ? 16 : 0,
594
- transition: 'max-width 0.2s ease-in-out, opacity 0.2s ease-in-out',
595
- opacity: isHovered ? 0.5 : 0,
596
- } }, { children: jsx(HeaderChevronRight, { color: chevronFillColor }) }))] })));
729
+ var icon = _a.icon,
730
+ borderGradient = _a.borderGradient,
731
+ backgroundGradient = _a.backgroundGradient,
732
+ handleChipClick = _a.handleChipClick,
733
+ chevronFillColor = _a.chevronFillColor;
734
+ var _b = useHeaderContext(),
735
+ loyaltyType = _b.loyaltyType,
736
+ isUserLoggedIn = _b.isUserLoggedIn,
737
+ ravenPushCallback = _b.ravenPushCallback,
738
+ ravenPageName = _b.ravenPageName,
739
+ _c = _b.ravenPayload,
740
+ ravenPayload = _c === void 0 ? {} : _c,
741
+ ravenEventName = _b.ravenEventName;
742
+ var _d = useState(false),
743
+ isHovered = _d[0],
744
+ setIsHovered = _d[1];
745
+ var handleClick = useCallback(function () {
746
+ var _a;
747
+ if (handleChipClick) {
748
+ handleChipClick();
749
+ } else {
750
+ var utmSource = (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic';
751
+ var defaultPayload = {
752
+ action_name: "loyalty_account_click",
753
+ action_type: 'click',
754
+ u_utm_source: utmSource,
755
+ loyaltyType: ravenLoyaltyTypes(loyaltyType)
756
+ };
757
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, defaultPayload, ravenPayload, ravenPushCallback, ravenPageName);
758
+ window.location.href = '/all-offers/loyalty-october';
759
+ }
760
+ }, [handleChipClick, loyaltyType, isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
761
+ return jsxs(Container, __assign({
762
+ display: 'flex',
763
+ position: 'relative',
764
+ alignItems: 'center',
765
+ justifyContent: 'center',
766
+ borderRadius: '8px',
767
+ cursor: 'pointer',
768
+ paddingLeft: '8px',
769
+ paddingRight: isHovered ? '4px' : '8px',
770
+ css: {
771
+ overflow: 'hidden',
772
+ height: 32,
773
+ paddingLeft: 8,
774
+ transition: 'padding-right 0.2s ease-in-out'
775
+ },
776
+ onMouseEnter: function () {
777
+ return setIsHovered(true);
778
+ },
779
+ onMouseLeave: function () {
780
+ return setIsHovered(false);
781
+ },
782
+ onClick: handleClick
783
+ }, {
784
+ children: [jsx(Container, {
785
+ css: {
786
+ content: '""',
787
+ position: 'absolute',
788
+ inset: 0,
789
+ borderRadius: 'inherit',
790
+ background: backgroundGradient,
791
+ zIndex: -2
792
+ }
793
+ }), jsx(Container, {
794
+ css: {
795
+ content: '""',
796
+ position: 'absolute',
797
+ inset: 0,
798
+ borderRadius: 'inherit',
799
+ padding: '1px',
800
+ background: borderGradient,
801
+ WebkitMask: 'linear-gradient(white, white) content-box, linear-gradient(white, white)',
802
+ WebkitMaskComposite: 'destination-out',
803
+ maskComposite: 'exclude',
804
+ zIndex: -1
805
+ }
806
+ }), jsx(Container, __assign({
807
+ display: 'flex',
808
+ alignItems: 'center',
809
+ position: 'relative'
810
+ }, {
811
+ children: icon
812
+ })), jsx(Container, __assign({
813
+ display: 'flex',
814
+ alignItems: 'center',
815
+ css: {
816
+ overflow: 'hidden',
817
+ maxWidth: isHovered ? 16 : 0,
818
+ transition: 'max-width 0.2s ease-in-out, opacity 0.2s ease-in-out',
819
+ opacity: isHovered ? 0.5 : 0
820
+ }
821
+ }, {
822
+ children: jsx(HeaderChevronRight, {
823
+ color: chevronFillColor
824
+ })
825
+ }))]
826
+ }));
597
827
  };
598
828
 
599
829
  var LOBS_VALUES;
600
830
  (function (LOBS_VALUES) {
601
- LOBS_VALUES["FLIGHTS"] = "Flights";
602
- LOBS_VALUES["HOTELS"] = "Hotels";
603
- LOBS_VALUES["BUSES"] = "Buses";
604
- LOBS_VALUES["TRAINS"] = "Trains";
605
- LOBS_VALUES["PACKAGES"] = "Packages";
831
+ LOBS_VALUES["FLIGHTS"] = "Flights";
832
+ LOBS_VALUES["HOTELS"] = "Hotels";
833
+ LOBS_VALUES["BUSES"] = "Buses";
834
+ LOBS_VALUES["TRAINS"] = "Trains";
835
+ LOBS_VALUES["HOLIDAYS"] = "Holidays";
606
836
  })(LOBS_VALUES || (LOBS_VALUES = {}));
607
837
 
608
838
  var LoyaltyType;
609
839
  (function (LoyaltyType) {
610
- LoyaltyType["FkVip"] = "FkVip";
611
- LoyaltyType["FkPremium"] = "FkPremium";
612
- LoyaltyType["InsiderIcon"] = "InsiderIcon";
613
- LoyaltyType["InsiderElite"] = "InsiderElite";
614
- LoyaltyType["CtLoyalty"] = "CtLoyalty";
840
+ LoyaltyType["FkVip"] = "FkVip";
841
+ LoyaltyType["FkPremium"] = "FkPremium";
842
+ LoyaltyType["InsiderIcon"] = "InsiderIcon";
843
+ LoyaltyType["InsiderElite"] = "InsiderElite";
844
+ LoyaltyType["CtLoyalty"] = "CtLoyalty";
615
845
  })(LoyaltyType || (LoyaltyType = {}));
616
846
 
617
847
  var _a;
618
- var LOYALTY_DATA = (_a = {},
619
- _a[LoyaltyType.FkVip] = {
620
- icon: jsx(FkBlackIcon, {}),
621
- borderGradient: 'linear-gradient(217.07deg, #0B182A 19.65%, #434E57 54.8%, #595952 89.95%)',
622
- backgroundGradient: 'linear-gradient(217.07deg, #0B182A 19.65%, #434E57 54.8%, #595952 89.95%)',
623
- chevronFillColor: '#FFF',
624
- },
625
- _a[LoyaltyType.FkPremium] = {
626
- icon: jsx(FkGold, {}),
627
- borderGradient: 'linear-gradient(230.68deg, rgba(243, 179, 39, 0) 10.1%, #F3B327 45.74%)',
628
- backgroundGradient: '#191717',
629
- chevronFillColor: '#FFF',
630
- },
631
- _a[LoyaltyType.InsiderIcon] = {
632
- icon: jsx(InsiderIcon, {}),
633
- borderGradient: 'linear-gradient(230.68deg, rgba(208, 175, 101, 0) 10.1%, #D0AF65 45.74%)',
634
- backgroundGradient: 'linear-gradient(111deg, #2E3042 0%, #1A1C23 100%)',
635
- chevronFillColor: '#FFF',
848
+ var LOYALTY_DATA = (_a = {}, _a[LoyaltyType.FkVip] = {
849
+ icon: jsx(FkBlackIcon, {}),
850
+ borderGradient: 'linear-gradient(217.07deg, #0B182A 19.65%, #434E57 54.8%, #595952 89.95%)',
851
+ backgroundGradient: 'linear-gradient(217.07deg, #0B182A 19.65%, #434E57 54.8%, #595952 89.95%)',
852
+ chevronFillColor: '#FFF'
853
+ }, _a[LoyaltyType.FkPremium] = {
854
+ icon: jsx(FkGold, {}),
855
+ borderGradient: 'linear-gradient(230.68deg, rgba(243, 179, 39, 0) 10.1%, #F3B327 45.74%)',
856
+ backgroundGradient: '#191717',
857
+ chevronFillColor: '#FFF'
858
+ }, _a[LoyaltyType.InsiderIcon] = {
859
+ icon: jsx(InsiderIcon, {}),
860
+ borderGradient: 'linear-gradient(230.68deg, rgba(208, 175, 101, 0) 10.1%, #D0AF65 45.74%)',
861
+ backgroundGradient: 'linear-gradient(111deg, #2E3042 0%, #1A1C23 100%)',
862
+ chevronFillColor: '#FFF'
863
+ }, _a[LoyaltyType.InsiderElite] = {
864
+ icon: jsx(InsiderElite, {}),
865
+ borderGradient: 'linear-gradient(230.68deg, rgba(208, 175, 101, 0) 10.1%, #D0AF65 45.74%)',
866
+ backgroundGradient: 'linear-gradient(111deg, #2E3042 0%, #1A1C23 100%)',
867
+ chevronFillColor: '#FFF'
868
+ }, _a[LoyaltyType.CtLoyalty] = {
869
+ icon: jsx(CtLoyalty, {}),
870
+ borderGradient: 'linear-gradient(230.68deg, rgba(243, 179, 39, 0) 10.1%, #F3B327 45.74%)',
871
+ backgroundGradient: 'linear-gradient(110.82deg, #FFF9EC 0%, #FEE3A8 100%)',
872
+ chevronFillColor: '#1A1A1A'
873
+ }, _a);
874
+
875
+ var ExpandableItem = function (_a) {
876
+ var icon = _a.icon,
877
+ handleChipClick = _a.handleChipClick,
878
+ value = _a.value,
879
+ type = _a.type;
880
+ var _b = useHeaderContext(),
881
+ loyaltyType = _b.loyaltyType,
882
+ isUserLoggedIn = _b.isUserLoggedIn,
883
+ ravenPushCallback = _b.ravenPushCallback,
884
+ ravenPageName = _b.ravenPageName,
885
+ ravenEventName = _b.ravenEventName,
886
+ _c = _b.ravenPayload,
887
+ ravenPayload = _c === void 0 ? {} : _c;
888
+ var _d = useState(false),
889
+ isHovered = _d[0],
890
+ setIsHovered = _d[1];
891
+ var handleDefaultClick = useCallback(function () {
892
+ var _a;
893
+ if (handleChipClick) {
894
+ handleChipClick();
895
+ } else {
896
+ var utmSource = (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic';
897
+ var defaultPayload = {
898
+ action_name: "".concat(type, "_account_click"),
899
+ action_type: 'click',
900
+ u_utm_source: utmSource,
901
+ loyaltyType: ravenLoyaltyTypes(loyaltyType)
902
+ };
903
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, defaultPayload, ravenPayload, ravenPushCallback, ravenPageName);
904
+ var redirectUrls = {
905
+ supercoin: '/all-offers/supercoins/',
906
+ wallet: '/accounts/wallet'
907
+ };
908
+ if (redirectUrls[type]) {
909
+ window.location.href = redirectUrls[type];
910
+ }
911
+ }
912
+ }, [handleChipClick, type, loyaltyType, isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
913
+ return jsxs(Container, __assign({
914
+ display: 'flex',
915
+ alignItems: 'center',
916
+ justifyContent: 'center',
917
+ borderRadius: '8px',
918
+ cursor: 'pointer',
919
+ css: {
920
+ height: 32,
921
+ paddingLeft: 8,
922
+ paddingRight: isHovered ? 4 : 8,
923
+ transition: 'padding-right 0.2s ease-in-out',
924
+ background: isHovered ? '#ffd7ca' : '#ffe6df'
636
925
  },
637
- _a[LoyaltyType.InsiderElite] = {
638
- icon: jsx(InsiderElite, {}),
639
- borderGradient: 'linear-gradient(230.68deg, rgba(208, 175, 101, 0) 10.1%, #D0AF65 45.74%)',
640
- backgroundGradient: 'linear-gradient(111deg, #2E3042 0%, #1A1C23 100%)',
641
- chevronFillColor: '#FFF',
926
+ onMouseEnter: function () {
927
+ return setIsHovered(true);
642
928
  },
643
- _a[LoyaltyType.CtLoyalty] = {
644
- icon: jsx(CtLoyalty, {}),
645
- borderGradient: 'linear-gradient(230.68deg, rgba(243, 179, 39, 0) 10.1%, #F3B327 45.74%)',
646
- backgroundGradient: 'linear-gradient(110.82deg, #FFF9EC 0%, #FEE3A8 100%)',
647
- chevronFillColor: '#1A1A1A',
929
+ onMouseLeave: function () {
930
+ return setIsHovered(false);
648
931
  },
649
- _a);
650
-
651
- var ExpandableItem = function (_a) {
652
- var icon = _a.icon, handleChipClick = _a.handleChipClick, value = _a.value, type = _a.type;
653
- var _b = useHeaderContext(), loyaltyType = _b.loyaltyType, isUserLoggedIn = _b.isUserLoggedIn, ravenPushCallback = _b.ravenPushCallback, ravenPageName = _b.ravenPageName, ravenEventName = _b.ravenEventName, _c = _b.ravenPayload, ravenPayload = _c === void 0 ? {} : _c;
654
- var _d = useState(false), isHovered = _d[0], setIsHovered = _d[1];
655
- var handleDefaultClick = useCallback(function () {
656
- var _a;
657
- if (handleChipClick) {
658
- handleChipClick();
659
- }
660
- else {
661
- var utmSource = (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic';
662
- var defaultPayload = {
663
- action_name: "".concat(type, "_account_click"),
664
- action_type: 'click',
665
- u_utm_source: utmSource,
666
- loyaltyType: ravenLoyaltyTypes(loyaltyType),
667
- };
668
- ravenSDKTrigger(isUserLoggedIn, ravenEventName, defaultPayload, ravenPayload, ravenPushCallback, ravenPageName);
669
- var redirectUrls = {
670
- supercoin: '/all-offers/supercoins/',
671
- wallet: '/accounts/wallet',
672
- };
673
- if (redirectUrls[type]) {
674
- window.location.href = redirectUrls[type];
675
- }
676
- }
677
- }, [
678
- handleChipClick,
679
- type,
680
- loyaltyType,
681
- isUserLoggedIn,
682
- ravenEventName,
683
- ravenPayload,
684
- ravenPushCallback,
685
- ravenPageName,
686
- ]);
687
- return (jsxs(Container, __assign({ display: 'flex', alignItems: 'center', justifyContent: 'center', borderRadius: '8px', cursor: 'pointer', css: {
688
- height: 32,
689
- paddingLeft: 8,
690
- paddingRight: isHovered ? 4 : 8,
691
- transition: 'padding-right 0.2s ease-in-out',
692
- background: isHovered ? '#ffd7ca' : '#ffe6df',
693
- }, onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onClick: handleDefaultClick }, { children: [jsxs(Container, __assign({ display: 'flex', alignItems: 'center', css: { gap: '4px' } }, { children: [icon, jsx(Typography, __assign({ variant: 'B3', isClickable: true }, { children: value }))] })), jsx(Container, __assign({ display: 'flex', alignItems: 'center', css: {
694
- overflow: 'hidden',
695
- maxWidth: isHovered ? 16 : 0,
696
- transition: 'max-width 0.2s ease-in-out, opacity 0.2s ease-in-out',
697
- opacity: isHovered ? 1 : 0,
698
- } }, { children: jsx(HeaderChevronRight, {}) }))] })));
932
+ onClick: handleDefaultClick
933
+ }, {
934
+ children: [jsxs(Container, __assign({
935
+ display: 'flex',
936
+ alignItems: 'center',
937
+ css: {
938
+ gap: '4px'
939
+ }
940
+ }, {
941
+ children: [icon, jsx(Typography, __assign({
942
+ variant: 'B3',
943
+ isClickable: true
944
+ }, {
945
+ children: value
946
+ }))]
947
+ })), jsx(Container, __assign({
948
+ display: 'flex',
949
+ alignItems: 'center',
950
+ css: {
951
+ overflow: 'hidden',
952
+ maxWidth: isHovered ? 16 : 0,
953
+ transition: 'max-width 0.2s ease-in-out, opacity 0.2s ease-in-out',
954
+ opacity: isHovered ? 1 : 0
955
+ }
956
+ }, {
957
+ children: jsx(HeaderChevronRight, {})
958
+ }))]
959
+ }));
699
960
  };
700
961
  var RewardsSection = function () {
701
- var _a;
702
- var _b = useHeaderContext(), selectedLoyaltyType = _b.loyaltyType, _c = _b.fkSupercoinBurnBalance, superCoinBalance = _c === void 0 ? 0 : _c, _d = _b.walletBalance, walletBalance = _d === void 0 ? 0 : _d, loyaltyLoading = _b.loyaltyLoading, superCoinsLoading = _b.superCoinsLoading, walletLoading = _b.walletLoading, walletChipClick = _b.walletChipClick, supercoinsChipClick = _b.supercoinsChipClick, loyaltyChipClick = _b.loyaltyChipClick, hideWalletChip = _b.hideWalletChip, hideSupercoinsChip = _b.hideSupercoinsChip, hideLoyaltyChip = _b.hideLoyaltyChip;
703
- var shouldShowLoyalty = loyaltyLoading || (selectedLoyaltyType && LOYALTY_DATA[selectedLoyaltyType] && !hideLoyaltyChip);
704
- var shouldShowSupercoin = superCoinsLoading || !hideSupercoinsChip;
705
- var shouldShowWallet = walletLoading || !hideWalletChip;
706
- if (!shouldShowLoyalty && !shouldShowSupercoin && !shouldShowWallet) {
707
- return null;
962
+ var _a;
963
+ var _b = useHeaderContext(),
964
+ selectedLoyaltyType = _b.loyaltyType,
965
+ _c = _b.fkSupercoinBurnBalance,
966
+ superCoinBalance = _c === void 0 ? 0 : _c,
967
+ _d = _b.walletBalance,
968
+ walletBalance = _d === void 0 ? 0 : _d,
969
+ loyaltyLoading = _b.loyaltyLoading,
970
+ superCoinsLoading = _b.superCoinsLoading,
971
+ walletLoading = _b.walletLoading,
972
+ walletChipClick = _b.walletChipClick,
973
+ supercoinsChipClick = _b.supercoinsChipClick,
974
+ loyaltyChipClick = _b.loyaltyChipClick,
975
+ hideWalletChip = _b.hideWalletChip,
976
+ hideSupercoinsChip = _b.hideSupercoinsChip,
977
+ hideLoyaltyChip = _b.hideLoyaltyChip;
978
+ var shouldShowLoyalty = loyaltyLoading || selectedLoyaltyType && LOYALTY_DATA[selectedLoyaltyType] && !hideLoyaltyChip;
979
+ var shouldShowSupercoin = superCoinsLoading || !hideSupercoinsChip;
980
+ var shouldShowWallet = walletLoading || !hideWalletChip;
981
+ if (!shouldShowLoyalty && !shouldShowSupercoin && !shouldShowWallet) {
982
+ return null;
983
+ }
984
+ return jsxs(Container, __assign({
985
+ display: 'flex',
986
+ padding: '0 16px 16px 16px',
987
+ justifyContent: 'flex-start',
988
+ css: {
989
+ alignSelf: 'stretch',
990
+ gap: '4px'
708
991
  }
709
- return (jsxs(Container, __assign({ display: 'flex', padding: '0 16px 16px 16px', justifyContent: 'flex-start', css: { alignSelf: 'stretch', gap: '4px' } }, { children: [loyaltyLoading ? (jsx(Container, { width: '50px', height: '32px', borderRadius: '8px', backgroundColor: '#efefef' })) : (selectedLoyaltyType &&
710
- LOYALTY_DATA[selectedLoyaltyType] &&
711
- !hideLoyaltyChip && (jsx(LoyaltyChip, { icon: LOYALTY_DATA[selectedLoyaltyType].icon, borderGradient: LOYALTY_DATA[selectedLoyaltyType].borderGradient, backgroundGradient: LOYALTY_DATA[selectedLoyaltyType].backgroundGradient, chevronFillColor: ((_a = LOYALTY_DATA[selectedLoyaltyType]) === null || _a === void 0 ? void 0 : _a.chevronFillColor) || '#FFF', handleChipClick: loyaltyChipClick }))), superCoinsLoading ? (jsx(Container, { width: '50px', height: '32px', borderRadius: '8px', backgroundColor: '#efefef' })) : (!hideSupercoinsChip && (jsx(ExpandableItem, { icon: jsx(Supercoin, { width: 20, height: 20 }), value: superCoinBalance, handleChipClick: supercoinsChipClick, type: 'supercoin' }))), walletLoading ? (jsx(Container, { width: '50px', height: '32px', borderRadius: '8px', backgroundColor: '#efefef' })) : (!hideWalletChip && (jsx(ExpandableItem, { icon: jsx(Wallet, { width: 20, height: 20 }), value: walletBalance, handleChipClick: walletChipClick, type: 'wallet' })))] })));
992
+ }, {
993
+ children: [loyaltyLoading ? jsx(Container, {
994
+ width: '50px',
995
+ height: '32px',
996
+ borderRadius: '8px',
997
+ backgroundColor: '#efefef'
998
+ }) : selectedLoyaltyType && LOYALTY_DATA[selectedLoyaltyType] && !hideLoyaltyChip && jsx(LoyaltyChip, {
999
+ icon: LOYALTY_DATA[selectedLoyaltyType].icon,
1000
+ borderGradient: LOYALTY_DATA[selectedLoyaltyType].borderGradient,
1001
+ backgroundGradient: LOYALTY_DATA[selectedLoyaltyType].backgroundGradient,
1002
+ chevronFillColor: ((_a = LOYALTY_DATA[selectedLoyaltyType]) === null || _a === void 0 ? void 0 : _a.chevronFillColor) || '#FFF',
1003
+ handleChipClick: loyaltyChipClick
1004
+ }), superCoinsLoading ? jsx(Container, {
1005
+ width: '50px',
1006
+ height: '32px',
1007
+ borderRadius: '8px',
1008
+ backgroundColor: '#efefef'
1009
+ }) : !hideSupercoinsChip && jsx(ExpandableItem, {
1010
+ icon: jsx(Supercoin, {
1011
+ width: 20,
1012
+ height: 20
1013
+ }),
1014
+ value: superCoinBalance,
1015
+ handleChipClick: supercoinsChipClick,
1016
+ type: 'supercoin'
1017
+ }), walletLoading ? jsx(Container, {
1018
+ width: '50px',
1019
+ height: '32px',
1020
+ borderRadius: '8px',
1021
+ backgroundColor: '#efefef'
1022
+ }) : !hideWalletChip && jsx(ExpandableItem, {
1023
+ icon: jsx(Wallet, {
1024
+ width: 20,
1025
+ height: 20
1026
+ }),
1027
+ value: walletBalance,
1028
+ handleChipClick: walletChipClick,
1029
+ type: 'wallet'
1030
+ })]
1031
+ }));
712
1032
  };
713
1033
 
714
1034
  var AccountDropdownContent = function (_a) {
715
- var isOpen = _a.isOpen;
716
- var _b = useHeaderContext(), handleLogoutClick = _b.handleLogoutClick, userName = _b.userName, userMobileNumber = _b.userMobileNumber, countryCode = _b.countryCode, userDetailsLoading = _b.userDetailsLoading, loyaltyType = _b.loyaltyType, isUserLoggedIn = _b.isUserLoggedIn, ravenEventName = _b.ravenEventName, ravenPageName = _b.ravenPageName, _c = _b.ravenPayload, ravenPayload = _c === void 0 ? {} : _c, ravenPushCallback = _b.ravenPushCallback;
717
- var containerRef = useDropdownAnimation(isOpen).containerRef;
718
- var _d = useMemo(function () { return ({
1035
+ var isOpen = _a.isOpen;
1036
+ var _b = useHeaderContext(),
1037
+ handleLogoutClick = _b.handleLogoutClick,
1038
+ userName = _b.userName,
1039
+ userMobileNumber = _b.userMobileNumber,
1040
+ countryCode = _b.countryCode,
1041
+ userDetailsLoading = _b.userDetailsLoading,
1042
+ loyaltyType = _b.loyaltyType,
1043
+ isUserLoggedIn = _b.isUserLoggedIn,
1044
+ ravenEventName = _b.ravenEventName,
1045
+ ravenPageName = _b.ravenPageName,
1046
+ _c = _b.ravenPayload,
1047
+ ravenPayload = _c === void 0 ? {} : _c,
1048
+ ravenPushCallback = _b.ravenPushCallback;
1049
+ var containerRef = useDropdownAnimation(isOpen).containerRef;
1050
+ var _d = useMemo(function () {
1051
+ return {
719
1052
  userGreeting: userName ? "Hello ".concat(userName, "!") : '',
720
- phoneNumber: countryCode && userMobileNumber ? "".concat(countryCode, " ").concat(userMobileNumber) : '',
721
- }); }, [userName, userMobileNumber, countryCode]), userGreeting = _d.userGreeting, phoneNumber = _d.phoneNumber;
722
- var generateRavenPayload = function (actionName) {
723
- var _a;
724
- return ({
725
- action_name: actionName.toLowerCase().replace(/[\s-]/g, '') + '_account_click',
726
- action_type: 'click',
727
- u_utm_source: (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic',
728
- loyalty_type: ravenLoyaltyTypes(loyaltyType),
729
- });
1053
+ phoneNumber: countryCode && userMobileNumber ? "".concat(countryCode, " ").concat(userMobileNumber) : ''
1054
+ };
1055
+ }, [userName, userMobileNumber, countryCode]),
1056
+ userGreeting = _d.userGreeting,
1057
+ phoneNumber = _d.phoneNumber;
1058
+ var generateRavenPayload = function (actionName) {
1059
+ var _a;
1060
+ return {
1061
+ action_name: actionName.toLowerCase().replace(/[\s-]/g, '') + '_account_click',
1062
+ action_type: 'click',
1063
+ u_utm_source: (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic',
1064
+ loyalty_type: ravenLoyaltyTypes(loyaltyType)
730
1065
  };
731
- var handleAccountOptionsClick = useCallback(function (text, redirectLink) {
732
- ravenSDKTrigger(isUserLoggedIn, ravenEventName, generateRavenPayload(text), ravenPayload, ravenPushCallback, ravenPageName);
733
- window.location.href = redirectLink;
734
- }, [isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
735
- useCallback(function () {
736
- ravenSDKTrigger(isUserLoggedIn, ravenEventName, generateRavenPayload(SIGN_OUT_TEXT), ravenPayload, ravenPushCallback, ravenPageName);
737
- handleLogoutClick();
738
- }, [isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName, handleLogoutClick]);
739
- var positionAccountOptionsDiv = useCallback(function () {
740
- var headerAccBtn = document.getElementById(HEADER_ACCOUNTS_OPTIONS_OPEN_BTN_ID);
741
- var accountOptionsElem = document.getElementById(ACCOUNT_OPTIONS_CONTAINER_ID);
742
- if (headerAccBtn && accountOptionsElem) {
743
- var headerBtnRight = headerAccBtn.getBoundingClientRect().right;
744
- accountOptionsElem.style.left = "".concat(headerBtnRight - ACCOUNT_OPTIONS_CONTAINER_WIDTH, "px");
745
- }
746
- }, []);
747
- useEffect(function () {
748
- positionAccountOptionsDiv();
749
- }, [positionAccountOptionsDiv]);
750
- var renderUserData = function () {
751
- var renderContent = function (loading, content, variant, color) { return (jsx(Typography, __assign({ variant: variant, color: color }, { children: loading ? (jsx(Container, { height: variant === 'HM3' ? '18px' : '12px', width: variant === 'HM3' ? '140px' : '200px', backgroundColor: '#efefef', borderRadius: '8px' })) : (content) }))); };
752
- return (jsx(Container, __assign({ display: 'flex', flexDirection: 'column', css: { gap: '4px' } }, { children: userGreeting ? (jsxs(Fragment, { children: [renderContent(userDetailsLoading, userGreeting, 'HM3', 'primary'), renderContent(userDetailsLoading, "".concat(LOGGEDIN_USER_TEXT, " ").concat(phoneNumber), 'P3', 'subheading')] })) : (jsxs(Fragment, { children: [renderContent(userDetailsLoading, LOGGEDIN_USER_TEXT, 'P3', 'subheading'), renderContent(userDetailsLoading, phoneNumber, 'HM3', 'primary')] })) })));
1066
+ };
1067
+ var handleAccountOptionsClick = useCallback(function (text, redirectLink) {
1068
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, generateRavenPayload(text), ravenPayload, ravenPushCallback, ravenPageName);
1069
+ window.location.href = redirectLink;
1070
+ }, [isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
1071
+ useCallback(function () {
1072
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, generateRavenPayload(SIGN_OUT_TEXT), ravenPayload, ravenPushCallback, ravenPageName);
1073
+ handleLogoutClick();
1074
+ }, [isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName, handleLogoutClick]);
1075
+ var positionAccountOptionsDiv = useCallback(function () {
1076
+ var headerAccBtn = document.getElementById(HEADER_ACCOUNTS_OPTIONS_OPEN_BTN_ID);
1077
+ var accountOptionsElem = document.getElementById(ACCOUNT_OPTIONS_CONTAINER_ID);
1078
+ if (headerAccBtn && accountOptionsElem) {
1079
+ var headerBtnRight = headerAccBtn.getBoundingClientRect().right;
1080
+ accountOptionsElem.style.left = "".concat(headerBtnRight - ACCOUNT_OPTIONS_CONTAINER_WIDTH, "px");
1081
+ }
1082
+ }, []);
1083
+ useEffect(function () {
1084
+ positionAccountOptionsDiv();
1085
+ }, [positionAccountOptionsDiv]);
1086
+ var renderUserData = function () {
1087
+ var renderContent = function (loading, content, variant, color) {
1088
+ return jsx(Typography, __assign({
1089
+ variant: variant,
1090
+ color: color
1091
+ }, {
1092
+ children: loading ? jsx(Container, {
1093
+ height: variant === 'HM3' ? '18px' : '12px',
1094
+ width: variant === 'HM3' ? '140px' : '200px',
1095
+ backgroundColor: '#efefef',
1096
+ borderRadius: '8px'
1097
+ }) : content
1098
+ }));
753
1099
  };
754
- return (jsxs(Container, __assign({ id: ACCOUNT_OPTIONS_CONTAINER_ID, ref: containerRef, display: 'flex', flexDirection: 'column', borderRadius: '16px', zIndex: 1002, top: '76px', position: 'fixed', css: { opacity: 0, overflow: 'hidden' }, width: "".concat(ACCOUNT_OPTIONS_CONTAINER_WIDTH, "px"), background: '#FFF1EC' }, { children: [jsx(Container, __assign({ padding: '16px', height: '76px' }, { children: renderUserData() })), jsx(RewardsSection, {}), jsxs(Container, __assign({ display: 'flex', flexDirection: 'column', padding: '8px', backgroundColor: 'white', rowGap: '8px', css: {
755
- borderBottomLeftRadius: 12,
756
- borderBottomRightRadius: 12,
757
- } }, { children: [ACCOUNT_OPTIONS_POPUP_CONFIG.map(function (_a) {
758
- var text = _a.text, icon = _a.icon, redirectionLink = _a.redirectionLink;
759
- return (jsx(Container, __assign({ padding: '8px', borderRadius: '8px', cursor: 'pointer', onClick: function () { return handleAccountOptionsClick(text, redirectionLink); }, css: accountOptionHoverStyles }, { children: jsxs(Container, __assign({ display: 'flex', cursor: 'pointer', css: { columnGap: '8px' } }, { children: [icon, jsx(Typography, __assign({ variant: 'P1', css: { display: 'flex', alignItems: 'center', cursor: 'pointer' } }, { children: text }))] })) }), "account-option-".concat(text)));
760
- }), jsx(Divider, { css: {
761
- borderBottom: '1px dashed #E6E6E6',
762
- } }), jsxs(Container, __assign({ display: 'flex', padding: '8px', borderRadius: '8px', cursor: 'pointer', columnGap: '8px', onClick: handleLogoutClick, css: logoutButtonHoverStyles }, { children: [jsx(Signout, { height: 24, width: 24 }), jsx(Typography, __assign({ variant: 'P1', css: { display: 'flex', alignItems: 'center', cursor: 'pointer' }, color: 'warning' }, { children: SIGN_OUT_TEXT }))] }))] }))] })));
1100
+ return jsx(Container, __assign({
1101
+ display: 'flex',
1102
+ flexDirection: 'column',
1103
+ css: {
1104
+ gap: '4px'
1105
+ }
1106
+ }, {
1107
+ children: userGreeting ? jsxs(Fragment, {
1108
+ children: [renderContent(userDetailsLoading, userGreeting, 'HM3', 'primary'), renderContent(userDetailsLoading, "".concat(LOGGEDIN_USER_TEXT, " ").concat(phoneNumber), 'P3', 'subheading')]
1109
+ }) : jsxs(Fragment, {
1110
+ children: [renderContent(userDetailsLoading, LOGGEDIN_USER_TEXT, 'P3', 'subheading'), renderContent(userDetailsLoading, phoneNumber, 'HM3', 'primary')]
1111
+ })
1112
+ }));
1113
+ };
1114
+ return jsxs(Container, __assign({
1115
+ id: ACCOUNT_OPTIONS_CONTAINER_ID,
1116
+ ref: containerRef,
1117
+ display: 'flex',
1118
+ flexDirection: 'column',
1119
+ borderRadius: '16px',
1120
+ zIndex: 1002,
1121
+ top: '76px',
1122
+ position: 'fixed',
1123
+ css: {
1124
+ opacity: 0,
1125
+ overflow: 'hidden'
1126
+ },
1127
+ width: "".concat(ACCOUNT_OPTIONS_CONTAINER_WIDTH, "px"),
1128
+ background: '#FFF1EC'
1129
+ }, {
1130
+ children: [jsx(Container, __assign({
1131
+ padding: '16px',
1132
+ height: '76px'
1133
+ }, {
1134
+ children: renderUserData()
1135
+ })), jsx(RewardsSection, {}), jsxs(Container, __assign({
1136
+ display: 'flex',
1137
+ flexDirection: 'column',
1138
+ padding: '8px',
1139
+ backgroundColor: 'white',
1140
+ rowGap: '8px',
1141
+ css: {
1142
+ borderBottomLeftRadius: 12,
1143
+ borderBottomRightRadius: 12
1144
+ }
1145
+ }, {
1146
+ children: [ACCOUNT_OPTIONS_POPUP_CONFIG.map(function (_a) {
1147
+ var text = _a.text,
1148
+ icon = _a.icon,
1149
+ redirectionLink = _a.redirectionLink;
1150
+ return jsx(Container, __assign({
1151
+ padding: '8px',
1152
+ borderRadius: '8px',
1153
+ cursor: 'pointer',
1154
+ onClick: function () {
1155
+ return handleAccountOptionsClick(text, redirectionLink);
1156
+ },
1157
+ css: accountOptionHoverStyles
1158
+ }, {
1159
+ children: jsxs(Container, __assign({
1160
+ display: 'flex',
1161
+ cursor: 'pointer',
1162
+ css: {
1163
+ columnGap: '8px'
1164
+ }
1165
+ }, {
1166
+ children: [icon, jsx(Typography, __assign({
1167
+ variant: 'P1',
1168
+ css: {
1169
+ display: 'flex',
1170
+ alignItems: 'center',
1171
+ cursor: 'pointer'
1172
+ }
1173
+ }, {
1174
+ children: text
1175
+ }))]
1176
+ }))
1177
+ }), "account-option-".concat(text));
1178
+ }), jsx(Divider, {
1179
+ css: {
1180
+ borderBottom: '1px dashed #E6E6E6'
1181
+ }
1182
+ }), jsxs(Container, __assign({
1183
+ display: 'flex',
1184
+ padding: '8px',
1185
+ borderRadius: '8px',
1186
+ cursor: 'pointer',
1187
+ columnGap: '8px',
1188
+ onClick: handleLogoutClick,
1189
+ css: logoutButtonHoverStyles
1190
+ }, {
1191
+ children: [jsx(Signout, {
1192
+ height: 24,
1193
+ width: 24
1194
+ }), jsx(Typography, __assign({
1195
+ variant: 'P1',
1196
+ css: {
1197
+ display: 'flex',
1198
+ alignItems: 'center',
1199
+ cursor: 'pointer'
1200
+ },
1201
+ color: 'warning'
1202
+ }, {
1203
+ children: SIGN_OUT_TEXT
1204
+ }))]
1205
+ }))]
1206
+ }))]
1207
+ }));
763
1208
  };
764
1209
 
765
1210
  var UserAccount = function () {
766
- var _a = useHeaderContext(), isNovacThemeEnabled = _a.isNovacThemeEnabled, ravenEventName = _a.ravenEventName, _b = _a.ravenPayload, ravenPayload = _b === void 0 ? {} : _b, ravenPushCallback = _a.ravenPushCallback, isUserLoggedIn = _a.isUserLoggedIn, loyaltyType = _a.loyaltyType, ravenPageName = _a.ravenPageName;
767
- var _c = useHoverDropdown({ openDelay: 0 }), isDropdownVisible = _c.isDropdownVisible, handleOnMouseEnter = _c.handleOnMouseEnter, handleOnMouseLeave = _c.handleOnMouseLeave, handleDropdownMouseEnter = _c.handleDropdownMouseEnter, handleDropdownMouseLeave = _c.handleDropdownMouseLeave;
768
- var _d = useState(false), scrolled = _d[0], setScrolled = _d[1];
769
- useEffect(function () {
770
- var handleScroll = function () {
771
- setScrolled(window.scrollY >= 50);
772
- };
773
- window.addEventListener('scroll', handleScroll);
774
- return function () { return window.removeEventListener('scroll', handleScroll); };
775
- }, []);
776
- var theme = isNovacThemeEnabled && !scrolled ? THEME_CONFIG.NOVAC : THEME_CONFIG.DEFAULT;
777
- var hoverColor = theme.hoverColor, typographyColor = theme.typographyColor;
778
- var triggerRavenEventOnHover = useCallback(function () {
779
- var _a;
780
- var utmSource = (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic';
781
- var defaultPayload = {
782
- action_name: "".concat(MY_ACCOUNT_TEXT.toLowerCase().replace(/[\s-]/g, ''), "_header_hover"),
783
- action_type: 'hover',
784
- u_utm_source: utmSource,
785
- loyalty_type: ravenLoyaltyTypes(loyaltyType),
786
- };
787
- ravenSDKTrigger(isUserLoggedIn, ravenEventName, defaultPayload, ravenPayload, ravenPushCallback, ravenPageName);
788
- }, [isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName, loyaltyType]);
789
- return (jsxs(Container, { children: [jsxs(Container, __assign({ display: 'flex', padding: '8px 12px', alignItems: 'center', borderRadius: '12px', height: '100%', cursor: 'pointer', css: { columnGap: 8, height: 64 }, onMouseEnter: function () {
790
- handleOnMouseEnter(0);
791
- triggerRavenEventOnHover();
792
- }, onMouseLeave: handleOnMouseLeave, id: HEADER_ACCOUNTS_OPTIONS_OPEN_BTN_ID }, { children: [jsx(MyAccount, { color: isDropdownVisible ? hoverColor : typographyColor }), jsxs(Container, __assign({ display: 'flex', flexDirection: 'row', alignItems: 'center' }, { children: [jsx(Typography, __assign({ variant: 'B2', css: { cursor: 'pointer' }, colorCode: isDropdownVisible ? hoverColor : typographyColor }, { children: MY_ACCOUNT_TEXT })), jsx(ChevronDown, { width: 20, height: 20, fill: isDropdownVisible ? hoverColor : typographyColor })] }))] })), jsx(HeaderAnimatedMask, __assign({ show: isDropdownVisible, marginTop: '64px', handleDropdownMouseEnter: handleDropdownMouseEnter, handleDropdownMouseLeave: handleDropdownMouseLeave, onMaskClick: handleDropdownMouseLeave }, { children: jsx(AccountDropdownContent, { isOpen: isDropdownVisible }) }))] }));
1211
+ var _a = useHeaderContext(),
1212
+ isNovacThemeEnabled = _a.isNovacThemeEnabled,
1213
+ ravenEventName = _a.ravenEventName,
1214
+ _b = _a.ravenPayload,
1215
+ ravenPayload = _b === void 0 ? {} : _b,
1216
+ ravenPushCallback = _a.ravenPushCallback,
1217
+ isUserLoggedIn = _a.isUserLoggedIn,
1218
+ loyaltyType = _a.loyaltyType,
1219
+ ravenPageName = _a.ravenPageName;
1220
+ var _c = useHoverDropdown({
1221
+ openDelay: 0
1222
+ }),
1223
+ isDropdownVisible = _c.isDropdownVisible,
1224
+ handleOnMouseEnter = _c.handleOnMouseEnter,
1225
+ handleOnMouseLeave = _c.handleOnMouseLeave,
1226
+ handleDropdownMouseEnter = _c.handleDropdownMouseEnter,
1227
+ handleDropdownMouseLeave = _c.handleDropdownMouseLeave;
1228
+ var _d = useState(false),
1229
+ scrolled = _d[0],
1230
+ setScrolled = _d[1];
1231
+ useEffect(function () {
1232
+ var handleScroll = function () {
1233
+ setScrolled(window.scrollY >= 50);
1234
+ };
1235
+ window.addEventListener('scroll', handleScroll);
1236
+ return function () {
1237
+ return window.removeEventListener('scroll', handleScroll);
1238
+ };
1239
+ }, []);
1240
+ var theme = isNovacThemeEnabled && !scrolled ? THEME_CONFIG.NOVAC : THEME_CONFIG.DEFAULT;
1241
+ var hoverColor = theme.hoverColor,
1242
+ typographyColor = theme.typographyColor;
1243
+ var triggerRavenEventOnHover = useCallback(function () {
1244
+ var _a;
1245
+ var utmSource = (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic';
1246
+ var defaultPayload = {
1247
+ action_name: "".concat(MY_ACCOUNT_TEXT.toLowerCase().replace(/[\s-]/g, ''), "_header_hover"),
1248
+ action_type: 'hover',
1249
+ u_utm_source: utmSource,
1250
+ loyalty_type: ravenLoyaltyTypes(loyaltyType)
1251
+ };
1252
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, defaultPayload, ravenPayload, ravenPushCallback, ravenPageName);
1253
+ }, [isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName, loyaltyType]);
1254
+ return jsxs(Container, {
1255
+ children: [jsxs(Container, __assign({
1256
+ display: 'flex',
1257
+ padding: '8px 12px',
1258
+ alignItems: 'center',
1259
+ borderRadius: '12px',
1260
+ height: '100%',
1261
+ cursor: 'pointer',
1262
+ css: {
1263
+ columnGap: 8,
1264
+ height: 64
1265
+ },
1266
+ onMouseEnter: function () {
1267
+ handleOnMouseEnter(0);
1268
+ triggerRavenEventOnHover();
1269
+ },
1270
+ onMouseLeave: handleOnMouseLeave,
1271
+ id: HEADER_ACCOUNTS_OPTIONS_OPEN_BTN_ID
1272
+ }, {
1273
+ children: [jsx(MyAccount, {
1274
+ color: isDropdownVisible ? hoverColor : typographyColor
1275
+ }), jsxs(Container, __assign({
1276
+ display: 'flex',
1277
+ flexDirection: 'row',
1278
+ alignItems: 'center'
1279
+ }, {
1280
+ children: [jsx(Typography, __assign({
1281
+ variant: 'B2',
1282
+ css: {
1283
+ cursor: 'pointer'
1284
+ },
1285
+ colorCode: isDropdownVisible ? hoverColor : typographyColor
1286
+ }, {
1287
+ children: MY_ACCOUNT_TEXT
1288
+ })), jsx(ChevronDown, {
1289
+ width: 20,
1290
+ height: 20,
1291
+ fill: isDropdownVisible ? hoverColor : typographyColor
1292
+ })]
1293
+ }))]
1294
+ })), jsx(HeaderAnimatedMask, __assign({
1295
+ show: isDropdownVisible,
1296
+ marginTop: '64px',
1297
+ handleDropdownMouseEnter: handleDropdownMouseEnter,
1298
+ handleDropdownMouseLeave: handleDropdownMouseLeave,
1299
+ onMaskClick: handleDropdownMouseLeave
1300
+ }, {
1301
+ children: jsx(AccountDropdownContent, {
1302
+ isOpen: isDropdownVisible
1303
+ })
1304
+ }))]
1305
+ });
793
1306
  };
794
1307
 
795
1308
  var Header = function (props) {
796
- return (jsx(HeaderProvider, __assign({ value: props }, { children: jsx(HeaderContent, {}) })));
1309
+ return jsx(HeaderProvider, __assign({
1310
+ value: props
1311
+ }, {
1312
+ children: jsx(HeaderContent, {})
1313
+ }));
797
1314
  };
798
1315
  var HeaderContent = function () {
799
- var _a;
800
- var _b = useHeaderContext(), onLoginButtonClick = _b.onLoginButtonClick, _c = _b.showAllLobs, showAllLobs = _c === void 0 ? false : _c, isUserLoggedIn = _b.isUserLoggedIn, loyaltyType = _b.loyaltyType, _d = _b.isNovacThemeEnabled, isNovacThemeEnabled = _d === void 0 ? false : _d, _e = _b.ravenPayload, ravenPayload = _e === void 0 ? {} : _e, ravenPushCallback = _b.ravenPushCallback, ravenPageName = _b.ravenPageName, ravenEventName = _b.ravenEventName;
801
- var _f = useState(false), scrolled = _f[0], setScrolled = _f[1];
802
- useEffect(function () {
803
- var handleScroll = function () {
804
- setScrolled(window.scrollY >= 50);
805
- };
806
- window.addEventListener('scroll', handleScroll);
807
- return function () { return window.removeEventListener('scroll', handleScroll); };
808
- }, []);
809
- var headerTheme = isNovacThemeEnabled && !scrolled ? THEME_CONFIG.NOVAC : THEME_CONFIG.DEFAULT;
810
- var headerBackground = headerTheme.headerBackground, logoFill = headerTheme.logoFill, loginButtonColorVariant = headerTheme.loginButtonColorVariant, hoverColor = headerTheme.hoverColor, fkcompanyColor = headerTheme.fkcompanyColor, typographyColor = headerTheme.typographyColor;
811
- var _g = useHoverDropdown({
812
- openDelay: 0,
813
- }), isDropdownVisible = _g.isDropdownVisible, hoveredElemIndex = _g.hoveredElemIndex, handleOnMouseEnter = _g.handleOnMouseEnter, handleOnMouseLeave = _g.handleOnMouseLeave, handleDropdownMouseEnter = _g.handleDropdownMouseEnter, handleDropdownMouseLeave = _g.handleDropdownMouseLeave;
814
- var utmSource = (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic';
815
- var createPayload = useCallback(function (actionName, actionType) { return ({
816
- action_name: actionName,
817
- action_type: actionType,
818
- u_utm_source: utmSource,
819
- loyalty_type: ravenLoyaltyTypes(loyaltyType),
820
- }); }, [utmSource, loyaltyType]);
821
- var handleNavbarOptionsClick = useCallback(function (option) {
822
- if (option.isClickable && option.link) {
823
- var actionName = "".concat(option.text.toLowerCase().replace(/\s/g, ''), "_header_click");
824
- var payload = createPayload(actionName, 'click');
825
- ravenSDKTrigger(isUserLoggedIn, ravenEventName, payload, ravenPayload, ravenPushCallback, ravenPageName);
826
- window.location.href = option.link;
1316
+ var _a;
1317
+ var _b = useHeaderContext(),
1318
+ onLoginButtonClick = _b.onLoginButtonClick,
1319
+ _c = _b.showAllLobs,
1320
+ showAllLobs = _c === void 0 ? false : _c,
1321
+ isUserLoggedIn = _b.isUserLoggedIn,
1322
+ loyaltyType = _b.loyaltyType,
1323
+ _d = _b.isNovacThemeEnabled,
1324
+ isNovacThemeEnabled = _d === void 0 ? false : _d,
1325
+ _e = _b.ravenPayload,
1326
+ ravenPayload = _e === void 0 ? {} : _e,
1327
+ ravenPushCallback = _b.ravenPushCallback,
1328
+ ravenPageName = _b.ravenPageName,
1329
+ ravenEventName = _b.ravenEventName;
1330
+ var _f = useState(false),
1331
+ scrolled = _f[0],
1332
+ setScrolled = _f[1];
1333
+ useEffect(function () {
1334
+ var handleScroll = function () {
1335
+ setScrolled(window.scrollY >= 50);
1336
+ };
1337
+ window.addEventListener('scroll', handleScroll);
1338
+ return function () {
1339
+ return window.removeEventListener('scroll', handleScroll);
1340
+ };
1341
+ }, []);
1342
+ var headerTheme = isNovacThemeEnabled && !scrolled ? THEME_CONFIG.NOVAC : THEME_CONFIG.DEFAULT;
1343
+ var headerBackground = headerTheme.headerBackground,
1344
+ logoFill = headerTheme.logoFill,
1345
+ loginButtonColorVariant = headerTheme.loginButtonColorVariant,
1346
+ hoverColor = headerTheme.hoverColor,
1347
+ fkcompanyColor = headerTheme.fkcompanyColor,
1348
+ typographyColor = headerTheme.typographyColor;
1349
+ var _g = useHoverDropdown({
1350
+ openDelay: 0
1351
+ }),
1352
+ isDropdownVisible = _g.isDropdownVisible,
1353
+ hoveredElemIndex = _g.hoveredElemIndex,
1354
+ handleOnMouseEnter = _g.handleOnMouseEnter,
1355
+ handleOnMouseLeave = _g.handleOnMouseLeave,
1356
+ handleDropdownMouseEnter = _g.handleDropdownMouseEnter,
1357
+ handleDropdownMouseLeave = _g.handleDropdownMouseLeave;
1358
+ var utmSource = (_a = getQueryParam('utm_source')) !== null && _a !== void 0 ? _a : 'organic';
1359
+ var createPayload = useCallback(function (actionName, actionType) {
1360
+ return {
1361
+ action_name: actionName,
1362
+ action_type: actionType,
1363
+ u_utm_source: utmSource,
1364
+ loyalty_type: ravenLoyaltyTypes(loyaltyType)
1365
+ };
1366
+ }, [utmSource, loyaltyType]);
1367
+ var handleNavbarOptionsClick = useCallback(function (option) {
1368
+ if (option.isClickable && option.link) {
1369
+ var actionName = "".concat(option.text.toLowerCase().replace(/\s/g, ''), "_header_click");
1370
+ var payload = createPayload(actionName, 'click');
1371
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, payload, ravenPayload, ravenPushCallback, ravenPageName);
1372
+ window.location.href = option.link;
1373
+ }
1374
+ }, [createPayload, isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
1375
+ var handleHomeClick = useCallback(function () {
1376
+ var payload = createPayload('home_header_click', 'click');
1377
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, payload, ravenPayload, ravenPushCallback, ravenPageName);
1378
+ window.location.href = '/';
1379
+ }, [createPayload, isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
1380
+ var triggerRavenEventOnHover = useCallback(function (option) {
1381
+ var actionName = "".concat(option.text.toLowerCase().replace(/\s/g, ''), "_header_hover");
1382
+ var payload = createPayload(actionName, 'hover');
1383
+ ravenSDKTrigger(isUserLoggedIn, ravenEventName, payload, ravenPayload, ravenPushCallback, ravenPageName);
1384
+ }, [createPayload, isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
1385
+ return jsxs(Fragment, {
1386
+ children: [jsx(Container, __assign({
1387
+ display: 'flex',
1388
+ top: 0,
1389
+ position: 'sticky',
1390
+ width: '100%',
1391
+ alignItems: 'center',
1392
+ justifyContent: 'center',
1393
+ zIndex: 1000,
1394
+ height: '64px',
1395
+ background: headerBackground,
1396
+ css: {
1397
+ gap: '24px',
1398
+ flexShrink: 0,
1399
+ borderBottom: headerBackground === 'transparent' ? '' : '1px solid #E6E6E6',
1400
+ transition: 'background-color 0.3s ease-in-out, border-bottom 0.3s ease-in-out'
1401
+ }
1402
+ }, {
1403
+ children: jsxs(Container, __assign({
1404
+ display: 'flex',
1405
+ alignItems: 'center',
1406
+ justifyContent: 'space-between',
1407
+ padding: '0 28px',
1408
+ flex: 1,
1409
+ css: {
1410
+ gap: '24px',
1411
+ maxWidth: 1440
827
1412
  }
828
- }, [createPayload, isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
829
- var handleHomeClick = useCallback(function () {
830
- var payload = createPayload('home_header_click', 'click');
831
- ravenSDKTrigger(isUserLoggedIn, ravenEventName, payload, ravenPayload, ravenPushCallback, ravenPageName);
832
- window.location.href = '/';
833
- }, [createPayload, isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
834
- var triggerRavenEventOnHover = useCallback(function (option) {
835
- var actionName = "".concat(option.text.toLowerCase().replace(/\s/g, ''), "_header_hover");
836
- var payload = createPayload(actionName, 'hover');
837
- ravenSDKTrigger(isUserLoggedIn, ravenEventName, payload, ravenPayload, ravenPushCallback, ravenPageName);
838
- }, [createPayload, isUserLoggedIn, ravenEventName, ravenPayload, ravenPushCallback, ravenPageName]);
839
- return (jsxs(Fragment, { children: [jsx(Container, __assign({ display: 'flex', top: 0, position: 'sticky', width: '100%', alignItems: 'center', justifyContent: 'center', zIndex: 1000, height: '64px', background: headerBackground, css: {
840
- gap: '24px',
841
- flexShrink: 0,
842
- borderBottom: headerBackground === 'transparent' ? '' : '1px solid #E6E6E6',
843
- transition: 'background-color 0.3s ease-in-out, border-bottom 0.3s ease-in-out',
844
- } }, { children: jsxs(Container, __assign({ display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '0 28px', flex: 1, css: {
845
- gap: '24px',
846
- maxWidth: 1440,
847
- } }, { children: [jsxs(Container, __assign({ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'center', cursor: 'pointer', onClick: handleHomeClick }, { children: [jsx(CTLogo, { fillColor: logoFill }), jsx(Divider, { css: {
848
- width: 12,
849
- marginLeft: 2,
850
- marginRight: 2,
851
- transform: 'rotate(90deg)',
852
- borderBottom: '1px solid #e0e0e0',
853
- } }), jsx(Fkcompany, { color: fkcompanyColor })] })), jsxs(Container, __assign({ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'center', columnGap: '24px' }, { children: [jsx(Container, __assign({ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'center', columnGap: '4px' }, { children: NAVBAR_OPTIONS.map(function (option, index) {
854
- var text = option.text, LeftIcon = option.lefticon, RightIcon = option.rightIcon, isHoverable = option.isHoverable;
855
- var isHovered = hoveredElemIndex === index;
856
- return (jsxs(Container, { children: [jsxs(Container, __assign({ onMouseEnter: function () {
857
- handleOnMouseEnter(index);
858
- if (option.isHoverable) {
859
- triggerRavenEventOnHover(option);
860
- }
861
- }, onMouseLeave: handleOnMouseLeave, display: 'flex', flexDirection: 'row', alignItems: 'center', padding: '8px 12px 8px 12px', cursor: 'pointer', position: 'relative', columnGap: 8, height: '64px', onClick: function () { return handleNavbarOptionsClick(option); } }, { children: [jsx(LeftIcon, { color: isHovered ? hoverColor : typographyColor }), jsxs(Container, __assign({ display: 'flex', flexDirection: 'row', alignItems: 'center' }, { children: [jsx(Typography, __assign({ variant: 'B2', colorCode: isHovered ? hoverColor : typographyColor, isClickable: true }, { children: text })), RightIcon && (jsx(RightIcon, { width: 20, height: 20, fill: isHovered ? hoverColor : typographyColor }))] }))] }), "nav-option-".concat(index)), jsx(HeaderAnimatedMask, __assign({ show: hoveredElemIndex === index && isHoverable && isDropdownVisible, marginTop: '64px', handleDropdownMouseEnter: handleDropdownMouseEnter, handleDropdownMouseLeave: handleDropdownMouseLeave, onMaskClick: handleDropdownMouseLeave }, { children: jsx(BusinessDropdownContent, { isOpen: hoveredElemIndex === index && isHoverable && isDropdownVisible }) }))] }));
862
- }) })), isUserLoggedIn && (jsx(Divider, { css: {
863
- width: 12,
864
- margin: '0 -18px',
865
- transform: 'rotate(90deg)',
866
- borderBottom: '1px solid #e0e0e0',
867
- } })), jsx(Container, { children: isUserLoggedIn ? (jsx(Container, __assign({ display: 'flex', flexDirection: 'row', alignItems: 'center' }, { children: jsx(UserAccount, {}) }))) : (jsx(Button, __assign({ onClick: onLoginButtonClick, css: __assign({ width: 153, height: 40 }, getLoginButtonBgColorStyles(headerBackground === 'transparent')), loading: false, color: loginButtonColorVariant, variant: ButtonVariant.OUTLINE }, { children: LOG_IN_TEXT }))) })] }))] })) })), showAllLobs && jsx(LobsHeader, {})] }));
1413
+ }, {
1414
+ children: [jsxs(Container, __assign({
1415
+ display: 'flex',
1416
+ flexDirection: 'row',
1417
+ alignItems: 'center',
1418
+ justifyContent: 'center',
1419
+ cursor: 'pointer',
1420
+ onClick: handleHomeClick
1421
+ }, {
1422
+ children: [jsx(CTLogo, {
1423
+ fillColor: logoFill
1424
+ }), jsx(Divider, {
1425
+ css: {
1426
+ width: 12,
1427
+ marginLeft: 2,
1428
+ marginRight: 2,
1429
+ transform: 'rotate(90deg)',
1430
+ borderBottom: '1px solid #e0e0e0'
1431
+ }
1432
+ }), jsx(Fkcompany, {
1433
+ color: fkcompanyColor
1434
+ })]
1435
+ })), jsxs(Container, __assign({
1436
+ display: 'flex',
1437
+ flexDirection: 'row',
1438
+ alignItems: 'center',
1439
+ justifyContent: 'center',
1440
+ columnGap: '24px'
1441
+ }, {
1442
+ children: [jsx(Container, __assign({
1443
+ display: 'flex',
1444
+ flexDirection: 'row',
1445
+ alignItems: 'center',
1446
+ justifyContent: 'center',
1447
+ columnGap: '4px'
1448
+ }, {
1449
+ children: NAVBAR_OPTIONS.map(function (option, index) {
1450
+ var text = option.text,
1451
+ LeftIcon = option.lefticon,
1452
+ RightIcon = option.rightIcon,
1453
+ isHoverable = option.isHoverable;
1454
+ var isHovered = hoveredElemIndex === index;
1455
+ return jsxs(Container, {
1456
+ children: [jsxs(Container, __assign({
1457
+ onMouseEnter: function () {
1458
+ handleOnMouseEnter(index);
1459
+ if (option.isHoverable) {
1460
+ triggerRavenEventOnHover(option);
1461
+ }
1462
+ },
1463
+ onMouseLeave: handleOnMouseLeave,
1464
+ display: 'flex',
1465
+ flexDirection: 'row',
1466
+ alignItems: 'center',
1467
+ padding: '8px 12px 8px 12px',
1468
+ cursor: 'pointer',
1469
+ position: 'relative',
1470
+ columnGap: 8,
1471
+ height: '64px',
1472
+ onClick: function () {
1473
+ return handleNavbarOptionsClick(option);
1474
+ }
1475
+ }, {
1476
+ children: [jsx(LeftIcon, {
1477
+ color: isHovered ? hoverColor : typographyColor
1478
+ }), jsxs(Container, __assign({
1479
+ display: 'flex',
1480
+ flexDirection: 'row',
1481
+ alignItems: 'center'
1482
+ }, {
1483
+ children: [jsx(Typography, __assign({
1484
+ variant: 'B2',
1485
+ colorCode: isHovered ? hoverColor : typographyColor,
1486
+ isClickable: true
1487
+ }, {
1488
+ children: text
1489
+ })), RightIcon && jsx(RightIcon, {
1490
+ width: 20,
1491
+ height: 20,
1492
+ fill: isHovered ? hoverColor : typographyColor
1493
+ })]
1494
+ }))]
1495
+ }), "nav-option-".concat(index)), jsx(HeaderAnimatedMask, __assign({
1496
+ show: hoveredElemIndex === index && isHoverable && isDropdownVisible,
1497
+ marginTop: '64px',
1498
+ handleDropdownMouseEnter: handleDropdownMouseEnter,
1499
+ handleDropdownMouseLeave: handleDropdownMouseLeave,
1500
+ onMaskClick: handleDropdownMouseLeave
1501
+ }, {
1502
+ children: jsx(BusinessDropdownContent, {
1503
+ isOpen: hoveredElemIndex === index && isHoverable && isDropdownVisible
1504
+ })
1505
+ }))]
1506
+ });
1507
+ })
1508
+ })), isUserLoggedIn && jsx(Divider, {
1509
+ css: {
1510
+ width: 12,
1511
+ margin: '0 -18px',
1512
+ transform: 'rotate(90deg)',
1513
+ borderBottom: '1px solid #e0e0e0'
1514
+ }
1515
+ }), jsx(Container, {
1516
+ children: isUserLoggedIn ? jsx(Container, __assign({
1517
+ display: 'flex',
1518
+ flexDirection: 'row',
1519
+ alignItems: 'center'
1520
+ }, {
1521
+ children: jsx(UserAccount, {})
1522
+ })) : jsx(Button, __assign({
1523
+ onClick: onLoginButtonClick,
1524
+ css: __assign({
1525
+ width: 153,
1526
+ height: 40
1527
+ }, getLoginButtonBgColorStyles(headerBackground === 'transparent')),
1528
+ loading: false,
1529
+ color: loginButtonColorVariant,
1530
+ variant: ButtonVariant.OUTLINE
1531
+ }, {
1532
+ children: LOG_IN_TEXT
1533
+ }))
1534
+ })]
1535
+ }))]
1536
+ }))
1537
+ })), showAllLobs && jsx(LobsHeader, {})]
1538
+ });
868
1539
  };
869
1540
 
870
1541
  export { Header, LOBS_VALUES, LoyaltyType, RAVEN_PAGE_NAMES };