igloo-d2c-components 1.0.10 → 1.0.12
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 +10 -0
- package/dist/cjs/index.js +525 -101
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +517 -102
- package/dist/esm/index.js.map +1 -1
- 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 +7 -3
- package/dist/types/components/CoverageAmountSlider/styled.d.ts +9 -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/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/index.d.ts +18 -0
- package/dist/types/storybook-components/CheckoutProgress.stories.d.ts +9 -0
- package/dist/types/storybook-components/CoverageAmountSlider.stories.d.ts +1 -1
- package/dist/types/storybook-components/HealthQuestionGroup.stories.d.ts +9 -0
- package/dist/types/storybook-components/ProductCard.stories.d.ts +9 -0
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { createContext, useMemo, useContext, useState, useEffect } from 'react';
|
|
5
|
-
import { Button as Button$1, Card as Card$1, CardHeader, CardContent, CardActions, Box, Typography, Avatar, Menu, MenuItem, Drawer, IconButton, FormControlLabel, useTheme, useMediaQuery, Toolbar, Icon, RadioGroup, Radio, AppBar as AppBar$1, Divider, List, ListItem, ListItemButton, ListItemText, styled as styled$1, ButtonBase } from '@mui/material';
|
|
5
|
+
import { Button as Button$1, Card as Card$1, CardHeader, CardContent, CardActions, Box, Typography, Avatar, Menu, MenuItem, Drawer, IconButton, FormControlLabel, useTheme, useMediaQuery, Toolbar, Icon, RadioGroup, Radio, AppBar as AppBar$1, Divider, List, ListItem, ListItemButton, ListItemText, styled as styled$1, ButtonBase, Slider, Checkbox } from '@mui/material';
|
|
6
6
|
import CloseIcon from '@mui/icons-material/Close';
|
|
7
7
|
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
|
|
8
8
|
import MenuIcon from '@mui/icons-material/Menu';
|
|
@@ -12,7 +12,6 @@ import { styled } from '@mui/material/styles';
|
|
|
12
12
|
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
|
|
13
13
|
import InfoIcon from '@mui/icons-material/Info';
|
|
14
14
|
import AddIcon from '@mui/icons-material/Add';
|
|
15
|
-
import DragHandleIcon from '@mui/icons-material/DragHandle';
|
|
16
15
|
import RemoveIcon from '@mui/icons-material/Remove';
|
|
17
16
|
|
|
18
17
|
const TenantThemeContext = createContext(undefined);
|
|
@@ -395,12 +394,12 @@ const cimbTheme = {
|
|
|
395
394
|
const ammetlifeTheme = {
|
|
396
395
|
palette: {
|
|
397
396
|
primary: {
|
|
398
|
-
dark: '#
|
|
399
|
-
main: '#
|
|
397
|
+
dark: '#2869a8',
|
|
398
|
+
main: '#317abc',
|
|
400
399
|
light: '#42A5F5',
|
|
401
400
|
bright: '#90CAF9',
|
|
402
401
|
plain: '#E3F2FD',
|
|
403
|
-
border: '#
|
|
402
|
+
border: '#317abc',
|
|
404
403
|
},
|
|
405
404
|
secondary: {
|
|
406
405
|
dim: '#E65100',
|
|
@@ -938,7 +937,7 @@ const AnchorLink$1 = styled('a')(({ theme }) => ({
|
|
|
938
937
|
color: 'inherit',
|
|
939
938
|
},
|
|
940
939
|
}));
|
|
941
|
-
const StyledButton = styled(Button$1)(({ theme }) => {
|
|
940
|
+
const StyledButton$1 = styled(Button$1)(({ theme }) => {
|
|
942
941
|
var _a, _b, _c, _d;
|
|
943
942
|
return ({
|
|
944
943
|
alignSelf: 'start',
|
|
@@ -1035,7 +1034,7 @@ function Header$1({ logo, alternateLogo, showAlternateLogo = false, navigationLi
|
|
|
1035
1034
|
},
|
|
1036
1035
|
} }, { children: [shouldShowContent && (jsxs(ButtonDesktopMenu, Object.assign({ onClick: handleOpenLanguageMenu, sx: { my: 2, textTransform: 'capitalize' }, "data-testid": "selectedLocale" }, { children: [jsx(Typography, Object.assign({ variant: "h6" }, { children: formatMessage({
|
|
1037
1036
|
id: `${currentLocale === null || currentLocale === void 0 ? void 0 : currentLocale.toLocaleUpperCase()}`,
|
|
1038
|
-
}) })), jsx(Icon, { component: ArrowDropDownIcon })] }), "language")), isPartnershipPagePCView && scrolled ? (jsx(StyledButton, Object.assign({ variant: "contained", onClick: onPartnershipCTAClick }, { children: jsx(TypographyBtnText, Object.assign({ variant: "body1" }, { children: formatMessage({ id: 'Be Our Partner' }) })) }))) : isSeoPageView && scrolled && bannerData ? (jsx(StyledButtonBanner, Object.assign({ style: { background: bannerData === null || bannerData === void 0 ? void 0 : bannerData.ctaBGColor }, variant: "contained", onClick: onGetQuoteClick }, { children: jsx(Typography, Object.assign({ style: {
|
|
1037
|
+
}) })), jsx(Icon, { component: ArrowDropDownIcon })] }), "language")), isPartnershipPagePCView && scrolled ? (jsx(StyledButton$1, Object.assign({ variant: "contained", onClick: onPartnershipCTAClick }, { children: jsx(TypographyBtnText, Object.assign({ variant: "body1" }, { children: formatMessage({ id: 'Be Our Partner' }) })) }))) : isSeoPageView && scrolled && bannerData ? (jsx(StyledButtonBanner, Object.assign({ style: { background: bannerData === null || bannerData === void 0 ? void 0 : bannerData.ctaBGColor }, variant: "contained", onClick: onGetQuoteClick }, { children: jsx(Typography, Object.assign({ style: {
|
|
1039
1038
|
color: bannerData === null || bannerData === void 0 ? void 0 : bannerData.ctaTextColor,
|
|
1040
1039
|
textTransform: 'none',
|
|
1041
1040
|
}, variant: "body1" }, { children: bannerData === null || bannerData === void 0 ? void 0 : bannerData.ctaText })) }))) : userToken ? (jsx(StyledAvatar, Object.assign({ onClick: handleOpenUserMenu, "data-testid": "user-profile-avatar" }, { children: firstName1stLetter }))) : (jsxs(DivButtonWrapper, { children: [jsx(ButtonAuth, Object.assign({ color: "primary", variant: "outlined", sx: { textTransform: 'capitalize' }, onClick: onLoginClick, "data-testid": "headerLogin" }, { children: jsx(TypographyAuth, Object.assign({ variant: "body1" }, { children: formatMessage({ id: 'Log in' }) })) })), jsx(ButtonAuth, Object.assign({ color: "primary", variant: "contained", sx: { textTransform: 'capitalize' }, onClick: onSignupClick }, { children: jsx(TypographyAuth, Object.assign({ variant: "body1" }, { children: formatMessage({ id: 'Sign up' }) })) }))] }))] })), jsx(StyledMenu, Object.assign({ id: "menu-appbar", anchorEl: anchorElNav, anchorOrigin: {
|
|
@@ -1085,7 +1084,7 @@ function Header$1({ logo, alternateLogo, showAlternateLogo = false, navigationLi
|
|
|
1085
1084
|
handleOpenNavMenu(e);
|
|
1086
1085
|
}
|
|
1087
1086
|
}, color: "inherit", sx: Object.assign({}, (isPartnershipPageMobileView &&
|
|
1088
|
-
scrolled && { padding: '0px !important' })) }, { children: Boolean(anchorElNav) ? (jsx(StyledCloseIcon, {})) : isPartnershipPageMobileView && scrolled ? (jsx(StyledButton, Object.assign({ variant: "contained", onClick: onPartnershipCTAClick }, { children: jsx(TypographyBtnText, Object.assign({ variant: "body1" }, { children: formatMessage({ id: 'Be Our Partner' }) })) }))) : isSeoPageView && scrolled && bannerData ? (jsx(StyledButtonBanner, Object.assign({ style: {
|
|
1087
|
+
scrolled && { padding: '0px !important' })) }, { children: Boolean(anchorElNav) ? (jsx(StyledCloseIcon, {})) : isPartnershipPageMobileView && scrolled ? (jsx(StyledButton$1, Object.assign({ variant: "contained", onClick: onPartnershipCTAClick }, { children: jsx(TypographyBtnText, Object.assign({ variant: "body1" }, { children: formatMessage({ id: 'Be Our Partner' }) })) }))) : isSeoPageView && scrolled && bannerData ? (jsx(StyledButtonBanner, Object.assign({ style: {
|
|
1089
1088
|
background: bannerData === null || bannerData === void 0 ? void 0 : bannerData.ctaBGColor,
|
|
1090
1089
|
}, variant: "contained", onClick: onGetQuoteClick }, { children: jsx(Typography, Object.assign({ style: {
|
|
1091
1090
|
color: bannerData === null || bannerData === void 0 ? void 0 : bannerData.ctaTextColor,
|
|
@@ -1137,7 +1136,7 @@ const StyledToolbar = styled(Toolbar)(({ theme }) => ({
|
|
|
1137
1136
|
padding: '12px 16px',
|
|
1138
1137
|
},
|
|
1139
1138
|
}));
|
|
1140
|
-
const LogoContainer = styled('div')(({ theme }) => ({
|
|
1139
|
+
const LogoContainer$1 = styled('div')(({ theme }) => ({
|
|
1141
1140
|
display: 'flex',
|
|
1142
1141
|
alignItems: 'center',
|
|
1143
1142
|
cursor: 'pointer',
|
|
@@ -1234,7 +1233,7 @@ function NewHeader({ logo: propLogo, navigationLinks = [], additionalMenuSection
|
|
|
1234
1233
|
(_a = item.onClick) === null || _a === void 0 ? void 0 : _a.call(item);
|
|
1235
1234
|
handleDrawerClose();
|
|
1236
1235
|
};
|
|
1237
|
-
return (jsxs(Fragment, { children: [jsx(StyledAppBar, Object.assign({ position: "fixed" }, { children: jsxs(StyledToolbar, Object.assign({ disableGutters: true }, { children: [jsx(LogoContainer, Object.assign({ onClick: handleLogoClick }, { children: jsx(LogoImage, { src: logo, alt: "Logo" }) })), jsx(MenuIconButton, Object.assign({ size: "large", edge: "end", "aria-label": "menu", onClick: handleDrawerOpen }, { children: jsx(MenuIcon, {}) }))] })) })), jsx(StyledDrawer$2, Object.assign({ anchor: "right", open: drawerOpen, onClose: handleDrawerClose }, { children: customDrawerContent ? (jsx(Box, Object.assign({ sx: { width: isMobile ? '100vw' : 350 } }, { children: customDrawerContent }))) : (jsxs(Box, Object.assign({ sx: { width: isMobile ? '100vw' : 350 } }, { children: [jsxs(DrawerHeader$2, { children: [jsx(DrawerLogoContainer, Object.assign({ onClick: handleLogoClick }, { children: jsx(LogoImage, { src: logo, alt: "Logo" }) })), jsx(CloseIconButton, Object.assign({ onClick: handleDrawerClose, "aria-label": "close" }, { children: jsx(CloseIcon, {}) }))] }), jsx(Divider, {}), jsxs(DrawerContent$2, { children: [navigationLinks.length > 0 && (jsx(List, { children: navigationLinks.map((item) => (jsx(ListItem, Object.assign({ disablePadding: true }, { children: jsx(ListItemButton, Object.assign({ onClick: () => handleMenuItemClick(item) }, { children: jsx(ListItemText, { primary: formatMessage({ id: item.label }) }) })) }), item.key))) })), additionalMenuSections.map((section, index) => (jsxs(React.Fragment, { children: [section.title && (jsxs(Fragment, { children: [jsx(Divider, {}), jsx(Box, Object.assign({ sx: { px: 2, py: 1 } }, { children: jsx(ListItemText, { primary: formatMessage({ id: section.title }), primaryTypographyProps: {
|
|
1236
|
+
return (jsxs(Fragment, { children: [jsx(StyledAppBar, Object.assign({ position: "fixed" }, { children: jsxs(StyledToolbar, Object.assign({ disableGutters: true }, { children: [jsx(LogoContainer$1, Object.assign({ onClick: handleLogoClick }, { children: jsx(LogoImage, { src: logo, alt: "Logo" }) })), jsx(MenuIconButton, Object.assign({ size: "large", edge: "end", "aria-label": "menu", onClick: handleDrawerOpen }, { children: jsx(MenuIcon, {}) }))] })) })), jsx(StyledDrawer$2, Object.assign({ anchor: "right", open: drawerOpen, onClose: handleDrawerClose }, { children: customDrawerContent ? (jsx(Box, Object.assign({ sx: { width: isMobile ? '100vw' : 350 } }, { children: customDrawerContent }))) : (jsxs(Box, Object.assign({ sx: { width: isMobile ? '100vw' : 350 } }, { children: [jsxs(DrawerHeader$2, { children: [jsx(DrawerLogoContainer, Object.assign({ onClick: handleLogoClick }, { children: jsx(LogoImage, { src: logo, alt: "Logo" }) })), jsx(CloseIconButton, Object.assign({ onClick: handleDrawerClose, "aria-label": "close" }, { children: jsx(CloseIcon, {}) }))] }), jsx(Divider, {}), jsxs(DrawerContent$2, { children: [navigationLinks.length > 0 && (jsx(List, { children: navigationLinks.map((item) => (jsx(ListItem, Object.assign({ disablePadding: true }, { children: jsx(ListItemButton, Object.assign({ onClick: () => handleMenuItemClick(item) }, { children: jsx(ListItemText, { primary: formatMessage({ id: item.label }) }) })) }), item.key))) })), additionalMenuSections.map((section, index) => (jsxs(React.Fragment, { children: [section.title && (jsxs(Fragment, { children: [jsx(Divider, {}), jsx(Box, Object.assign({ sx: { px: 2, py: 1 } }, { children: jsx(ListItemText, { primary: formatMessage({ id: section.title }), primaryTypographyProps: {
|
|
1238
1237
|
variant: 'caption',
|
|
1239
1238
|
color: 'text.secondary',
|
|
1240
1239
|
} }) }))] })), jsx(List, { children: section.items.map((item) => (jsx(ListItem, Object.assign({ disablePadding: true }, { children: jsx(ListItemButton, Object.assign({ onClick: () => handleMenuItemClick(item) }, { children: jsx(ListItemText, { primary: formatMessage({ id: item.label }) }) })) }), item.key))) })] }, index)))] })] }))) }))] }));
|
|
@@ -1505,8 +1504,8 @@ const FooterButtons = styled(Box)(({ theme }) => ({
|
|
|
1505
1504
|
gap: '16px',
|
|
1506
1505
|
width: '100%',
|
|
1507
1506
|
}));
|
|
1507
|
+
// Base button styles - colors will be injected via sx prop from component
|
|
1508
1508
|
const PrimaryButton = styled(Button$1)(({ theme }) => ({
|
|
1509
|
-
backgroundColor: '#4E4EEB',
|
|
1510
1509
|
color: '#FFFFFF',
|
|
1511
1510
|
borderRadius: '8px',
|
|
1512
1511
|
height: '48px',
|
|
@@ -1515,16 +1514,12 @@ const PrimaryButton = styled(Button$1)(({ theme }) => ({
|
|
|
1515
1514
|
fontWeight: 500,
|
|
1516
1515
|
fontSize: '14px',
|
|
1517
1516
|
lineHeight: '18px',
|
|
1518
|
-
'&:hover': {
|
|
1519
|
-
backgroundColor: '#3E3EDB',
|
|
1520
|
-
},
|
|
1521
1517
|
'&:disabled': {
|
|
1522
1518
|
backgroundColor: '#C8C5CA',
|
|
1523
1519
|
color: '#FFFFFF',
|
|
1524
1520
|
},
|
|
1525
1521
|
}));
|
|
1526
1522
|
const SecondaryButton = styled(Button$1)(({ theme }) => ({
|
|
1527
|
-
color: '#4E4EEB',
|
|
1528
1523
|
borderRadius: '8px',
|
|
1529
1524
|
height: '40px',
|
|
1530
1525
|
textTransform: 'none',
|
|
@@ -1532,9 +1527,6 @@ const SecondaryButton = styled(Button$1)(({ theme }) => ({
|
|
|
1532
1527
|
fontWeight: 500,
|
|
1533
1528
|
fontSize: '14px',
|
|
1534
1529
|
lineHeight: '18px',
|
|
1535
|
-
'&:hover': {
|
|
1536
|
-
backgroundColor: 'rgba(78, 78, 235, 0.08)',
|
|
1537
|
-
},
|
|
1538
1530
|
}));
|
|
1539
1531
|
|
|
1540
1532
|
/**
|
|
@@ -1555,9 +1547,24 @@ const SecondaryButton = styled(Button$1)(({ theme }) => ({
|
|
|
1555
1547
|
* ```
|
|
1556
1548
|
*/
|
|
1557
1549
|
function RecommendationsDrawer({ open, onClose, children, headerIcon, title, subtitle, showBackButton = false, onBack, primaryButtonText, onPrimaryAction, primaryButtonDisabled = false, secondaryButtonText, onSecondaryAction, showFooter = true, customFooter, formatMessage = (descriptor) => descriptor.id, }) {
|
|
1558
|
-
var _a;
|
|
1550
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1559
1551
|
const muiTheme = useTheme();
|
|
1560
1552
|
useMediaQuery((_a = muiTheme === null || muiTheme === void 0 ? void 0 : muiTheme.breakpoints) === null || _a === void 0 ? void 0 : _a.down('md'));
|
|
1553
|
+
const tenantTheme = useTenantTheme();
|
|
1554
|
+
// Get primary color from tenant theme, fallback to default
|
|
1555
|
+
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';
|
|
1556
|
+
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';
|
|
1557
|
+
// Helper to convert hex to rgba
|
|
1558
|
+
const hexToRgba = (hex, alpha) => {
|
|
1559
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
1560
|
+
if (result) {
|
|
1561
|
+
const r = parseInt(result[1], 16);
|
|
1562
|
+
const g = parseInt(result[2], 16);
|
|
1563
|
+
const b = parseInt(result[3], 16);
|
|
1564
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
1565
|
+
}
|
|
1566
|
+
return `rgba(49, 122, 188, ${alpha})`;
|
|
1567
|
+
};
|
|
1561
1568
|
const handleClose = () => {
|
|
1562
1569
|
onClose();
|
|
1563
1570
|
};
|
|
@@ -1578,7 +1585,17 @@ function RecommendationsDrawer({ open, onClose, children, headerIcon, title, sub
|
|
|
1578
1585
|
},
|
|
1579
1586
|
}, sx: {
|
|
1580
1587
|
zIndex: 1300,
|
|
1581
|
-
} }, { children: jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: 'column', height: '100%' } }, { children: [jsx(DrawerHeader$1, { children: jsx(IconButton, Object.assign({ onClick: handleBackOrClose, sx: { padding: 0 }, "aria-label": showBackButton ? 'back' : 'close' }, { children: showBackButton ? jsx(ArrowBackIcon, {}) : jsx(CloseIcon, {}) })) }), (title || subtitle || headerIcon) && (jsxs(HeaderSection, { children: [headerIcon && (jsx(CategoryIcon, { children: jsx("img", { src: headerIcon, alt: "Category icon", width: 32, height: 32 }) })), title && (jsx(TitleText, Object.assign({ variant: "h5" }, { children: formatMessage({ id: title }) }))), subtitle && (jsx(SubtitleText, Object.assign({ variant: "body2" }, { children: formatMessage({ id: subtitle }) })))] })), jsx(DrawerContent$1, { children: children }), showFooter && (jsx(DrawerFooter, { children: customFooter ? (customFooter) : (jsxs(FooterButtons, { children: [primaryButtonText && (jsx(PrimaryButton, Object.assign({ variant: "contained", fullWidth: true, onClick: onPrimaryAction, disabled: primaryButtonDisabled
|
|
1588
|
+
} }, { children: jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: 'column', height: '100%' } }, { children: [jsx(DrawerHeader$1, { children: jsx(IconButton, Object.assign({ onClick: handleBackOrClose, sx: { padding: 0 }, "aria-label": showBackButton ? 'back' : 'close' }, { children: showBackButton ? jsx(ArrowBackIcon, {}) : jsx(CloseIcon, {}) })) }), (title || subtitle || headerIcon) && (jsxs(HeaderSection, { children: [headerIcon && (jsx(CategoryIcon, { children: jsx("img", { src: headerIcon, alt: "Category icon", width: 32, height: 32 }) })), title && (jsx(TitleText, Object.assign({ variant: "h5" }, { children: formatMessage({ id: title }) }))), subtitle && (jsx(SubtitleText, Object.assign({ variant: "body2" }, { children: formatMessage({ id: subtitle }) })))] })), jsx(DrawerContent$1, { children: children }), showFooter && (jsx(DrawerFooter, { children: customFooter ? (customFooter) : (jsxs(FooterButtons, { children: [primaryButtonText && (jsx(PrimaryButton, Object.assign({ variant: "contained", fullWidth: true, onClick: onPrimaryAction, disabled: primaryButtonDisabled, sx: {
|
|
1589
|
+
backgroundColor: primaryColor,
|
|
1590
|
+
'&:hover': {
|
|
1591
|
+
backgroundColor: primaryDark,
|
|
1592
|
+
},
|
|
1593
|
+
} }, { children: formatMessage({ id: primaryButtonText }) }))), secondaryButtonText && (jsx(SecondaryButton, Object.assign({ variant: "text", fullWidth: true, onClick: onSecondaryAction, sx: {
|
|
1594
|
+
color: primaryColor,
|
|
1595
|
+
'&:hover': {
|
|
1596
|
+
backgroundColor: hexToRgba(primaryColor, 0.08),
|
|
1597
|
+
},
|
|
1598
|
+
} }, { children: formatMessage({ id: secondaryButtonText }) })))] })) }))] })) })));
|
|
1582
1599
|
}
|
|
1583
1600
|
|
|
1584
1601
|
const StyledDrawer = styled$1(Drawer)(({ theme }) => ({
|
|
@@ -1636,7 +1653,7 @@ const ProductsGrid = styled$1(Box)({
|
|
|
1636
1653
|
gridTemplateColumns: 'repeat(2, 1fr)',
|
|
1637
1654
|
gap: '12px',
|
|
1638
1655
|
});
|
|
1639
|
-
const ProductCard = styled$1(Box)({
|
|
1656
|
+
const ProductCard$1 = styled$1(Box)({
|
|
1640
1657
|
display: 'flex',
|
|
1641
1658
|
flexDirection: 'column',
|
|
1642
1659
|
gap: '16px',
|
|
@@ -1646,7 +1663,7 @@ const ProductCard = styled$1(Box)({
|
|
|
1646
1663
|
padding: '16px 12px 12px',
|
|
1647
1664
|
height: '168px',
|
|
1648
1665
|
});
|
|
1649
|
-
const ProductInfo = styled$1(Box)({
|
|
1666
|
+
const ProductInfo$1 = styled$1(Box)({
|
|
1650
1667
|
display: 'flex',
|
|
1651
1668
|
flexDirection: 'column',
|
|
1652
1669
|
gap: '6px',
|
|
@@ -1660,7 +1677,7 @@ const ProductLogo = styled$1(Box)({
|
|
|
1660
1677
|
justifyContent: 'center',
|
|
1661
1678
|
padding: '4px',
|
|
1662
1679
|
});
|
|
1663
|
-
const ProductName = styled$1(Typography)({
|
|
1680
|
+
const ProductName$1 = styled$1(Typography)({
|
|
1664
1681
|
fontFamily: 'Montserrat, sans-serif',
|
|
1665
1682
|
fontSize: '14px',
|
|
1666
1683
|
fontWeight: 700,
|
|
@@ -1676,8 +1693,8 @@ const ProductType = styled$1(Typography)({
|
|
|
1676
1693
|
color: '#13131b',
|
|
1677
1694
|
textAlign: 'center',
|
|
1678
1695
|
});
|
|
1696
|
+
// Base button styles - colors will be injected via sx prop from component
|
|
1679
1697
|
const ViewPlansButton = styled$1(Button$1)({
|
|
1680
|
-
backgroundColor: '#317abc',
|
|
1681
1698
|
color: '#ffffff',
|
|
1682
1699
|
borderRadius: '8px',
|
|
1683
1700
|
height: '36px',
|
|
@@ -1686,23 +1703,31 @@ const ViewPlansButton = styled$1(Button$1)({
|
|
|
1686
1703
|
fontSize: '14px',
|
|
1687
1704
|
fontWeight: 500,
|
|
1688
1705
|
lineHeight: '18px',
|
|
1689
|
-
'&:hover': {
|
|
1690
|
-
backgroundColor: '#2869a8',
|
|
1691
|
-
},
|
|
1692
|
-
'&:active': {
|
|
1693
|
-
backgroundColor: '#1f5489',
|
|
1694
|
-
},
|
|
1695
1706
|
});
|
|
1696
1707
|
|
|
1697
1708
|
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', }) {
|
|
1698
|
-
|
|
1709
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1710
|
+
const tenantTheme = useTenantTheme();
|
|
1711
|
+
// Get primary color from tenant theme, fallback to default
|
|
1712
|
+
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';
|
|
1713
|
+
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';
|
|
1714
|
+
const primaryDarker = '#1f5489'; // Active state
|
|
1715
|
+
return (jsx(StyledDrawer, Object.assign({ anchor: "bottom", open: open, onClose: onClose }, { children: jsxs(DrawerContent, { children: [jsx(DrawerHeader, { children: jsx(CloseButtonContainer, { children: jsx(IconButton, Object.assign({ onClick: onClose, sx: { padding: 0 } }, { children: jsx(CloseIcon, { sx: { fontSize: 24, color: '#13131b' } }) })) }) }), jsxs(Header, { children: [jsx(HeaderTitle, { children: title }), jsx(HeaderSubtitle, { children: subtitle })] }), jsx(ProductsContainer, { children: jsx(ProductsGrid, { children: products.map((product) => (jsxs(ProductCard$1, { children: [jsxs(ProductInfo$1, { children: [jsx(ProductLogo, { children: jsx("img", { src: product.logo, alt: product.name, style: {
|
|
1699
1716
|
width: '88px',
|
|
1700
1717
|
height: '32px',
|
|
1701
1718
|
objectFit: 'cover',
|
|
1702
|
-
} }) }), jsxs(Box, Object.assign({ sx: { textAlign: 'center', width: '100%' } }, { children: [jsx(ProductName, { children: product.name }), jsx(ProductType, { children: product.type })] }))] }), jsx(ViewPlansButton, Object.assign({ variant: "contained", fullWidth: true, onClick: () => onProductSelect(product.id)
|
|
1719
|
+
} }) }), jsxs(Box, Object.assign({ sx: { textAlign: 'center', width: '100%' } }, { children: [jsx(ProductName$1, { children: product.name }), jsx(ProductType, { children: product.type })] }))] }), jsx(ViewPlansButton, Object.assign({ variant: "contained", fullWidth: true, onClick: () => onProductSelect(product.id), sx: {
|
|
1720
|
+
backgroundColor: primaryColor,
|
|
1721
|
+
'&:hover': {
|
|
1722
|
+
backgroundColor: primaryDark,
|
|
1723
|
+
},
|
|
1724
|
+
'&:active': {
|
|
1725
|
+
backgroundColor: primaryDarker,
|
|
1726
|
+
},
|
|
1727
|
+
} }, { children: viewPlansButtonText }))] }, product.id))) }) })] }) })));
|
|
1703
1728
|
}
|
|
1704
1729
|
|
|
1705
|
-
const QuestionContainer = styled(Box)(({ theme }) => ({
|
|
1730
|
+
const QuestionContainer$1 = styled(Box)(({ theme }) => ({
|
|
1706
1731
|
backgroundColor: '#FFFFFF',
|
|
1707
1732
|
padding: '12px 16px',
|
|
1708
1733
|
display: 'flex',
|
|
@@ -1730,7 +1755,7 @@ const QuestionSubtext = styled(Typography)(({ theme }) => ({
|
|
|
1730
1755
|
lineHeight: '16px',
|
|
1731
1756
|
color: '#5F5E62',
|
|
1732
1757
|
}));
|
|
1733
|
-
const OptionsContainer = styled(Box)(({ theme }) => ({
|
|
1758
|
+
const OptionsContainer$1 = styled(Box)(({ theme }) => ({
|
|
1734
1759
|
display: 'flex',
|
|
1735
1760
|
flexDirection: 'column',
|
|
1736
1761
|
gap: '8px',
|
|
@@ -1759,7 +1784,7 @@ function QuestionSection({ questionNumber, question, helperText, options, select
|
|
|
1759
1784
|
}
|
|
1760
1785
|
return selectedValue === optionValue;
|
|
1761
1786
|
};
|
|
1762
|
-
return (jsxs(QuestionContainer, { children: [jsxs(QuestionHeader, { children: [jsxs(QuestionTitle, Object.assign({ variant: "subtitle1" }, { children: [questionNumber && `${questionNumber}. `, formatMessage({ id: question })] })), helperText && (jsx(QuestionSubtext, Object.assign({ variant: "caption" }, { children: formatMessage({ id: helperText }) })))] }), jsx(OptionsContainer, { children: options.map((option) => {
|
|
1787
|
+
return (jsxs(QuestionContainer$1, { children: [jsxs(QuestionHeader, { children: [jsxs(QuestionTitle, Object.assign({ variant: "subtitle1" }, { children: [questionNumber && `${questionNumber}. `, formatMessage({ id: question })] })), helperText && (jsx(QuestionSubtext, Object.assign({ variant: "caption" }, { children: formatMessage({ id: helperText }) })))] }), jsx(OptionsContainer$1, { children: options.map((option) => {
|
|
1763
1788
|
const selected = isSelected(option.value);
|
|
1764
1789
|
if (renderOption) {
|
|
1765
1790
|
return renderOption(option, selected);
|
|
@@ -1835,7 +1860,7 @@ const OptionLabel = styled(Typography)(({ theme, selected, disabled }) => ({
|
|
|
1835
1860
|
* />
|
|
1836
1861
|
* ```
|
|
1837
1862
|
*/
|
|
1838
|
-
function OptionButton({ value, label, icon, selected = false, disabled = false, onClick, size = 'medium', fullWidth = true, formatMessage = (descriptor) => descriptor.id, }) {
|
|
1863
|
+
function OptionButton$1({ value, label, icon, selected = false, disabled = false, onClick, size = 'medium', fullWidth = true, formatMessage = (descriptor) => descriptor.id, }) {
|
|
1839
1864
|
const handleClick = () => {
|
|
1840
1865
|
if (!disabled && onClick) {
|
|
1841
1866
|
onClick(value);
|
|
@@ -2194,7 +2219,7 @@ const InputContainer = styled(Box)(({ theme }) => {
|
|
|
2194
2219
|
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'}`,
|
|
2195
2220
|
borderRadius: '8px',
|
|
2196
2221
|
width: '100%',
|
|
2197
|
-
maxWidth: '
|
|
2222
|
+
maxWidth: 'initial', // Match slider track width
|
|
2198
2223
|
});
|
|
2199
2224
|
});
|
|
2200
2225
|
const InputValue = styled(Typography)(({ theme }) => {
|
|
@@ -2210,15 +2235,15 @@ const InputValue = styled(Typography)(({ theme }) => {
|
|
|
2210
2235
|
flex: 1,
|
|
2211
2236
|
});
|
|
2212
2237
|
});
|
|
2213
|
-
|
|
2238
|
+
styled(Box)(({ theme }) => ({
|
|
2214
2239
|
display: 'flex',
|
|
2215
2240
|
alignItems: 'center',
|
|
2216
2241
|
position: 'relative',
|
|
2217
2242
|
width: '100%',
|
|
2218
|
-
maxWidth: '
|
|
2243
|
+
maxWidth: 'initial',
|
|
2219
2244
|
height: '4px',
|
|
2220
2245
|
}));
|
|
2221
|
-
|
|
2246
|
+
styled(Box)(({ theme, active }) => {
|
|
2222
2247
|
var _a, _b, _c, _d;
|
|
2223
2248
|
return ({
|
|
2224
2249
|
height: '4px',
|
|
@@ -2230,7 +2255,7 @@ const SliderSegment = styled(Box)(({ theme, active }) => {
|
|
|
2230
2255
|
marginRight: '-1px',
|
|
2231
2256
|
});
|
|
2232
2257
|
});
|
|
2233
|
-
|
|
2258
|
+
styled(Box)(({ theme, active }) => {
|
|
2234
2259
|
var _a, _b, _c, _d;
|
|
2235
2260
|
return ({
|
|
2236
2261
|
width: '10px',
|
|
@@ -2250,7 +2275,7 @@ const SliderDot = styled(Box)(({ theme, active }) => {
|
|
|
2250
2275
|
},
|
|
2251
2276
|
});
|
|
2252
2277
|
});
|
|
2253
|
-
|
|
2278
|
+
styled(Box)(({ theme }) => ({
|
|
2254
2279
|
position: 'absolute',
|
|
2255
2280
|
width: '18px',
|
|
2256
2281
|
height: '18px',
|
|
@@ -2268,7 +2293,7 @@ const SliderThumb = styled(Box)(({ theme }) => ({
|
|
|
2268
2293
|
cursor: 'grabbing',
|
|
2269
2294
|
},
|
|
2270
2295
|
}));
|
|
2271
|
-
|
|
2296
|
+
styled(Box)(({ theme }) => {
|
|
2272
2297
|
var _a, _b;
|
|
2273
2298
|
return ({
|
|
2274
2299
|
width: '13px',
|
|
@@ -2279,11 +2304,11 @@ const ThumbIcon = styled(Box)(({ theme }) => {
|
|
|
2279
2304
|
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',
|
|
2280
2305
|
});
|
|
2281
2306
|
});
|
|
2282
|
-
|
|
2307
|
+
styled(Box)(({ theme }) => ({
|
|
2283
2308
|
display: 'flex',
|
|
2284
2309
|
justifyContent: 'space-between',
|
|
2285
2310
|
width: '100%',
|
|
2286
|
-
maxWidth: '
|
|
2311
|
+
maxWidth: 'initial', // Match slider track width
|
|
2287
2312
|
}));
|
|
2288
2313
|
const RangeLabel = styled(Typography)(({ theme }) => {
|
|
2289
2314
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
@@ -2296,6 +2321,72 @@ const RangeLabel = styled(Typography)(({ theme }) => {
|
|
|
2296
2321
|
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',
|
|
2297
2322
|
});
|
|
2298
2323
|
});
|
|
2324
|
+
const StyledMuiSlider = styled(Slider)(({ theme, sliderActiveColor, sliderInactiveColor }) => {
|
|
2325
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
2326
|
+
return ({
|
|
2327
|
+
width: '100%',
|
|
2328
|
+
marginBottom: '0px !important',
|
|
2329
|
+
padding: '7px 0px !important',
|
|
2330
|
+
'& .MuiSlider-markLabel': {
|
|
2331
|
+
display: 'none',
|
|
2332
|
+
},
|
|
2333
|
+
'& .MuiSlider-mark': {
|
|
2334
|
+
width: 10,
|
|
2335
|
+
height: 10,
|
|
2336
|
+
borderRadius: '50%',
|
|
2337
|
+
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',
|
|
2338
|
+
},
|
|
2339
|
+
'& .MuiSlider-track': {
|
|
2340
|
+
height: 4,
|
|
2341
|
+
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',
|
|
2342
|
+
},
|
|
2343
|
+
'& .MuiSlider-rail': {
|
|
2344
|
+
height: 4,
|
|
2345
|
+
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',
|
|
2346
|
+
},
|
|
2347
|
+
'& .MuiSlider-markActive': {
|
|
2348
|
+
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',
|
|
2349
|
+
},
|
|
2350
|
+
'& .MuiSlider-thumb': {
|
|
2351
|
+
display: 'flex',
|
|
2352
|
+
justifyContent: 'center',
|
|
2353
|
+
alignItems: 'center',
|
|
2354
|
+
height: 18,
|
|
2355
|
+
width: 18,
|
|
2356
|
+
backgroundColor: '#ffffff',
|
|
2357
|
+
border: 'none',
|
|
2358
|
+
cursor: 'pointer',
|
|
2359
|
+
borderRadius: '50%',
|
|
2360
|
+
boxShadow: '0px 2px 20px 4px rgba(0, 0, 0, 0.14)',
|
|
2361
|
+
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`,
|
|
2362
|
+
transform: 'translate(-50%, -50%) !important',
|
|
2363
|
+
'&::before': {
|
|
2364
|
+
content: '""',
|
|
2365
|
+
width: '13px',
|
|
2366
|
+
height: '10px',
|
|
2367
|
+
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")`,
|
|
2368
|
+
backgroundRepeat: 'no-repeat',
|
|
2369
|
+
backgroundPosition: 'center',
|
|
2370
|
+
backgroundSize: 'contain',
|
|
2371
|
+
},
|
|
2372
|
+
'&:hover': {
|
|
2373
|
+
boxShadow: '0px 2px 20px 4px rgba(0, 0, 0, 0.2)',
|
|
2374
|
+
},
|
|
2375
|
+
'&.Mui-focusVisible': {
|
|
2376
|
+
boxShadow: '0px 2px 20px 4px rgba(0, 0, 0, 0.2)',
|
|
2377
|
+
},
|
|
2378
|
+
'&.Mui-active': {
|
|
2379
|
+
boxShadow: '0px 2px 20px 4px rgba(0, 0, 0, 0.2)',
|
|
2380
|
+
},
|
|
2381
|
+
},
|
|
2382
|
+
});
|
|
2383
|
+
});
|
|
2384
|
+
const SliderLabelsContainer = styled(Box)(({ theme }) => ({
|
|
2385
|
+
display: 'flex',
|
|
2386
|
+
justifyContent: 'space-between',
|
|
2387
|
+
width: '100%',
|
|
2388
|
+
marginTop: '6px',
|
|
2389
|
+
}));
|
|
2299
2390
|
|
|
2300
2391
|
/**
|
|
2301
2392
|
* CoverageAmountSlider - Interactive slider for selecting coverage amounts
|
|
@@ -2310,11 +2401,12 @@ const RangeLabel = styled(Typography)(({ theme }) => {
|
|
|
2310
2401
|
* />
|
|
2311
2402
|
* ```
|
|
2312
2403
|
*/
|
|
2313
|
-
function CoverageAmountSlider({ min, max, value, onChange, label = 'Choose your coverage amount',
|
|
2404
|
+
function CoverageAmountSlider({ min, max, value, onChange, label = 'Choose your coverage amount', steps = 5, currency = 'RM', formatCurrency: customFormatCurrency, disabled = false, }) {
|
|
2314
2405
|
// Safely get theme, handle SSR case where it might be undefined
|
|
2315
2406
|
const tenantTheme = useTenantTheme();
|
|
2316
2407
|
const theme = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
2317
2408
|
const [localValue, setLocalValue] = useState(value);
|
|
2409
|
+
const [sliderIndex, setSliderIndex] = useState(0);
|
|
2318
2410
|
// Get theme colors with SSR-safe fallbacks
|
|
2319
2411
|
const sliderActiveColor = getThemeColor(theme, 'ui.sliderActive', '#317abc');
|
|
2320
2412
|
const sliderInactiveColor = getThemeColor(theme, 'ui.sliderInactive', '#c8c5ca');
|
|
@@ -2323,9 +2415,33 @@ function CoverageAmountSlider({ min, max, value, onChange, label = 'Choose your
|
|
|
2323
2415
|
const inputBorderColor = getThemeColor(theme, 'ui.inputBorder', '#eeeeee');
|
|
2324
2416
|
const textColor = getThemeColor(theme, 'natural.dim', '#13131b');
|
|
2325
2417
|
const labelColor = getThemeColor(theme, 'natural.main', '#929094');
|
|
2418
|
+
// Generate slider marks/options based on min, max, and steps
|
|
2419
|
+
const { sliderMarks, stepSize, maxSliderValue, defaultSliderValue } = useMemo(() => {
|
|
2420
|
+
const stepAmount = (max - min) / (steps - 1);
|
|
2421
|
+
const marks = [];
|
|
2422
|
+
for (let i = 0; i < steps; i++) {
|
|
2423
|
+
const coverageValue = min + stepAmount * i;
|
|
2424
|
+
marks.push({
|
|
2425
|
+
value: i * 10,
|
|
2426
|
+
label: `${(coverageValue / 1000).toFixed(0)}k`,
|
|
2427
|
+
coverageVal: coverageValue,
|
|
2428
|
+
});
|
|
2429
|
+
}
|
|
2430
|
+
// Find the default slider position based on the initial value
|
|
2431
|
+
const defaultIdx = marks.findIndex((m) => m.coverageVal >= value) || 0;
|
|
2432
|
+
return {
|
|
2433
|
+
sliderMarks: marks,
|
|
2434
|
+
stepSize: 10,
|
|
2435
|
+
maxSliderValue: (steps - 1) * 10,
|
|
2436
|
+
defaultSliderValue: defaultIdx * 10,
|
|
2437
|
+
};
|
|
2438
|
+
}, [min, max, steps, value]);
|
|
2326
2439
|
useEffect(() => {
|
|
2327
2440
|
setLocalValue(value);
|
|
2328
|
-
|
|
2441
|
+
// Update slider index when value changes externally
|
|
2442
|
+
const idx = sliderMarks.findIndex((m) => m.coverageVal >= value);
|
|
2443
|
+
setSliderIndex(idx >= 0 ? idx * 10 : 0);
|
|
2444
|
+
}, [value, sliderMarks]);
|
|
2329
2445
|
const defaultFormatCurrency = (amount) => {
|
|
2330
2446
|
return `${currency} ${amount.toLocaleString('en-US', {
|
|
2331
2447
|
minimumFractionDigits: 0,
|
|
@@ -2334,79 +2450,378 @@ function CoverageAmountSlider({ min, max, value, onChange, label = 'Choose your
|
|
|
2334
2450
|
};
|
|
2335
2451
|
const formatCurrency = customFormatCurrency || defaultFormatCurrency;
|
|
2336
2452
|
const handleDecrease = () => {
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
const
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2453
|
+
if (disabled)
|
|
2454
|
+
return;
|
|
2455
|
+
const currentIdx = sliderMarks.findIndex((m) => m.coverageVal === localValue);
|
|
2456
|
+
if (currentIdx > 0) {
|
|
2457
|
+
const newValue = sliderMarks[currentIdx - 1].coverageVal;
|
|
2458
|
+
setLocalValue(newValue);
|
|
2459
|
+
setSliderIndex((currentIdx - 1) * 10);
|
|
2460
|
+
onChange(newValue);
|
|
2461
|
+
}
|
|
2343
2462
|
};
|
|
2344
2463
|
const handleIncrease = () => {
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
const
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2464
|
+
if (disabled)
|
|
2465
|
+
return;
|
|
2466
|
+
const currentIdx = sliderMarks.findIndex((m) => m.coverageVal === localValue);
|
|
2467
|
+
if (currentIdx < sliderMarks.length - 1) {
|
|
2468
|
+
const newValue = sliderMarks[currentIdx + 1].coverageVal;
|
|
2469
|
+
setLocalValue(newValue);
|
|
2470
|
+
setSliderIndex((currentIdx + 1) * 10);
|
|
2471
|
+
onChange(newValue);
|
|
2472
|
+
}
|
|
2351
2473
|
};
|
|
2352
|
-
const
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2474
|
+
const handleSliderChange = (_event, newValue) => {
|
|
2475
|
+
if (disabled)
|
|
2476
|
+
return;
|
|
2477
|
+
const sliderVal = newValue;
|
|
2478
|
+
const currentMark = sliderMarks.find((opt) => opt.value === sliderVal);
|
|
2479
|
+
if (currentMark) {
|
|
2480
|
+
setSliderIndex(sliderVal);
|
|
2481
|
+
setLocalValue(currentMark.coverageVal);
|
|
2482
|
+
onChange(currentMark.coverageVal);
|
|
2483
|
+
}
|
|
2357
2484
|
};
|
|
2358
|
-
const percentage = ((localValue - min) / (max - min)) * 100;
|
|
2359
|
-
// Track width is 298px (10 dots * 10px + 9 gaps * 22px = 298px)
|
|
2360
|
-
// Each dot is 10px wide, so dot centers are at: 5px, 37px, 69px, ... (5 + dotIndex * 32)
|
|
2361
|
-
// First dot center: 5px (half of 10px dot width)
|
|
2362
|
-
// Last dot center: 298px - 5px = 293px
|
|
2363
|
-
// Thumb is 18px wide, so thumb center offset from left edge is 9px
|
|
2364
|
-
// Position thumb so its center aligns with the dot center
|
|
2365
|
-
// left = dotCenter - thumbCenterOffset = dotCenter - 9px
|
|
2366
|
-
const firstDotCenter = 5; // First dot center position
|
|
2367
|
-
const lastDotCenter = 298 - 5; // Last dot center position
|
|
2368
|
-
const thumbCenterOffset = 9; // Half of thumb width (18px / 2)
|
|
2369
|
-
const dotCenterPosition = firstDotCenter + (percentage / 100) * (lastDotCenter - firstDotCenter);
|
|
2370
|
-
const thumbPosition = dotCenterPosition - thumbCenterOffset;
|
|
2371
|
-
// Create slider with dots: dot-segment-dot-segment-...-dot
|
|
2372
|
-
// With 8 segments, we have 9 dots total (start + 8 in between + end)
|
|
2373
|
-
// But user wants 8 dots in between, so total = 1 (start) + 8 (between) + 1 (end) = 10 dots
|
|
2374
|
-
// This means 9 segments between the 10 dots
|
|
2375
|
-
const dotsInBetween = segments; // 8 dots in between
|
|
2376
|
-
const totalDots = dotsInBetween + 2; // start + 8 in between + end = 10 dots
|
|
2377
2485
|
return (jsxs(SliderContainer, Object.assign({ sx: {
|
|
2378
2486
|
backgroundColor: sliderBgColor,
|
|
2379
2487
|
} }, { children: [jsxs(InputSection, { children: [jsx(InputLabel, Object.assign({ sx: { color: textColor } }, { children: label })), jsxs(InputContainer, Object.assign({ sx: {
|
|
2380
2488
|
backgroundColor: inputBgColor,
|
|
2381
2489
|
border: `1px solid ${inputBorderColor}`,
|
|
2382
|
-
|
|
2490
|
+
opacity: disabled ? 0.5 : 1,
|
|
2491
|
+
} }, { children: [jsx(IconButton, Object.assign({ onClick: handleDecrease, disabled: disabled, sx: {
|
|
2383
2492
|
padding: 0,
|
|
2384
2493
|
width: '24px',
|
|
2385
2494
|
height: '24px',
|
|
2386
2495
|
color: textColor,
|
|
2387
|
-
} }, { children: jsx(RemoveIcon, { sx: { fontSize: 24 } }) })), jsx(InputValue, Object.assign({ sx: { color: textColor } }, { children: formatCurrency(localValue) })), jsx(IconButton, Object.assign({ onClick: handleIncrease, sx: {
|
|
2496
|
+
} }, { children: jsx(RemoveIcon, { sx: { fontSize: 24 } }) })), jsx(InputValue, Object.assign({ sx: { color: textColor } }, { children: formatCurrency(localValue) })), jsx(IconButton, Object.assign({ onClick: handleIncrease, disabled: disabled, sx: {
|
|
2388
2497
|
padding: 0,
|
|
2389
2498
|
width: '24px',
|
|
2390
2499
|
height: '24px',
|
|
2391
2500
|
color: textColor,
|
|
2392
|
-
} }, { children: jsx(AddIcon, { sx: { fontSize: 24 } }) }))] }))] }), jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: 'column',
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
: sliderInactiveColor,
|
|
2400
|
-
} }), !isLast && (jsx(SliderSegment, { active: localValue > dotValue, sx: {
|
|
2401
|
-
backgroundColor: localValue > dotValue
|
|
2402
|
-
? sliderActiveColor
|
|
2403
|
-
: sliderInactiveColor,
|
|
2404
|
-
} }))] }), index));
|
|
2405
|
-
}), jsx(SliderThumb, Object.assign({ style: {
|
|
2406
|
-
left: `${thumbPosition}px`,
|
|
2407
|
-
} }, { children: jsx(ThumbIcon, Object.assign({ sx: { color: sliderActiveColor } }, { children: jsx(DragHandleIcon, { sx: { fontSize: 16 } }) })) }))] }), jsxs(RangeLabels, { children: [jsx(RangeLabel, Object.assign({ sx: { color: labelColor } }, { children: formatCurrency(min) })), jsx(RangeLabel, Object.assign({ sx: { textAlign: 'right', color: labelColor } }, { children: formatCurrency(max) }))] })] }))] })));
|
|
2501
|
+
} }, { children: jsx(AddIcon, { sx: { fontSize: 24 } }) }))] }))] }), jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: 'column', width: '100%' } }, { children: [jsx(StyledMuiSlider, { value: sliderIndex, defaultValue: defaultSliderValue, step: stepSize, min: 0, max: maxSliderValue, marks: sliderMarks, valueLabelDisplay: "off", onChange: handleSliderChange, disabled: disabled, sliderActiveColor: sliderActiveColor, sliderInactiveColor: sliderInactiveColor }), jsx(SliderLabelsContainer, { children: sliderMarks.map((mark, index) => (jsx(RangeLabel, Object.assign({ sx: {
|
|
2502
|
+
color: sliderIndex === mark.value
|
|
2503
|
+
? sliderActiveColor
|
|
2504
|
+
: labelColor,
|
|
2505
|
+
textAlign: index === 0 ? 'left' : index === sliderMarks.length - 1 ? 'right' : 'center',
|
|
2506
|
+
flex: index === 0 || index === sliderMarks.length - 1 ? 'none' : 1,
|
|
2507
|
+
} }, { children: mark.label }), index))) })] }))] })));
|
|
2408
2508
|
}
|
|
2409
2509
|
|
|
2510
|
+
const ProgressBarContainer = styled(Box)({
|
|
2511
|
+
display: 'flex',
|
|
2512
|
+
alignItems: 'center',
|
|
2513
|
+
gap: '8px',
|
|
2514
|
+
padding: '16px',
|
|
2515
|
+
});
|
|
2516
|
+
const ProgressBar = styled(Box)({
|
|
2517
|
+
display: 'flex',
|
|
2518
|
+
alignItems: 'center',
|
|
2519
|
+
flex: 1,
|
|
2520
|
+
height: '4px',
|
|
2521
|
+
backgroundColor: 'rgba(0, 0, 0, 0.1)',
|
|
2522
|
+
borderRadius: '2px',
|
|
2523
|
+
overflow: 'hidden',
|
|
2524
|
+
});
|
|
2525
|
+
const ProgressFill = styled(Box)(({ width, progressBarTheme }) => ({
|
|
2526
|
+
height: '100%',
|
|
2527
|
+
width: `${width}%`,
|
|
2528
|
+
background: progressBarTheme || 'linear-gradient(90deg, #0090DA 0.06%, #A4CE4E 99.94%)',
|
|
2529
|
+
transition: 'width 0.3s ease',
|
|
2530
|
+
}));
|
|
2531
|
+
const ProgressText = styled(Typography)({
|
|
2532
|
+
fontFamily: 'Montserrat',
|
|
2533
|
+
fontSize: '12px',
|
|
2534
|
+
color: '#5F5E62',
|
|
2535
|
+
fontWeight: 400,
|
|
2536
|
+
lineHeight: '16px',
|
|
2537
|
+
});
|
|
2538
|
+
|
|
2539
|
+
const CheckoutProgress = ({ currentStep, totalSteps, onBack, showBackButton = true, progressBarTheme, sx, }) => {
|
|
2540
|
+
const progressPercentage = ((currentStep + 1) / totalSteps) * 100;
|
|
2541
|
+
return (jsxs(ProgressBarContainer, Object.assign({ sx: sx }, { children: [showBackButton && onBack && (jsx(IconButton, Object.assign({ onClick: onBack, sx: { p: 0, width: '24px', height: '24px' }, "aria-label": "Go back" }, { children: jsx(ArrowBackIcon, { sx: { fontSize: '20px', color: '#13131B' } }) }))), jsx(ProgressBar, { children: jsx(ProgressFill, { width: progressPercentage, progressBarTheme: progressBarTheme }) }), jsxs(ProgressText, { children: [currentStep + 1, "/", totalSteps] })] })));
|
|
2542
|
+
};
|
|
2543
|
+
|
|
2544
|
+
const ProductCardContainer = styled(Box)(({ theme, showIndicator }) => {
|
|
2545
|
+
var _a, _b;
|
|
2546
|
+
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 && {
|
|
2547
|
+
'&::before': {
|
|
2548
|
+
content: '""',
|
|
2549
|
+
position: 'absolute',
|
|
2550
|
+
left: 0,
|
|
2551
|
+
top: 0,
|
|
2552
|
+
width: '8px',
|
|
2553
|
+
height: '64px',
|
|
2554
|
+
borderRadius: '0 0 8px 8px',
|
|
2555
|
+
backgroundColor: ((_b = (_a = theme.palette) === null || _a === void 0 ? void 0 : _a.primary) === null || _b === void 0 ? void 0 : _b.main) || '#13131B',
|
|
2556
|
+
},
|
|
2557
|
+
})));
|
|
2558
|
+
});
|
|
2559
|
+
const LogoContainer = styled(Box)({
|
|
2560
|
+
width: '45px',
|
|
2561
|
+
height: '40px',
|
|
2562
|
+
border: '1.25px solid rgba(0, 0, 0, 0.1)',
|
|
2563
|
+
borderRadius: '10px',
|
|
2564
|
+
display: 'flex',
|
|
2565
|
+
alignItems: 'center',
|
|
2566
|
+
justifyContent: 'center',
|
|
2567
|
+
flexShrink: 0,
|
|
2568
|
+
marginLeft: '8px',
|
|
2569
|
+
});
|
|
2570
|
+
const ProductInfo = styled(Box)({
|
|
2571
|
+
flex: 1,
|
|
2572
|
+
marginLeft: '4px',
|
|
2573
|
+
});
|
|
2574
|
+
const ProductName = styled(Typography)({
|
|
2575
|
+
fontFamily: 'Montserrat',
|
|
2576
|
+
fontSize: '14px',
|
|
2577
|
+
fontWeight: 600,
|
|
2578
|
+
color: '#13131B',
|
|
2579
|
+
lineHeight: '20px',
|
|
2580
|
+
});
|
|
2581
|
+
const PlanName = styled(Typography)({
|
|
2582
|
+
fontFamily: 'Montserrat',
|
|
2583
|
+
fontSize: '12px',
|
|
2584
|
+
fontWeight: 400,
|
|
2585
|
+
color: '#13131B',
|
|
2586
|
+
lineHeight: '16px',
|
|
2587
|
+
});
|
|
2588
|
+
const PriceContainer = styled(Box)({
|
|
2589
|
+
display: 'flex',
|
|
2590
|
+
alignItems: 'baseline',
|
|
2591
|
+
gap: '2px',
|
|
2592
|
+
});
|
|
2593
|
+
const Price = styled(Typography)({
|
|
2594
|
+
fontFamily: 'Montserrat',
|
|
2595
|
+
fontSize: '14px',
|
|
2596
|
+
fontWeight: 600,
|
|
2597
|
+
color: '#13131B',
|
|
2598
|
+
lineHeight: '20px',
|
|
2599
|
+
});
|
|
2600
|
+
const PricePeriod = styled(Typography)({
|
|
2601
|
+
fontFamily: 'Montserrat',
|
|
2602
|
+
fontSize: '12px',
|
|
2603
|
+
fontWeight: 400,
|
|
2604
|
+
color: '#13131B',
|
|
2605
|
+
lineHeight: '16px',
|
|
2606
|
+
});
|
|
2607
|
+
|
|
2608
|
+
const ProductCard = ({ productName, planName, logoUrl, price, currency = 'RM', period = '/month', sx, showIndicator = true, }) => {
|
|
2609
|
+
return (jsxs(ProductCardContainer, Object.assign({ sx: sx, showIndicator: showIndicator }, { children: [logoUrl && (jsx(LogoContainer, { children: jsx("img", { src: logoUrl, alt: productName, style: { maxWidth: '100%', maxHeight: '100%' } }) })), jsxs(ProductInfo, { children: [jsx(ProductName, { children: productName }), planName && jsx(PlanName, { children: planName })] }), jsxs(PriceContainer, { children: [jsxs(Price, { children: [currency, " ", price] }), jsx(PricePeriod, { children: period })] })] })));
|
|
2610
|
+
};
|
|
2611
|
+
|
|
2612
|
+
const HeaderContainer = styled(Box)(({ sticky }) => (Object.assign(Object.assign({}, (sticky && {
|
|
2613
|
+
position: 'sticky',
|
|
2614
|
+
top: 0,
|
|
2615
|
+
zIndex: 1000,
|
|
2616
|
+
})), { backgroundColor: '#fff', width: '100%' })));
|
|
2617
|
+
const SectionHeader = styled(Box)({
|
|
2618
|
+
padding: '0 16px 24px',
|
|
2619
|
+
});
|
|
2620
|
+
const SectionTitle = styled(Typography)({
|
|
2621
|
+
fontFamily: 'Montserrat',
|
|
2622
|
+
fontSize: '20px',
|
|
2623
|
+
fontWeight: 700,
|
|
2624
|
+
color: '#13131B',
|
|
2625
|
+
lineHeight: '28px',
|
|
2626
|
+
marginBottom: '8px',
|
|
2627
|
+
});
|
|
2628
|
+
const SectionDescription = styled(Typography)({
|
|
2629
|
+
fontFamily: 'Montserrat',
|
|
2630
|
+
fontSize: '14px',
|
|
2631
|
+
fontWeight: 400,
|
|
2632
|
+
color: '#5F5E62',
|
|
2633
|
+
lineHeight: '18px',
|
|
2634
|
+
});
|
|
2635
|
+
|
|
2636
|
+
const CheckoutHeader = ({ progress, product, sectionTitle, sectionDescription, sticky = true, progressBarTheme, sx, }) => {
|
|
2637
|
+
return (jsxs(HeaderContainer, Object.assign({ sticky: sticky, sx: sx }, { children: [jsx(CheckoutProgress, Object.assign({}, progress, { progressBarTheme: progressBarTheme })), product && (jsx(Box, Object.assign({ sx: { padding: '0 16px 24px' } }, { children: jsx(ProductCard, Object.assign({}, product)) }))), jsxs(SectionHeader, { children: [jsx(SectionTitle, { children: sectionTitle }), jsx(SectionDescription, { children: sectionDescription })] })] })));
|
|
2638
|
+
};
|
|
2639
|
+
|
|
2640
|
+
const ButtonContainer = styled(Box)(({ isFixed }) => ({
|
|
2641
|
+
position: isFixed ? 'fixed' : 'relative',
|
|
2642
|
+
bottom: 0,
|
|
2643
|
+
left: 0,
|
|
2644
|
+
right: 0,
|
|
2645
|
+
backgroundColor: '#fff',
|
|
2646
|
+
padding: '16px',
|
|
2647
|
+
boxShadow: isFixed ? '0px 2px 10px 0px rgba(0, 0, 0, 0.12)' : 'none',
|
|
2648
|
+
zIndex: 999,
|
|
2649
|
+
}));
|
|
2650
|
+
const StyledButton = styled('button')(({ theme, isDisabled }) => {
|
|
2651
|
+
var _a, _b, _c, _d;
|
|
2652
|
+
return ({
|
|
2653
|
+
width: '100%',
|
|
2654
|
+
height: '48px',
|
|
2655
|
+
borderRadius: '8px',
|
|
2656
|
+
border: 'none',
|
|
2657
|
+
backgroundColor: isDisabled
|
|
2658
|
+
? '#E1E2EB'
|
|
2659
|
+
: ((_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',
|
|
2660
|
+
color: isDisabled ? '#929094' : '#fff',
|
|
2661
|
+
fontFamily: 'Montserrat',
|
|
2662
|
+
fontSize: '14px',
|
|
2663
|
+
fontWeight: 500,
|
|
2664
|
+
lineHeight: '18px',
|
|
2665
|
+
cursor: isDisabled ? 'not-allowed' : 'pointer',
|
|
2666
|
+
transition: 'all 0.2s ease',
|
|
2667
|
+
'&:hover': {
|
|
2668
|
+
backgroundColor: isDisabled
|
|
2669
|
+
? '#E1E2EB'
|
|
2670
|
+
: ((_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',
|
|
2671
|
+
},
|
|
2672
|
+
});
|
|
2673
|
+
});
|
|
2674
|
+
|
|
2675
|
+
const CheckoutFormButton = ({ text = 'Next', disabled = false, onClick, fixed = true, type = 'button', sx, loading = false, }) => {
|
|
2676
|
+
return (jsx(ButtonContainer, Object.assign({ isFixed: fixed, sx: sx }, { children: jsx(StyledButton, Object.assign({ type: type, disabled: disabled || loading, isDisabled: disabled || loading, onClick: onClick }, { children: loading ? 'Processing...' : text })) })));
|
|
2677
|
+
};
|
|
2678
|
+
|
|
2679
|
+
const QuestionContainer = styled(Box)({
|
|
2680
|
+
display: 'flex',
|
|
2681
|
+
flexDirection: 'column',
|
|
2682
|
+
gap: '8px',
|
|
2683
|
+
marginBottom: '24px',
|
|
2684
|
+
});
|
|
2685
|
+
const QuestionText = styled(Typography)({
|
|
2686
|
+
fontFamily: 'Montserrat',
|
|
2687
|
+
fontSize: '14px',
|
|
2688
|
+
fontWeight: 400,
|
|
2689
|
+
color: '#13131B',
|
|
2690
|
+
lineHeight: '20px',
|
|
2691
|
+
});
|
|
2692
|
+
const OptionsContainer = styled(Box)({
|
|
2693
|
+
display: 'flex',
|
|
2694
|
+
gap: '16px',
|
|
2695
|
+
marginTop: '12px',
|
|
2696
|
+
});
|
|
2697
|
+
const OptionButton = styled(Box)(({ selected }) => ({
|
|
2698
|
+
flex: 1,
|
|
2699
|
+
height: '48px',
|
|
2700
|
+
border: `1px solid ${selected ? '#13131B' : '#929094'}`,
|
|
2701
|
+
borderRadius: '8px',
|
|
2702
|
+
display: 'flex',
|
|
2703
|
+
alignItems: 'center',
|
|
2704
|
+
justifyContent: 'center',
|
|
2705
|
+
cursor: 'pointer',
|
|
2706
|
+
backgroundColor: selected ? '#F5F5F7' : '#fff',
|
|
2707
|
+
transition: 'all 0.2s ease',
|
|
2708
|
+
'&:hover': {
|
|
2709
|
+
borderColor: '#13131B',
|
|
2710
|
+
},
|
|
2711
|
+
}));
|
|
2712
|
+
const OptionText = styled(Typography)(({ selected }) => ({
|
|
2713
|
+
fontFamily: 'Montserrat',
|
|
2714
|
+
fontSize: '14px',
|
|
2715
|
+
fontWeight: 600,
|
|
2716
|
+
color: selected ? '#13131B' : '#5F5E62',
|
|
2717
|
+
lineHeight: '20px',
|
|
2718
|
+
}));
|
|
2719
|
+
|
|
2720
|
+
const HealthQuestionGroup = ({ question, questionNumber, value, onChange, error, labels = { yes: 'Yes', no: 'No' }, sx, }) => {
|
|
2721
|
+
return (jsxs(QuestionContainer, Object.assign({ sx: sx }, { children: [jsxs(QuestionText, { children: [questionNumber && `${questionNumber}. `, question] }), jsxs(OptionsContainer, { children: [jsx(OptionButton, Object.assign({ selected: value === 'yes', onClick: () => onChange('yes'), role: "button", "aria-pressed": value === 'yes' }, { children: jsx(OptionText, Object.assign({ selected: value === 'yes' }, { children: labels.yes || 'Yes' })) })), jsx(OptionButton, Object.assign({ selected: value === 'no', onClick: () => onChange('no'), role: "button", "aria-pressed": value === 'no' }, { children: jsx(OptionText, Object.assign({ selected: value === 'no' }, { children: labels.no || 'No' })) }))] }), error && (jsx(Typography, Object.assign({ sx: {
|
|
2722
|
+
color: 'error.main',
|
|
2723
|
+
fontSize: '12px',
|
|
2724
|
+
mt: 0.5,
|
|
2725
|
+
ml: 2,
|
|
2726
|
+
} }, { children: error })))] })));
|
|
2727
|
+
};
|
|
2728
|
+
|
|
2729
|
+
const FormContainer$3 = styled(Box)({
|
|
2730
|
+
padding: '0 16px 100px',
|
|
2731
|
+
});
|
|
2732
|
+
const CheckboxContainer$1 = styled(Box)({
|
|
2733
|
+
marginTop: '12px',
|
|
2734
|
+
'& .MuiFormControlLabel-root': {
|
|
2735
|
+
alignItems: 'flex-start',
|
|
2736
|
+
marginLeft: 0,
|
|
2737
|
+
},
|
|
2738
|
+
'& .MuiCheckbox-root': {
|
|
2739
|
+
padding: '4px 8px 4px 0',
|
|
2740
|
+
},
|
|
2741
|
+
});
|
|
2742
|
+
const CheckboxLabel$1 = styled(Typography)({
|
|
2743
|
+
fontFamily: 'Montserrat',
|
|
2744
|
+
fontSize: '14px',
|
|
2745
|
+
fontWeight: 400,
|
|
2746
|
+
color: '#5F5E62',
|
|
2747
|
+
lineHeight: '18px',
|
|
2748
|
+
});
|
|
2749
|
+
|
|
2750
|
+
const PersonalInformationForm = ({ renderField, fields, consents, onSubmit, formRef, sx, }) => {
|
|
2751
|
+
const defaultBankConfirmationLabel = 'I confirm this bank account is mine and consent to AmMetLife crediting payouts to it';
|
|
2752
|
+
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';
|
|
2753
|
+
return (jsx(FormContainer$3, Object.assign({ ref: formRef, component: "form", onSubmit: onSubmit, sx: sx }, { children: jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: 'column', gap: '24px' } }, { children: [jsxs(Box, { children: [renderField(fields.full_name), fields.full_name.helperText && (jsx(Typography, Object.assign({ variant: "caption", sx: {
|
|
2754
|
+
display: 'block',
|
|
2755
|
+
mt: 0.5,
|
|
2756
|
+
ml: 2,
|
|
2757
|
+
color: '#5F5E62',
|
|
2758
|
+
fontSize: '12px',
|
|
2759
|
+
fontFamily: 'Montserrat',
|
|
2760
|
+
} }, { children: fields.full_name.helperText })))] }), renderField(fields.nric), renderField(fields.date_of_birth), renderField(fields.gender), renderField(fields.salutation), renderField(fields.nationality), renderField(fields.occupation), renderField(fields.industry), renderField(fields.crediting_bank_name), renderField(fields.crediting_bank_account_number), jsxs(CheckboxContainer$1, { children: [jsx(FormControlLabel, { control: jsx(Checkbox, { checked: consents.bank_account_confirmation.checked, onChange: (e) => consents.bank_account_confirmation.onChange(e.target.checked), name: "bank_account_confirmation" }), label: jsx(CheckboxLabel$1, { children: consents.bank_account_confirmation.label ||
|
|
2761
|
+
defaultBankConfirmationLabel }) }), consents.bank_account_confirmation.error && (jsx(Typography, Object.assign({ sx: {
|
|
2762
|
+
color: 'error.main',
|
|
2763
|
+
fontSize: '12px',
|
|
2764
|
+
mt: 0.5,
|
|
2765
|
+
ml: 4,
|
|
2766
|
+
} }, { children: consents.bank_account_confirmation.error })))] }), jsx(CheckboxContainer$1, { children: jsx(FormControlLabel, { control: jsx(Checkbox, { checked: consents.marketing_consent.checked, onChange: (e) => consents.marketing_consent.onChange(e.target.checked), name: "marketing_consent" }), label: jsx(CheckboxLabel$1, { children: consents.marketing_consent.label || defaultMarketingLabel }) }) })] })) })));
|
|
2767
|
+
};
|
|
2768
|
+
|
|
2769
|
+
const FormContainer$2 = styled(Box)({
|
|
2770
|
+
padding: '0 16px 100px',
|
|
2771
|
+
});
|
|
2772
|
+
const CheckboxContainer = styled(Box)({
|
|
2773
|
+
marginTop: '12px',
|
|
2774
|
+
'& .MuiFormControlLabel-root': {
|
|
2775
|
+
alignItems: 'flex-start',
|
|
2776
|
+
marginLeft: 0,
|
|
2777
|
+
},
|
|
2778
|
+
'& .MuiCheckbox-root': {
|
|
2779
|
+
padding: '4px 8px 4px 0',
|
|
2780
|
+
},
|
|
2781
|
+
});
|
|
2782
|
+
const CheckboxLabel = styled(Typography)({
|
|
2783
|
+
fontFamily: 'Montserrat',
|
|
2784
|
+
fontSize: '14px',
|
|
2785
|
+
fontWeight: 400,
|
|
2786
|
+
color: '#5F5E62',
|
|
2787
|
+
lineHeight: '18px',
|
|
2788
|
+
});
|
|
2789
|
+
|
|
2790
|
+
const ContactDetailsForm = ({ renderField, fields, mailingAddressSame, onSubmit, formRef, sx, }) => {
|
|
2791
|
+
const defaultMailingLabel = 'My mailing address is the same as residential';
|
|
2792
|
+
return (jsx(FormContainer$2, Object.assign({ ref: formRef, component: "form", onSubmit: onSubmit, sx: sx }, { children: jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: 'column', gap: '24px' } }, { children: [jsxs(Box, { children: [renderField(fields.phone_number), fields.phone_number.helperText && (jsx(Box, Object.assign({ component: "span", sx: {
|
|
2793
|
+
display: 'block',
|
|
2794
|
+
mt: 0.5,
|
|
2795
|
+
ml: 2,
|
|
2796
|
+
color: '#5F5E62',
|
|
2797
|
+
fontSize: '12px',
|
|
2798
|
+
fontFamily: 'Montserrat',
|
|
2799
|
+
} }, { children: fields.phone_number.helperText })))] }), renderField(fields.email_address), renderField(fields.residential_address), renderField(fields.postal_code), renderField(fields.city), renderField(fields.state), mailingAddressSame && (jsx(CheckboxContainer, { children: jsx(FormControlLabel, { control: jsx(Checkbox, { checked: mailingAddressSame.checked, onChange: (e) => mailingAddressSame.onChange(e.target.checked), name: "mailing_same_as_residential" }), label: jsx(CheckboxLabel, { children: mailingAddressSame.label || defaultMailingLabel }) }) }))] })) })));
|
|
2800
|
+
};
|
|
2801
|
+
|
|
2802
|
+
const FormContainer$1 = styled(Box)({
|
|
2803
|
+
padding: '0 16px 100px',
|
|
2804
|
+
});
|
|
2805
|
+
|
|
2806
|
+
const HealthInformationForm = ({ renderField, measurementFields, healthQuestions, onSubmit, formRef, sx, }) => {
|
|
2807
|
+
return (jsx(FormContainer$1, Object.assign({ ref: formRef, component: "form", onSubmit: onSubmit, sx: sx }, { children: jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: 'column', gap: '24px' } }, { children: [renderField(measurementFields.weight), renderField(measurementFields.height), healthQuestions.map((question, index) => (jsx(HealthQuestionGroup, { question: question.question, questionNumber: question.questionNumber, value: question.value, onChange: question.onChange, error: question.error, labels: question.labels }, question.name || index)))] })) })));
|
|
2808
|
+
};
|
|
2809
|
+
|
|
2810
|
+
const FormContainer = styled(Box)({
|
|
2811
|
+
padding: '0 16px 100px',
|
|
2812
|
+
});
|
|
2813
|
+
|
|
2814
|
+
const ChildInformationForm = ({ renderField, fields, onSubmit, formRef, sx, }) => {
|
|
2815
|
+
return (jsx(FormContainer, Object.assign({ ref: formRef, component: "form", onSubmit: onSubmit, sx: sx }, { children: jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: 'column', gap: '24px' } }, { children: [jsxs(Box, { children: [renderField(fields.full_name), fields.full_name.helperText && (jsx(Box, Object.assign({ component: "span", sx: {
|
|
2816
|
+
display: 'block',
|
|
2817
|
+
mt: 0.5,
|
|
2818
|
+
ml: 2,
|
|
2819
|
+
color: '#5F5E62',
|
|
2820
|
+
fontSize: '12px',
|
|
2821
|
+
fontFamily: 'Montserrat',
|
|
2822
|
+
} }, { children: fields.full_name.helperText })))] }), renderField(fields.nric), renderField(fields.date_of_birth), renderField(fields.gender), renderField(fields.nationality)] })) })));
|
|
2823
|
+
};
|
|
2824
|
+
|
|
2410
2825
|
/**
|
|
2411
2826
|
* Asset Management Utilities
|
|
2412
2827
|
* Helper functions for managing tenant-specific assets
|
|
@@ -2521,5 +2936,5 @@ function getIconPath(iconName) {
|
|
|
2521
2936
|
return ICON_PATHS[iconName];
|
|
2522
2937
|
}
|
|
2523
2938
|
|
|
2524
|
-
export { Banner, BillingToggle, Button, Card, CoverageAmountSlider, Footer, Header$1 as Header, ICON_PATHS, InfoCallout, NewHeader, OptionButton, ProductSelectionDrawer, QuestionSection, RecommendationsDrawer, TenantThemeProvider, ToggleGroup, ammetlifeTheme, ammetlifeTypography, cimbTheme, cimbTypography, createThemeCSSVariables, getAvailableTenants, getIconPath, getTenantAssetPath, getTenantLogoPath, getTenantTheme, getTenantTypography, getThemeColor, iglooTheme, iglooTypography, isValidTenantId, mergeTenantTheme, tenantThemes, tenantTypography, useIsTenant, useTenantAsset, useTenantFavicon, useTenantId, useTenantLogo, useTenantTheme };
|
|
2939
|
+
export { Banner, BillingToggle, Button, Card, CheckoutFormButton, CheckoutHeader, CheckoutProgress, ChildInformationForm, ContactDetailsForm, CoverageAmountSlider, Footer, Header$1 as Header, HealthInformationForm, HealthQuestionGroup, ICON_PATHS, InfoCallout, NewHeader, OptionButton$1 as OptionButton, PersonalInformationForm, ProductCard, ProductSelectionDrawer, QuestionSection, RecommendationsDrawer, TenantThemeProvider, ToggleGroup, ammetlifeTheme, ammetlifeTypography, cimbTheme, cimbTypography, createThemeCSSVariables, getAvailableTenants, getIconPath, getTenantAssetPath, getTenantLogoPath, getTenantTheme, getTenantTypography, getThemeColor, iglooTheme, iglooTypography, isValidTenantId, mergeTenantTheme, tenantThemes, tenantTypography, useIsTenant, useTenantAsset, useTenantFavicon, useTenantId, useTenantLogo, useTenantTheme };
|
|
2525
2940
|
//# sourceMappingURL=index.js.map
|