@cleartrip/ct-design-header 1.2.0-SNAPSHOT-snapshot-anim.0 → 1.2.0-SNAPSHOT-styled-header-test.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.
@@ -9,347 +9,492 @@ var ctDesignDivider = require('@cleartrip/ct-design-divider');
9
9
  var ctDesignIcons = require('@cleartrip/ct-design-icons');
10
10
  var react = require('react');
11
11
  var ctDesignShimmer = require('@cleartrip/ct-design-shimmer');
12
+ var styled = require('styled-components');
13
+
14
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
15
+
16
+ var styled__default = /*#__PURE__*/_interopDefault(styled);
12
17
 
13
18
  var OFFERS_URL = 'all-offers/?categories=flights';
14
19
  var MY_TRIPS_URL = '/account/trips';
15
20
  var SUPPORT_URL = '/support';
16
- var NAVBAR_OPTIONS = [
17
- {
18
- lefticon: ctDesignIcons.Offers,
19
- text: 'Offers',
20
- isHoverable: false,
21
- isClickable: true,
22
- link: OFFERS_URL,
23
- },
24
- {
25
- lefticon: ctDesignIcons.BusinessBag,
26
- text: 'Business',
27
- rightIcon: ctDesignIcons.ChevronDown,
28
- isHoverable: true,
29
- },
30
- {
31
- lefticon: ctDesignIcons.MyTrips,
32
- text: 'My Trips',
33
- isHoverable: false,
34
- isClickable: true,
35
- link: MY_TRIPS_URL,
36
- },
37
- {
38
- lefticon: ctDesignIcons.SupportIcon,
39
- text: 'Support',
40
- isHoverable: false,
41
- isClickable: true,
42
- link: SUPPORT_URL,
43
- },
44
- ];
21
+ var NAVBAR_OPTIONS = [{
22
+ lefticon: ctDesignIcons.Offers,
23
+ text: 'Offers',
24
+ isHoverable: false,
25
+ isClickable: true,
26
+ link: OFFERS_URL
27
+ }, {
28
+ lefticon: ctDesignIcons.BusinessBag,
29
+ text: 'Business',
30
+ rightIcon: ctDesignIcons.ChevronDown,
31
+ isHoverable: true
32
+ }, {
33
+ lefticon: ctDesignIcons.MyTrips,
34
+ text: 'My Trips',
35
+ isHoverable: false,
36
+ isClickable: true,
37
+ link: MY_TRIPS_URL
38
+ }, {
39
+ lefticon: ctDesignIcons.SupportIcon,
40
+ text: 'Support',
41
+ isHoverable: false,
42
+ isClickable: true,
43
+ link: SUPPORT_URL
44
+ }];
45
45
  var LOBS = {
46
- FLIGHTS: 'Flights',
47
- HOTELS: 'Hotels',
48
- TRAIN: 'Trains',
49
- PACKAGES: 'Packages',
50
- BUSES: 'Buses',
46
+ FLIGHTS: 'Flights',
47
+ HOTELS: 'Hotels',
48
+ TRAIN: 'Trains',
49
+ PACKAGES: 'Packages',
50
+ BUSES: 'Buses'
51
51
  };
52
- var LOB_DATA = [
53
- {
54
- title: LOBS.FLIGHTS,
55
- image: 'https://rukmini-ct.flixcart.com/f_auto,w_48,h_48,dpr_2/offermgmt-prod/offermgmt/images/banner/flight_uhp.png?cache=true',
56
- link: '/flights',
57
- },
58
- {
59
- title: LOBS.HOTELS,
60
- image: 'https://rukmini-ct.flixcart.com/f_auto,w_48,h_48,dpr_2/offermgmt-prod/offermgmt/images/banner/hotel_uhp.png?cache=true',
61
- link: '/hotels',
62
- },
63
- {
64
- title: LOBS.BUSES,
65
- image: 'https://rukmini-ct.flixcart.com/f_auto,w_40,h_40,dpr_2/offermgmt-prod/offermgmt/images/banner/bus_uhp.png?cache=true',
66
- link: '/bus',
67
- },
68
- {
69
- title: LOBS.TRAIN,
70
- image: 'https://rukmini-ct.flixcart.com/f_auto,w_40,h_40,dpr_2/offermgmt-prod/offermgmt/images/banner/train_uhp.png?cache=true',
71
- link: '/',
72
- },
73
- {
74
- title: LOBS.PACKAGES,
75
- image: 'https://rukmini-ct.flixcart.com/f_auto,w_40,h_40,dpr_2/offermgmt-prod/offermgmt/images/banner/holiday_uhp.png?cache=true',
76
- link: '/#',
77
- },
78
- ];
79
- var bdConfig = [
80
- {
81
- title: 'AgentBox',
82
- subtitle: 'For travel agents',
83
- details: 'One-stop travel solution offering the best deals to our travel agency partners',
84
- },
85
- {
86
- title: 'OutOfOffice',
87
- subtitle: 'For startups, corporates and SMEs',
88
- details: 'Manage corporate business travel, smartly',
89
- },
90
- {
91
- title: 'MICE',
92
- subtitle: 'For corporate events',
93
- details: 'An end-to-end management solution for all your corporate events',
94
- },
95
- {
96
- title: 'API',
97
- subtitle: 'For developers',
98
- details: 'Unlock seamless integration and scale with our powerful, reliable APIs',
99
- },
100
- ];
52
+ var LOB_DATA = [{
53
+ title: LOBS.FLIGHTS,
54
+ image: 'https://rukmini-ct.flixcart.com/f_auto,w_48,h_48,dpr_2/offermgmt-prod/offermgmt/images/banner/flight_uhp.png?cache=true',
55
+ link: '/flights'
56
+ }, {
57
+ title: LOBS.HOTELS,
58
+ image: 'https://rukmini-ct.flixcart.com/f_auto,w_48,h_48,dpr_2/offermgmt-prod/offermgmt/images/banner/hotel_uhp.png?cache=true',
59
+ link: '/hotels'
60
+ }, {
61
+ title: LOBS.BUSES,
62
+ image: 'https://rukmini-ct.flixcart.com/f_auto,w_40,h_40,dpr_2/offermgmt-prod/offermgmt/images/banner/bus_uhp.png?cache=true',
63
+ link: '/bus'
64
+ }, {
65
+ title: LOBS.TRAIN,
66
+ image: 'https://rukmini-ct.flixcart.com/f_auto,w_40,h_40,dpr_2/offermgmt-prod/offermgmt/images/banner/train_uhp.png?cache=true',
67
+ link: '/'
68
+ }, {
69
+ title: LOBS.PACKAGES,
70
+ image: 'https://rukmini-ct.flixcart.com/f_auto,w_40,h_40,dpr_2/offermgmt-prod/offermgmt/images/banner/holiday_uhp.png?cache=true',
71
+ link: '/#'
72
+ }];
73
+ var bdConfig = [{
74
+ title: 'AgentBox',
75
+ subtitle: 'For travel agents',
76
+ details: 'One-stop travel solution offering the best deals to our travel agency partners'
77
+ }, {
78
+ title: 'OutOfOffice',
79
+ subtitle: 'For startups, corporates and SMEs',
80
+ details: 'Manage corporate business travel, smartly'
81
+ }, {
82
+ title: 'MICE',
83
+ subtitle: 'For corporate events',
84
+ details: 'An end-to-end management solution for all your corporate events'
85
+ }, {
86
+ title: 'API',
87
+ subtitle: 'For developers',
88
+ details: 'Unlock seamless integration and scale with our powerful, reliable APIs'
89
+ }];
101
90
  var BUSINESS_DROPDOWN_HEADING = 'Other business services';
102
91
 
103
92
  var LobsHeader = function (_a) {
104
- var selectedLOB = _a.selectedLOB;
105
- return (jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({ className: 'flex p-4 flex-middle flex-center p-sticky', css: {
106
- gap: 40,
107
- height: 64,
108
- background: ' #F3F5FA',
109
- top: 64,
110
- zIndex: 2,
111
- } }, { children: LOB_DATA.map(function (item, index) {
112
- return (jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({ className: 'flex flex-middle c-pointer', css: {
113
- gap: 8,
114
- background: selectedLOB === item.title ? '#FFFFFF' : 'transparent',
115
- borderRadius: selectedLOB === item.title ? '40px' : '0',
116
- padding: selectedLOB === item.title ? '8px 16px 8px 8px' : '0',
117
- }, onClick: function () {
118
- window.location.href = item.link;
119
- } }, { children: [jsxRuntime.jsx("img", { src: item.image, alt: item.title, width: 32, height: 32 }), jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ variant: 'P1', style: { fontWeight: selectedLOB === item.title ? 600 : 500 }, isClickable: true }, { children: item.title }))] }), index));
120
- }) })));
93
+ var selectedLOB = _a.selectedLOB;
94
+ return jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({
95
+ className: 'flex p-4 flex-middle flex-center p-sticky',
96
+ css: {
97
+ gap: 40,
98
+ height: 64,
99
+ background: ' #F3F5FA',
100
+ top: 64,
101
+ zIndex: 2
102
+ }
103
+ }, {
104
+ children: LOB_DATA.map(function (item, index) {
105
+ return jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
106
+ className: 'flex flex-middle c-pointer',
107
+ css: {
108
+ gap: 8,
109
+ background: selectedLOB === item.title ? '#FFFFFF' : 'transparent',
110
+ borderRadius: selectedLOB === item.title ? '40px' : '0',
111
+ padding: selectedLOB === item.title ? '8px 16px 8px 8px' : '0'
112
+ },
113
+ onClick: function () {
114
+ window.location.href = item.link;
115
+ }
116
+ }, {
117
+ children: [jsxRuntime.jsx("img", {
118
+ src: item.image,
119
+ alt: item.title,
120
+ width: 32,
121
+ height: 32
122
+ }), jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({
123
+ variant: 'P1',
124
+ style: {
125
+ fontWeight: selectedLOB === item.title ? 600 : 500
126
+ },
127
+ isClickable: true
128
+ }, {
129
+ children: item.title
130
+ }))]
131
+ }), index);
132
+ })
133
+ }));
121
134
  };
122
135
 
123
136
  var useDelayedUnmount = function (show, unmountDelay) {
124
- var _a = react.useState(show), showComponent = _a[0], setShowComponent = _a[1];
125
- var timerRef = react.useRef();
126
- react.useEffect(function () {
127
- if (!show) {
128
- timerRef.current = setTimeout(function () {
129
- setShowComponent(false);
130
- }, unmountDelay);
131
- }
132
- else {
133
- setShowComponent(show);
134
- }
135
- return function () {
136
- (timerRef === null || timerRef === void 0 ? void 0 : timerRef.current) && clearTimeout(timerRef.current);
137
- };
138
- }, [show]);
139
- return showComponent;
137
+ var _a = react.useState(show),
138
+ showComponent = _a[0],
139
+ setShowComponent = _a[1];
140
+ var timerRef = react.useRef();
141
+ react.useEffect(function () {
142
+ if (!show) {
143
+ timerRef.current = setTimeout(function () {
144
+ setShowComponent(false);
145
+ }, unmountDelay);
146
+ } else {
147
+ setShowComponent(show);
148
+ }
149
+ return function () {
150
+ (timerRef === null || timerRef === void 0 ? void 0 : timerRef.current) && clearTimeout(timerRef.current);
151
+ };
152
+ }, [show]);
153
+ return showComponent;
140
154
  };
