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