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/cjs/index.js
CHANGED
|
@@ -13,7 +13,6 @@ var styles = require('@mui/material/styles');
|
|
|
13
13
|
var ArrowBackIcon = require('@mui/icons-material/ArrowBack');
|
|
14
14
|
var InfoIcon = require('@mui/icons-material/Info');
|
|
15
15
|
var AddIcon = require('@mui/icons-material/Add');
|
|
16
|
-
var DragHandleIcon = require('@mui/icons-material/DragHandle');
|
|
17
16
|
var RemoveIcon = require('@mui/icons-material/Remove');
|
|
18
17
|
|
|
19
18
|
function _interopNamespaceDefault(e) {
|
|
@@ -415,12 +414,12 @@ const cimbTheme = {
|
|
|
415
414
|
const ammetlifeTheme = {
|
|
416
415
|
palette: {
|
|
417
416
|
primary: {
|
|
418
|
-
dark: '#
|
|
419
|
-
main: '#
|
|
417
|
+
dark: '#2869a8',
|
|
418
|
+
main: '#317abc',
|
|
420
419
|
light: '#42A5F5',
|
|
421
420
|
bright: '#90CAF9',
|
|
422
421
|
plain: '#E3F2FD',
|
|
423
|
-
border: '#
|
|
422
|
+
border: '#317abc',
|
|
424
423
|
},
|
|
425
424
|
secondary: {
|
|
426
425
|
dim: '#E65100',
|
|
@@ -958,7 +957,7 @@ const AnchorLink$1 = styles.styled('a')(({ theme }) => ({
|
|
|
958
957
|
color: 'inherit',
|
|
959
958
|
},
|
|
960
959
|
}));
|
|
961
|
-
const StyledButton = styles.styled(material.Button)(({ theme }) => {
|
|
960
|
+
const StyledButton$1 = styles.styled(material.Button)(({ theme }) => {
|
|
962
961
|
var _a, _b, _c, _d;
|
|
963
962
|
return ({
|
|
964
963
|
alignSelf: 'start',
|
|
@@ -1055,7 +1054,7 @@ function Header$1({ logo, alternateLogo, showAlternateLogo = false, navigationLi
|
|
|
1055
1054
|
},
|
|
1056
1055
|
} }, { 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
1056
|
id: `${currentLocale === null || currentLocale === void 0 ? void 0 : currentLocale.toLocaleUpperCase()}`,
|
|
1058
|
-
}) })), jsxRuntime.jsx(material.Icon, { component: ArrowDropDownIcon })] }), "language")), isPartnershipPagePCView && scrolled ? (jsxRuntime.jsx(StyledButton, Object.assign({ variant: "contained", onClick: onPartnershipCTAClick }, { children: jsxRuntime.jsx(TypographyBtnText, Object.assign({ variant: "body1" }, { children: formatMessage({ id: 'Be Our Partner' }) })) }))) : isSeoPageView && scrolled && bannerData ? (jsxRuntime.jsx(StyledButtonBanner, Object.assign({ style: { background: bannerData === null || bannerData === void 0 ? void 0 : bannerData.ctaBGColor }, variant: "contained", onClick: onGetQuoteClick }, { children: jsxRuntime.jsx(material.Typography, Object.assign({ style: {
|
|
1057
|
+
}) })), 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
1058
|
color: bannerData === null || bannerData === void 0 ? void 0 : bannerData.ctaTextColor,
|
|
1060
1059
|
textTransform: 'none',
|
|
1061
1060
|
}, 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: {
|
|
@@ -1105,7 +1104,7 @@ function Header$1({ logo, alternateLogo, showAlternateLogo = false, navigationLi
|
|
|
1105
1104
|
handleOpenNavMenu(e);
|
|
1106
1105
|
}
|
|
1107
1106
|
}, color: "inherit", sx: Object.assign({}, (isPartnershipPageMobileView &&
|
|
1108
|
-
scrolled && { padding: '0px !important' })) }, { children: Boolean(anchorElNav) ? (jsxRuntime.jsx(StyledCloseIcon, {})) : isPartnershipPageMobileView && scrolled ? (jsxRuntime.jsx(StyledButton, Object.assign({ variant: "contained", onClick: onPartnershipCTAClick }, { children: jsxRuntime.jsx(TypographyBtnText, Object.assign({ variant: "body1" }, { children: formatMessage({ id: 'Be Our Partner' }) })) }))) : isSeoPageView && scrolled && bannerData ? (jsxRuntime.jsx(StyledButtonBanner, Object.assign({ style: {
|
|
1107
|
+
scrolled && { padding: '0px !important' })) }, { children: Boolean(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
1108
|
background: bannerData === null || bannerData === void 0 ? void 0 : bannerData.ctaBGColor,
|
|
1110
1109
|
}, variant: "contained", onClick: onGetQuoteClick }, { children: jsxRuntime.jsx(material.Typography, Object.assign({ style: {
|
|
1111
1110
|
color: bannerData === null || bannerData === void 0 ? void 0 : bannerData.ctaTextColor,
|
|
@@ -1157,7 +1156,7 @@ const StyledToolbar = styles.styled(material.Toolbar)(({ theme }) => ({
|
|
|
1157
1156
|
padding: '12px 16px',
|
|
1158
1157
|
},
|
|
1159
1158
|
}));
|
|
1160
|
-
const LogoContainer = styles.styled('div')(({ theme }) => ({
|
|
1159
|
+
const LogoContainer$1 = styles.styled('div')(({ theme }) => ({
|
|
1161
1160
|
display: 'flex',
|
|
1162
1161
|
alignItems: 'center',
|
|
1163
1162
|
cursor: 'pointer',
|
|
@@ -1254,7 +1253,7 @@ function NewHeader({ logo: propLogo, navigationLinks = [], additionalMenuSection
|
|
|
1254
1253
|
(_a = item.onClick) === null || _a === void 0 ? void 0 : _a.call(item);
|
|
1255
1254
|
handleDrawerClose();
|
|
1256
1255
|
};
|
|
1257
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(StyledAppBar, Object.assign({ position: "fixed" }, { children: jsxRuntime.jsxs(StyledToolbar, Object.assign({ disableGutters: true }, { children: [jsxRuntime.jsx(LogoContainer, Object.assign({ onClick: handleLogoClick }, { children: jsxRuntime.jsx(LogoImage, { src: logo, alt: "Logo" }) })), jsxRuntime.jsx(MenuIconButton, Object.assign({ size: "large", edge: "end", "aria-label": "menu", onClick: handleDrawerOpen }, { children: jsxRuntime.jsx(MenuIcon, {}) }))] })) })), jsxRuntime.jsx(StyledDrawer$2, Object.assign({ anchor: "right", open: drawerOpen, onClose: handleDrawerClose }, { children: customDrawerContent ? (jsxRuntime.jsx(material.Box, Object.assign({ sx: { width: isMobile ? '100vw' : 350 } }, { children: customDrawerContent }))) : (jsxRuntime.jsxs(material.Box, Object.assign({ sx: { width: isMobile ? '100vw' : 350 } }, { children: [jsxRuntime.jsxs(DrawerHeader$2, { children: [jsxRuntime.jsx(DrawerLogoContainer, Object.assign({ onClick: handleLogoClick }, { children: jsxRuntime.jsx(LogoImage, { src: logo, alt: "Logo" }) })), jsxRuntime.jsx(CloseIconButton, Object.assign({ onClick: handleDrawerClose, "aria-label": "close" }, { children: jsxRuntime.jsx(CloseIcon, {}) }))] }), jsxRuntime.jsx(material.Divider, {}), jsxRuntime.jsxs(DrawerContent$2, { children: [navigationLinks.length > 0 && (jsxRuntime.jsx(material.List, { children: navigationLinks.map((item) => (jsxRuntime.jsx(material.ListItem, Object.assign({ disablePadding: true }, { children: jsxRuntime.jsx(material.ListItemButton, Object.assign({ onClick: () => handleMenuItemClick(item) }, { children: jsxRuntime.jsx(material.ListItemText, { primary: formatMessage({ id: item.label }) }) })) }), item.key))) })), additionalMenuSections.map((section, index) => (jsxRuntime.jsxs(React__namespace.Fragment, { children: [section.title && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(material.Divider, {}), jsxRuntime.jsx(material.Box, Object.assign({ sx: { px: 2, py: 1 } }, { children: jsxRuntime.jsx(material.ListItemText, { primary: formatMessage({ id: section.title }), primaryTypographyProps: {
|
|
1256
|
+
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
1257
|
variant: 'caption',
|
|
1259
1258
|
color: 'text.secondary',
|
|
1260
1259
|
} }) }))] })), 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)))] })] }))) }))] }));
|
|
@@ -1525,8 +1524,8 @@ const FooterButtons = styles.styled(material.Box)(({ theme }) => ({
|
|
|
1525
1524
|
gap: '16px',
|
|
1526
1525
|
width: '100%',
|
|
1527
1526
|
}));
|
|
1527
|
+
// Base button styles - colors will be injected via sx prop from component
|
|
1528
1528
|
const PrimaryButton = styles.styled(material.Button)(({ theme }) => ({
|
|
1529
|
-
backgroundColor: '#4E4EEB',
|
|
1530
1529
|
color: '#FFFFFF',
|
|
1531
1530
|
borderRadius: '8px',
|
|
1532
1531
|
height: '48px',
|
|
@@ -1535,16 +1534,12 @@ const PrimaryButton = styles.styled(material.Button)(({ theme }) => ({
|
|
|
1535
1534
|
fontWeight: 500,
|
|
1536
1535
|
fontSize: '14px',
|
|
1537
1536
|
lineHeight: '18px',
|
|
1538
|
-
'&:hover': {
|
|
1539
|
-
backgroundColor: '#3E3EDB',
|
|
1540
|
-
},
|
|
1541
1537
|
'&:disabled': {
|
|
1542
1538
|
backgroundColor: '#C8C5CA',
|
|
1543
1539
|
color: '#FFFFFF',
|
|
1544
1540
|
},
|
|
1545
1541
|
}));
|
|
1546
1542
|
const SecondaryButton = styles.styled(material.Button)(({ theme }) => ({
|
|
1547
|
-
color: '#4E4EEB',
|
|
1548
1543
|
borderRadius: '8px',
|
|
1549
1544
|
height: '40px',
|
|
1550
1545
|
textTransform: 'none',
|
|
@@ -1552,9 +1547,6 @@ const SecondaryButton = styles.styled(material.Button)(({ theme }) => ({
|
|
|
1552
1547
|
fontWeight: 500,
|
|
1553
1548
|
fontSize: '14px',
|
|
1554
1549
|
lineHeight: '18px',
|
|
1555
|
-
'&:hover': {
|
|
1556
|
-
backgroundColor: 'rgba(78, 78, 235, 0.08)',
|
|
1557
|
-
},
|
|
1558
1550
|
}));
|
|
1559
1551
|
|
|
1560
1552
|
/**
|
|
@@ -1575,9 +1567,24 @@ const SecondaryButton = styles.styled(material.Button)(({ theme }) => ({
|
|
|
1575
1567
|
* ```
|
|
1576
1568
|
*/
|
|
1577
1569
|
function RecommendationsDrawer({ open, onClose, children, headerIcon, title, subtitle, showBackButton = false, onBack, primaryButtonText, onPrimaryAction, primaryButtonDisabled = false, secondaryButtonText, onSecondaryAction, showFooter = true, customFooter, formatMessage = (descriptor) => descriptor.id, }) {
|
|
1578
|
-
var _a;
|
|
1570
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1579
1571
|
const muiTheme = material.useTheme();
|
|
1580
1572
|
material.useMediaQuery((_a = muiTheme === null || muiTheme === void 0 ? void 0 : muiTheme.breakpoints) === null || _a === void 0 ? void 0 : _a.down('md'));
|
|
1573
|
+
const tenantTheme = useTenantTheme();
|
|
1574
|
+
// Get primary color from tenant theme, fallback to default
|
|
1575
|
+
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';
|
|
1576
|
+
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';
|
|
1577
|
+
// Helper to convert hex to rgba
|
|
1578
|
+
const hexToRgba = (hex, alpha) => {
|
|
1579
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
1580
|
+
if (result) {
|
|
1581
|
+
const r = parseInt(result[1], 16);
|
|
1582
|
+
const g = parseInt(result[2], 16);
|
|
1583
|
+
const b = parseInt(result[3], 16);
|
|
1584
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
1585
|
+
}
|
|
1586
|
+
return `rgba(49, 122, 188, ${alpha})`;
|
|
1587
|
+
};
|
|
1581
1588
|
const handleClose = () => {
|
|
1582
1589
|
onClose();
|
|
1583
1590
|
};
|
|
@@ -1598,7 +1605,17 @@ function RecommendationsDrawer({ open, onClose, children, headerIcon, title, sub
|
|
|
1598
1605
|
},
|
|
1599
1606
|
}, sx: {
|
|
1600
1607
|
zIndex: 1300,
|
|
1601
|
-
} }, { children: jsxRuntime.jsxs(material.Box, Object.assign({ sx: { display: 'flex', flexDirection: 'column', height: '100%' } }, { children: [jsxRuntime.jsx(DrawerHeader$1, { children: jsxRuntime.jsx(material.IconButton, Object.assign({ onClick: handleBackOrClose, sx: { padding: 0 }, "aria-label": showBackButton ? 'back' : 'close' }, { children: showBackButton ? jsxRuntime.jsx(ArrowBackIcon, {}) : jsxRuntime.jsx(CloseIcon, {}) })) }), (title || subtitle || headerIcon) && (jsxRuntime.jsxs(HeaderSection, { children: [headerIcon && (jsxRuntime.jsx(CategoryIcon, { children: jsxRuntime.jsx("img", { src: headerIcon, alt: "Category icon", width: 32, height: 32 }) })), title && (jsxRuntime.jsx(TitleText, Object.assign({ variant: "h5" }, { children: formatMessage({ id: title }) }))), subtitle && (jsxRuntime.jsx(SubtitleText, Object.assign({ variant: "body2" }, { children: formatMessage({ id: subtitle }) })))] })), jsxRuntime.jsx(DrawerContent$1, { children: children }), showFooter && (jsxRuntime.jsx(DrawerFooter, { children: customFooter ? (customFooter) : (jsxRuntime.jsxs(FooterButtons, { children: [primaryButtonText && (jsxRuntime.jsx(PrimaryButton, Object.assign({ variant: "contained", fullWidth: true, onClick: onPrimaryAction, disabled: primaryButtonDisabled
|
|
1608
|
+
} }, { 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: {
|
|
1609
|
+
backgroundColor: primaryColor,
|
|
1610
|
+
'&:hover': {
|
|
1611
|
+
backgroundColor: primaryDark,
|
|
1612
|
+
},
|
|
1613
|
+
} }, { children: formatMessage({ id: primaryButtonText }) }))), secondaryButtonText && (jsxRuntime.jsx(SecondaryButton, Object.assign({ variant: "text", fullWidth: true, onClick: onSecondaryAction, sx: {
|
|
1614
|
+
color: primaryColor,
|
|
1615
|
+
'&:hover': {
|
|
1616
|
+
backgroundColor: hexToRgba(primaryColor, 0.08),
|
|
1617
|
+
},
|
|
1618
|
+
} }, { children: formatMessage({ id: secondaryButtonText }) })))] })) }))] })) })));
|
|
1602
1619
|
}
|
|
1603
1620
|
|
|
1604
1621
|
const StyledDrawer = material.styled(material.Drawer)(({ theme }) => ({
|
|
@@ -1656,7 +1673,7 @@ const ProductsGrid = material.styled(material.Box)({
|
|
|
1656
1673
|
gridTemplateColumns: 'repeat(2, 1fr)',
|
|
1657
1674
|
gap: '12px',
|
|
1658
1675
|
});
|
|
1659
|
-
const ProductCard = material.styled(material.Box)({
|
|
1676
|
+
const ProductCard$1 = material.styled(material.Box)({
|
|
1660
1677
|
display: 'flex',
|
|
1661
1678
|
flexDirection: 'column',
|
|
1662
1679
|
gap: '16px',
|
|
@@ -1666,7 +1683,7 @@ const ProductCard = material.styled(material.Box)({
|
|
|
1666
1683
|
padding: '16px 12px 12px',
|
|
1667
1684
|
height: '168px',
|
|
1668
1685
|
});
|
|
1669
|
-
const ProductInfo = material.styled(material.Box)({
|
|
1686
|
+
const ProductInfo$1 = material.styled(material.Box)({
|
|
1670
1687
|
display: 'flex',
|
|
1671
1688
|
flexDirection: 'column',
|
|
1672
1689
|
gap: '6px',
|
|
@@ -1680,7 +1697,7 @@ const ProductLogo = material.styled(material.Box)({
|
|
|
1680
1697
|
justifyContent: 'center',
|
|
1681
1698
|
padding: '4px',
|
|
1682
1699
|
});
|
|
1683
|
-
const ProductName = material.styled(material.Typography)({
|
|
1700
|
+
const ProductName$1 = material.styled(material.Typography)({
|
|
1684
1701
|
fontFamily: 'Montserrat, sans-serif',
|
|
1685
1702
|
fontSize: '14px',
|
|
1686
1703
|
fontWeight: 700,
|
|
@@ -1696,8 +1713,8 @@ const ProductType = material.styled(material.Typography)({
|
|
|
1696
1713
|
color: '#13131b',
|
|
1697
1714
|
textAlign: 'center',
|
|
1698
1715
|
});
|
|
1716
|
+
// Base button styles - colors will be injected via sx prop from component
|
|
1699
1717
|
const ViewPlansButton = material.styled(material.Button)({
|
|
1700
|
-
backgroundColor: '#317abc',
|
|
1701
1718
|
color: '#ffffff',
|
|
1702
1719
|
borderRadius: '8px',
|
|
1703
1720
|
height: '36px',
|
|
@@ -1706,23 +1723,31 @@ const ViewPlansButton = material.styled(material.Button)({
|
|
|
1706
1723
|
fontSize: '14px',
|
|
1707
1724
|
fontWeight: 500,
|
|
1708
1725
|
lineHeight: '18px',
|
|
1709
|
-
'&:hover': {
|
|
1710
|
-
backgroundColor: '#2869a8',
|
|
1711
|
-
},
|
|
1712
|
-
'&:active': {
|
|
1713
|
-
backgroundColor: '#1f5489',
|
|
1714
|
-
},
|
|
1715
1726
|
});
|
|
1716
1727
|
|
|
1717
1728
|
function ProductSelectionDrawer({ open, onClose, products, onProductSelect, title = 'Select your product', subtitle = 'Pick the product that suits your protection goals to view available plans', viewPlansButtonText = 'View plans', }) {
|
|
1718
|
-
|
|
1729
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1730
|
+
const tenantTheme = useTenantTheme();
|
|
1731
|
+
// Get primary color from tenant theme, fallback to default
|
|
1732
|
+
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';
|
|
1733
|
+
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';
|
|
1734
|
+
const primaryDarker = '#1f5489'; // Active state
|
|
1735
|
+
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: {
|
|
1719
1736
|
width: '88px',
|
|
1720
1737
|
height: '32px',
|
|
1721
1738
|
objectFit: 'cover',
|
|
1722
|
-
} }) }), jsxRuntime.jsxs(material.Box, Object.assign({ sx: { textAlign: 'center', width: '100%' } }, { children: [jsxRuntime.jsx(ProductName, { children: product.name }), jsxRuntime.jsx(ProductType, { children: product.type })] }))] }), jsxRuntime.jsx(ViewPlansButton, Object.assign({ variant: "contained", fullWidth: true, onClick: () => onProductSelect(product.id)
|
|
1739
|
+
} }) }), 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: {
|
|
1740
|
+
backgroundColor: primaryColor,
|
|
1741
|
+
'&:hover': {
|
|
1742
|
+
backgroundColor: primaryDark,
|
|
1743
|
+
},
|
|
1744
|
+
'&:active': {
|
|
1745
|
+
backgroundColor: primaryDarker,
|
|
1746
|
+
},
|
|
1747
|
+
} }, { children: viewPlansButtonText }))] }, product.id))) }) })] }) })));
|
|
1723
1748
|
}
|
|
1724
1749
|
|
|
1725
|
-
const QuestionContainer = styles.styled(material.Box)(({ theme }) => ({
|
|
1750
|
+
const QuestionContainer$1 = styles.styled(material.Box)(({ theme }) => ({
|
|
1726
1751
|
backgroundColor: '#FFFFFF',
|
|
1727
1752
|
padding: '12px 16px',
|
|
1728
1753
|
display: 'flex',
|
|
@@ -1750,7 +1775,7 @@ const QuestionSubtext = styles.styled(material.Typography)(({ theme }) => ({
|
|
|
1750
1775
|
lineHeight: '16px',
|
|
1751
1776
|
color: '#5F5E62',
|
|
1752
1777
|
}));
|
|
1753
|
-
const OptionsContainer = styles.styled(material.Box)(({ theme }) => ({
|
|
1778
|
+
const OptionsContainer$1 = styles.styled(material.Box)(({ theme }) => ({
|
|
1754
1779
|
display: 'flex',
|
|
1755
1780
|
flexDirection: 'column',
|
|
1756
1781
|
gap: '8px',
|
|
@@ -1779,7 +1804,7 @@ function QuestionSection({ questionNumber, question, helperText, options, select
|
|
|
1779
1804
|
}
|
|
1780
1805
|
return selectedValue === optionValue;
|
|
1781
1806
|
};
|
|
1782
|
-
return (jsxRuntime.jsxs(QuestionContainer, { children: [jsxRuntime.jsxs(QuestionHeader, { children: [jsxRuntime.jsxs(QuestionTitle, Object.assign({ variant: "subtitle1" }, { children: [questionNumber && `${questionNumber}. `, formatMessage({ id: question })] })), helperText && (jsxRuntime.jsx(QuestionSubtext, Object.assign({ variant: "caption" }, { children: formatMessage({ id: helperText }) })))] }), jsxRuntime.jsx(OptionsContainer, { children: options.map((option) => {
|
|
1807
|
+
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) => {
|
|
1783
1808
|
const selected = isSelected(option.value);
|
|
1784
1809
|
if (renderOption) {
|
|
1785
1810
|
return renderOption(option, selected);
|
|
@@ -1855,7 +1880,7 @@ const OptionLabel = styles.styled(material.Typography)(({ theme, selected, disab
|
|
|
1855
1880
|
* />
|
|
1856
1881
|
* ```
|
|
1857
1882
|
*/
|
|
1858
|
-
function OptionButton({ value, label, icon, selected = false, disabled = false, onClick, size = 'medium', fullWidth = true, formatMessage = (descriptor) => descriptor.id, }) {
|
|
1883
|
+
function OptionButton$1({ value, label, icon, selected = false, disabled = false, onClick, size = 'medium', fullWidth = true, formatMessage = (descriptor) => descriptor.id, }) {
|
|
1859
1884
|
const handleClick = () => {
|
|
1860
1885
|
if (!disabled && onClick) {
|
|
1861
1886
|
onClick(value);
|
|
@@ -2214,7 +2239,7 @@ const InputContainer = styles.styled(material.Box)(({ theme }) => {
|
|
|
2214
2239
|
border: `1px solid ${((_d = (_c = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _c === void 0 ? void 0 : _c.ui) === null || _d === void 0 ? void 0 : _d.inputBorder) || '#eeeeee'}`,
|
|
2215
2240
|
borderRadius: '8px',
|
|
2216
2241
|
width: '100%',
|
|
2217
|
-
maxWidth: '
|
|
2242
|
+
maxWidth: 'initial', // Match slider track width
|
|
2218
2243
|
});
|
|
2219
2244
|
});
|
|
2220
2245
|
const InputValue = styles.styled(material.Typography)(({ theme }) => {
|
|
@@ -2230,15 +2255,15 @@ const InputValue = styles.styled(material.Typography)(({ theme }) => {
|
|
|
2230
2255
|
flex: 1,
|
|
2231
2256
|
});
|
|
2232
2257
|
});
|
|
2233
|
-
|
|
2258
|
+
styles.styled(material.Box)(({ theme }) => ({
|
|
2234
2259
|
display: 'flex',
|
|
2235
2260
|
alignItems: 'center',
|
|
2236
2261
|
position: 'relative',
|
|
2237
2262
|
width: '100%',
|
|
2238
|
-
maxWidth: '
|
|
2263
|
+
maxWidth: 'initial',
|
|
2239
2264
|
height: '4px',
|
|
2240
2265
|
}));
|
|
2241
|
-
|
|
2266
|
+
styles.styled(material.Box)(({ theme, active }) => {
|
|
2242
2267
|
var _a, _b, _c, _d;
|
|
2243
2268
|
return ({
|
|
2244
2269
|
height: '4px',
|
|
@@ -2250,7 +2275,7 @@ const SliderSegment = styles.styled(material.Box)(({ theme, active }) => {
|
|
|
2250
2275
|
marginRight: '-1px',
|
|
2251
2276
|
});
|
|
2252
2277
|
});
|
|
2253
|
-
|
|
2278
|
+
styles.styled(material.Box)(({ theme, active }) => {
|
|
2254
2279
|
var _a, _b, _c, _d;
|
|
2255
2280
|
return ({
|
|
2256
2281
|
width: '10px',
|
|
@@ -2270,7 +2295,7 @@ const SliderDot = styles.styled(material.Box)(({ theme, active }) => {
|
|
|
2270
2295
|
},
|
|
2271
2296
|
});
|
|
2272
2297
|
});
|
|
2273
|
-
|
|
2298
|
+
styles.styled(material.Box)(({ theme }) => ({
|
|
2274
2299
|
position: 'absolute',
|
|
2275
2300
|
width: '18px',
|
|
2276
2301
|
height: '18px',
|
|
@@ -2288,7 +2313,7 @@ const SliderThumb = styles.styled(material.Box)(({ theme }) => ({
|
|
|
2288
2313
|
cursor: 'grabbing',
|
|
2289
2314
|
},
|
|
2290
2315
|
}));
|
|
2291
|
-
|
|
2316
|
+
styles.styled(material.Box)(({ theme }) => {
|
|
2292
2317
|
var _a, _b;
|
|
2293
2318
|
return ({
|
|
2294
2319
|
width: '13px',
|
|
@@ -2299,11 +2324,11 @@ const ThumbIcon = styles.styled(material.Box)(({ theme }) => {
|
|
|
2299
2324
|
color: ((_b = (_a = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _a === void 0 ? void 0 : _a.ui) === null || _b === void 0 ? void 0 : _b.sliderActive) || '#317abc',
|
|
2300
2325
|
});
|
|
2301
2326
|
});
|
|
2302
|
-
|
|
2327
|
+
styles.styled(material.Box)(({ theme }) => ({
|
|
2303
2328
|
display: 'flex',
|
|
2304
2329
|
justifyContent: 'space-between',
|
|
2305
2330
|
width: '100%',
|
|
2306
|
-
maxWidth: '
|
|
2331
|
+
maxWidth: 'initial', // Match slider track width
|
|
2307
2332
|
}));
|
|
2308
2333
|
const RangeLabel = styles.styled(material.Typography)(({ theme }) => {
|
|
2309
2334
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
@@ -2316,6 +2341,72 @@ const RangeLabel = styles.styled(material.Typography)(({ theme }) => {
|
|
|
2316
2341
|
color: ((_j = (_h = theme === null || theme === void 0 ? void 0 : theme.palette) === null || _h === void 0 ? void 0 : _h.natural) === null || _j === void 0 ? void 0 : _j.main) || '#929094',
|
|
2317
2342
|
});
|
|
2318
2343
|
});
|
|
2344
|
+
const StyledMuiSlider = styles.styled(material.Slider)(({ theme, sliderActiveColor, sliderInactiveColor }) => {
|
|
2345
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
2346
|
+
return ({
|
|
2347
|
+
width: '100%',
|
|
2348
|
+
marginBottom: '0px !important',
|
|
2349
|
+
padding: '7px 0px !important',
|
|
2350
|
+
'& .MuiSlider-markLabel': {
|
|
2351
|
+
display: 'none',
|
|
2352
|
+
},
|
|
2353
|
+
'& .MuiSlider-mark': {
|
|
2354
|
+
width: 10,
|
|
2355
|
+
height: 10,
|
|
2356
|
+
borderRadius: '50%',
|
|
2357
|
+
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',
|
|
2358
|
+
},
|
|
2359
|
+
'& .MuiSlider-track': {
|
|
2360
|
+
height: 4,
|
|
2361
|
+
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',
|
|
2362
|
+
},
|
|
2363
|
+
'& .MuiSlider-rail': {
|
|
2364
|
+
height: 4,
|
|
2365
|
+
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',
|
|
2366
|
+
},
|
|
2367
|
+
'& .MuiSlider-markActive': {
|
|
2368
|
+
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',
|
|
2369
|
+
},
|
|
2370
|
+
'& .MuiSlider-thumb': {
|
|
2371
|
+
display: 'flex',
|
|
2372
|
+
justifyContent: 'center',
|
|
2373
|
+
alignItems: 'center',
|
|
2374
|
+
height: 18,
|
|
2375
|
+
width: 18,
|
|
2376
|
+
backgroundColor: '#ffffff',
|
|
2377
|
+
border: 'none',
|
|
2378
|
+
cursor: 'pointer',
|
|
2379
|
+
borderRadius: '50%',
|
|
2380
|
+
boxShadow: '0px 2px 20px 4px rgba(0, 0, 0, 0.14)',
|
|
2381
|
+
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`,
|
|
2382
|
+
transform: 'translate(-50%, -50%) !important',
|
|
2383
|
+
'&::before': {
|
|
2384
|
+
content: '""',
|
|
2385
|
+
width: '13px',
|
|
2386
|
+
height: '10px',
|
|
2387
|
+
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")`,
|
|
2388
|
+
backgroundRepeat: 'no-repeat',
|
|
2389
|
+
backgroundPosition: 'center',
|
|
2390
|
+
backgroundSize: 'contain',
|
|
2391
|
+
},
|
|
2392
|
+
'&:hover': {
|
|
2393
|
+
boxShadow: '0px 2px 20px 4px rgba(0, 0, 0, 0.2)',
|
|
2394
|
+
},
|
|
2395
|
+
'&.Mui-focusVisible': {
|
|
2396
|
+
boxShadow: '0px 2px 20px 4px rgba(0, 0, 0, 0.2)',
|
|
2397
|
+
},
|
|
2398
|
+
'&.Mui-active': {
|
|
2399
|
+
boxShadow: '0px 2px 20px 4px rgba(0, 0, 0, 0.2)',
|
|
2400
|
+
},
|
|
2401
|
+
},
|
|
2402
|
+
});
|
|
2403
|
+
});
|
|
2404
|
+
const SliderLabelsContainer = styles.styled(material.Box)(({ theme }) => ({
|
|
2405
|
+
display: 'flex',
|
|
2406
|
+
justifyContent: 'space-between',
|
|
2407
|
+
width: '100%',
|
|
2408
|
+
marginTop: '6px',
|
|
2409
|
+
}));
|
|
2319
2410
|
|
|
2320
2411
|
/**
|
|
2321
2412
|
* CoverageAmountSlider - Interactive slider for selecting coverage amounts
|
|
@@ -2330,11 +2421,12 @@ const RangeLabel = styles.styled(material.Typography)(({ theme }) => {
|
|
|
2330
2421
|
* />
|
|
2331
2422
|
* ```
|
|
2332
2423
|
*/
|
|
2333
|
-
function CoverageAmountSlider({ min, max, value, onChange, label = 'Choose your coverage amount',
|
|
2424
|
+
function CoverageAmountSlider({ min, max, value, onChange, label = 'Choose your coverage amount', steps = 5, currency = 'RM', formatCurrency: customFormatCurrency, disabled = false, }) {
|
|
2334
2425
|
// Safely get theme, handle SSR case where it might be undefined
|
|
2335
2426
|
const tenantTheme = useTenantTheme();
|
|
2336
2427
|
const theme = tenantTheme === null || tenantTheme === void 0 ? void 0 : tenantTheme.theme;
|
|
2337
2428
|
const [localValue, setLocalValue] = React.useState(value);
|
|
2429
|
+
const [sliderIndex, setSliderIndex] = React.useState(0);
|
|
2338
2430
|
// Get theme colors with SSR-safe fallbacks
|
|
2339
2431
|
const sliderActiveColor = getThemeColor(theme, 'ui.sliderActive', '#317abc');
|
|
2340
2432
|
const sliderInactiveColor = getThemeColor(theme, 'ui.sliderInactive', '#c8c5ca');
|
|
@@ -2343,9 +2435,33 @@ function CoverageAmountSlider({ min, max, value, onChange, label = 'Choose your
|
|
|
2343
2435
|
const inputBorderColor = getThemeColor(theme, 'ui.inputBorder', '#eeeeee');
|
|
2344
2436
|
const textColor = getThemeColor(theme, 'natural.dim', '#13131b');
|
|
2345
2437
|
const labelColor = getThemeColor(theme, 'natural.main', '#929094');
|
|
2438
|
+
// Generate slider marks/options based on min, max, and steps
|
|
2439
|
+
const { sliderMarks, stepSize, maxSliderValue, defaultSliderValue } = React.useMemo(() => {
|
|
2440
|
+
const stepAmount = (max - min) / (steps - 1);
|
|
2441
|
+
const marks = [];
|
|
2442
|
+
for (let i = 0; i < steps; i++) {
|
|
2443
|
+
const coverageValue = min + stepAmount * i;
|
|
2444
|
+
marks.push({
|
|
2445
|
+
value: i * 10,
|
|
2446
|
+
label: `${(coverageValue / 1000).toFixed(0)}k`,
|
|
2447
|
+
coverageVal: coverageValue,
|
|
2448
|
+
});
|
|
2449
|
+
}
|
|
2450
|
+
// Find the default slider position based on the initial value
|
|
2451
|
+
const defaultIdx = marks.findIndex((m) => m.coverageVal >= value) || 0;
|
|
2452
|
+
return {
|
|
2453
|
+
sliderMarks: marks,
|
|
2454
|
+
stepSize: 10,
|
|
2455
|
+
maxSliderValue: (steps - 1) * 10,
|
|
2456
|
+
defaultSliderValue: defaultIdx * 10,
|
|
2457
|
+
};
|
|
2458
|
+
}, [min, max, steps, value]);
|
|
2346
2459
|
React.useEffect(() => {
|
|
2347
2460
|
setLocalValue(value);
|
|
2348
|
-
|
|
2461
|
+
// Update slider index when value changes externally
|
|
2462
|
+
const idx = sliderMarks.findIndex((m) => m.coverageVal >= value);
|
|
2463
|
+
setSliderIndex(idx >= 0 ? idx * 10 : 0);
|
|
2464
|
+
}, [value, sliderMarks]);
|
|
2349
2465
|
const defaultFormatCurrency = (amount) => {
|
|
2350
2466
|
return `${currency} ${amount.toLocaleString('en-US', {
|
|
2351
2467
|
minimumFractionDigits: 0,
|
|
@@ -2354,79 +2470,378 @@ function CoverageAmountSlider({ min, max, value, onChange, label = 'Choose your
|
|
|
2354
2470
|
};
|
|
2355
2471
|
const formatCurrency = customFormatCurrency || defaultFormatCurrency;
|
|
2356
2472
|
const handleDecrease = () => {
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
const
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2473
|
+
if (disabled)
|
|
2474
|
+
return;
|
|
2475
|
+
const currentIdx = sliderMarks.findIndex((m) => m.coverageVal === localValue);
|
|
2476
|
+
if (currentIdx > 0) {
|
|
2477
|
+
const newValue = sliderMarks[currentIdx - 1].coverageVal;
|
|
2478
|
+
setLocalValue(newValue);
|
|
2479
|
+
setSliderIndex((currentIdx - 1) * 10);
|
|
2480
|
+
onChange(newValue);
|
|
2481
|
+
}
|
|
2363
2482
|
};
|
|
2364
2483
|
const handleIncrease = () => {
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
const
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2484
|
+
if (disabled)
|
|
2485
|
+
return;
|
|
2486
|
+
const currentIdx = sliderMarks.findIndex((m) => m.coverageVal === localValue);
|
|
2487
|
+
if (currentIdx < sliderMarks.length - 1) {
|
|
2488
|
+
const newValue = sliderMarks[currentIdx + 1].coverageVal;
|
|
2489
|
+
setLocalValue(newValue);
|
|
2490
|
+
setSliderIndex((currentIdx + 1) * 10);
|
|
2491
|
+
onChange(newValue);
|
|
2492
|
+
}
|
|
2371
2493
|
};
|
|
2372
|
-
const
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2494
|
+
const handleSliderChange = (_event, newValue) => {
|
|
2495
|
+
if (disabled)
|
|
2496
|
+
return;
|
|
2497
|
+
const sliderVal = newValue;
|
|
2498
|
+
const currentMark = sliderMarks.find((opt) => opt.value === sliderVal);
|
|
2499
|
+
if (currentMark) {
|
|
2500
|
+
setSliderIndex(sliderVal);
|
|
2501
|
+
setLocalValue(currentMark.coverageVal);
|
|
2502
|
+
onChange(currentMark.coverageVal);
|
|
2503
|
+
}
|
|
2377
2504
|
};
|
|
2378
|
-
const percentage = ((localValue - min) / (max - min)) * 100;
|
|
2379
|
-
// Track width is 298px (10 dots * 10px + 9 gaps * 22px = 298px)
|
|
2380
|
-
// Each dot is 10px wide, so dot centers are at: 5px, 37px, 69px, ... (5 + dotIndex * 32)
|
|
2381
|
-
// First dot center: 5px (half of 10px dot width)
|
|
2382
|
-
// Last dot center: 298px - 5px = 293px
|
|
2383
|
-
// Thumb is 18px wide, so thumb center offset from left edge is 9px
|
|
2384
|
-
// Position thumb so its center aligns with the dot center
|
|
2385
|
-
// left = dotCenter - thumbCenterOffset = dotCenter - 9px
|
|
2386
|
-
const firstDotCenter = 5; // First dot center position
|
|
2387
|
-
const lastDotCenter = 298 - 5; // Last dot center position
|
|
2388
|
-
const thumbCenterOffset = 9; // Half of thumb width (18px / 2)
|
|
2389
|
-
const dotCenterPosition = firstDotCenter + (percentage / 100) * (lastDotCenter - firstDotCenter);
|
|
2390
|
-
const thumbPosition = dotCenterPosition - thumbCenterOffset;
|
|
2391
|
-
// Create slider with dots: dot-segment-dot-segment-...-dot
|
|
2392
|
-
// With 8 segments, we have 9 dots total (start + 8 in between + end)
|
|
2393
|
-
// But user wants 8 dots in between, so total = 1 (start) + 8 (between) + 1 (end) = 10 dots
|
|
2394
|
-
// This means 9 segments between the 10 dots
|
|
2395
|
-
const dotsInBetween = segments; // 8 dots in between
|
|
2396
|
-
const totalDots = dotsInBetween + 2; // start + 8 in between + end = 10 dots
|
|
2397
2505
|
return (jsxRuntime.jsxs(SliderContainer, Object.assign({ sx: {
|
|
2398
2506
|
backgroundColor: sliderBgColor,
|
|
2399
2507
|
} }, { children: [jsxRuntime.jsxs(InputSection, { children: [jsxRuntime.jsx(InputLabel, Object.assign({ sx: { color: textColor } }, { children: label })), jsxRuntime.jsxs(InputContainer, Object.assign({ sx: {
|
|
2400
2508
|
backgroundColor: inputBgColor,
|
|
2401
2509
|
border: `1px solid ${inputBorderColor}`,
|
|
2402
|
-
|
|
2510
|
+
opacity: disabled ? 0.5 : 1,
|
|
2511
|
+
} }, { children: [jsxRuntime.jsx(material.IconButton, Object.assign({ onClick: handleDecrease, disabled: disabled, sx: {
|
|
2403
2512
|
padding: 0,
|
|
2404
2513
|
width: '24px',
|
|
2405
2514
|
height: '24px',
|
|
2406
2515
|
color: textColor,
|
|
2407
|
-
} }, { children: jsxRuntime.jsx(RemoveIcon, { sx: { fontSize: 24 } }) })), jsxRuntime.jsx(InputValue, Object.assign({ sx: { color: textColor } }, { children: formatCurrency(localValue) })), jsxRuntime.jsx(material.IconButton, Object.assign({ onClick: handleIncrease, sx: {
|
|
2516
|
+
} }, { 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: {
|
|
2408
2517
|
padding: 0,
|
|
2409
2518
|
width: '24px',
|
|
2410
2519
|
height: '24px',
|
|
2411
2520
|
color: textColor,
|
|
2412
|
-
} }, { children: jsxRuntime.jsx(AddIcon, { sx: { fontSize: 24 } }) }))] }))] }), jsxRuntime.jsxs(material.Box, Object.assign({ sx: { display: 'flex', flexDirection: 'column',
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
: sliderInactiveColor,
|
|
2420
|
-
} }), !isLast && (jsxRuntime.jsx(SliderSegment, { active: localValue > dotValue, sx: {
|
|
2421
|
-
backgroundColor: localValue > dotValue
|
|
2422
|
-
? sliderActiveColor
|
|
2423
|
-
: sliderInactiveColor,
|
|
2424
|
-
} }))] }), index));
|
|
2425
|
-
}), jsxRuntime.jsx(SliderThumb, Object.assign({ style: {
|
|
2426
|
-
left: `${thumbPosition}px`,
|
|
2427
|
-
} }, { children: jsxRuntime.jsx(ThumbIcon, Object.assign({ sx: { color: sliderActiveColor } }, { children: jsxRuntime.jsx(DragHandleIcon, { sx: { fontSize: 16 } }) })) }))] }), jsxRuntime.jsxs(RangeLabels, { children: [jsxRuntime.jsx(RangeLabel, Object.assign({ sx: { color: labelColor } }, { children: formatCurrency(min) })), jsxRuntime.jsx(RangeLabel, Object.assign({ sx: { textAlign: 'right', color: labelColor } }, { children: formatCurrency(max) }))] })] }))] })));
|
|
2521
|
+
} }, { 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: {
|
|
2522
|
+
color: sliderIndex === mark.value
|
|
2523
|
+
? sliderActiveColor
|
|
2524
|
+
: labelColor,
|
|
2525
|
+
textAlign: index === 0 ? 'left' : index === sliderMarks.length - 1 ? 'right' : 'center',
|
|
2526
|
+
flex: index === 0 || index === sliderMarks.length - 1 ? 'none' : 1,
|
|
2527
|
+
} }, { children: mark.label }), index))) })] }))] })));
|
|
2428
2528
|
}
|
|
2429
2529
|
|
|
2530
|
+
const ProgressBarContainer = styles.styled(material.Box)({
|
|
2531
|
+
display: 'flex',
|
|
2532
|
+
alignItems: 'center',
|
|
2533
|
+
gap: '8px',
|
|
2534
|
+
padding: '16px',
|
|
2535
|
+
});
|
|
2536
|
+
const ProgressBar = styles.styled(material.Box)({
|
|
2537
|
+
display: 'flex',
|
|
2538
|
+
alignItems: 'center',
|
|
2539
|
+
flex: 1,
|
|
2540
|
+
height: '4px',
|
|
2541
|
+
backgroundColor: 'rgba(0, 0, 0, 0.1)',
|
|
2542
|
+
borderRadius: '2px',
|
|
2543
|
+
overflow: 'hidden',
|
|
2544
|
+
});
|
|
2545
|
+
const ProgressFill = styles.styled(material.Box)(({ width, progressBarTheme }) => ({
|
|
2546
|
+
height: '100%',
|
|
2547
|
+
width: `${width}%`,
|
|
2548
|
+
background: progressBarTheme || 'linear-gradient(90deg, #0090DA 0.06%, #A4CE4E 99.94%)',
|
|
2549
|
+
transition: 'width 0.3s ease',
|
|
2550
|
+
}));
|
|
2551
|
+
const ProgressText = styles.styled(material.Typography)({
|
|
2552
|
+
fontFamily: 'Montserrat',
|
|
2553
|
+
fontSize: '12px',
|
|
2554
|
+
color: '#5F5E62',
|
|
2555
|
+
fontWeight: 400,
|
|
2556
|
+
lineHeight: '16px',
|
|
2557
|
+
});
|
|
2558
|
+
|
|
2559
|
+
const CheckoutProgress = ({ currentStep, totalSteps, onBack, showBackButton = true, progressBarTheme, sx, }) => {
|
|
2560
|
+
const progressPercentage = ((currentStep + 1) / totalSteps) * 100;
|
|
2561
|
+
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] })] })));
|
|
2562
|
+
};
|
|
2563
|
+
|
|
2564
|
+
const ProductCardContainer = styles.styled(material.Box)(({ theme, showIndicator }) => {
|
|
2565
|
+
var _a, _b;
|
|
2566
|
+
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 && {
|
|
2567
|
+
'&::before': {
|
|
2568
|
+
content: '""',
|
|
2569
|
+
position: 'absolute',
|
|
2570
|
+
left: 0,
|
|
2571
|
+
top: 0,
|
|
2572
|
+
width: '8px',
|
|
2573
|
+
height: '64px',
|
|
2574
|
+
borderRadius: '0 0 8px 8px',
|
|
2575
|
+
backgroundColor: ((_b = (_a = theme.palette) === null || _a === void 0 ? void 0 : _a.primary) === null || _b === void 0 ? void 0 : _b.main) || '#13131B',
|
|
2576
|
+
},
|
|
2577
|
+
})));
|
|
2578
|
+
});
|
|
2579
|
+
const LogoContainer = styles.styled(material.Box)({
|
|
2580
|
+
width: '45px',
|
|
2581
|
+
height: '40px',
|
|
2582
|
+
border: '1.25px solid rgba(0, 0, 0, 0.1)',
|
|
2583
|
+
borderRadius: '10px',
|
|
2584
|
+
display: 'flex',
|
|
2585
|
+
alignItems: 'center',
|
|
2586
|
+
justifyContent: 'center',
|
|
2587
|
+
flexShrink: 0,
|
|
2588
|
+
marginLeft: '8px',
|
|
2589
|
+
});
|
|
2590
|
+
const ProductInfo = styles.styled(material.Box)({
|
|
2591
|
+
flex: 1,
|
|
2592
|
+
marginLeft: '4px',
|
|
2593
|
+
});
|
|
2594
|
+
const ProductName = styles.styled(material.Typography)({
|
|
2595
|
+
fontFamily: 'Montserrat',
|
|
2596
|
+
fontSize: '14px',
|
|
2597
|
+
fontWeight: 600,
|
|
2598
|
+
color: '#13131B',
|
|
2599
|
+
lineHeight: '20px',
|
|
2600
|
+
});
|
|
2601
|
+
const PlanName = styles.styled(material.Typography)({
|
|
2602
|
+
fontFamily: 'Montserrat',
|
|
2603
|
+
fontSize: '12px',
|
|
2604
|
+
fontWeight: 400,
|
|
2605
|
+
color: '#13131B',
|
|
2606
|
+
lineHeight: '16px',
|
|
2607
|
+
});
|
|
2608
|
+
const PriceContainer = styles.styled(material.Box)({
|
|
2609
|
+
display: 'flex',
|
|
2610
|
+
alignItems: 'baseline',
|
|
2611
|
+
gap: '2px',
|
|
2612
|
+
});
|
|
2613
|
+
const Price = styles.styled(material.Typography)({
|
|
2614
|
+
fontFamily: 'Montserrat',
|
|
2615
|
+
fontSize: '14px',
|
|
2616
|
+
fontWeight: 600,
|
|
2617
|
+
color: '#13131B',
|
|
2618
|
+
lineHeight: '20px',
|
|
2619
|
+
});
|
|
2620
|
+
const PricePeriod = styles.styled(material.Typography)({
|
|
2621
|
+
fontFamily: 'Montserrat',
|
|
2622
|
+
fontSize: '12px',
|
|
2623
|
+
fontWeight: 400,
|
|
2624
|
+
color: '#13131B',
|
|
2625
|
+
lineHeight: '16px',
|
|
2626
|
+
});
|
|
2627
|
+
|
|
2628
|
+
const ProductCard = ({ productName, planName, logoUrl, price, currency = 'RM', period = '/month', sx, showIndicator = true, }) => {
|
|
2629
|
+
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 })] })] })));
|
|
2630
|
+
};
|
|
2631
|
+
|
|
2632
|
+
const HeaderContainer = styles.styled(material.Box)(({ sticky }) => (Object.assign(Object.assign({}, (sticky && {
|
|
2633
|
+
position: 'sticky',
|
|
2634
|
+
top: 0,
|
|
2635
|
+
zIndex: 1000,
|
|
2636
|
+
})), { backgroundColor: '#fff', width: '100%' })));
|
|
2637
|
+
const SectionHeader = styles.styled(material.Box)({
|
|
2638
|
+
padding: '0 16px 24px',
|
|
2639
|
+
});
|
|
2640
|
+
const SectionTitle = styles.styled(material.Typography)({
|
|
2641
|
+
fontFamily: 'Montserrat',
|
|
2642
|
+
fontSize: '20px',
|
|
2643
|
+
fontWeight: 700,
|
|
2644
|
+
color: '#13131B',
|
|
2645
|
+
lineHeight: '28px',
|
|
2646
|
+
marginBottom: '8px',
|
|
2647
|
+
});
|
|
2648
|
+
const SectionDescription = styles.styled(material.Typography)({
|
|
2649
|
+
fontFamily: 'Montserrat',
|
|
2650
|
+
fontSize: '14px',
|
|
2651
|
+
fontWeight: 400,
|
|
2652
|
+
color: '#5F5E62',
|
|
2653
|
+
lineHeight: '18px',
|
|
2654
|
+
});
|
|
2655
|
+
|
|
2656
|
+
const CheckoutHeader = ({ progress, product, sectionTitle, sectionDescription, sticky = true, progressBarTheme, sx, }) => {
|
|
2657
|
+
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, { children: sectionTitle }), jsxRuntime.jsx(SectionDescription, { children: sectionDescription })] })] })));
|
|
2658
|
+
};
|
|
2659
|
+
|
|
2660
|
+
const ButtonContainer = styles.styled(material.Box)(({ isFixed }) => ({
|
|
2661
|
+
position: isFixed ? 'fixed' : 'relative',
|
|
2662
|
+
bottom: 0,
|
|
2663
|
+
left: 0,
|
|
2664
|
+
right: 0,
|
|
2665
|
+
backgroundColor: '#fff',
|
|
2666
|
+
padding: '16px',
|
|
2667
|
+
boxShadow: isFixed ? '0px 2px 10px 0px rgba(0, 0, 0, 0.12)' : 'none',
|
|
2668
|
+
zIndex: 999,
|
|
2669
|
+
}));
|
|
2670
|
+
const StyledButton = styles.styled('button')(({ theme, isDisabled }) => {
|
|
2671
|
+
var _a, _b, _c, _d;
|
|
2672
|
+
return ({
|
|
2673
|
+
width: '100%',
|
|
2674
|
+
height: '48px',
|
|
2675
|
+
borderRadius: '8px',
|
|
2676
|
+
border: 'none',
|
|
2677
|
+
backgroundColor: isDisabled
|
|
2678
|
+
? '#E1E2EB'
|
|
2679
|
+
: ((_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',
|
|
2680
|
+
color: isDisabled ? '#929094' : '#fff',
|
|
2681
|
+
fontFamily: 'Montserrat',
|
|
2682
|
+
fontSize: '14px',
|
|
2683
|
+
fontWeight: 500,
|
|
2684
|
+
lineHeight: '18px',
|
|
2685
|
+
cursor: isDisabled ? 'not-allowed' : 'pointer',
|
|
2686
|
+
transition: 'all 0.2s ease',
|
|
2687
|
+
'&:hover': {
|
|
2688
|
+
backgroundColor: isDisabled
|
|
2689
|
+
? '#E1E2EB'
|
|
2690
|
+
: ((_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',
|
|
2691
|
+
},
|
|
2692
|
+
});
|
|
2693
|
+
});
|
|
2694
|
+
|
|
2695
|
+
const CheckoutFormButton = ({ text = 'Next', disabled = false, onClick, fixed = true, type = 'button', sx, loading = false, }) => {
|
|
2696
|
+
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 })) })));
|
|
2697
|
+
};
|
|
2698
|
+
|
|
2699
|
+
const QuestionContainer = styles.styled(material.Box)({
|
|
2700
|
+
display: 'flex',
|
|
2701
|
+
flexDirection: 'column',
|
|
2702
|
+
gap: '8px',
|
|
2703
|
+
marginBottom: '24px',
|
|
2704
|
+
});
|
|
2705
|
+
const QuestionText = styles.styled(material.Typography)({
|
|
2706
|
+
fontFamily: 'Montserrat',
|
|
2707
|
+
fontSize: '14px',
|
|
2708
|
+
fontWeight: 400,
|
|
2709
|
+
color: '#13131B',
|
|
2710
|
+
lineHeight: '20px',
|
|
2711
|
+
});
|
|
2712
|
+
const OptionsContainer = styles.styled(material.Box)({
|
|
2713
|
+
display: 'flex',
|
|
2714
|
+
gap: '16px',
|
|
2715
|
+
marginTop: '12px',
|
|
2716
|
+
});
|
|
2717
|
+
const OptionButton = styles.styled(material.Box)(({ selected }) => ({
|
|
2718
|
+
flex: 1,
|
|
2719
|
+
height: '48px',
|
|
2720
|
+
border: `1px solid ${selected ? '#13131B' : '#929094'}`,
|
|
2721
|
+
borderRadius: '8px',
|
|
2722
|
+
display: 'flex',
|
|
2723
|
+
alignItems: 'center',
|
|
2724
|
+
justifyContent: 'center',
|
|
2725
|
+
cursor: 'pointer',
|
|
2726
|
+
backgroundColor: selected ? '#F5F5F7' : '#fff',
|
|
2727
|
+
transition: 'all 0.2s ease',
|
|
2728
|
+
'&:hover': {
|
|
2729
|
+
borderColor: '#13131B',
|
|
2730
|
+
},
|
|
2731
|
+
}));
|
|
2732
|
+
const OptionText = styles.styled(material.Typography)(({ selected }) => ({
|
|
2733
|
+
fontFamily: 'Montserrat',
|
|
2734
|
+
fontSize: '14px',
|
|
2735
|
+
fontWeight: 600,
|
|
2736
|
+
color: selected ? '#13131B' : '#5F5E62',
|
|
2737
|
+
lineHeight: '20px',
|
|
2738
|
+
}));
|
|
2739
|
+
|
|
2740
|
+
const HealthQuestionGroup = ({ question, questionNumber, value, onChange, error, labels = { yes: 'Yes', no: 'No' }, sx, }) => {
|
|
2741
|
+
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: {
|
|
2742
|
+
color: 'error.main',
|
|
2743
|
+
fontSize: '12px',
|
|
2744
|
+
mt: 0.5,
|
|
2745
|
+
ml: 2,
|
|
2746
|
+
} }, { children: error })))] })));
|
|
2747
|
+
};
|
|
2748
|
+
|
|
2749
|
+
const FormContainer$3 = styles.styled(material.Box)({
|
|
2750
|
+
padding: '0 16px 100px',
|
|
2751
|
+
});
|
|
2752
|
+
const CheckboxContainer$1 = styles.styled(material.Box)({
|
|
2753
|
+
marginTop: '12px',
|
|
2754
|
+
'& .MuiFormControlLabel-root': {
|
|
2755
|
+
alignItems: 'flex-start',
|
|
2756
|
+
marginLeft: 0,
|
|
2757
|
+
},
|
|
2758
|
+
'& .MuiCheckbox-root': {
|
|
2759
|
+
padding: '4px 8px 4px 0',
|
|
2760
|
+
},
|
|
2761
|
+
});
|
|
2762
|
+
const CheckboxLabel$1 = styles.styled(material.Typography)({
|
|
2763
|
+
fontFamily: 'Montserrat',
|
|
2764
|
+
fontSize: '14px',
|
|
2765
|
+
fontWeight: 400,
|
|
2766
|
+
color: '#5F5E62',
|
|
2767
|
+
lineHeight: '18px',
|
|
2768
|
+
});
|
|
2769
|
+
|
|
2770
|
+
const PersonalInformationForm = ({ renderField, fields, consents, onSubmit, formRef, sx, }) => {
|
|
2771
|
+
const defaultBankConfirmationLabel = 'I confirm this bank account is mine and consent to AmMetLife crediting payouts to it';
|
|
2772
|
+
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';
|
|
2773
|
+
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: {
|
|
2774
|
+
display: 'block',
|
|
2775
|
+
mt: 0.5,
|
|
2776
|
+
ml: 2,
|
|
2777
|
+
color: '#5F5E62',
|
|
2778
|
+
fontSize: '12px',
|
|
2779
|
+
fontFamily: 'Montserrat',
|
|
2780
|
+
} }, { 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 ||
|
|
2781
|
+
defaultBankConfirmationLabel }) }), consents.bank_account_confirmation.error && (jsxRuntime.jsx(material.Typography, Object.assign({ sx: {
|
|
2782
|
+
color: 'error.main',
|
|
2783
|
+
fontSize: '12px',
|
|
2784
|
+
mt: 0.5,
|
|
2785
|
+
ml: 4,
|
|
2786
|
+
} }, { 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 }) }) })] })) })));
|
|
2787
|
+
};
|
|
2788
|
+
|
|
2789
|
+
const FormContainer$2 = styles.styled(material.Box)({
|
|
2790
|
+
padding: '0 16px 100px',
|
|
2791
|
+
});
|
|
2792
|
+
const CheckboxContainer = styles.styled(material.Box)({
|
|
2793
|
+
marginTop: '12px',
|
|
2794
|
+
'& .MuiFormControlLabel-root': {
|
|
2795
|
+
alignItems: 'flex-start',
|
|
2796
|
+
marginLeft: 0,
|
|
2797
|
+
},
|
|
2798
|
+
'& .MuiCheckbox-root': {
|
|
2799
|
+
padding: '4px 8px 4px 0',
|
|
2800
|
+
},
|
|
2801
|
+
});
|
|
2802
|
+
const CheckboxLabel = styles.styled(material.Typography)({
|
|
2803
|
+
fontFamily: 'Montserrat',
|
|
2804
|
+
fontSize: '14px',
|
|
2805
|
+
fontWeight: 400,
|
|
2806
|
+
color: '#5F5E62',
|
|
2807
|
+
lineHeight: '18px',
|
|
2808
|
+
});
|
|
2809
|
+
|
|
2810
|
+
const ContactDetailsForm = ({ renderField, fields, mailingAddressSame, onSubmit, formRef, sx, }) => {
|
|
2811
|
+
const defaultMailingLabel = 'My mailing address is the same as residential';
|
|
2812
|
+
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: {
|
|
2813
|
+
display: 'block',
|
|
2814
|
+
mt: 0.5,
|
|
2815
|
+
ml: 2,
|
|
2816
|
+
color: '#5F5E62',
|
|
2817
|
+
fontSize: '12px',
|
|
2818
|
+
fontFamily: 'Montserrat',
|
|
2819
|
+
} }, { 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 }) }) }))] })) })));
|
|
2820
|
+
};
|
|
2821
|
+
|
|
2822
|
+
const FormContainer$1 = styles.styled(material.Box)({
|
|
2823
|
+
padding: '0 16px 100px',
|
|
2824
|
+
});
|
|
2825
|
+
|
|
2826
|
+
const HealthInformationForm = ({ renderField, measurementFields, healthQuestions, onSubmit, formRef, sx, }) => {
|
|
2827
|
+
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)))] })) })));
|
|
2828
|
+
};
|
|
2829
|
+
|
|
2830
|
+
const FormContainer = styles.styled(material.Box)({
|
|
2831
|
+
padding: '0 16px 100px',
|
|
2832
|
+
});
|
|
2833
|
+
|
|
2834
|
+
const ChildInformationForm = ({ renderField, fields, onSubmit, formRef, sx, }) => {
|
|
2835
|
+
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: {
|
|
2836
|
+
display: 'block',
|
|
2837
|
+
mt: 0.5,
|
|
2838
|
+
ml: 2,
|
|
2839
|
+
color: '#5F5E62',
|
|
2840
|
+
fontSize: '12px',
|
|
2841
|
+
fontFamily: 'Montserrat',
|
|
2842
|
+
} }, { children: fields.full_name.helperText })))] }), renderField(fields.nric), renderField(fields.date_of_birth), renderField(fields.gender), renderField(fields.nationality)] })) })));
|
|
2843
|
+
};
|
|
2844
|
+
|
|
2430
2845
|
/**
|
|
2431
2846
|
* Asset Management Utilities
|
|
2432
2847
|
* Helper functions for managing tenant-specific assets
|
|
@@ -2545,13 +2960,22 @@ exports.Banner = Banner;
|
|
|
2545
2960
|
exports.BillingToggle = BillingToggle;
|
|
2546
2961
|
exports.Button = Button;
|
|
2547
2962
|
exports.Card = Card;
|
|
2963
|
+
exports.CheckoutFormButton = CheckoutFormButton;
|
|
2964
|
+
exports.CheckoutHeader = CheckoutHeader;
|
|
2965
|
+
exports.CheckoutProgress = CheckoutProgress;
|
|
2966
|
+
exports.ChildInformationForm = ChildInformationForm;
|
|
2967
|
+
exports.ContactDetailsForm = ContactDetailsForm;
|
|
2548
2968
|
exports.CoverageAmountSlider = CoverageAmountSlider;
|
|
2549
2969
|
exports.Footer = Footer;
|
|
2550
2970
|
exports.Header = Header$1;
|
|
2971
|
+
exports.HealthInformationForm = HealthInformationForm;
|
|
2972
|
+
exports.HealthQuestionGroup = HealthQuestionGroup;
|
|
2551
2973
|
exports.ICON_PATHS = ICON_PATHS;
|
|
2552
2974
|
exports.InfoCallout = InfoCallout;
|
|
2553
2975
|
exports.NewHeader = NewHeader;
|
|
2554
|
-
exports.OptionButton = OptionButton;
|
|
2976
|
+
exports.OptionButton = OptionButton$1;
|
|
2977
|
+
exports.PersonalInformationForm = PersonalInformationForm;
|
|
2978
|
+
exports.ProductCard = ProductCard;
|
|
2555
2979
|
exports.ProductSelectionDrawer = ProductSelectionDrawer;
|
|
2556
2980
|
exports.QuestionSection = QuestionSection;
|
|
2557
2981
|
exports.RecommendationsDrawer = RecommendationsDrawer;
|