141
155
  var useMountTransition = function (isMounted, unmountDelay) {
142
- var _a = react.useState(false), hasTransitionedIn = _a[0], setHasTransitionedIn = _a[1];
143
- var timeoutIdRef = react.useRef();
144
- react.useEffect(function () {
145
- if (isMounted && !hasTransitionedIn) {
146
- setTimeout(function () {
147
- setHasTransitionedIn(true);
148
- }, 0);
149
- }
150
- else if (!isMounted && hasTransitionedIn) {
151
- timeoutIdRef.current = setTimeout(function () { return setHasTransitionedIn(false); }, unmountDelay);
152
- }
153
- return function () {
154
- if (timeoutIdRef && timeoutIdRef.current) {
155
- clearTimeout(timeoutIdRef.current);
156
- }
157
- };
158
- }, [unmountDelay, isMounted]);
159
- return hasTransitionedIn;
156
+ var _a = react.useState(false),
157
+ hasTransitionedIn = _a[0],
158
+ setHasTransitionedIn = _a[1];
159
+ var timeoutIdRef = react.useRef();
160
+ react.useEffect(function () {
161
+ if (isMounted && !hasTransitionedIn) {
162
+ setTimeout(function () {
163
+ setHasTransitionedIn(true);
164
+ }, 0);
165
+ } else if (!isMounted && hasTransitionedIn) {
166
+ timeoutIdRef.current = setTimeout(function () {
167
+ return setHasTransitionedIn(false);
168
+ }, unmountDelay);
169
+ }
170
+ return function () {
171
+ if (timeoutIdRef && timeoutIdRef.current) {
172
+ clearTimeout(timeoutIdRef.current);
173
+ }
174
+ };
175
+ }, [unmountDelay, isMounted]);
176
+ return hasTransitionedIn;
160
177
  };
161
178
 
162
179
  function HeaderAnimatedMask(_a) {
163
- var children = _a.children, onMaskClick = _a.onMaskClick, show = _a.show, marginTop = _a.marginTop, handleDropdownMouseEnter = _a.handleDropdownMouseEnter, handleDropdownMouseLeave = _a.handleDropdownMouseLeave;
164
- react.useEffect(function () {
165
- if (show) {
166
- document.body.style.overflow = 'hidden';
167
- }
168
- return function () {
169
- document.body.style.overflow = 'initial';
170
- };
171
- }, [show]);
172
- var showFlagProxy = useDelayedUnmount(show, 300);
173
- var triggerTransition = useMountTransition(show, 100);
174
- var triggerOpenTransition = triggerTransition;
175
- console.log(show, showFlagProxy, 'custom hook');
176
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [showFlagProxy && (jsxRuntime.jsx(ctDesignContainer.Container, { id: 'mask-container', css: {
177
- position: 'fixed',
178
- backgroundColor: '#000',
179
- opacity: triggerOpenTransition ? 0.4 : 0,
180
- width: '100%',
181
- height: '100vh',
182
- left: 0,
183
- top: marginTop || 0,
184
- zIndex: 9,
185
- transition: 'opacity 300ms ease-in',
186
- }, onClick: onMaskClick })), showFlagProxy && (jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({ onMouseEnter: handleDropdownMouseEnter, onMouseLeave: handleDropdownMouseLeave }, { children: children })))] }));
180
+ var children = _a.children,
181
+ onMaskClick = _a.onMaskClick,
182
+ show = _a.show,
183
+ marginTop = _a.marginTop,
184
+ handleDropdownMouseEnter = _a.handleDropdownMouseEnter,
185
+ handleDropdownMouseLeave = _a.handleDropdownMouseLeave;
186
+ react.useEffect(function () {
187
+ if (show) {
188
+ document.body.style.overflow = 'hidden';
189
+ }
190
+ return function () {
191
+ document.body.style.overflow = 'initial';
192
+ };
193
+ }, [show]);
194
+ var showFlagProxy = useDelayedUnmount(show, 300);
195
+ var triggerTransition = useMountTransition(show, 100);
196
+ var triggerOpenTransition = triggerTransition;
197
+ console.log(show, showFlagProxy, 'custom hook');
198
+ return jsxRuntime.jsxs(jsxRuntime.Fragment, {
199
+ children: [showFlagProxy && jsxRuntime.jsx(ctDesignContainer.Container, {
200
+ id: 'mask-container',
201
+ css: {
202
+ position: 'fixed',
203
+ backgroundColor: '#000',
204
+ opacity: triggerOpenTransition ? 0.4 : 0,
205
+ width: '100%',
206
+ height: '100vh',
207
+ left: 0,
208
+ top: marginTop || 0,
209
+ zIndex: 9,
210
+ transition: 'opacity 300ms ease-in'
211
+ },
212
+ onClick: onMaskClick
213
+ }), showFlagProxy && jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({
214
+ onMouseEnter: handleDropdownMouseEnter,
215
+ onMouseLeave: handleDropdownMouseLeave
216
+ }, {
217
+ children: children
218
+ }))]
219
+ });
187
220
  }
188
221
 
189
222
  var MIN_CLOSE_DELAY = 150;
