igloo-d2c-components 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/assets/icons/alert.svg +5 -0
- package/dist/assets/icons/arrow-down.svg +3 -0
- package/dist/assets/icons/arrow.svg +9 -0
- package/dist/assets/icons/close.svg +4 -0
- package/dist/assets/icons/facebook.svg +3 -0
- package/dist/assets/icons/index.ts +26 -0
- package/dist/assets/icons/instagram.svg +11 -0
- package/dist/assets/icons/youtube.svg +11 -0
- package/dist/assets/index.ts +13 -0
- package/dist/assets/tenants/ammetlife/logo.svg +10 -0
- package/dist/assets/tenants/cimb/logo-white.png +0 -0
- package/dist/assets/tenants/cimb/logo.svg +62 -0
- package/dist/assets/tenants/igloo/logo.svg +22 -0
- package/dist/cjs/index.js +2124 -38
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +2083 -38
- package/dist/esm/index.js.map +1 -1
- package/dist/types/assets/icons/index.d.ts +21 -0
- package/dist/types/assets/index.d.ts +9 -0
- package/dist/types/components/BillingToggle/BillingToggle.d.ts +34 -0
- package/dist/types/components/BillingToggle/index.d.ts +3 -0
- package/dist/types/components/BillingToggle/styled.d.ts +12 -0
- package/dist/types/components/CoverageAmountSlider/CoverageAmountSlider.d.ts +53 -0
- package/dist/types/components/CoverageAmountSlider/index.d.ts +3 -0
- package/dist/types/components/CoverageAmountSlider/styled.d.ts +41 -0
- package/dist/types/components/Footer/Footer.d.ts +94 -0
- package/dist/types/components/Footer/index.d.ts +3 -0
- package/dist/types/components/Footer/styled.d.ts +38 -0
- package/dist/types/components/Header/Header.d.ts +159 -0
- package/dist/types/components/Header/index.d.ts +3 -0
- package/dist/types/components/Header/styled.d.ts +80 -0
- package/dist/types/components/InfoCallout/InfoCallout.d.ts +34 -0
- package/dist/types/components/InfoCallout/index.d.ts +3 -0
- package/dist/types/components/InfoCallout/styled.d.ts +16 -0
- package/dist/types/components/NewHeader/NewHeader.d.ts +60 -0
- package/dist/types/components/NewHeader/index.d.ts +3 -0
- package/dist/types/components/NewHeader/styled.d.ts +26 -0
- package/dist/types/components/OptionButton/OptionButton.d.ts +59 -0
- package/dist/types/components/OptionButton/index.d.ts +3 -0
- package/dist/types/components/OptionButton/styled.d.ts +18 -0
- package/dist/types/components/ProductSelectionDrawer/ProductSelectionDrawer.d.ts +54 -0
- package/dist/types/components/ProductSelectionDrawer/index.d.ts +3 -0
- package/dist/types/components/ProductSelectionDrawer/styled.d.ts +44 -0
- package/dist/types/components/QuestionSection/QuestionSection.d.ts +71 -0
- package/dist/types/components/QuestionSection/index.d.ts +3 -0
- package/dist/types/components/QuestionSection/styled.d.ts +16 -0
- package/dist/types/components/RecommendationsDrawer/RecommendationsDrawer.d.ts +92 -0
- package/dist/types/components/RecommendationsDrawer/index.d.ts +3 -0
- package/dist/types/components/RecommendationsDrawer/styled.d.ts +35 -0
- package/dist/types/components/ToggleGroup/ToggleGroup.d.ts +45 -0
- package/dist/types/components/ToggleGroup/index.d.ts +3 -0
- package/dist/types/components/ToggleGroup/styled.d.ts +17 -0
- package/dist/types/context/TenantThemeContext.d.ts +3 -2
- package/dist/types/index.d.ts +30 -4
- package/dist/types/{components/Banner → storybook-components}/Banner.stories.d.ts +1 -1
- package/dist/types/storybook-components/BillingToggle.stories.d.ts +10 -0
- package/dist/types/{components/Button → storybook-components}/Button.stories.d.ts +1 -1
- package/dist/types/{components/Card → storybook-components}/Card.stories.d.ts +1 -1
- package/dist/types/storybook-components/CoverageAmountSlider.stories.d.ts +14 -0
- package/dist/types/storybook-components/Footer.stories.d.ts +10 -0
- package/dist/types/storybook-components/Header.stories.d.ts +9 -0
- package/dist/types/storybook-components/InfoCallout.stories.d.ts +11 -0
- package/dist/types/storybook-components/NewHeader.stories.d.ts +82 -0
- package/dist/types/storybook-components/OptionButton.stories.d.ts +12 -0
- package/dist/types/storybook-components/ProductSelectionDrawer.stories.d.ts +24 -0
- package/dist/types/storybook-components/QuestionSection.stories.d.ts +11 -0
- package/dist/types/storybook-components/RecommendationsDrawer.stories.d.ts +36 -0
- package/dist/types/storybook-components/ToggleGroup.stories.d.ts +10 -0
- package/dist/types/themes/index.d.ts +1 -1
- package/dist/types/themes/typography.d.ts +69 -0
- package/dist/types/types/tenant.d.ts +23 -2
- package/dist/types/utils/assets.d.ts +54 -0
- package/dist/types/utils/theme.d.ts +3 -2
- package/package.json +4 -2
package/dist/cjs/index.js
CHANGED
|
@@ -2,10 +2,40 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
-
var
|
|
5
|
+
var React = require('react');
|
|
6
6
|
var material = require('@mui/material');
|
|
7
|
+
var CloseIcon = require('@mui/icons-material/Close');
|
|
8
|
+
var ArrowDropDownIcon = require('@mui/icons-material/ArrowDropDown');
|
|
9
|
+
var MenuIcon = require('@mui/icons-material/Menu');
|
|
10
|
+
var AppBar = require('@mui/material/AppBar');
|
|
11
|
+
var Container = require('@mui/material/Container');
|
|
12
|
+
var styles = require('@mui/material/styles');
|
|
13
|
+
var ArrowBackIcon = require('@mui/icons-material/ArrowBack');
|
|
14
|
+
var InfoIcon = require('@mui/icons-material/Info');
|
|
15
|
+
var AddIcon = require('@mui/icons-material/Add');
|
|
16
|
+
var DragHandleIcon = require('@mui/icons-material/DragHandle');
|
|
17
|
+
var RemoveIcon = require('@mui/icons-material/Remove');
|
|
7
18
|
|
|
8
|
-
|
|
19
|
+
function _interopNamespaceDefault(e) {
|
|
20
|
+
var n = Object.create(null);
|
|
21
|
+
if (e) {
|
|
22
|
+
Object.keys(e).forEach(function (k) {
|
|
23
|
+
if (k !== 'default') {
|
|
24
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
25
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () { return e[k]; }
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
n.default = e;
|
|
33
|
+
return Object.freeze(n);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
37
|
+
|
|
38
|
+
const TenantThemeContext = React.createContext(undefined);
|
|
9
39
|
/**
|
|
10
40
|
* TenantThemeProvider
|
|
11
41
|
* Wraps components to provide tenant-specific theming
|
|
@@ -21,7 +51,7 @@ const TenantThemeContext = react.createContext(undefined);
|
|
|
21
51
|
* ```
|
|
22
52
|
*/
|
|
23
53
|
function TenantThemeProvider({ children, tenantId, theme, }) {
|
|
24
|
-
const value =
|
|
54
|
+
const value = React.useMemo(() => ({
|
|
25
55
|
tenantId,
|
|
26
56
|
theme,
|
|
27
57
|
}), [tenantId, theme]);
|
|
@@ -29,11 +59,20 @@ function TenantThemeProvider({ children, tenantId, theme, }) {
|
|
|
29
59
|
}
|
|
30
60
|
/**
|
|
31
61
|
* Hook to access tenant theme configuration
|
|
32
|
-
*
|
|
62
|
+
* Returns undefined during SSR if context is not available
|
|
63
|
+
* @returns TenantContextValue or undefined during SSR
|
|
33
64
|
*/
|
|
34
65
|
function useTenantTheme() {
|
|
35
|
-
const context =
|
|
66
|
+
const context = React.useContext(TenantThemeContext);
|
|
67
|
+
// During SSR, context might be undefined - return undefined instead of throwing
|
|
68
|
+
// This allows components to handle SSR gracefully with fallback values
|
|
36
69
|
if (context === undefined) {
|
|
70
|
+
// Check if we're in a browser environment
|
|
71
|
+
if (typeof window === 'undefined') {
|
|
72
|
+
// SSR - return undefined to allow fallback handling
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
// Client-side but no provider - throw error for development
|
|
37
76
|
throw new Error('useTenantTheme must be used within a TenantThemeProvider');
|
|
38
77
|
}
|
|
39
78
|
return context;
|
|
@@ -42,15 +81,160 @@ function useTenantTheme() {
|
|
|
42
81
|
* Hook to get tenant ID
|
|
43
82
|
*/
|
|
44
83
|
function useTenantId() {
|
|
45
|
-
const
|
|
46
|
-
return tenantId;
|
|
84
|
+
const tenantTheme = useTenantTheme();
|
|
85
|
+
return (tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.tenantId) || '';
|
|
47
86
|
}
|
|
48
87
|
/**
|
|
49
88
|
* Hook to check if current tenant matches given tenant ID
|
|
50
89
|
*/
|
|
51
90
|
function useIsTenant(checkTenantId) {
|
|
52
|
-
const
|
|
53
|
-
return tenantId === checkTenantId;
|
|
91
|
+
const tenantTheme = useTenantTheme();
|
|
92
|
+
return (tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.tenantId) === checkTenantId;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Tenant Typography Configurations
|
|
97
|
+
* Centralized typography definitions for all tenants
|
|
98
|
+
* Based on b2c-web-demo typography structure
|
|
99
|
+
*/
|
|
100
|
+
/**
|
|
101
|
+
* Igloo Typography Configuration
|
|
102
|
+
*/
|
|
103
|
+
const iglooTypography = {
|
|
104
|
+
fontFamily: 'Montserrat',
|
|
105
|
+
fontWeightRegular: 400,
|
|
106
|
+
fontWeightMedium: 500,
|
|
107
|
+
fontWeightSemiBold: 600,
|
|
108
|
+
fontWeightBold: 700,
|
|
109
|
+
fontWeightExtraBold: 800,
|
|
110
|
+
fontWeightExtraBlack: 900,
|
|
111
|
+
h1: {
|
|
112
|
+
fontSize: '42px',
|
|
113
|
+
fontStyle: 'normal',
|
|
114
|
+
fontWeight: 700,
|
|
115
|
+
lineHeight: '48px',
|
|
116
|
+
'@media (max-width:600px)': {
|
|
117
|
+
fontSize: '24px',
|
|
118
|
+
fontStyle: 'normal',
|
|
119
|
+
fontWeight: 700,
|
|
120
|
+
lineHeight: '30px',
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
h2: {
|
|
124
|
+
fontSize: '22px',
|
|
125
|
+
fontStyle: 'normal',
|
|
126
|
+
fontWeight: 700,
|
|
127
|
+
lineHeight: '26px',
|
|
128
|
+
'@media (max-width:600px)': {
|
|
129
|
+
fontSize: '14px',
|
|
130
|
+
fontStyle: 'normal',
|
|
131
|
+
fontWeight: 700,
|
|
132
|
+
lineHeight: '22px',
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
h3: {
|
|
136
|
+
fontSize: '18px',
|
|
137
|
+
fontStyle: 'normal',
|
|
138
|
+
fontWeight: 600,
|
|
139
|
+
lineHeight: '24px',
|
|
140
|
+
'@media (max-width:600px)': {
|
|
141
|
+
fontSize: '14px',
|
|
142
|
+
fontStyle: 'normal',
|
|
143
|
+
fontWeight: 600,
|
|
144
|
+
lineHeight: '20px',
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
h4: {
|
|
148
|
+
fontSize: '18px',
|
|
149
|
+
fontStyle: 'normal',
|
|
150
|
+
fontWeight: 600,
|
|
151
|
+
lineHeight: '24px',
|
|
152
|
+
'@media (max-width:600px)': {
|
|
153
|
+
fontSize: '14px',
|
|
154
|
+
fontStyle: 'normal',
|
|
155
|
+
fontWeight: 500,
|
|
156
|
+
lineHeight: '18px',
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
bodyStrongLarge: {
|
|
160
|
+
fontSize: '16px',
|
|
161
|
+
fontStyle: 'normal',
|
|
162
|
+
fontWeight: 500,
|
|
163
|
+
lineHeight: '20px',
|
|
164
|
+
'@media (max-width:600px)': {
|
|
165
|
+
fontSize: '14px',
|
|
166
|
+
fontStyle: 'normal',
|
|
167
|
+
fontWeight: 400,
|
|
168
|
+
lineHeight: '18px',
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
bodyStrongMedium: {
|
|
172
|
+
fontSize: '14px',
|
|
173
|
+
fontStyle: 'normal',
|
|
174
|
+
fontWeight: 500,
|
|
175
|
+
lineHeight: '18px',
|
|
176
|
+
},
|
|
177
|
+
bodyStrongSmall: {
|
|
178
|
+
fontSize: '12px',
|
|
179
|
+
fontStyle: 'normal',
|
|
180
|
+
fontWeight: 500,
|
|
181
|
+
lineHeight: '16px',
|
|
182
|
+
},
|
|
183
|
+
bodyLarge: {
|
|
184
|
+
fontSize: '16px',
|
|
185
|
+
fontStyle: 'normal',
|
|
186
|
+
fontWeight: 400,
|
|
187
|
+
lineHeight: '20px',
|
|
188
|
+
'@media (max-width:600px)': {
|
|
189
|
+
fontSize: '14px',
|
|
190
|
+
fontStyle: 'normal',
|
|
191
|
+
fontWeight: 400,
|
|
192
|
+
lineHeight: '18px',
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
bodyMedium: {
|
|
196
|
+
fontSize: '14px',
|
|
197
|
+
fontStyle: 'normal',
|
|
198
|
+
fontWeight: 400,
|
|
199
|
+
lineHeight: '20px',
|
|
200
|
+
},
|
|
201
|
+
bodySmall: {
|
|
202
|
+
fontSize: '12px',
|
|
203
|
+
fontStyle: 'normal',
|
|
204
|
+
fontWeight: 400,
|
|
205
|
+
lineHeight: '16px',
|
|
206
|
+
},
|
|
207
|
+
smallText: {
|
|
208
|
+
fontSize: '8px',
|
|
209
|
+
fontStyle: 'normal',
|
|
210
|
+
fontWeight: 500,
|
|
211
|
+
lineHeight: '16px',
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* CIMB Typography Configuration
|
|
216
|
+
*/
|
|
217
|
+
const cimbTypography = Object.assign(Object.assign({}, iglooTypography), { fontFamily: 'CIMB Sans' });
|
|
218
|
+
/**
|
|
219
|
+
* AmmetLife Typography Configuration
|
|
220
|
+
*/
|
|
221
|
+
const ammetlifeTypography = Object.assign(Object.assign({}, iglooTypography), { fontFamily: 'Montserrat' });
|
|
222
|
+
/**
|
|
223
|
+
* Typography Registry
|
|
224
|
+
* Map of tenant IDs to their typography configurations
|
|
225
|
+
*/
|
|
226
|
+
const tenantTypography = {
|
|
227
|
+
igloo: iglooTypography,
|
|
228
|
+
cimb: cimbTypography,
|
|
229
|
+
ammetlife: ammetlifeTypography,
|
|
230
|
+
};
|
|
231
|
+
/**
|
|
232
|
+
* Get typography configuration by tenant ID
|
|
233
|
+
* @param tenantId - The tenant identifier
|
|
234
|
+
* @returns Typography configuration for the specified tenant
|
|
235
|
+
*/
|
|
236
|
+
function getTenantTypography(tenantId) {
|
|
237
|
+
return tenantTypography[tenantId] || iglooTypography;
|
|
54
238
|
}
|
|
55
239
|
|
|
56
240
|
/**
|
|
@@ -94,6 +278,19 @@ const iglooTheme = {
|
|
|
94
278
|
bright: '#fff',
|
|
95
279
|
granite: '#666',
|
|
96
280
|
},
|
|
281
|
+
// UI Component Colors
|
|
282
|
+
ui: {
|
|
283
|
+
sliderActive: '#5656F6',
|
|
284
|
+
sliderInactive: '#c8c5ca',
|
|
285
|
+
sliderBackground: '#f9f9f9',
|
|
286
|
+
toggleActive: '#5656F6',
|
|
287
|
+
toggleActiveText: '#ffffff',
|
|
288
|
+
toggleInactiveText: '#5f5e62',
|
|
289
|
+
calloutBackground: '#f9f9f9',
|
|
290
|
+
calloutBorder: '#ffffff',
|
|
291
|
+
inputBackground: '#ffffff',
|
|
292
|
+
inputBorder: '#eeeeee',
|
|
293
|
+
},
|
|
97
294
|
motor: {
|
|
98
295
|
main: '#00CCFF',
|
|
99
296
|
light: 'rgba(0, 208, 255, 0.10)',
|
|
@@ -119,11 +316,10 @@ const iglooTheme = {
|
|
|
119
316
|
main: '#F3A100',
|
|
120
317
|
},
|
|
121
318
|
},
|
|
122
|
-
typography: {
|
|
123
|
-
|
|
124
|
-
},
|
|
125
|
-
logo: '/assets/igloo_nobeta.svg',
|
|
319
|
+
typography: Object.assign(Object.assign({}, iglooTypography), { fontFamily: '"Manrope", "Roboto", "Helvetica", "Arial", sans-serif' }),
|
|
320
|
+
logo: '/assets/tenants/igloo/logo.svg',
|
|
126
321
|
favicon: 'https://static.iglooinsure.com/icons/favicon.ico',
|
|
322
|
+
assetBaseUrl: '/assets/tenants/igloo',
|
|
127
323
|
};
|
|
128
324
|
/**
|
|
129
325
|
* CIMB Theme Configuration
|
|
@@ -168,6 +364,19 @@ const cimbTheme = {
|
|
|
168
364
|
bright: '#fff',
|
|
169
365
|
granite: '#666',
|
|
170
366
|
},
|
|
367
|
+
// UI Component Colors
|
|
368
|
+
ui: {
|
|
369
|
+
sliderActive: '#C3214B',
|
|
370
|
+
sliderInactive: '#c8c5ca',
|
|
371
|
+
sliderBackground: '#f9f9f9',
|
|
372
|
+
toggleActive: '#EE0500',
|
|
373
|
+
toggleActiveText: '#fefbff',
|
|
374
|
+
toggleInactiveText: '#5f5e62',
|
|
375
|
+
calloutBackground: '#f9f9f9',
|
|
376
|
+
calloutBorder: '#ffffff',
|
|
377
|
+
inputBackground: '#ffffff',
|
|
378
|
+
inputBorder: '#eeeeee',
|
|
379
|
+
},
|
|
171
380
|
motor: {
|
|
172
381
|
main: '#C3214B',
|
|
173
382
|
light: 'rgba(195, 33, 75, 0.10)',
|
|
@@ -194,11 +403,11 @@ const cimbTheme = {
|
|
|
194
403
|
main: '#F3A100',
|
|
195
404
|
},
|
|
196
405
|
},
|
|
197
|
-
typography: {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
logo: '/assets/cimb/cimb-logo.svg',
|
|
406
|
+
typography: Object.assign(Object.assign({}, cimbTypography), { fontFamily: '"CIMB Sans", "Roboto", "Helvetica", "Arial", sans-serif' }),
|
|
407
|
+
logo: '/assets/tenants/cimb/logo.svg',
|
|
408
|
+
logoWhite: '/assets/tenants/cimb/logo-white.png',
|
|
201
409
|
favicon: 'https://static.iglooinsure.com/icons/favicon.ico',
|
|
410
|
+
assetBaseUrl: '/assets/tenants/cimb',
|
|
202
411
|
};
|
|
203
412
|
/**
|
|
204
413
|
* Ammetlife Theme Configuration
|
|
@@ -237,6 +446,19 @@ const ammetlifeTheme = {
|
|
|
237
446
|
bright: '#fff',
|
|
238
447
|
granite: '#666',
|
|
239
448
|
},
|
|
449
|
+
// UI Component Colors
|
|
450
|
+
ui: {
|
|
451
|
+
sliderActive: '#317abc',
|
|
452
|
+
sliderInactive: '#c8c5ca',
|
|
453
|
+
sliderBackground: '#f9f9f9',
|
|
454
|
+
toggleActive: '#a4ce4e',
|
|
455
|
+
toggleActiveText: '#fefbff',
|
|
456
|
+
toggleInactiveText: '#5f5e62',
|
|
457
|
+
calloutBackground: '#f9f9f9',
|
|
458
|
+
calloutBorder: '#ffffff',
|
|
459
|
+
inputBackground: '#ffffff',
|
|
460
|
+
inputBorder: '#eeeeee',
|
|
461
|
+
},
|
|
240
462
|
motor: {
|
|
241
463
|
main: '#1976D2',
|
|
242
464
|
light: 'rgba(25, 118, 210, 0.10)',
|
|
@@ -263,11 +485,10 @@ const ammetlifeTheme = {
|
|
|
263
485
|
main: '#FF9800',
|
|
264
486
|
},
|
|
265
487
|
},
|
|
266
|
-
typography: {
|
|
267
|
-
|
|
268
|
-
},
|
|
269
|
-
logo: '/assets/ammetlife/logo-AmMetLife.svg',
|
|
488
|
+
typography: Object.assign(Object.assign({}, ammetlifeTypography), { fontFamily: '"Montserrat", "Roboto", "Helvetica", "Arial", sans-serif' }),
|
|
489
|
+
logo: '/assets/tenants/ammetlife/logo.svg',
|
|
270
490
|
favicon: 'https://static.iglooinsure.com/icons/favicon.ico',
|
|
491
|
+
assetBaseUrl: '/assets/tenants/ammetlife',
|
|
271
492
|
};
|
|
272
493
|
/**
|
|
273
494
|
* Theme Registry
|
|
@@ -354,12 +575,13 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
354
575
|
* ```
|
|
355
576
|
*/
|
|
356
577
|
function Button(_a) {
|
|
357
|
-
var _b, _c, _d;
|
|
578
|
+
var _b, _c, _d, _e, _f, _g;
|
|
358
579
|
var { tenantColored = false, variant = 'contained', sx, color } = _a, props = __rest(_a, ["tenantColored", "variant", "sx", "color"]);
|
|
359
|
-
const
|
|
360
|
-
const
|
|
361
|
-
|
|
362
|
-
|
|
580
|
+
const tenantTheme = useTenantTheme();
|
|
581
|
+
const theme = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
582
|
+
const buttonSx = tenantColored && theme
|
|
583
|
+
? Object.assign({ backgroundColor: (_c = (_b = theme.palette) === null || _b === void 0 ? void 0 : _b.primary) === null || _c === void 0 ? void 0 : _c.main, color: '#fff', '&:hover': {
|
|
584
|
+
backgroundColor: ((_e = (_d = theme.palette) === null || _d === void 0 ? void 0 : _d.primary) === null || _e === void 0 ? void 0 : _e.dark) || ((_g = (_f = theme.palette) === null || _f === void 0 ? void 0 : _f.primary) === null || _g === void 0 ? void 0 : _g.main),
|
|
363
585
|
} }, sx) : sx;
|
|
364
586
|
return (jsxRuntime.jsx(material.Button, Object.assign({ variant: variant, color: tenantColored ? undefined : color, sx: buttonSx }, props)));
|
|
365
587
|
}
|
|
@@ -378,11 +600,12 @@ function Button(_a) {
|
|
|
378
600
|
* ```
|
|
379
601
|
*/
|
|
380
602
|
function Card(_a) {
|
|
381
|
-
var _b;
|
|
603
|
+
var _b, _c;
|
|
382
604
|
var { title, headerAction, content, actions, tenantAccent = false, sx, children } = _a, props = __rest(_a, ["title", "headerAction", "content", "actions", "tenantAccent", "sx", "children"]);
|
|
383
|
-
const
|
|
384
|
-
const
|
|
385
|
-
|
|
605
|
+
const tenantTheme = useTenantTheme();
|
|
606
|
+
const theme = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
607
|
+
const cardSx = tenantAccent && theme
|
|
608
|
+
? Object.assign({ borderTop: `4px solid ${((_c = (_b = theme.palette) === null || _b === void 0 ? void 0 : _b.primary) === null || _c === void 0 ? void 0 : _c.main) || '#000000'}` }, sx) : sx;
|
|
386
609
|
return (jsxRuntime.jsxs(material.Card, Object.assign({ sx: cardSx }, props, { children: [title && jsxRuntime.jsx(material.CardHeader, { title: title, action: headerAction }), (content || children) && (jsxRuntime.jsx(material.CardContent, { children: content || children })), actions && jsxRuntime.jsx(material.CardActions, { children: actions })] })));
|
|
387
610
|
}
|
|
388
611
|
|
|
@@ -402,25 +625,1322 @@ function Card(_a) {
|
|
|
402
625
|
function Banner(_a) {
|
|
403
626
|
var _b, _c, _d, _e;
|
|
404
627
|
var { title, description, action, gradient = true, sx } = _a, props = __rest(_a, ["title", "description", "action", "gradient", "sx"]);
|
|
405
|
-
const
|
|
628
|
+
const tenantTheme = useTenantTheme();
|
|
629
|
+
const theme = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
630
|
+
const primaryColor = ((_c = (_b = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _b === void 0 ? void 0 : _b.primary) === null || _c === void 0 ? void 0 : _c.main) || '#000000';
|
|
631
|
+
const lightColor = ((_e = (_d = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _d === void 0 ? void 0 : _d.primary) === null || _e === void 0 ? void 0 : _e.light) || primaryColor;
|
|
406
632
|
const background = gradient
|
|
407
|
-
? `linear-gradient(135deg, ${
|
|
408
|
-
:
|
|
633
|
+
? `linear-gradient(135deg, ${primaryColor} 0%, ${lightColor} 100%)`
|
|
634
|
+
: primaryColor;
|
|
409
635
|
return (jsxRuntime.jsxs(material.Box, Object.assign({ sx: Object.assign({ background, color: 'white', padding: '32px', borderRadius: '12px', textAlign: 'center' }, sx) }, props, { children: [jsxRuntime.jsx(material.Typography, Object.assign({ variant: "h4", component: "h2", gutterBottom: true, fontWeight: "bold" }, { children: title })), description && (jsxRuntime.jsx(material.Typography, Object.assign({ variant: "body1", sx: { opacity: 0.95, mb: action ? 2 : 0 } }, { children: description }))), action && jsxRuntime.jsx(material.Box, Object.assign({ sx: { mt: 2 } }, { children: action }))] })));
|
|
410
636
|
}
|
|
411
637
|
|
|
638
|
+
const StyledAppBar$1 = styles.styled(AppBar)(({ theme, ispartnershippagemobileview, scrolled }) => {
|
|
639
|
+
var _a, _b;
|
|
640
|
+
return ({
|
|
641
|
+
zIndex: '1000 !important',
|
|
642
|
+
backgroundColor: ispartnershippagemobileview && !scrolled
|
|
643
|
+
? 'transparent !important'
|
|
644
|
+
: `${((_a = theme.palette.background) === null || _a === void 0 ? void 0 : _a.paper) || '#fff'} !important`,
|
|
645
|
+
boxShadow: 'none !important',
|
|
646
|
+
'& .MuiToolbar-root': {
|
|
647
|
+
minHeight: '80px',
|
|
648
|
+
[(_b = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _b === void 0 ? void 0 : _b.down('md')]: {
|
|
649
|
+
minHeight: '64px',
|
|
650
|
+
},
|
|
651
|
+
},
|
|
652
|
+
[theme.breakpoints.up(1025)]: {
|
|
653
|
+
boxShadow: scrolled && '0px 2px 20px 4px rgba(0, 0, 0, 0.14) !important',
|
|
654
|
+
},
|
|
655
|
+
});
|
|
656
|
+
});
|
|
657
|
+
const ResponsiveB2CLayout = styles.styled('div')(({ theme }) => ({
|
|
658
|
+
[theme.breakpoints.up(1025)]: {
|
|
659
|
+
minWidth: '1128px',
|
|
660
|
+
maxWidth: '1128px',
|
|
661
|
+
margin: '0 auto',
|
|
662
|
+
},
|
|
663
|
+
}));
|
|
664
|
+
const StyledContainer = styles.styled(Container)(({ theme, ispartnershippagemobileview, scrolled }) => {
|
|
665
|
+
var _a;
|
|
666
|
+
return ({
|
|
667
|
+
boxShadow: 'none',
|
|
668
|
+
[(_a = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _a === void 0 ? void 0 : _a.down('md')]: {
|
|
669
|
+
boxShadow: !scrolled ? 'none' : '0px 2px 20px 4px rgba(0, 0, 0, 0.14)',
|
|
670
|
+
},
|
|
671
|
+
});
|
|
672
|
+
});
|
|
673
|
+
const TypographyLogo = styles.styled(material.Typography)(({ theme }) => {
|
|
674
|
+
var _a, _b;
|
|
675
|
+
return ({
|
|
676
|
+
margin: 'auto 40 auto 0',
|
|
677
|
+
display: '-webkit-box',
|
|
678
|
+
alignItems: 'anchor-center',
|
|
679
|
+
[(_a = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _a === void 0 ? void 0 : _a.up('md')]: {
|
|
680
|
+
width: 95,
|
|
681
|
+
height: 57,
|
|
682
|
+
},
|
|
683
|
+
[(_b = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _b === void 0 ? void 0 : _b.down('md')]: {
|
|
684
|
+
width: 73.3,
|
|
685
|
+
display: 'flex',
|
|
686
|
+
},
|
|
687
|
+
});
|
|
688
|
+
});
|
|
689
|
+
const ButtonDesktopMenu = styles.styled(material.Button)(({ theme }) => {
|
|
690
|
+
var _a;
|
|
691
|
+
return ({
|
|
692
|
+
color: ((_a = theme.palette.text) === null || _a === void 0 ? void 0 : _a.primary) || '#000',
|
|
693
|
+
display: 'flex',
|
|
694
|
+
padding: '0px 10px',
|
|
695
|
+
alignItems: 'center',
|
|
696
|
+
gap: 8,
|
|
697
|
+
alignSelf: 'stretch',
|
|
698
|
+
});
|
|
699
|
+
});
|
|
700
|
+
const AnchorLinks = styles.styled('a')(({ theme }) => ({
|
|
701
|
+
color: 'inherit',
|
|
702
|
+
'&:hover': {
|
|
703
|
+
color: 'inherit',
|
|
704
|
+
},
|
|
705
|
+
}));
|
|
706
|
+
const StyledAvatar = styles.styled(material.Avatar)(({ theme }) => {
|
|
707
|
+
var _a;
|
|
708
|
+
return ({
|
|
709
|
+
margin: '15px 0',
|
|
710
|
+
cursor: 'pointer',
|
|
711
|
+
backgroundColor: `${theme.palette.primary.main} !important`,
|
|
712
|
+
[(_a = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _a === void 0 ? void 0 : _a.down('md')]: {
|
|
713
|
+
margin: '0',
|
|
714
|
+
},
|
|
715
|
+
});
|
|
716
|
+
});
|
|
717
|
+
const DivButtonWrapper = styles.styled('div')(({ theme }) => {
|
|
718
|
+
var _a;
|
|
719
|
+
return ({
|
|
720
|
+
justifyContent: 'end',
|
|
721
|
+
display: 'flex',
|
|
722
|
+
marginTop: 0,
|
|
723
|
+
padding: `16px 0`,
|
|
724
|
+
gap: 12,
|
|
725
|
+
[(_a = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _a === void 0 ? void 0 : _a.down('md')]: {
|
|
726
|
+
marginTop: 24,
|
|
727
|
+
padding: 0,
|
|
728
|
+
},
|
|
729
|
+
});
|
|
730
|
+
});
|
|
731
|
+
const ButtonAuth = styles.styled(material.Button)(({ theme }) => ({
|
|
732
|
+
justifyContent: 'center',
|
|
733
|
+
alignItems: 'center',
|
|
734
|
+
borderRadius: '100px !important',
|
|
735
|
+
borderColor: theme.palette.primary.main,
|
|
736
|
+
borderStyle: 'solid',
|
|
737
|
+
borderWidth: 1,
|
|
738
|
+
flex: 1,
|
|
739
|
+
height: 40,
|
|
740
|
+
minWidth: 'max-content !important',
|
|
741
|
+
}));
|
|
742
|
+
const TypographyAuth = styles.styled(material.Typography)(({ theme }) => ({
|
|
743
|
+
textTransform: 'none',
|
|
744
|
+
}));
|
|
745
|
+
const StyledMenu = styles.styled(material.Menu)(({ theme }) => {
|
|
746
|
+
var _a;
|
|
747
|
+
return ({
|
|
748
|
+
'& .MuiMenu-paper': {
|
|
749
|
+
left: 'auto',
|
|
750
|
+
width: 'fit-content',
|
|
751
|
+
maxWidth: 'unset',
|
|
752
|
+
boxShadow: 'inset',
|
|
753
|
+
borderRadius: 16,
|
|
754
|
+
[(_a = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _a === void 0 ? void 0 : _a.down('md')]: {
|
|
755
|
+
left: `0 !important`,
|
|
756
|
+
width: '100%',
|
|
757
|
+
boxShadow: 'none !important',
|
|
758
|
+
borderRadius: 'none',
|
|
759
|
+
},
|
|
760
|
+
},
|
|
761
|
+
});
|
|
762
|
+
});
|
|
763
|
+
const DivProductListing = styles.styled('div')(({ theme }) => {
|
|
764
|
+
var _a;
|
|
765
|
+
return ({
|
|
766
|
+
padding: '0 16px',
|
|
767
|
+
display: 'flex',
|
|
768
|
+
flexDirection: 'column',
|
|
769
|
+
alignSelf: 'stretch',
|
|
770
|
+
[(_a = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _a === void 0 ? void 0 : _a.down('md')]: {
|
|
771
|
+
padding: 16,
|
|
772
|
+
},
|
|
773
|
+
});
|
|
774
|
+
});
|
|
775
|
+
const StyledMenuItem = styles.styled(material.MenuItem)(({ theme }) => {
|
|
776
|
+
var _a;
|
|
777
|
+
return ({
|
|
778
|
+
display: 'flex',
|
|
779
|
+
borderBottom: 'none',
|
|
780
|
+
alignItems: 'flex-start',
|
|
781
|
+
gap: 6,
|
|
782
|
+
padding: '16px 0 !important',
|
|
783
|
+
'&:last-child': {
|
|
784
|
+
borderBottom: 'none !important',
|
|
785
|
+
},
|
|
786
|
+
width: '100%',
|
|
787
|
+
[(_a = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _a === void 0 ? void 0 : _a.down('md')]: {
|
|
788
|
+
borderBottom: `1px solid ${theme.palette.divider} !important`,
|
|
789
|
+
},
|
|
790
|
+
});
|
|
791
|
+
});
|
|
792
|
+
const SpanImageWrapper = styles.styled('span')(({ theme }) => ({
|
|
793
|
+
alignItems: 'center',
|
|
794
|
+
display: 'flex',
|
|
795
|
+
justifyContent: 'center',
|
|
796
|
+
margin: 'auto 0',
|
|
797
|
+
}));
|
|
798
|
+
const ImageProductIcon = styles.styled('img')(({ theme }) => ({
|
|
799
|
+
aspectRatio: 1,
|
|
800
|
+
objectPosition: 'center',
|
|
801
|
+
width: 18,
|
|
802
|
+
height: 18,
|
|
803
|
+
}));
|
|
804
|
+
const StyledMenuItemDesktop = styles.styled(material.MenuItem)(({ theme }) => {
|
|
805
|
+
var _a, _b;
|
|
806
|
+
return ({
|
|
807
|
+
color: `${((_a = theme.palette.secondary) === null || _a === void 0 ? void 0 : _a.main) || '#f00'} !important`,
|
|
808
|
+
display: 'flex',
|
|
809
|
+
borderBottom: 'none',
|
|
810
|
+
alignItems: 'flex-start',
|
|
811
|
+
gap: 6,
|
|
812
|
+
padding: '16px 0 !important',
|
|
813
|
+
'&:last-child': {
|
|
814
|
+
borderBottom: 'none !important',
|
|
815
|
+
},
|
|
816
|
+
width: '100%',
|
|
817
|
+
[(_b = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _b === void 0 ? void 0 : _b.down('md')]: {
|
|
818
|
+
borderBottom: `1px solid ${theme.palette.divider} !important`,
|
|
819
|
+
},
|
|
820
|
+
});
|
|
821
|
+
});
|
|
822
|
+
const StyledCloseIcon = styles.styled(CloseIcon)(({ theme }) => {
|
|
823
|
+
var _a;
|
|
824
|
+
return ({
|
|
825
|
+
color: `${((_a = theme.palette.text) === null || _a === void 0 ? void 0 : _a.primary) || '#000'}`,
|
|
826
|
+
});
|
|
827
|
+
});
|
|
828
|
+
const StyledAvatarUserIcon = styles.styled(material.Avatar)(({ theme }) => {
|
|
829
|
+
var _a, _b;
|
|
830
|
+
return ({
|
|
831
|
+
margin: '15px 0',
|
|
832
|
+
cursor: 'pointer',
|
|
833
|
+
backgroundColor: `${((_a = theme.palette.text) === null || _a === void 0 ? void 0 : _a.primary) || '#000'} !important`,
|
|
834
|
+
[(_b = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _b === void 0 ? void 0 : _b.down('md')]: {
|
|
835
|
+
margin: '0',
|
|
836
|
+
},
|
|
837
|
+
});
|
|
838
|
+
});
|
|
839
|
+
const StyledMenuIcon = styles.styled(MenuIcon)(({ theme, ispartnershippagemobileview, scrolled }) => {
|
|
840
|
+
var _a, _b;
|
|
841
|
+
return ({
|
|
842
|
+
color: ispartnershippagemobileview && !scrolled
|
|
843
|
+
? ((_a = theme.palette.common) === null || _a === void 0 ? void 0 : _a.white) || '#fff'
|
|
844
|
+
: `${((_b = theme.palette.text) === null || _b === void 0 ? void 0 : _b.primary) || '#000'}`,
|
|
845
|
+
});
|
|
846
|
+
});
|
|
847
|
+
const StyledDrawer$3 = styles.styled(material.Drawer)(({ theme }) => {
|
|
848
|
+
var _a;
|
|
849
|
+
return ({
|
|
850
|
+
'& .MuiMenu-paper': {
|
|
851
|
+
left: 'auto',
|
|
852
|
+
width: 'fit-content',
|
|
853
|
+
maxWidth: 'unset',
|
|
854
|
+
boxShadow: 'inset',
|
|
855
|
+
borderRadius: 16,
|
|
856
|
+
[(_a = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _a === void 0 ? void 0 : _a.down('md')]: {
|
|
857
|
+
left: `0 !important`,
|
|
858
|
+
width: '100%',
|
|
859
|
+
boxShadow: 'none !important',
|
|
860
|
+
borderRadius: 'none',
|
|
861
|
+
},
|
|
862
|
+
},
|
|
863
|
+
});
|
|
864
|
+
});
|
|
865
|
+
const DivLogoWrapper = styles.styled('div')(({ theme }) => ({
|
|
866
|
+
justifyContent: 'space-between',
|
|
867
|
+
alignSelf: 'stretch',
|
|
868
|
+
backgroundColor: '',
|
|
869
|
+
display: 'flex',
|
|
870
|
+
gap: '20px',
|
|
871
|
+
padding: '12px 16px',
|
|
872
|
+
marginBottom: 16,
|
|
873
|
+
}));
|
|
874
|
+
const DivLogo = styles.styled('div')(({ theme }) => {
|
|
875
|
+
var _a, _b;
|
|
876
|
+
return ({
|
|
877
|
+
margin: 'auto 40 auto 0',
|
|
878
|
+
display: '-webkit-box',
|
|
879
|
+
[(_a = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _a === void 0 ? void 0 : _a.up('md')]: {
|
|
880
|
+
width: 95,
|
|
881
|
+
height: 57,
|
|
882
|
+
},
|
|
883
|
+
[(_b = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _b === void 0 ? void 0 : _b.down('md')]: {
|
|
884
|
+
width: 60,
|
|
885
|
+
height: 36,
|
|
886
|
+
display: 'flex',
|
|
887
|
+
},
|
|
888
|
+
});
|
|
889
|
+
});
|
|
890
|
+
const DivCrossIconWrapper = styles.styled('div')(({ theme }) => ({
|
|
891
|
+
display: 'flex',
|
|
892
|
+
alignItems: 'center',
|
|
893
|
+
justifyContent: 'center',
|
|
894
|
+
padding: 6,
|
|
895
|
+
}));
|
|
896
|
+
const StyledCloseIconBtn = styles.styled(material.IconButton)(({ theme }) => {
|
|
897
|
+
var _a;
|
|
898
|
+
return ({
|
|
899
|
+
color: `${((_a = theme.palette.text) === null || _a === void 0 ? void 0 : _a.primary) || '#000'} !important`,
|
|
900
|
+
padding: '0 !important',
|
|
901
|
+
});
|
|
902
|
+
});
|
|
903
|
+
const DivLoginActionContainer = styles.styled('div')(({ theme }) => ({
|
|
904
|
+
justifyContent: 'center',
|
|
905
|
+
alignSelf: 'stretch',
|
|
906
|
+
display: 'flex',
|
|
907
|
+
flexDirection: 'column',
|
|
908
|
+
padding: ' 0 16px',
|
|
909
|
+
}));
|
|
910
|
+
const DivCommonMenus = styles.styled('div')(({ theme }) => ({
|
|
911
|
+
padding: 16,
|
|
912
|
+
display: 'flex',
|
|
913
|
+
flexDirection: 'column',
|
|
914
|
+
alignSelf: 'stretch',
|
|
915
|
+
alignItems: 'flex-start',
|
|
916
|
+
}));
|
|
917
|
+
const MenuItemOtherLinks = styles.styled(material.MenuItem)(({ theme }) => ({
|
|
918
|
+
display: 'flex',
|
|
919
|
+
borderBottom: `1px solid ${theme.palette.divider} !important`,
|
|
920
|
+
alignItems: 'flex-start',
|
|
921
|
+
padding: '16px 0 !important',
|
|
922
|
+
'&:last-child': {
|
|
923
|
+
borderBottom: 'none !important',
|
|
924
|
+
gap: '30px',
|
|
925
|
+
justifyContent: 'space-between',
|
|
926
|
+
},
|
|
927
|
+
width: '100%',
|
|
928
|
+
gap: '50%',
|
|
929
|
+
}));
|
|
930
|
+
const StyledFormControlLabel = styles.styled(material.FormControlLabel)(({ theme }) => ({
|
|
931
|
+
'& .MuiRadio-root': {
|
|
932
|
+
padding: '0 9px',
|
|
933
|
+
},
|
|
934
|
+
}));
|
|
935
|
+
const ButtonLogout = styles.styled(material.Button)(({ theme }) => {
|
|
936
|
+
var _a, _b;
|
|
937
|
+
return ({
|
|
938
|
+
display: 'flex',
|
|
939
|
+
padding: 16,
|
|
940
|
+
alignItems: 'center',
|
|
941
|
+
gap: 78,
|
|
942
|
+
alignSelf: 'stretch',
|
|
943
|
+
width: '100%',
|
|
944
|
+
flex: '1 0 0',
|
|
945
|
+
justifyContent: 'center',
|
|
946
|
+
flexDirection: 'column',
|
|
947
|
+
borderRadius: '100px !important',
|
|
948
|
+
border: `1px solid ${((_a = theme.palette.secondary) === null || _a === void 0 ? void 0 : _a.main) || '#f00'} !important`,
|
|
949
|
+
color: `${((_b = theme.palette.secondary) === null || _b === void 0 ? void 0 : _b.main) || '#f00'} !important`,
|
|
950
|
+
});
|
|
951
|
+
});
|
|
952
|
+
const DivLogoutBtnWrapper = styles.styled('div')(({ theme }) => ({
|
|
953
|
+
margin: 16,
|
|
954
|
+
}));
|
|
955
|
+
const AnchorLink$1 = styles.styled('a')(({ theme }) => ({
|
|
956
|
+
color: 'inherit',
|
|
957
|
+
'&:hover': {
|
|
958
|
+
color: 'inherit',
|
|
959
|
+
},
|
|
960
|
+
}));
|
|
961
|
+
const StyledButton = styles.styled(material.Button)(({ theme }) => {
|
|
962
|
+
var _a, _b, _c, _d;
|
|
963
|
+
return ({
|
|
964
|
+
alignSelf: 'start',
|
|
965
|
+
backgroundColor: (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _a === void 0 ? void 0 : _a.primary) === null || _b === void 0 ? void 0 : _b.main,
|
|
966
|
+
color: ((_d = (_c = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _c === void 0 ? void 0 : _c.common) === null || _d === void 0 ? void 0 : _d.white) || '#fff',
|
|
967
|
+
height: '40px',
|
|
968
|
+
borderRadius: '100px',
|
|
969
|
+
padding: '10px 24px',
|
|
970
|
+
});
|
|
971
|
+
});
|
|
972
|
+
const StyledButtonBanner = styles.styled(material.Button)(({ theme }) => ({
|
|
973
|
+
alignSelf: 'start',
|
|
974
|
+
height: '40px',
|
|
975
|
+
borderRadius: '100px',
|
|
976
|
+
padding: '10px 24px',
|
|
977
|
+
}));
|
|
978
|
+
const TypographyBtnText = styles.styled(material.Typography)(({ theme }) => {
|
|
979
|
+
var _a, _b;
|
|
980
|
+
return ({
|
|
981
|
+
color: ((_b = (_a = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _a === void 0 ? void 0 : _a.common) === null || _b === void 0 ? void 0 : _b.white) || '#fff',
|
|
982
|
+
textTransform: 'none',
|
|
983
|
+
});
|
|
984
|
+
});
|
|
985
|
+
|
|
986
|
+
/**
|
|
987
|
+
* Header component with tenant theme support and responsive navigation
|
|
988
|
+
*
|
|
989
|
+
* @example
|
|
990
|
+
* ```tsx
|
|
991
|
+
* <Header
|
|
992
|
+
* logo={logoSrc}
|
|
993
|
+
* navigationLinks={navLinks}
|
|
994
|
+
* languages={languageOptions}
|
|
995
|
+
* currentLocale="en"
|
|
996
|
+
* onLogoClick={() => history.push('/')}
|
|
997
|
+
* onLoginClick={() => setShowLoginModal(true)}
|
|
998
|
+
* />
|
|
999
|
+
* ```
|
|
1000
|
+
*/
|
|
1001
|
+
function Header$1({ logo, alternateLogo, showAlternateLogo = false, navigationLinks, languages, currentLocale, currentLang, userToken, userFirstName, isMobile: propIsMobile, scrolled = false, isPartnershipPageMobileView = false, isPartnershipPagePCView = false, isSeoPageView = false, showGetQuoteButton = false, bannerData, ctaData, host = '', welcomeMessage, formatMessage = (descriptor) => descriptor.id, menuItems, userProfileComponent, onLogoClick, onProductMenuClick, onLanguageChange, onLoginClick, onSignupClick, onLogoutClick, onPartnershipClick, onAboutUsClick, onBlogClick, onMyProfileClick, onGetQuoteClick, onPartnershipCTAClick, }) {
|
|
1002
|
+
var _a, _b;
|
|
1003
|
+
const tenantTheme = useTenantTheme();
|
|
1004
|
+
tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
1005
|
+
const muiTheme = material.useTheme();
|
|
1006
|
+
const themeBreakpoint = material.useMediaQuery((_a = muiTheme === null || muiTheme === void 0 ? void 0 : muiTheme.breakpoints) === null || _a === void 0 ? void 0 : _a.down('md'));
|
|
1007
|
+
const isMobile = propIsMobile !== undefined ? propIsMobile : themeBreakpoint;
|
|
1008
|
+
const [anchorElNav, setAnchorElNav] = React__namespace.useState(null);
|
|
1009
|
+
const [anchorElLanguage, setAnchorElLanguage] = React__namespace.useState(null);
|
|
1010
|
+
const [anchorElUserMenu, setAnchorElUserMenu] = React__namespace.useState(null);
|
|
1011
|
+
const shouldShowContent = (!isPartnershipPagePCView || (isPartnershipPagePCView && !scrolled)) &&
|
|
1012
|
+
(!isSeoPageView || (isSeoPageView && !scrolled));
|
|
1013
|
+
const firstName1stLetter = ((_b = userFirstName === null || userFirstName === void 0 ? void 0 : userFirstName.trim()) === null || _b === void 0 ? void 0 : _b.slice(0, 1)) || '';
|
|
1014
|
+
const handleOpenNavMenu = (event) => {
|
|
1015
|
+
setAnchorElNav(event.currentTarget);
|
|
1016
|
+
};
|
|
1017
|
+
const handleOpenLanguageMenu = (event) => {
|
|
1018
|
+
setAnchorElLanguage(event.currentTarget);
|
|
1019
|
+
};
|
|
1020
|
+
const handleCloseNavMenu = () => {
|
|
1021
|
+
setAnchorElNav(null);
|
|
1022
|
+
};
|
|
1023
|
+
const handleCloseLanguageMenu = () => {
|
|
1024
|
+
setAnchorElLanguage(null);
|
|
1025
|
+
};
|
|
1026
|
+
const handleOpenUserMenu = (event) => {
|
|
1027
|
+
setAnchorElUserMenu(event.currentTarget);
|
|
1028
|
+
};
|
|
1029
|
+
const handleCloseUserMenu = () => {
|
|
1030
|
+
setAnchorElUserMenu(null);
|
|
1031
|
+
};
|
|
1032
|
+
const displayLogo = showAlternateLogo && alternateLogo ? alternateLogo : logo;
|
|
1033
|
+
return (jsxRuntime.jsx(StyledAppBar$1, Object.assign({ ispartnershippagemobileview: isPartnershipPageMobileView, scrolled: scrolled }, { children: jsxRuntime.jsx(ResponsiveB2CLayout, { children: jsxRuntime.jsx(StyledContainer, Object.assign({ ispartnershippagemobileview: isPartnershipPageMobileView, scrolled: scrolled, maxWidth: "xl" }, { children: jsxRuntime.jsxs(material.Toolbar, Object.assign({ disableGutters: true }, { children: [jsxRuntime.jsx("a", Object.assign({ href: host || '#', onClick: (e) => {
|
|
1034
|
+
e === null || e === void 0 ? void 0 : e.preventDefault();
|
|
1035
|
+
onLogoClick === null || onLogoClick === void 0 ? void 0 : onLogoClick();
|
|
1036
|
+
}, style: Object.assign({ marginRight: isMobile ? 2 : 5, display: 'flex', flexGrow: isMobile ? 1 : 0, fontFamily: 'monospace', fontWeight: 700, letterSpacing: '.3rem', color: 'inherit' }, (isMobile && { height: '44px', width: '73.3px' })) }, { children: jsxRuntime.jsx(TypographyLogo, Object.assign({ variant: "h6", noWrap: true, sx: {
|
|
1037
|
+
mr: isMobile ? 2 : 5,
|
|
1038
|
+
display: { xs: 'flex', md: 'flex' },
|
|
1039
|
+
flexGrow: isMobile ? 1 : 0,
|
|
1040
|
+
fontFamily: 'monospace',
|
|
1041
|
+
fontWeight: 700,
|
|
1042
|
+
letterSpacing: '.3rem',
|
|
1043
|
+
color: 'inherit',
|
|
1044
|
+
textDecoration: 'none',
|
|
1045
|
+
} }, { children: jsxRuntime.jsx("img", { src: displayLogo, alt: "Logo", style: Object.assign({}, (isMobile && { height: '32px', width: '119px' })), height: isMobile ? '32px' : '57px', width: isMobile ? '119px' : '93.36px' }) })) })), !isMobile && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [shouldShowContent && (jsxRuntime.jsxs(material.Box, Object.assign({ sx: {
|
|
1046
|
+
flexGrow: 1,
|
|
1047
|
+
display: { xs: 'none', md: 'flex', gap: 40 },
|
|
1048
|
+
} }, { children: [jsxRuntime.jsxs(ButtonDesktopMenu, Object.assign({ onClick: handleOpenNavMenu, sx: { my: 2, textTransform: 'capitalize' }, "data-testid": "productNavigationMenu" }, { children: [jsxRuntime.jsx(material.Typography, Object.assign({ variant: "h6" }, { children: formatMessage({ id: 'Products' }) })), jsxRuntime.jsx(material.Icon, { component: ArrowDropDownIcon })] }), "product"), (menuItems === null || menuItems === void 0 ? void 0 : menuItems.partnership) && (jsxRuntime.jsx(ButtonDesktopMenu, Object.assign({ onClick: onPartnershipClick, sx: { my: 2, textTransform: 'capitalize' } }, { children: jsxRuntime.jsx(material.Typography, Object.assign({ variant: "h6" }, { children: jsxRuntime.jsx(AnchorLink$1, Object.assign({ href: `${host}${menuItems.partnership.route}`, onClick: (e) => e === null || e === void 0 ? void 0 : e.preventDefault() }, { children: menuItems.partnership.label })) })) }), "partnership")), (menuItems === null || menuItems === void 0 ? void 0 : menuItems.aboutUs) && (jsxRuntime.jsx(ButtonDesktopMenu, Object.assign({ onClick: onAboutUsClick, sx: { my: 2, textTransform: 'capitalize' } }, { children: jsxRuntime.jsx(material.Typography, Object.assign({ variant: "h6" }, { children: jsxRuntime.jsx(AnchorLinks, Object.assign({ href: `${host}${menuItems.aboutUs.route}`, onClick: (e) => e === null || e === void 0 ? void 0 : e.preventDefault() }, { children: menuItems.aboutUs.label })) })) }), "aboutus")), (menuItems === null || menuItems === void 0 ? void 0 : menuItems.blog) && (jsxRuntime.jsx(ButtonDesktopMenu, Object.assign({ onClick: onBlogClick, sx: { my: 2, textTransform: 'capitalize' } }, { children: jsxRuntime.jsx(material.Typography, Object.assign({ variant: "h6" }, { children: jsxRuntime.jsx(AnchorLink$1, Object.assign({ href: menuItems.blog.url, onClick: (e) => e === null || e === void 0 ? void 0 : e.preventDefault() }, { children: menuItems.blog.label })) })) }), "blog"))] }))), jsxRuntime.jsxs(material.Box, Object.assign({ sx: {
|
|
1049
|
+
flexGrow: 1,
|
|
1050
|
+
display: {
|
|
1051
|
+
xs: 'none',
|
|
1052
|
+
md: 'flex',
|
|
1053
|
+
gap: 40,
|
|
1054
|
+
justifyContent: 'flex-end',
|
|
1055
|
+
},
|
|
1056
|
+
} }, { children: [shouldShowContent && (jsxRuntime.jsxs(ButtonDesktopMenu, Object.assign({ onClick: handleOpenLanguageMenu, sx: { my: 2, textTransform: 'capitalize' }, "data-testid": "selectedLocale" }, { children: [jsxRuntime.jsx(material.Typography, Object.assign({ variant: "h6" }, { children: formatMessage({
|
|
1057
|
+
id: `${currentLocale === null || currentLocale === void 0 ? void 0 : currentLocale.toLocaleUpperCase()}`,
|
|
1058
|
+
}) })), jsxRuntime.jsx(material.Icon, { component: ArrowDropDownIcon })] }), "language")), isPartnershipPagePCView && scrolled ? (jsxRuntime.jsx(StyledButton, Object.assign({ variant: "contained", onClick: onPartnershipCTAClick }, { children: jsxRuntime.jsx(TypographyBtnText, Object.assign({ variant: "body1" }, { children: formatMessage({ id: 'Be Our Partner' }) })) }))) : isSeoPageView && scrolled && bannerData ? (jsxRuntime.jsx(StyledButtonBanner, Object.assign({ style: { background: bannerData === null || bannerData === void 0 ? void 0 : bannerData.ctaBGColor }, variant: "contained", onClick: onGetQuoteClick }, { children: jsxRuntime.jsx(material.Typography, Object.assign({ style: {
|
|
1059
|
+
color: bannerData === null || bannerData === void 0 ? void 0 : bannerData.ctaTextColor,
|
|
1060
|
+
textTransform: 'none',
|
|
1061
|
+
}, variant: "body1" }, { children: bannerData === null || bannerData === void 0 ? void 0 : bannerData.ctaText })) }))) : userToken ? (jsxRuntime.jsx(StyledAvatar, Object.assign({ onClick: handleOpenUserMenu, "data-testid": "user-profile-avatar" }, { children: firstName1stLetter }))) : (jsxRuntime.jsxs(DivButtonWrapper, { children: [jsxRuntime.jsx(ButtonAuth, Object.assign({ color: "primary", variant: "outlined", sx: { textTransform: 'capitalize' }, onClick: onLoginClick, "data-testid": "headerLogin" }, { children: jsxRuntime.jsx(TypographyAuth, Object.assign({ variant: "body1" }, { children: formatMessage({ id: 'Log in' }) })) })), jsxRuntime.jsx(ButtonAuth, Object.assign({ color: "primary", variant: "contained", sx: { textTransform: 'capitalize' }, onClick: onSignupClick }, { children: jsxRuntime.jsx(TypographyAuth, Object.assign({ variant: "body1" }, { children: formatMessage({ id: 'Sign up' }) })) }))] }))] })), jsxRuntime.jsx(StyledMenu, Object.assign({ id: "menu-appbar", anchorEl: anchorElNav, anchorOrigin: {
|
|
1062
|
+
vertical: 'bottom',
|
|
1063
|
+
horizontal: 'left',
|
|
1064
|
+
}, keepMounted: true, transformOrigin: {
|
|
1065
|
+
vertical: 'top',
|
|
1066
|
+
horizontal: 'left',
|
|
1067
|
+
}, open: Boolean(anchorElNav), onClose: handleCloseNavMenu, sx: {
|
|
1068
|
+
display: { xs: 'none', md: 'block' },
|
|
1069
|
+
} }, { children: jsxRuntime.jsx(DivProductListing, { children: navigationLinks.map(({ key, name, icon }) => (jsxRuntime.jsxs(StyledMenuItem, Object.assign({ onClick: () => {
|
|
1070
|
+
onProductMenuClick === null || onProductMenuClick === void 0 ? void 0 : onProductMenuClick(key);
|
|
1071
|
+
handleCloseNavMenu();
|
|
1072
|
+
}, "data-testid": `product-navigation-${key}` }, { children: [jsxRuntime.jsx(SpanImageWrapper, { children: jsxRuntime.jsx(ImageProductIcon, { src: icon, width: 18, height: 18, alt: name }) }), jsxRuntime.jsx(material.Typography, Object.assign({ variant: "body1", textAlign: "center" }, { children: jsxRuntime.jsx(AnchorLinks, Object.assign({ href: `#${key}`, onClick: (e) => e === null || e === void 0 ? void 0 : e.preventDefault() }, { children: formatMessage({ id: `${name}` }) })) }))] }), key))) }) })), jsxRuntime.jsx(StyledMenu, Object.assign({ id: "language-menu", anchorEl: anchorElLanguage, anchorOrigin: {
|
|
1073
|
+
vertical: 'bottom',
|
|
1074
|
+
horizontal: 'left',
|
|
1075
|
+
}, keepMounted: true, transformOrigin: {
|
|
1076
|
+
vertical: 'top',
|
|
1077
|
+
horizontal: 'left',
|
|
1078
|
+
}, open: Boolean(anchorElLanguage), onClose: handleCloseLanguageMenu, sx: {
|
|
1079
|
+
display: { xs: 'none', md: 'block' },
|
|
1080
|
+
} }, { children: jsxRuntime.jsx(DivProductListing, { children: languages.map(({ value, locale, label }) => (jsxRuntime.jsx(StyledMenuItem, Object.assign({ onClick: () => {
|
|
1081
|
+
onLanguageChange === null || onLanguageChange === void 0 ? void 0 : onLanguageChange(locale, value);
|
|
1082
|
+
handleCloseLanguageMenu();
|
|
1083
|
+
}, "data-testid": `lang-${locale}` }, { children: jsxRuntime.jsx(material.Typography, Object.assign({ variant: "body1", textAlign: "center" }, { children: label })) }), value))) }) })), jsxRuntime.jsx(StyledMenu, Object.assign({ id: "user-menu", anchorEl: anchorElUserMenu, anchorOrigin: {
|
|
1084
|
+
vertical: 'bottom',
|
|
1085
|
+
horizontal: 'left',
|
|
1086
|
+
}, keepMounted: true, transformOrigin: {
|
|
1087
|
+
vertical: 'top',
|
|
1088
|
+
horizontal: 'left',
|
|
1089
|
+
}, open: Boolean(anchorElUserMenu), onClose: handleCloseUserMenu, sx: {
|
|
1090
|
+
display: { xs: 'none', md: 'block' },
|
|
1091
|
+
} }, { children: jsxRuntime.jsxs(DivProductListing, { children: [jsxRuntime.jsx(StyledMenuItem, Object.assign({ onClick: () => {
|
|
1092
|
+
onMyProfileClick === null || onMyProfileClick === void 0 ? void 0 : onMyProfileClick();
|
|
1093
|
+
handleCloseUserMenu();
|
|
1094
|
+
} }, { children: jsxRuntime.jsx(material.Typography, Object.assign({ variant: "body1", textAlign: "center" }, { children: formatMessage({ id: `My profile` }) })) }), "myProfile"), jsxRuntime.jsx(StyledMenuItemDesktop, Object.assign({ onClick: () => {
|
|
1095
|
+
onLogoutClick === null || onLogoutClick === void 0 ? void 0 : onLogoutClick();
|
|
1096
|
+
handleCloseUserMenu();
|
|
1097
|
+
} }, { children: jsxRuntime.jsx(material.Typography, Object.assign({ variant: "body1", textAlign: "center" }, { children: formatMessage({ id: `Logout` }) })) }), "logout")] }) }))] })), isMobile && (jsxRuntime.jsxs(material.Box, Object.assign({ sx: { flexGrow: 0, display: { xs: 'flex', md: 'none' } } }, { children: [jsxRuntime.jsx(material.IconButton, Object.assign({ size: "large", "aria-label": "account of current user", "aria-controls": "menu-appbar", "aria-haspopup": "true", "aria-labelledby": "menu icon", onClick: (e) => {
|
|
1098
|
+
if (isPartnershipPageMobileView && scrolled) {
|
|
1099
|
+
onPartnershipCTAClick === null || onPartnershipCTAClick === void 0 ? void 0 : onPartnershipCTAClick();
|
|
1100
|
+
}
|
|
1101
|
+
else if (isSeoPageView && scrolled) {
|
|
1102
|
+
onGetQuoteClick === null || onGetQuoteClick === void 0 ? void 0 : onGetQuoteClick();
|
|
1103
|
+
}
|
|
1104
|
+
else {
|
|
1105
|
+
handleOpenNavMenu(e);
|
|
1106
|
+
}
|
|
1107
|
+
}, color: "inherit", sx: Object.assign({}, (isPartnershipPageMobileView &&
|
|
1108
|
+
scrolled && { padding: '0px !important' })) }, { children: Boolean(anchorElNav) ? (jsxRuntime.jsx(StyledCloseIcon, {})) : isPartnershipPageMobileView && scrolled ? (jsxRuntime.jsx(StyledButton, Object.assign({ variant: "contained", onClick: onPartnershipCTAClick }, { children: jsxRuntime.jsx(TypographyBtnText, Object.assign({ variant: "body1" }, { children: formatMessage({ id: 'Be Our Partner' }) })) }))) : isSeoPageView && scrolled && bannerData ? (jsxRuntime.jsx(StyledButtonBanner, Object.assign({ style: {
|
|
1109
|
+
background: bannerData === null || bannerData === void 0 ? void 0 : bannerData.ctaBGColor,
|
|
1110
|
+
}, variant: "contained", onClick: onGetQuoteClick }, { children: jsxRuntime.jsx(material.Typography, Object.assign({ style: {
|
|
1111
|
+
color: bannerData === null || bannerData === void 0 ? void 0 : bannerData.ctaTextColor,
|
|
1112
|
+
textTransform: 'none',
|
|
1113
|
+
}, variant: "body1" }, { children: bannerData === null || bannerData === void 0 ? void 0 : bannerData.ctaText })) }))) : userToken ? (jsxRuntime.jsx(StyledAvatarUserIcon, Object.assign({ "data-testid": "user-profile-avatar" }, { children: firstName1stLetter }))) : (jsxRuntime.jsx(StyledMenuIcon, { ispartnershippagemobileview: isPartnershipPageMobileView, scrolled: scrolled })) })), jsxRuntime.jsxs(StyledDrawer$3, Object.assign({ id: "menu-appbar", anchor: "top", keepMounted: true, open: Boolean(anchorElNav), onClose: handleCloseNavMenu, sx: {
|
|
1114
|
+
display: { xs: 'block', md: 'none' },
|
|
1115
|
+
width: '100%',
|
|
1116
|
+
left: 0,
|
|
1117
|
+
} }, { children: [jsxRuntime.jsxs(DivLogoWrapper, { children: [jsxRuntime.jsx(DivLogo, { children: jsxRuntime.jsx("img", { src: logo, alt: "logo", width: "100%", height: "100%" }) }), jsxRuntime.jsx(DivCrossIconWrapper, { children: jsxRuntime.jsx(StyledCloseIconBtn, Object.assign({ size: "large", "aria-label": "close menu", "aria-controls": "menu-appbar", "aria-haspopup": "true", onClick: handleCloseNavMenu, color: "inherit" }, { children: jsxRuntime.jsx(CloseIcon, {}) })) })] }), userToken ? (userProfileComponent) : (jsxRuntime.jsxs(DivLoginActionContainer, { children: [jsxRuntime.jsx(material.Typography, Object.assign({ variant: "h6" }, { children: welcomeMessage || formatMessage({ id: 'Welcome' }) })), jsxRuntime.jsxs(DivButtonWrapper, { children: [jsxRuntime.jsx(ButtonAuth, Object.assign({ color: "primary", variant: "outlined", onClick: () => {
|
|
1118
|
+
onLoginClick === null || onLoginClick === void 0 ? void 0 : onLoginClick();
|
|
1119
|
+
handleCloseNavMenu();
|
|
1120
|
+
}, "data-testid": "headerLogin" }, { children: jsxRuntime.jsx(TypographyAuth, Object.assign({ variant: "body1" }, { children: formatMessage({ id: 'Log in' }) })) })), jsxRuntime.jsx(ButtonAuth, Object.assign({ color: "primary", variant: "contained", onClick: () => {
|
|
1121
|
+
onSignupClick === null || onSignupClick === void 0 ? void 0 : onSignupClick();
|
|
1122
|
+
handleCloseNavMenu();
|
|
1123
|
+
} }, { children: jsxRuntime.jsx(TypographyAuth, Object.assign({ variant: "body1" }, { children: formatMessage({ id: 'Sign up' }) })) }))] })] })), jsxRuntime.jsx(DivProductListing, { children: navigationLinks.map(({ key, name, icon }) => (jsxRuntime.jsxs(StyledMenuItem, Object.assign({ onClick: () => {
|
|
1124
|
+
onProductMenuClick === null || onProductMenuClick === void 0 ? void 0 : onProductMenuClick(key);
|
|
1125
|
+
handleCloseNavMenu();
|
|
1126
|
+
}, "data-testid": `product-navigation-${key}` }, { children: [jsxRuntime.jsx(SpanImageWrapper, { children: jsxRuntime.jsx(ImageProductIcon, { src: icon, width: 18, height: 18, alt: name }) }), jsxRuntime.jsx(material.Typography, Object.assign({ variant: "body1", textAlign: "center" }, { children: formatMessage({ id: `${name}` }) }))] }), key))) }), jsxRuntime.jsxs(DivCommonMenus, { children: [userToken && (jsxRuntime.jsx(MenuItemOtherLinks, Object.assign({ onClick: () => {
|
|
1127
|
+
handleCloseNavMenu();
|
|
1128
|
+
onMyProfileClick === null || onMyProfileClick === void 0 ? void 0 : onMyProfileClick();
|
|
1129
|
+
} }, { children: jsxRuntime.jsx(material.Typography, Object.assign({ variant: "body1", textAlign: "center" }, { children: formatMessage({ id: 'My Policy' }) })) }))), (menuItems === null || menuItems === void 0 ? void 0 : menuItems.blog) && (jsxRuntime.jsx(MenuItemOtherLinks, Object.assign({ onClick: onBlogClick }, { children: jsxRuntime.jsx(material.Typography, Object.assign({ variant: "body1", textAlign: "center" }, { children: jsxRuntime.jsx(AnchorLink$1, Object.assign({ href: menuItems.blog.url, onClick: (e) => e === null || e === void 0 ? void 0 : e.preventDefault() }, { children: menuItems.blog.label })) })) }))), (menuItems === null || menuItems === void 0 ? void 0 : menuItems.partnership) && (jsxRuntime.jsx(MenuItemOtherLinks, Object.assign({ onClick: () => {
|
|
1130
|
+
handleCloseNavMenu();
|
|
1131
|
+
onPartnershipClick === null || onPartnershipClick === void 0 ? void 0 : onPartnershipClick();
|
|
1132
|
+
} }, { children: jsxRuntime.jsx(material.Typography, Object.assign({ variant: "body1", textAlign: "center" }, { children: menuItems.partnership.label })) }))), (menuItems === null || menuItems === void 0 ? void 0 : menuItems.aboutUs) && (jsxRuntime.jsx(MenuItemOtherLinks, Object.assign({ onClick: () => {
|
|
1133
|
+
handleCloseNavMenu();
|
|
1134
|
+
onAboutUsClick === null || onAboutUsClick === void 0 ? void 0 : onAboutUsClick();
|
|
1135
|
+
} }, { children: jsxRuntime.jsx(material.Typography, Object.assign({ variant: "body1", textAlign: "center" }, { children: menuItems.aboutUs.label })) }))), jsxRuntime.jsxs(MenuItemOtherLinks, { children: [jsxRuntime.jsx(material.Typography, Object.assign({ variant: "body1", textAlign: "center" }, { children: formatMessage({ id: 'Language' }) })), jsxRuntime.jsx(material.RadioGroup, Object.assign({ row: true, "aria-labelledby": "language-selector", name: "language-selector", onChange: (e) => {
|
|
1136
|
+
const value = e.target.value;
|
|
1137
|
+
const selectedLang = languages.find((lang) => lang.locale === value);
|
|
1138
|
+
if (selectedLang) {
|
|
1139
|
+
onLanguageChange === null || onLanguageChange === void 0 ? void 0 : onLanguageChange(selectedLang.locale, selectedLang.value);
|
|
1140
|
+
}
|
|
1141
|
+
}, defaultValue: currentLocale, value: currentLocale }, { children: languages.map((lang) => (jsxRuntime.jsx(StyledFormControlLabel, { value: lang.locale, control: jsxRuntime.jsx(material.Radio, {}), label: lang.label, "data-testid": `lang-${lang.locale}` }, lang.locale))) }))] })] }), isMobile && userToken && (jsxRuntime.jsx(DivLogoutBtnWrapper, { children: jsxRuntime.jsx(ButtonLogout, Object.assign({ onClick: onLogoutClick }, { children: formatMessage({ id: 'Logout' }) })) }))] }))] })))] })) })) }) })));
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
const StyledAppBar = styles.styled(material.AppBar)(({ theme }) => ({
|
|
1145
|
+
backgroundColor: '#FFFFFF',
|
|
1146
|
+
boxShadow: '0px 2px 20px 4px rgba(0, 0, 0, 0.14)',
|
|
1147
|
+
zIndex: theme.zIndex.drawer + 1,
|
|
1148
|
+
}));
|
|
1149
|
+
const StyledToolbar = styles.styled(material.Toolbar)(({ theme }) => ({
|
|
1150
|
+
display: 'flex',
|
|
1151
|
+
alignItems: 'center',
|
|
1152
|
+
justifyContent: 'space-between',
|
|
1153
|
+
padding: '12px 16px',
|
|
1154
|
+
minHeight: '64px !important',
|
|
1155
|
+
[theme.breakpoints.down('md')]: {
|
|
1156
|
+
minHeight: '56px !important',
|
|
1157
|
+
padding: '12px 16px',
|
|
1158
|
+
},
|
|
1159
|
+
}));
|
|
1160
|
+
const LogoContainer = styles.styled('div')(({ theme }) => ({
|
|
1161
|
+
display: 'flex',
|
|
1162
|
+
alignItems: 'center',
|
|
1163
|
+
cursor: 'pointer',
|
|
1164
|
+
height: '32px',
|
|
1165
|
+
}));
|
|
1166
|
+
const LogoImage = styles.styled('img')(({ theme }) => ({
|
|
1167
|
+
height: '32px',
|
|
1168
|
+
width: 'auto',
|
|
1169
|
+
objectFit: 'contain',
|
|
1170
|
+
}));
|
|
1171
|
+
const MenuIconButton = styles.styled(material.IconButton)(({ theme }) => ({
|
|
1172
|
+
padding: '6px',
|
|
1173
|
+
borderRadius: '25px',
|
|
1174
|
+
width: '40px',
|
|
1175
|
+
height: '40px',
|
|
1176
|
+
'& .MuiSvgIcon-root': {
|
|
1177
|
+
color: '#000000',
|
|
1178
|
+
fontSize: '24px',
|
|
1179
|
+
},
|
|
1180
|
+
}));
|
|
1181
|
+
const StyledDrawer$2 = styles.styled(material.Drawer)(({ theme }) => ({
|
|
1182
|
+
'& .MuiDrawer-paper': {
|
|
1183
|
+
backgroundColor: '#FFFFFF',
|
|
1184
|
+
boxSizing: 'border-box',
|
|
1185
|
+
},
|
|
1186
|
+
}));
|
|
1187
|
+
const DrawerHeader$2 = styles.styled(material.Box)(({ theme }) => ({
|
|
1188
|
+
display: 'flex',
|
|
1189
|
+
alignItems: 'center',
|
|
1190
|
+
justifyContent: 'space-between',
|
|
1191
|
+
padding: '12px 16px',
|
|
1192
|
+
minHeight: '64px',
|
|
1193
|
+
}));
|
|
1194
|
+
const DrawerLogoContainer = styles.styled('div')(({ theme }) => ({
|
|
1195
|
+
display: 'flex',
|
|
1196
|
+
alignItems: 'center',
|
|
1197
|
+
cursor: 'pointer',
|
|
1198
|
+
height: '32px',
|
|
1199
|
+
}));
|
|
1200
|
+
const CloseIconButton = styles.styled(material.IconButton)(({ theme }) => ({
|
|
1201
|
+
padding: '6px',
|
|
1202
|
+
'& .MuiSvgIcon-root': {
|
|
1203
|
+
color: '#000000',
|
|
1204
|
+
fontSize: '24px',
|
|
1205
|
+
},
|
|
1206
|
+
}));
|
|
1207
|
+
const DrawerContent$2 = styles.styled(material.Box)(({ theme }) => ({
|
|
1208
|
+
flex: 1,
|
|
1209
|
+
overflowY: 'auto',
|
|
1210
|
+
paddingBottom: theme.spacing(2),
|
|
1211
|
+
}));
|
|
1212
|
+
styles.styled(material.Box)(({ theme }) => ({
|
|
1213
|
+
padding: theme.spacing(2),
|
|
1214
|
+
borderTop: `1px solid ${theme.palette.divider}`,
|
|
1215
|
+
}));
|
|
1216
|
+
|
|
1217
|
+
/**
|
|
1218
|
+
* NewHeader component - simplified design based on Figma
|
|
1219
|
+
*
|
|
1220
|
+
* @example
|
|
1221
|
+
* ```tsx
|
|
1222
|
+
* <NewHeader
|
|
1223
|
+
* logo={logoSrc}
|
|
1224
|
+
* navigationLinks={navLinks}
|
|
1225
|
+
* onLogoClick={() => history.push('/')}
|
|
1226
|
+
* />
|
|
1227
|
+
* ```
|
|
1228
|
+
*/
|
|
1229
|
+
function NewHeader({ logo: propLogo, navigationLinks = [], additionalMenuSections = [], isMobile: propIsMobile, onLogoClick, onMenuOpen, onMenuClose, customDrawerContent, formatMessage = (descriptor) => descriptor.id, }) {
|
|
1230
|
+
var _a;
|
|
1231
|
+
const tenantTheme = useTenantTheme();
|
|
1232
|
+
const theme = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
1233
|
+
const muiTheme = material.useTheme();
|
|
1234
|
+
const themeBreakpoint = material.useMediaQuery((_a = muiTheme === null || muiTheme === void 0 ? void 0 : muiTheme.breakpoints) === null || _a === void 0 ? void 0 : _a.down('md'));
|
|
1235
|
+
const isMobile = propIsMobile !== undefined ? propIsMobile : themeBreakpoint;
|
|
1236
|
+
// Use prop logo if provided, otherwise try to get from theme
|
|
1237
|
+
// Fallback to empty string to avoid SSR errors
|
|
1238
|
+
const logo = propLogo || (theme === null || theme === void 0 ? void 0 : theme.logo) || '';
|
|
1239
|
+
const [drawerOpen, setDrawerOpen] = React__namespace.useState(false);
|
|
1240
|
+
const handleDrawerOpen = () => {
|
|
1241
|
+
setDrawerOpen(true);
|
|
1242
|
+
onMenuOpen === null || onMenuOpen === void 0 ? void 0 : onMenuOpen();
|
|
1243
|
+
};
|
|
1244
|
+
const handleDrawerClose = () => {
|
|
1245
|
+
setDrawerOpen(false);
|
|
1246
|
+
onMenuClose === null || onMenuClose === void 0 ? void 0 : onMenuClose();
|
|
1247
|
+
};
|
|
1248
|
+
const handleLogoClick = (e) => {
|
|
1249
|
+
e.preventDefault();
|
|
1250
|
+
onLogoClick === null || onLogoClick === void 0 ? void 0 : onLogoClick();
|
|
1251
|
+
};
|
|
1252
|
+
const handleMenuItemClick = (item) => {
|
|
1253
|
+
var _a;
|
|
1254
|
+
(_a = item.onClick) === null || _a === void 0 ? void 0 : _a.call(item);
|
|
1255
|
+
handleDrawerClose();
|
|
1256
|
+
};
|
|
1257
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(StyledAppBar, Object.assign({ position: "fixed" }, { children: jsxRuntime.jsxs(StyledToolbar, Object.assign({ disableGutters: true }, { children: [jsxRuntime.jsx(LogoContainer, Object.assign({ onClick: handleLogoClick }, { children: jsxRuntime.jsx(LogoImage, { src: logo, alt: "Logo" }) })), jsxRuntime.jsx(MenuIconButton, Object.assign({ size: "large", edge: "end", "aria-label": "menu", onClick: handleDrawerOpen }, { children: jsxRuntime.jsx(MenuIcon, {}) }))] })) })), jsxRuntime.jsx(StyledDrawer$2, Object.assign({ anchor: "right", open: drawerOpen, onClose: handleDrawerClose }, { children: customDrawerContent ? (jsxRuntime.jsx(material.Box, Object.assign({ sx: { width: isMobile ? '100vw' : 350 } }, { children: customDrawerContent }))) : (jsxRuntime.jsxs(material.Box, Object.assign({ sx: { width: isMobile ? '100vw' : 350 } }, { children: [jsxRuntime.jsxs(DrawerHeader$2, { children: [jsxRuntime.jsx(DrawerLogoContainer, Object.assign({ onClick: handleLogoClick }, { children: jsxRuntime.jsx(LogoImage, { src: logo, alt: "Logo" }) })), jsxRuntime.jsx(CloseIconButton, Object.assign({ onClick: handleDrawerClose, "aria-label": "close" }, { children: jsxRuntime.jsx(CloseIcon, {}) }))] }), jsxRuntime.jsx(material.Divider, {}), jsxRuntime.jsxs(DrawerContent$2, { children: [navigationLinks.length > 0 && (jsxRuntime.jsx(material.List, { children: navigationLinks.map((item) => (jsxRuntime.jsx(material.ListItem, Object.assign({ disablePadding: true }, { children: jsxRuntime.jsx(material.ListItemButton, Object.assign({ onClick: () => handleMenuItemClick(item) }, { children: jsxRuntime.jsx(material.ListItemText, { primary: formatMessage({ id: item.label }) }) })) }), item.key))) })), additionalMenuSections.map((section, index) => (jsxRuntime.jsxs(React__namespace.Fragment, { children: [section.title && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(material.Divider, {}), jsxRuntime.jsx(material.Box, Object.assign({ sx: { px: 2, py: 1 } }, { children: jsxRuntime.jsx(material.ListItemText, { primary: formatMessage({ id: section.title }), primaryTypographyProps: {
|
|
1258
|
+
variant: 'caption',
|
|
1259
|
+
color: 'text.secondary',
|
|
1260
|
+
} }) }))] })), jsxRuntime.jsx(material.List, { children: section.items.map((item) => (jsxRuntime.jsx(material.ListItem, Object.assign({ disablePadding: true }, { children: jsxRuntime.jsx(material.ListItemButton, Object.assign({ onClick: () => handleMenuItemClick(item) }, { children: jsxRuntime.jsx(material.ListItemText, { primary: formatMessage({ id: item.label }) }) })) }), item.key))) })] }, index)))] })] }))) }))] }));
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
const DivFooter = styles.styled('div')(({ theme }) => ({
|
|
1264
|
+
backgroundColor: '#424242',
|
|
1265
|
+
padding: '20px 16px',
|
|
1266
|
+
'@media (min-width: 769px)': {
|
|
1267
|
+
padding: '70px 0px',
|
|
1268
|
+
},
|
|
1269
|
+
anchorLinks: {
|
|
1270
|
+
color: 'inherit',
|
|
1271
|
+
'&:hover': {
|
|
1272
|
+
color: 'inherit',
|
|
1273
|
+
},
|
|
1274
|
+
},
|
|
1275
|
+
}));
|
|
1276
|
+
const DivFooterConterResponsiveLayout = styles.styled('div')(({ theme }) => ({
|
|
1277
|
+
color: '#fff',
|
|
1278
|
+
[theme.breakpoints.up(1025)]: {
|
|
1279
|
+
minWidth: '1128px',
|
|
1280
|
+
maxWidth: '1128px',
|
|
1281
|
+
margin: '0 auto',
|
|
1282
|
+
},
|
|
1283
|
+
}));
|
|
1284
|
+
const FooterHiddenContent = styles.styled('div')(({ theme, simplifiedLayout }) => simplifiedLayout ? { display: 'none' } : { display: 'flex' });
|
|
1285
|
+
const DivIglooIntro = styles.styled('div')(({ theme }) => {
|
|
1286
|
+
var _a;
|
|
1287
|
+
return ({
|
|
1288
|
+
display: 'flex',
|
|
1289
|
+
flexDirection: 'column',
|
|
1290
|
+
gap: '24px',
|
|
1291
|
+
color: ((_a = theme === null || theme === void 0 ? void 0 : theme.palette.common) === null || _a === void 0 ? void 0 : _a.white) || '#fff',
|
|
1292
|
+
'@media (min-width: 769px)': {
|
|
1293
|
+
width: 320,
|
|
1294
|
+
marginRight: 194,
|
|
1295
|
+
},
|
|
1296
|
+
});
|
|
1297
|
+
});
|
|
1298
|
+
const DivSocial = styles.styled('div')(({ theme }) => ({
|
|
1299
|
+
display: 'flex',
|
|
1300
|
+
alignItems: 'center',
|
|
1301
|
+
margin: '0 auto',
|
|
1302
|
+
columnGap: '32px',
|
|
1303
|
+
flexDirection: 'row',
|
|
1304
|
+
'@media (min-width: 769px)': {
|
|
1305
|
+
margin: 'initial',
|
|
1306
|
+
},
|
|
1307
|
+
}));
|
|
1308
|
+
const ButtonIcon = styles.styled(material.Button)(({ theme }) => {
|
|
1309
|
+
var _a;
|
|
1310
|
+
return ({
|
|
1311
|
+
color: ((_a = theme.palette.common) === null || _a === void 0 ? void 0 : _a.white) || '#fff',
|
|
1312
|
+
padding: '0 !important',
|
|
1313
|
+
minWidth: 'auto !important',
|
|
1314
|
+
});
|
|
1315
|
+
});
|
|
1316
|
+
const TypographyIntro = styles.styled(material.Typography)(({ theme }) => ({
|
|
1317
|
+
textAlign: 'center',
|
|
1318
|
+
color: `#fff !important`,
|
|
1319
|
+
'@media (min-width: 769px)': {
|
|
1320
|
+
textAlign: 'left',
|
|
1321
|
+
},
|
|
1322
|
+
}));
|
|
1323
|
+
const TypographyAddressFooter = styles.styled(material.Typography)(({ theme }) => ({
|
|
1324
|
+
marginTop: 16,
|
|
1325
|
+
textAlign: 'center',
|
|
1326
|
+
color: '#fff',
|
|
1327
|
+
'@media (min-width: 769px)': {
|
|
1328
|
+
textAlign: 'left',
|
|
1329
|
+
},
|
|
1330
|
+
}));
|
|
1331
|
+
const DivLogos = styles.styled('div')(({ theme }) => ({
|
|
1332
|
+
display: 'flex',
|
|
1333
|
+
flexDirection: 'column',
|
|
1334
|
+
gap: 16,
|
|
1335
|
+
alignItems: 'center',
|
|
1336
|
+
marginTop: 16,
|
|
1337
|
+
'@media (min-width: 769px)': {
|
|
1338
|
+
width: '100%',
|
|
1339
|
+
marginTop: 0,
|
|
1340
|
+
gap: 'initial',
|
|
1341
|
+
alignItems: 'baseline',
|
|
1342
|
+
},
|
|
1343
|
+
}));
|
|
1344
|
+
const DivFirstRow = styles.styled('div')(({ theme }) => ({
|
|
1345
|
+
display: 'flex',
|
|
1346
|
+
flexDirection: 'row',
|
|
1347
|
+
gap: 16,
|
|
1348
|
+
}));
|
|
1349
|
+
const ButtonOjkLink = styles.styled(material.Button)(({ theme }) => ({
|
|
1350
|
+
display: 'flex',
|
|
1351
|
+
justifyContent: 'flex-start',
|
|
1352
|
+
'@media (min-width: 769px)': {
|
|
1353
|
+
display: 'flex !important',
|
|
1354
|
+
justifyContent: 'flex-start !important ',
|
|
1355
|
+
},
|
|
1356
|
+
}));
|
|
1357
|
+
const ImageOjkLicense = styles.styled('img')(({ theme }) => ({
|
|
1358
|
+
alignSelf: 'flex-start',
|
|
1359
|
+
height: 36,
|
|
1360
|
+
}));
|
|
1361
|
+
const ButtonSolisoustamaLink = styles.styled(material.Button)(({ theme }) => ({
|
|
1362
|
+
display: 'flex',
|
|
1363
|
+
justifyContent: 'flex-start',
|
|
1364
|
+
}));
|
|
1365
|
+
const ImageSolisoustama = styles.styled('img')(({ theme }) => ({
|
|
1366
|
+
height: 'auto',
|
|
1367
|
+
}));
|
|
1368
|
+
const DivLinks = styles.styled('div')(({ theme }) => ({
|
|
1369
|
+
display: 'flex',
|
|
1370
|
+
flex: 1,
|
|
1371
|
+
alignItems: 'center',
|
|
1372
|
+
gap: 16,
|
|
1373
|
+
justifyContent: 'center',
|
|
1374
|
+
'@media (min-width: 769px)': {
|
|
1375
|
+
flex: '1 1',
|
|
1376
|
+
alignItems: 'normal',
|
|
1377
|
+
},
|
|
1378
|
+
}));
|
|
1379
|
+
const DivSection = styles.styled('div')(({ theme }) => ({
|
|
1380
|
+
display: 'flex',
|
|
1381
|
+
flexDirection: 'column',
|
|
1382
|
+
gap: 16,
|
|
1383
|
+
flex: 1,
|
|
1384
|
+
alignItems: 'flex-start',
|
|
1385
|
+
'@media (min-width: 769px)': {
|
|
1386
|
+
gap: 24,
|
|
1387
|
+
'&:not(:first-of-type)': {
|
|
1388
|
+
marginLeft: 194,
|
|
1389
|
+
},
|
|
1390
|
+
},
|
|
1391
|
+
}));
|
|
1392
|
+
const ButtonBottomLink = styles.styled(material.Button)(({ theme }) => ({
|
|
1393
|
+
color: '#fff !important',
|
|
1394
|
+
textTransform: 'capitalize',
|
|
1395
|
+
'@media (min-width: 769px)': {
|
|
1396
|
+
padding: '0 !important',
|
|
1397
|
+
textAlign: 'left !important',
|
|
1398
|
+
minWidth: 'auto !important',
|
|
1399
|
+
},
|
|
1400
|
+
}));
|
|
1401
|
+
const StyledDivider = styles.styled(material.Divider)(({ theme }) => ({
|
|
1402
|
+
margin: '24px 0 16px !important',
|
|
1403
|
+
borderColor: '#5F5E62 !important',
|
|
1404
|
+
}));
|
|
1405
|
+
const DivBottom = styles.styled('div')(({ theme }) => ({
|
|
1406
|
+
display: 'flex',
|
|
1407
|
+
justifyContent: 'space-between',
|
|
1408
|
+
alignItems: 'center',
|
|
1409
|
+
}));
|
|
1410
|
+
const DivSep = styles.styled('div')(({ theme }) => ({
|
|
1411
|
+
width: '1px',
|
|
1412
|
+
height: 10,
|
|
1413
|
+
borderRadius: '1px',
|
|
1414
|
+
backgroundColor: '#fff',
|
|
1415
|
+
}));
|
|
1416
|
+
const AnchorLink = styles.styled('a')(({ theme }) => ({
|
|
1417
|
+
color: 'inherit',
|
|
1418
|
+
'&:hover': {
|
|
1419
|
+
color: 'inherit',
|
|
1420
|
+
},
|
|
1421
|
+
}));
|
|
1422
|
+
|
|
1423
|
+
/**
|
|
1424
|
+
* Footer component with tenant theme support
|
|
1425
|
+
*
|
|
1426
|
+
* @example
|
|
1427
|
+
* ```tsx
|
|
1428
|
+
* <Footer
|
|
1429
|
+
* introText="Company introduction..."
|
|
1430
|
+
* socialLinks={socialMediaLinks}
|
|
1431
|
+
* licenseImages={licenses}
|
|
1432
|
+
* navigationLinks={footerNavLinks}
|
|
1433
|
+
* currentLocale="en"
|
|
1434
|
+
* />
|
|
1435
|
+
* ```
|
|
1436
|
+
*/
|
|
1437
|
+
function Footer({ simplifiedLayout = false, introText, addressText, socialLinks, licenseImages, poweredByImage, navigationLinks = [], currentLocale, host = '', isMobile: propIsMobile, onLinkClick, onSocialClick, onPrivacyPolicyClick, onTermsOfServiceClick, formatMessage = (descriptor) => descriptor.id, }) {
|
|
1438
|
+
var _a;
|
|
1439
|
+
const tenantTheme = useTenantTheme();
|
|
1440
|
+
tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
1441
|
+
const muiTheme = material.useTheme();
|
|
1442
|
+
const themeBreakpoint = material.useMediaQuery((_a = muiTheme === null || muiTheme === void 0 ? void 0 : muiTheme.breakpoints) === null || _a === void 0 ? void 0 : _a.down('md'));
|
|
1443
|
+
const isMobile = propIsMobile !== undefined ? propIsMobile : themeBreakpoint;
|
|
1444
|
+
return (jsxRuntime.jsx(DivFooter, { children: jsxRuntime.jsxs(DivFooterConterResponsiveLayout, { children: [jsxRuntime.jsxs(FooterHiddenContent, Object.assign({ simplifiedLayout: simplifiedLayout }, { children: [jsxRuntime.jsxs(DivIglooIntro, { children: [isMobile && (jsxRuntime.jsx(DivSocial, { children: socialLinks.map((social) => (jsxRuntime.jsx(ButtonIcon, Object.assign({ onClick: () => onSocialClick === null || onSocialClick === void 0 ? void 0 : onSocialClick(social.platform, social.url), "aria-label": social.ariaLabel || social.platform }, { children: jsxRuntime.jsx("img", { src: social.icon, alt: social.platform, loading: "lazy", height: "24px", width: "24px" }) }), social.platform))) })), jsxRuntime.jsx(TypographyIntro, Object.assign({ variant: "body2" }, { children: formatMessage({ id: introText }) })), addressText && (jsxRuntime.jsx(TypographyAddressFooter, Object.assign({ variant: "body2" }, { children: addressText }))), jsxRuntime.jsxs(DivLogos, { children: [jsxRuntime.jsx(DivFirstRow, { children: licenseImages.map((license, index) => (jsxRuntime.jsx(ButtonOjkLink, Object.assign({ onClick: () => license.url && window.open(license.url), "aria-label": license.ariaLabel || license.alt }, { children: jsxRuntime.jsx(ImageOjkLicense, { src: license.src, alt: license.alt, width: license.width, height: license.height, loading: "lazy" }) }), index))) }), poweredByImage && (jsxRuntime.jsx(ButtonSolisoustamaLink, Object.assign({ "aria-label": poweredByImage.ariaLabel || 'Powered by' }, { children: jsxRuntime.jsx(ImageSolisoustama, { src: poweredByImage.src, alt: poweredByImage.alt, width: poweredByImage.width, height: poweredByImage.height, loading: "lazy" }) })))] })] }), !isMobile && (jsxRuntime.jsx(DivLinks, { children: navigationLinks === null || navigationLinks === void 0 ? void 0 : navigationLinks.map((items, index) => (jsxRuntime.jsxs(DivSection, { children: [items === null || items === void 0 ? void 0 : items.map((link, _index) => {
|
|
1445
|
+
var _a, _b, _c;
|
|
1446
|
+
const isExternalURL = (_c = (_b = (_a = link.outerHref) === null || _a === void 0 ? void 0 : _a.split(':')) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.includes('http');
|
|
1447
|
+
const anchorLinkOuterRef = isExternalURL
|
|
1448
|
+
? link.outerHref || ''
|
|
1449
|
+
: `${host}${link.outerHref}`;
|
|
1450
|
+
const anchorLinkInnerRef = `${host}${link.innerHref}`;
|
|
1451
|
+
return (jsxRuntime.jsx(ButtonBottomLink, Object.assign({ onClick: () => {
|
|
1452
|
+
onLinkClick === null || onLinkClick === void 0 ? void 0 : onLinkClick(link);
|
|
1453
|
+
} }, { children: jsxRuntime.jsx(material.Typography, Object.assign({ variant: "body1" }, { children: jsxRuntime.jsx(AnchorLink, Object.assign({ href: link.innerHref ? anchorLinkInnerRef : anchorLinkOuterRef || '', onClick: (e) => e === null || e === void 0 ? void 0 : e.preventDefault() }, { children: formatMessage({ id: `${link.label}` }) })) })) }), _index));
|
|
1454
|
+
}), index === navigationLinks.length - 1 && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ButtonBottomLink, Object.assign({ onClick: onPrivacyPolicyClick }, { children: jsxRuntime.jsx(material.Typography, Object.assign({ variant: "body1" }, { children: jsxRuntime.jsx(AnchorLink, Object.assign({ href: `${host}/${currentLocale}/terms/privacypolicy`, onClick: (e) => e === null || e === void 0 ? void 0 : e.preventDefault() }, { children: formatMessage({ id: 'Privacy Policy' }) })) })) })), jsxRuntime.jsx(ButtonBottomLink, Object.assign({ onClick: onTermsOfServiceClick }, { children: jsxRuntime.jsx(material.Typography, Object.assign({ variant: "body1" }, { children: jsxRuntime.jsx(AnchorLink, Object.assign({ href: `${host}/${currentLocale}/terms/termsofservice`, onClick: (e) => e === null || e === void 0 ? void 0 : e.preventDefault() }, { children: formatMessage({ id: 'Terms of Service' }) })) })) })), jsxRuntime.jsx(DivSocial, { children: socialLinks.map((social) => (jsxRuntime.jsx(ButtonIcon, Object.assign({ onClick: () => onSocialClick === null || onSocialClick === void 0 ? void 0 : onSocialClick(social.platform, social.url), "aria-label": social.ariaLabel || social.platform }, { children: jsxRuntime.jsx(AnchorLink, Object.assign({ href: social.url, onClick: (e) => e === null || e === void 0 ? void 0 : e.preventDefault() }, { children: jsxRuntime.jsx("img", { src: social.icon, alt: social.platform, height: isMobile ? '24' : '28', width: isMobile ? '24' : '28', loading: "lazy" }) })) }), social.platform))) })] }))] }, index))) }))] })), isMobile && jsxRuntime.jsx(StyledDivider, {}), isMobile && (jsxRuntime.jsx(DivBottom, { children: jsxRuntime.jsxs(DivLinks, { children: [jsxRuntime.jsx("div", Object.assign({ onClick: onPrivacyPolicyClick, style: { cursor: 'pointer' } }, { children: jsxRuntime.jsx(material.Typography, Object.assign({ variant: "body2" }, { children: jsxRuntime.jsx(AnchorLink, Object.assign({ href: `${host}/${currentLocale}/terms/privacypolicy`, onClick: (e) => e === null || e === void 0 ? void 0 : e.preventDefault() }, { children: formatMessage({ id: 'Privacy Policy' }) })) })) })), jsxRuntime.jsx(DivSep, {}), jsxRuntime.jsx("div", Object.assign({ onClick: onTermsOfServiceClick, style: { cursor: 'pointer' } }, { children: jsxRuntime.jsx(material.Typography, Object.assign({ variant: "body2" }, { children: jsxRuntime.jsx(AnchorLink, Object.assign({ href: `${host}/${currentLocale}/terms/termsofservice`, onClick: (e) => e === null || e === void 0 ? void 0 : e.preventDefault() }, { children: formatMessage({ id: 'Terms of Service' }) })) })) }))] }) }))] }) }));
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
const StyledDrawer$1 = styles.styled(material.Drawer)(({ theme }) => ({
|
|
1458
|
+
zIndex: '1300 !important',
|
|
1459
|
+
'& .MuiDrawer-root': {
|
|
1460
|
+
zIndex: 1300,
|
|
1461
|
+
},
|
|
1462
|
+
'& .MuiDrawer-paper': {
|
|
1463
|
+
backgroundColor: '#FFFFFF',
|
|
1464
|
+
boxSizing: 'border-box',
|
|
1465
|
+
overflow: 'hidden',
|
|
1466
|
+
zIndex: 1300,
|
|
1467
|
+
},
|
|
1468
|
+
'& .MuiBackdrop-root': {
|
|
1469
|
+
zIndex: 1299,
|
|
1470
|
+
},
|
|
1471
|
+
}));
|
|
1472
|
+
const DrawerHeader$1 = styles.styled(material.Box)(({ theme }) => ({
|
|
1473
|
+
display: 'flex',
|
|
1474
|
+
alignItems: 'center',
|
|
1475
|
+
justifyContent: 'flex-start',
|
|
1476
|
+
padding: '16px',
|
|
1477
|
+
minHeight: '56px',
|
|
1478
|
+
}));
|
|
1479
|
+
const DrawerContent$1 = styles.styled(material.Box)(({ theme }) => ({
|
|
1480
|
+
flex: 1,
|
|
1481
|
+
overflowY: 'auto',
|
|
1482
|
+
paddingBottom: theme.spacing(2),
|
|
1483
|
+
}));
|
|
1484
|
+
const DrawerFooter = styles.styled(material.Box)(({ theme }) => ({
|
|
1485
|
+
padding: '16px',
|
|
1486
|
+
backgroundColor: '#FFFFFF',
|
|
1487
|
+
borderTop: 'none',
|
|
1488
|
+
boxShadow: '0px -2px 8px rgba(0, 0, 0, 0.08)',
|
|
1489
|
+
}));
|
|
1490
|
+
styles.styled(material.Button)(({ theme }) => ({
|
|
1491
|
+
minWidth: 'auto',
|
|
1492
|
+
padding: 0,
|
|
1493
|
+
}));
|
|
1494
|
+
const HeaderSection = styles.styled(material.Box)(({ theme }) => ({
|
|
1495
|
+
backgroundColor: '#FFFFFF',
|
|
1496
|
+
padding: '16px',
|
|
1497
|
+
display: 'flex',
|
|
1498
|
+
flexDirection: 'column',
|
|
1499
|
+
gap: '12px',
|
|
1500
|
+
}));
|
|
1501
|
+
const CategoryIcon = styles.styled(material.Box)(({ theme }) => ({
|
|
1502
|
+
width: '32px',
|
|
1503
|
+
height: '32px',
|
|
1504
|
+
display: 'flex',
|
|
1505
|
+
alignItems: 'center',
|
|
1506
|
+
justifyContent: 'center',
|
|
1507
|
+
}));
|
|
1508
|
+
const TitleText = styles.styled(material.Typography)(({ theme }) => ({
|
|
1509
|
+
fontFamily: '"Montserrat", sans-serif',
|
|
1510
|
+
fontWeight: 700,
|
|
1511
|
+
fontSize: '20px',
|
|
1512
|
+
lineHeight: '28px',
|
|
1513
|
+
color: '#13131B',
|
|
1514
|
+
}));
|
|
1515
|
+
const SubtitleText = styles.styled(material.Typography)(({ theme }) => ({
|
|
1516
|
+
fontFamily: '"Montserrat", sans-serif',
|
|
1517
|
+
fontWeight: 400,
|
|
1518
|
+
fontSize: '14px',
|
|
1519
|
+
lineHeight: '18px',
|
|
1520
|
+
color: '#5F5E62',
|
|
1521
|
+
}));
|
|
1522
|
+
const FooterButtons = styles.styled(material.Box)(({ theme }) => ({
|
|
1523
|
+
display: 'flex',
|
|
1524
|
+
flexDirection: 'column',
|
|
1525
|
+
gap: '16px',
|
|
1526
|
+
width: '100%',
|
|
1527
|
+
}));
|
|
1528
|
+
const PrimaryButton = styles.styled(material.Button)(({ theme }) => ({
|
|
1529
|
+
backgroundColor: '#4E4EEB',
|
|
1530
|
+
color: '#FFFFFF',
|
|
1531
|
+
borderRadius: '8px',
|
|
1532
|
+
height: '48px',
|
|
1533
|
+
textTransform: 'none',
|
|
1534
|
+
fontFamily: '"Montserrat", sans-serif',
|
|
1535
|
+
fontWeight: 500,
|
|
1536
|
+
fontSize: '14px',
|
|
1537
|
+
lineHeight: '18px',
|
|
1538
|
+
'&:hover': {
|
|
1539
|
+
backgroundColor: '#3E3EDB',
|
|
1540
|
+
},
|
|
1541
|
+
'&:disabled': {
|
|
1542
|
+
backgroundColor: '#C8C5CA',
|
|
1543
|
+
color: '#FFFFFF',
|
|
1544
|
+
},
|
|
1545
|
+
}));
|
|
1546
|
+
const SecondaryButton = styles.styled(material.Button)(({ theme }) => ({
|
|
1547
|
+
color: '#4E4EEB',
|
|
1548
|
+
borderRadius: '8px',
|
|
1549
|
+
height: '40px',
|
|
1550
|
+
textTransform: 'none',
|
|
1551
|
+
fontFamily: '"Montserrat", sans-serif',
|
|
1552
|
+
fontWeight: 500,
|
|
1553
|
+
fontSize: '14px',
|
|
1554
|
+
lineHeight: '18px',
|
|
1555
|
+
'&:hover': {
|
|
1556
|
+
backgroundColor: 'rgba(78, 78, 235, 0.08)',
|
|
1557
|
+
},
|
|
1558
|
+
}));
|
|
1559
|
+
|
|
1560
|
+
/**
|
|
1561
|
+
* RecommendationsDrawer - Mobile drawer for recommendations and forms
|
|
1562
|
+
*
|
|
1563
|
+
* @example
|
|
1564
|
+
* ```tsx
|
|
1565
|
+
* <RecommendationsDrawer
|
|
1566
|
+
* open={isOpen}
|
|
1567
|
+
* onClose={handleClose}
|
|
1568
|
+
* title="Personalize Your Plan"
|
|
1569
|
+
* subtitle="Answer a few questions"
|
|
1570
|
+
* primaryButtonText="Next"
|
|
1571
|
+
* onPrimaryAction={handleNext}
|
|
1572
|
+
* >
|
|
1573
|
+
* <QuestionSection question="What is your budget?" />
|
|
1574
|
+
* </RecommendationsDrawer>
|
|
1575
|
+
* ```
|
|
1576
|
+
*/
|
|
1577
|
+
function RecommendationsDrawer({ open, onClose, children, headerIcon, title, subtitle, showBackButton = false, onBack, primaryButtonText, onPrimaryAction, primaryButtonDisabled = false, secondaryButtonText, onSecondaryAction, showFooter = true, customFooter, formatMessage = (descriptor) => descriptor.id, }) {
|
|
1578
|
+
var _a;
|
|
1579
|
+
const muiTheme = material.useTheme();
|
|
1580
|
+
material.useMediaQuery((_a = muiTheme === null || muiTheme === void 0 ? void 0 : muiTheme.breakpoints) === null || _a === void 0 ? void 0 : _a.down('md'));
|
|
1581
|
+
const handleClose = () => {
|
|
1582
|
+
onClose();
|
|
1583
|
+
};
|
|
1584
|
+
const handleBackOrClose = () => {
|
|
1585
|
+
if (showBackButton && onBack) {
|
|
1586
|
+
onBack();
|
|
1587
|
+
}
|
|
1588
|
+
else {
|
|
1589
|
+
onClose();
|
|
1590
|
+
}
|
|
1591
|
+
};
|
|
1592
|
+
return (jsxRuntime.jsx(StyledDrawer$1, Object.assign({ anchor: "bottom", open: open, onClose: handleClose, PaperProps: {
|
|
1593
|
+
sx: {
|
|
1594
|
+
height: '95vh',
|
|
1595
|
+
borderTopLeftRadius: '16px',
|
|
1596
|
+
borderTopRightRadius: '16px',
|
|
1597
|
+
maxHeight: '95vh',
|
|
1598
|
+
},
|
|
1599
|
+
}, sx: {
|
|
1600
|
+
zIndex: 1300,
|
|
1601
|
+
} }, { children: jsxRuntime.jsxs(material.Box, Object.assign({ sx: { display: 'flex', flexDirection: 'column', height: '100%' } }, { children: [jsxRuntime.jsx(DrawerHeader$1, { children: jsxRuntime.jsx(material.IconButton, Object.assign({ onClick: handleBackOrClose, sx: { padding: 0 }, "aria-label": showBackButton ? 'back' : 'close' }, { children: showBackButton ? jsxRuntime.jsx(ArrowBackIcon, {}) : jsxRuntime.jsx(CloseIcon, {}) })) }), (title || subtitle || headerIcon) && (jsxRuntime.jsxs(HeaderSection, { children: [headerIcon && (jsxRuntime.jsx(CategoryIcon, { children: jsxRuntime.jsx("img", { src: headerIcon, alt: "Category icon", width: 32, height: 32 }) })), title && (jsxRuntime.jsx(TitleText, Object.assign({ variant: "h5" }, { children: formatMessage({ id: title }) }))), subtitle && (jsxRuntime.jsx(SubtitleText, Object.assign({ variant: "body2" }, { children: formatMessage({ id: subtitle }) })))] })), jsxRuntime.jsx(DrawerContent$1, { children: children }), showFooter && (jsxRuntime.jsx(DrawerFooter, { children: customFooter ? (customFooter) : (jsxRuntime.jsxs(FooterButtons, { children: [primaryButtonText && (jsxRuntime.jsx(PrimaryButton, Object.assign({ variant: "contained", fullWidth: true, onClick: onPrimaryAction, disabled: primaryButtonDisabled }, { children: formatMessage({ id: primaryButtonText }) }))), secondaryButtonText && (jsxRuntime.jsx(SecondaryButton, Object.assign({ variant: "text", fullWidth: true, onClick: onSecondaryAction }, { children: formatMessage({ id: secondaryButtonText }) })))] })) }))] })) })));
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
const StyledDrawer = material.styled(material.Drawer)(({ theme }) => ({
|
|
1605
|
+
zIndex: 1300,
|
|
1606
|
+
'& .MuiDrawer-paper': {
|
|
1607
|
+
borderTopLeftRadius: '8px',
|
|
1608
|
+
borderTopRightRadius: '8px',
|
|
1609
|
+
maxHeight: '90vh',
|
|
1610
|
+
},
|
|
1611
|
+
}));
|
|
1612
|
+
const DrawerContent = material.styled(material.Box)({
|
|
1613
|
+
display: 'flex',
|
|
1614
|
+
flexDirection: 'column',
|
|
1615
|
+
width: '100%',
|
|
1616
|
+
backgroundColor: '#ffffff',
|
|
1617
|
+
});
|
|
1618
|
+
const DrawerHeader = material.styled(material.Box)({
|
|
1619
|
+
display: 'flex',
|
|
1620
|
+
justifyContent: 'flex-end',
|
|
1621
|
+
alignItems: 'center',
|
|
1622
|
+
padding: '16px 16px 0',
|
|
1623
|
+
backgroundColor: '#ffffff',
|
|
1624
|
+
});
|
|
1625
|
+
const CloseButtonContainer = material.styled(material.Box)({
|
|
1626
|
+
width: '24px',
|
|
1627
|
+
height: '24px',
|
|
1628
|
+
});
|
|
1629
|
+
const Header = material.styled(material.Box)({
|
|
1630
|
+
display: 'flex',
|
|
1631
|
+
flexDirection: 'column',
|
|
1632
|
+
gap: '6px',
|
|
1633
|
+
padding: '16px',
|
|
1634
|
+
backgroundColor: '#ffffff',
|
|
1635
|
+
});
|
|
1636
|
+
const HeaderTitle = material.styled(material.Typography)({
|
|
1637
|
+
fontFamily: 'Montserrat, sans-serif',
|
|
1638
|
+
fontSize: '20px',
|
|
1639
|
+
fontWeight: 700,
|
|
1640
|
+
lineHeight: '28px',
|
|
1641
|
+
color: '#13131b',
|
|
1642
|
+
});
|
|
1643
|
+
const HeaderSubtitle = material.styled(material.Typography)({
|
|
1644
|
+
fontFamily: 'Montserrat, sans-serif',
|
|
1645
|
+
fontSize: '14px',
|
|
1646
|
+
fontWeight: 400,
|
|
1647
|
+
lineHeight: '18px',
|
|
1648
|
+
color: 'rgba(0, 0, 0, 0.6)',
|
|
1649
|
+
});
|
|
1650
|
+
const ProductsContainer = material.styled(material.Box)({
|
|
1651
|
+
padding: '16px',
|
|
1652
|
+
backgroundColor: '#ffffff',
|
|
1653
|
+
});
|
|
1654
|
+
const ProductsGrid = material.styled(material.Box)({
|
|
1655
|
+
display: 'grid',
|
|
1656
|
+
gridTemplateColumns: 'repeat(2, 1fr)',
|
|
1657
|
+
gap: '12px',
|
|
1658
|
+
});
|
|
1659
|
+
const ProductCard = material.styled(material.Box)({
|
|
1660
|
+
display: 'flex',
|
|
1661
|
+
flexDirection: 'column',
|
|
1662
|
+
gap: '16px',
|
|
1663
|
+
backgroundColor: '#ffffff',
|
|
1664
|
+
borderRadius: '12px',
|
|
1665
|
+
boxShadow: '0px 2px 10px 0px rgba(0, 0, 0, 0.12)',
|
|
1666
|
+
padding: '16px 12px 12px',
|
|
1667
|
+
height: '168px',
|
|
1668
|
+
});
|
|
1669
|
+
const ProductInfo = material.styled(material.Box)({
|
|
1670
|
+
display: 'flex',
|
|
1671
|
+
flexDirection: 'column',
|
|
1672
|
+
gap: '6px',
|
|
1673
|
+
alignItems: 'center',
|
|
1674
|
+
justifyContent: 'center',
|
|
1675
|
+
flex: 1,
|
|
1676
|
+
});
|
|
1677
|
+
const ProductLogo = material.styled(material.Box)({
|
|
1678
|
+
display: 'flex',
|
|
1679
|
+
alignItems: 'center',
|
|
1680
|
+
justifyContent: 'center',
|
|
1681
|
+
padding: '4px',
|
|
1682
|
+
});
|
|
1683
|
+
const ProductName = material.styled(material.Typography)({
|
|
1684
|
+
fontFamily: 'Montserrat, sans-serif',
|
|
1685
|
+
fontSize: '14px',
|
|
1686
|
+
fontWeight: 700,
|
|
1687
|
+
lineHeight: '22px',
|
|
1688
|
+
color: '#13131b',
|
|
1689
|
+
textAlign: 'center',
|
|
1690
|
+
});
|
|
1691
|
+
const ProductType = material.styled(material.Typography)({
|
|
1692
|
+
fontFamily: 'Montserrat, sans-serif',
|
|
1693
|
+
fontSize: '12px',
|
|
1694
|
+
fontWeight: 400,
|
|
1695
|
+
lineHeight: '16px',
|
|
1696
|
+
color: '#13131b',
|
|
1697
|
+
textAlign: 'center',
|
|
1698
|
+
});
|
|
1699
|
+
const ViewPlansButton = material.styled(material.Button)({
|
|
1700
|
+
backgroundColor: '#317abc',
|
|
1701
|
+
color: '#ffffff',
|
|
1702
|
+
borderRadius: '8px',
|
|
1703
|
+
height: '36px',
|
|
1704
|
+
textTransform: 'none',
|
|
1705
|
+
fontFamily: 'Montserrat, sans-serif',
|
|
1706
|
+
fontSize: '14px',
|
|
1707
|
+
fontWeight: 500,
|
|
1708
|
+
lineHeight: '18px',
|
|
1709
|
+
'&:hover': {
|
|
1710
|
+
backgroundColor: '#2869a8',
|
|
1711
|
+
},
|
|
1712
|
+
'&:active': {
|
|
1713
|
+
backgroundColor: '#1f5489',
|
|
1714
|
+
},
|
|
1715
|
+
});
|
|
1716
|
+
|
|
1717
|
+
function ProductSelectionDrawer({ open, onClose, products, onProductSelect, title = 'Select your product', subtitle = 'Pick the product that suits your protection goals to view available plans', viewPlansButtonText = 'View plans', }) {
|
|
1718
|
+
return (jsxRuntime.jsx(StyledDrawer, Object.assign({ anchor: "bottom", open: open, onClose: onClose }, { children: jsxRuntime.jsxs(DrawerContent, { children: [jsxRuntime.jsx(DrawerHeader, { children: jsxRuntime.jsx(CloseButtonContainer, { children: jsxRuntime.jsx(material.IconButton, Object.assign({ onClick: onClose, sx: { padding: 0 } }, { children: jsxRuntime.jsx(CloseIcon, { sx: { fontSize: 24, color: '#13131b' } }) })) }) }), jsxRuntime.jsxs(Header, { children: [jsxRuntime.jsx(HeaderTitle, { children: title }), jsxRuntime.jsx(HeaderSubtitle, { children: subtitle })] }), jsxRuntime.jsx(ProductsContainer, { children: jsxRuntime.jsx(ProductsGrid, { children: products.map((product) => (jsxRuntime.jsxs(ProductCard, { children: [jsxRuntime.jsxs(ProductInfo, { children: [jsxRuntime.jsx(ProductLogo, { children: jsxRuntime.jsx("img", { src: product.logo, alt: product.name, style: {
|
|
1719
|
+
width: '88px',
|
|
1720
|
+
height: '32px',
|
|
1721
|
+
objectFit: 'cover',
|
|
1722
|
+
} }) }), jsxRuntime.jsxs(material.Box, Object.assign({ sx: { textAlign: 'center', width: '100%' } }, { children: [jsxRuntime.jsx(ProductName, { children: product.name }), jsxRuntime.jsx(ProductType, { children: product.type })] }))] }), jsxRuntime.jsx(ViewPlansButton, Object.assign({ variant: "contained", fullWidth: true, onClick: () => onProductSelect(product.id) }, { children: viewPlansButtonText }))] }, product.id))) }) })] }) })));
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
const QuestionContainer = styles.styled(material.Box)(({ theme }) => ({
|
|
1726
|
+
backgroundColor: '#FFFFFF',
|
|
1727
|
+
padding: '12px 16px',
|
|
1728
|
+
display: 'flex',
|
|
1729
|
+
flexDirection: 'column',
|
|
1730
|
+
gap: '16px',
|
|
1731
|
+
width: '100%',
|
|
1732
|
+
}));
|
|
1733
|
+
const QuestionHeader = styles.styled(material.Box)(({ theme }) => ({
|
|
1734
|
+
display: 'flex',
|
|
1735
|
+
flexDirection: 'column',
|
|
1736
|
+
gap: '6px',
|
|
1737
|
+
width: '100%',
|
|
1738
|
+
}));
|
|
1739
|
+
const QuestionTitle = styles.styled(material.Typography)(({ theme }) => ({
|
|
1740
|
+
fontFamily: '"Montserrat", sans-serif',
|
|
1741
|
+
fontWeight: 600,
|
|
1742
|
+
fontSize: '14px',
|
|
1743
|
+
lineHeight: '20px',
|
|
1744
|
+
color: '#13131B',
|
|
1745
|
+
}));
|
|
1746
|
+
const QuestionSubtext = styles.styled(material.Typography)(({ theme }) => ({
|
|
1747
|
+
fontFamily: '"Montserrat", sans-serif',
|
|
1748
|
+
fontWeight: 400,
|
|
1749
|
+
fontSize: '12px',
|
|
1750
|
+
lineHeight: '16px',
|
|
1751
|
+
color: '#5F5E62',
|
|
1752
|
+
}));
|
|
1753
|
+
const OptionsContainer = styles.styled(material.Box)(({ theme }) => ({
|
|
1754
|
+
display: 'flex',
|
|
1755
|
+
flexDirection: 'column',
|
|
1756
|
+
gap: '8px',
|
|
1757
|
+
width: '100%',
|
|
1758
|
+
}));
|
|
1759
|
+
|
|
1760
|
+
/**
|
|
1761
|
+
* QuestionSection - Displays a question with selectable options
|
|
1762
|
+
*
|
|
1763
|
+
* @example
|
|
1764
|
+
* ```tsx
|
|
1765
|
+
* <QuestionSection
|
|
1766
|
+
* questionNumber="1"
|
|
1767
|
+
* question="Which plan feels right for you?"
|
|
1768
|
+
* helperText="Select one option"
|
|
1769
|
+
* options={planOptions}
|
|
1770
|
+
* selectedValue={selectedPlan}
|
|
1771
|
+
* onSelect={setSelectedPlan}
|
|
1772
|
+
* />
|
|
1773
|
+
* ```
|
|
1774
|
+
*/
|
|
1775
|
+
function QuestionSection({ questionNumber, question, helperText, options, selectedValue, onSelect, multiple = false, selectedValues = [], renderOption, formatMessage = (descriptor) => descriptor.id, }) {
|
|
1776
|
+
const isSelected = (optionValue) => {
|
|
1777
|
+
if (multiple) {
|
|
1778
|
+
return selectedValues.includes(optionValue);
|
|
1779
|
+
}
|
|
1780
|
+
return selectedValue === optionValue;
|
|
1781
|
+
};
|
|
1782
|
+
return (jsxRuntime.jsxs(QuestionContainer, { children: [jsxRuntime.jsxs(QuestionHeader, { children: [jsxRuntime.jsxs(QuestionTitle, Object.assign({ variant: "subtitle1" }, { children: [questionNumber && `${questionNumber}. `, formatMessage({ id: question })] })), helperText && (jsxRuntime.jsx(QuestionSubtext, Object.assign({ variant: "caption" }, { children: formatMessage({ id: helperText }) })))] }), jsxRuntime.jsx(OptionsContainer, { children: options.map((option) => {
|
|
1783
|
+
const selected = isSelected(option.value);
|
|
1784
|
+
if (renderOption) {
|
|
1785
|
+
return renderOption(option, selected);
|
|
1786
|
+
}
|
|
1787
|
+
// Default rendering handled by parent or OptionButton component
|
|
1788
|
+
return null;
|
|
1789
|
+
}) })] }));
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
const StyledOptionButton = styles.styled(material.ButtonBase)(({ theme, selected, size = 'medium', fullWidth }) => {
|
|
1793
|
+
const heights = {
|
|
1794
|
+
small: '32px',
|
|
1795
|
+
medium: '40px',
|
|
1796
|
+
large: '48px',
|
|
1797
|
+
};
|
|
1798
|
+
return {
|
|
1799
|
+
height: heights[size],
|
|
1800
|
+
width: fullWidth ? '100%' : 'auto',
|
|
1801
|
+
borderRadius: '8px',
|
|
1802
|
+
border: selected
|
|
1803
|
+
? '2px solid #317ABC'
|
|
1804
|
+
: '1px solid #C8C5CA',
|
|
1805
|
+
backgroundColor: selected ? 'rgba(49, 122, 188, 0.1)' : '#FFFFFF',
|
|
1806
|
+
padding: '10px 24px',
|
|
1807
|
+
display: 'flex',
|
|
1808
|
+
alignItems: 'center',
|
|
1809
|
+
justifyContent: 'center',
|
|
1810
|
+
cursor: 'pointer',
|
|
1811
|
+
transition: 'all 0.2s ease',
|
|
1812
|
+
'&:hover': {
|
|
1813
|
+
backgroundColor: selected ? 'rgba(49, 122, 188, 0.15)' : 'rgba(0, 0, 0, 0.04)',
|
|
1814
|
+
},
|
|
1815
|
+
'&:disabled': {
|
|
1816
|
+
backgroundColor: '#F5F5F5',
|
|
1817
|
+
border: '1px solid #EEEEEE',
|
|
1818
|
+
cursor: 'not-allowed',
|
|
1819
|
+
opacity: 0.6,
|
|
1820
|
+
},
|
|
1821
|
+
};
|
|
1822
|
+
});
|
|
1823
|
+
const OptionContent = styles.styled(material.Box)(({ theme }) => ({
|
|
1824
|
+
display: 'flex',
|
|
1825
|
+
alignItems: 'center',
|
|
1826
|
+
justifyContent: 'center',
|
|
1827
|
+
gap: '8px',
|
|
1828
|
+
width: '100%',
|
|
1829
|
+
}));
|
|
1830
|
+
const OptionIcon = styles.styled('span')(({ theme }) => ({
|
|
1831
|
+
fontSize: '18px',
|
|
1832
|
+
lineHeight: 1,
|
|
1833
|
+
flexShrink: 0,
|
|
1834
|
+
}));
|
|
1835
|
+
const OptionLabel = styles.styled(material.Typography)(({ theme, selected, disabled }) => ({
|
|
1836
|
+
fontFamily: '"Montserrat", sans-serif',
|
|
1837
|
+
fontWeight: selected ? 600 : 500,
|
|
1838
|
+
fontSize: '14px',
|
|
1839
|
+
lineHeight: '20px',
|
|
1840
|
+
color: disabled ? 'rgba(0, 0, 0, 0.4)' : '#13131B',
|
|
1841
|
+
textAlign: 'center',
|
|
1842
|
+
}));
|
|
1843
|
+
|
|
1844
|
+
/**
|
|
1845
|
+
* OptionButton - Selectable button for questionnaire options
|
|
1846
|
+
*
|
|
1847
|
+
* @example
|
|
1848
|
+
* ```tsx
|
|
1849
|
+
* <OptionButton
|
|
1850
|
+
* value="option1"
|
|
1851
|
+
* label="Option 1"
|
|
1852
|
+
* icon="🎯"
|
|
1853
|
+
* selected={selectedValue === 'option1'}
|
|
1854
|
+
* onClick={(value) => setSelectedValue(value)}
|
|
1855
|
+
* />
|
|
1856
|
+
* ```
|
|
1857
|
+
*/
|
|
1858
|
+
function OptionButton({ value, label, icon, selected = false, disabled = false, onClick, size = 'medium', fullWidth = true, formatMessage = (descriptor) => descriptor.id, }) {
|
|
1859
|
+
const handleClick = () => {
|
|
1860
|
+
if (!disabled && onClick) {
|
|
1861
|
+
onClick(value);
|
|
1862
|
+
}
|
|
1863
|
+
};
|
|
1864
|
+
return (jsxRuntime.jsx(StyledOptionButton, Object.assign({ selected: selected, disabled: disabled, onClick: handleClick, size: size, fullWidth: fullWidth }, { children: jsxRuntime.jsxs(OptionContent, { children: [icon && jsxRuntime.jsx(OptionIcon, { children: icon }), jsxRuntime.jsx(OptionLabel, Object.assign({ selected: selected, disabled: disabled, variant: "body2" }, { children: formatMessage({ id: label }) }))] }) })));
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
const ToggleContainer$1 = styles.styled(material.Box)(({ theme }) => ({
|
|
1868
|
+
backgroundColor: '#F9F9F9',
|
|
1869
|
+
borderRadius: '40px',
|
|
1870
|
+
display: 'flex',
|
|
1871
|
+
gap: '6px',
|
|
1872
|
+
height: '48px',
|
|
1873
|
+
padding: '0',
|
|
1874
|
+
width: '100%',
|
|
1875
|
+
}));
|
|
1876
|
+
const ToggleButton$1 = styles.styled(material.ButtonBase)(({ theme, selected }) => ({
|
|
1877
|
+
flex: 1,
|
|
1878
|
+
display: 'flex',
|
|
1879
|
+
alignItems: 'center',
|
|
1880
|
+
justifyContent: 'center',
|
|
1881
|
+
gap: '4px',
|
|
1882
|
+
padding: '8px',
|
|
1883
|
+
borderRadius: selected ? '40px' : '104px',
|
|
1884
|
+
backgroundColor: selected ? '#00E08B' : 'transparent',
|
|
1885
|
+
transition: 'all 0.3s ease',
|
|
1886
|
+
'&:hover': {
|
|
1887
|
+
backgroundColor: selected ? '#00D080' : 'rgba(0, 0, 0, 0.04)',
|
|
1888
|
+
},
|
|
1889
|
+
}));
|
|
1890
|
+
const ToggleIcon = styles.styled(material.Box)(({ theme }) => ({
|
|
1891
|
+
backgroundColor: '#FFFFFF',
|
|
1892
|
+
borderRadius: '50px',
|
|
1893
|
+
width: '32px',
|
|
1894
|
+
height: '32px',
|
|
1895
|
+
display: 'flex',
|
|
1896
|
+
alignItems: 'center',
|
|
1897
|
+
justifyContent: 'center',
|
|
1898
|
+
padding: '6px',
|
|
1899
|
+
}));
|
|
1900
|
+
const ToggleLabel = styles.styled(material.Typography)(({ theme, selected }) => ({
|
|
1901
|
+
fontFamily: '"Montserrat", sans-serif',
|
|
1902
|
+
fontWeight: 600,
|
|
1903
|
+
fontSize: '14px',
|
|
1904
|
+
lineHeight: '20px',
|
|
1905
|
+
color: selected ? '#FEFBFF' : '#5F5E62',
|
|
1906
|
+
whiteSpace: 'nowrap',
|
|
1907
|
+
}));
|
|
1908
|
+
|
|
1909
|
+
/**
|
|
1910
|
+
* ToggleGroup - Segmented control for switching between options
|
|
1911
|
+
*
|
|
1912
|
+
* @example
|
|
1913
|
+
* ```tsx
|
|
1914
|
+
* <ToggleGroup
|
|
1915
|
+
* options={[
|
|
1916
|
+
* { value: 'domestic', label: 'Domestic', icon: '🏠' },
|
|
1917
|
+
* { value: 'international', label: 'International', icon: '✈️' }
|
|
1918
|
+
* ]}
|
|
1919
|
+
* value={selectedType}
|
|
1920
|
+
* onChange={setSelectedType}
|
|
1921
|
+
* />
|
|
1922
|
+
* ```
|
|
1923
|
+
*/
|
|
1924
|
+
function ToggleGroup({ options, value, onChange, formatMessage = (descriptor) => descriptor.id, }) {
|
|
1925
|
+
return (jsxRuntime.jsx(ToggleContainer$1, { children: options.map((option) => (jsxRuntime.jsxs(ToggleButton$1, Object.assign({ selected: value === option.value, onClick: () => onChange(option.value) }, { children: [option.icon && (jsxRuntime.jsx(ToggleIcon, { children: jsxRuntime.jsx("img", { src: option.icon, alt: option.label, width: 19.2, height: 19.2 }) })), jsxRuntime.jsx(ToggleLabel, Object.assign({ selected: value === option.value }, { children: formatMessage({ id: option.label }) }))] }), option.value))) }));
|
|
1926
|
+
}
|
|
1927
|
+
|
|
412
1928
|
/**
|
|
413
1929
|
* Theme Utility Functions
|
|
414
1930
|
* Helper functions for working with tenant themes
|
|
415
1931
|
*/
|
|
416
1932
|
/**
|
|
417
1933
|
* Get color value from theme palette path
|
|
418
|
-
* @param theme - Tenant theme configuration
|
|
1934
|
+
* @param theme - Tenant theme configuration (can be undefined/null for SSR)
|
|
419
1935
|
* @param path - Dot-notation path to color (e.g., 'primary.main')
|
|
420
1936
|
* @param defaultColor - Fallback color if path not found
|
|
421
1937
|
* @returns Color string
|
|
422
1938
|
*/
|
|
423
1939
|
function getThemeColor(theme, path, defaultColor = '#000000') {
|
|
1940
|
+
// Handle SSR case where theme might be undefined
|
|
1941
|
+
if (!theme || !theme.palette) {
|
|
1942
|
+
return defaultColor;
|
|
1943
|
+
}
|
|
424
1944
|
const keys = path.split('.');
|
|
425
1945
|
let value = theme.palette;
|
|
426
1946
|
for (const key of keys) {
|
|
@@ -435,15 +1955,22 @@ function getThemeColor(theme, path, defaultColor = '#000000') {
|
|
|
435
1955
|
}
|
|
436
1956
|
/**
|
|
437
1957
|
* Merge tenant theme with base MUI theme
|
|
1958
|
+
* This makes tenant theme accessible in styled components via theme parameter
|
|
438
1959
|
* @param baseTheme - Base MUI theme
|
|
439
1960
|
* @param tenantTheme - Tenant-specific theme configuration
|
|
440
1961
|
* @returns Merged theme
|
|
441
1962
|
*/
|
|
442
1963
|
function mergeTenantTheme(baseTheme, tenantTheme) {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
1964
|
+
// Merge tenant palette and typography into MUI theme
|
|
1965
|
+
const mergedPalette = Object.assign(Object.assign(Object.assign({}, baseTheme.palette), tenantTheme.palette), {
|
|
1966
|
+
// Make tenant colors accessible via theme.palette
|
|
1967
|
+
tenant: tenantTheme.palette });
|
|
1968
|
+
const mergedTypography = Object.assign(Object.assign(Object.assign({}, baseTheme.typography), tenantTheme.typography), {
|
|
1969
|
+
// Make tenant typography accessible via theme.typography
|
|
1970
|
+
tenant: tenantTheme.typography });
|
|
1971
|
+
return Object.assign(Object.assign({}, baseTheme), { palette: mergedPalette, typography: mergedTypography,
|
|
1972
|
+
// Also add tenant theme at root level for easy access
|
|
1973
|
+
tenantTheme });
|
|
447
1974
|
}
|
|
448
1975
|
/**
|
|
449
1976
|
* Create CSS variables from tenant theme
|
|
@@ -478,21 +2005,580 @@ function createThemeCSSVariables(theme, prefix = '--tenant') {
|
|
|
478
2005
|
return variables;
|
|
479
2006
|
}
|
|
480
2007
|
|
|
2008
|
+
const ToggleContainer = styles.styled(material.Box)(({ theme }) => {
|
|
2009
|
+
var _a, _b;
|
|
2010
|
+
return ({
|
|
2011
|
+
display: 'flex',
|
|
2012
|
+
gap: '6px',
|
|
2013
|
+
height: '48px',
|
|
2014
|
+
backgroundColor: ((_b = (_a = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _a === void 0 ? void 0 : _a.ui) === null || _b === void 0 ? void 0 : _b.sliderBackground) || '#f9f9f9',
|
|
2015
|
+
borderRadius: '40px',
|
|
2016
|
+
width: '100%',
|
|
2017
|
+
padding: '0',
|
|
2018
|
+
position: 'relative',
|
|
2019
|
+
});
|
|
2020
|
+
});
|
|
2021
|
+
const ToggleButton = styles.styled(material.Box)(({ theme, active }) => {
|
|
2022
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2023
|
+
return ({
|
|
2024
|
+
flex: 1,
|
|
2025
|
+
display: 'flex',
|
|
2026
|
+
gap: '4px',
|
|
2027
|
+
alignItems: 'center',
|
|
2028
|
+
justifyContent: 'center',
|
|
2029
|
+
padding: '8px',
|
|
2030
|
+
height: '100%',
|
|
2031
|
+
borderRadius: '40px',
|
|
2032
|
+
cursor: 'pointer',
|
|
2033
|
+
backgroundColor: active
|
|
2034
|
+
? ((_b = (_a = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _a === void 0 ? void 0 : _a.ui) === null || _b === void 0 ? void 0 : _b.toggleActive) || '#a4ce4e'
|
|
2035
|
+
: 'transparent',
|
|
2036
|
+
color: active
|
|
2037
|
+
? ((_d = (_c = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _c === void 0 ? void 0 : _c.ui) === null || _d === void 0 ? void 0 : _d.toggleActiveText) || '#fefbff'
|
|
2038
|
+
: ((_f = (_e = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _e === void 0 ? void 0 : _e.ui) === null || _f === void 0 ? void 0 : _f.toggleInactiveText) || '#5f5e62',
|
|
2039
|
+
transition: 'all 0.2s ease',
|
|
2040
|
+
'&:hover': {
|
|
2041
|
+
opacity: 0.9,
|
|
2042
|
+
},
|
|
2043
|
+
});
|
|
2044
|
+
});
|
|
2045
|
+
const ToggleText = styles.styled(material.Typography)(({ theme }) => {
|
|
2046
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2047
|
+
return ({
|
|
2048
|
+
fontFamily: ((_a = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _a === void 0 ? void 0 : _a.fontFamily) ||
|
|
2049
|
+
"'Montserrat', sans-serif",
|
|
2050
|
+
fontSize: ((_c = (_b = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _b === void 0 ? void 0 : _b.bodyMedium) === null || _c === void 0 ? void 0 : _c.fontSize) || '14px',
|
|
2051
|
+
fontWeight: ((_d = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _d === void 0 ? void 0 : _d.fontWeightSemiBold) || 600,
|
|
2052
|
+
lineHeight: ((_f = (_e = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _e === void 0 ? void 0 : _e.bodyMedium) === null || _f === void 0 ? void 0 : _f.lineHeight) || '20px',
|
|
2053
|
+
whiteSpace: 'nowrap',
|
|
2054
|
+
});
|
|
2055
|
+
});
|
|
2056
|
+
|
|
2057
|
+
/**
|
|
2058
|
+
* BillingToggle - Toggle between monthly and annual billing
|
|
2059
|
+
*
|
|
2060
|
+
* @example
|
|
2061
|
+
* ```tsx
|
|
2062
|
+
* <BillingToggle
|
|
2063
|
+
* value={billingType}
|
|
2064
|
+
* onChange={setBillingType}
|
|
2065
|
+
* />
|
|
2066
|
+
* ```
|
|
2067
|
+
*/
|
|
2068
|
+
function BillingToggle({ value, onChange, formatMessage = (descriptor) => descriptor.defaultMessage || descriptor.id, }) {
|
|
2069
|
+
// Safely get theme, handle SSR case where it might be undefined
|
|
2070
|
+
const tenantTheme = useTenantTheme();
|
|
2071
|
+
const theme = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
2072
|
+
// Get theme colors with SSR-safe fallbacks
|
|
2073
|
+
const toggleActiveColor = getThemeColor(theme, 'ui.toggleActive', '#a4ce4e');
|
|
2074
|
+
const toggleActiveTextColor = getThemeColor(theme, 'ui.toggleActiveText', '#fefbff');
|
|
2075
|
+
const toggleInactiveTextColor = getThemeColor(theme, 'ui.toggleInactiveText', '#5f5e62');
|
|
2076
|
+
const toggleBgColor = getThemeColor(theme, 'ui.sliderBackground', '#f9f9f9');
|
|
2077
|
+
return (jsxRuntime.jsxs(ToggleContainer, Object.assign({ sx: {
|
|
2078
|
+
backgroundColor: toggleBgColor,
|
|
2079
|
+
} }, { children: [jsxRuntime.jsx(ToggleButton, Object.assign({ active: value === 'monthly', onClick: () => onChange('monthly'), sx: {
|
|
2080
|
+
backgroundColor: value === 'monthly' ? toggleActiveColor : 'transparent',
|
|
2081
|
+
color: value === 'monthly'
|
|
2082
|
+
? toggleActiveTextColor
|
|
2083
|
+
: toggleInactiveTextColor,
|
|
2084
|
+
} }, { children: jsxRuntime.jsx(ToggleText, { children: formatMessage({
|
|
2085
|
+
id: 'Billed monthly',
|
|
2086
|
+
defaultMessage: 'Billed monthly',
|
|
2087
|
+
}) }) })), jsxRuntime.jsx(ToggleButton, Object.assign({ active: value === 'annually', onClick: () => onChange('annually'), sx: {
|
|
2088
|
+
backgroundColor: value === 'annually' ? toggleActiveColor : 'transparent',
|
|
2089
|
+
color: value === 'annually'
|
|
2090
|
+
? toggleActiveTextColor
|
|
2091
|
+
: toggleInactiveTextColor,
|
|
2092
|
+
} }, { children: jsxRuntime.jsx(ToggleText, { children: formatMessage({
|
|
2093
|
+
id: 'Billed annually',
|
|
2094
|
+
defaultMessage: 'Billed annually',
|
|
2095
|
+
}) }) }))] })));
|
|
2096
|
+
}
|
|
2097
|
+
|
|
2098
|
+
const CalloutContainer = styles.styled(material.Box)(({ theme }) => {
|
|
2099
|
+
var _a, _b, _c, _d;
|
|
2100
|
+
return ({
|
|
2101
|
+
display: 'flex',
|
|
2102
|
+
flexDirection: 'column',
|
|
2103
|
+
gap: '8px',
|
|
2104
|
+
padding: '12px',
|
|
2105
|
+
backgroundColor: ((_b = (_a = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _a === void 0 ? void 0 : _a.ui) === null || _b === void 0 ? void 0 : _b.calloutBackground) || '#f9f9f9',
|
|
2106
|
+
border: `1px solid ${((_d = (_c = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _c === void 0 ? void 0 : _c.ui) === null || _d === void 0 ? void 0 : _d.calloutBorder) || '#ffffff'}`,
|
|
2107
|
+
borderRadius: '8px',
|
|
2108
|
+
width: '100%',
|
|
2109
|
+
});
|
|
2110
|
+
});
|
|
2111
|
+
const CalloutHeader = styles.styled(material.Box)(({ theme }) => ({
|
|
2112
|
+
display: 'flex',
|
|
2113
|
+
gap: '4px',
|
|
2114
|
+
alignItems: 'center',
|
|
2115
|
+
}));
|
|
2116
|
+
const CalloutIcon = styles.styled(InfoIcon)(({ theme }) => {
|
|
2117
|
+
var _a, _b;
|
|
2118
|
+
return ({
|
|
2119
|
+
width: '20px',
|
|
2120
|
+
height: '20px',
|
|
2121
|
+
color: ((_b = (_a = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _a === void 0 ? void 0 : _a.natural) === null || _b === void 0 ? void 0 : _b.dim) || '#13131b',
|
|
2122
|
+
});
|
|
2123
|
+
});
|
|
2124
|
+
const CalloutTitle = styles.styled(material.Typography)(({ theme }) => {
|
|
2125
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2126
|
+
return ({
|
|
2127
|
+
fontFamily: ((_a = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _a === void 0 ? void 0 : _a.fontFamily) ||
|
|
2128
|
+
"'Montserrat', sans-serif",
|
|
2129
|
+
fontSize: ((_c = (_b = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _b === void 0 ? void 0 : _b.bodyMedium) === null || _c === void 0 ? void 0 : _c.fontSize) || '14px',
|
|
2130
|
+
fontWeight: ((_d = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _d === void 0 ? void 0 : _d.fontWeightSemiBold) || 600,
|
|
2131
|
+
lineHeight: ((_f = (_e = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _e === void 0 ? void 0 : _e.bodyMedium) === null || _f === void 0 ? void 0 : _f.lineHeight) || '20px',
|
|
2132
|
+
color: ((_h = (_g = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _g === void 0 ? void 0 : _g.natural) === null || _h === void 0 ? void 0 : _h.dim) || '#13131b',
|
|
2133
|
+
});
|
|
2134
|
+
});
|
|
2135
|
+
const CalloutText = styles.styled(material.Typography)(({ theme }) => {
|
|
2136
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
2137
|
+
return ({
|
|
2138
|
+
fontFamily: ((_a = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _a === void 0 ? void 0 : _a.fontFamily) ||
|
|
2139
|
+
"'Montserrat', sans-serif",
|
|
2140
|
+
fontSize: ((_c = (_b = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _b === void 0 ? void 0 : _b.bodySmall) === null || _c === void 0 ? void 0 : _c.fontSize) || '12px',
|
|
2141
|
+
fontWeight: ((_e = (_d = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _d === void 0 ? void 0 : _d.bodySmall) === null || _e === void 0 ? void 0 : _e.fontWeight) || 400,
|
|
2142
|
+
lineHeight: ((_g = (_f = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _f === void 0 ? void 0 : _f.bodySmall) === null || _g === void 0 ? void 0 : _g.lineHeight) || '16px',
|
|
2143
|
+
color: ((_j = (_h = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _h === void 0 ? void 0 : _h.natural) === null || _j === void 0 ? void 0 : _j.dark) || '#5f5e62',
|
|
2144
|
+
});
|
|
2145
|
+
});
|
|
2146
|
+
|
|
2147
|
+
/**
|
|
2148
|
+
* InfoCallout - Displays helpful information or tips
|
|
2149
|
+
*
|
|
2150
|
+
* @example
|
|
2151
|
+
* ```tsx
|
|
2152
|
+
* <InfoCallout title="Helpful tip">
|
|
2153
|
+
* Many Malaysians aim for life protection that's at least 10–12 times their annual income
|
|
2154
|
+
* </InfoCallout>
|
|
2155
|
+
* ```
|
|
2156
|
+
*/
|
|
2157
|
+
function InfoCallout({ title = 'Helpful tip', children, formatMessage = (descriptor) => descriptor.defaultMessage || descriptor.id, }) {
|
|
2158
|
+
// Safely get theme, handle SSR case where it might be undefined
|
|
2159
|
+
const tenantTheme = useTenantTheme();
|
|
2160
|
+
const theme = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
2161
|
+
// Get theme colors with SSR-safe fallbacks
|
|
2162
|
+
const calloutBgColor = getThemeColor(theme, 'ui.calloutBackground', '#f9f9f9');
|
|
2163
|
+
const calloutBorderColor = getThemeColor(theme, 'ui.calloutBorder', '#ffffff');
|
|
2164
|
+
const textColor = getThemeColor(theme, 'natural.dim', '#13131b');
|
|
2165
|
+
const subtitleColor = getThemeColor(theme, 'natural.dark', '#5f5e62');
|
|
2166
|
+
return (jsxRuntime.jsxs(CalloutContainer, Object.assign({ sx: {
|
|
2167
|
+
backgroundColor: calloutBgColor,
|
|
2168
|
+
border: `1px solid ${calloutBorderColor}`,
|
|
2169
|
+
} }, { children: [jsxRuntime.jsxs(CalloutHeader, { children: [jsxRuntime.jsx(CalloutIcon, { sx: { color: textColor } }), jsxRuntime.jsx(CalloutTitle, Object.assign({ sx: { color: textColor } }, { children: formatMessage({
|
|
2170
|
+
id: title,
|
|
2171
|
+
defaultMessage: title,
|
|
2172
|
+
}) }))] }), jsxRuntime.jsx(CalloutText, Object.assign({ sx: { color: subtitleColor } }, { children: children }))] })));
|
|
2173
|
+
}
|
|
2174
|
+
|
|
2175
|
+
const SliderContainer = styles.styled(material.Box)(({ theme }) => {
|
|
2176
|
+
var _a, _b;
|
|
2177
|
+
return ({
|
|
2178
|
+
display: 'flex',
|
|
2179
|
+
flexDirection: 'column',
|
|
2180
|
+
gap: '16px',
|
|
2181
|
+
padding: '12px',
|
|
2182
|
+
backgroundColor: ((_b = (_a = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _a === void 0 ? void 0 : _a.ui) === null || _b === void 0 ? void 0 : _b.sliderBackground) || '#f9f9f9',
|
|
2183
|
+
borderRadius: '8px',
|
|
2184
|
+
width: '100%',
|
|
2185
|
+
});
|
|
2186
|
+
});
|
|
2187
|
+
const InputSection = styles.styled(material.Box)(({ theme }) => ({
|
|
2188
|
+
display: 'flex',
|
|
2189
|
+
flexDirection: 'column',
|
|
2190
|
+
gap: '8px',
|
|
2191
|
+
width: '100%',
|
|
2192
|
+
}));
|
|
2193
|
+
const InputLabel = styles.styled(material.Typography)(({ theme }) => {
|
|
2194
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
2195
|
+
return ({
|
|
2196
|
+
fontFamily: ((_a = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _a === void 0 ? void 0 : _a.fontFamily) ||
|
|
2197
|
+
"'Montserrat', sans-serif",
|
|
2198
|
+
fontSize: ((_c = (_b = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _b === void 0 ? void 0 : _b.bodySmall) === null || _c === void 0 ? void 0 : _c.fontSize) || '12px',
|
|
2199
|
+
fontWeight: ((_e = (_d = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _d === void 0 ? void 0 : _d.bodySmall) === null || _e === void 0 ? void 0 : _e.fontWeight) || 400,
|
|
2200
|
+
lineHeight: ((_g = (_f = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _f === void 0 ? void 0 : _f.bodySmall) === null || _g === void 0 ? void 0 : _g.lineHeight) || '16px',
|
|
2201
|
+
color: ((_j = (_h = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _h === void 0 ? void 0 : _h.natural) === null || _j === void 0 ? void 0 : _j.dim) || '#13131b',
|
|
2202
|
+
});
|
|
2203
|
+
});
|
|
2204
|
+
const InputContainer = styles.styled(material.Box)(({ theme }) => {
|
|
2205
|
+
var _a, _b, _c, _d;
|
|
2206
|
+
return ({
|
|
2207
|
+
display: 'flex',
|
|
2208
|
+
gap: '24px',
|
|
2209
|
+
alignItems: 'center',
|
|
2210
|
+
justifyContent: 'center',
|
|
2211
|
+
padding: '8px 16px',
|
|
2212
|
+
height: '44px',
|
|
2213
|
+
backgroundColor: ((_b = (_a = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _a === void 0 ? void 0 : _a.ui) === null || _b === void 0 ? void 0 : _b.inputBackground) || '#ffffff',
|
|
2214
|
+
border: `1px solid ${((_d = (_c = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _c === void 0 ? void 0 : _c.ui) === null || _d === void 0 ? void 0 : _d.inputBorder) || '#eeeeee'}`,
|
|
2215
|
+
borderRadius: '8px',
|
|
2216
|
+
width: '100%',
|
|
2217
|
+
maxWidth: '298px', // Match slider track width
|
|
2218
|
+
});
|
|
2219
|
+
});
|
|
2220
|
+
const InputValue = styles.styled(material.Typography)(({ theme }) => {
|
|
2221
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
2222
|
+
return ({
|
|
2223
|
+
fontFamily: ((_a = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _a === void 0 ? void 0 : _a.fontFamily) ||
|
|
2224
|
+
"'Montserrat', sans-serif",
|
|
2225
|
+
fontSize: ((_c = (_b = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _b === void 0 ? void 0 : _b.bodyMedium) === null || _c === void 0 ? void 0 : _c.fontSize) || '14px',
|
|
2226
|
+
fontWeight: ((_e = (_d = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _d === void 0 ? void 0 : _d.bodyMedium) === null || _e === void 0 ? void 0 : _e.fontWeight) || 400,
|
|
2227
|
+
lineHeight: ((_g = (_f = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _f === void 0 ? void 0 : _f.bodyMedium) === null || _g === void 0 ? void 0 : _g.lineHeight) || '18px',
|
|
2228
|
+
color: ((_j = (_h = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _h === void 0 ? void 0 : _h.natural) === null || _j === void 0 ? void 0 : _j.dim) || '#13131b',
|
|
2229
|
+
textAlign: 'center',
|
|
2230
|
+
flex: 1,
|
|
2231
|
+
});
|
|
2232
|
+
});
|
|
2233
|
+
const SliderTrack = styles.styled(material.Box)(({ theme }) => ({
|
|
2234
|
+
display: 'flex',
|
|
2235
|
+
alignItems: 'center',
|
|
2236
|
+
position: 'relative',
|
|
2237
|
+
width: '100%',
|
|
2238
|
+
maxWidth: '298px',
|
|
2239
|
+
height: '4px',
|
|
2240
|
+
}));
|
|
2241
|
+
const SliderSegment = styles.styled(material.Box)(({ theme, active }) => {
|
|
2242
|
+
var _a, _b, _c, _d;
|
|
2243
|
+
return ({
|
|
2244
|
+
height: '4px',
|
|
2245
|
+
backgroundColor: active
|
|
2246
|
+
? ((_b = (_a = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _a === void 0 ? void 0 : _a.ui) === null || _b === void 0 ? void 0 : _b.sliderActive) || '#317abc'
|
|
2247
|
+
: ((_d = (_c = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _c === void 0 ? void 0 : _c.ui) === null || _d === void 0 ? void 0 : _d.sliderInactive) || '#c8c5ca',
|
|
2248
|
+
borderRadius: '8px',
|
|
2249
|
+
width: '22px',
|
|
2250
|
+
marginRight: '-1px',
|
|
2251
|
+
});
|
|
2252
|
+
});
|
|
2253
|
+
const SliderDot = styles.styled(material.Box)(({ theme, active }) => {
|
|
2254
|
+
var _a, _b, _c, _d;
|
|
2255
|
+
return ({
|
|
2256
|
+
width: '10px',
|
|
2257
|
+
height: '10px',
|
|
2258
|
+
borderRadius: '8px',
|
|
2259
|
+
backgroundColor: active
|
|
2260
|
+
? ((_b = (_a = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _a === void 0 ? void 0 : _a.ui) === null || _b === void 0 ? void 0 : _b.sliderActive) || '#317abc'
|
|
2261
|
+
: ((_d = (_c = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _c === void 0 ? void 0 : _c.ui) === null || _d === void 0 ? void 0 : _d.sliderInactive) || '#c8c5ca',
|
|
2262
|
+
boxShadow: active ? '0px 2px 20px 4px rgba(0, 0, 0, 0.14)' : 'none',
|
|
2263
|
+
marginRight: '-1px',
|
|
2264
|
+
cursor: 'pointer',
|
|
2265
|
+
position: 'relative',
|
|
2266
|
+
zIndex: 2,
|
|
2267
|
+
'&:hover': {
|
|
2268
|
+
transform: 'scale(1.2)',
|
|
2269
|
+
transition: 'transform 0.2s ease',
|
|
2270
|
+
},
|
|
2271
|
+
});
|
|
2272
|
+
});
|
|
2273
|
+
const SliderThumb = styles.styled(material.Box)(({ theme }) => ({
|
|
2274
|
+
position: 'absolute',
|
|
2275
|
+
width: '18px',
|
|
2276
|
+
height: '18px',
|
|
2277
|
+
borderRadius: '34px',
|
|
2278
|
+
backgroundColor: '#ffffff',
|
|
2279
|
+
boxShadow: '0px 2px 20px 4px rgba(0, 0, 0, 0.14)',
|
|
2280
|
+
display: 'flex',
|
|
2281
|
+
alignItems: 'center',
|
|
2282
|
+
justifyContent: 'center',
|
|
2283
|
+
top: '-21px',
|
|
2284
|
+
left: '0px',
|
|
2285
|
+
cursor: 'grab',
|
|
2286
|
+
zIndex: 10,
|
|
2287
|
+
'&:active': {
|
|
2288
|
+
cursor: 'grabbing',
|
|
2289
|
+
},
|
|
2290
|
+
}));
|
|
2291
|
+
const ThumbIcon = styles.styled(material.Box)(({ theme }) => {
|
|
2292
|
+
var _a, _b;
|
|
2293
|
+
return ({
|
|
2294
|
+
width: '13px',
|
|
2295
|
+
height: '10px',
|
|
2296
|
+
display: 'flex',
|
|
2297
|
+
alignItems: 'center',
|
|
2298
|
+
justifyContent: 'center',
|
|
2299
|
+
color: ((_b = (_a = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _a === void 0 ? void 0 : _a.ui) === null || _b === void 0 ? void 0 : _b.sliderActive) || '#317abc',
|
|
2300
|
+
});
|
|
2301
|
+
});
|
|
2302
|
+
const RangeLabels = styles.styled(material.Box)(({ theme }) => ({
|
|
2303
|
+
display: 'flex',
|
|
2304
|
+
justifyContent: 'space-between',
|
|
2305
|
+
width: '100%',
|
|
2306
|
+
maxWidth: '298px', // Match slider track width
|
|
2307
|
+
}));
|
|
2308
|
+
const RangeLabel = styles.styled(material.Typography)(({ theme }) => {
|
|
2309
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
2310
|
+
return ({
|
|
2311
|
+
fontFamily: ((_a = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _a === void 0 ? void 0 : _a.fontFamily) ||
|
|
2312
|
+
"'Montserrat', sans-serif",
|
|
2313
|
+
fontSize: ((_c = (_b = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _b === void 0 ? void 0 : _b.smallText) === null || _c === void 0 ? void 0 : _c.fontSize) || '8px',
|
|
2314
|
+
fontWeight: ((_e = (_d = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _d === void 0 ? void 0 : _d.smallText) === null || _e === void 0 ? void 0 : _e.fontWeight) || 500,
|
|
2315
|
+
lineHeight: ((_g = (_f = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _f === void 0 ? void 0 : _f.smallText) === null || _g === void 0 ? void 0 : _g.lineHeight) || '16px',
|
|
2316
|
+
color: ((_j = (_h = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _h === void 0 ? void 0 : _h.natural) === null || _j === void 0 ? void 0 : _j.main) || '#929094',
|
|
2317
|
+
});
|
|
2318
|
+
});
|
|
2319
|
+
|
|
2320
|
+
/**
|
|
2321
|
+
* CoverageAmountSlider - Interactive slider for selecting coverage amounts
|
|
2322
|
+
*
|
|
2323
|
+
* @example
|
|
2324
|
+
* ```tsx
|
|
2325
|
+
* <CoverageAmountSlider
|
|
2326
|
+
* min={100000}
|
|
2327
|
+
* max={550000}
|
|
2328
|
+
* value={coverageAmount}
|
|
2329
|
+
* onChange={setCoverageAmount}
|
|
2330
|
+
* />
|
|
2331
|
+
* ```
|
|
2332
|
+
*/
|
|
2333
|
+
function CoverageAmountSlider({ min, max, value, onChange, label = 'Choose your coverage amount', segments = 8, currency = 'RM', formatCurrency: customFormatCurrency, }) {
|
|
2334
|
+
// Safely get theme, handle SSR case where it might be undefined
|
|
2335
|
+
const tenantTheme = useTenantTheme();
|
|
2336
|
+
const theme = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
2337
|
+
const [localValue, setLocalValue] = React.useState(value);
|
|
2338
|
+
// Get theme colors with SSR-safe fallbacks
|
|
2339
|
+
const sliderActiveColor = getThemeColor(theme, 'ui.sliderActive', '#317abc');
|
|
2340
|
+
const sliderInactiveColor = getThemeColor(theme, 'ui.sliderInactive', '#c8c5ca');
|
|
2341
|
+
const sliderBgColor = getThemeColor(theme, 'ui.sliderBackground', '#f9f9f9');
|
|
2342
|
+
const inputBgColor = getThemeColor(theme, 'ui.inputBackground', '#ffffff');
|
|
2343
|
+
const inputBorderColor = getThemeColor(theme, 'ui.inputBorder', '#eeeeee');
|
|
2344
|
+
const textColor = getThemeColor(theme, 'natural.dim', '#13131b');
|
|
2345
|
+
const labelColor = getThemeColor(theme, 'natural.main', '#929094');
|
|
2346
|
+
React.useEffect(() => {
|
|
2347
|
+
setLocalValue(value);
|
|
2348
|
+
}, [value]);
|
|
2349
|
+
const defaultFormatCurrency = (amount) => {
|
|
2350
|
+
return `${currency} ${amount.toLocaleString('en-US', {
|
|
2351
|
+
minimumFractionDigits: 0,
|
|
2352
|
+
maximumFractionDigits: 0,
|
|
2353
|
+
})}`;
|
|
2354
|
+
};
|
|
2355
|
+
const formatCurrency = customFormatCurrency || defaultFormatCurrency;
|
|
2356
|
+
const handleDecrease = () => {
|
|
2357
|
+
// Use total segments (9) for step calculation to match visual dots
|
|
2358
|
+
const totalSegmentsForSteps = segments + 1; // 9 segments between 10 dots
|
|
2359
|
+
const step = (max - min) / totalSegmentsForSteps;
|
|
2360
|
+
const newValue = Math.max(min, localValue - step);
|
|
2361
|
+
setLocalValue(newValue);
|
|
2362
|
+
onChange(newValue);
|
|
2363
|
+
};
|
|
2364
|
+
const handleIncrease = () => {
|
|
2365
|
+
// Use total segments (9) for step calculation to match visual dots
|
|
2366
|
+
const totalSegmentsForSteps = segments + 1; // 9 segments between 10 dots
|
|
2367
|
+
const step = (max - min) / totalSegmentsForSteps;
|
|
2368
|
+
const newValue = Math.min(max, localValue + step);
|
|
2369
|
+
setLocalValue(newValue);
|
|
2370
|
+
onChange(newValue);
|
|
2371
|
+
};
|
|
2372
|
+
const handleDotClick = (dotIndex) => {
|
|
2373
|
+
// Calculate the value for this dot position
|
|
2374
|
+
const dotValue = min + (dotIndex * (max - min)) / (totalDots - 1);
|
|
2375
|
+
setLocalValue(dotValue);
|
|
2376
|
+
onChange(dotValue);
|
|
2377
|
+
};
|
|
2378
|
+
const percentage = ((localValue - min) / (max - min)) * 100;
|
|
2379
|
+
// Track width is 298px (10 dots * 10px + 9 gaps * 22px = 298px)
|
|
2380
|
+
// Each dot is 10px wide, so dot centers are at: 5px, 37px, 69px, ... (5 + dotIndex * 32)
|
|
2381
|
+
// First dot center: 5px (half of 10px dot width)
|
|
2382
|
+
// Last dot center: 298px - 5px = 293px
|
|
2383
|
+
// Thumb is 18px wide, so thumb center offset from left edge is 9px
|
|
2384
|
+
// Position thumb so its center aligns with the dot center
|
|
2385
|
+
// left = dotCenter - thumbCenterOffset = dotCenter - 9px
|
|
2386
|
+
const firstDotCenter = 5; // First dot center position
|
|
2387
|
+
const lastDotCenter = 298 - 5; // Last dot center position
|
|
2388
|
+
const thumbCenterOffset = 9; // Half of thumb width (18px / 2)
|
|
2389
|
+
const dotCenterPosition = firstDotCenter + (percentage / 100) * (lastDotCenter - firstDotCenter);
|
|
2390
|
+
const thumbPosition = dotCenterPosition - thumbCenterOffset;
|
|
2391
|
+
// Create slider with dots: dot-segment-dot-segment-...-dot
|
|
2392
|
+
// With 8 segments, we have 9 dots total (start + 8 in between + end)
|
|
2393
|
+
// But user wants 8 dots in between, so total = 1 (start) + 8 (between) + 1 (end) = 10 dots
|
|
2394
|
+
// This means 9 segments between the 10 dots
|
|
2395
|
+
const dotsInBetween = segments; // 8 dots in between
|
|
2396
|
+
const totalDots = dotsInBetween + 2; // start + 8 in between + end = 10 dots
|
|
2397
|
+
return (jsxRuntime.jsxs(SliderContainer, Object.assign({ sx: {
|
|
2398
|
+
backgroundColor: sliderBgColor,
|
|
2399
|
+
} }, { children: [jsxRuntime.jsxs(InputSection, { children: [jsxRuntime.jsx(InputLabel, Object.assign({ sx: { color: textColor } }, { children: label })), jsxRuntime.jsxs(InputContainer, Object.assign({ sx: {
|
|
2400
|
+
backgroundColor: inputBgColor,
|
|
2401
|
+
border: `1px solid ${inputBorderColor}`,
|
|
2402
|
+
} }, { children: [jsxRuntime.jsx(material.IconButton, Object.assign({ onClick: handleDecrease, sx: {
|
|
2403
|
+
padding: 0,
|
|
2404
|
+
width: '24px',
|
|
2405
|
+
height: '24px',
|
|
2406
|
+
color: textColor,
|
|
2407
|
+
} }, { children: jsxRuntime.jsx(RemoveIcon, { sx: { fontSize: 24 } }) })), jsxRuntime.jsx(InputValue, Object.assign({ sx: { color: textColor } }, { children: formatCurrency(localValue) })), jsxRuntime.jsx(material.IconButton, Object.assign({ onClick: handleIncrease, sx: {
|
|
2408
|
+
padding: 0,
|
|
2409
|
+
width: '24px',
|
|
2410
|
+
height: '24px',
|
|
2411
|
+
color: textColor,
|
|
2412
|
+
} }, { children: jsxRuntime.jsx(AddIcon, { sx: { fontSize: 24 } }) }))] }))] }), jsxRuntime.jsxs(material.Box, Object.assign({ sx: { display: 'flex', flexDirection: 'column', gap: '10px' } }, { children: [jsxRuntime.jsxs(SliderTrack, { children: [Array.from({ length: totalDots }).map((_, index) => {
|
|
2413
|
+
const dotValue = min + (index * (max - min)) / (totalDots - 1);
|
|
2414
|
+
const isActive = localValue >= dotValue;
|
|
2415
|
+
const isLast = index === totalDots - 1;
|
|
2416
|
+
return (jsxRuntime.jsxs(material.Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' } }, { children: [jsxRuntime.jsx(SliderDot, { active: isActive, onClick: () => handleDotClick(index), sx: {
|
|
2417
|
+
backgroundColor: isActive
|
|
2418
|
+
? sliderActiveColor
|
|
2419
|
+
: sliderInactiveColor,
|
|
2420
|
+
} }), !isLast && (jsxRuntime.jsx(SliderSegment, { active: localValue > dotValue, sx: {
|
|
2421
|
+
backgroundColor: localValue > dotValue
|
|
2422
|
+
? sliderActiveColor
|
|
2423
|
+
: sliderInactiveColor,
|
|
2424
|
+
} }))] }), index));
|
|
2425
|
+
}), jsxRuntime.jsx(SliderThumb, Object.assign({ style: {
|
|
2426
|
+
left: `${thumbPosition}px`,
|
|
2427
|
+
} }, { children: jsxRuntime.jsx(ThumbIcon, Object.assign({ sx: { color: sliderActiveColor } }, { children: jsxRuntime.jsx(DragHandleIcon, { sx: { fontSize: 16 } }) })) }))] }), jsxRuntime.jsxs(RangeLabels, { children: [jsxRuntime.jsx(RangeLabel, Object.assign({ sx: { color: labelColor } }, { children: formatCurrency(min) })), jsxRuntime.jsx(RangeLabel, Object.assign({ sx: { textAlign: 'right', color: labelColor } }, { children: formatCurrency(max) }))] })] }))] })));
|
|
2428
|
+
}
|
|
2429
|
+
|
|
2430
|
+
/**
|
|
2431
|
+
* Asset Management Utilities
|
|
2432
|
+
* Helper functions for managing tenant-specific assets
|
|
2433
|
+
*/
|
|
2434
|
+
/**
|
|
2435
|
+
* Hook to get tenant-specific asset URL
|
|
2436
|
+
* @param assetPath - Relative path to asset within tenant folder
|
|
2437
|
+
* @returns Full path to tenant-specific asset
|
|
2438
|
+
*
|
|
2439
|
+
* @example
|
|
2440
|
+
* ```tsx
|
|
2441
|
+
* const bannerImage = useTenantAsset('promotional-banner.jpg')
|
|
2442
|
+
* <img src={bannerImage} alt="Promo" />
|
|
2443
|
+
* ```
|
|
2444
|
+
*/
|
|
2445
|
+
function useTenantAsset(assetPath) {
|
|
2446
|
+
const tenantId = useTenantId();
|
|
2447
|
+
// Return tenant-specific asset path that will be resolved at build time
|
|
2448
|
+
return `/assets/tenants/${tenantId}/${assetPath}`;
|
|
2449
|
+
}
|
|
2450
|
+
/**
|
|
2451
|
+
* Hook to get tenant logo URL
|
|
2452
|
+
* @param variant - Logo variant ('default' | 'dark' | 'alt' | 'white')
|
|
2453
|
+
* @returns Logo URL from theme configuration
|
|
2454
|
+
*
|
|
2455
|
+
* @example
|
|
2456
|
+
* ```tsx
|
|
2457
|
+
* const logo = useTenantLogo()
|
|
2458
|
+
* const darkLogo = useTenantLogo('dark')
|
|
2459
|
+
* <img src={logo} alt="Logo" />
|
|
2460
|
+
* ```
|
|
2461
|
+
*/
|
|
2462
|
+
function useTenantLogo(variant = 'default') {
|
|
2463
|
+
const tenantTheme = useTenantTheme();
|
|
2464
|
+
const theme = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
2465
|
+
// Guard against undefined theme (SSR or initialization issues)
|
|
2466
|
+
if (!theme || !theme.logo) {
|
|
2467
|
+
console.warn('useTenantLogo: Theme or logo is undefined, returning empty string');
|
|
2468
|
+
return '';
|
|
2469
|
+
}
|
|
2470
|
+
switch (variant) {
|
|
2471
|
+
case 'dark':
|
|
2472
|
+
return theme.logoDark || theme.logo;
|
|
2473
|
+
case 'alt':
|
|
2474
|
+
return theme.logoAlt || theme.logo;
|
|
2475
|
+
case 'white':
|
|
2476
|
+
return theme.logoWhite || theme.logo;
|
|
2477
|
+
default:
|
|
2478
|
+
return theme.logo;
|
|
2479
|
+
}
|
|
2480
|
+
}
|
|
2481
|
+
/**
|
|
2482
|
+
* Hook to get tenant favicon URL
|
|
2483
|
+
* @returns Favicon URL from theme configuration
|
|
2484
|
+
*
|
|
2485
|
+
* @example
|
|
2486
|
+
* ```tsx
|
|
2487
|
+
* const favicon = useTenantFavicon()
|
|
2488
|
+
* <link rel="icon" href={favicon} />
|
|
2489
|
+
* ```
|
|
2490
|
+
*/
|
|
2491
|
+
function useTenantFavicon() {
|
|
2492
|
+
const tenantTheme = useTenantTheme();
|
|
2493
|
+
const theme = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
2494
|
+
// Guard against undefined theme
|
|
2495
|
+
if (!theme || !theme.favicon) {
|
|
2496
|
+
console.warn('useTenantFavicon: Theme or favicon is undefined');
|
|
2497
|
+
return '';
|
|
2498
|
+
}
|
|
2499
|
+
return theme.favicon;
|
|
2500
|
+
}
|
|
2501
|
+
/**
|
|
2502
|
+
* Get tenant asset path (non-hook version for use outside components)
|
|
2503
|
+
* @param tenantId - Tenant identifier
|
|
2504
|
+
* @param assetPath - Relative path to asset
|
|
2505
|
+
* @returns Full asset path
|
|
2506
|
+
*/
|
|
2507
|
+
function getTenantAssetPath(tenantId, assetPath) {
|
|
2508
|
+
return `/assets/tenants/${tenantId}/${assetPath}`;
|
|
2509
|
+
}
|
|
2510
|
+
/**
|
|
2511
|
+
* Get tenant logo path (non-hook version)
|
|
2512
|
+
* @param tenantId - Tenant identifier
|
|
2513
|
+
* @param variant - Logo variant
|
|
2514
|
+
* @returns Logo path
|
|
2515
|
+
*/
|
|
2516
|
+
function getTenantLogoPath(tenantId, variant = 'default') {
|
|
2517
|
+
const variantSuffix = variant === 'default' ? '' : `-${variant}`;
|
|
2518
|
+
return `/assets/tenants/${tenantId}/logo${variantSuffix}.svg`;
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
/**
|
|
2522
|
+
* Common UI Icons
|
|
2523
|
+
* Path references to reusable icons
|
|
2524
|
+
* Assets are copied to dist/assets folder during build
|
|
2525
|
+
*/
|
|
2526
|
+
const ICON_PATHS = {
|
|
2527
|
+
close: '/assets/icons/close.svg',
|
|
2528
|
+
arrow: '/assets/icons/arrow.svg',
|
|
2529
|
+
arrowDown: '/assets/icons/arrow-down.svg',
|
|
2530
|
+
alert: '/assets/icons/alert.svg',
|
|
2531
|
+
facebook: '/assets/icons/facebook.svg',
|
|
2532
|
+
instagram: '/assets/icons/instagram.svg',
|
|
2533
|
+
youtube: '/assets/icons/youtube.svg',
|
|
2534
|
+
};
|
|
2535
|
+
/**
|
|
2536
|
+
* Get icon path by name
|
|
2537
|
+
* @param iconName - Name of the icon
|
|
2538
|
+
* @returns Path to icon asset
|
|
2539
|
+
*/
|
|
2540
|
+
function getIconPath(iconName) {
|
|
2541
|
+
return ICON_PATHS[iconName];
|
|
2542
|
+
}
|
|
2543
|
+
|
|
481
2544
|
exports.Banner = Banner;
|
|
2545
|
+
exports.BillingToggle = BillingToggle;
|
|
482
2546
|
exports.Button = Button;
|
|
483
2547
|
exports.Card = Card;
|
|
2548
|
+
exports.CoverageAmountSlider = CoverageAmountSlider;
|
|
2549
|
+
exports.Footer = Footer;
|
|
2550
|
+
exports.Header = Header$1;
|
|
2551
|
+
exports.ICON_PATHS = ICON_PATHS;
|
|
2552
|
+
exports.InfoCallout = InfoCallout;
|
|
2553
|
+
exports.NewHeader = NewHeader;
|
|
2554
|
+
exports.OptionButton = OptionButton;
|
|
2555
|
+
exports.ProductSelectionDrawer = ProductSelectionDrawer;
|
|
2556
|
+
exports.QuestionSection = QuestionSection;
|
|
2557
|
+
exports.RecommendationsDrawer = RecommendationsDrawer;
|
|
484
2558
|
exports.TenantThemeProvider = TenantThemeProvider;
|
|
2559
|
+
exports.ToggleGroup = ToggleGroup;
|
|
485
2560
|
exports.ammetlifeTheme = ammetlifeTheme;
|
|
2561
|
+
exports.ammetlifeTypography = ammetlifeTypography;
|
|
486
2562
|
exports.cimbTheme = cimbTheme;
|
|
2563
|
+
exports.cimbTypography = cimbTypography;
|
|
487
2564
|
exports.createThemeCSSVariables = createThemeCSSVariables;
|
|
488
2565
|
exports.getAvailableTenants = getAvailableTenants;
|
|
2566
|
+
exports.getIconPath = getIconPath;
|
|
2567
|
+
exports.getTenantAssetPath = getTenantAssetPath;
|
|
2568
|
+
exports.getTenantLogoPath = getTenantLogoPath;
|
|
489
2569
|
exports.getTenantTheme = getTenantTheme;
|
|
2570
|
+
exports.getTenantTypography = getTenantTypography;
|
|
490
2571
|
exports.getThemeColor = getThemeColor;
|
|
491
2572
|
exports.iglooTheme = iglooTheme;
|
|
2573
|
+
exports.iglooTypography = iglooTypography;
|
|
492
2574
|
exports.isValidTenantId = isValidTenantId;
|
|
493
2575
|
exports.mergeTenantTheme = mergeTenantTheme;
|
|
494
2576
|
exports.tenantThemes = tenantThemes;
|
|
2577
|
+
exports.tenantTypography = tenantTypography;
|
|
495
2578
|
exports.useIsTenant = useIsTenant;
|
|
2579
|
+
exports.useTenantAsset = useTenantAsset;
|
|
2580
|
+
exports.useTenantFavicon = useTenantFavicon;
|
|
496
2581
|
exports.useTenantId = useTenantId;
|
|
2582
|
+
exports.useTenantLogo = useTenantLogo;
|
|
497
2583
|
exports.useTenantTheme = useTenantTheme;
|
|
498
2584
|
//# sourceMappingURL=index.js.map
|