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