190
223
  var useHoverDropdown = function (_a) {
191
- var _b = _a === void 0 ? {} : _a, _c = _b.closeDelay, closeDelayArg = _c === void 0 ? 300 : _c, _d = _b.openDelay, openDelay = _d === void 0 ? 500 : _d;
192
- var closeDelay = Math.max(closeDelayArg, MIN_CLOSE_DELAY);
193
- var _e = react.useState(false), isDropdownVisible = _e[0], setIsDropdownVisible = _e[1];
194
- var _f = react.useState(null), hoveredElemIndex = _f[0], setHoveredElemIndex = _f[1];
195
- var timeoutRef = react.useRef(null);
196
- var openTimeoutRef = react.useRef(null);
197
- var cancelElementHover = react.useRef(false);
198
- var handleOnMouseEnter = react.useCallback(function (index) {
199
- console.log('handleOnMouseEnter');
200
- if (timeoutRef.current)
201
- clearTimeout(timeoutRef.current);
202
- if (openTimeoutRef.current)
203
- clearTimeout(openTimeoutRef.current);
204
- cancelElementHover.current = false;
205
- openTimeoutRef.current = setTimeout(function () {
206
- setIsDropdownVisible(true);
207
- if (!cancelElementHover.current) {
208
- setHoveredElemIndex(index);
209
- }
210
- }, openDelay);
211
- }, [openDelay]);
212
- var handleOnMouseLeave = react.useCallback(function () {
213
- console.log('handleMouseLeave');
214
- cancelElementHover.current = true;
215
- timeoutRef.current = setTimeout(function () {
216
- setIsDropdownVisible(false);
217
- setHoveredElemIndex(null);
218
- }, closeDelay);
219
- }, [closeDelay]);
220
- var handleDropdownMouseEnter = react.useCallback(function () {
221
- console.log('handleDropdownMouseEnter');
222
- if (timeoutRef.current)
223
- clearTimeout(timeoutRef.current);
224
- }, []);
225
- var handleDropdownMouseLeave = react.useCallback(function () {
226
- console.log('handleDropdownMouseLeave');
227
- cancelElementHover.current = true;
228
- (timeoutRef === null || timeoutRef === void 0 ? void 0 : timeoutRef.current) && clearTimeout(timeoutRef.current);
229
- timeoutRef.current = setTimeout(function () {
230
- setIsDropdownVisible(false);
231
- setHoveredElemIndex(null);
232
- }, closeDelay);
233
- }, []);
234
- react.useEffect(function () {
235
- var handleMouseLeaveWindow = function (event) {
236
- if (event.clientY <= 0) {
237
- setIsDropdownVisible(false);
238
- setHoveredElemIndex(null);
239
- }
240
- };
241
- window.addEventListener('mouseleave', handleMouseLeaveWindow);
242
- return function () {
243
- window.removeEventListener('mouseleave', handleMouseLeaveWindow);
244
- };
245
- }, []);
246
- return {
247
- isDropdownVisible: isDropdownVisible,
248
- hoveredElemIndex: hoveredElemIndex,
249
- handleOnMouseEnter: handleOnMouseEnter,
250
- handleOnMouseLeave: handleOnMouseLeave,
251
- handleDropdownMouseEnter: handleDropdownMouseEnter,
252
- handleDropdownMouseLeave: handleDropdownMouseLeave,
224
+ var _b = _a === void 0 ? {} : _a,
225
+ _c = _b.closeDelay,
226
+ closeDelayArg = _c === void 0 ? 300 : _c,
227
+ _d = _b.openDelay,
228
+ openDelay = _d === void 0 ? 500 : _d;
229
+ var closeDelay = Math.max(closeDelayArg, MIN_CLOSE_DELAY);
230
+ var _e = react.useState(false),
231
+ isDropdownVisible = _e[0],
232
+ setIsDropdownVisible = _e[1];
233
+ var _f = react.useState(null),
234
+ hoveredElemIndex = _f[0],
235
+ setHoveredElemIndex = _f[1];
236
+ var timeoutRef = react.useRef(null);
237
+ var openTimeoutRef = react.useRef(null);
238
+ var cancelElementHover = react.useRef(false);
239
+ var handleOnMouseEnter = react.useCallback(function (index) {
240
+ console.log('handleOnMouseEnter');
241
+ if (timeoutRef.current) clearTimeout(timeoutRef.current);
242
+ if (openTimeoutRef.current) clearTimeout(openTimeoutRef.current);
243
+ cancelElementHover.current = false;
244
+ openTimeoutRef.current = setTimeout(function () {
245
+ setIsDropdownVisible(true);
246
+ if (!cancelElementHover.current) {
247
+ setHoveredElemIndex(index);
248
+ }
249
+ }, openDelay);
250
+ }, [openDelay]);
251
+ var handleOnMouseLeave = react.useCallback(function () {
252
+ console.log('handleMouseLeave');
253
+ cancelElementHover.current = true;
254
+ timeoutRef.current = setTimeout(function () {
255
+ setIsDropdownVisible(false);
256
+ setHoveredElemIndex(null);
257
+ }, closeDelay);
258
+ }, [closeDelay]);
259
+ var handleDropdownMouseEnter = react.useCallback(function () {
260
+ console.log('handleDropdownMouseEnter');
261
+ if (timeoutRef.current) clearTimeout(timeoutRef.current);
262
+ }, []);
263
+ var handleDropdownMouseLeave = react.useCallback(function () {
264
+ console.log('handleDropdownMouseLeave');
265
+ cancelElementHover.current = true;
266
+ (timeoutRef === null || timeoutRef === void 0 ? void 0 : timeoutRef.current) && clearTimeout(timeoutRef.current);
267
+ timeoutRef.current = setTimeout(function () {
268
+ setIsDropdownVisible(false);
269
+ setHoveredElemIndex(null);
270
+ }, closeDelay);
271
+ }, []);
272
+ react.useEffect(function () {
273
+ var handleMouseLeaveWindow = function (event) {
274
+ if (event.clientY <= 0) {
275
+ setIsDropdownVisible(false);
276
+ setHoveredElemIndex(null);
277
+ }
253
278
  };
279
+ window.addEventListener('mouseleave', handleMouseLeaveWindow);
280
+ return function () {
281
+ window.removeEventListener('mouseleave', handleMouseLeaveWindow);
282
+ };
283
+ }, []);
284
+ return {
285
+ isDropdownVisible: isDropdownVisible,
286
+ hoveredElemIndex: hoveredElemIndex,
287
+ handleOnMouseEnter: handleOnMouseEnter,
288
+ handleOnMouseLeave: handleOnMouseLeave,
289
+ handleDropdownMouseEnter: handleDropdownMouseEnter,
290
+ handleDropdownMouseLeave: handleDropdownMouseLeave
291
+ };
254
292
  };
255
293
 
256
- var useDropdownAnimation = function () {
257
- var containerRef = react.useRef(null);
258
- var openDropdown = function () {
294
+ var useDropdownAnimation = function (isOpen) {
295
+ var containerRef = react.useRef(null);
296
+ var openDropdown = function () {
297
+ if (containerRef.current) {
298
+ var fullHeight_1 = containerRef.current.scrollHeight;
299
+ containerRef.current.style.maxHeight = "".concat(fullHeight_1 / 2, "px");
300
+ containerRef.current.style.opacity = '0';
301
+ requestAnimationFrame(function () {
259
302
  if (containerRef.current) {
260
- var fullHeight_1 = containerRef.current.scrollHeight;
261
- containerRef.current.style.maxHeight = "".concat(fullHeight_1 / 2, "px");
262
- containerRef.current.style.opacity = '0';
263
- requestAnimationFrame(function () {
264
- if (containerRef.current) {
265
- containerRef.current.style.transition = 'max-height 0.3s ease-in-out, opacity 0.3s ease-in-out';
266
- containerRef.current.style.maxHeight = "".concat(fullHeight_1, "px");
267
- containerRef.current.style.opacity = '1';
268
- }
269
- });
303
+ containerRef.current.style.transition = 'max-height 0.3s ease-in-out, opacity 0.3s ease-in-out';
304
+ containerRef.current.style.maxHeight = "".concat(fullHeight_1, "px");
305
+ containerRef.current.style.opacity = '1';
270
306
  }
271
- };
272
- react.useEffect(function () {
273
- openDropdown();
274
- }, []);
275
- return { containerRef: containerRef, openDropdown: openDropdown };
307
+ });
308
+ }
309
+ };
310
+ var closeDropdown = function () {
311
+ if (containerRef.current) {
312
+ var fullHeight = containerRef.current.scrollHeight;
313
+ containerRef.current.style.transition = 'max-height 0.3s ease-in-out, opacity 0.3s ease-in-out';
314
+ containerRef.current.style.maxHeight = "".concat(fullHeight / 2, "px");
315
+ containerRef.current.style.opacity = '0';
316
+ setTimeout(function () {
317
+ if (containerRef.current) {
318
+ containerRef.current.style.maxHeight = '0px';
319
+ }
320
+ }, 300);
321
+ }
322
+ };
323
+ react.useEffect(function () {
324
+ if (isOpen) {
325
+ openDropdown();
326
+ } else {
327
+ closeDropdown();
328
+ }
329
+ }, [isOpen]);
330
+ return {
331
+ containerRef: containerRef
332
+ };
276
333
  };
277
334
 
278
- var BusinessDropdownContent = function () {
279
- var _a = react.useState(0), leftPosition = _a[0], setLeftPosition = _a[1];
280
- var containerRef = useDropdownAnimation().containerRef;
281
- react.useEffect(function () {
282
- var updatePosition = function () {
283
- if (containerRef.current) {
284
- var screenWidth = window.innerWidth;
285
- var containerWidth = containerRef.current.offsetWidth || 0;
286
- setLeftPosition((screenWidth - containerWidth) / 2);
335
+ var BusinessDropdownContent = function (_a) {
336
+ var isOpen = _a.isOpen;
337
+ var _b = react.useState(0),
338
+ leftPosition = _b[0],
339
+ setLeftPosition = _b[1];
340
+ var containerRef = useDropdownAnimation(isOpen).containerRef;
341
+ react.useEffect(function () {
342
+ var updatePosition = function () {
343
+ if (containerRef.current) {
344
+ var screenWidth = window.innerWidth;
345
+ var containerWidth = containerRef.current.offsetWidth || 0;
346
+ setLeftPosition((screenWidth - containerWidth) / 2);
347
+ }
348
+ };
349
+ updatePosition();
350
+ window.addEventListener('resize', updatePosition);
351
+ return function () {
352
+ return window.removeEventListener('resize', updatePosition);
353
+ };
354
+ }, []);
355
+ return jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
356
+ ref: containerRef,
357
+ className: 'bg-neutral-100 o-hidden',
358
+ css: {
359
+ top: '76px',
360
+ position: 'fixed',
361
+ left: "".concat(leftPosition, "px"),
362
+ borderRadius: 24,
363
+ boxShadow: '0px 8px 24px 0px rgba(26, 26, 26, 0.10)',
364
+ width: 'fit-content',
365
+ zIndex: 1002,
366
+ opacity: 0
367
+ }
368
+ }, {
369
+ children: [jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({
370
+ className: 'px-6 py-5',
371
+ backgroundColor: '#FFF1EC'
372
+ }, {
373
+ children: jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({
374
+ variant: 'HM2',
375
+ style: {
376
+ lineHeight: '24px'
377
+ }
378
+ }, {
379
+ children: BUSINESS_DROPDOWN_HEADING
380
+ }))
381
+ })), jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({
382
+ className: 'flex flex-row p-6',
383
+ css: {
384
+ columnGap: '48px',
385
+ width: 'fit-content'
386
+ }
387
+ }, {
388
+ children: bdConfig.map(function (_a) {
389
+ var title = _a.title,
390
+ subtitle = _a.subtitle,
391
+ details = _a.details;
392
+ return jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
393
+ css: {
394
+ width: '200px'
395
+ },
396
+ className: 'bd-hover-container c-pointer'
397
+ }, {
398
+ children: [jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
399
+ className: 'flex flex-row flex-middle',
400
+ style: {
401
+ columnGap: '8px'
287
402
  }
288
- };
289
- updatePosition();
290
- window.addEventListener('resize', updatePosition);
291
- return function () { return window.removeEventListener('resize', updatePosition); };
292
- }, []);
293
- return (jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({ ref: containerRef, className: 'bg-neutral-100 o-hidden', css: {
294
- top: '76px',
295
- position: 'fixed',
296
- left: "".concat(leftPosition, "px"),
297
- borderRadius: 24,
298
- boxShadow: '0px 8px 24px 0px rgba(26, 26, 26, 0.10)',
299
- width: 'fit-content',
300
- zIndex: 1002,
301
- opacity: 0,
302
- } }, { children: [jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({ className: 'px-6 py-5', backgroundColor: '#FFF1EC' }, { children: jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ variant: 'HM2', style: { lineHeight: '24px' } }, { children: BUSINESS_DROPDOWN_HEADING })) })), jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({ className: 'flex flex-row p-6', css: { columnGap: '48px', width: 'fit-content' } }, { children: bdConfig.map(function (_a) {
303
- var title = _a.title, subtitle = _a.subtitle, details = _a.details;
304
- return (jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({ css: { width: '200px' }, className: 'bd-hover-container' }, { children: [jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({ className: 'flex flex-row flex-middle', style: { columnGap: '8px' } }, { children: [jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ variant: 'HM2', className: 'color-orange-on-hover' }, { children: title })), jsxRuntime.jsx(AnimatedArrow, {})] })), jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ variant: 'B3', className: 'mt-1', css: { opacity: 0.75 } }, { children: subtitle })), jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ variant: 'P3', color: 'subheading', className: 'mt-3' }, { children: details }))] }), title));
305
- }) }))] })));
403
+ }, {
404
+ children: [jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({
405
+ variant: 'HM2',
406
+ className: 'color-orange-on-hover'
407
+ }, {
408
+ children: title
409
+ })), jsxRuntime.jsx(AnimatedArrow, {})]
410
+ })), jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({
411
+ variant: 'B3',
412
+ className: 'mt-1',
413
+ css: {
414
+ opacity: 0.75
415
+ }
416
+ }, {
417
+ children: subtitle
418
+ })), jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({
419
+ variant: 'P3',
420
+ color: 'subheading',
421
+ className: 'mt-3'
422
+ }, {
423
+ children: details
424
+ }))]
425
+ }), title);
426
+ })
427
+ }))]
428
+ }));
306
429
  };
307
430
  var AnimatedArrow = function () {
308
- return (jsxRuntime.jsxs("div", tslib.__assign({ className: 'bd-arrow-container' }, { children: [jsxRuntime.jsx("div", tslib.__assign({ className: 'bd-arrow-wrapper' }, { children: jsxRuntime.jsx(ctDesignIcons.ArrowRight, {}) })), jsxRuntime.jsx("div", tslib.__assign({ className: 'bd-arrow-wrapper' }, { children: jsxRuntime.jsx(ctDesignIcons.ArrowRight, {}) })), jsxRuntime.jsx("div", tslib.__assign({ className: 'bd-arrow-wrapper' }, { children: jsxRuntime.jsx(ctDesignIcons.ArrowRight, {}) }))] })));
431
+ return jsxRuntime.jsxs("div", tslib.__assign({
432
+ className: 'bd-arrow-container'
433
+ }, {
434
+ children: [jsxRuntime.jsx("div", tslib.__assign({
435
+ className: 'bd-arrow-wrapper'
436
+ }, {
437
+ children: jsxRuntime.jsx(ctDesignIcons.ArrowRight, {})
438
+ })), jsxRuntime.jsx("div", tslib.__assign({
439
+ className: 'bd-arrow-wrapper'
440
+ }, {
441
+ children: jsxRuntime.jsx(ctDesignIcons.ArrowRight, {})
442
+ })), jsxRuntime.jsx("div", tslib.__assign({
443
+ className: 'bd-arrow-wrapper'
444
+ }, {
445
+ children: jsxRuntime.jsx(ctDesignIcons.ArrowRight, {})
446
+ }))]
447
+ }));
309
448
  };
