igloo-d2c-components 1.0.13 → 1.0.14
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 +1151 -321
- 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 +2804 -41
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +2752 -41
- 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/BenefitsSummary/BenefitsSummary.d.ts +22 -0
- package/dist/types/components/BenefitsSummary/index.d.ts +2 -0
- package/dist/types/components/BenefitsSummary/styled.d.ts +29 -0
- package/dist/types/components/BenefitsSummary/types.d.ts +58 -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/CheckoutFormButton/CheckoutFormButton.d.ts +39 -0
- package/dist/types/components/CheckoutFormButton/index.d.ts +2 -0
- package/dist/types/components/CheckoutFormButton/styled.d.ts +9 -0
- package/dist/types/components/CheckoutHeader/CheckoutHeader.d.ts +41 -0
- package/dist/types/components/CheckoutHeader/index.d.ts +2 -0
- package/dist/types/components/CheckoutHeader/styled.d.ts +15 -0
- package/dist/types/components/CheckoutProgress/CheckoutProgress.d.ts +35 -0
- package/dist/types/components/CheckoutProgress/index.d.ts +2 -0
- package/dist/types/components/CheckoutProgress/styled.d.ts +16 -0
- package/dist/types/components/ChildInformationForm/ChildInformationForm.d.ts +52 -0
- package/dist/types/components/ChildInformationForm/index.d.ts +2 -0
- package/dist/types/components/ChildInformationForm/styled.d.ts +4 -0
- package/dist/types/components/ContactDetailsForm/ContactDetailsForm.d.ts +63 -0
- package/dist/types/components/ContactDetailsForm/index.d.ts +2 -0
- package/dist/types/components/ContactDetailsForm/styled.d.ts +10 -0
- package/dist/types/components/CoverageAmountSlider/CoverageAmountSlider.d.ts +57 -0
- package/dist/types/components/CoverageAmountSlider/index.d.ts +3 -0
- package/dist/types/components/CoverageAmountSlider/styled.d.ts +50 -0
- package/dist/types/components/FAQAccordion/FAQAccordion.d.ts +22 -0
- package/dist/types/components/FAQAccordion/index.d.ts +2 -0
- package/dist/types/components/FAQAccordion/styled.d.ts +37 -0
- package/dist/types/components/FAQAccordion/types.d.ts +57 -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/HealthInformationForm/HealthInformationForm.d.ts +81 -0
- package/dist/types/components/HealthInformationForm/index.d.ts +2 -0
- package/dist/types/components/HealthInformationForm/styled.d.ts +4 -0
- package/dist/types/components/HealthQuestionGroup/HealthQuestionGroup.d.ts +40 -0
- package/dist/types/components/HealthQuestionGroup/index.d.ts +2 -0
- package/dist/types/components/HealthQuestionGroup/styled.d.ts +20 -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/PersonalInformationForm/PersonalInformationForm.d.ts +75 -0
- package/dist/types/components/PersonalInformationForm/index.d.ts +2 -0
- package/dist/types/components/PersonalInformationForm/styled.d.ts +10 -0
- package/dist/types/components/ProductCard/ProductCard.d.ts +43 -0
- package/dist/types/components/ProductCard/index.d.ts +2 -0
- package/dist/types/components/ProductCard/styled.d.ts +27 -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 +52 -4
- package/dist/types/{components/Banner → storybook-components}/Banner.stories.d.ts +1 -1
- package/dist/types/storybook-components/BenefitsSummary.stories.d.ts +37 -0
- 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/CheckoutProgress.stories.d.ts +9 -0
- package/dist/types/storybook-components/CoverageAmountSlider.stories.d.ts +14 -0
- package/dist/types/storybook-components/FAQAccordion.stories.d.ts +37 -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/HealthQuestionGroup.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/ProductCard.stories.d.ts +9 -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/esm/index.js
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { createContext, useMemo, useContext, useState, useEffect } from 'react';
|
|
5
|
+
import { Button as Button$1, Card as Card$1, CardHeader, CardContent, CardActions, Box, Typography, Avatar, Menu, MenuItem, Drawer, IconButton, FormControlLabel, useTheme, useMediaQuery, Toolbar, Icon, RadioGroup, Radio, AppBar as AppBar$1, Divider, List, ListItem, ListItemButton, ListItemText, styled as styled$1, ButtonBase, Slider, Checkbox, Accordion, AccordionSummary, AccordionDetails } from '@mui/material';
|
|
6
|
+
import CloseIcon from '@mui/icons-material/Close';
|
|
7
|
+
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
|
|
8
|
+
import MenuIcon from '@mui/icons-material/Menu';
|
|
9
|
+
import AppBar from '@mui/material/AppBar';
|
|
10
|
+
import Container from '@mui/material/Container';
|
|
11
|
+
import { styled } from '@mui/material/styles';
|
|
12
|
+
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
|
|
13
|
+
import InfoIcon from '@mui/icons-material/Info';
|
|
14
|
+
import AddIcon from '@mui/icons-material/Add';
|
|
15
|
+
import RemoveIcon from '@mui/icons-material/Remove';
|
|
16
|
+
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
5
17
|
|
|
6
18
|
const TenantThemeContext = createContext(undefined);
|
|
7
19
|
/**
|
|
@@ -27,11 +39,20 @@ function TenantThemeProvider({ children, tenantId, theme, }) {
|
|
|
27
39
|
}
|
|
28
40
|
/**
|
|
29
41
|
* Hook to access tenant theme configuration
|
|
30
|
-
*
|
|
42
|
+
* Returns undefined during SSR if context is not available
|
|
43
|
+
* @returns TenantContextValue or undefined during SSR
|
|
31
44
|
*/
|
|
32
45
|
function useTenantTheme() {
|
|
33
46
|
const context = useContext(TenantThemeContext);
|
|
47
|
+
// During SSR, context might be undefined - return undefined instead of throwing
|
|
48
|
+
// This allows components to handle SSR gracefully with fallback values
|
|
34
49
|
if (context === undefined) {
|
|
50
|
+
// Check if we're in a browser environment
|
|
51
|
+
if (typeof window === 'undefined') {
|
|
52
|
+
// SSR - return undefined to allow fallback handling
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
// Client-side but no provider - throw error for development
|
|
35
56
|
throw new Error('useTenantTheme must be used within a TenantThemeProvider');
|
|
36
57
|
}
|
|
37
58
|
return context;
|
|
@@ -40,15 +61,160 @@ function useTenantTheme() {
|
|
|
40
61
|
* Hook to get tenant ID
|
|
41
62
|
*/
|
|
42
63
|
function useTenantId() {
|
|
43
|
-
const
|
|
44
|
-
return tenantId;
|
|
64
|
+
const tenantTheme = useTenantTheme();
|
|
65
|
+
return (tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.tenantId) || '';
|
|
45
66
|
}
|
|
46
67
|
/**
|
|
47
68
|
* Hook to check if current tenant matches given tenant ID
|
|
48
69
|
*/
|
|
49
70
|
function useIsTenant(checkTenantId) {
|
|
50
|
-
const
|
|
51
|
-
return tenantId === checkTenantId;
|
|
71
|
+
const tenantTheme = useTenantTheme();
|
|
72
|
+
return (tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.tenantId) === checkTenantId;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Tenant Typography Configurations
|
|
77
|
+
* Centralized typography definitions for all tenants
|
|
78
|
+
* Based on b2c-web-demo typography structure
|
|
79
|
+
*/
|
|
80
|
+
/**
|
|
81
|
+
* Igloo Typography Configuration
|
|
82
|
+
*/
|
|
83
|
+
const iglooTypography = {
|
|
84
|
+
fontFamily: 'Montserrat',
|
|
85
|
+
fontWeightRegular: 400,
|
|
86
|
+
fontWeightMedium: 500,
|
|
87
|
+
fontWeightSemiBold: 600,
|
|
88
|
+
fontWeightBold: 700,
|
|
89
|
+
fontWeightExtraBold: 800,
|
|
90
|
+
fontWeightExtraBlack: 900,
|
|
91
|
+
h1: {
|
|
92
|
+
fontSize: '42px',
|
|
93
|
+
fontStyle: 'normal',
|
|
94
|
+
fontWeight: 700,
|
|
95
|
+
lineHeight: '48px',
|
|
96
|
+
'@media (max-width:600px)': {
|
|
97
|
+
fontSize: '24px',
|
|
98
|
+
fontStyle: 'normal',
|
|
99
|
+
fontWeight: 700,
|
|
100
|
+
lineHeight: '30px',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
h2: {
|
|
104
|
+
fontSize: '22px',
|
|
105
|
+
fontStyle: 'normal',
|
|
106
|
+
fontWeight: 700,
|
|
107
|
+
lineHeight: '26px',
|
|
108
|
+
'@media (max-width:600px)': {
|
|
109
|
+
fontSize: '14px',
|
|
110
|
+
fontStyle: 'normal',
|
|
111
|
+
fontWeight: 700,
|
|
112
|
+
lineHeight: '22px',
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
h3: {
|
|
116
|
+
fontSize: '18px',
|
|
117
|
+
fontStyle: 'normal',
|
|
118
|
+
fontWeight: 600,
|
|
119
|
+
lineHeight: '24px',
|
|
120
|
+
'@media (max-width:600px)': {
|
|
121
|
+
fontSize: '14px',
|
|
122
|
+
fontStyle: 'normal',
|
|
123
|
+
fontWeight: 600,
|
|
124
|
+
lineHeight: '20px',
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
h4: {
|
|
128
|
+
fontSize: '18px',
|
|
129
|
+
fontStyle: 'normal',
|
|
130
|
+
fontWeight: 600,
|
|
131
|
+
lineHeight: '24px',
|
|
132
|
+
'@media (max-width:600px)': {
|
|
133
|
+
fontSize: '14px',
|
|
134
|
+
fontStyle: 'normal',
|
|
135
|
+
fontWeight: 500,
|
|
136
|
+
lineHeight: '18px',
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
bodyStrongLarge: {
|
|
140
|
+
fontSize: '16px',
|
|
141
|
+
fontStyle: 'normal',
|
|
142
|
+
fontWeight: 500,
|
|
143
|
+
lineHeight: '20px',
|
|
144
|
+
'@media (max-width:600px)': {
|
|
145
|
+
fontSize: '14px',
|
|
146
|
+
fontStyle: 'normal',
|
|
147
|
+
fontWeight: 400,
|
|
148
|
+
lineHeight: '18px',
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
bodyStrongMedium: {
|
|
152
|
+
fontSize: '14px',
|
|
153
|
+
fontStyle: 'normal',
|
|
154
|
+
fontWeight: 500,
|
|
155
|
+
lineHeight: '18px',
|
|
156
|
+
},
|
|
157
|
+
bodyStrongSmall: {
|
|
158
|
+
fontSize: '12px',
|
|
159
|
+
fontStyle: 'normal',
|
|
160
|
+
fontWeight: 500,
|
|
161
|
+
lineHeight: '16px',
|
|
162
|
+
},
|
|
163
|
+
bodyLarge: {
|
|
164
|
+
fontSize: '16px',
|
|
165
|
+
fontStyle: 'normal',
|
|
166
|
+
fontWeight: 400,
|
|
167
|
+
lineHeight: '20px',
|
|
168
|
+
'@media (max-width:600px)': {
|
|
169
|
+
fontSize: '14px',
|
|
170
|
+
fontStyle: 'normal',
|
|
171
|
+
fontWeight: 400,
|
|
172
|
+
lineHeight: '18px',
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
bodyMedium: {
|
|
176
|
+
fontSize: '14px',
|
|
177
|
+
fontStyle: 'normal',
|
|
178
|
+
fontWeight: 400,
|
|
179
|
+
lineHeight: '20px',
|
|
180
|
+
},
|
|
181
|
+
bodySmall: {
|
|
182
|
+
fontSize: '12px',
|
|
183
|
+
fontStyle: 'normal',
|
|
184
|
+
fontWeight: 400,
|
|
185
|
+
lineHeight: '16px',
|
|
186
|
+
},
|
|
187
|
+
smallText: {
|
|
188
|
+
fontSize: '8px',
|
|
189
|
+
fontStyle: 'normal',
|
|
190
|
+
fontWeight: 500,
|
|
191
|
+
lineHeight: '16px',
|
|
192
|
+
},
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* CIMB Typography Configuration
|
|
196
|
+
*/
|
|
197
|
+
const cimbTypography = Object.assign(Object.assign({}, iglooTypography), { fontFamily: 'CIMB Sans' });
|
|
198
|
+
/**
|
|
199
|
+
* AmmetLife Typography Configuration
|
|
200
|
+
*/
|
|
201
|
+
const ammetlifeTypography = Object.assign(Object.assign({}, iglooTypography), { fontFamily: 'Montserrat' });
|
|
202
|
+
/**
|
|
203
|
+
* Typography Registry
|
|
204
|
+
* Map of tenant IDs to their typography configurations
|
|
205
|
+
*/
|
|
206
|
+
const tenantTypography = {
|
|
207
|
+
igloo: iglooTypography,
|
|
208
|
+
cimb: cimbTypography,
|
|
209
|
+
ammetlife: ammetlifeTypography,
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* Get typography configuration by tenant ID
|
|
213
|
+
* @param tenantId - The tenant identifier
|
|
214
|
+
* @returns Typography configuration for the specified tenant
|
|
215
|
+
*/
|
|
216
|
+
function getTenantTypography(tenantId) {
|
|
217
|
+
return tenantTypography[tenantId] || iglooTypography;
|
|
52
218
|
}
|
|
53
219
|
|
|
54
220
|
/**
|
|
@@ -92,6 +258,19 @@ const iglooTheme = {
|
|
|
92
258
|
bright: '#fff',
|
|
93
259
|
granite: '#666',
|
|
94
260
|
},
|
|
261
|
+
// UI Component Colors
|
|
262
|
+
ui: {
|
|
263
|
+
sliderActive: '#5656F6',
|
|
264
|
+
sliderInactive: '#c8c5ca',
|
|
265
|
+
sliderBackground: '#f9f9f9',
|
|
266
|
+
toggleActive: '#5656F6',
|
|
267
|
+
toggleActiveText: '#ffffff',
|
|
268
|
+
toggleInactiveText: '#5f5e62',
|
|
269
|
+
calloutBackground: '#f9f9f9',
|
|
270
|
+
calloutBorder: '#ffffff',
|
|
271
|
+
inputBackground: '#ffffff',
|
|
272
|
+
inputBorder: '#eeeeee',
|
|
273
|
+
},
|
|
95
274
|
motor: {
|
|
96
275
|
main: '#00CCFF',
|
|
97
276
|
light: 'rgba(0, 208, 255, 0.10)',
|
|
@@ -117,11 +296,10 @@ const iglooTheme = {
|
|
|
117
296
|
main: '#F3A100',
|
|
118
297
|
},
|
|
119
298
|
},
|
|
120
|
-
typography: {
|
|
121
|
-
|
|
122
|
-
},
|
|
123
|
-
logo: '/assets/igloo_nobeta.svg',
|
|
299
|
+
typography: Object.assign(Object.assign({}, iglooTypography), { fontFamily: '"Manrope", "Roboto", "Helvetica", "Arial", sans-serif' }),
|
|
300
|
+
logo: '/assets/tenants/igloo/logo.svg',
|
|
124
301
|
favicon: 'https://static.iglooinsure.com/icons/favicon.ico',
|
|
302
|
+
assetBaseUrl: '/assets/tenants/igloo',
|
|
125
303
|
};
|
|
126
304
|
/**
|
|
127
305
|
* CIMB Theme Configuration
|
|
@@ -166,6 +344,19 @@ const cimbTheme = {
|
|
|
166
344
|
bright: '#fff',
|
|
167
345
|
granite: '#666',
|
|
168
346
|
},
|
|
347
|
+
// UI Component Colors
|
|
348
|
+
ui: {
|
|
349
|
+
sliderActive: '#C3214B',
|
|
350
|
+
sliderInactive: '#c8c5ca',
|
|
351
|
+
sliderBackground: '#f9f9f9',
|
|
352
|
+
toggleActive: '#EE0500',
|
|
353
|
+
toggleActiveText: '#fefbff',
|
|
354
|
+
toggleInactiveText: '#5f5e62',
|
|
355
|
+
calloutBackground: '#f9f9f9',
|
|
356
|
+
calloutBorder: '#ffffff',
|
|
357
|
+
inputBackground: '#ffffff',
|
|
358
|
+
inputBorder: '#eeeeee',
|
|
359
|
+
},
|
|
169
360
|
motor: {
|
|
170
361
|
main: '#C3214B',
|
|
171
362
|
light: 'rgba(195, 33, 75, 0.10)',
|
|
@@ -192,11 +383,11 @@ const cimbTheme = {
|
|
|
192
383
|
main: '#F3A100',
|
|
193
384
|
},
|
|
194
385
|
},
|
|
195
|
-
typography: {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
logo: '/assets/cimb/cimb-logo.svg',
|
|
386
|
+
typography: Object.assign(Object.assign({}, cimbTypography), { fontFamily: '"CIMB Sans", "Roboto", "Helvetica", "Arial", sans-serif' }),
|
|
387
|
+
logo: '/assets/tenants/cimb/logo.svg',
|
|
388
|
+
logoWhite: '/assets/tenants/cimb/logo-white.png',
|
|
199
389
|
favicon: 'https://static.iglooinsure.com/icons/favicon.ico',
|
|
390
|
+
assetBaseUrl: '/assets/tenants/cimb',
|
|
200
391
|
};
|
|
201
392
|
/**
|
|
202
393
|
* Ammetlife Theme Configuration
|
|
@@ -204,12 +395,12 @@ const cimbTheme = {
|
|
|
204
395
|
const ammetlifeTheme = {
|
|
205
396
|
palette: {
|
|
206
397
|
primary: {
|
|
207
|
-
dark: '#
|
|
208
|
-
main: '#
|
|
398
|
+
dark: '#2869a8',
|
|
399
|
+
main: '#317abc',
|
|
209
400
|
light: '#42A5F5',
|
|
210
401
|
bright: '#90CAF9',
|
|
211
402
|
plain: '#E3F2FD',
|
|
212
|
-
border: '#
|
|
403
|
+
border: '#317abc',
|
|
213
404
|
},
|
|
214
405
|
secondary: {
|
|
215
406
|
dim: '#E65100',
|
|
@@ -235,6 +426,19 @@ const ammetlifeTheme = {
|
|
|
235
426
|
bright: '#fff',
|
|
236
427
|
granite: '#666',
|
|
237
428
|
},
|
|
429
|
+
// UI Component Colors
|
|
430
|
+
ui: {
|
|
431
|
+
sliderActive: '#317abc',
|
|
432
|
+
sliderInactive: '#c8c5ca',
|
|
433
|
+
sliderBackground: '#f9f9f9',
|
|
434
|
+
toggleActive: '#a4ce4e',
|
|
435
|
+
toggleActiveText: '#fefbff',
|
|
436
|
+
toggleInactiveText: '#5f5e62',
|
|
437
|
+
calloutBackground: '#f9f9f9',
|
|
438
|
+
calloutBorder: '#ffffff',
|
|
439
|
+
inputBackground: '#ffffff',
|
|
440
|
+
inputBorder: '#eeeeee',
|
|
441
|
+
},
|
|
238
442
|
motor: {
|
|
239
443
|
main: '#1976D2',
|
|
240
444
|
light: 'rgba(25, 118, 210, 0.10)',
|
|
@@ -261,11 +465,10 @@ const ammetlifeTheme = {
|
|
|
261
465
|
main: '#FF9800',
|
|
262
466
|
},
|
|
263
467
|
},
|
|
264
|
-
typography: {
|
|
265
|
-
|
|
266
|
-
},
|
|
267
|
-
logo: '/assets/ammetlife/logo-AmMetLife.svg',
|
|
468
|
+
typography: Object.assign(Object.assign({}, ammetlifeTypography), { fontFamily: '"Montserrat", "Roboto", "Helvetica", "Arial", sans-serif' }),
|
|
469
|
+
logo: '/assets/tenants/ammetlife/logo.svg',
|
|
268
470
|
favicon: 'https://static.iglooinsure.com/icons/favicon.ico',
|
|
471
|
+
assetBaseUrl: '/assets/tenants/ammetlife',
|
|
269
472
|
};
|
|
270
473
|
/**
|
|
271
474
|
* Theme Registry
|
|
@@ -352,12 +555,13 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
352
555
|
* ```
|
|
353
556
|
*/
|
|
354
557
|
function Button(_a) {
|
|
355
|
-
var _b, _c, _d;
|
|
558
|
+
var _b, _c, _d, _e, _f, _g;
|
|
356
559
|
var { tenantColored = false, variant = 'contained', sx, color } = _a, props = __rest(_a, ["tenantColored", "variant", "sx", "color"]);
|
|
357
|
-
const
|
|
358
|
-
const
|
|
359
|
-
|
|
360
|
-
|
|
560
|
+
const tenantTheme = useTenantTheme();
|
|
561
|
+
const theme = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
562
|
+
const buttonSx = tenantColored && theme
|
|
563
|
+
? 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': {
|
|
564
|
+
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),
|
|
361
565
|
} }, sx) : sx;
|
|
362
566
|
return (jsx(Button$1, Object.assign({ variant: variant, color: tenantColored ? undefined : color, sx: buttonSx }, props)));
|
|
363
567
|
}
|
|
@@ -376,11 +580,12 @@ function Button(_a) {
|
|
|
376
580
|
* ```
|
|
377
581
|
*/
|
|
378
582
|
function Card(_a) {
|
|
379
|
-
var _b;
|
|
583
|
+
var _b, _c;
|
|
380
584
|
var { title, headerAction, content, actions, tenantAccent = false, sx, children } = _a, props = __rest(_a, ["title", "headerAction", "content", "actions", "tenantAccent", "sx", "children"]);
|
|
381
|
-
const
|
|
382
|
-
const
|
|
383
|
-
|
|
585
|
+
const tenantTheme = useTenantTheme();
|
|
586
|
+
const theme = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
587
|
+
const cardSx = tenantAccent && theme
|
|
588
|
+
? 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;
|
|
384
589
|
return (jsxs(Card$1, Object.assign({ sx: cardSx }, props, { children: [title && jsx(CardHeader, { title: title, action: headerAction }), (content || children) && (jsx(CardContent, { children: content || children })), actions && jsx(CardActions, { children: actions })] })));
|
|
385
590
|
}
|
|
386
591
|
|
|
@@ -400,25 +605,1348 @@ function Card(_a) {
|
|
|
400
605
|
function Banner(_a) {
|
|
401
606
|
var _b, _c, _d, _e;
|
|
402
607
|
var { title, description, action, gradient = true, sx } = _a, props = __rest(_a, ["title", "description", "action", "gradient", "sx"]);
|
|
403
|
-
const
|
|
608
|
+
const tenantTheme = useTenantTheme();
|
|
609
|
+
const theme = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
610
|
+
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';
|
|
611
|
+
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;
|
|
404
612
|
const background = gradient
|
|
405
|
-
? `linear-gradient(135deg, ${
|
|
406
|
-
:
|
|
613
|
+
? `linear-gradient(135deg, ${primaryColor} 0%, ${lightColor} 100%)`
|
|
614
|
+
: primaryColor;
|
|
407
615
|
return (jsxs(Box, Object.assign({ sx: Object.assign({ background, color: 'white', padding: '32px', borderRadius: '12px', textAlign: 'center' }, sx) }, props, { children: [jsx(Typography, Object.assign({ variant: "h4", component: "h2", gutterBottom: true, fontWeight: "bold" }, { children: title })), description && (jsx(Typography, Object.assign({ variant: "body1", sx: { opacity: 0.95, mb: action ? 2 : 0 } }, { children: description }))), action && jsx(Box, Object.assign({ sx: { mt: 2 } }, { children: action }))] })));
|
|
408
616
|
}
|
|
409
617
|
|
|
618
|
+
const StyledAppBar$1 = styled(AppBar)(({ theme, ispartnershippagemobileview, scrolled }) => {
|
|
619
|
+
var _a, _b;
|
|
620
|
+
return ({
|
|
621
|
+
zIndex: '1000 !important',
|
|
622
|
+
backgroundColor: ispartnershippagemobileview && !scrolled
|
|
623
|
+
? 'transparent !important'
|
|
624
|
+
: `${((_a = theme.palette.background) === null || _a === void 0 ? void 0 : _a.paper) || '#fff'} !important`,
|
|
625
|
+
boxShadow: 'none !important',
|
|
626
|
+
'& .MuiToolbar-root': {
|
|
627
|
+
minHeight: '80px',
|
|
628
|
+
[(_b = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _b === void 0 ? void 0 : _b.down('md')]: {
|
|
629
|
+
minHeight: '64px',
|
|
630
|
+
},
|
|
631
|
+
},
|
|
632
|
+
[theme.breakpoints.up(1025)]: {
|
|
633
|
+
boxShadow: scrolled && '0px 2px 20px 4px rgba(0, 0, 0, 0.14) !important',
|
|
634
|
+
},
|
|
635
|
+
});
|
|
636
|
+
});
|
|
637
|
+
const ResponsiveB2CLayout = styled('div')(({ theme }) => ({
|
|
638
|
+
[theme.breakpoints.up(1025)]: {
|
|
639
|
+
minWidth: '1128px',
|
|
640
|
+
maxWidth: '1128px',
|
|
641
|
+
margin: '0 auto',
|
|
642
|
+
},
|
|
643
|
+
}));
|
|
644
|
+
const StyledContainer = styled(Container)(({ theme, ispartnershippagemobileview, scrolled }) => {
|
|
645
|
+
var _a;
|
|
646
|
+
return ({
|
|
647
|
+
boxShadow: 'none',
|
|
648
|
+
[(_a = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _a === void 0 ? void 0 : _a.down('md')]: {
|
|
649
|
+
boxShadow: !scrolled ? 'none' : '0px 2px 20px 4px rgba(0, 0, 0, 0.14)',
|
|
650
|
+
},
|
|
651
|
+
});
|
|
652
|
+
});
|
|
653
|
+
const TypographyLogo = styled(Typography)(({ theme }) => {
|
|
654
|
+
var _a, _b;
|
|
655
|
+
return ({
|
|
656
|
+
margin: 'auto 40 auto 0',
|
|
657
|
+
display: '-webkit-box',
|
|
658
|
+
alignItems: 'anchor-center',
|
|
659
|
+
[(_a = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _a === void 0 ? void 0 : _a.up('md')]: {
|
|
660
|
+
width: 95,
|
|
661
|
+
height: 57,
|
|
662
|
+
},
|
|
663
|
+
[(_b = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _b === void 0 ? void 0 : _b.down('md')]: {
|
|
664
|
+
width: 73.3,
|
|
665
|
+
display: 'flex',
|
|
666
|
+
},
|
|
667
|
+
});
|
|
668
|
+
});
|
|
669
|
+
const ButtonDesktopMenu = styled(Button$1)(({ theme }) => {
|
|
670
|
+
var _a;
|
|
671
|
+
return ({
|
|
672
|
+
color: ((_a = theme.palette.text) === null || _a === void 0 ? void 0 : _a.primary) || '#000',
|
|
673
|
+
display: 'flex',
|
|
674
|
+
padding: '0px 10px',
|
|
675
|
+
alignItems: 'center',
|
|
676
|
+
gap: 8,
|
|
677
|
+
alignSelf: 'stretch',
|
|
678
|
+
});
|
|
679
|
+
});
|
|
680
|
+
const AnchorLinks = styled('a')(({ theme }) => ({
|
|
681
|
+
color: 'inherit',
|
|
682
|
+
'&:hover': {
|
|
683
|
+
color: 'inherit',
|
|
684
|
+
},
|
|
685
|
+
}));
|
|
686
|
+
const StyledAvatar = styled(Avatar)(({ theme }) => {
|
|
687
|
+
var _a;
|
|
688
|
+
return ({
|
|
689
|
+
margin: '15px 0',
|
|
690
|
+
cursor: 'pointer',
|
|
691
|
+
backgroundColor: `${theme.palette.primary.main} !important`,
|
|
692
|
+
[(_a = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _a === void 0 ? void 0 : _a.down('md')]: {
|
|
693
|
+
margin: '0',
|
|
694
|
+
},
|
|
695
|
+
});
|
|
696
|
+
});
|
|
697
|
+
const DivButtonWrapper = styled('div')(({ theme }) => {
|
|
698
|
+
var _a;
|
|
699
|
+
return ({
|
|
700
|
+
justifyContent: 'end',
|
|
701
|
+
display: 'flex',
|
|
702
|
+
marginTop: 0,
|
|
703
|
+
padding: `16px 0`,
|
|
704
|
+
gap: 12,
|
|
705
|
+
[(_a = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _a === void 0 ? void 0 : _a.down('md')]: {
|
|
706
|
+
marginTop: 24,
|
|
707
|
+
padding: 0,
|
|
708
|
+
},
|
|
709
|
+
});
|
|
710
|
+
});
|
|
711
|
+
const ButtonAuth = styled(Button$1)(({ theme }) => ({
|
|
712
|
+
justifyContent: 'center',
|
|
713
|
+
alignItems: 'center',
|
|
714
|
+
borderRadius: '100px !important',
|
|
715
|
+
borderColor: theme.palette.primary.main,
|
|
716
|
+
borderStyle: 'solid',
|
|
717
|
+
borderWidth: 1,
|
|
718
|
+
flex: 1,
|
|
719
|
+
height: 40,
|
|
720
|
+
minWidth: 'max-content !important',
|
|
721
|
+
}));
|
|
722
|
+
const TypographyAuth = styled(Typography)(({ theme }) => ({
|
|
723
|
+
textTransform: 'none',
|
|
724
|
+
}));
|
|
725
|
+
const StyledMenu = styled(Menu)(({ theme }) => {
|
|
726
|
+
var _a;
|
|
727
|
+
return ({
|
|
728
|
+
'& .MuiMenu-paper': {
|
|
729
|
+
left: 'auto',
|
|
730
|
+
width: 'fit-content',
|
|
731
|
+
maxWidth: 'unset',
|
|
732
|
+
boxShadow: 'inset',
|
|
733
|
+
borderRadius: 16,
|
|
734
|
+
[(_a = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _a === void 0 ? void 0 : _a.down('md')]: {
|
|
735
|
+
left: `0 !important`,
|
|
736
|
+
width: '100%',
|
|
737
|
+
boxShadow: 'none !important',
|
|
738
|
+
borderRadius: 'none',
|
|
739
|
+
},
|
|
740
|
+
},
|
|
741
|
+
});
|
|
742
|
+
});
|
|
743
|
+
const DivProductListing = styled('div')(({ theme }) => {
|
|
744
|
+
var _a;
|
|
745
|
+
return ({
|
|
746
|
+
padding: '0 16px',
|
|
747
|
+
display: 'flex',
|
|
748
|
+
flexDirection: 'column',
|
|
749
|
+
alignSelf: 'stretch',
|
|
750
|
+
[(_a = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _a === void 0 ? void 0 : _a.down('md')]: {
|
|
751
|
+
padding: 16,
|
|
752
|
+
},
|
|
753
|
+
});
|
|
754
|
+
});
|
|
755
|
+
const StyledMenuItem = styled(MenuItem)(({ theme }) => {
|
|
756
|
+
var _a;
|
|
757
|
+
return ({
|
|
758
|
+
display: 'flex',
|
|
759
|
+
borderBottom: 'none',
|
|
760
|
+
alignItems: 'flex-start',
|
|
761
|
+
gap: 6,
|
|
762
|
+
padding: '16px 0 !important',
|
|
763
|
+
'&:last-child': {
|
|
764
|
+
borderBottom: 'none !important',
|
|
765
|
+
},
|
|
766
|
+
width: '100%',
|
|
767
|
+
[(_a = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _a === void 0 ? void 0 : _a.down('md')]: {
|
|
768
|
+
borderBottom: `1px solid ${theme.palette.divider} !important`,
|
|
769
|
+
},
|
|
770
|
+
});
|
|
771
|
+
});
|
|
772
|
+
const SpanImageWrapper = styled('span')(({ theme }) => ({
|
|
773
|
+
alignItems: 'center',
|
|
774
|
+
display: 'flex',
|
|
775
|
+
justifyContent: 'center',
|
|
776
|
+
margin: 'auto 0',
|
|
777
|
+
}));
|
|
778
|
+
const ImageProductIcon = styled('img')(({ theme }) => ({
|
|
779
|
+
aspectRatio: 1,
|
|
780
|
+
objectPosition: 'center',
|
|
781
|
+
width: 18,
|
|
782
|
+
height: 18,
|
|
783
|
+
}));
|
|
784
|
+
const StyledMenuItemDesktop = styled(MenuItem)(({ theme }) => {
|
|
785
|
+
var _a, _b;
|
|
786
|
+
return ({
|
|
787
|
+
color: `${((_a = theme.palette.secondary) === null || _a === void 0 ? void 0 : _a.main) || '#f00'} !important`,
|
|
788
|
+
display: 'flex',
|
|
789
|
+
borderBottom: 'none',
|
|
790
|
+
alignItems: 'flex-start',
|
|
791
|
+
gap: 6,
|
|
792
|
+
padding: '16px 0 !important',
|
|
793
|
+
'&:last-child': {
|
|
794
|
+
borderBottom: 'none !important',
|
|
795
|
+
},
|
|
796
|
+
width: '100%',
|
|
797
|
+
[(_b = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _b === void 0 ? void 0 : _b.down('md')]: {
|
|
798
|
+
borderBottom: `1px solid ${theme.palette.divider} !important`,
|
|
799
|
+
},
|
|
800
|
+
});
|
|
801
|
+
});
|
|
802
|
+
const StyledCloseIcon = styled(CloseIcon)(({ theme }) => {
|
|
803
|
+
var _a;
|
|
804
|
+
return ({
|
|
805
|
+
color: `${((_a = theme.palette.text) === null || _a === void 0 ? void 0 : _a.primary) || '#000'}`,
|
|
806
|
+
});
|
|
807
|
+
});
|
|
808
|
+
const StyledAvatarUserIcon = styled(Avatar)(({ theme }) => {
|
|
809
|
+
var _a, _b;
|
|
810
|
+
return ({
|
|
811
|
+
margin: '15px 0',
|
|
812
|
+
cursor: 'pointer',
|
|
813
|
+
backgroundColor: `${((_a = theme.palette.text) === null || _a === void 0 ? void 0 : _a.primary) || '#000'} !important`,
|
|
814
|
+
[(_b = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _b === void 0 ? void 0 : _b.down('md')]: {
|
|
815
|
+
margin: '0',
|
|
816
|
+
},
|
|
817
|
+
});
|
|
818
|
+
});
|
|
819
|
+
const StyledMenuIcon = styled(MenuIcon)(({ theme, ispartnershippagemobileview, scrolled }) => {
|
|
820
|
+
var _a, _b;
|
|
821
|
+
return ({
|
|
822
|
+
color: ispartnershippagemobileview && !scrolled
|
|
823
|
+
? ((_a = theme.palette.common) === null || _a === void 0 ? void 0 : _a.white) || '#fff'
|
|
824
|
+
: `${((_b = theme.palette.text) === null || _b === void 0 ? void 0 : _b.primary) || '#000'}`,
|
|
825
|
+
});
|
|
826
|
+
});
|
|
827
|
+
const StyledDrawer$3 = styled(Drawer)(({ theme }) => {
|
|
828
|
+
var _a;
|
|
829
|
+
return ({
|
|
830
|
+
'& .MuiMenu-paper': {
|
|
831
|
+
left: 'auto',
|
|
832
|
+
width: 'fit-content',
|
|
833
|
+
maxWidth: 'unset',
|
|
834
|
+
boxShadow: 'inset',
|
|
835
|
+
borderRadius: 16,
|
|
836
|
+
[(_a = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _a === void 0 ? void 0 : _a.down('md')]: {
|
|
837
|
+
left: `0 !important`,
|
|
838
|
+
width: '100%',
|
|
839
|
+
boxShadow: 'none !important',
|
|
840
|
+
borderRadius: 'none',
|
|
841
|
+
},
|
|
842
|
+
},
|
|
843
|
+
});
|
|
844
|
+
});
|
|
845
|
+
const DivLogoWrapper = styled('div')(({ theme }) => ({
|
|
846
|
+
justifyContent: 'space-between',
|
|
847
|
+
alignSelf: 'stretch',
|
|
848
|
+
backgroundColor: '',
|
|
849
|
+
display: 'flex',
|
|
850
|
+
gap: '20px',
|
|
851
|
+
padding: '12px 16px',
|
|
852
|
+
marginBottom: 16,
|
|
853
|
+
}));
|
|
854
|
+
const DivLogo = styled('div')(({ theme }) => {
|
|
855
|
+
var _a, _b;
|
|
856
|
+
return ({
|
|
857
|
+
margin: 'auto 40 auto 0',
|
|
858
|
+
display: '-webkit-box',
|
|
859
|
+
[(_a = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _a === void 0 ? void 0 : _a.up('md')]: {
|
|
860
|
+
width: 95,
|
|
861
|
+
height: 57,
|
|
862
|
+
},
|
|
863
|
+
[(_b = theme === null || theme === void 0 ? void 0 : theme.breakpoints) === null || _b === void 0 ? void 0 : _b.down('md')]: {
|
|
864
|
+
width: 60,
|
|
865
|
+
height: 36,
|
|
866
|
+
display: 'flex',
|
|
867
|
+
},
|
|
868
|
+
});
|
|
869
|
+
});
|
|
870
|
+
const DivCrossIconWrapper = styled('div')(({ theme }) => ({
|
|
871
|
+
display: 'flex',
|
|
872
|
+
alignItems: 'center',
|
|
873
|
+
justifyContent: 'center',
|
|
874
|
+
padding: 6,
|
|
875
|
+
}));
|
|
876
|
+
const StyledCloseIconBtn = styled(IconButton)(({ theme }) => {
|
|
877
|
+
var _a;
|
|
878
|
+
return ({
|
|
879
|
+
color: `${((_a = theme.palette.text) === null || _a === void 0 ? void 0 : _a.primary) || '#000'} !important`,
|
|
880
|
+
padding: '0 !important',
|
|
881
|
+
});
|
|
882
|
+
});
|
|
883
|
+
const DivLoginActionContainer = styled('div')(({ theme }) => ({
|
|
884
|
+
justifyContent: 'center',
|
|
885
|
+
alignSelf: 'stretch',
|
|
886
|
+
display: 'flex',
|
|
887
|
+
flexDirection: 'column',
|
|
888
|
+
padding: ' 0 16px',
|
|
889
|
+
}));
|
|
890
|
+
const DivCommonMenus = styled('div')(({ theme }) => ({
|
|
891
|
+
padding: 16,
|
|
892
|
+
display: 'flex',
|
|
893
|
+
flexDirection: 'column',
|
|
894
|
+
alignSelf: 'stretch',
|
|
895
|
+
alignItems: 'flex-start',
|
|
896
|
+
}));
|
|
897
|
+
const MenuItemOtherLinks = styled(MenuItem)(({ theme }) => ({
|
|
898
|
+
display: 'flex',
|
|
899
|
+
borderBottom: `1px solid ${theme.palette.divider} !important`,
|
|
900
|
+
alignItems: 'flex-start',
|
|
901
|
+
padding: '16px 0 !important',
|
|
902
|
+
'&:last-child': {
|
|
903
|
+
borderBottom: 'none !important',
|
|
904
|
+
gap: '30px',
|
|
905
|
+
justifyContent: 'space-between',
|
|
906
|
+
},
|
|
907
|
+
width: '100%',
|
|
908
|
+
gap: '50%',
|
|
909
|
+
}));
|
|
910
|
+
const StyledFormControlLabel = styled(FormControlLabel)(({ theme }) => ({
|
|
911
|
+
'& .MuiRadio-root': {
|
|
912
|
+
padding: '0 9px',
|
|
913
|
+
},
|
|
914
|
+
}));
|
|
915
|
+
const ButtonLogout = styled(Button$1)(({ theme }) => {
|
|
916
|
+
var _a, _b;
|
|
917
|
+
return ({
|
|
918
|
+
display: 'flex',
|
|
919
|
+
padding: 16,
|
|
920
|
+
alignItems: 'center',
|
|
921
|
+
gap: 78,
|
|
922
|
+
alignSelf: 'stretch',
|
|
923
|
+
width: '100%',
|
|
924
|
+
flex: '1 0 0',
|
|
925
|
+
justifyContent: 'center',
|
|
926
|
+
flexDirection: 'column',
|
|
927
|
+
borderRadius: '100px !important',
|
|
928
|
+
border: `1px solid ${((_a = theme.palette.secondary) === null || _a === void 0 ? void 0 : _a.main) || '#f00'} !important`,
|
|
929
|
+
color: `${((_b = theme.palette.secondary) === null || _b === void 0 ? void 0 : _b.main) || '#f00'} !important`,
|
|
930
|
+
});
|
|
931
|
+
});
|
|
932
|
+
const DivLogoutBtnWrapper = styled('div')(({ theme }) => ({
|
|
933
|
+
margin: 16,
|
|
934
|
+
}));
|
|
935
|
+
const AnchorLink$1 = styled('a')(({ theme }) => ({
|
|
936
|
+
color: 'inherit',
|
|
937
|
+
'&:hover': {
|
|
938
|
+
color: 'inherit',
|
|
939
|
+
},
|
|
940
|
+
}));
|
|
941
|
+
const StyledButton$1 = styled(Button$1)(({ theme }) => {
|
|
942
|
+
var _a, _b, _c, _d;
|
|
943
|
+
return ({
|
|
944
|
+
alignSelf: 'start',
|
|
945
|
+
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,
|
|
946
|
+
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',
|
|
947
|
+
height: '40px',
|
|
948
|
+
borderRadius: '100px',
|
|
949
|
+
padding: '10px 24px',
|
|
950
|
+
});
|
|
951
|
+
});
|
|
952
|
+
const StyledButtonBanner = styled(Button$1)(({ theme }) => ({
|
|
953
|
+
alignSelf: 'start',
|
|
954
|
+
height: '40px',
|
|
955
|
+
borderRadius: '100px',
|
|
956
|
+
padding: '10px 24px',
|
|
957
|
+
}));
|
|
958
|
+
const TypographyBtnText = styled(Typography)(({ theme }) => {
|
|
959
|
+
var _a, _b;
|
|
960
|
+
return ({
|
|
961
|
+
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',
|
|
962
|
+
textTransform: 'none',
|
|
963
|
+
});
|
|
964
|
+
});
|
|
965
|
+
|
|
966
|
+
/**
|
|
967
|
+
* Header component with tenant theme support and responsive navigation
|
|
968
|
+
*
|
|
969
|
+
* @example
|
|
970
|
+
* ```tsx
|
|
971
|
+
* <Header
|
|
972
|
+
* logo={logoSrc}
|
|
973
|
+
* navigationLinks={navLinks}
|
|
974
|
+
* languages={languageOptions}
|
|
975
|
+
* currentLocale="en"
|
|
976
|
+
* onLogoClick={() => history.push('/')}
|
|
977
|
+
* onLoginClick={() => setShowLoginModal(true)}
|
|
978
|
+
* />
|
|
979
|
+
* ```
|
|
980
|
+
*/
|
|
981
|
+
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, }) {
|
|
982
|
+
var _a, _b;
|
|
983
|
+
const tenantTheme = useTenantTheme();
|
|
984
|
+
tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
985
|
+
const muiTheme = useTheme();
|
|
986
|
+
const themeBreakpoint = useMediaQuery((_a = muiTheme === null || muiTheme === void 0 ? void 0 : muiTheme.breakpoints) === null || _a === void 0 ? void 0 : _a.down('md'));
|
|
987
|
+
const isMobile = propIsMobile !== undefined ? propIsMobile : themeBreakpoint;
|
|
988
|
+
const [anchorElNav, setAnchorElNav] = React.useState(null);
|
|
989
|
+
const [anchorElLanguage, setAnchorElLanguage] = React.useState(null);
|
|
990
|
+
const [anchorElUserMenu, setAnchorElUserMenu] = React.useState(null);
|
|
991
|
+
const shouldShowContent = (!isPartnershipPagePCView || (isPartnershipPagePCView && !scrolled)) &&
|
|
992
|
+
(!isSeoPageView || (isSeoPageView && !scrolled));
|
|
993
|
+
const firstName1stLetter = ((_b = userFirstName === null || userFirstName === void 0 ? void 0 : userFirstName.trim()) === null || _b === void 0 ? void 0 : _b.slice(0, 1)) || '';
|
|
994
|
+
const handleOpenNavMenu = (event) => {
|
|
995
|
+
setAnchorElNav(event.currentTarget);
|
|
996
|
+
};
|
|
997
|
+
const handleOpenLanguageMenu = (event) => {
|
|
998
|
+
setAnchorElLanguage(event.currentTarget);
|
|
999
|
+
};
|
|
1000
|
+
const handleCloseNavMenu = () => {
|
|
1001
|
+
setAnchorElNav(null);
|
|
1002
|
+
};
|
|
1003
|
+
const handleCloseLanguageMenu = () => {
|
|
1004
|
+
setAnchorElLanguage(null);
|
|
1005
|
+
};
|
|
1006
|
+
const handleOpenUserMenu = (event) => {
|
|
1007
|
+
setAnchorElUserMenu(event.currentTarget);
|
|
1008
|
+
};
|
|
1009
|
+
const handleCloseUserMenu = () => {
|
|
1010
|
+
setAnchorElUserMenu(null);
|
|
1011
|
+
};
|
|
1012
|
+
const displayLogo = showAlternateLogo && alternateLogo ? alternateLogo : logo;
|
|
1013
|
+
return (jsx(StyledAppBar$1, Object.assign({ ispartnershippagemobileview: isPartnershipPageMobileView, scrolled: scrolled }, { children: jsx(ResponsiveB2CLayout, { children: jsx(StyledContainer, Object.assign({ ispartnershippagemobileview: isPartnershipPageMobileView, scrolled: scrolled, maxWidth: "xl" }, { children: jsxs(Toolbar, Object.assign({ disableGutters: true }, { children: [jsx("a", Object.assign({ href: host || '#', onClick: (e) => {
|
|
1014
|
+
e === null || e === void 0 ? void 0 : e.preventDefault();
|
|
1015
|
+
onLogoClick === null || onLogoClick === void 0 ? void 0 : onLogoClick();
|
|
1016
|
+
}, 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: jsx(TypographyLogo, Object.assign({ variant: "h6", noWrap: true, sx: {
|
|
1017
|
+
mr: isMobile ? 2 : 5,
|
|
1018
|
+
display: { xs: 'flex', md: 'flex' },
|
|
1019
|
+
flexGrow: isMobile ? 1 : 0,
|
|
1020
|
+
fontFamily: 'monospace',
|
|
1021
|
+
fontWeight: 700,
|
|
1022
|
+
letterSpacing: '.3rem',
|
|
1023
|
+
color: 'inherit',
|
|
1024
|
+
textDecoration: 'none',
|
|
1025
|
+
} }, { children: jsx("img", { src: displayLogo, alt: "Logo", style: Object.assign({}, (isMobile && { height: '32px', width: '119px' })), height: isMobile ? '32px' : '57px', width: isMobile ? '119px' : '93.36px' }) })) })), !isMobile && (jsxs(Fragment, { children: [shouldShowContent && (jsxs(Box, Object.assign({ sx: {
|
|
1026
|
+
flexGrow: 1,
|
|
1027
|
+
display: { xs: 'none', md: 'flex', gap: 40 },
|
|
1028
|
+
} }, { children: [jsxs(ButtonDesktopMenu, Object.assign({ onClick: handleOpenNavMenu, sx: { my: 2, textTransform: 'capitalize' }, "data-testid": "productNavigationMenu" }, { children: [jsx(Typography, Object.assign({ variant: "h6" }, { children: formatMessage({ id: 'Products' }) })), jsx(Icon, { component: ArrowDropDownIcon })] }), "product"), (menuItems === null || menuItems === void 0 ? void 0 : menuItems.partnership) && (jsx(ButtonDesktopMenu, Object.assign({ onClick: onPartnershipClick, sx: { my: 2, textTransform: 'capitalize' } }, { children: jsx(Typography, Object.assign({ variant: "h6" }, { children: 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) && (jsx(ButtonDesktopMenu, Object.assign({ onClick: onAboutUsClick, sx: { my: 2, textTransform: 'capitalize' } }, { children: jsx(Typography, Object.assign({ variant: "h6" }, { children: 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) && (jsx(ButtonDesktopMenu, Object.assign({ onClick: onBlogClick, sx: { my: 2, textTransform: 'capitalize' } }, { children: jsx(Typography, Object.assign({ variant: "h6" }, { children: 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"))] }))), jsxs(Box, Object.assign({ sx: {
|
|
1029
|
+
flexGrow: 1,
|
|
1030
|
+
display: {
|
|
1031
|
+
xs: 'none',
|
|
1032
|
+
md: 'flex',
|
|
1033
|
+
gap: 40,
|
|
1034
|
+
justifyContent: 'flex-end',
|
|
1035
|
+
},
|
|
1036
|
+
} }, { children: [shouldShowContent && (jsxs(ButtonDesktopMenu, Object.assign({ onClick: handleOpenLanguageMenu, sx: { my: 2, textTransform: 'capitalize' }, "data-testid": "selectedLocale" }, { children: [jsx(Typography, Object.assign({ variant: "h6" }, { children: formatMessage({
|
|
1037
|
+
id: `${currentLocale === null || currentLocale === void 0 ? void 0 : currentLocale.toLocaleUpperCase()}`,
|
|
1038
|
+
}) })), jsx(Icon, { component: ArrowDropDownIcon })] }), "language")), isPartnershipPagePCView && scrolled ? (jsx(StyledButton$1, Object.assign({ variant: "contained", onClick: onPartnershipCTAClick }, { children: jsx(TypographyBtnText, Object.assign({ variant: "body1" }, { children: formatMessage({ id: 'Be Our Partner' }) })) }))) : isSeoPageView && scrolled && bannerData ? (jsx(StyledButtonBanner, Object.assign({ style: { background: bannerData === null || bannerData === void 0 ? void 0 : bannerData.ctaBGColor }, variant: "contained", onClick: onGetQuoteClick }, { children: jsx(Typography, Object.assign({ style: {
|
|
1039
|
+
color: bannerData === null || bannerData === void 0 ? void 0 : bannerData.ctaTextColor,
|
|
1040
|
+
textTransform: 'none',
|
|
1041
|
+
}, variant: "body1" }, { children: bannerData === null || bannerData === void 0 ? void 0 : bannerData.ctaText })) }))) : userToken ? (jsx(StyledAvatar, Object.assign({ onClick: handleOpenUserMenu, "data-testid": "user-profile-avatar" }, { children: firstName1stLetter }))) : (jsxs(DivButtonWrapper, { children: [jsx(ButtonAuth, Object.assign({ color: "primary", variant: "outlined", sx: { textTransform: 'capitalize' }, onClick: onLoginClick, "data-testid": "headerLogin" }, { children: jsx(TypographyAuth, Object.assign({ variant: "body1" }, { children: formatMessage({ id: 'Log in' }) })) })), jsx(ButtonAuth, Object.assign({ color: "primary", variant: "contained", sx: { textTransform: 'capitalize' }, onClick: onSignupClick }, { children: jsx(TypographyAuth, Object.assign({ variant: "body1" }, { children: formatMessage({ id: 'Sign up' }) })) }))] }))] })), jsx(StyledMenu, Object.assign({ id: "menu-appbar", anchorEl: anchorElNav, anchorOrigin: {
|
|
1042
|
+
vertical: 'bottom',
|
|
1043
|
+
horizontal: 'left',
|
|
1044
|
+
}, keepMounted: true, transformOrigin: {
|
|
1045
|
+
vertical: 'top',
|
|
1046
|
+
horizontal: 'left',
|
|
1047
|
+
}, open: Boolean(anchorElNav), onClose: handleCloseNavMenu, sx: {
|
|
1048
|
+
display: { xs: 'none', md: 'block' },
|
|
1049
|
+
} }, { children: jsx(DivProductListing, { children: navigationLinks.map(({ key, name, icon }) => (jsxs(StyledMenuItem, Object.assign({ onClick: () => {
|
|
1050
|
+
onProductMenuClick === null || onProductMenuClick === void 0 ? void 0 : onProductMenuClick(key);
|
|
1051
|
+
handleCloseNavMenu();
|
|
1052
|
+
}, "data-testid": `product-navigation-${key}` }, { children: [jsx(SpanImageWrapper, { children: jsx(ImageProductIcon, { src: icon, width: 18, height: 18, alt: name }) }), jsx(Typography, Object.assign({ variant: "body1", textAlign: "center" }, { children: jsx(AnchorLinks, Object.assign({ href: `#${key}`, onClick: (e) => e === null || e === void 0 ? void 0 : e.preventDefault() }, { children: formatMessage({ id: `${name}` }) })) }))] }), key))) }) })), jsx(StyledMenu, Object.assign({ id: "language-menu", anchorEl: anchorElLanguage, anchorOrigin: {
|
|
1053
|
+
vertical: 'bottom',
|
|
1054
|
+
horizontal: 'left',
|
|
1055
|
+
}, keepMounted: true, transformOrigin: {
|
|
1056
|
+
vertical: 'top',
|
|
1057
|
+
horizontal: 'left',
|
|
1058
|
+
}, open: Boolean(anchorElLanguage), onClose: handleCloseLanguageMenu, sx: {
|
|
1059
|
+
display: { xs: 'none', md: 'block' },
|
|
1060
|
+
} }, { children: jsx(DivProductListing, { children: languages.map(({ value, locale, label }) => (jsx(StyledMenuItem, Object.assign({ onClick: () => {
|
|
1061
|
+
onLanguageChange === null || onLanguageChange === void 0 ? void 0 : onLanguageChange(locale, value);
|
|
1062
|
+
handleCloseLanguageMenu();
|
|
1063
|
+
}, "data-testid": `lang-${locale}` }, { children: jsx(Typography, Object.assign({ variant: "body1", textAlign: "center" }, { children: label })) }), value))) }) })), jsx(StyledMenu, Object.assign({ id: "user-menu", anchorEl: anchorElUserMenu, anchorOrigin: {
|
|
1064
|
+
vertical: 'bottom',
|
|
1065
|
+
horizontal: 'left',
|
|
1066
|
+
}, keepMounted: true, transformOrigin: {
|
|
1067
|
+
vertical: 'top',
|
|
1068
|
+
horizontal: 'left',
|
|
1069
|
+
}, open: Boolean(anchorElUserMenu), onClose: handleCloseUserMenu, sx: {
|
|
1070
|
+
display: { xs: 'none', md: 'block' },
|
|
1071
|
+
} }, { children: jsxs(DivProductListing, { children: [jsx(StyledMenuItem, Object.assign({ onClick: () => {
|
|
1072
|
+
onMyProfileClick === null || onMyProfileClick === void 0 ? void 0 : onMyProfileClick();
|
|
1073
|
+
handleCloseUserMenu();
|
|
1074
|
+
} }, { children: jsx(Typography, Object.assign({ variant: "body1", textAlign: "center" }, { children: formatMessage({ id: `My profile` }) })) }), "myProfile"), jsx(StyledMenuItemDesktop, Object.assign({ onClick: () => {
|
|
1075
|
+
onLogoutClick === null || onLogoutClick === void 0 ? void 0 : onLogoutClick();
|
|
1076
|
+
handleCloseUserMenu();
|
|
1077
|
+
} }, { children: jsx(Typography, Object.assign({ variant: "body1", textAlign: "center" }, { children: formatMessage({ id: `Logout` }) })) }), "logout")] }) }))] })), isMobile && (jsxs(Box, Object.assign({ sx: { flexGrow: 0, display: { xs: 'flex', md: 'none' } } }, { children: [jsx(IconButton, Object.assign({ size: "large", "aria-label": "account of current user", "aria-controls": "menu-appbar", "aria-haspopup": "true", "aria-labelledby": "menu icon", onClick: (e) => {
|
|
1078
|
+
if (isPartnershipPageMobileView && scrolled) {
|
|
1079
|
+
onPartnershipCTAClick === null || onPartnershipCTAClick === void 0 ? void 0 : onPartnershipCTAClick();
|
|
1080
|
+
}
|
|
1081
|
+
else if (isSeoPageView && scrolled) {
|
|
1082
|
+
onGetQuoteClick === null || onGetQuoteClick === void 0 ? void 0 : onGetQuoteClick();
|
|
1083
|
+
}
|
|
1084
|
+
else {
|
|
1085
|
+
handleOpenNavMenu(e);
|
|
1086
|
+
}
|
|
1087
|
+
}, color: "inherit", sx: Object.assign({}, (isPartnershipPageMobileView &&
|
|
1088
|
+
scrolled && { padding: '0px !important' })) }, { children: anchorElNav ? (jsx(StyledCloseIcon, {})) : isPartnershipPageMobileView && scrolled ? (jsx(StyledButton$1, Object.assign({ variant: "contained", onClick: onPartnershipCTAClick }, { children: jsx(TypographyBtnText, Object.assign({ variant: "body1" }, { children: formatMessage({ id: 'Be Our Partner' }) })) }))) : isSeoPageView && scrolled && bannerData ? (jsx(StyledButtonBanner, Object.assign({ style: {
|
|
1089
|
+
background: bannerData === null || bannerData === void 0 ? void 0 : bannerData.ctaBGColor,
|
|
1090
|
+
}, variant: "contained", onClick: onGetQuoteClick }, { children: jsx(Typography, Object.assign({ style: {
|
|
1091
|
+
color: bannerData === null || bannerData === void 0 ? void 0 : bannerData.ctaTextColor,
|
|
1092
|
+
textTransform: 'none',
|
|
1093
|
+
}, variant: "body1" }, { children: bannerData === null || bannerData === void 0 ? void 0 : bannerData.ctaText })) }))) : userToken ? (jsx(StyledAvatarUserIcon, Object.assign({ "data-testid": "user-profile-avatar" }, { children: firstName1stLetter }))) : (jsx(StyledMenuIcon, { ispartnershippagemobileview: isPartnershipPageMobileView, scrolled: scrolled })) })), jsxs(StyledDrawer$3, Object.assign({ id: "menu-appbar", anchor: "top", keepMounted: true, open: Boolean(anchorElNav), onClose: handleCloseNavMenu, sx: {
|
|
1094
|
+
display: { xs: 'block', md: 'none' },
|
|
1095
|
+
width: '100%',
|
|
1096
|
+
left: 0,
|
|
1097
|
+
} }, { children: [jsxs(DivLogoWrapper, { children: [jsx(DivLogo, { children: jsx("img", { src: logo, alt: "logo", width: "100%", height: "100%" }) }), jsx(DivCrossIconWrapper, { children: jsx(StyledCloseIconBtn, Object.assign({ size: "large", "aria-label": "close menu", "aria-controls": "menu-appbar", "aria-haspopup": "true", onClick: handleCloseNavMenu, color: "inherit" }, { children: jsx(CloseIcon, {}) })) })] }), userToken ? (userProfileComponent) : (jsxs(DivLoginActionContainer, { children: [jsx(Typography, Object.assign({ variant: "h6" }, { children: welcomeMessage || formatMessage({ id: 'Welcome' }) })), jsxs(DivButtonWrapper, { children: [jsx(ButtonAuth, Object.assign({ color: "primary", variant: "outlined", onClick: () => {
|
|
1098
|
+
onLoginClick === null || onLoginClick === void 0 ? void 0 : onLoginClick();
|
|
1099
|
+
handleCloseNavMenu();
|
|
1100
|
+
}, "data-testid": "headerLogin" }, { children: jsx(TypographyAuth, Object.assign({ variant: "body1" }, { children: formatMessage({ id: 'Log in' }) })) })), jsx(ButtonAuth, Object.assign({ color: "primary", variant: "contained", onClick: () => {
|
|
1101
|
+
onSignupClick === null || onSignupClick === void 0 ? void 0 : onSignupClick();
|
|
1102
|
+
handleCloseNavMenu();
|
|
1103
|
+
} }, { children: jsx(TypographyAuth, Object.assign({ variant: "body1" }, { children: formatMessage({ id: 'Sign up' }) })) }))] })] })), jsx(DivProductListing, { children: navigationLinks.map(({ key, name, icon }) => (jsxs(StyledMenuItem, Object.assign({ onClick: () => {
|
|
1104
|
+
onProductMenuClick === null || onProductMenuClick === void 0 ? void 0 : onProductMenuClick(key);
|
|
1105
|
+
handleCloseNavMenu();
|
|
1106
|
+
}, "data-testid": `product-navigation-${key}` }, { children: [jsx(SpanImageWrapper, { children: jsx(ImageProductIcon, { src: icon, width: 18, height: 18, alt: name }) }), jsx(Typography, Object.assign({ variant: "body1", textAlign: "center" }, { children: formatMessage({ id: `${name}` }) }))] }), key))) }), jsxs(DivCommonMenus, { children: [userToken && (jsx(MenuItemOtherLinks, Object.assign({ onClick: () => {
|
|
1107
|
+
handleCloseNavMenu();
|
|
1108
|
+
onMyProfileClick === null || onMyProfileClick === void 0 ? void 0 : onMyProfileClick();
|
|
1109
|
+
} }, { children: jsx(Typography, Object.assign({ variant: "body1", textAlign: "center" }, { children: formatMessage({ id: 'My Policy' }) })) }))), (menuItems === null || menuItems === void 0 ? void 0 : menuItems.blog) && (jsx(MenuItemOtherLinks, Object.assign({ onClick: onBlogClick }, { children: jsx(Typography, Object.assign({ variant: "body1", textAlign: "center" }, { children: 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) && (jsx(MenuItemOtherLinks, Object.assign({ onClick: () => {
|
|
1110
|
+
handleCloseNavMenu();
|
|
1111
|
+
onPartnershipClick === null || onPartnershipClick === void 0 ? void 0 : onPartnershipClick();
|
|
1112
|
+
} }, { children: jsx(Typography, Object.assign({ variant: "body1", textAlign: "center" }, { children: menuItems.partnership.label })) }))), (menuItems === null || menuItems === void 0 ? void 0 : menuItems.aboutUs) && (jsx(MenuItemOtherLinks, Object.assign({ onClick: () => {
|
|
1113
|
+
handleCloseNavMenu();
|
|
1114
|
+
onAboutUsClick === null || onAboutUsClick === void 0 ? void 0 : onAboutUsClick();
|
|
1115
|
+
} }, { children: jsx(Typography, Object.assign({ variant: "body1", textAlign: "center" }, { children: menuItems.aboutUs.label })) }))), jsxs(MenuItemOtherLinks, { children: [jsx(Typography, Object.assign({ variant: "body1", textAlign: "center" }, { children: formatMessage({ id: 'Language' }) })), jsx(RadioGroup, Object.assign({ row: true, "aria-labelledby": "language-selector", name: "language-selector", onChange: (e) => {
|
|
1116
|
+
const value = e.target.value;
|
|
1117
|
+
const selectedLang = languages.find((lang) => lang.locale === value);
|
|
1118
|
+
if (selectedLang) {
|
|
1119
|
+
onLanguageChange === null || onLanguageChange === void 0 ? void 0 : onLanguageChange(selectedLang.locale, selectedLang.value);
|
|
1120
|
+
}
|
|
1121
|
+
}, defaultValue: currentLocale, value: currentLocale }, { children: languages.map((lang) => (jsx(StyledFormControlLabel, { value: lang.locale, control: jsx(Radio, {}), label: lang.label, "data-testid": `lang-${lang.locale}` }, lang.locale))) }))] })] }), isMobile && userToken && (jsx(DivLogoutBtnWrapper, { children: jsx(ButtonLogout, Object.assign({ onClick: onLogoutClick }, { children: formatMessage({ id: 'Logout' }) })) }))] }))] })))] })) })) }) })));
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
const StyledAppBar = styled(AppBar$1)(({ theme }) => ({
|
|
1125
|
+
backgroundColor: '#FFFFFF',
|
|
1126
|
+
boxShadow: '0px 2px 20px 4px rgba(0, 0, 0, 0.14)',
|
|
1127
|
+
zIndex: theme.zIndex.drawer + 1,
|
|
1128
|
+
}));
|
|
1129
|
+
const StyledToolbar = styled(Toolbar)(({ theme }) => ({
|
|
1130
|
+
display: 'flex',
|
|
1131
|
+
alignItems: 'center',
|
|
1132
|
+
justifyContent: 'space-between',
|
|
1133
|
+
padding: '12px 16px',
|
|
1134
|
+
minHeight: '64px !important',
|
|
1135
|
+
[theme.breakpoints.down('md')]: {
|
|
1136
|
+
minHeight: '56px !important',
|
|
1137
|
+
padding: '12px 16px',
|
|
1138
|
+
},
|
|
1139
|
+
}));
|
|
1140
|
+
const LogoContainer$1 = styled('div')(({ theme }) => ({
|
|
1141
|
+
display: 'flex',
|
|
1142
|
+
alignItems: 'center',
|
|
1143
|
+
cursor: 'pointer',
|
|
1144
|
+
height: '32px',
|
|
1145
|
+
}));
|
|
1146
|
+
const LogoImage = styled('img')(({ theme }) => ({
|
|
1147
|
+
height: '32px',
|
|
1148
|
+
width: 'auto',
|
|
1149
|
+
objectFit: 'contain',
|
|
1150
|
+
}));
|
|
1151
|
+
const MenuIconButton = styled(IconButton)(({ theme }) => ({
|
|
1152
|
+
padding: '6px',
|
|
1153
|
+
borderRadius: '25px',
|
|
1154
|
+
width: '40px',
|
|
1155
|
+
height: '40px',
|
|
1156
|
+
'& .MuiSvgIcon-root': {
|
|
1157
|
+
color: '#000000',
|
|
1158
|
+
fontSize: '24px',
|
|
1159
|
+
},
|
|
1160
|
+
}));
|
|
1161
|
+
const StyledDrawer$2 = styled(Drawer)(({ theme }) => ({
|
|
1162
|
+
'& .MuiDrawer-paper': {
|
|
1163
|
+
backgroundColor: '#FFFFFF',
|
|
1164
|
+
boxSizing: 'border-box',
|
|
1165
|
+
},
|
|
1166
|
+
}));
|
|
1167
|
+
const DrawerHeader$2 = styled(Box)(({ theme }) => ({
|
|
1168
|
+
display: 'flex',
|
|
1169
|
+
alignItems: 'center',
|
|
1170
|
+
justifyContent: 'space-between',
|
|
1171
|
+
padding: '12px 16px',
|
|
1172
|
+
minHeight: '64px',
|
|
1173
|
+
}));
|
|
1174
|
+
const DrawerLogoContainer = styled('div')(({ theme }) => ({
|
|
1175
|
+
display: 'flex',
|
|
1176
|
+
alignItems: 'center',
|
|
1177
|
+
cursor: 'pointer',
|
|
1178
|
+
height: '32px',
|
|
1179
|
+
}));
|
|
1180
|
+
const CloseIconButton = styled(IconButton)(({ theme }) => ({
|
|
1181
|
+
padding: '6px',
|
|
1182
|
+
'& .MuiSvgIcon-root': {
|
|
1183
|
+
color: '#000000',
|
|
1184
|
+
fontSize: '24px',
|
|
1185
|
+
},
|
|
1186
|
+
}));
|
|
1187
|
+
const DrawerContent$2 = styled(Box)(({ theme }) => ({
|
|
1188
|
+
flex: 1,
|
|
1189
|
+
overflowY: 'auto',
|
|
1190
|
+
paddingBottom: theme.spacing(2),
|
|
1191
|
+
}));
|
|
1192
|
+
styled(Box)(({ theme }) => ({
|
|
1193
|
+
padding: theme.spacing(2),
|
|
1194
|
+
borderTop: `1px solid ${theme.palette.divider}`,
|
|
1195
|
+
}));
|
|
1196
|
+
|
|
1197
|
+
/**
|
|
1198
|
+
* NewHeader component - simplified design based on Figma
|
|
1199
|
+
*
|
|
1200
|
+
* @example
|
|
1201
|
+
* ```tsx
|
|
1202
|
+
* <NewHeader
|
|
1203
|
+
* logo={logoSrc}
|
|
1204
|
+
* navigationLinks={navLinks}
|
|
1205
|
+
* onLogoClick={() => history.push('/')}
|
|
1206
|
+
* />
|
|
1207
|
+
* ```
|
|
1208
|
+
*/
|
|
1209
|
+
function NewHeader({ logo: propLogo, navigationLinks = [], additionalMenuSections = [], isMobile: propIsMobile, onLogoClick, onMenuOpen, onMenuClose, customDrawerContent, formatMessage = (descriptor) => descriptor.id, }) {
|
|
1210
|
+
var _a;
|
|
1211
|
+
const tenantTheme = useTenantTheme();
|
|
1212
|
+
const theme = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
1213
|
+
const muiTheme = useTheme();
|
|
1214
|
+
const themeBreakpoint = useMediaQuery((_a = muiTheme === null || muiTheme === void 0 ? void 0 : muiTheme.breakpoints) === null || _a === void 0 ? void 0 : _a.down('md'));
|
|
1215
|
+
const isMobile = propIsMobile !== undefined ? propIsMobile : themeBreakpoint;
|
|
1216
|
+
// Use prop logo if provided, otherwise try to get from theme
|
|
1217
|
+
// Fallback to empty string to avoid SSR errors
|
|
1218
|
+
const logo = propLogo || (theme === null || theme === void 0 ? void 0 : theme.logo) || '';
|
|
1219
|
+
const [drawerOpen, setDrawerOpen] = React.useState(false);
|
|
1220
|
+
const handleDrawerOpen = () => {
|
|
1221
|
+
setDrawerOpen(true);
|
|
1222
|
+
onMenuOpen === null || onMenuOpen === void 0 ? void 0 : onMenuOpen();
|
|
1223
|
+
};
|
|
1224
|
+
const handleDrawerClose = () => {
|
|
1225
|
+
setDrawerOpen(false);
|
|
1226
|
+
onMenuClose === null || onMenuClose === void 0 ? void 0 : onMenuClose();
|
|
1227
|
+
};
|
|
1228
|
+
const handleLogoClick = (e) => {
|
|
1229
|
+
e.preventDefault();
|
|
1230
|
+
onLogoClick === null || onLogoClick === void 0 ? void 0 : onLogoClick();
|
|
1231
|
+
};
|
|
1232
|
+
const handleMenuItemClick = (item) => {
|
|
1233
|
+
var _a;
|
|
1234
|
+
(_a = item.onClick) === null || _a === void 0 ? void 0 : _a.call(item);
|
|
1235
|
+
handleDrawerClose();
|
|
1236
|
+
};
|
|
1237
|
+
return (jsxs(Fragment, { children: [jsx(StyledAppBar, Object.assign({ position: "fixed" }, { children: jsxs(StyledToolbar, Object.assign({ disableGutters: true }, { children: [jsx(LogoContainer$1, Object.assign({ onClick: handleLogoClick }, { children: jsx(LogoImage, { src: logo, alt: "Logo" }) })), jsx(MenuIconButton, Object.assign({ size: "large", edge: "end", "aria-label": "menu", onClick: handleDrawerOpen }, { children: jsx(MenuIcon, {}) }))] })) })), jsx(StyledDrawer$2, Object.assign({ anchor: "right", open: drawerOpen, onClose: handleDrawerClose }, { children: customDrawerContent ? (jsx(Box, Object.assign({ sx: { width: isMobile ? '100vw' : 350 } }, { children: customDrawerContent }))) : (jsxs(Box, Object.assign({ sx: { width: isMobile ? '100vw' : 350 } }, { children: [jsxs(DrawerHeader$2, { children: [jsx(DrawerLogoContainer, Object.assign({ onClick: handleLogoClick }, { children: jsx(LogoImage, { src: logo, alt: "Logo" }) })), jsx(CloseIconButton, Object.assign({ onClick: handleDrawerClose, "aria-label": "close" }, { children: jsx(CloseIcon, {}) }))] }), jsx(Divider, {}), jsxs(DrawerContent$2, { children: [navigationLinks.length > 0 && (jsx(List, { children: navigationLinks.map((item) => (jsx(ListItem, Object.assign({ disablePadding: true }, { children: jsx(ListItemButton, Object.assign({ onClick: () => handleMenuItemClick(item) }, { children: jsx(ListItemText, { primary: formatMessage({ id: item.label }) }) })) }), item.key))) })), additionalMenuSections.map((section, index) => (jsxs(React.Fragment, { children: [section.title && (jsxs(Fragment, { children: [jsx(Divider, {}), jsx(Box, Object.assign({ sx: { px: 2, py: 1 } }, { children: jsx(ListItemText, { primary: formatMessage({ id: section.title }), primaryTypographyProps: {
|
|
1238
|
+
variant: 'caption',
|
|
1239
|
+
color: 'text.secondary',
|
|
1240
|
+
} }) }))] })), jsx(List, { children: section.items.map((item) => (jsx(ListItem, Object.assign({ disablePadding: true }, { children: jsx(ListItemButton, Object.assign({ onClick: () => handleMenuItemClick(item) }, { children: jsx(ListItemText, { primary: formatMessage({ id: item.label }) }) })) }), item.key))) })] }, index)))] })] }))) }))] }));
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
const DivFooter = styled('div')(({ theme }) => ({
|
|
1244
|
+
backgroundColor: '#424242',
|
|
1245
|
+
padding: '20px 16px',
|
|
1246
|
+
'@media (min-width: 769px)': {
|
|
1247
|
+
padding: '70px 0px',
|
|
1248
|
+
},
|
|
1249
|
+
anchorLinks: {
|
|
1250
|
+
color: 'inherit',
|
|
1251
|
+
'&:hover': {
|
|
1252
|
+
color: 'inherit',
|
|
1253
|
+
},
|
|
1254
|
+
},
|
|
1255
|
+
}));
|
|
1256
|
+
const DivFooterConterResponsiveLayout = styled('div')(({ theme }) => ({
|
|
1257
|
+
color: '#fff',
|
|
1258
|
+
[theme.breakpoints.up(1025)]: {
|
|
1259
|
+
minWidth: '1128px',
|
|
1260
|
+
maxWidth: '1128px',
|
|
1261
|
+
margin: '0 auto',
|
|
1262
|
+
},
|
|
1263
|
+
}));
|
|
1264
|
+
const FooterHiddenContent = styled('div')(({ theme, simplifiedLayout }) => simplifiedLayout ? { display: 'none' } : { display: 'flex' });
|
|
1265
|
+
const DivIglooIntro = styled('div')(({ theme }) => {
|
|
1266
|
+
var _a;
|
|
1267
|
+
return ({
|
|
1268
|
+
display: 'flex',
|
|
1269
|
+
flexDirection: 'column',
|
|
1270
|
+
gap: '24px',
|
|
1271
|
+
color: ((_a = theme === null || theme === void 0 ? void 0 : theme.palette.common) === null || _a === void 0 ? void 0 : _a.white) || '#fff',
|
|
1272
|
+
'@media (min-width: 769px)': {
|
|
1273
|
+
width: 320,
|
|
1274
|
+
marginRight: 194,
|
|
1275
|
+
},
|
|
1276
|
+
});
|
|
1277
|
+
});
|
|
1278
|
+
const DivSocial = styled('div')(({ theme }) => ({
|
|
1279
|
+
display: 'flex',
|
|
1280
|
+
alignItems: 'center',
|
|
1281
|
+
margin: '0 auto',
|
|
1282
|
+
columnGap: '32px',
|
|
1283
|
+
flexDirection: 'row',
|
|
1284
|
+
'@media (min-width: 769px)': {
|
|
1285
|
+
margin: 'initial',
|
|
1286
|
+
},
|
|
1287
|
+
}));
|
|
1288
|
+
const ButtonIcon = styled(Button$1)(({ theme }) => {
|
|
1289
|
+
var _a;
|
|
1290
|
+
return ({
|
|
1291
|
+
color: ((_a = theme.palette.common) === null || _a === void 0 ? void 0 : _a.white) || '#fff',
|
|
1292
|
+
padding: '0 !important',
|
|
1293
|
+
minWidth: 'auto !important',
|
|
1294
|
+
});
|
|
1295
|
+
});
|
|
1296
|
+
const TypographyIntro = styled(Typography)(({ theme }) => ({
|
|
1297
|
+
textAlign: 'center',
|
|
1298
|
+
color: `#fff !important`,
|
|
1299
|
+
'@media (min-width: 769px)': {
|
|
1300
|
+
textAlign: 'left',
|
|
1301
|
+
},
|
|
1302
|
+
}));
|
|
1303
|
+
const TypographyAddressFooter = styled(Typography)(({ theme }) => ({
|
|
1304
|
+
marginTop: 16,
|
|
1305
|
+
textAlign: 'center',
|
|
1306
|
+
color: '#fff',
|
|
1307
|
+
'@media (min-width: 769px)': {
|
|
1308
|
+
textAlign: 'left',
|
|
1309
|
+
},
|
|
1310
|
+
}));
|
|
1311
|
+
const DivLogos = styled('div')(({ theme }) => ({
|
|
1312
|
+
display: 'flex',
|
|
1313
|
+
flexDirection: 'column',
|
|
1314
|
+
gap: 16,
|
|
1315
|
+
alignItems: 'center',
|
|
1316
|
+
marginTop: 16,
|
|
1317
|
+
'@media (min-width: 769px)': {
|
|
1318
|
+
width: '100%',
|
|
1319
|
+
marginTop: 0,
|
|
1320
|
+
gap: 'initial',
|
|
1321
|
+
alignItems: 'baseline',
|
|
1322
|
+
},
|
|
1323
|
+
}));
|
|
1324
|
+
const DivFirstRow = styled('div')(({ theme }) => ({
|
|
1325
|
+
display: 'flex',
|
|
1326
|
+
flexDirection: 'row',
|
|
1327
|
+
gap: 16,
|
|
1328
|
+
}));
|
|
1329
|
+
const ButtonOjkLink = styled(Button$1)(({ theme }) => ({
|
|
1330
|
+
display: 'flex',
|
|
1331
|
+
justifyContent: 'flex-start',
|
|
1332
|
+
'@media (min-width: 769px)': {
|
|
1333
|
+
display: 'flex !important',
|
|
1334
|
+
justifyContent: 'flex-start !important ',
|
|
1335
|
+
},
|
|
1336
|
+
}));
|
|
1337
|
+
const ImageOjkLicense = styled('img')(({ theme }) => ({
|
|
1338
|
+
alignSelf: 'flex-start',
|
|
1339
|
+
height: 36,
|
|
1340
|
+
}));
|
|
1341
|
+
const ButtonSolisoustamaLink = styled(Button$1)(({ theme }) => ({
|
|
1342
|
+
display: 'flex',
|
|
1343
|
+
justifyContent: 'flex-start',
|
|
1344
|
+
}));
|
|
1345
|
+
const ImageSolisoustama = styled('img')(({ theme }) => ({
|
|
1346
|
+
height: 'auto',
|
|
1347
|
+
}));
|
|
1348
|
+
const DivLinks = styled('div')(({ theme }) => ({
|
|
1349
|
+
display: 'flex',
|
|
1350
|
+
flex: 1,
|
|
1351
|
+
alignItems: 'center',
|
|
1352
|
+
gap: 16,
|
|
1353
|
+
justifyContent: 'center',
|
|
1354
|
+
'@media (min-width: 769px)': {
|
|
1355
|
+
flex: '1 1',
|
|
1356
|
+
alignItems: 'normal',
|
|
1357
|
+
},
|
|
1358
|
+
}));
|
|
1359
|
+
const DivSection = styled('div')(({ theme }) => ({
|
|
1360
|
+
display: 'flex',
|
|
1361
|
+
flexDirection: 'column',
|
|
1362
|
+
gap: 16,
|
|
1363
|
+
flex: 1,
|
|
1364
|
+
alignItems: 'flex-start',
|
|
1365
|
+
'@media (min-width: 769px)': {
|
|
1366
|
+
gap: 24,
|
|
1367
|
+
'&:not(:first-of-type)': {
|
|
1368
|
+
marginLeft: 194,
|
|
1369
|
+
},
|
|
1370
|
+
},
|
|
1371
|
+
}));
|
|
1372
|
+
const ButtonBottomLink = styled(Button$1)(({ theme }) => ({
|
|
1373
|
+
color: '#fff !important',
|
|
1374
|
+
textTransform: 'capitalize',
|
|
1375
|
+
'@media (min-width: 769px)': {
|
|
1376
|
+
padding: '0 !important',
|
|
1377
|
+
textAlign: 'left !important',
|
|
1378
|
+
minWidth: 'auto !important',
|
|
1379
|
+
},
|
|
1380
|
+
}));
|
|
1381
|
+
const StyledDivider = styled(Divider)(({ theme }) => ({
|
|
1382
|
+
margin: '24px 0 16px !important',
|
|
1383
|
+
borderColor: '#5F5E62 !important',
|
|
1384
|
+
}));
|
|
1385
|
+
const DivBottom = styled('div')(({ theme }) => ({
|
|
1386
|
+
display: 'flex',
|
|
1387
|
+
justifyContent: 'space-between',
|
|
1388
|
+
alignItems: 'center',
|
|
1389
|
+
}));
|
|
1390
|
+
const DivSep = styled('div')(({ theme }) => ({
|
|
1391
|
+
width: '1px',
|
|
1392
|
+
height: 10,
|
|
1393
|
+
borderRadius: '1px',
|
|
1394
|
+
backgroundColor: '#fff',
|
|
1395
|
+
}));
|
|
1396
|
+
const AnchorLink = styled('a')(({ theme }) => ({
|
|
1397
|
+
color: 'inherit',
|
|
1398
|
+
'&:hover': {
|
|
1399
|
+
color: 'inherit',
|
|
1400
|
+
},
|
|
1401
|
+
}));
|
|
1402
|
+
|
|
1403
|
+
/**
|
|
1404
|
+
* Footer component with tenant theme support
|
|
1405
|
+
*
|
|
1406
|
+
* @example
|
|
1407
|
+
* ```tsx
|
|
1408
|
+
* <Footer
|
|
1409
|
+
* introText="Company introduction..."
|
|
1410
|
+
* socialLinks={socialMediaLinks}
|
|
1411
|
+
* licenseImages={licenses}
|
|
1412
|
+
* navigationLinks={footerNavLinks}
|
|
1413
|
+
* currentLocale="en"
|
|
1414
|
+
* />
|
|
1415
|
+
* ```
|
|
1416
|
+
*/
|
|
1417
|
+
function Footer({ simplifiedLayout = false, introText, addressText, socialLinks, licenseImages, poweredByImage, navigationLinks = [], currentLocale, host = '', isMobile: propIsMobile, onLinkClick, onSocialClick, onPrivacyPolicyClick, onTermsOfServiceClick, formatMessage = (descriptor) => descriptor.id, }) {
|
|
1418
|
+
var _a;
|
|
1419
|
+
const tenantTheme = useTenantTheme();
|
|
1420
|
+
tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
1421
|
+
const muiTheme = useTheme();
|
|
1422
|
+
const themeBreakpoint = useMediaQuery((_a = muiTheme === null || muiTheme === void 0 ? void 0 : muiTheme.breakpoints) === null || _a === void 0 ? void 0 : _a.down('md'));
|
|
1423
|
+
const isMobile = propIsMobile !== undefined ? propIsMobile : themeBreakpoint;
|
|
1424
|
+
return (jsx(DivFooter, { children: jsxs(DivFooterConterResponsiveLayout, { children: [jsxs(FooterHiddenContent, Object.assign({ simplifiedLayout: simplifiedLayout }, { children: [jsxs(DivIglooIntro, { children: [isMobile && (jsx(DivSocial, { children: socialLinks.map((social) => (jsx(ButtonIcon, Object.assign({ onClick: () => onSocialClick === null || onSocialClick === void 0 ? void 0 : onSocialClick(social.platform, social.url), "aria-label": social.ariaLabel || social.platform }, { children: jsx("img", { src: social.icon, alt: social.platform, loading: "lazy", height: "24px", width: "24px" }) }), social.platform))) })), jsx(TypographyIntro, Object.assign({ variant: "body2" }, { children: formatMessage({ id: introText }) })), addressText && (jsx(TypographyAddressFooter, Object.assign({ variant: "body2" }, { children: addressText }))), jsxs(DivLogos, { children: [jsx(DivFirstRow, { children: licenseImages.map((license, index) => (jsx(ButtonOjkLink, Object.assign({ onClick: () => license.url && window.open(license.url), "aria-label": license.ariaLabel || license.alt }, { children: jsx(ImageOjkLicense, { src: license.src, alt: license.alt, width: license.width, height: license.height, loading: "lazy" }) }), index))) }), poweredByImage && (jsx(ButtonSolisoustamaLink, Object.assign({ "aria-label": poweredByImage.ariaLabel || 'Powered by' }, { children: jsx(ImageSolisoustama, { src: poweredByImage.src, alt: poweredByImage.alt, width: poweredByImage.width, height: poweredByImage.height, loading: "lazy" }) })))] })] }), !isMobile && (jsx(DivLinks, { children: navigationLinks === null || navigationLinks === void 0 ? void 0 : navigationLinks.map((items, index) => (jsxs(DivSection, { children: [items === null || items === void 0 ? void 0 : items.map((link, _index) => {
|
|
1425
|
+
var _a, _b, _c;
|
|
1426
|
+
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');
|
|
1427
|
+
const anchorLinkOuterRef = isExternalURL
|
|
1428
|
+
? link.outerHref || ''
|
|
1429
|
+
: `${host}${link.outerHref}`;
|
|
1430
|
+
const anchorLinkInnerRef = `${host}${link.innerHref}`;
|
|
1431
|
+
return (jsx(ButtonBottomLink, Object.assign({ onClick: () => {
|
|
1432
|
+
onLinkClick === null || onLinkClick === void 0 ? void 0 : onLinkClick(link);
|
|
1433
|
+
} }, { children: jsx(Typography, Object.assign({ variant: "body1" }, { children: 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));
|
|
1434
|
+
}), index === navigationLinks.length - 1 && (jsxs(Fragment, { children: [jsx(ButtonBottomLink, Object.assign({ onClick: onPrivacyPolicyClick }, { children: jsx(Typography, Object.assign({ variant: "body1" }, { children: 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' }) })) })) })), jsx(ButtonBottomLink, Object.assign({ onClick: onTermsOfServiceClick }, { children: jsx(Typography, Object.assign({ variant: "body1" }, { children: 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' }) })) })) })), jsx(DivSocial, { children: socialLinks.map((social) => (jsx(ButtonIcon, Object.assign({ onClick: () => onSocialClick === null || onSocialClick === void 0 ? void 0 : onSocialClick(social.platform, social.url), "aria-label": social.ariaLabel || social.platform }, { children: jsx(AnchorLink, Object.assign({ href: social.url, onClick: (e) => e === null || e === void 0 ? void 0 : e.preventDefault() }, { children: jsx("img", { src: social.icon, alt: social.platform, height: isMobile ? '24' : '28', width: isMobile ? '24' : '28', loading: "lazy" }) })) }), social.platform))) })] }))] }, index))) }))] })), isMobile && jsx(StyledDivider, {}), isMobile && (jsx(DivBottom, { children: jsxs(DivLinks, { children: [jsx("div", Object.assign({ onClick: onPrivacyPolicyClick, style: { cursor: 'pointer' } }, { children: jsx(Typography, Object.assign({ variant: "body2" }, { children: 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' }) })) })) })), jsx(DivSep, {}), jsx("div", Object.assign({ onClick: onTermsOfServiceClick, style: { cursor: 'pointer' } }, { children: jsx(Typography, Object.assign({ variant: "body2" }, { children: 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' }) })) })) }))] }) }))] }) }));
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
const StyledDrawer$1 = styled(Drawer)(({ theme }) => ({
|
|
1438
|
+
zIndex: '1300 !important',
|
|
1439
|
+
'& .MuiDrawer-root': {
|
|
1440
|
+
zIndex: 1300,
|
|
1441
|
+
},
|
|
1442
|
+
'& .MuiDrawer-paper': {
|
|
1443
|
+
backgroundColor: '#FFFFFF',
|
|
1444
|
+
boxSizing: 'border-box',
|
|
1445
|
+
overflow: 'hidden',
|
|
1446
|
+
zIndex: 1300,
|
|
1447
|
+
},
|
|
1448
|
+
'& .MuiBackdrop-root': {
|
|
1449
|
+
zIndex: 1299,
|
|
1450
|
+
},
|
|
1451
|
+
}));
|
|
1452
|
+
const DrawerHeader$1 = styled(Box)(({ theme }) => ({
|
|
1453
|
+
display: 'flex',
|
|
1454
|
+
alignItems: 'center',
|
|
1455
|
+
justifyContent: 'flex-start',
|
|
1456
|
+
padding: '16px',
|
|
1457
|
+
minHeight: '56px',
|
|
1458
|
+
}));
|
|
1459
|
+
const DrawerContent$1 = styled(Box)(({ theme }) => ({
|
|
1460
|
+
flex: 1,
|
|
1461
|
+
overflowY: 'auto',
|
|
1462
|
+
paddingBottom: theme.spacing(2),
|
|
1463
|
+
}));
|
|
1464
|
+
const DrawerFooter = styled(Box)(({ theme }) => ({
|
|
1465
|
+
padding: '16px',
|
|
1466
|
+
backgroundColor: '#FFFFFF',
|
|
1467
|
+
borderTop: 'none',
|
|
1468
|
+
boxShadow: '0px -2px 8px rgba(0, 0, 0, 0.08)',
|
|
1469
|
+
}));
|
|
1470
|
+
styled(Button$1)(({ theme }) => ({
|
|
1471
|
+
minWidth: 'auto',
|
|
1472
|
+
padding: 0,
|
|
1473
|
+
}));
|
|
1474
|
+
const HeaderSection = styled(Box)(({ theme }) => ({
|
|
1475
|
+
backgroundColor: '#FFFFFF',
|
|
1476
|
+
padding: '16px',
|
|
1477
|
+
display: 'flex',
|
|
1478
|
+
flexDirection: 'column',
|
|
1479
|
+
gap: '12px',
|
|
1480
|
+
}));
|
|
1481
|
+
const CategoryIcon = styled(Box)(({ theme }) => ({
|
|
1482
|
+
width: '32px',
|
|
1483
|
+
height: '32px',
|
|
1484
|
+
display: 'flex',
|
|
1485
|
+
alignItems: 'center',
|
|
1486
|
+
justifyContent: 'center',
|
|
1487
|
+
}));
|
|
1488
|
+
const TitleText = styled(Typography)(({ theme }) => ({
|
|
1489
|
+
fontFamily: '"Montserrat", sans-serif',
|
|
1490
|
+
fontWeight: 700,
|
|
1491
|
+
fontSize: '20px',
|
|
1492
|
+
lineHeight: '28px',
|
|
1493
|
+
color: '#13131B',
|
|
1494
|
+
}));
|
|
1495
|
+
const SubtitleText = styled(Typography)(({ theme }) => ({
|
|
1496
|
+
fontFamily: '"Montserrat", sans-serif',
|
|
1497
|
+
fontWeight: 400,
|
|
1498
|
+
fontSize: '14px',
|
|
1499
|
+
lineHeight: '18px',
|
|
1500
|
+
color: '#5F5E62',
|
|
1501
|
+
}));
|
|
1502
|
+
const FooterButtons = styled(Box)(({ theme }) => ({
|
|
1503
|
+
display: 'flex',
|
|
1504
|
+
flexDirection: 'column',
|
|
1505
|
+
gap: '16px',
|
|
1506
|
+
width: '100%',
|
|
1507
|
+
}));
|
|
1508
|
+
// Base button styles - colors will be injected via sx prop from component
|
|
1509
|
+
const PrimaryButton = styled(Button$1)(({ theme }) => ({
|
|
1510
|
+
color: '#FFFFFF',
|
|
1511
|
+
borderRadius: '8px',
|
|
1512
|
+
height: '48px',
|
|
1513
|
+
textTransform: 'none',
|
|
1514
|
+
fontFamily: '"Montserrat", sans-serif',
|
|
1515
|
+
fontWeight: 500,
|
|
1516
|
+
fontSize: '14px',
|
|
1517
|
+
lineHeight: '18px',
|
|
1518
|
+
'&:disabled': {
|
|
1519
|
+
backgroundColor: '#C8C5CA',
|
|
1520
|
+
color: '#FFFFFF',
|
|
1521
|
+
},
|
|
1522
|
+
}));
|
|
1523
|
+
const SecondaryButton = styled(Button$1)(({ theme }) => ({
|
|
1524
|
+
borderRadius: '8px',
|
|
1525
|
+
height: '40px',
|
|
1526
|
+
textTransform: 'none',
|
|
1527
|
+
fontFamily: '"Montserrat", sans-serif',
|
|
1528
|
+
fontWeight: 500,
|
|
1529
|
+
fontSize: '14px',
|
|
1530
|
+
lineHeight: '18px',
|
|
1531
|
+
}));
|
|
1532
|
+
|
|
1533
|
+
/**
|
|
1534
|
+
* RecommendationsDrawer - Mobile drawer for recommendations and forms
|
|
1535
|
+
*
|
|
1536
|
+
* @example
|
|
1537
|
+
* ```tsx
|
|
1538
|
+
* <RecommendationsDrawer
|
|
1539
|
+
* open={isOpen}
|
|
1540
|
+
* onClose={handleClose}
|
|
1541
|
+
* title="Personalize Your Plan"
|
|
1542
|
+
* subtitle="Answer a few questions"
|
|
1543
|
+
* primaryButtonText="Next"
|
|
1544
|
+
* onPrimaryAction={handleNext}
|
|
1545
|
+
* >
|
|
1546
|
+
* <QuestionSection question="What is your budget?" />
|
|
1547
|
+
* </RecommendationsDrawer>
|
|
1548
|
+
* ```
|
|
1549
|
+
*/
|
|
1550
|
+
function RecommendationsDrawer({ open, onClose, children, headerIcon, title, subtitle, showBackButton = false, onBack, primaryButtonText, onPrimaryAction, primaryButtonDisabled = false, secondaryButtonText, onSecondaryAction, showFooter = true, customFooter, formatMessage = (descriptor) => descriptor.id, }) {
|
|
1551
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1552
|
+
const muiTheme = useTheme();
|
|
1553
|
+
useMediaQuery((_a = muiTheme === null || muiTheme === void 0 ? void 0 : muiTheme.breakpoints) === null || _a === void 0 ? void 0 : _a.down('md'));
|
|
1554
|
+
const tenantTheme = useTenantTheme();
|
|
1555
|
+
// Get primary color from tenant theme, fallback to default
|
|
1556
|
+
const primaryColor = ((_d = (_c = (_b = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme) === null || _b === void 0 ? void 0 : _b.palette) === null || _c === void 0 ? void 0 : _c.primary) === null || _d === void 0 ? void 0 : _d.main) || '#317abc';
|
|
1557
|
+
const primaryDark = ((_g = (_f = (_e = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme) === null || _e === void 0 ? void 0 : _e.palette) === null || _f === void 0 ? void 0 : _f.primary) === null || _g === void 0 ? void 0 : _g.dark) || '#2869a8';
|
|
1558
|
+
// Helper to convert hex to rgba
|
|
1559
|
+
const hexToRgba = (hex, alpha) => {
|
|
1560
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
1561
|
+
if (result) {
|
|
1562
|
+
const r = parseInt(result[1], 16);
|
|
1563
|
+
const g = parseInt(result[2], 16);
|
|
1564
|
+
const b = parseInt(result[3], 16);
|
|
1565
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
1566
|
+
}
|
|
1567
|
+
return `rgba(49, 122, 188, ${alpha})`;
|
|
1568
|
+
};
|
|
1569
|
+
const handleClose = () => {
|
|
1570
|
+
onClose();
|
|
1571
|
+
};
|
|
1572
|
+
const handleBackOrClose = () => {
|
|
1573
|
+
if (showBackButton && onBack) {
|
|
1574
|
+
onBack();
|
|
1575
|
+
}
|
|
1576
|
+
else {
|
|
1577
|
+
onClose();
|
|
1578
|
+
}
|
|
1579
|
+
};
|
|
1580
|
+
return (jsx(StyledDrawer$1, Object.assign({ anchor: "bottom", open: open, onClose: handleClose, PaperProps: {
|
|
1581
|
+
sx: {
|
|
1582
|
+
height: '95vh',
|
|
1583
|
+
borderTopLeftRadius: '16px',
|
|
1584
|
+
borderTopRightRadius: '16px',
|
|
1585
|
+
maxHeight: '95vh',
|
|
1586
|
+
},
|
|
1587
|
+
}, sx: {
|
|
1588
|
+
zIndex: 1300,
|
|
1589
|
+
} }, { children: jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: 'column', height: '100%' } }, { children: [jsx(DrawerHeader$1, { children: jsx(IconButton, Object.assign({ onClick: handleBackOrClose, sx: { padding: 0 }, "aria-label": showBackButton ? 'back' : 'close' }, { children: showBackButton ? jsx(ArrowBackIcon, {}) : jsx(CloseIcon, {}) })) }), (title || subtitle || headerIcon) && (jsxs(HeaderSection, { children: [headerIcon && (jsx(CategoryIcon, { children: jsx("img", { src: headerIcon, alt: "Category icon", width: 32, height: 32 }) })), title && (jsx(TitleText, Object.assign({ variant: "h5" }, { children: formatMessage({ id: title }) }))), subtitle && (jsx(SubtitleText, Object.assign({ variant: "body2" }, { children: formatMessage({ id: subtitle }) })))] })), jsx(DrawerContent$1, { children: children }), showFooter && (jsx(DrawerFooter, { children: customFooter ? (customFooter) : (jsxs(FooterButtons, { children: [primaryButtonText && (jsx(PrimaryButton, Object.assign({ variant: "contained", fullWidth: true, onClick: onPrimaryAction, disabled: primaryButtonDisabled, sx: {
|
|
1590
|
+
backgroundColor: primaryColor,
|
|
1591
|
+
'&:hover': {
|
|
1592
|
+
backgroundColor: primaryDark,
|
|
1593
|
+
},
|
|
1594
|
+
} }, { children: formatMessage({ id: primaryButtonText }) }))), secondaryButtonText && (jsx(SecondaryButton, Object.assign({ variant: "text", fullWidth: true, onClick: onSecondaryAction, sx: {
|
|
1595
|
+
color: primaryColor,
|
|
1596
|
+
'&:hover': {
|
|
1597
|
+
backgroundColor: hexToRgba(primaryColor, 0.08),
|
|
1598
|
+
},
|
|
1599
|
+
} }, { children: formatMessage({ id: secondaryButtonText }) })))] })) }))] })) })));
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
const StyledDrawer = styled$1(Drawer)(({ theme }) => ({
|
|
1603
|
+
zIndex: 1300,
|
|
1604
|
+
'& .MuiDrawer-paper': {
|
|
1605
|
+
borderTopLeftRadius: '8px',
|
|
1606
|
+
borderTopRightRadius: '8px',
|
|
1607
|
+
maxHeight: '90vh',
|
|
1608
|
+
},
|
|
1609
|
+
}));
|
|
1610
|
+
const DrawerContent = styled$1(Box)({
|
|
1611
|
+
display: 'flex',
|
|
1612
|
+
flexDirection: 'column',
|
|
1613
|
+
width: '100%',
|
|
1614
|
+
backgroundColor: '#ffffff',
|
|
1615
|
+
});
|
|
1616
|
+
const DrawerHeader = styled$1(Box)({
|
|
1617
|
+
display: 'flex',
|
|
1618
|
+
justifyContent: 'flex-end',
|
|
1619
|
+
alignItems: 'center',
|
|
1620
|
+
padding: '16px 16px 0',
|
|
1621
|
+
backgroundColor: '#ffffff',
|
|
1622
|
+
});
|
|
1623
|
+
const CloseButtonContainer = styled$1(Box)({
|
|
1624
|
+
width: '24px',
|
|
1625
|
+
height: '24px',
|
|
1626
|
+
});
|
|
1627
|
+
const Header = styled$1(Box)({
|
|
1628
|
+
display: 'flex',
|
|
1629
|
+
flexDirection: 'column',
|
|
1630
|
+
gap: '6px',
|
|
1631
|
+
padding: '16px',
|
|
1632
|
+
backgroundColor: '#ffffff',
|
|
1633
|
+
});
|
|
1634
|
+
const HeaderTitle = styled$1(Typography)({
|
|
1635
|
+
fontFamily: 'Montserrat, sans-serif',
|
|
1636
|
+
fontSize: '20px',
|
|
1637
|
+
fontWeight: 700,
|
|
1638
|
+
lineHeight: '28px',
|
|
1639
|
+
color: '#13131b',
|
|
1640
|
+
});
|
|
1641
|
+
const HeaderSubtitle = styled$1(Typography)({
|
|
1642
|
+
fontFamily: 'Montserrat, sans-serif',
|
|
1643
|
+
fontSize: '14px',
|
|
1644
|
+
fontWeight: 400,
|
|
1645
|
+
lineHeight: '18px',
|
|
1646
|
+
color: 'rgba(0, 0, 0, 0.6)',
|
|
1647
|
+
});
|
|
1648
|
+
const ProductsContainer = styled$1(Box)({
|
|
1649
|
+
padding: '16px',
|
|
1650
|
+
backgroundColor: '#ffffff',
|
|
1651
|
+
});
|
|
1652
|
+
const ProductsGrid = styled$1(Box)({
|
|
1653
|
+
display: 'grid',
|
|
1654
|
+
gridTemplateColumns: 'repeat(2, 1fr)',
|
|
1655
|
+
gap: '12px',
|
|
1656
|
+
});
|
|
1657
|
+
const ProductCard$1 = styled$1(Box)({
|
|
1658
|
+
display: 'flex',
|
|
1659
|
+
flexDirection: 'column',
|
|
1660
|
+
gap: '16px',
|
|
1661
|
+
backgroundColor: '#ffffff',
|
|
1662
|
+
borderRadius: '12px',
|
|
1663
|
+
boxShadow: '0px 2px 10px 0px rgba(0, 0, 0, 0.12)',
|
|
1664
|
+
padding: '16px 12px 12px',
|
|
1665
|
+
height: '168px',
|
|
1666
|
+
});
|
|
1667
|
+
const ProductInfo$1 = styled$1(Box)({
|
|
1668
|
+
display: 'flex',
|
|
1669
|
+
flexDirection: 'column',
|
|
1670
|
+
gap: '6px',
|
|
1671
|
+
alignItems: 'center',
|
|
1672
|
+
justifyContent: 'center',
|
|
1673
|
+
flex: 1,
|
|
1674
|
+
});
|
|
1675
|
+
const ProductLogo = styled$1(Box)({
|
|
1676
|
+
display: 'flex',
|
|
1677
|
+
alignItems: 'center',
|
|
1678
|
+
justifyContent: 'center',
|
|
1679
|
+
padding: '4px',
|
|
1680
|
+
});
|
|
1681
|
+
const ProductName$1 = styled$1(Typography)({
|
|
1682
|
+
fontFamily: 'Montserrat, sans-serif',
|
|
1683
|
+
fontSize: '14px',
|
|
1684
|
+
fontWeight: 700,
|
|
1685
|
+
lineHeight: '22px',
|
|
1686
|
+
color: '#13131b',
|
|
1687
|
+
textAlign: 'center',
|
|
1688
|
+
});
|
|
1689
|
+
const ProductType = styled$1(Typography)({
|
|
1690
|
+
fontFamily: 'Montserrat, sans-serif',
|
|
1691
|
+
fontSize: '12px',
|
|
1692
|
+
fontWeight: 400,
|
|
1693
|
+
lineHeight: '16px',
|
|
1694
|
+
color: '#13131b',
|
|
1695
|
+
textAlign: 'center',
|
|
1696
|
+
});
|
|
1697
|
+
// Base button styles - colors will be injected via sx prop from component
|
|
1698
|
+
const ViewPlansButton = styled$1(Button$1)({
|
|
1699
|
+
color: '#ffffff',
|
|
1700
|
+
borderRadius: '8px',
|
|
1701
|
+
height: '36px',
|
|
1702
|
+
textTransform: 'none',
|
|
1703
|
+
fontFamily: 'Montserrat, sans-serif',
|
|
1704
|
+
fontSize: '14px',
|
|
1705
|
+
fontWeight: 500,
|
|
1706
|
+
lineHeight: '18px',
|
|
1707
|
+
});
|
|
1708
|
+
|
|
1709
|
+
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', }) {
|
|
1710
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1711
|
+
const tenantTheme = useTenantTheme();
|
|
1712
|
+
// Get primary color from tenant theme, fallback to default
|
|
1713
|
+
const primaryColor = ((_c = (_b = (_a = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme) === null || _a === void 0 ? void 0 : _a.palette) === null || _b === void 0 ? void 0 : _b.primary) === null || _c === void 0 ? void 0 : _c.main) || '#317abc';
|
|
1714
|
+
const primaryDark = ((_f = (_e = (_d = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme) === null || _d === void 0 ? void 0 : _d.palette) === null || _e === void 0 ? void 0 : _e.primary) === null || _f === void 0 ? void 0 : _f.dark) || '#2869a8';
|
|
1715
|
+
const primaryDarker = '#1f5489'; // Active state
|
|
1716
|
+
return (jsx(StyledDrawer, Object.assign({ anchor: "bottom", open: open, onClose: onClose }, { children: jsxs(DrawerContent, { children: [jsx(DrawerHeader, { children: jsx(CloseButtonContainer, { children: jsx(IconButton, Object.assign({ onClick: onClose, sx: { padding: 0 } }, { children: jsx(CloseIcon, { sx: { fontSize: 24, color: '#13131b' } }) })) }) }), jsxs(Header, { children: [jsx(HeaderTitle, { children: title }), jsx(HeaderSubtitle, { children: subtitle })] }), jsx(ProductsContainer, { children: jsx(ProductsGrid, { children: products.map((product) => (jsxs(ProductCard$1, { children: [jsxs(ProductInfo$1, { children: [jsx(ProductLogo, { children: jsx("img", { src: product.logo, alt: product.name, style: {
|
|
1717
|
+
width: '88px',
|
|
1718
|
+
height: '32px',
|
|
1719
|
+
objectFit: 'cover',
|
|
1720
|
+
} }) }), jsxs(Box, Object.assign({ sx: { textAlign: 'center', width: '100%' } }, { children: [jsx(ProductName$1, { children: product.name }), jsx(ProductType, { children: product.type })] }))] }), jsx(ViewPlansButton, Object.assign({ variant: "contained", fullWidth: true, onClick: () => onProductSelect(product.id), sx: {
|
|
1721
|
+
backgroundColor: primaryColor,
|
|
1722
|
+
'&:hover': {
|
|
1723
|
+
backgroundColor: primaryDark,
|
|
1724
|
+
},
|
|
1725
|
+
'&:active': {
|
|
1726
|
+
backgroundColor: primaryDarker,
|
|
1727
|
+
},
|
|
1728
|
+
} }, { children: viewPlansButtonText }))] }, product.id))) }) })] }) })));
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1731
|
+
const QuestionContainer$1 = styled(Box)(({ theme }) => ({
|
|
1732
|
+
backgroundColor: '#FFFFFF',
|
|
1733
|
+
padding: '12px 16px',
|
|
1734
|
+
display: 'flex',
|
|
1735
|
+
flexDirection: 'column',
|
|
1736
|
+
gap: '16px',
|
|
1737
|
+
width: '100%',
|
|
1738
|
+
}));
|
|
1739
|
+
const QuestionHeader = styled(Box)(({ theme }) => ({
|
|
1740
|
+
display: 'flex',
|
|
1741
|
+
flexDirection: 'column',
|
|
1742
|
+
gap: '6px',
|
|
1743
|
+
width: '100%',
|
|
1744
|
+
}));
|
|
1745
|
+
const QuestionTitle = styled(Typography)(({ theme }) => ({
|
|
1746
|
+
fontFamily: '"Montserrat", sans-serif',
|
|
1747
|
+
fontWeight: 600,
|
|
1748
|
+
fontSize: '14px',
|
|
1749
|
+
lineHeight: '20px',
|
|
1750
|
+
color: '#13131B',
|
|
1751
|
+
}));
|
|
1752
|
+
const QuestionSubtext = styled(Typography)(({ theme }) => ({
|
|
1753
|
+
fontFamily: '"Montserrat", sans-serif',
|
|
1754
|
+
fontWeight: 400,
|
|
1755
|
+
fontSize: '12px',
|
|
1756
|
+
lineHeight: '16px',
|
|
1757
|
+
color: '#5F5E62',
|
|
1758
|
+
}));
|
|
1759
|
+
const OptionsContainer$1 = styled(Box)(({ theme }) => ({
|
|
1760
|
+
display: 'flex',
|
|
1761
|
+
flexDirection: 'column',
|
|
1762
|
+
gap: '8px',
|
|
1763
|
+
width: '100%',
|
|
1764
|
+
}));
|
|
1765
|
+
|
|
1766
|
+
/**
|
|
1767
|
+
* QuestionSection - Displays a question with selectable options
|
|
1768
|
+
*
|
|
1769
|
+
* @example
|
|
1770
|
+
* ```tsx
|
|
1771
|
+
* <QuestionSection
|
|
1772
|
+
* questionNumber="1"
|
|
1773
|
+
* question="Which plan feels right for you?"
|
|
1774
|
+
* helperText="Select one option"
|
|
1775
|
+
* options={planOptions}
|
|
1776
|
+
* selectedValue={selectedPlan}
|
|
1777
|
+
* onSelect={setSelectedPlan}
|
|
1778
|
+
* />
|
|
1779
|
+
* ```
|
|
1780
|
+
*/
|
|
1781
|
+
function QuestionSection({ questionNumber, question, helperText, options, selectedValue, onSelect, multiple = false, selectedValues = [], renderOption, formatMessage = (descriptor) => descriptor.id, }) {
|
|
1782
|
+
const isSelected = (optionValue) => {
|
|
1783
|
+
if (multiple) {
|
|
1784
|
+
return selectedValues.includes(optionValue);
|
|
1785
|
+
}
|
|
1786
|
+
return selectedValue === optionValue;
|
|
1787
|
+
};
|
|
1788
|
+
return (jsxs(QuestionContainer$1, { children: [jsxs(QuestionHeader, { children: [jsxs(QuestionTitle, Object.assign({ variant: "subtitle1" }, { children: [questionNumber && `${questionNumber}. `, formatMessage({ id: question })] })), helperText && (jsx(QuestionSubtext, Object.assign({ variant: "caption" }, { children: formatMessage({ id: helperText }) })))] }), jsx(OptionsContainer$1, { children: options.map((option) => {
|
|
1789
|
+
const selected = isSelected(option.value);
|
|
1790
|
+
if (renderOption) {
|
|
1791
|
+
return renderOption(option, selected);
|
|
1792
|
+
}
|
|
1793
|
+
// Default rendering handled by parent or OptionButton component
|
|
1794
|
+
return null;
|
|
1795
|
+
}) })] }));
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1798
|
+
const StyledOptionButton = styled(ButtonBase)(({ theme, selected, size = 'medium', fullWidth }) => {
|
|
1799
|
+
const heights = {
|
|
1800
|
+
small: '32px',
|
|
1801
|
+
medium: '40px',
|
|
1802
|
+
large: '48px',
|
|
1803
|
+
};
|
|
1804
|
+
return {
|
|
1805
|
+
height: heights[size],
|
|
1806
|
+
width: fullWidth ? '100%' : 'auto',
|
|
1807
|
+
borderRadius: '8px',
|
|
1808
|
+
border: selected
|
|
1809
|
+
? '2px solid #317ABC'
|
|
1810
|
+
: '1px solid #C8C5CA',
|
|
1811
|
+
backgroundColor: selected ? 'rgba(49, 122, 188, 0.1)' : '#FFFFFF',
|
|
1812
|
+
padding: '10px 24px',
|
|
1813
|
+
display: 'flex',
|
|
1814
|
+
alignItems: 'center',
|
|
1815
|
+
justifyContent: 'center',
|
|
1816
|
+
cursor: 'pointer',
|
|
1817
|
+
transition: 'all 0.2s ease',
|
|
1818
|
+
'&:hover': {
|
|
1819
|
+
backgroundColor: selected ? 'rgba(49, 122, 188, 0.15)' : 'rgba(0, 0, 0, 0.04)',
|
|
1820
|
+
},
|
|
1821
|
+
'&:disabled': {
|
|
1822
|
+
backgroundColor: '#F5F5F5',
|
|
1823
|
+
border: '1px solid #EEEEEE',
|
|
1824
|
+
cursor: 'not-allowed',
|
|
1825
|
+
opacity: 0.6,
|
|
1826
|
+
},
|
|
1827
|
+
};
|
|
1828
|
+
});
|
|
1829
|
+
const OptionContent = styled(Box)(({ theme }) => ({
|
|
1830
|
+
display: 'flex',
|
|
1831
|
+
alignItems: 'center',
|
|
1832
|
+
justifyContent: 'center',
|
|
1833
|
+
gap: '8px',
|
|
1834
|
+
width: '100%',
|
|
1835
|
+
}));
|
|
1836
|
+
const OptionIcon = styled('span')(({ theme }) => ({
|
|
1837
|
+
fontSize: '18px',
|
|
1838
|
+
lineHeight: 1,
|
|
1839
|
+
flexShrink: 0,
|
|
1840
|
+
}));
|
|
1841
|
+
const OptionLabel = styled(Typography)(({ theme, selected, disabled }) => ({
|
|
1842
|
+
fontFamily: '"Montserrat", sans-serif',
|
|
1843
|
+
fontWeight: selected ? 600 : 500,
|
|
1844
|
+
fontSize: '14px',
|
|
1845
|
+
lineHeight: '20px',
|
|
1846
|
+
color: disabled ? 'rgba(0, 0, 0, 0.4)' : '#13131B',
|
|
1847
|
+
textAlign: 'center',
|
|
1848
|
+
}));
|
|
1849
|
+
|
|
1850
|
+
/**
|
|
1851
|
+
* OptionButton - Selectable button for questionnaire options
|
|
1852
|
+
*
|
|
1853
|
+
* @example
|
|
1854
|
+
* ```tsx
|
|
1855
|
+
* <OptionButton
|
|
1856
|
+
* value="option1"
|
|
1857
|
+
* label="Option 1"
|
|
1858
|
+
* icon="🎯"
|
|
1859
|
+
* selected={selectedValue === 'option1'}
|
|
1860
|
+
* onClick={(value) => setSelectedValue(value)}
|
|
1861
|
+
* />
|
|
1862
|
+
* ```
|
|
1863
|
+
*/
|
|
1864
|
+
function OptionButton$1({ value, label, icon, selected = false, disabled = false, onClick, size = 'medium', fullWidth = true, formatMessage = (descriptor) => descriptor.id, }) {
|
|
1865
|
+
const handleClick = () => {
|
|
1866
|
+
if (!disabled && onClick) {
|
|
1867
|
+
onClick(value);
|
|
1868
|
+
}
|
|
1869
|
+
};
|
|
1870
|
+
return (jsx(StyledOptionButton, Object.assign({ selected: selected, disabled: disabled, onClick: handleClick, size: size, fullWidth: fullWidth }, { children: jsxs(OptionContent, { children: [icon && jsx(OptionIcon, { children: icon }), jsx(OptionLabel, Object.assign({ selected: selected, disabled: disabled, variant: "body2" }, { children: formatMessage({ id: label }) }))] }) })));
|
|
1871
|
+
}
|
|
1872
|
+
|
|
1873
|
+
const ToggleContainer$1 = styled(Box)(({ theme }) => ({
|
|
1874
|
+
backgroundColor: '#F9F9F9',
|
|
1875
|
+
borderRadius: '40px',
|
|
1876
|
+
display: 'flex',
|
|
1877
|
+
gap: '6px',
|
|
1878
|
+
height: '48px',
|
|
1879
|
+
padding: '0',
|
|
1880
|
+
width: '100%',
|
|
1881
|
+
}));
|
|
1882
|
+
const ToggleButton$1 = styled(ButtonBase)(({ theme, selected }) => ({
|
|
1883
|
+
flex: 1,
|
|
1884
|
+
display: 'flex',
|
|
1885
|
+
alignItems: 'center',
|
|
1886
|
+
justifyContent: 'center',
|
|
1887
|
+
gap: '4px',
|
|
1888
|
+
padding: '8px',
|
|
1889
|
+
borderRadius: selected ? '40px' : '104px',
|
|
1890
|
+
backgroundColor: selected ? '#00E08B' : 'transparent',
|
|
1891
|
+
transition: 'all 0.3s ease',
|
|
1892
|
+
'&:hover': {
|
|
1893
|
+
backgroundColor: selected ? '#00D080' : 'rgba(0, 0, 0, 0.04)',
|
|
1894
|
+
},
|
|
1895
|
+
}));
|
|
1896
|
+
const ToggleIcon = styled(Box)(({ theme }) => ({
|
|
1897
|
+
backgroundColor: '#FFFFFF',
|
|
1898
|
+
borderRadius: '50px',
|
|
1899
|
+
width: '32px',
|
|
1900
|
+
height: '32px',
|
|
1901
|
+
display: 'flex',
|
|
1902
|
+
alignItems: 'center',
|
|
1903
|
+
justifyContent: 'center',
|
|
1904
|
+
padding: '6px',
|
|
1905
|
+
}));
|
|
1906
|
+
const ToggleLabel = styled(Typography)(({ theme, selected }) => ({
|
|
1907
|
+
fontFamily: '"Montserrat", sans-serif',
|
|
1908
|
+
fontWeight: 600,
|
|
1909
|
+
fontSize: '14px',
|
|
1910
|
+
lineHeight: '20px',
|
|
1911
|
+
color: selected ? '#FEFBFF' : '#5F5E62',
|
|
1912
|
+
whiteSpace: 'nowrap',
|
|
1913
|
+
}));
|
|
1914
|
+
|
|
1915
|
+
/**
|
|
1916
|
+
* ToggleGroup - Segmented control for switching between options
|
|
1917
|
+
*
|
|
1918
|
+
* @example
|
|
1919
|
+
* ```tsx
|
|
1920
|
+
* <ToggleGroup
|
|
1921
|
+
* options={[
|
|
1922
|
+
* { value: 'domestic', label: 'Domestic', icon: '🏠' },
|
|
1923
|
+
* { value: 'international', label: 'International', icon: '✈️' }
|
|
1924
|
+
* ]}
|
|
1925
|
+
* value={selectedType}
|
|
1926
|
+
* onChange={setSelectedType}
|
|
1927
|
+
* />
|
|
1928
|
+
* ```
|
|
1929
|
+
*/
|
|
1930
|
+
function ToggleGroup({ options, value, onChange, formatMessage = (descriptor) => descriptor.id, }) {
|
|
1931
|
+
return (jsx(ToggleContainer$1, { children: options.map((option) => (jsxs(ToggleButton$1, Object.assign({ selected: value === option.value, onClick: () => onChange(option.value) }, { children: [option.icon && (jsx(ToggleIcon, { children: jsx("img", { src: option.icon, alt: option.label, width: 19.2, height: 19.2 }) })), jsx(ToggleLabel, Object.assign({ selected: value === option.value }, { children: formatMessage({ id: option.label }) }))] }), option.value))) }));
|
|
1932
|
+
}
|
|
1933
|
+
|
|
410
1934
|
/**
|
|
411
1935
|
* Theme Utility Functions
|
|
412
1936
|
* Helper functions for working with tenant themes
|
|
413
1937
|
*/
|
|
414
1938
|
/**
|
|
415
1939
|
* Get color value from theme palette path
|
|
416
|
-
* @param theme - Tenant theme configuration
|
|
1940
|
+
* @param theme - Tenant theme configuration (can be undefined/null for SSR)
|
|
417
1941
|
* @param path - Dot-notation path to color (e.g., 'primary.main')
|
|
418
1942
|
* @param defaultColor - Fallback color if path not found
|
|
419
1943
|
* @returns Color string
|
|
420
1944
|
*/
|
|
421
1945
|
function getThemeColor(theme, path, defaultColor = '#000000') {
|
|
1946
|
+
// Handle SSR case where theme might be undefined
|
|
1947
|
+
if (!theme || !theme.palette) {
|
|
1948
|
+
return defaultColor;
|
|
1949
|
+
}
|
|
422
1950
|
const keys = path.split('.');
|
|
423
1951
|
let value = theme.palette;
|
|
424
1952
|
for (const key of keys) {
|
|
@@ -433,15 +1961,22 @@ function getThemeColor(theme, path, defaultColor = '#000000') {
|
|
|
433
1961
|
}
|
|
434
1962
|
/**
|
|
435
1963
|
* Merge tenant theme with base MUI theme
|
|
1964
|
+
* This makes tenant theme accessible in styled components via theme parameter
|
|
436
1965
|
* @param baseTheme - Base MUI theme
|
|
437
1966
|
* @param tenantTheme - Tenant-specific theme configuration
|
|
438
1967
|
* @returns Merged theme
|
|
439
1968
|
*/
|
|
440
1969
|
function mergeTenantTheme(baseTheme, tenantTheme) {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
1970
|
+
// Merge tenant palette and typography into MUI theme
|
|
1971
|
+
const mergedPalette = Object.assign(Object.assign(Object.assign({}, baseTheme.palette), tenantTheme.palette), {
|
|
1972
|
+
// Make tenant colors accessible via theme.palette
|
|
1973
|
+
tenant: tenantTheme.palette });
|
|
1974
|
+
const mergedTypography = Object.assign(Object.assign(Object.assign({}, baseTheme.typography), tenantTheme.typography), {
|
|
1975
|
+
// Make tenant typography accessible via theme.typography
|
|
1976
|
+
tenant: tenantTheme.typography });
|
|
1977
|
+
return Object.assign(Object.assign({}, baseTheme), { palette: mergedPalette, typography: mergedTypography,
|
|
1978
|
+
// Also add tenant theme at root level for easy access
|
|
1979
|
+
tenantTheme });
|
|
445
1980
|
}
|
|
446
1981
|
/**
|
|
447
1982
|
* Create CSS variables from tenant theme
|
|
@@ -476,5 +2011,1181 @@ function createThemeCSSVariables(theme, prefix = '--tenant') {
|
|
|
476
2011
|
return variables;
|
|
477
2012
|
}
|
|
478
2013
|
|
|
479
|
-
|
|
2014
|
+
const ToggleContainer = styled(Box)(({ theme }) => {
|
|
2015
|
+
var _a, _b;
|
|
2016
|
+
return ({
|
|
2017
|
+
display: 'flex',
|
|
2018
|
+
gap: '6px',
|
|
2019
|
+
height: '48px',
|
|
2020
|
+
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',
|
|
2021
|
+
borderRadius: '40px',
|
|
2022
|
+
width: '100%',
|
|
2023
|
+
padding: '0',
|
|
2024
|
+
position: 'relative',
|
|
2025
|
+
});
|
|
2026
|
+
});
|
|
2027
|
+
const ToggleButton = styled(Box)(({ theme, active }) => {
|
|
2028
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2029
|
+
return ({
|
|
2030
|
+
flex: 1,
|
|
2031
|
+
display: 'flex',
|
|
2032
|
+
gap: '4px',
|
|
2033
|
+
alignItems: 'center',
|
|
2034
|
+
justifyContent: 'center',
|
|
2035
|
+
padding: '8px',
|
|
2036
|
+
height: '100%',
|
|
2037
|
+
borderRadius: '40px',
|
|
2038
|
+
cursor: 'pointer',
|
|
2039
|
+
backgroundColor: active
|
|
2040
|
+
? ((_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'
|
|
2041
|
+
: 'transparent',
|
|
2042
|
+
color: active
|
|
2043
|
+
? ((_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'
|
|
2044
|
+
: ((_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',
|
|
2045
|
+
transition: 'all 0.2s ease',
|
|
2046
|
+
'&:hover': {
|
|
2047
|
+
opacity: 0.9,
|
|
2048
|
+
},
|
|
2049
|
+
});
|
|
2050
|
+
});
|
|
2051
|
+
const ToggleText = styled(Typography)(({ theme }) => {
|
|
2052
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2053
|
+
return ({
|
|
2054
|
+
fontFamily: ((_a = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _a === void 0 ? void 0 : _a.fontFamily) ||
|
|
2055
|
+
"'Montserrat', sans-serif",
|
|
2056
|
+
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',
|
|
2057
|
+
fontWeight: ((_d = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _d === void 0 ? void 0 : _d.fontWeightSemiBold) || 600,
|
|
2058
|
+
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',
|
|
2059
|
+
whiteSpace: 'nowrap',
|
|
2060
|
+
});
|
|
2061
|
+
});
|
|
2062
|
+
|
|
2063
|
+
/**
|
|
2064
|
+
* BillingToggle - Toggle between monthly and annual billing
|
|
2065
|
+
*
|
|
2066
|
+
* @example
|
|
2067
|
+
* ```tsx
|
|
2068
|
+
* <BillingToggle
|
|
2069
|
+
* value={billingType}
|
|
2070
|
+
* onChange={setBillingType}
|
|
2071
|
+
* />
|
|
2072
|
+
* ```
|
|
2073
|
+
*/
|
|
2074
|
+
function BillingToggle({ value, onChange, formatMessage = (descriptor) => descriptor.defaultMessage || descriptor.id, }) {
|
|
2075
|
+
// Safely get theme, handle SSR case where it might be undefined
|
|
2076
|
+
const tenantTheme = useTenantTheme();
|
|
2077
|
+
const theme = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
2078
|
+
// Get theme colors with SSR-safe fallbacks
|
|
2079
|
+
const toggleActiveColor = getThemeColor(theme, 'ui.toggleActive', '#a4ce4e');
|
|
2080
|
+
const toggleActiveTextColor = getThemeColor(theme, 'ui.toggleActiveText', '#fefbff');
|
|
2081
|
+
const toggleInactiveTextColor = getThemeColor(theme, 'ui.toggleInactiveText', '#5f5e62');
|
|
2082
|
+
const toggleBgColor = getThemeColor(theme, 'ui.sliderBackground', '#f9f9f9');
|
|
2083
|
+
return (jsxs(ToggleContainer, Object.assign({ sx: {
|
|
2084
|
+
backgroundColor: toggleBgColor,
|
|
2085
|
+
} }, { children: [jsx(ToggleButton, Object.assign({ active: value === 'monthly', onClick: () => onChange('monthly'), sx: {
|
|
2086
|
+
backgroundColor: value === 'monthly' ? toggleActiveColor : 'transparent',
|
|
2087
|
+
color: value === 'monthly'
|
|
2088
|
+
? toggleActiveTextColor
|
|
2089
|
+
: toggleInactiveTextColor,
|
|
2090
|
+
} }, { children: jsx(ToggleText, { children: formatMessage({
|
|
2091
|
+
id: 'Billed monthly',
|
|
2092
|
+
defaultMessage: 'Billed monthly',
|
|
2093
|
+
}) }) })), jsx(ToggleButton, Object.assign({ active: value === 'annually', onClick: () => onChange('annually'), sx: {
|
|
2094
|
+
backgroundColor: value === 'annually' ? toggleActiveColor : 'transparent',
|
|
2095
|
+
color: value === 'annually'
|
|
2096
|
+
? toggleActiveTextColor
|
|
2097
|
+
: toggleInactiveTextColor,
|
|
2098
|
+
} }, { children: jsx(ToggleText, { children: formatMessage({
|
|
2099
|
+
id: 'Billed annually',
|
|
2100
|
+
defaultMessage: 'Billed annually',
|
|
2101
|
+
}) }) }))] })));
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
const CalloutContainer = styled(Box)(({ theme }) => {
|
|
2105
|
+
var _a, _b, _c, _d;
|
|
2106
|
+
return ({
|
|
2107
|
+
display: 'flex',
|
|
2108
|
+
flexDirection: 'column',
|
|
2109
|
+
gap: '8px',
|
|
2110
|
+
padding: '12px',
|
|
2111
|
+
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',
|
|
2112
|
+
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'}`,
|
|
2113
|
+
borderRadius: '8px',
|
|
2114
|
+
width: '100%',
|
|
2115
|
+
});
|
|
2116
|
+
});
|
|
2117
|
+
const CalloutHeader = styled(Box)(({ theme }) => ({
|
|
2118
|
+
display: 'flex',
|
|
2119
|
+
gap: '4px',
|
|
2120
|
+
alignItems: 'center',
|
|
2121
|
+
}));
|
|
2122
|
+
const CalloutIcon = styled(InfoIcon)(({ theme }) => {
|
|
2123
|
+
var _a, _b;
|
|
2124
|
+
return ({
|
|
2125
|
+
width: '20px',
|
|
2126
|
+
height: '20px',
|
|
2127
|
+
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',
|
|
2128
|
+
});
|
|
2129
|
+
});
|
|
2130
|
+
const CalloutTitle = styled(Typography)(({ theme }) => {
|
|
2131
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2132
|
+
return ({
|
|
2133
|
+
fontFamily: ((_a = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _a === void 0 ? void 0 : _a.fontFamily) ||
|
|
2134
|
+
"'Montserrat', sans-serif",
|
|
2135
|
+
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',
|
|
2136
|
+
fontWeight: ((_d = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _d === void 0 ? void 0 : _d.fontWeightSemiBold) || 600,
|
|
2137
|
+
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',
|
|
2138
|
+
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',
|
|
2139
|
+
});
|
|
2140
|
+
});
|
|
2141
|
+
const CalloutText = styled(Typography)(({ theme }) => {
|
|
2142
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
2143
|
+
return ({
|
|
2144
|
+
fontFamily: ((_a = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _a === void 0 ? void 0 : _a.fontFamily) ||
|
|
2145
|
+
"'Montserrat', sans-serif",
|
|
2146
|
+
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',
|
|
2147
|
+
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,
|
|
2148
|
+
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',
|
|
2149
|
+
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',
|
|
2150
|
+
});
|
|
2151
|
+
});
|
|
2152
|
+
|
|
2153
|
+
/**
|
|
2154
|
+
* InfoCallout - Displays helpful information or tips
|
|
2155
|
+
*
|
|
2156
|
+
* @example
|
|
2157
|
+
* ```tsx
|
|
2158
|
+
* <InfoCallout title="Helpful tip">
|
|
2159
|
+
* Many Malaysians aim for life protection that's at least 10–12 times their annual income
|
|
2160
|
+
* </InfoCallout>
|
|
2161
|
+
* ```
|
|
2162
|
+
*/
|
|
2163
|
+
function InfoCallout({ title = 'Helpful tip', children, formatMessage = (descriptor) => descriptor.defaultMessage || descriptor.id, }) {
|
|
2164
|
+
// Safely get theme, handle SSR case where it might be undefined
|
|
2165
|
+
const tenantTheme = useTenantTheme();
|
|
2166
|
+
const theme = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
2167
|
+
// Get theme colors with SSR-safe fallbacks
|
|
2168
|
+
const calloutBgColor = getThemeColor(theme, 'ui.calloutBackground', '#f9f9f9');
|
|
2169
|
+
const calloutBorderColor = getThemeColor(theme, 'ui.calloutBorder', '#ffffff');
|
|
2170
|
+
const textColor = getThemeColor(theme, 'natural.dim', '#13131b');
|
|
2171
|
+
const subtitleColor = getThemeColor(theme, 'natural.dark', '#5f5e62');
|
|
2172
|
+
return (jsxs(CalloutContainer, Object.assign({ sx: {
|
|
2173
|
+
backgroundColor: calloutBgColor,
|
|
2174
|
+
border: `1px solid ${calloutBorderColor}`,
|
|
2175
|
+
} }, { children: [jsxs(CalloutHeader, { children: [jsx(CalloutIcon, { sx: { color: textColor } }), jsx(CalloutTitle, Object.assign({ sx: { color: textColor } }, { children: formatMessage({
|
|
2176
|
+
id: title,
|
|
2177
|
+
defaultMessage: title,
|
|
2178
|
+
}) }))] }), jsx(CalloutText, Object.assign({ sx: { color: subtitleColor } }, { children: children }))] })));
|
|
2179
|
+
}
|
|
2180
|
+
|
|
2181
|
+
const SliderContainer = styled(Box)(({ theme }) => {
|
|
2182
|
+
var _a, _b;
|
|
2183
|
+
return ({
|
|
2184
|
+
display: 'flex',
|
|
2185
|
+
flexDirection: 'column',
|
|
2186
|
+
gap: '16px',
|
|
2187
|
+
padding: '12px',
|
|
2188
|
+
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',
|
|
2189
|
+
borderRadius: '8px',
|
|
2190
|
+
width: '100%',
|
|
2191
|
+
});
|
|
2192
|
+
});
|
|
2193
|
+
const InputSection = styled(Box)(({ theme }) => ({
|
|
2194
|
+
display: 'flex',
|
|
2195
|
+
flexDirection: 'column',
|
|
2196
|
+
gap: '8px',
|
|
2197
|
+
width: '100%',
|
|
2198
|
+
}));
|
|
2199
|
+
const InputLabel = styled(Typography)(({ theme }) => {
|
|
2200
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
2201
|
+
return ({
|
|
2202
|
+
fontFamily: ((_a = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _a === void 0 ? void 0 : _a.fontFamily) ||
|
|
2203
|
+
"'Montserrat', sans-serif",
|
|
2204
|
+
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',
|
|
2205
|
+
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,
|
|
2206
|
+
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',
|
|
2207
|
+
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',
|
|
2208
|
+
});
|
|
2209
|
+
});
|
|
2210
|
+
const InputContainer = styled(Box)(({ theme }) => {
|
|
2211
|
+
var _a, _b, _c, _d;
|
|
2212
|
+
return ({
|
|
2213
|
+
display: 'flex',
|
|
2214
|
+
gap: '24px',
|
|
2215
|
+
alignItems: 'center',
|
|
2216
|
+
justifyContent: 'center',
|
|
2217
|
+
padding: '8px 16px',
|
|
2218
|
+
height: '44px',
|
|
2219
|
+
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',
|
|
2220
|
+
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'}`,
|
|
2221
|
+
borderRadius: '8px',
|
|
2222
|
+
width: '100%',
|
|
2223
|
+
maxWidth: 'initial', // Match slider track width
|
|
2224
|
+
});
|
|
2225
|
+
});
|
|
2226
|
+
const InputValue = styled(Typography)(({ theme }) => {
|
|
2227
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
2228
|
+
return ({
|
|
2229
|
+
fontFamily: ((_a = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _a === void 0 ? void 0 : _a.fontFamily) ||
|
|
2230
|
+
"'Montserrat', sans-serif",
|
|
2231
|
+
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',
|
|
2232
|
+
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,
|
|
2233
|
+
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',
|
|
2234
|
+
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',
|
|
2235
|
+
textAlign: 'center',
|
|
2236
|
+
flex: 1,
|
|
2237
|
+
});
|
|
2238
|
+
});
|
|
2239
|
+
styled(Box)(({ theme }) => ({
|
|
2240
|
+
display: 'flex',
|
|
2241
|
+
alignItems: 'center',
|
|
2242
|
+
position: 'relative',
|
|
2243
|
+
width: '100%',
|
|
2244
|
+
maxWidth: 'initial',
|
|
2245
|
+
height: '4px',
|
|
2246
|
+
}));
|
|
2247
|
+
styled(Box)(({ theme, active }) => {
|
|
2248
|
+
var _a, _b, _c, _d;
|
|
2249
|
+
return ({
|
|
2250
|
+
height: '4px',
|
|
2251
|
+
backgroundColor: active
|
|
2252
|
+
? ((_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'
|
|
2253
|
+
: ((_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',
|
|
2254
|
+
borderRadius: '8px',
|
|
2255
|
+
width: '22px',
|
|
2256
|
+
marginRight: '-1px',
|
|
2257
|
+
});
|
|
2258
|
+
});
|
|
2259
|
+
styled(Box)(({ theme, active }) => {
|
|
2260
|
+
var _a, _b, _c, _d;
|
|
2261
|
+
return ({
|
|
2262
|
+
width: '10px',
|
|
2263
|
+
height: '10px',
|
|
2264
|
+
borderRadius: '8px',
|
|
2265
|
+
backgroundColor: active
|
|
2266
|
+
? ((_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'
|
|
2267
|
+
: ((_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',
|
|
2268
|
+
boxShadow: active ? '0px 2px 20px 4px rgba(0, 0, 0, 0.14)' : 'none',
|
|
2269
|
+
marginRight: '-1px',
|
|
2270
|
+
cursor: 'pointer',
|
|
2271
|
+
position: 'relative',
|
|
2272
|
+
zIndex: 2,
|
|
2273
|
+
'&:hover': {
|
|
2274
|
+
transform: 'scale(1.2)',
|
|
2275
|
+
transition: 'transform 0.2s ease',
|
|
2276
|
+
},
|
|
2277
|
+
});
|
|
2278
|
+
});
|
|
2279
|
+
styled(Box)(({ theme }) => ({
|
|
2280
|
+
position: 'absolute',
|
|
2281
|
+
width: '18px',
|
|
2282
|
+
height: '18px',
|
|
2283
|
+
borderRadius: '34px',
|
|
2284
|
+
backgroundColor: '#ffffff',
|
|
2285
|
+
boxShadow: '0px 2px 20px 4px rgba(0, 0, 0, 0.14)',
|
|
2286
|
+
display: 'flex',
|
|
2287
|
+
alignItems: 'center',
|
|
2288
|
+
justifyContent: 'center',
|
|
2289
|
+
top: '-21px',
|
|
2290
|
+
left: '0px',
|
|
2291
|
+
cursor: 'grab',
|
|
2292
|
+
zIndex: 10,
|
|
2293
|
+
'&:active': {
|
|
2294
|
+
cursor: 'grabbing',
|
|
2295
|
+
},
|
|
2296
|
+
}));
|
|
2297
|
+
styled(Box)(({ theme }) => {
|
|
2298
|
+
var _a, _b;
|
|
2299
|
+
return ({
|
|
2300
|
+
width: '13px',
|
|
2301
|
+
height: '10px',
|
|
2302
|
+
display: 'flex',
|
|
2303
|
+
alignItems: 'center',
|
|
2304
|
+
justifyContent: 'center',
|
|
2305
|
+
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',
|
|
2306
|
+
});
|
|
2307
|
+
});
|
|
2308
|
+
styled(Box)(({ theme }) => ({
|
|
2309
|
+
display: 'flex',
|
|
2310
|
+
justifyContent: 'space-between',
|
|
2311
|
+
width: '100%',
|
|
2312
|
+
maxWidth: 'initial', // Match slider track width
|
|
2313
|
+
}));
|
|
2314
|
+
const RangeLabel = styled(Typography)(({ theme }) => {
|
|
2315
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
2316
|
+
return ({
|
|
2317
|
+
fontFamily: ((_a = theme === null || theme === void 0 ? void 0 : theme.typography) === null || _a === void 0 ? void 0 : _a.fontFamily) ||
|
|
2318
|
+
"'Montserrat', sans-serif",
|
|
2319
|
+
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',
|
|
2320
|
+
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,
|
|
2321
|
+
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',
|
|
2322
|
+
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',
|
|
2323
|
+
});
|
|
2324
|
+
});
|
|
2325
|
+
const StyledMuiSlider = styled(Slider)(({ theme, sliderActiveColor, sliderInactiveColor }) => {
|
|
2326
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
2327
|
+
return ({
|
|
2328
|
+
width: '100%',
|
|
2329
|
+
marginBottom: '0px !important',
|
|
2330
|
+
padding: '7px 0px !important',
|
|
2331
|
+
'& .MuiSlider-markLabel': {
|
|
2332
|
+
display: 'none',
|
|
2333
|
+
},
|
|
2334
|
+
'& .MuiSlider-mark': {
|
|
2335
|
+
width: 10,
|
|
2336
|
+
height: 10,
|
|
2337
|
+
borderRadius: '50%',
|
|
2338
|
+
backgroundColor: sliderInactiveColor || ((_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.sliderInactive) || '#c8c5ca',
|
|
2339
|
+
},
|
|
2340
|
+
'& .MuiSlider-track': {
|
|
2341
|
+
height: 4,
|
|
2342
|
+
backgroundColor: sliderActiveColor || ((_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.sliderActive) || '#317abc',
|
|
2343
|
+
},
|
|
2344
|
+
'& .MuiSlider-rail': {
|
|
2345
|
+
height: 4,
|
|
2346
|
+
backgroundColor: sliderInactiveColor || ((_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.sliderInactive) || '#c8c5ca',
|
|
2347
|
+
},
|
|
2348
|
+
'& .MuiSlider-markActive': {
|
|
2349
|
+
backgroundColor: sliderActiveColor || ((_h = (_g = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _g === void 0 ? void 0 : _g.ui) === null || _h === void 0 ? void 0 : _h.sliderActive) || '#317abc',
|
|
2350
|
+
},
|
|
2351
|
+
'& .MuiSlider-thumb': {
|
|
2352
|
+
display: 'flex',
|
|
2353
|
+
justifyContent: 'center',
|
|
2354
|
+
alignItems: 'center',
|
|
2355
|
+
height: 18,
|
|
2356
|
+
width: 18,
|
|
2357
|
+
backgroundColor: '#ffffff',
|
|
2358
|
+
border: 'none',
|
|
2359
|
+
cursor: 'pointer',
|
|
2360
|
+
borderRadius: '50%',
|
|
2361
|
+
boxShadow: '0px 2px 20px 4px rgba(0, 0, 0, 0.14)',
|
|
2362
|
+
color: `${sliderActiveColor || ((_k = (_j = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _j === void 0 ? void 0 : _j.ui) === null || _k === void 0 ? void 0 : _k.sliderActive) || '#317abc'} !important`,
|
|
2363
|
+
transform: 'translate(-50%, -50%) !important',
|
|
2364
|
+
'&::before': {
|
|
2365
|
+
content: '""',
|
|
2366
|
+
width: '13px',
|
|
2367
|
+
height: '10px',
|
|
2368
|
+
backgroundImage: `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='${encodeURIComponent(sliderActiveColor || '#317abc')}'%3E%3Cpath d='M4 18h16v-2H4v2zm0-5h16v-2H4v2zm0-7v2h16V6H4z'/%3E%3C/svg%3E")`,
|
|
2369
|
+
backgroundRepeat: 'no-repeat',
|
|
2370
|
+
backgroundPosition: 'center',
|
|
2371
|
+
backgroundSize: 'contain',
|
|
2372
|
+
},
|
|
2373
|
+
'&:hover': {
|
|
2374
|
+
boxShadow: '0px 2px 20px 4px rgba(0, 0, 0, 0.2)',
|
|
2375
|
+
},
|
|
2376
|
+
'&.Mui-focusVisible': {
|
|
2377
|
+
boxShadow: '0px 2px 20px 4px rgba(0, 0, 0, 0.2)',
|
|
2378
|
+
},
|
|
2379
|
+
'&.Mui-active': {
|
|
2380
|
+
boxShadow: '0px 2px 20px 4px rgba(0, 0, 0, 0.2)',
|
|
2381
|
+
},
|
|
2382
|
+
},
|
|
2383
|
+
});
|
|
2384
|
+
});
|
|
2385
|
+
const SliderLabelsContainer = styled(Box)(({ theme }) => ({
|
|
2386
|
+
display: 'flex',
|
|
2387
|
+
justifyContent: 'space-between',
|
|
2388
|
+
width: '100%',
|
|
2389
|
+
marginTop: '6px',
|
|
2390
|
+
}));
|
|
2391
|
+
|
|
2392
|
+
/**
|
|
2393
|
+
* CoverageAmountSlider - Interactive slider for selecting coverage amounts
|
|
2394
|
+
*
|
|
2395
|
+
* @example
|
|
2396
|
+
* ```tsx
|
|
2397
|
+
* <CoverageAmountSlider
|
|
2398
|
+
* min={100000}
|
|
2399
|
+
* max={550000}
|
|
2400
|
+
* value={coverageAmount}
|
|
2401
|
+
* onChange={setCoverageAmount}
|
|
2402
|
+
* />
|
|
2403
|
+
* ```
|
|
2404
|
+
*/
|
|
2405
|
+
function CoverageAmountSlider({ min, max, value, onChange, label = 'Choose your coverage amount', steps = 5, currency = 'RM', formatCurrency: customFormatCurrency, disabled = false, }) {
|
|
2406
|
+
// Safely get theme, handle SSR case where it might be undefined
|
|
2407
|
+
const tenantTheme = useTenantTheme();
|
|
2408
|
+
const theme = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
2409
|
+
const [localValue, setLocalValue] = useState(value);
|
|
2410
|
+
const [sliderIndex, setSliderIndex] = useState(0);
|
|
2411
|
+
// Get theme colors with SSR-safe fallbacks
|
|
2412
|
+
const sliderActiveColor = getThemeColor(theme, 'ui.sliderActive', '#317abc');
|
|
2413
|
+
const sliderInactiveColor = getThemeColor(theme, 'ui.sliderInactive', '#c8c5ca');
|
|
2414
|
+
const sliderBgColor = getThemeColor(theme, 'ui.sliderBackground', '#f9f9f9');
|
|
2415
|
+
const inputBgColor = getThemeColor(theme, 'ui.inputBackground', '#ffffff');
|
|
2416
|
+
const inputBorderColor = getThemeColor(theme, 'ui.inputBorder', '#eeeeee');
|
|
2417
|
+
const textColor = getThemeColor(theme, 'natural.dim', '#13131b');
|
|
2418
|
+
const labelColor = getThemeColor(theme, 'natural.main', '#929094');
|
|
2419
|
+
// Generate slider marks/options based on min, max, and steps
|
|
2420
|
+
const { sliderMarks, stepSize, maxSliderValue, defaultSliderValue } = useMemo(() => {
|
|
2421
|
+
const stepAmount = (max - min) / (steps - 1);
|
|
2422
|
+
const marks = [];
|
|
2423
|
+
for (let i = 0; i < steps; i++) {
|
|
2424
|
+
const coverageValue = min + stepAmount * i;
|
|
2425
|
+
marks.push({
|
|
2426
|
+
value: i * 10,
|
|
2427
|
+
label: `${(coverageValue / 1000).toFixed(0)}k`,
|
|
2428
|
+
coverageVal: coverageValue,
|
|
2429
|
+
});
|
|
2430
|
+
}
|
|
2431
|
+
// Find the default slider position based on the initial value
|
|
2432
|
+
const defaultIdx = marks.findIndex((m) => m.coverageVal >= value) || 0;
|
|
2433
|
+
return {
|
|
2434
|
+
sliderMarks: marks,
|
|
2435
|
+
stepSize: 10,
|
|
2436
|
+
maxSliderValue: (steps - 1) * 10,
|
|
2437
|
+
defaultSliderValue: defaultIdx * 10,
|
|
2438
|
+
};
|
|
2439
|
+
}, [min, max, steps, value]);
|
|
2440
|
+
useEffect(() => {
|
|
2441
|
+
setLocalValue(value);
|
|
2442
|
+
// Update slider index when value changes externally
|
|
2443
|
+
const idx = sliderMarks.findIndex((m) => m.coverageVal >= value);
|
|
2444
|
+
setSliderIndex(idx >= 0 ? idx * 10 : 0);
|
|
2445
|
+
}, [value, sliderMarks]);
|
|
2446
|
+
const defaultFormatCurrency = (amount) => {
|
|
2447
|
+
return `${currency} ${amount.toLocaleString('en-US', {
|
|
2448
|
+
minimumFractionDigits: 0,
|
|
2449
|
+
maximumFractionDigits: 0,
|
|
2450
|
+
})}`;
|
|
2451
|
+
};
|
|
2452
|
+
const formatCurrency = customFormatCurrency || defaultFormatCurrency;
|
|
2453
|
+
const handleDecrease = () => {
|
|
2454
|
+
if (disabled)
|
|
2455
|
+
return;
|
|
2456
|
+
const currentIdx = sliderMarks.findIndex((m) => m.coverageVal === localValue);
|
|
2457
|
+
if (currentIdx > 0) {
|
|
2458
|
+
const newValue = sliderMarks[currentIdx - 1].coverageVal;
|
|
2459
|
+
setLocalValue(newValue);
|
|
2460
|
+
setSliderIndex((currentIdx - 1) * 10);
|
|
2461
|
+
onChange(newValue);
|
|
2462
|
+
}
|
|
2463
|
+
};
|
|
2464
|
+
const handleIncrease = () => {
|
|
2465
|
+
if (disabled)
|
|
2466
|
+
return;
|
|
2467
|
+
const currentIdx = sliderMarks.findIndex((m) => m.coverageVal === localValue);
|
|
2468
|
+
if (currentIdx < sliderMarks.length - 1) {
|
|
2469
|
+
const newValue = sliderMarks[currentIdx + 1].coverageVal;
|
|
2470
|
+
setLocalValue(newValue);
|
|
2471
|
+
setSliderIndex((currentIdx + 1) * 10);
|
|
2472
|
+
onChange(newValue);
|
|
2473
|
+
}
|
|
2474
|
+
};
|
|
2475
|
+
const handleSliderChange = (_event, newValue) => {
|
|
2476
|
+
if (disabled)
|
|
2477
|
+
return;
|
|
2478
|
+
const sliderVal = newValue;
|
|
2479
|
+
const currentMark = sliderMarks.find((opt) => opt.value === sliderVal);
|
|
2480
|
+
if (currentMark) {
|
|
2481
|
+
setSliderIndex(sliderVal);
|
|
2482
|
+
setLocalValue(currentMark.coverageVal);
|
|
2483
|
+
onChange(currentMark.coverageVal);
|
|
2484
|
+
}
|
|
2485
|
+
};
|
|
2486
|
+
return (jsxs(SliderContainer, Object.assign({ sx: {
|
|
2487
|
+
backgroundColor: sliderBgColor,
|
|
2488
|
+
} }, { children: [jsxs(InputSection, { children: [jsx(InputLabel, Object.assign({ sx: { color: textColor } }, { children: label })), jsxs(InputContainer, Object.assign({ sx: {
|
|
2489
|
+
backgroundColor: inputBgColor,
|
|
2490
|
+
border: `1px solid ${inputBorderColor}`,
|
|
2491
|
+
opacity: disabled ? 0.5 : 1,
|
|
2492
|
+
} }, { children: [jsx(IconButton, Object.assign({ onClick: handleDecrease, disabled: disabled, sx: {
|
|
2493
|
+
padding: 0,
|
|
2494
|
+
width: '24px',
|
|
2495
|
+
height: '24px',
|
|
2496
|
+
color: textColor,
|
|
2497
|
+
} }, { children: jsx(RemoveIcon, { sx: { fontSize: 24 } }) })), jsx(InputValue, Object.assign({ sx: { color: textColor } }, { children: formatCurrency(localValue) })), jsx(IconButton, Object.assign({ onClick: handleIncrease, disabled: disabled, sx: {
|
|
2498
|
+
padding: 0,
|
|
2499
|
+
width: '24px',
|
|
2500
|
+
height: '24px',
|
|
2501
|
+
color: textColor,
|
|
2502
|
+
} }, { children: jsx(AddIcon, { sx: { fontSize: 24 } }) }))] }))] }), jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: 'column', width: '100%' } }, { children: [jsx(StyledMuiSlider, { value: sliderIndex, defaultValue: defaultSliderValue, step: stepSize, min: 0, max: maxSliderValue, marks: sliderMarks, valueLabelDisplay: "off", onChange: handleSliderChange, disabled: disabled, sliderActiveColor: sliderActiveColor, sliderInactiveColor: sliderInactiveColor }), jsx(SliderLabelsContainer, { children: sliderMarks.map((mark, index) => (jsx(RangeLabel, Object.assign({ sx: {
|
|
2503
|
+
color: sliderIndex === mark.value
|
|
2504
|
+
? sliderActiveColor
|
|
2505
|
+
: labelColor,
|
|
2506
|
+
textAlign: index === 0 ? 'left' : index === sliderMarks.length - 1 ? 'right' : 'center',
|
|
2507
|
+
flex: index === 0 || index === sliderMarks.length - 1 ? 'none' : 1,
|
|
2508
|
+
} }, { children: mark.label }), index))) })] }))] })));
|
|
2509
|
+
}
|
|
2510
|
+
|
|
2511
|
+
const ProgressBarContainer = styled(Box)({
|
|
2512
|
+
display: 'flex',
|
|
2513
|
+
alignItems: 'center',
|
|
2514
|
+
gap: '8px',
|
|
2515
|
+
padding: '16px',
|
|
2516
|
+
});
|
|
2517
|
+
const ProgressBar = styled(Box)({
|
|
2518
|
+
display: 'flex',
|
|
2519
|
+
alignItems: 'center',
|
|
2520
|
+
flex: 1,
|
|
2521
|
+
height: '4px',
|
|
2522
|
+
backgroundColor: 'rgba(0, 0, 0, 0.1)',
|
|
2523
|
+
borderRadius: '2px',
|
|
2524
|
+
overflow: 'hidden',
|
|
2525
|
+
});
|
|
2526
|
+
const ProgressFill = styled(Box)(({ width, progressBarTheme }) => ({
|
|
2527
|
+
height: '100%',
|
|
2528
|
+
width: `${width}%`,
|
|
2529
|
+
background: progressBarTheme || 'linear-gradient(90deg, #0090DA 0.06%, #A4CE4E 99.94%)',
|
|
2530
|
+
transition: 'width 0.3s ease',
|
|
2531
|
+
}));
|
|
2532
|
+
const ProgressText = styled(Typography)({
|
|
2533
|
+
fontFamily: 'Montserrat',
|
|
2534
|
+
fontSize: '12px',
|
|
2535
|
+
color: '#5F5E62',
|
|
2536
|
+
fontWeight: 400,
|
|
2537
|
+
lineHeight: '16px',
|
|
2538
|
+
});
|
|
2539
|
+
|
|
2540
|
+
const CheckoutProgress = ({ currentStep, totalSteps, onBack, showBackButton = true, progressBarTheme, sx, }) => {
|
|
2541
|
+
const progressPercentage = ((currentStep + 1) / totalSteps) * 100;
|
|
2542
|
+
return (jsxs(ProgressBarContainer, Object.assign({ sx: sx }, { children: [showBackButton && onBack && (jsx(IconButton, Object.assign({ onClick: onBack, sx: { p: 0, width: '24px', height: '24px' }, "aria-label": "Go back" }, { children: jsx(ArrowBackIcon, { sx: { fontSize: '20px', color: '#13131B' } }) }))), jsx(ProgressBar, { children: jsx(ProgressFill, { width: progressPercentage, progressBarTheme: progressBarTheme }) }), jsxs(ProgressText, { children: [currentStep + 1, "/", totalSteps] })] })));
|
|
2543
|
+
};
|
|
2544
|
+
|
|
2545
|
+
const ProductCardContainer = styled(Box)(({ theme, showIndicator }) => {
|
|
2546
|
+
var _a, _b;
|
|
2547
|
+
return (Object.assign({ backgroundColor: '#fff', boxShadow: '0px 2px 10px 0px rgba(0, 0, 0, 0.12)', borderRadius: '8px', padding: '12px 20px 12px 12px', display: 'flex', gap: '4px', alignItems: 'center', position: 'relative' }, (showIndicator && {
|
|
2548
|
+
'&::before': {
|
|
2549
|
+
content: '""',
|
|
2550
|
+
position: 'absolute',
|
|
2551
|
+
left: 0,
|
|
2552
|
+
top: 0,
|
|
2553
|
+
width: '8px',
|
|
2554
|
+
height: '64px',
|
|
2555
|
+
borderRadius: '0 0 8px 8px',
|
|
2556
|
+
backgroundColor: ((_b = (_a = theme.palette) === null || _a === void 0 ? void 0 : _a.primary) === null || _b === void 0 ? void 0 : _b.main) || '#13131B',
|
|
2557
|
+
},
|
|
2558
|
+
})));
|
|
2559
|
+
});
|
|
2560
|
+
const LogoContainer = styled(Box)({
|
|
2561
|
+
width: '45px',
|
|
2562
|
+
height: '40px',
|
|
2563
|
+
border: '1.25px solid rgba(0, 0, 0, 0.1)',
|
|
2564
|
+
borderRadius: '10px',
|
|
2565
|
+
display: 'flex',
|
|
2566
|
+
alignItems: 'center',
|
|
2567
|
+
justifyContent: 'center',
|
|
2568
|
+
flexShrink: 0,
|
|
2569
|
+
marginLeft: '8px',
|
|
2570
|
+
});
|
|
2571
|
+
const ProductInfo = styled(Box)({
|
|
2572
|
+
flex: 1,
|
|
2573
|
+
marginLeft: '4px',
|
|
2574
|
+
});
|
|
2575
|
+
const ProductName = styled(Typography)({
|
|
2576
|
+
fontFamily: 'Montserrat',
|
|
2577
|
+
fontSize: '14px',
|
|
2578
|
+
fontWeight: 600,
|
|
2579
|
+
color: '#13131B',
|
|
2580
|
+
lineHeight: '20px',
|
|
2581
|
+
});
|
|
2582
|
+
const PlanName = styled(Typography)({
|
|
2583
|
+
fontFamily: 'Montserrat',
|
|
2584
|
+
fontSize: '12px',
|
|
2585
|
+
fontWeight: 400,
|
|
2586
|
+
color: '#13131B',
|
|
2587
|
+
lineHeight: '16px',
|
|
2588
|
+
});
|
|
2589
|
+
const PriceContainer = styled(Box)({
|
|
2590
|
+
display: 'flex',
|
|
2591
|
+
alignItems: 'baseline',
|
|
2592
|
+
gap: '2px',
|
|
2593
|
+
});
|
|
2594
|
+
const Price = styled(Typography)({
|
|
2595
|
+
fontFamily: 'Montserrat',
|
|
2596
|
+
fontSize: '14px',
|
|
2597
|
+
fontWeight: 600,
|
|
2598
|
+
color: '#13131B',
|
|
2599
|
+
lineHeight: '20px',
|
|
2600
|
+
});
|
|
2601
|
+
const PricePeriod = styled(Typography)({
|
|
2602
|
+
fontFamily: 'Montserrat',
|
|
2603
|
+
fontSize: '12px',
|
|
2604
|
+
fontWeight: 400,
|
|
2605
|
+
color: '#13131B',
|
|
2606
|
+
lineHeight: '16px',
|
|
2607
|
+
});
|
|
2608
|
+
|
|
2609
|
+
const ProductCard = ({ productName, planName, logoUrl, price, currency = 'RM', period = '/month', sx, showIndicator = true, }) => {
|
|
2610
|
+
return (jsxs(ProductCardContainer, Object.assign({ sx: sx, showIndicator: showIndicator }, { children: [logoUrl && (jsx(LogoContainer, { children: jsx("img", { src: logoUrl, alt: productName, style: { maxWidth: '100%', maxHeight: '100%' } }) })), jsxs(ProductInfo, { children: [jsx(ProductName, { children: productName }), planName && jsx(PlanName, { children: planName })] }), jsxs(PriceContainer, { children: [jsxs(Price, { children: [currency, " ", price] }), jsx(PricePeriod, { children: period })] })] })));
|
|
2611
|
+
};
|
|
2612
|
+
|
|
2613
|
+
const HeaderContainer = styled(Box)(({ sticky }) => (Object.assign(Object.assign({}, (sticky && {
|
|
2614
|
+
position: 'sticky',
|
|
2615
|
+
top: 0,
|
|
2616
|
+
zIndex: 1000,
|
|
2617
|
+
})), { backgroundColor: '#fff', width: '100%' })));
|
|
2618
|
+
const SectionHeader = styled(Box)({
|
|
2619
|
+
padding: '0 16px 24px',
|
|
2620
|
+
});
|
|
2621
|
+
const SectionTitle$1 = styled(Typography)({
|
|
2622
|
+
fontFamily: 'Montserrat',
|
|
2623
|
+
fontSize: '20px',
|
|
2624
|
+
fontWeight: 700,
|
|
2625
|
+
color: '#13131B',
|
|
2626
|
+
lineHeight: '28px',
|
|
2627
|
+
marginBottom: '8px',
|
|
2628
|
+
});
|
|
2629
|
+
const SectionDescription = styled(Typography)({
|
|
2630
|
+
fontFamily: 'Montserrat',
|
|
2631
|
+
fontSize: '14px',
|
|
2632
|
+
fontWeight: 400,
|
|
2633
|
+
color: '#5F5E62',
|
|
2634
|
+
lineHeight: '18px',
|
|
2635
|
+
});
|
|
2636
|
+
|
|
2637
|
+
const CheckoutHeader = ({ progress, product, sectionTitle, sectionDescription, sticky = true, progressBarTheme, sx, }) => {
|
|
2638
|
+
return (jsxs(HeaderContainer, Object.assign({ sticky: sticky, sx: sx }, { children: [jsx(CheckoutProgress, Object.assign({}, progress, { progressBarTheme: progressBarTheme })), product && (jsx(Box, Object.assign({ sx: { padding: '0 16px 24px' } }, { children: jsx(ProductCard, Object.assign({}, product)) }))), jsxs(SectionHeader, { children: [jsx(SectionTitle$1, { children: sectionTitle }), jsx(SectionDescription, { children: sectionDescription })] })] })));
|
|
2639
|
+
};
|
|
2640
|
+
|
|
2641
|
+
const ButtonContainer = styled(Box)(({ isFixed }) => ({
|
|
2642
|
+
position: isFixed ? 'fixed' : 'relative',
|
|
2643
|
+
bottom: 0,
|
|
2644
|
+
left: 0,
|
|
2645
|
+
right: 0,
|
|
2646
|
+
backgroundColor: '#fff',
|
|
2647
|
+
padding: '16px',
|
|
2648
|
+
boxShadow: isFixed ? '0px 2px 10px 0px rgba(0, 0, 0, 0.12)' : 'none',
|
|
2649
|
+
zIndex: 999,
|
|
2650
|
+
}));
|
|
2651
|
+
const StyledButton = styled('button')(({ theme, isDisabled }) => {
|
|
2652
|
+
var _a, _b, _c, _d;
|
|
2653
|
+
return ({
|
|
2654
|
+
width: '100%',
|
|
2655
|
+
height: '48px',
|
|
2656
|
+
borderRadius: '8px',
|
|
2657
|
+
border: 'none',
|
|
2658
|
+
backgroundColor: isDisabled
|
|
2659
|
+
? '#E1E2EB'
|
|
2660
|
+
: ((_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) || '#13131B',
|
|
2661
|
+
color: isDisabled ? '#929094' : '#fff',
|
|
2662
|
+
fontFamily: 'Montserrat',
|
|
2663
|
+
fontSize: '14px',
|
|
2664
|
+
fontWeight: 500,
|
|
2665
|
+
lineHeight: '18px',
|
|
2666
|
+
cursor: isDisabled ? 'not-allowed' : 'pointer',
|
|
2667
|
+
transition: 'all 0.2s ease',
|
|
2668
|
+
'&:hover': {
|
|
2669
|
+
backgroundColor: isDisabled
|
|
2670
|
+
? '#E1E2EB'
|
|
2671
|
+
: ((_d = (_c = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _c === void 0 ? void 0 : _c.primary) === null || _d === void 0 ? void 0 : _d.dark) || '#2a2a33',
|
|
2672
|
+
},
|
|
2673
|
+
});
|
|
2674
|
+
});
|
|
2675
|
+
|
|
2676
|
+
const CheckoutFormButton = ({ text = 'Next', disabled = false, onClick, fixed = true, type = 'button', sx, loading = false, }) => {
|
|
2677
|
+
return (jsx(ButtonContainer, Object.assign({ isFixed: fixed, sx: sx }, { children: jsx(StyledButton, Object.assign({ type: type, disabled: disabled || loading, isDisabled: disabled || loading, onClick: onClick }, { children: loading ? 'Processing...' : text })) })));
|
|
2678
|
+
};
|
|
2679
|
+
|
|
2680
|
+
const QuestionContainer = styled(Box)({
|
|
2681
|
+
display: 'flex',
|
|
2682
|
+
flexDirection: 'column',
|
|
2683
|
+
gap: '8px',
|
|
2684
|
+
marginBottom: '24px',
|
|
2685
|
+
});
|
|
2686
|
+
const QuestionText = styled(Typography)({
|
|
2687
|
+
fontFamily: 'Montserrat',
|
|
2688
|
+
fontSize: '14px',
|
|
2689
|
+
fontWeight: 400,
|
|
2690
|
+
color: '#13131B',
|
|
2691
|
+
lineHeight: '20px',
|
|
2692
|
+
});
|
|
2693
|
+
const OptionsContainer = styled(Box)({
|
|
2694
|
+
display: 'flex',
|
|
2695
|
+
gap: '16px',
|
|
2696
|
+
marginTop: '12px',
|
|
2697
|
+
});
|
|
2698
|
+
const OptionButton = styled(Box)(({ selected }) => ({
|
|
2699
|
+
flex: 1,
|
|
2700
|
+
height: '48px',
|
|
2701
|
+
border: `1px solid ${selected ? '#13131B' : '#929094'}`,
|
|
2702
|
+
borderRadius: '8px',
|
|
2703
|
+
display: 'flex',
|
|
2704
|
+
alignItems: 'center',
|
|
2705
|
+
justifyContent: 'center',
|
|
2706
|
+
cursor: 'pointer',
|
|
2707
|
+
backgroundColor: selected ? '#F5F5F7' : '#fff',
|
|
2708
|
+
transition: 'all 0.2s ease',
|
|
2709
|
+
'&:hover': {
|
|
2710
|
+
borderColor: '#13131B',
|
|
2711
|
+
},
|
|
2712
|
+
}));
|
|
2713
|
+
const OptionText = styled(Typography)(({ selected }) => ({
|
|
2714
|
+
fontFamily: 'Montserrat',
|
|
2715
|
+
fontSize: '14px',
|
|
2716
|
+
fontWeight: 600,
|
|
2717
|
+
color: selected ? '#13131B' : '#5F5E62',
|
|
2718
|
+
lineHeight: '20px',
|
|
2719
|
+
}));
|
|
2720
|
+
|
|
2721
|
+
const HealthQuestionGroup = ({ question, questionNumber, value, onChange, error, labels = { yes: 'Yes', no: 'No' }, sx, }) => {
|
|
2722
|
+
return (jsxs(QuestionContainer, Object.assign({ sx: sx }, { children: [jsxs(QuestionText, { children: [questionNumber && `${questionNumber}. `, question] }), jsxs(OptionsContainer, { children: [jsx(OptionButton, Object.assign({ selected: value === 'yes', onClick: () => onChange('yes'), role: "button", "aria-pressed": value === 'yes' }, { children: jsx(OptionText, Object.assign({ selected: value === 'yes' }, { children: labels.yes || 'Yes' })) })), jsx(OptionButton, Object.assign({ selected: value === 'no', onClick: () => onChange('no'), role: "button", "aria-pressed": value === 'no' }, { children: jsx(OptionText, Object.assign({ selected: value === 'no' }, { children: labels.no || 'No' })) }))] }), error && (jsx(Typography, Object.assign({ sx: {
|
|
2723
|
+
color: 'error.main',
|
|
2724
|
+
fontSize: '12px',
|
|
2725
|
+
mt: 0.5,
|
|
2726
|
+
ml: 2,
|
|
2727
|
+
} }, { children: error })))] })));
|
|
2728
|
+
};
|
|
2729
|
+
|
|
2730
|
+
const FormContainer$3 = styled(Box)({
|
|
2731
|
+
padding: '0 16px 100px',
|
|
2732
|
+
});
|
|
2733
|
+
const CheckboxContainer$1 = styled(Box)({
|
|
2734
|
+
marginTop: '12px',
|
|
2735
|
+
'& .MuiFormControlLabel-root': {
|
|
2736
|
+
alignItems: 'flex-start',
|
|
2737
|
+
marginLeft: 0,
|
|
2738
|
+
},
|
|
2739
|
+
'& .MuiCheckbox-root': {
|
|
2740
|
+
padding: '4px 8px 4px 0',
|
|
2741
|
+
},
|
|
2742
|
+
});
|
|
2743
|
+
const CheckboxLabel$1 = styled(Typography)({
|
|
2744
|
+
fontFamily: 'Montserrat',
|
|
2745
|
+
fontSize: '14px',
|
|
2746
|
+
fontWeight: 400,
|
|
2747
|
+
color: '#5F5E62',
|
|
2748
|
+
lineHeight: '18px',
|
|
2749
|
+
});
|
|
2750
|
+
|
|
2751
|
+
const PersonalInformationForm = ({ renderField, fields, consents, onSubmit, formRef, sx, }) => {
|
|
2752
|
+
const defaultBankConfirmationLabel = 'I confirm this bank account is mine and consent to AmMetLife crediting payouts to it';
|
|
2753
|
+
const defaultMarketingLabel = 'I/We consent to AmMetLife Insurance Berhad using my personal data for marketing and communication via digital platforms such as email, WhatsApp, and mobile';
|
|
2754
|
+
return (jsx(FormContainer$3, Object.assign({ ref: formRef, component: "form", onSubmit: onSubmit, sx: sx }, { children: jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: 'column', gap: '24px' } }, { children: [jsxs(Box, { children: [renderField(fields.full_name), fields.full_name.helperText && (jsx(Typography, Object.assign({ variant: "caption", sx: {
|
|
2755
|
+
display: 'block',
|
|
2756
|
+
mt: 0.5,
|
|
2757
|
+
ml: 2,
|
|
2758
|
+
color: '#5F5E62',
|
|
2759
|
+
fontSize: '12px',
|
|
2760
|
+
fontFamily: 'Montserrat',
|
|
2761
|
+
} }, { children: fields.full_name.helperText })))] }), renderField(fields.nric), renderField(fields.date_of_birth), renderField(fields.gender), renderField(fields.salutation), renderField(fields.nationality), renderField(fields.occupation), renderField(fields.industry), renderField(fields.crediting_bank_name), renderField(fields.crediting_bank_account_number), jsxs(CheckboxContainer$1, { children: [jsx(FormControlLabel, { control: jsx(Checkbox, { checked: consents.bank_account_confirmation.checked, onChange: (e) => consents.bank_account_confirmation.onChange(e.target.checked), name: "bank_account_confirmation" }), label: jsx(CheckboxLabel$1, { children: consents.bank_account_confirmation.label ||
|
|
2762
|
+
defaultBankConfirmationLabel }) }), consents.bank_account_confirmation.error && (jsx(Typography, Object.assign({ sx: {
|
|
2763
|
+
color: 'error.main',
|
|
2764
|
+
fontSize: '12px',
|
|
2765
|
+
mt: 0.5,
|
|
2766
|
+
ml: 4,
|
|
2767
|
+
} }, { children: consents.bank_account_confirmation.error })))] }), jsx(CheckboxContainer$1, { children: jsx(FormControlLabel, { control: jsx(Checkbox, { checked: consents.marketing_consent.checked, onChange: (e) => consents.marketing_consent.onChange(e.target.checked), name: "marketing_consent" }), label: jsx(CheckboxLabel$1, { children: consents.marketing_consent.label || defaultMarketingLabel }) }) })] })) })));
|
|
2768
|
+
};
|
|
2769
|
+
|
|
2770
|
+
const FormContainer$2 = styled(Box)({
|
|
2771
|
+
padding: '0 16px 100px',
|
|
2772
|
+
});
|
|
2773
|
+
const CheckboxContainer = styled(Box)({
|
|
2774
|
+
marginTop: '12px',
|
|
2775
|
+
'& .MuiFormControlLabel-root': {
|
|
2776
|
+
alignItems: 'flex-start',
|
|
2777
|
+
marginLeft: 0,
|
|
2778
|
+
},
|
|
2779
|
+
'& .MuiCheckbox-root': {
|
|
2780
|
+
padding: '4px 8px 4px 0',
|
|
2781
|
+
},
|
|
2782
|
+
});
|
|
2783
|
+
const CheckboxLabel = styled(Typography)({
|
|
2784
|
+
fontFamily: 'Montserrat',
|
|
2785
|
+
fontSize: '14px',
|
|
2786
|
+
fontWeight: 400,
|
|
2787
|
+
color: '#5F5E62',
|
|
2788
|
+
lineHeight: '18px',
|
|
2789
|
+
});
|
|
2790
|
+
|
|
2791
|
+
const ContactDetailsForm = ({ renderField, fields, mailingAddressSame, onSubmit, formRef, sx, }) => {
|
|
2792
|
+
const defaultMailingLabel = 'My mailing address is the same as residential';
|
|
2793
|
+
return (jsx(FormContainer$2, Object.assign({ ref: formRef, component: "form", onSubmit: onSubmit, sx: sx }, { children: jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: 'column', gap: '24px' } }, { children: [jsxs(Box, { children: [renderField(fields.phone_number), fields.phone_number.helperText && (jsx(Box, Object.assign({ component: "span", sx: {
|
|
2794
|
+
display: 'block',
|
|
2795
|
+
mt: 0.5,
|
|
2796
|
+
ml: 2,
|
|
2797
|
+
color: '#5F5E62',
|
|
2798
|
+
fontSize: '12px',
|
|
2799
|
+
fontFamily: 'Montserrat',
|
|
2800
|
+
} }, { children: fields.phone_number.helperText })))] }), renderField(fields.email_address), renderField(fields.residential_address), renderField(fields.postal_code), renderField(fields.city), renderField(fields.state), mailingAddressSame && (jsx(CheckboxContainer, { children: jsx(FormControlLabel, { control: jsx(Checkbox, { checked: mailingAddressSame.checked, onChange: (e) => mailingAddressSame.onChange(e.target.checked), name: "mailing_same_as_residential" }), label: jsx(CheckboxLabel, { children: mailingAddressSame.label || defaultMailingLabel }) }) }))] })) })));
|
|
2801
|
+
};
|
|
2802
|
+
|
|
2803
|
+
const FormContainer$1 = styled(Box)({
|
|
2804
|
+
padding: '0 16px 100px',
|
|
2805
|
+
});
|
|
2806
|
+
|
|
2807
|
+
const HealthInformationForm = ({ renderField, measurementFields, healthQuestions, onSubmit, formRef, sx, }) => {
|
|
2808
|
+
return (jsx(FormContainer$1, Object.assign({ ref: formRef, component: "form", onSubmit: onSubmit, sx: sx }, { children: jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: 'column', gap: '24px' } }, { children: [renderField(measurementFields.weight), renderField(measurementFields.height), healthQuestions.map((question, index) => (jsx(HealthQuestionGroup, { question: question.question, questionNumber: question.questionNumber, value: question.value, onChange: question.onChange, error: question.error, labels: question.labels }, question.name || index)))] })) })));
|
|
2809
|
+
};
|
|
2810
|
+
|
|
2811
|
+
const FormContainer = styled(Box)({
|
|
2812
|
+
padding: '0 16px 100px',
|
|
2813
|
+
});
|
|
2814
|
+
|
|
2815
|
+
const ChildInformationForm = ({ renderField, fields, onSubmit, formRef, sx, }) => {
|
|
2816
|
+
return (jsx(FormContainer, Object.assign({ ref: formRef, component: "form", onSubmit: onSubmit, sx: sx }, { children: jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: 'column', gap: '24px' } }, { children: [jsxs(Box, { children: [renderField(fields.full_name), fields.full_name.helperText && (jsx(Box, Object.assign({ component: "span", sx: {
|
|
2817
|
+
display: 'block',
|
|
2818
|
+
mt: 0.5,
|
|
2819
|
+
ml: 2,
|
|
2820
|
+
color: '#5F5E62',
|
|
2821
|
+
fontSize: '12px',
|
|
2822
|
+
fontFamily: 'Montserrat',
|
|
2823
|
+
} }, { children: fields.full_name.helperText })))] }), renderField(fields.nric), renderField(fields.date_of_birth), renderField(fields.gender), renderField(fields.nationality)] })) })));
|
|
2824
|
+
};
|
|
2825
|
+
|
|
2826
|
+
/**
|
|
2827
|
+
* FAQ Accordion Styled Components
|
|
2828
|
+
* MUI styled components for the FAQ Accordion
|
|
2829
|
+
*/
|
|
2830
|
+
const FAQContainer = styled$1(Box)(({ theme }) => ({
|
|
2831
|
+
padding: '50px 16px',
|
|
2832
|
+
display: 'flex',
|
|
2833
|
+
flexDirection: 'column',
|
|
2834
|
+
gap: '24px',
|
|
2835
|
+
alignItems: 'center',
|
|
2836
|
+
justifyContent: 'center',
|
|
2837
|
+
width: '100%',
|
|
2838
|
+
backgroundColor: '#ffffff',
|
|
2839
|
+
[theme.breakpoints.up('md')]: {
|
|
2840
|
+
padding: '64px 32px',
|
|
2841
|
+
gap: '32px',
|
|
2842
|
+
},
|
|
2843
|
+
}));
|
|
2844
|
+
const FAQTitle = styled$1(Typography)(({ theme }) => ({
|
|
2845
|
+
fontWeight: 700,
|
|
2846
|
+
fontSize: '20px',
|
|
2847
|
+
lineHeight: '28px',
|
|
2848
|
+
textAlign: 'center',
|
|
2849
|
+
width: '100%',
|
|
2850
|
+
margin: 0,
|
|
2851
|
+
[theme.breakpoints.up('md')]: {
|
|
2852
|
+
fontSize: '28px',
|
|
2853
|
+
lineHeight: '36px',
|
|
2854
|
+
},
|
|
2855
|
+
}));
|
|
2856
|
+
const StyledAccordion = styled$1(Accordion)(({ theme }) => ({
|
|
2857
|
+
backgroundColor: 'transparent',
|
|
2858
|
+
boxShadow: 'none',
|
|
2859
|
+
borderRadius: 0,
|
|
2860
|
+
'&:before': {
|
|
2861
|
+
display: 'none',
|
|
2862
|
+
},
|
|
2863
|
+
'&:not(:last-child)': {
|
|
2864
|
+
borderBottom: '1px solid rgba(0, 0, 0, 0.1)',
|
|
2865
|
+
},
|
|
2866
|
+
'&.Mui-expanded': {
|
|
2867
|
+
margin: 0,
|
|
2868
|
+
},
|
|
2869
|
+
}));
|
|
2870
|
+
const StyledAccordionSummary = styled$1(AccordionSummary)(({ theme }) => ({
|
|
2871
|
+
minHeight: '48px',
|
|
2872
|
+
padding: '12px 0',
|
|
2873
|
+
gap: '6px',
|
|
2874
|
+
'&.Mui-expanded': {
|
|
2875
|
+
minHeight: '48px',
|
|
2876
|
+
},
|
|
2877
|
+
'& .MuiAccordionSummary-content': {
|
|
2878
|
+
margin: 0,
|
|
2879
|
+
'&.Mui-expanded': {
|
|
2880
|
+
margin: 0,
|
|
2881
|
+
},
|
|
2882
|
+
},
|
|
2883
|
+
'& .MuiAccordionSummary-expandIconWrapper': {
|
|
2884
|
+
transition: 'transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms',
|
|
2885
|
+
},
|
|
2886
|
+
}));
|
|
2887
|
+
const FAQQuestion = styled$1(Typography)(({ theme }) => ({
|
|
2888
|
+
fontWeight: 600,
|
|
2889
|
+
fontSize: '14px',
|
|
2890
|
+
lineHeight: '20px',
|
|
2891
|
+
flex: 1,
|
|
2892
|
+
[theme.breakpoints.up('md')]: {
|
|
2893
|
+
fontSize: '15px',
|
|
2894
|
+
lineHeight: '22px',
|
|
2895
|
+
},
|
|
2896
|
+
}));
|
|
2897
|
+
const StyledAccordionDetails = styled$1(AccordionDetails)(({ theme }) => ({
|
|
2898
|
+
fontWeight: 400,
|
|
2899
|
+
fontSize: '14px',
|
|
2900
|
+
lineHeight: '20px',
|
|
2901
|
+
padding: '0 0 16px 0',
|
|
2902
|
+
[theme.breakpoints.up('md')]: {
|
|
2903
|
+
fontSize: '15px',
|
|
2904
|
+
lineHeight: '22px',
|
|
2905
|
+
padding: '0 0 20px 0',
|
|
2906
|
+
},
|
|
2907
|
+
}));
|
|
2908
|
+
const FAQContentWrapper = styled$1(Box)({
|
|
2909
|
+
width: '100%',
|
|
2910
|
+
});
|
|
2911
|
+
|
|
2912
|
+
/**
|
|
2913
|
+
* FAQAccordion - Displays a list of frequently asked questions in an accordion format
|
|
2914
|
+
*
|
|
2915
|
+
* @example
|
|
2916
|
+
* ```tsx
|
|
2917
|
+
* const faqs = [
|
|
2918
|
+
* { id: 'faq-1', question: 'What is this product?', answer: 'This is a great product.' },
|
|
2919
|
+
* { id: 'faq-2', question: 'How does it work?', answer: 'It works seamlessly.' },
|
|
2920
|
+
* ]
|
|
2921
|
+
*
|
|
2922
|
+
* <FAQAccordion
|
|
2923
|
+
* faqs={faqs}
|
|
2924
|
+
* title="Frequently Asked Questions"
|
|
2925
|
+
* />
|
|
2926
|
+
* ```
|
|
2927
|
+
*/
|
|
2928
|
+
function FAQAccordion({ faqs, title = 'Frequently Asked Questions', formatMessage = (descriptor) => descriptor.defaultMessage || descriptor.id, backgroundColor, maxWidth = '1128px', className, defaultExpanded, onAccordionChange, }) {
|
|
2929
|
+
const [expanded, setExpanded] = useState(defaultExpanded || false);
|
|
2930
|
+
// Safely get theme, handle SSR case where it might be undefined
|
|
2931
|
+
const tenantTheme = useTenantTheme();
|
|
2932
|
+
const theme = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
2933
|
+
// Get theme colors with SSR-safe fallbacks
|
|
2934
|
+
const textColor = getThemeColor(theme, 'natural.dim', '#13131b');
|
|
2935
|
+
const subtitleColor = getThemeColor(theme, 'natural.dark', '#5f5e62');
|
|
2936
|
+
const bgColor = backgroundColor || getThemeColor(theme, 'natural.light', '#ffffff');
|
|
2937
|
+
const handleChange = (panel) => (event, isExpanded) => {
|
|
2938
|
+
setExpanded(isExpanded ? panel : false);
|
|
2939
|
+
onAccordionChange === null || onAccordionChange === void 0 ? void 0 : onAccordionChange(panel, isExpanded);
|
|
2940
|
+
};
|
|
2941
|
+
const displayTitle = formatMessage({
|
|
2942
|
+
id: title,
|
|
2943
|
+
defaultMessage: title,
|
|
2944
|
+
});
|
|
2945
|
+
return (jsxs(FAQContainer, Object.assign({ className: className, sx: { backgroundColor: bgColor } }, { children: [jsx(FAQTitle, Object.assign({ sx: { color: textColor, maxWidth } }, { children: displayTitle })), jsx(FAQContentWrapper, Object.assign({ sx: { maxWidth } }, { children: faqs.map((faq) => (jsxs(StyledAccordion, Object.assign({ expanded: expanded === faq.id, onChange: handleChange(faq.id), disableGutters: true, elevation: 0 }, { children: [jsx(StyledAccordionSummary, Object.assign({ expandIcon: jsx(ExpandMoreIcon, { sx: { color: textColor } }), "aria-controls": `${faq.id}-content`, id: `${faq.id}-header` }, { children: jsx(FAQQuestion, Object.assign({ sx: { color: textColor } }, { children: faq.question })) })), jsx(StyledAccordionDetails, Object.assign({ sx: { color: subtitleColor } }, { children: faq.answer }))] }), faq.id))) }))] })));
|
|
2946
|
+
}
|
|
2947
|
+
|
|
2948
|
+
/**
|
|
2949
|
+
* Benefits Summary Styled Components
|
|
2950
|
+
* MUI styled components for the Benefits Summary
|
|
2951
|
+
*/
|
|
2952
|
+
const SectionContainer = styled$1(Box)(({ theme }) => ({
|
|
2953
|
+
padding: '50px 16px',
|
|
2954
|
+
display: 'flex',
|
|
2955
|
+
flexDirection: 'column',
|
|
2956
|
+
gap: '32px',
|
|
2957
|
+
alignItems: 'center',
|
|
2958
|
+
width: '100%',
|
|
2959
|
+
backgroundColor: '#ffffff',
|
|
2960
|
+
[theme.breakpoints.up('md')]: {
|
|
2961
|
+
padding: '64px 32px',
|
|
2962
|
+
gap: '40px',
|
|
2963
|
+
},
|
|
2964
|
+
}));
|
|
2965
|
+
const SectionTitle = styled$1(Typography)(({ theme }) => ({
|
|
2966
|
+
fontWeight: 700,
|
|
2967
|
+
fontSize: '20px',
|
|
2968
|
+
lineHeight: '28px',
|
|
2969
|
+
textAlign: 'center',
|
|
2970
|
+
width: '100%',
|
|
2971
|
+
margin: 0,
|
|
2972
|
+
[theme.breakpoints.up('md')]: {
|
|
2973
|
+
fontSize: '28px',
|
|
2974
|
+
lineHeight: '36px',
|
|
2975
|
+
},
|
|
2976
|
+
}));
|
|
2977
|
+
const BenefitsList = styled$1(Box)(({ theme }) => ({
|
|
2978
|
+
display: 'flex',
|
|
2979
|
+
flexDirection: 'column',
|
|
2980
|
+
gap: '16px',
|
|
2981
|
+
width: '100%',
|
|
2982
|
+
[theme.breakpoints.up('md')]: {
|
|
2983
|
+
gap: '24px',
|
|
2984
|
+
},
|
|
2985
|
+
}));
|
|
2986
|
+
const BenefitItemContainer = styled$1(Box)(({ theme }) => ({
|
|
2987
|
+
display: 'flex',
|
|
2988
|
+
gap: '12px',
|
|
2989
|
+
alignItems: 'flex-start',
|
|
2990
|
+
width: '100%',
|
|
2991
|
+
[theme.breakpoints.up('md')]: {
|
|
2992
|
+
gap: '16px',
|
|
2993
|
+
},
|
|
2994
|
+
}));
|
|
2995
|
+
const BenefitIcon = styled$1(Box)({
|
|
2996
|
+
flexShrink: 0,
|
|
2997
|
+
display: 'flex',
|
|
2998
|
+
alignItems: 'center',
|
|
2999
|
+
justifyContent: 'center',
|
|
3000
|
+
});
|
|
3001
|
+
const BenefitContent = styled$1(Box)({
|
|
3002
|
+
flex: 1,
|
|
3003
|
+
display: 'flex',
|
|
3004
|
+
flexDirection: 'column',
|
|
3005
|
+
gap: '6px',
|
|
3006
|
+
});
|
|
3007
|
+
const BenefitTitle = styled$1(Typography)(({ theme }) => ({
|
|
3008
|
+
fontWeight: 600,
|
|
3009
|
+
fontSize: '14px',
|
|
3010
|
+
lineHeight: '20px',
|
|
3011
|
+
margin: 0,
|
|
3012
|
+
[theme.breakpoints.up('md')]: {
|
|
3013
|
+
fontSize: '16px',
|
|
3014
|
+
lineHeight: '22px',
|
|
3015
|
+
},
|
|
3016
|
+
}));
|
|
3017
|
+
const BenefitDescription = styled$1(Typography)(({ theme }) => ({
|
|
3018
|
+
fontWeight: 400,
|
|
3019
|
+
fontSize: '14px',
|
|
3020
|
+
lineHeight: '18px',
|
|
3021
|
+
margin: 0,
|
|
3022
|
+
[theme.breakpoints.up('md')]: {
|
|
3023
|
+
fontSize: '15px',
|
|
3024
|
+
lineHeight: '20px',
|
|
3025
|
+
},
|
|
3026
|
+
}));
|
|
3027
|
+
|
|
3028
|
+
/**
|
|
3029
|
+
* BenefitsSummary - Displays a list of product benefits
|
|
3030
|
+
*
|
|
3031
|
+
* @example
|
|
3032
|
+
* ```tsx
|
|
3033
|
+
* const benefits = [
|
|
3034
|
+
* { id: 'benefit-1', icon: '/icons/health.svg', title: 'Death Benefit', description: '100% of Sum Assured' },
|
|
3035
|
+
* { id: 'benefit-2', icon: <HealthIcon />, title: 'TPD Coverage', description: 'Total & Permanent Disability' },
|
|
3036
|
+
* ]
|
|
3037
|
+
*
|
|
3038
|
+
* <BenefitsSummary
|
|
3039
|
+
* benefits={benefits}
|
|
3040
|
+
* title="Benefits Summary"
|
|
3041
|
+
* />
|
|
3042
|
+
* ```
|
|
3043
|
+
*/
|
|
3044
|
+
function BenefitsSummary({ benefits, title = 'Benefits Summary', formatMessage = (descriptor) => descriptor.defaultMessage || descriptor.id, backgroundColor, maxWidth = '1128px', className, iconSize = 24, }) {
|
|
3045
|
+
// Safely get theme, handle SSR case where it might be undefined
|
|
3046
|
+
const tenantTheme = useTenantTheme();
|
|
3047
|
+
const theme = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
3048
|
+
// Get theme colors with SSR-safe fallbacks
|
|
3049
|
+
const textColor = getThemeColor(theme, 'natural.dim', '#13131b');
|
|
3050
|
+
const subtitleColor = getThemeColor(theme, 'natural.dark', '#5f5e62');
|
|
3051
|
+
const bgColor = backgroundColor || getThemeColor(theme, 'natural.bright', '#ffffff');
|
|
3052
|
+
const displayTitle = formatMessage({
|
|
3053
|
+
id: title,
|
|
3054
|
+
defaultMessage: title,
|
|
3055
|
+
});
|
|
3056
|
+
const renderIcon = (icon) => {
|
|
3057
|
+
if (typeof icon === 'string') {
|
|
3058
|
+
return (jsx("img", { src: icon, alt: "", style: {
|
|
3059
|
+
width: iconSize,
|
|
3060
|
+
height: iconSize,
|
|
3061
|
+
objectFit: 'contain',
|
|
3062
|
+
} }));
|
|
3063
|
+
}
|
|
3064
|
+
return icon;
|
|
3065
|
+
};
|
|
3066
|
+
const renderDescription = (description) => {
|
|
3067
|
+
const lines = description.split('\n');
|
|
3068
|
+
return lines.map((line, index) => (jsxs(React.Fragment, { children: [line, index < lines.length - 1 && jsx("br", {})] }, index)));
|
|
3069
|
+
};
|
|
3070
|
+
return (jsxs(SectionContainer, Object.assign({ className: className, sx: { backgroundColor: bgColor } }, { children: [jsx(SectionTitle, Object.assign({ sx: { color: textColor, maxWidth } }, { children: displayTitle })), jsx(BenefitsList, Object.assign({ sx: { maxWidth } }, { children: benefits.map((benefit) => (jsxs(BenefitItemContainer, { children: [jsx(BenefitIcon, Object.assign({ sx: {
|
|
3071
|
+
width: iconSize,
|
|
3072
|
+
height: iconSize,
|
|
3073
|
+
} }, { children: renderIcon(benefit.icon) })), jsxs(BenefitContent, { children: [jsx(BenefitTitle, Object.assign({ sx: { color: textColor } }, { children: benefit.title })), jsx(BenefitDescription, Object.assign({ sx: { color: subtitleColor } }, { children: renderDescription(benefit.description) }))] })] }, benefit.id))) }))] })));
|
|
3074
|
+
}
|
|
3075
|
+
|
|
3076
|
+
/**
|
|
3077
|
+
* Asset Management Utilities
|
|
3078
|
+
* Helper functions for managing tenant-specific assets
|
|
3079
|
+
*/
|
|
3080
|
+
/**
|
|
3081
|
+
* Hook to get tenant-specific asset URL
|
|
3082
|
+
* @param assetPath - Relative path to asset within tenant folder
|
|
3083
|
+
* @returns Full path to tenant-specific asset
|
|
3084
|
+
*
|
|
3085
|
+
* @example
|
|
3086
|
+
* ```tsx
|
|
3087
|
+
* const bannerImage = useTenantAsset('promotional-banner.jpg')
|
|
3088
|
+
* <img src={bannerImage} alt="Promo" />
|
|
3089
|
+
* ```
|
|
3090
|
+
*/
|
|
3091
|
+
function useTenantAsset(assetPath) {
|
|
3092
|
+
const tenantId = useTenantId();
|
|
3093
|
+
// Return tenant-specific asset path that will be resolved at build time
|
|
3094
|
+
return `/assets/tenants/${tenantId}/${assetPath}`;
|
|
3095
|
+
}
|
|
3096
|
+
/**
|
|
3097
|
+
* Hook to get tenant logo URL
|
|
3098
|
+
* @param variant - Logo variant ('default' | 'dark' | 'alt' | 'white')
|
|
3099
|
+
* @returns Logo URL from theme configuration
|
|
3100
|
+
*
|
|
3101
|
+
* @example
|
|
3102
|
+
* ```tsx
|
|
3103
|
+
* const logo = useTenantLogo()
|
|
3104
|
+
* const darkLogo = useTenantLogo('dark')
|
|
3105
|
+
* <img src={logo} alt="Logo" />
|
|
3106
|
+
* ```
|
|
3107
|
+
*/
|
|
3108
|
+
function useTenantLogo(variant = 'default') {
|
|
3109
|
+
const tenantTheme = useTenantTheme();
|
|
3110
|
+
const theme = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
3111
|
+
// Guard against undefined theme (SSR or initialization issues)
|
|
3112
|
+
if (!theme || !theme.logo) {
|
|
3113
|
+
console.warn('useTenantLogo: Theme or logo is undefined, returning empty string');
|
|
3114
|
+
return '';
|
|
3115
|
+
}
|
|
3116
|
+
switch (variant) {
|
|
3117
|
+
case 'dark':
|
|
3118
|
+
return theme.logoDark || theme.logo;
|
|
3119
|
+
case 'alt':
|
|
3120
|
+
return theme.logoAlt || theme.logo;
|
|
3121
|
+
case 'white':
|
|
3122
|
+
return theme.logoWhite || theme.logo;
|
|
3123
|
+
default:
|
|
3124
|
+
return theme.logo;
|
|
3125
|
+
}
|
|
3126
|
+
}
|
|
3127
|
+
/**
|
|
3128
|
+
* Hook to get tenant favicon URL
|
|
3129
|
+
* @returns Favicon URL from theme configuration
|
|
3130
|
+
*
|
|
3131
|
+
* @example
|
|
3132
|
+
* ```tsx
|
|
3133
|
+
* const favicon = useTenantFavicon()
|
|
3134
|
+
* <link rel="icon" href={favicon} />
|
|
3135
|
+
* ```
|
|
3136
|
+
*/
|
|
3137
|
+
function useTenantFavicon() {
|
|
3138
|
+
const tenantTheme = useTenantTheme();
|
|
3139
|
+
const theme = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
3140
|
+
// Guard against undefined theme
|
|
3141
|
+
if (!theme || !theme.favicon) {
|
|
3142
|
+
console.warn('useTenantFavicon: Theme or favicon is undefined');
|
|
3143
|
+
return '';
|
|
3144
|
+
}
|
|
3145
|
+
return theme.favicon;
|
|
3146
|
+
}
|
|
3147
|
+
/**
|
|
3148
|
+
* Get tenant asset path (non-hook version for use outside components)
|
|
3149
|
+
* @param tenantId - Tenant identifier
|
|
3150
|
+
* @param assetPath - Relative path to asset
|
|
3151
|
+
* @returns Full asset path
|
|
3152
|
+
*/
|
|
3153
|
+
function getTenantAssetPath(tenantId, assetPath) {
|
|
3154
|
+
return `/assets/tenants/${tenantId}/${assetPath}`;
|
|
3155
|
+
}
|
|
3156
|
+
/**
|
|
3157
|
+
* Get tenant logo path (non-hook version)
|
|
3158
|
+
* @param tenantId - Tenant identifier
|
|
3159
|
+
* @param variant - Logo variant
|
|
3160
|
+
* @returns Logo path
|
|
3161
|
+
*/
|
|
3162
|
+
function getTenantLogoPath(tenantId, variant = 'default') {
|
|
3163
|
+
const variantSuffix = variant === 'default' ? '' : `-${variant}`;
|
|
3164
|
+
return `/assets/tenants/${tenantId}/logo${variantSuffix}.svg`;
|
|
3165
|
+
}
|
|
3166
|
+
|
|
3167
|
+
/**
|
|
3168
|
+
* Common UI Icons
|
|
3169
|
+
* Path references to reusable icons
|
|
3170
|
+
* Assets are copied to dist/assets folder during build
|
|
3171
|
+
*/
|
|
3172
|
+
const ICON_PATHS = {
|
|
3173
|
+
close: '/assets/icons/close.svg',
|
|
3174
|
+
arrow: '/assets/icons/arrow.svg',
|
|
3175
|
+
arrowDown: '/assets/icons/arrow-down.svg',
|
|
3176
|
+
alert: '/assets/icons/alert.svg',
|
|
3177
|
+
facebook: '/assets/icons/facebook.svg',
|
|
3178
|
+
instagram: '/assets/icons/instagram.svg',
|
|
3179
|
+
youtube: '/assets/icons/youtube.svg',
|
|
3180
|
+
};
|
|
3181
|
+
/**
|
|
3182
|
+
* Get icon path by name
|
|
3183
|
+
* @param iconName - Name of the icon
|
|
3184
|
+
* @returns Path to icon asset
|
|
3185
|
+
*/
|
|
3186
|
+
function getIconPath(iconName) {
|
|
3187
|
+
return ICON_PATHS[iconName];
|
|
3188
|
+
}
|
|
3189
|
+
|
|
3190
|
+
export { Banner, BenefitsSummary, BillingToggle, Button, Card, CheckoutFormButton, CheckoutHeader, CheckoutProgress, ChildInformationForm, ContactDetailsForm, CoverageAmountSlider, FAQAccordion, Footer, Header$1 as Header, HealthInformationForm, HealthQuestionGroup, ICON_PATHS, InfoCallout, NewHeader, OptionButton$1 as OptionButton, PersonalInformationForm, ProductCard, ProductSelectionDrawer, QuestionSection, RecommendationsDrawer, TenantThemeProvider, ToggleGroup, ammetlifeTheme, ammetlifeTypography, cimbTheme, cimbTypography, createThemeCSSVariables, getAvailableTenants, getIconPath, getTenantAssetPath, getTenantLogoPath, getTenantTheme, getTenantTypography, getThemeColor, iglooTheme, iglooTypography, isValidTenantId, mergeTenantTheme, tenantThemes, tenantTypography, useIsTenant, useTenantAsset, useTenantFavicon, useTenantId, useTenantLogo, useTenantTheme };
|
|
480
3191
|
//# sourceMappingURL=index.js.map
|