310
449
 
311
- var ACCOUNT_OPTIONS_POPUP_CONFIG = [
312
- {
313
- text: 'My Profile',
314
- icon: jsxRuntime.jsx(ctDesignIcons.MyAccount, { width: 24, height: 24 }),
315
- redirectionLink: '/accounts/profile',
316
- },
317
- {
318
- text: 'My Trips',
319
- icon: jsxRuntime.jsx(ctDesignIcons.MyTrips, { width: 24, height: 24 }),
320
- redirectionLink: '/accounts/trips',
321
- },
322
- {
323
- text: 'Saved Cards',
324
- icon: jsxRuntime.jsx(ctDesignIcons.SavedCard, {}),
325
- redirectionLink: '/accounts/expressway',
326
- },
327
- {
328
- text: 'Saved Travellers',
329
- icon: jsxRuntime.jsx(ctDesignIcons.Travellers, { width: 24, height: 24 }),
330
- redirectionLink: '/account/travellers',
331
- },
332
- {
333
- text: 'Hi-Five',
334
- icon: jsxRuntime.jsx(ctDesignIcons.HiFive, {}),
335
- redirectionLink: '/accounts/hi-five?src=fh',
336
- },
337
- {
338
- text: 'Wallet',
339
- icon: jsxRuntime.jsx(ctDesignIcons.Wallet, { width: 24, height: 24 }),
340
- redirectionLink: '/accounts/wallet',
341
- },
342
- {
343
- text: 'Settings',
344
- icon: jsxRuntime.jsx(ctDesignIcons.SettingsCog, { width: 24, height: 24 }),
345
- redirectionLink: '/account/settings',
346
- },
347
- {
348
- text: 'Privacy Rights',
349
- icon: jsxRuntime.jsx(ctDesignIcons.PrivacyRights, {}),
350
- redirectionLink: 'accounts/personal-data-dashboard',
351
- },
352
- ];
450
+ var ACCOUNT_OPTIONS_POPUP_CONFIG = [{
451
+ text: 'My Profile',
452
+ icon: jsxRuntime.jsx(ctDesignIcons.MyAccount, {
453
+ width: 24,
454
+ height: 24
455
+ }),
456
+ redirectionLink: '/accounts/profile'
457
+ }, {
458
+ text: 'My Trips',
459
+ icon: jsxRuntime.jsx(ctDesignIcons.MyTrips, {
460
+ width: 24,
461
+ height: 24
462
+ }),
463
+ redirectionLink: '/accounts/trips'
464
+ }, {
465
+ text: 'Saved Cards',
466
+ icon: jsxRuntime.jsx(ctDesignIcons.SavedCard, {}),
467
+ redirectionLink: '/accounts/expressway'
468
+ }, {
469
+ text: 'Saved Travellers',
470
+ icon: jsxRuntime.jsx(ctDesignIcons.Travellers, {
471
+ width: 24,
472
+ height: 24
473
+ }),
474
+ redirectionLink: '/account/travellers'
475
+ }, {
476
+ text: 'Hi-Five',
477
+ icon: jsxRuntime.jsx(ctDesignIcons.HiFive, {}),
478
+ redirectionLink: '/accounts/hi-five?src=fh'
479
+ }, {
480
+ text: 'Wallet',
481
+ icon: jsxRuntime.jsx(ctDesignIcons.Wallet, {
482
+ width: 24,
483
+ height: 24
484
+ }),
485
+ redirectionLink: '/accounts/wallet'
486
+ }, {
487
+ text: 'Settings',
488
+ icon: jsxRuntime.jsx(ctDesignIcons.SettingsCog, {
489
+ width: 24,
490
+ height: 24
491
+ }),
492
+ redirectionLink: '/account/settings'
493
+ }, {
494
+ text: 'Privacy Rights',
495
+ icon: jsxRuntime.jsx(ctDesignIcons.PrivacyRights, {}),
496
+ redirectionLink: 'accounts/personal-data-dashboard'
497
+ }];
353
498
  var SIGN_OUT_TEXT = 'Logout';
354
499
  var LOGGEDIN_USER_TEXT = 'You are logged in with';
355
500
  var HEADER_ACCOUNTS_OPTIONS_OPEN_BTN_ID = 'header-acc-btn';
@@ -357,173 +502,600 @@ var ACCOUNT_OPTIONS_CONTAINER_ID = 'account-options';
357
502
  var ACCOUNT_OPTIONS_CONTAINER_WIDTH = 328;
358
503
 
359
504
  var LoyaltyChip = function (_a) {
360
- var icon = _a.icon, borderGradient = _a.borderGradient, backgroundGradient = _a.backgroundGradient, handleChipClick = _a.handleChipClick;
361
- var _b = react.useState(false), isHovered = _b[0], setIsHovered = _b[1];
362
- return (jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({ className: 'flex p-relative flex-middle flex-center br-8 o-hidden c-pointer', style: {
363
- height: 32,
364
- paddingLeft: 8,
365
- transition: 'padding-right 0.2s ease-in-out',
366
- paddingRight: isHovered ? 4 : 8,
367
- }, onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onClick: handleChipClick }, { children: [jsxRuntime.jsx(ctDesignContainer.Container, { style: {
368
- content: '""',
369
- position: 'absolute',
370
- inset: 0,
371
- borderRadius: 'inherit',
372
- background: backgroundGradient,
373
- zIndex: -2,
374
- } }), jsxRuntime.jsx(ctDesignContainer.Container, { style: {
375
- content: '""',
376
- position: 'absolute',
377
- inset: 0,
378
- borderRadius: 'inherit',
379
- padding: '1px',
380
- background: borderGradient,
381
- WebkitMask: 'linear-gradient(white, white) content-box, linear-gradient(white, white)',
382
- WebkitMaskComposite: 'destination-out',
383
- maskComposite: 'exclude',
384
- zIndex: -1,
385
- } }), jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({ className: 'flex flex-middle p-relative' }, { children: icon })), jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({ className: 'flex flex-middle o-hidden', style: {
386
- maxWidth: isHovered ? 16 : 0,
387
- transition: 'max-width 0.2s ease-in-out, opacity 0.2s ease-in-out',
388
- opacity: isHovered ? 0.5 : 0,
389
- } }, { children: jsxRuntime.jsx(ctDesignIcons.HeaderChevronRight, { color: 'white' }) }))] })));
505
+ var icon = _a.icon,
506
+ borderGradient = _a.borderGradient,
507
+ backgroundGradient = _a.backgroundGradient,
508
+ handleChipClick = _a.handleChipClick;
509
+ var _b = react.useState(false),
510
+ isHovered = _b[0],
511
+ setIsHovered = _b[1];
512
+ return jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
513
+ className: 'flex p-relative flex-middle flex-center br-8 o-hidden c-pointer',
514
+ style: {
515
+ height: 32,
516
+ paddingLeft: 8,
517
+ transition: 'padding-right 0.2s ease-in-out',
518
+ paddingRight: isHovered ? 4 : 8
519
+ },
520
+ onMouseEnter: function () {
521
+ return setIsHovered(true);
522
+ },
523
+ onMouseLeave: function () {
524
+ return setIsHovered(false);
525
+ },
526
+ onClick: handleChipClick
527
+ }, {
528
+ children: [jsxRuntime.jsx(ctDesignContainer.Container, {
529
+ style: {
530
+ content: '""',
531
+ position: 'absolute',
532
+ inset: 0,
533
+ borderRadius: 'inherit',
534
+ background: backgroundGradient,
535
+ zIndex: -2
536
+ }
537
+ }), jsxRuntime.jsx(ctDesignContainer.Container, {
538
+ style: {
539
+ content: '""',
540
+ position: 'absolute',
541
+ inset: 0,
542
+ borderRadius: 'inherit',
543
+ padding: '1px',
544
+ background: borderGradient,
545
+ WebkitMask: 'linear-gradient(white, white) content-box, linear-gradient(white, white)',
546
+ WebkitMaskComposite: 'destination-out',
547
+ maskComposite: 'exclude',
548
+ zIndex: -1
549
+ }
550
+ }), jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({
551
+ className: 'flex flex-middle p-relative'
552
+ }, {
553
+ children: icon
554
+ })), jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({
555
+ className: 'flex flex-middle o-hidden',
556
+ style: {
557
+ maxWidth: isHovered ? 16 : 0,
558
+ transition: 'max-width 0.2s ease-in-out, opacity 0.2s ease-in-out',
559
+ opacity: isHovered ? 0.5 : 0
560
+ }
561
+ }, {
562
+ children: jsxRuntime.jsx(ctDesignIcons.HeaderChevronRight, {
563
+ color: 'white'
564
+ })
565
+ }))]
566
+ }));
390
567
  };
391
568
 
392
569
  var _a;
393
570
  var LoyaltyType;
394
571
  (function (LoyaltyType) {
395
- LoyaltyType["FkVip"] = "FkVip";
396
- LoyaltyType["FkPremium"] = "FkPremium";
397
- LoyaltyType["InsiderIcon"] = "InsiderIcon";
398
- LoyaltyType["InsiderElite"] = "InsiderElite";
572
+ LoyaltyType["FkVip"] = "FkVip";
573
+ LoyaltyType["FkPremium"] = "FkPremium";
574
+ LoyaltyType["InsiderIcon"] = "InsiderIcon";
575
+ LoyaltyType["InsiderElite"] = "InsiderElite";
399
576
  })(LoyaltyType || (LoyaltyType = {}));
400
- var LOYALTY_DATA = (_a = {},
401
- _a[LoyaltyType.FkVip] = {
402
- icon: jsxRuntime.jsx(ctDesignIcons.FkVip, {}),
403
- borderGradient: 'linear-gradient(222.13deg, rgba(243, 179, 39, 0) 2.08%, #F3B327 85.17%)',
404
- backgroundGradient: 'linear-gradient(111deg, #360042 0%, #540061 100%)',
405
- },
406
- _a[LoyaltyType.FkPremium] = {
407
- icon: jsxRuntime.jsx(ctDesignIcons.FkPremium, {}),
408
- borderGradient: 'linear-gradient(230.68deg, rgba(243, 179, 39, 0) 10.1%, #F3B327 45.74%)',
409
- backgroundGradient: 'linear-gradient(180deg, #04176A 0%, #082395 100%)',
577
+ var LOYALTY_DATA = (_a = {}, _a[LoyaltyType.FkVip] = {
578
+ icon: jsxRuntime.jsx(ctDesignIcons.FkVip, {}),
579
+ borderGradient: 'linear-gradient(222.13deg, rgba(243, 179, 39, 0) 2.08%, #F3B327 85.17%)',
580
+ backgroundGradient: 'linear-gradient(111deg, #360042 0%, #540061 100%)'
581
+ }, _a[LoyaltyType.FkPremium] = {
582
+ icon: jsxRuntime.jsx(ctDesignIcons.FkPremium, {}),
583
+ borderGradient: 'linear-gradient(230.68deg, rgba(243, 179, 39, 0) 10.1%, #F3B327 45.74%)',
584
+ backgroundGradient: 'linear-gradient(180deg, #04176A 0%, #082395 100%)'
585
+ }, _a[LoyaltyType.InsiderIcon] = {
586
+ icon: jsxRuntime.jsx(ctDesignIcons.InsiderIcon, {}),
587
+ borderGradient: 'linear-gradient(230.68deg, rgba(208, 175, 101, 0) 10.1%, #D0AF65 45.74%)',
588
+ backgroundGradient: 'linear-gradient(111deg, #2E3042 0%, #1A1C23 100%)'
589
+ }, _a[LoyaltyType.InsiderElite] = {
590
+ icon: jsxRuntime.jsx(ctDesignIcons.InsiderElite, {}),
591
+ borderGradient: 'linear-gradient(230.68deg, rgba(208, 175, 101, 0) 10.1%, #D0AF65 45.74%)',
592
+ backgroundGradient: 'linear-gradient(111deg, #2E3042 0%, #1A1C23 100%)'
593
+ }, _a);
594
+
595
+ var ExpandableItem = function (_a) {
596
+ var icon = _a.icon,
597
+ handleChipClick = _a.handleChipClick,
598
+ value = _a.value;
599
+ var _b = react.useState(false),
600
+ isHovered = _b[0],
601
+ setIsHovered = _b[1];
602
+ return jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
603
+ className: "flex flex-middle justify-center br-8 c-pointer",
604
+ style: {
605
+ height: 32,
606
+ paddingLeft: 8,
607
+ paddingRight: isHovered ? 4 : 8,
608
+ transition: 'padding-right 0.2s ease-in-out',
609
+ background: isHovered ? '#ffd7ca' : '#ffe6df'
410
610
  },
411
- _a[LoyaltyType.InsiderIcon] = {
412
- icon: jsxRuntime.jsx(ctDesignIcons.InsiderIcon, {}),
413
- borderGradient: 'linear-gradient(230.68deg, rgba(208, 175, 101, 0) 10.1%, #D0AF65 45.74%)',
414
- backgroundGradient: 'linear-gradient(111deg, #2E3042 0%, #1A1C23 100%)',
611
+ onMouseEnter: function () {
612
+ return setIsHovered(true);
415
613
  },
416
- _a[LoyaltyType.InsiderElite] = {
417
- icon: jsxRuntime.jsx(ctDesignIcons.InsiderElite, {}),
418
- borderGradient: 'linear-gradient(230.68deg, rgba(208, 175, 101, 0) 10.1%, #D0AF65 45.74%)',
419
- backgroundGradient: 'linear-gradient(111deg, #2E3042 0%, #1A1C23 100%)',
614
+ onMouseLeave: function () {
615
+ return setIsHovered(false);
420
616
  },
421
- _a);
422
-
423
- var ExpandableItem = function (_a) {
424
- var icon = _a.icon, handleChipClick = _a.handleChipClick, value = _a.value;
425
- var _b = react.useState(false), isHovered = _b[0], setIsHovered = _b[1];
426
- return (jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({ className: "flex flex-middle justify-center br-8 c-pointer", style: {
427
- height: 32,
428
- paddingLeft: 8,
429
- paddingRight: isHovered ? 4 : 8,
430
- transition: 'padding-right 0.2s ease-in-out',
431
- background: isHovered ? '#ffd7ca' : '#ffe6df',
432
- }, onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onClick: handleChipClick }, { children: [jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({ className: 'flex flex-middle flex-gap-1' }, { children: [icon, value && (jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ variant: 'B3', className: 'value-text', isClickable: true }, { children: value })))] })), jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({ className: 'flex flex-middle o-hidden', style: {
433
- maxWidth: isHovered ? 16 : 0,
434
- transition: 'max-width 0.2s ease-in-out, opacity 0.2s ease-in-out',
435
- opacity: isHovered ? 1 : 0,
436
- } }, { children: jsxRuntime.jsx(ctDesignIcons.HeaderChevronRight, {}) }))] })));
617
+ onClick: handleChipClick
618
+ }, {
619
+ children: [jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
620
+ className: 'flex flex-middle flex-gap-1'
621
+ }, {
622
+ children: [icon, value && jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({
623
+ variant: 'B3',
624
+ className: 'value-text',
625
+ isClickable: true
626
+ }, {
627
+ children: value
628
+ }))]
629
+ })), jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({
630
+ className: 'flex flex-middle o-hidden',
631
+ style: {
632
+ maxWidth: isHovered ? 16 : 0,
633
+ transition: 'max-width 0.2s ease-in-out, opacity 0.2s ease-in-out',
634
+ opacity: isHovered ? 1 : 0
635
+ }
636
+ }, {
637
+ children: jsxRuntime.jsx(ctDesignIcons.HeaderChevronRight, {})
638
+ }))]
639
+ }));
437
640
  };
438
641
  var RewardsSection = function (props) {
439
- var selectedLoyaltyType = props.loyaltyType, _a = props.fkSupercoinBurnBalance, superCoinBalance = _a === void 0 ? 0 : _a, _b = props.walletBalance, walletBalance = _b === void 0 ? 0 : _b, loyaltyLoading = props.loyaltyLoading, superCoinsLoading = props.superCoinsLoading, walletLoading = props.walletLoading, walletChipClick = props.walletChipClick, supercoinsChipClick = props.supercoinsChipClick, loyaltyChipClick = props.loyaltyChipClick;
440
- return (jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({ className: 'flex p-4 pt-0 flex-start flex-gap-1', style: { alignSelf: 'stretch' } }, { children: [loyaltyLoading ? (jsxRuntime.jsx(ctDesignShimmer.Shimmer, { width: '50px', height: '32px', borderRadius: '8px' })) : (selectedLoyaltyType &&
441
- LOYALTY_DATA[selectedLoyaltyType] && (jsxRuntime.jsx(LoyaltyChip, { icon: LOYALTY_DATA[selectedLoyaltyType].icon, borderGradient: LOYALTY_DATA[selectedLoyaltyType].borderGradient, backgroundGradient: LOYALTY_DATA[selectedLoyaltyType].backgroundGradient, handleChipClick: loyaltyChipClick }))), superCoinsLoading ? (jsxRuntime.jsx(ctDesignShimmer.Shimmer, { width: '50px', height: '32px', borderRadius: '8px' })) : (jsxRuntime.jsx(ExpandableItem, { icon: jsxRuntime.jsx(ctDesignIcons.Supercoin, { width: 20, height: 20 }), value: superCoinBalance, handleChipClick: supercoinsChipClick })), walletLoading ? (jsxRuntime.jsx(ctDesignShimmer.Shimmer, { width: '50px', height: '32px', borderRadius: '8px' })) : (jsxRuntime.jsx(ExpandableItem, { icon: jsxRuntime.jsx(ctDesignIcons.Wallet, { width: 20, height: 20 }), value: walletBalance, handleChipClick: walletChipClick }))] })));
642
+ var selectedLoyaltyType = props.loyaltyType,
643
+ _a = props.fkSupercoinBurnBalance,
644
+ superCoinBalance = _a === void 0 ? 0 : _a,
645
+ _b = props.walletBalance,
646
+ walletBalance = _b === void 0 ? 0 : _b,
647
+ loyaltyLoading = props.loyaltyLoading,
648
+ superCoinsLoading = props.superCoinsLoading,
649
+ walletLoading = props.walletLoading,
650
+ walletChipClick = props.walletChipClick,
651
+ supercoinsChipClick = props.supercoinsChipClick,
652
+ loyaltyChipClick = props.loyaltyChipClick;
653
+ return jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
654
+ className: 'flex p-4 pt-0 flex-start flex-gap-1',
655
+ style: {
656
+ alignSelf: 'stretch'
657
+ }
658
+ }, {
659
+ children: [loyaltyLoading ? jsxRuntime.jsx(ctDesignShimmer.Shimmer, {
660
+ width: '50px',
661
+ height: '32px',
662
+ borderRadius: '8px'
663
+ }) : selectedLoyaltyType && LOYALTY_DATA[selectedLoyaltyType] && jsxRuntime.jsx(LoyaltyChip, {
664
+ icon: LOYALTY_DATA[selectedLoyaltyType].icon,
665
+ borderGradient: LOYALTY_DATA[selectedLoyaltyType].borderGradient,
666
+ backgroundGradient: LOYALTY_DATA[selectedLoyaltyType].backgroundGradient,
667
+ handleChipClick: loyaltyChipClick
668
+ }), superCoinsLoading ? jsxRuntime.jsx(ctDesignShimmer.Shimmer, {
669
+ width: '50px',
670
+ height: '32px',
671
+ borderRadius: '8px'
672
+ }) : jsxRuntime.jsx(ExpandableItem, {
673
+ icon: jsxRuntime.jsx(ctDesignIcons.Supercoin, {
674
+ width: 20,
675
+ height: 20
676
+ }),
677
+ value: superCoinBalance,
678
+ handleChipClick: supercoinsChipClick
679
+ }), walletLoading ? jsxRuntime.jsx(ctDesignShimmer.Shimmer, {
680
+ width: '50px',
681
+ height: '32px',
682
+ borderRadius: '8px'
683
+ }) : jsxRuntime.jsx(ExpandableItem, {
684
+ icon: jsxRuntime.jsx(ctDesignIcons.Wallet, {
685
+ width: 20,
686
+ height: 20
687
+ }),
688
+ value: walletBalance,
689
+ handleChipClick: walletChipClick
690
+ })]
691
+ }));
442
692
  };
443
693
 
694
+ var HoverableContainer = /*#__PURE__*/styled__default.default(ctDesignContainer.Container).withConfig({
695
+ displayName: "StyledHeader__HoverableContainer",
696
+ componentId: "sc-aht4pl-0"
697
+ })(templateObject_1 || (templateObject_1 = tslib.__makeTemplateObject(["\n padding: 8px;\n border-radius: 8px;\n cursor: pointer;\n transition: background-color 0.2s ease-in-out;\n\n &:hover {\n background-color: #ecf3ff;\n color: green;\n }\n"], ["\n padding: 8px;\n border-radius: 8px;\n cursor: pointer;\n transition: background-color 0.2s ease-in-out;\n\n &:hover {\n background-color: #ecf3ff;\n color: green;\n }\n"])));
698
+ var LogoutButton = /*#__PURE__*/styled__default.default(ctDesignContainer.Container).withConfig({
699
+ displayName: "StyledHeader__LogoutButton",
700
+ componentId: "sc-aht4pl-1"
701
+ })(templateObject_2 || (templateObject_2 = tslib.__makeTemplateObject(["\n padding: 8px;\n border-radius: 8px;\n cursor: pointer;\n display: flex;\n column-gap: 8px;\n transition: background-color 0.2s ease-in-out;\n\n &:hover {\n background-color: #fbefef;\n }\n"], ["\n padding: 8px;\n border-radius: 8px;\n cursor: pointer;\n display: flex;\n column-gap: 8px;\n transition: background-color 0.2s ease-in-out;\n\n &:hover {\n background-color: #fbefef;\n }\n"])));
702
+ var templateObject_1, templateObject_2;
703
+
444
704
  var AccountDropdownContent = function (props) {
445
- var _a = props || {}, handleLogout = _a.handleLogout, userName = _a.userName, userMobileNumber = _a.userMobileNumber, countryCode = _a.countryCode, userDetailsLoading = _a.userDetailsLoading, superCoinBalance = _a.fkSupercoinBurnBalance, walletBalance = _a.walletBalance, loyaltyType = _a.loyaltyType, loyaltyLoading = _a.loyaltyLoading, walletLoading = _a.walletLoading, superCoinsLoading = _a.superCoinsLoading, walletChipClick = _a.walletChipClick, supercoinsChipClick = _a.supercoinsChipClick, loyaltyChipClick = _a.loyaltyChipClick;
446
- var containerRef = useDropdownAnimation().containerRef;
447
- var _b = react.useMemo(function () {
448
- var userGreeting = userName && "Hello ".concat(userName, "!");
449
- var phoneNumber = countryCode && userMobileNumber ? "".concat(countryCode, " ").concat(userMobileNumber) : '';
450
- return { userGreeting: userGreeting, phoneNumber: phoneNumber };
451
- }, [userName, userMobileNumber, countryCode]), userGreeting = _b.userGreeting, phoneNumber = _b.phoneNumber;
452
- var handleRedirectClick = function (redirectLink) {
453
- return function () {
454
- window.location.href = redirectLink;
455
- };
705
+ var _a = props || {},
706
+ handleLogout = _a.handleLogout,
707
+ userName = _a.userName,
708
+ userMobileNumber = _a.userMobileNumber,
709
+ countryCode = _a.countryCode,
710
+ userDetailsLoading = _a.userDetailsLoading,
711
+ superCoinBalance = _a.fkSupercoinBurnBalance,
712
+ walletBalance = _a.walletBalance,
713
+ loyaltyType = _a.loyaltyType,
714
+ loyaltyLoading = _a.loyaltyLoading,
715
+ walletLoading = _a.walletLoading,
716
+ superCoinsLoading = _a.superCoinsLoading,
717
+ walletChipClick = _a.walletChipClick,
718
+ supercoinsChipClick = _a.supercoinsChipClick,
719
+ loyaltyChipClick = _a.loyaltyChipClick,
720
+ isOpen = _a.isOpen;
721
+ var containerRef = useDropdownAnimation(isOpen).containerRef;
722
+ var _b = react.useMemo(function () {
723
+ var userGreeting = userName && "Hello ".concat(userName, "!");
724
+ var phoneNumber = countryCode && userMobileNumber ? "".concat(countryCode, " ").concat(userMobileNumber) : '';
725
+ return {
726
+ userGreeting: userGreeting,
727
+ phoneNumber: phoneNumber
728
+ };
729
+ }, [userName, userMobileNumber, countryCode]),
730
+ userGreeting = _b.userGreeting,
731
+ phoneNumber = _b.phoneNumber;
732
+ var handleRedirectClick = function (redirectLink) {
733
+ return function () {
734
+ window.location.href = redirectLink;
456
735
  };
457
- react.useEffect(function () {
458
- var headerAccBtn = document.getElementById(HEADER_ACCOUNTS_OPTIONS_OPEN_BTN_ID);
459
- var accountOptionsElem = document.getElementById(ACCOUNT_OPTIONS_CONTAINER_ID);
460
- var positionAccountOptionsDiv = function () {
461
- var headerBtnRight = headerAccBtn === null || headerAccBtn === void 0 ? void 0 : headerAccBtn.getBoundingClientRect().right;
462
- if (accountOptionsElem && headerBtnRight) {
463
- accountOptionsElem.style.left = "".concat(headerBtnRight - ACCOUNT_OPTIONS_CONTAINER_WIDTH, "px");
464
- }
465
- };
466
- positionAccountOptionsDiv();
467
- }, []);
468
- var renderUserData = function () {
469
- var renderContent = function (loading, content, variant, color) { return (jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ variant: variant, color: color }, { children: loading ? (jsxRuntime.jsx(ctDesignShimmer.Shimmer, { height: variant === 'HM3' ? '18px' : '12px', width: variant === 'HM3' ? '140px' : '200px' })) : (content) }))); };
470
- return (jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({ className: 'flex flex-column flex-gap-1' }, { 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')] })) })));
736
+ };
737
+ react.useEffect(function () {
738
+ var headerAccBtn = document.getElementById(HEADER_ACCOUNTS_OPTIONS_OPEN_BTN_ID);
739
+ var accountOptionsElem = document.getElementById(ACCOUNT_OPTIONS_CONTAINER_ID);
740
+ var positionAccountOptionsDiv = function () {
741
+ var headerBtnRight = headerAccBtn === null || headerAccBtn === void 0 ? void 0 : headerAccBtn.getBoundingClientRect().right;
742
+ if (accountOptionsElem && headerBtnRight) {
743
+ accountOptionsElem.style.left = "".concat(headerBtnRight - ACCOUNT_OPTIONS_CONTAINER_WIDTH, "px");
744
+ }
471
745
  };
472
- return (jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({ id: ACCOUNT_OPTIONS_CONTAINER_ID, ref: containerRef, className: 'flex flex-column br-16 o-hidden', css: { zIndex: 1002, opacity: 0, top: '76px', position: 'fixed' }, width: "".concat(ACCOUNT_OPTIONS_CONTAINER_WIDTH, "px"), background: '#FFF1EC' }, { children: [jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({ className: 'p-4', height: '72px' }, { children: renderUserData() })), jsxRuntime.jsx(RewardsSection, { fkSupercoinBurnBalance: superCoinBalance, walletBalance: walletBalance, loyaltyType: loyaltyType, loyaltyLoading: loyaltyLoading, superCoinsLoading: superCoinsLoading, walletLoading: walletLoading, walletChipClick: walletChipClick, supercoinsChipClick: supercoinsChipClick, loyaltyChipClick: loyaltyChipClick }), jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({ className: 'p-2 flex flex-column', backgroundColor: 'white', style: {
473
- borderBottomLeftRadius: 12,
474
- borderBottomRightRadius: 12,
475
- rowGap: 8,
476
- } }, { children: [ACCOUNT_OPTIONS_POPUP_CONFIG.map(function (_a) {
477
- var text = _a.text, icon = _a.icon, redirectionLink = _a.redirectionLink;
478
- return (jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({ className: "highlight-on-hover default p-2 br-8 c-pointer" }, { children: jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({ className: 'flex c-pointer', css: { columnGap: '8px' }, onClick: handleRedirectClick(redirectionLink) }, { children: [icon, jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ variant: 'P1', className: 'flex flex-middle c-pointer' }, { children: text }))] }), "account-option-".concat(text)) }), "account-option-".concat(text)));
479
- }), jsxRuntime.jsx(ctDesignDivider.Divider, { style: {
480
- borderBottom: '1px dashed #E6E6E6',
481
- } }), jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({ className: "logout-button-hover default flex p-2 br-8 c-pointer", css: { columnGap: '8px' }, onClick: handleLogout }, { children: [jsxRuntime.jsx(ctDesignIcons.Signout, { height: 24, width: 24 }), jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ variant: 'P1', className: 'flex flex-middle c-pointer', color: 'warning' }, { children: SIGN_OUT_TEXT }))] }))] }))] })));
746
+ positionAccountOptionsDiv();
747
+ }, []);
748
+ var renderUserData = function () {
749
+ var renderContent = function (loading, content, variant, color) {
750
+ return jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({
751
+ variant: variant,
752
+ color: color
753
+ }, {
754
+ children: loading ? jsxRuntime.jsx(ctDesignShimmer.Shimmer, {
755
+ height: variant === 'HM3' ? '18px' : '12px',
756
+ width: variant === 'HM3' ? '140px' : '200px'
757
+ }) : content
758
+ }));
759
+ };
760
+ return jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({
761
+ className: 'flex flex-column flex-gap-1'
762
+ }, {
763
+ children: userGreeting ? jsxRuntime.jsxs(jsxRuntime.Fragment, {
764
+ children: [renderContent(userDetailsLoading, userGreeting, 'HM3', 'primary'), renderContent(userDetailsLoading, "".concat(LOGGEDIN_USER_TEXT, " ").concat(phoneNumber), 'P3', 'subheading')]
765
+ }) : jsxRuntime.jsxs(jsxRuntime.Fragment, {
766
+ children: [renderContent(userDetailsLoading, LOGGEDIN_USER_TEXT, 'P3', 'subheading'), renderContent(userDetailsLoading, phoneNumber, 'HM3', 'primary')]
767
+ })
768
+ }));
769
+ };
770
+ return jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
771
+ id: ACCOUNT_OPTIONS_CONTAINER_ID,
772
+ ref: containerRef,
773
+ className: 'flex flex-column br-16 o-hidden',
774
+ css: {
775
+ zIndex: 1002,
776
+ opacity: 0,
777
+ top: '76px',
778
+ position: 'fixed'
779
+ },
780
+ width: "".concat(ACCOUNT_OPTIONS_CONTAINER_WIDTH, "px"),
781
+ background: '#FFF1EC'
782
+ }, {
783
+ children: [jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({
784
+ className: 'p-4',
785
+ height: '72px'
786
+ }, {
787
+ children: renderUserData()
788
+ })), jsxRuntime.jsx(RewardsSection, {
789
+ fkSupercoinBurnBalance: superCoinBalance,
790
+ walletBalance: walletBalance,
791
+ loyaltyType: loyaltyType,
792
+ loyaltyLoading: loyaltyLoading,
793
+ superCoinsLoading: superCoinsLoading,
794
+ walletLoading: walletLoading,
795
+ walletChipClick: walletChipClick,
796
+ supercoinsChipClick: supercoinsChipClick,
797
+ loyaltyChipClick: loyaltyChipClick
798
+ }), jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
799
+ className: 'p-2 flex flex-column',
800
+ backgroundColor: 'white',
801
+ style: {
802
+ borderBottomLeftRadius: 12,
803
+ borderBottomRightRadius: 12,
804
+ rowGap: 8
805
+ }
806
+ }, {
807
+ children: [ACCOUNT_OPTIONS_POPUP_CONFIG.map(function (_a) {
808
+ var text = _a.text,
809
+ icon = _a.icon,
810
+ redirectionLink = _a.redirectionLink;
811
+ return jsxRuntime.jsx(HoverableContainer, tslib.__assign({
812
+ onClick: handleRedirectClick(redirectionLink)
813
+ }, {
814
+ children: jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
815
+ className: 'flex c-pointer',
816
+ style: {
817
+ columnGap: '8px'
818
+ }
819
+ }, {
820
+ children: [icon, jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({
821
+ variant: 'P1',
822
+ className: 'flex flex-middle c-pointer'
823
+ }, {
824
+ children: text
825
+ }))]
826
+ }))
827
+ }), "account-option-".concat(text));
828
+ }), jsxRuntime.jsx(ctDesignDivider.Divider, {
829
+ style: {
830
+ borderBottom: '1px dashed #E6E6E6'
831
+ }
832
+ }), jsxRuntime.jsxs(LogoutButton, tslib.__assign({
833
+ onClick: handleLogout
834
+ }, {
835
+ children: [jsxRuntime.jsx(ctDesignIcons.Signout, {
836
+ height: 24,
837
+ width: 24
838
+ }), jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({
839
+ variant: 'P1',
840
+ className: 'flex flex-middle c-pointer',
841
+ color: 'warning'
842
+ }, {
843
+ children: SIGN_OUT_TEXT
844
+ }))]
845
+ }))]
846
+ }))]
847
+ }));
482
848
  };
483
849
 
484
850
  var UserAccount = function (props) {
485
- var handleLogout = props.handleLogout, userDetailsLoading = props.userDetailsLoading, userName = props.userName, userMobileNumber = props.userMobileNumber, countryCode = props.countryCode, fkSupercoinBurnBalance = props.fkSupercoinBurnBalance, walletBalance = props.walletBalance, loyaltyType = props.loyaltyType, walletLoading = props.walletLoading, superCoinsLoading = props.superCoinsLoading, loyaltyLoading = props.loyaltyLoading, loyaltyChipClick = props.loyaltyChipClick, supercoinsChipClick = props.supercoinsChipClick, walletChipClick = props.walletChipClick;
486
- var _a = useHoverDropdown({ openDelay: 500, closeDelay: 50 }), isDropdownVisible = _a.isDropdownVisible, handleOnMouseEnter = _a.handleOnMouseEnter, handleOnMouseLeave = _a.handleOnMouseLeave, handleDropdownMouseEnter = _a.handleDropdownMouseEnter, handleDropdownMouseLeave = _a.handleDropdownMouseLeave;
487
- return (jsxRuntime.jsxs(ctDesignContainer.Container, { children: [jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({ className: "flex px-3 py-2 flex-middle br-12 h-100p c-pointer", style: { columnGap: 8 }, onMouseEnter: function () { return handleOnMouseEnter(4); }, onMouseLeave: handleOnMouseLeave, id: HEADER_ACCOUNTS_OPTIONS_OPEN_BTN_ID }, { children: [jsxRuntime.jsx(ctDesignIcons.MyAccount, { color: isDropdownVisible ? '#FF4F17' : '#1A1A1A' }), jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({ className: 'flex flex-row flex-middle' }, { children: [jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ variant: 'B2', className: 'c-pointer', color: isDropdownVisible ? 'secondary' : 'primary' }, { children: "My Account" })), jsxRuntime.jsx(ctDesignIcons.ChevronDown, { width: 20, height: 20, fill: isDropdownVisible ? '#FF4F17' : '#1A1A1A' })] }))] })), jsxRuntime.jsx(HeaderAnimatedMask, tslib.__assign({ show: isDropdownVisible, marginTop: '64px', handleDropdownMouseEnter: handleDropdownMouseEnter, handleDropdownMouseLeave: handleDropdownMouseLeave, onMaskClick: handleDropdownMouseLeave }, { children: jsxRuntime.jsx(AccountDropdownContent, { handleLogout: handleLogout, userDetailsLoading: userDetailsLoading, userName: userName, userMobileNumber: userMobileNumber, countryCode: countryCode, loyaltyType: loyaltyType, walletBalance: walletBalance, fkSupercoinBurnBalance: fkSupercoinBurnBalance, walletLoading: walletLoading, superCoinsLoading: superCoinsLoading, loyaltyLoading: loyaltyLoading, loyaltyChipClick: loyaltyChipClick, walletChipClick: walletChipClick, supercoinsChipClick: supercoinsChipClick }) }))] }));
851
+ var handleLogout = props.handleLogout,
852
+ userDetailsLoading = props.userDetailsLoading,
853
+ userName = props.userName,
854
+ userMobileNumber = props.userMobileNumber,
855
+ countryCode = props.countryCode,
856
+ fkSupercoinBurnBalance = props.fkSupercoinBurnBalance,
857
+ walletBalance = props.walletBalance,
858
+ loyaltyType = props.loyaltyType,
859
+ walletLoading = props.walletLoading,
860
+ superCoinsLoading = props.superCoinsLoading,
861
+ loyaltyLoading = props.loyaltyLoading,
862
+ loyaltyChipClick = props.loyaltyChipClick,
863
+ supercoinsChipClick = props.supercoinsChipClick,
864
+ walletChipClick = props.walletChipClick;
865
+ var _a = useHoverDropdown({
866
+ openDelay: 500,
867
+ closeDelay: 50
868
+ }),
869
+ isDropdownVisible = _a.isDropdownVisible,
870
+ handleOnMouseEnter = _a.handleOnMouseEnter,
871
+ handleOnMouseLeave = _a.handleOnMouseLeave,
872
+ handleDropdownMouseEnter = _a.handleDropdownMouseEnter,
873
+ handleDropdownMouseLeave = _a.handleDropdownMouseLeave;
874
+ return jsxRuntime.jsxs(ctDesignContainer.Container, {
875
+ children: [jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
876
+ className: "flex px-3 py-2 flex-middle br-12 h-100p c-pointer",
877
+ style: {
878
+ columnGap: 8,
879
+ height: 64
880
+ },
881
+ onMouseEnter: function () {
882
+ return handleOnMouseEnter(4);
883
+ },
884
+ onMouseLeave: handleOnMouseLeave,
885
+ id: HEADER_ACCOUNTS_OPTIONS_OPEN_BTN_ID
886
+ }, {
887
+ children: [jsxRuntime.jsx(ctDesignIcons.MyAccount, {
888
+ color: isDropdownVisible ? '#FF4F17' : '#1A1A1A'
889
+ }), jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
890
+ className: 'flex flex-row flex-middle'
891
+ }, {
892
+ children: [jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({
893
+ variant: 'B2',
894
+ className: 'c-pointer',
895
+ color: isDropdownVisible ? 'secondary' : 'primary'
896
+ }, {
897
+ children: "My Account"
898
+ })), jsxRuntime.jsx(ctDesignIcons.ChevronDown, {
899
+ width: 20,
900
+ height: 20,
901
+ fill: isDropdownVisible ? '#FF4F17' : '#1A1A1A'
902
+ })]
903
+ }))]
904
+ })), jsxRuntime.jsx(HeaderAnimatedMask, tslib.__assign({
905
+ show: isDropdownVisible,
906
+ marginTop: '64px',
907
+ handleDropdownMouseEnter: handleDropdownMouseEnter,
908
+ handleDropdownMouseLeave: handleDropdownMouseLeave,
909
+ onMaskClick: handleDropdownMouseLeave
910
+ }, {
911
+ children: jsxRuntime.jsx(AccountDropdownContent, {
912
+ handleLogout: handleLogout,
913
+ userDetailsLoading: userDetailsLoading,
914
+ userName: userName,
915
+ userMobileNumber: userMobileNumber,
916
+ countryCode: countryCode,
917
+ loyaltyType: loyaltyType,
918
+ walletBalance: walletBalance,
919
+ fkSupercoinBurnBalance: fkSupercoinBurnBalance,
920
+ walletLoading: walletLoading,
921
+ superCoinsLoading: superCoinsLoading,
922
+ loyaltyLoading: loyaltyLoading,
923
+ loyaltyChipClick: loyaltyChipClick,
924
+ walletChipClick: walletChipClick,
925
+ supercoinsChipClick: supercoinsChipClick,
926
+ isOpen: isDropdownVisible
927
+ })
928
+ }))]
929
+ });
488
930
  };
489
931
 
490
932
  var Header = function (props) {
491
- var superCoinsLoading = props.superCoinsLoading, fkSupercoinBurnBalance = props.fkSupercoinBurnBalance, onLoginButtonClick = props.onLoginButtonClick, _a = props.showAllLobs, showAllLobs = _a === void 0 ? false : _a, selectedLOB = props.selectedLOB, isUserLoggedIn = props.isUserLoggedIn, handleLogoutClick = props.handleLogoutClick, walletBalance = props.walletBalance, walletLoading = props.walletLoading, loyaltyLoading = props.loyaltyLoading, loyaltyType = props.loyaltyType, userDetailsLoading = props.userDetailsLoading, userName = props.userName, userMobileNumber = props.userMobileNumber, countryCode = props.countryCode, loyaltyChipClick = props.loyaltyChipClick, supercoinsChipClick = props.supercoinsChipClick, walletChipClick = props.walletChipClick; props.ravenPayload; props.ravenPushCallback;
492
- var _c = useHoverDropdown({
493
- openDelay: 500,
494
- }), isDropdownVisible = _c.isDropdownVisible, hoveredElemIndex = _c.hoveredElemIndex, handleOnMouseEnter = _c.handleOnMouseEnter, handleOnMouseLeave = _c.handleOnMouseLeave, handleDropdownMouseEnter = _c.handleDropdownMouseEnter, handleDropdownMouseLeave = _c.handleDropdownMouseLeave;
495
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({ className: 'flex t-0 p-sticky w-100p flex-middle flex-center flex-gap-6 flex-no-shrink', style: {
496
- zIndex: 1000,
497
- height: 64,
498
- borderBottom: '1px solid #E6E6E6',
499
- background: '#F7FAFF',
500
- } }, { children: jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({ className: 'flex flex-middle flex-between flex-gap-6', style: {
501
- maxWidth: 1440,
502
- padding: '0px 28px',
503
- flex: '1 0 0',
504
- } }, { children: [jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({ className: 'flex flex-row flex-center flex-middle' }, { children: [jsxRuntime.jsx(ctDesignIcons.CTLogo, {}), jsxRuntime.jsx(ctDesignDivider.Divider, { style: {
505
- width: 12,
506
- marginLeft: 2,
507
- marginRight: 2,
508
- transform: 'rotate(90deg)',
509
- borderBottom: '1px solid #e0e0e0',
510
- } }), jsxRuntime.jsx(ctDesignIcons.Fkcompany, {})] })), jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({ className: 'flex flex-row flex-middle flex-center flex-cg-6' }, { children: [jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({ className: 'flex flex-row flex-middle flex-center flex-cg-1' }, { children: NAVBAR_OPTIONS.map(function (option, index) {
511
- var isHovered = hoveredElemIndex === index;
512
- return (jsxRuntime.jsxs(ctDesignContainer.Container, { children: [jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({ onMouseEnter: function () { return handleOnMouseEnter(index); }, onMouseLeave: handleOnMouseLeave, className: 'flex flex-row flex-middle px-3 py-2 c-pointer p-relative', style: { columnGap: 8, height: 64 }, onClick: function () {
513
- if (option.isClickable) {
514
- window.location.href = option.link;
515
- }
516
- } }, { children: [jsxRuntime.jsx(option.lefticon, { color: isHovered ? '#FF4F17' : '#1A1A1A' }), jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({ className: 'flex flex-row flex-middle' }, { children: [jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ variant: 'B2', color: isHovered ? 'secondary' : 'primary', isClickable: true }, { children: option.text })), option.rightIcon && (jsxRuntime.jsx(option.rightIcon, { width: 20, height: 20, fill: isHovered ? '#FF4F17' : '#1A1A1A' }))] }))] }), "nav-option-".concat(index)), jsxRuntime.jsx(HeaderAnimatedMask, tslib.__assign({ show: hoveredElemIndex === index && option.isHoverable && isDropdownVisible, marginTop: '64px', handleDropdownMouseEnter: handleDropdownMouseEnter, handleDropdownMouseLeave: handleDropdownMouseLeave, onMaskClick: handleDropdownMouseLeave }, { children: jsxRuntime.jsx(BusinessDropdownContent, {}) }))] }));
517
- }) })), isUserLoggedIn && (jsxRuntime.jsx(ctDesignDivider.Divider, { style: {
518
- width: 12,
519
- margin: '0 -18px',
520
- transform: 'rotate(90deg)',
521
- borderBottom: '1px solid #e0e0e0',
522
- } })), jsxRuntime.jsx(ctDesignContainer.Container, { children: isUserLoggedIn ? (jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({ className: 'flex flex-row flex-middle' }, { children: jsxRuntime.jsx(UserAccount, { handleLogout: handleLogoutClick, superCoinsLoading: superCoinsLoading, fkSupercoinBurnBalance: fkSupercoinBurnBalance, walletBalance: walletBalance, walletLoading: walletLoading, loyaltyLoading: loyaltyLoading, loyaltyType: loyaltyType, userDetailsLoading: userDetailsLoading, userName: userName, userMobileNumber: userMobileNumber, countryCode: countryCode, walletChipClick: walletChipClick, supercoinsChipClick: supercoinsChipClick, loyaltyChipClick: loyaltyChipClick }) }))) : (jsxRuntime.jsx(ctDesignButton.Button, tslib.__assign({ className: "fw-400 fs-14 login-button", onClick: onLoginButtonClick, style: {
523
- width: 153,
524
- height: 40,
525
- border: '1px solid #1A1A1A',
526
- }, loading: false }, { children: jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({ componentNode: 'span', variant: 'L2' }, { children: "Login" })) }))) })] }))] })) })), showAllLobs && jsxRuntime.jsx(LobsHeader, { selectedLOB: selectedLOB })] }));
933
+ var superCoinsLoading = props.superCoinsLoading,
934
+ fkSupercoinBurnBalance = props.fkSupercoinBurnBalance,
935
+ onLoginButtonClick = props.onLoginButtonClick,
936
+ _a = props.showAllLobs,
937
+ showAllLobs = _a === void 0 ? false : _a,
938
+ selectedLOB = props.selectedLOB,
939
+ isUserLoggedIn = props.isUserLoggedIn,
940
+ handleLogoutClick = props.handleLogoutClick,
941
+ walletBalance = props.walletBalance,
942
+ walletLoading = props.walletLoading,
943
+ loyaltyLoading = props.loyaltyLoading,
944
+ loyaltyType = props.loyaltyType,
945
+ userDetailsLoading = props.userDetailsLoading,
946
+ userName = props.userName,
947
+ userMobileNumber = props.userMobileNumber,
948
+ countryCode = props.countryCode,
949
+ loyaltyChipClick = props.loyaltyChipClick,
950
+ supercoinsChipClick = props.supercoinsChipClick,
951
+ walletChipClick = props.walletChipClick;
952
+ props.ravenPayload;
953
+ props.ravenPushCallback;
954
+ var _c = useHoverDropdown({
955
+ openDelay: 500
956
+ }),
957
+ isDropdownVisible = _c.isDropdownVisible,
958
+ hoveredElemIndex = _c.hoveredElemIndex,
959
+ handleOnMouseEnter = _c.handleOnMouseEnter,
960
+ handleOnMouseLeave = _c.handleOnMouseLeave,
961
+ handleDropdownMouseEnter = _c.handleDropdownMouseEnter,
962
+ handleDropdownMouseLeave = _c.handleDropdownMouseLeave;
963
+ return jsxRuntime.jsxs(jsxRuntime.Fragment, {
964
+ children: [jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({
965
+ className: 'flex t-0 p-sticky w-100p flex-middle flex-center flex-gap-6 flex-no-shrink',
966
+ style: {
967
+ zIndex: 1000,
968
+ height: 64,
969
+ borderBottom: '1px solid #E6E6E6',
970
+ background: '#F7FAFF'
971
+ }
972
+ }, {
973
+ children: jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
974
+ className: 'flex flex-middle flex-between flex-gap-6',
975
+ style: {
976
+ maxWidth: 1440,
977
+ padding: '0px 28px',
978
+ flex: '1 0 0'
979
+ }
980
+ }, {
981
+ children: [jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
982
+ className: 'flex flex-row flex-center flex-middle'
983
+ }, {
984
+ children: [jsxRuntime.jsx(ctDesignIcons.CTLogo, {}), jsxRuntime.jsx(ctDesignDivider.Divider, {
985
+ style: {
986
+ width: 12,
987
+ marginLeft: 2,
988
+ marginRight: 2,
989
+ transform: 'rotate(90deg)',
990
+ borderBottom: '1px solid #e0e0e0'
991
+ }
992
+ }), jsxRuntime.jsx(ctDesignIcons.Fkcompany, {})]
993
+ })), jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
994
+ className: 'flex flex-row flex-middle flex-center flex-cg-6'
995
+ }, {
996
+ children: [jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({
997
+ className: 'flex flex-row flex-middle flex-center flex-cg-1'
998
+ }, {
999
+ children: NAVBAR_OPTIONS.map(function (option, index) {
1000
+ var isHovered = hoveredElemIndex === index;
1001
+ return jsxRuntime.jsxs(ctDesignContainer.Container, {
1002
+ children: [jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
1003
+ onMouseEnter: function () {
1004
+ return handleOnMouseEnter(index);
1005
+ },
1006
+ onMouseLeave: handleOnMouseLeave,
1007
+ className: 'flex flex-row flex-middle px-3 py-2 c-pointer p-relative',
1008
+ style: {
1009
+ columnGap: 8,
1010
+ height: 64
1011
+ },
1012
+ onClick: function () {
1013
+ if (option.isClickable) {
1014
+ window.location.href = option.link;
1015
+ }
1016
+ }
1017
+ }, {
1018
+ children: [jsxRuntime.jsx(option.lefticon, {
1019
+ color: isHovered ? '#FF4F17' : '#1A1A1A'
1020
+ }), jsxRuntime.jsxs(ctDesignContainer.Container, tslib.__assign({
1021
+ className: 'flex flex-row flex-middle'
1022
+ }, {
1023
+ children: [jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({
1024
+ variant: 'B2',
1025
+ color: isHovered ? 'secondary' : 'primary',
1026
+ isClickable: true
1027
+ }, {
1028
+ children: option.text
1029
+ })), option.rightIcon && jsxRuntime.jsx(option.rightIcon, {
1030
+ width: 20,
1031
+ height: 20,
1032
+ fill: isHovered ? '#FF4F17' : '#1A1A1A'
1033
+ })]
1034
+ }))]
1035
+ }), "nav-option-".concat(index)), jsxRuntime.jsx(HeaderAnimatedMask, tslib.__assign({
1036
+ show: hoveredElemIndex === index && option.isHoverable && isDropdownVisible,
1037
+ marginTop: '64px',
1038
+ handleDropdownMouseEnter: handleDropdownMouseEnter,
1039
+ handleDropdownMouseLeave: handleDropdownMouseLeave,
1040
+ onMaskClick: handleDropdownMouseLeave
1041
+ }, {
1042
+ children: jsxRuntime.jsx(BusinessDropdownContent, {
1043
+ isOpen: hoveredElemIndex === index && option.isHoverable && isDropdownVisible
1044
+ })
1045
+ }))]
1046
+ });
1047
+ })
1048
+ })), isUserLoggedIn && jsxRuntime.jsx(ctDesignDivider.Divider, {
1049
+ style: {
1050
+ width: 12,
1051
+ margin: '0 -18px',
1052
+ transform: 'rotate(90deg)',
1053
+ borderBottom: '1px solid #e0e0e0'
1054
+ }
1055
+ }), jsxRuntime.jsx(ctDesignContainer.Container, {
1056
+ children: isUserLoggedIn ? jsxRuntime.jsx(ctDesignContainer.Container, tslib.__assign({
1057
+ className: 'flex flex-row flex-middle'
1058
+ }, {
1059
+ children: jsxRuntime.jsx(UserAccount, {
1060
+ handleLogout: handleLogoutClick,
1061
+ superCoinsLoading: superCoinsLoading,
1062
+ fkSupercoinBurnBalance: fkSupercoinBurnBalance,
1063
+ walletBalance: walletBalance,
1064
+ walletLoading: walletLoading,
1065
+ loyaltyLoading: loyaltyLoading,
1066
+ loyaltyType: loyaltyType,
1067
+ userDetailsLoading: userDetailsLoading,
1068
+ userName: userName,
1069
+ userMobileNumber: userMobileNumber,
1070
+ countryCode: countryCode,
1071
+ walletChipClick: walletChipClick,
1072
+ supercoinsChipClick: supercoinsChipClick,
1073
+ loyaltyChipClick: loyaltyChipClick
1074
+ })
1075
+ })) : jsxRuntime.jsx(ctDesignButton.Button, tslib.__assign({
1076
+ className: "fw-400 fs-14 login-button",
1077
+ onClick: onLoginButtonClick,
1078
+ style: {
1079
+ width: 153,
1080
+ height: 40,
1081
+ border: '1px solid #1A1A1A'
1082
+ },
1083
+ loading: false
1084
+ }, {
1085
+ children: jsxRuntime.jsx(ctDesignTypography.Typography, tslib.__assign({
1086
+ componentNode: 'span',
1087
+ variant: 'L2'
1088
+ }, {
1089
+ children: "Login"
1090
+ }))
1091
+ }))
1092
+ })]
1093
+ }))]
1094
+ }))
1095
+ })), showAllLobs && jsxRuntime.jsx(LobsHeader, {
1096
+ selectedLOB: selectedLOB
1097
+ })]
1098
+ });
527
1099
  };
528
1100
 
529
1101
  exports.Header = Header;