igloo-d2c-components 1.0.49 → 1.0.51

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.
Files changed (49) hide show
  1. package/README.md +131 -36
  2. package/dist/cjs/index.js +1172 -1096
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/esm/index.js +1153 -1093
  5. package/dist/esm/index.js.map +1 -1
  6. package/dist/types/components/BenefitsSummary/styled.d.ts +3 -3
  7. package/dist/types/components/BillingToggle/styled.d.ts +1 -1
  8. package/dist/types/components/CheckoutHeader/styled.d.ts +2 -2
  9. package/dist/types/components/CheckoutProgress/styled.d.ts +1 -1
  10. package/dist/types/components/ContactDetailsForm/styled.d.ts +2 -2
  11. package/dist/types/components/CoverageAmountSlider/styled.d.ts +3 -3
  12. package/dist/types/components/DesktopHeaderMenuBar/styled.d.ts +5 -5
  13. package/dist/types/components/FAQAccordion/styled.d.ts +2 -2
  14. package/dist/types/components/Footer/styled.d.ts +3 -3
  15. package/dist/types/components/Header/styled.d.ts +9 -12
  16. package/dist/types/components/HealthQuestionGroup/styled.d.ts +2 -2
  17. package/dist/types/components/InfoCallout/styled.d.ts +3 -3
  18. package/dist/types/components/OptionButton/styled.d.ts +1 -1
  19. package/dist/types/components/PersonalInformationForm/styled.d.ts +1 -1
  20. package/dist/types/components/ProductCard/styled.d.ts +4 -4
  21. package/dist/types/components/ProductSelectionDrawer/styled.d.ts +9 -9
  22. package/dist/types/components/QuestionSection/styled.d.ts +2 -2
  23. package/dist/types/components/RecommendationsDrawer/styled.d.ts +2 -2
  24. package/dist/types/components/ToggleGroup/styled.d.ts +1 -1
  25. package/dist/types/context/TenantThemeContext.d.ts +5 -5
  26. package/dist/types/index.d.ts +5 -2
  27. package/dist/types/storybook-components/Banner.stories.d.ts +1 -1
  28. package/dist/types/storybook-components/BenefitsSummary.stories.d.ts +0 -4
  29. package/dist/types/storybook-components/BillingToggle.stories.d.ts +0 -1
  30. package/dist/types/storybook-components/Button.stories.d.ts +1 -1
  31. package/dist/types/storybook-components/Card.stories.d.ts +1 -1
  32. package/dist/types/storybook-components/CoverageAmountSlider.stories.d.ts +0 -1
  33. package/dist/types/storybook-components/FAQAccordion.stories.d.ts +0 -4
  34. package/dist/types/storybook-components/Footer.stories.d.ts +0 -1
  35. package/dist/types/storybook-components/Header.stories.d.ts +0 -1
  36. package/dist/types/storybook-components/InfoCallout.stories.d.ts +0 -1
  37. package/dist/types/storybook-components/NewHeader.stories.d.ts +0 -4
  38. package/dist/types/storybook-components/OptionButton.stories.d.ts +1 -1
  39. package/dist/types/storybook-components/QuestionSection.stories.d.ts +1 -1
  40. package/dist/types/storybook-components/ToggleGroup.stories.d.ts +1 -1
  41. package/dist/types/themes/index.d.ts +0 -4
  42. package/dist/types/themes/typography.d.ts +0 -4
  43. package/dist/types/types/tenant.d.ts +1 -2
  44. package/dist/types/utils/assets.d.ts +4 -2
  45. package/dist/types/utils/image.d.ts +34 -0
  46. package/dist/types/utils/security.d.ts +48 -0
  47. package/package.json +21 -7
  48. package/dist/assets/tenants/cimb/logo-white.png +0 -0
  49. package/dist/assets/tenants/cimb/logo.svg +0 -62
@@ -5,5 +5,4 @@ export default _default;
5
5
  export declare const Default: ComponentStory<typeof Header>;
6
6
  export declare const WithUser: ComponentStory<typeof Header>;
7
7
  export declare const MobileView: ComponentStory<typeof Header>;
8
- export declare const WithCIMBTheme: ComponentStory<typeof Header>;
9
8
  export declare const WithAmmetLifeTheme: ComponentStory<typeof Header>;
@@ -7,5 +7,4 @@ export declare const CustomTitle: ComponentStory<typeof InfoCallout>;
7
7
  export declare const LongContent: ComponentStory<typeof InfoCallout>;
8
8
  export declare const ShortContent: ComponentStory<typeof InfoCallout>;
9
9
  export declare const WithCustomFormatMessage: ComponentStory<typeof InfoCallout>;
10
- export declare const WithCIMBTheme: ComponentStory<typeof InfoCallout>;
11
10
  export declare const WithAmmetLifeTheme: ComponentStory<typeof InfoCallout>;
@@ -18,10 +18,6 @@ export declare const AuthenticatedUser: ComponentStory<typeof NewHeader>;
18
18
  * Mobile View story
19
19
  */
20
20
  export declare const MobileView: ComponentStory<typeof NewHeader>;
21
- /**
22
- * CIMB Tenant story
23
- */
24
- export declare const CIMBTenant: ComponentStory<typeof NewHeader>;
25
21
  /**
26
22
  * AmMetLife Tenant story
27
23
  */
@@ -9,4 +9,4 @@ export declare const Disabled: ComponentStory<typeof OptionButton>;
9
9
  export declare const Sizes: () => import("react/jsx-runtime").JSX.Element;
10
10
  export declare const Interactive: () => import("react/jsx-runtime").JSX.Element;
11
11
  export declare const MultipleOptions: () => import("react/jsx-runtime").JSX.Element;
12
- export declare const WithCIMBTheme: ComponentStory<typeof OptionButton>;
12
+ export declare const WithAmmetLifeTheme: ComponentStory<typeof OptionButton>;
@@ -8,4 +8,4 @@ export declare const WithoutNumber: ComponentStory<typeof QuestionSection>;
8
8
  export declare const MultipleSelection: () => import("react/jsx-runtime").JSX.Element;
9
9
  export declare const WithCustomRenderer: ComponentStory<typeof QuestionSection>;
10
10
  export declare const LongQuestion: ComponentStory<typeof QuestionSection>;
11
- export declare const WithCIMBTheme: ComponentStory<typeof QuestionSection>;
11
+ export declare const WithAmmetLifeTheme: ComponentStory<typeof QuestionSection>;
@@ -7,4 +7,4 @@ export declare const ThreeOptions: ComponentStory<typeof ToggleGroup>;
7
7
  export declare const WithoutIcons: ComponentStory<typeof ToggleGroup>;
8
8
  export declare const WithImageIcons: ComponentStory<typeof ToggleGroup>;
9
9
  export declare const Interactive: () => import("react/jsx-runtime").JSX.Element;
10
- export declare const WithCIMBTheme: ComponentStory<typeof ToggleGroup>;
10
+ export declare const WithAmmetLifeTheme: ComponentStory<typeof ToggleGroup>;
@@ -7,10 +7,6 @@ import { TenantId, TenantThemeConfig } from '../types/tenant';
7
7
  * Igloo Theme Configuration
8
8
  */
9
9
  export declare const iglooTheme: TenantThemeConfig;
10
- /**
11
- * CIMB Theme Configuration
12
- */
13
- export declare const cimbTheme: TenantThemeConfig;
14
10
  /**
15
11
  * Ammetlife Theme Configuration
16
12
  */
@@ -52,10 +52,6 @@ export interface TenantTypographyConfig {
52
52
  * Igloo Typography Configuration
53
53
  */
54
54
  export declare const iglooTypography: TenantTypographyConfig;
55
- /**
56
- * CIMB Typography Configuration
57
- */
58
- export declare const cimbTypography: TenantTypographyConfig;
59
55
  /**
60
56
  * AmmetLife Typography Configuration
61
57
  */
@@ -41,7 +41,6 @@ export interface TenantPalette {
41
41
  health?: ColorShade;
42
42
  life?: ColorShade;
43
43
  pet?: ColorShade;
44
- paCimb?: ColorShade;
45
44
  [key: string]: ColorShade | UIColors | undefined;
46
45
  }
47
46
  export interface TypographyVariantStyle {
@@ -94,4 +93,4 @@ export interface TenantContextValue {
94
93
  /**
95
94
  * Supported Tenant IDs
96
95
  */
97
- export type TenantId = 'igloo' | 'cimb' | 'ammetlife';
96
+ export type TenantId = 'igloo' | 'ammetlife';
@@ -42,13 +42,15 @@ export declare function useTenantFavicon(): string;
42
42
  * Get tenant asset path (non-hook version for use outside components)
43
43
  * @param tenantId - Tenant identifier
44
44
  * @param assetPath - Relative path to asset
45
+ * @param basePath - Optional custom base path (defaults to getAssetBasePath())
45
46
  * @returns Full asset path
46
47
  */
47
- export declare function getTenantAssetPath(tenantId: string, assetPath: string): string;
48
+ export declare function getTenantAssetPath(tenantId: string, assetPath: string, basePath?: string): string;
48
49
  /**
49
50
  * Get tenant logo path (non-hook version)
50
51
  * @param tenantId - Tenant identifier
51
52
  * @param variant - Logo variant
53
+ * @param basePath - Optional custom base path (defaults to getAssetBasePath())
52
54
  * @returns Logo path
53
55
  */
54
- export declare function getTenantLogoPath(tenantId: string, variant?: 'default' | 'dark' | 'alt' | 'white'): string;
56
+ export declare function getTenantLogoPath(tenantId: string, variant?: 'default' | 'dark' | 'alt' | 'white', basePath?: string): string;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Image utilities for handling static image imports across different bundlers
3
+ * Supports both Rollup (data URLs) and Next.js (StaticImageData objects)
4
+ */
5
+ /**
6
+ * Next.js StaticImageData type (when using next/image)
7
+ */
8
+ export interface StaticImageData {
9
+ src: string;
10
+ height: number;
11
+ width: number;
12
+ blurDataURL?: string;
13
+ blurWidth?: number;
14
+ blurHeight?: number;
15
+ }
16
+ /**
17
+ * Normalizes an image import to a string URL
18
+ * Handles both Rollup data URL strings and Next.js StaticImageData objects
19
+ *
20
+ * @param image - Image import (string URL or Next.js StaticImageData)
21
+ * @returns String URL suitable for use in img src attribute
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * import logo from './logo.png';
26
+ * const imgSrc = getImageSrc(logo); // Works with both Rollup and Next.js
27
+ * <img src={imgSrc} alt="Logo" />
28
+ * ```
29
+ */
30
+ export declare function getImageSrc(image: string | StaticImageData | undefined): string;
31
+ /**
32
+ * Type guard to check if an image is a Next.js StaticImageData object
33
+ */
34
+ export declare function isStaticImageData(image: unknown): image is StaticImageData;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Security utilities for URL validation and safe external link handling
3
+ */
4
+ /**
5
+ * Validates if a URL is safe to use (prevents open redirect vulnerabilities)
6
+ *
7
+ * @param url - The URL to validate
8
+ * @param allowedDomains - Optional list of allowed domains. If not provided, all HTTPS URLs are allowed.
9
+ * @returns true if the URL is safe, false otherwise
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * isValidExternalUrl('https://example.com') // true
14
+ * isValidExternalUrl('javascript:alert(1)') // false
15
+ * isValidExternalUrl('//evil.com', ['trusted.com']) // false
16
+ * ```
17
+ */
18
+ export declare function isValidExternalUrl(url: string, allowedDomains?: string[]): boolean;
19
+ /**
20
+ * Safely opens an external URL in a new window with security measures
21
+ * Prevents tabnabbing attacks by setting noopener and noreferrer
22
+ *
23
+ * @param url - The URL to open
24
+ * @param allowedDomains - Optional list of allowed domains for validation
25
+ * @returns true if window was opened successfully, false otherwise
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * safeWindowOpen('https://example.com')
30
+ * safeWindowOpen('https://partner.com', ['partner.com', 'trusted.com'])
31
+ * ```
32
+ */
33
+ export declare function safeWindowOpen(url: string, allowedDomains?: string[]): boolean;
34
+ /**
35
+ * Sanitizes a URL for use in href attributes
36
+ *
37
+ * @param url - The URL to sanitize
38
+ * @param fallback - Fallback URL if validation fails (default: '#')
39
+ * @returns Sanitized URL or fallback
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * sanitizeUrl('https://example.com') // 'https://example.com'
44
+ * sanitizeUrl('javascript:alert(1)') // '#'
45
+ * sanitizeUrl('invalid', '/home') // '/home'
46
+ * ```
47
+ */
48
+ export declare function sanitizeUrl(url: string, fallback?: string): string;
package/package.json CHANGED
@@ -1,15 +1,25 @@
1
1
  {
2
2
  "name": "igloo-d2c-components",
3
- "version": "1.0.49",
3
+ "version": "1.0.51",
4
4
  "description": "Reusable component library with tenant-aware theming for B2C applications",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
7
7
  "types": "dist/types/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/types/index.d.ts",
11
+ "import": "./dist/esm/index.js",
12
+ "require": "./dist/cjs/index.js",
13
+ "default": "./dist/cjs/index.js"
14
+ },
15
+ "./package.json": "./package.json"
16
+ },
8
17
  "files": [
9
18
  "dist",
10
19
  "README.md",
11
20
  "dist/assets"
12
21
  ],
22
+ "sideEffects": false,
13
23
  "scripts": {
14
24
  "build": "yarn clean && rollup -c rollup.config.cjs && tsc --declaration --emitDeclarationOnly --outDir dist/types",
15
25
  "dev": "rollup -c rollup.config.cjs -w",
@@ -21,10 +31,14 @@
21
31
  "storybook": "start-storybook -p 6006",
22
32
  "build-storybook": "build-storybook",
23
33
  "release": "bash scripts/release.sh",
34
+ "release:patch": "bash scripts/release.sh patch",
35
+ "release:minor": "bash scripts/release.sh minor",
36
+ "release:major": "bash scripts/release.sh major",
37
+ "release:beta": "bash scripts/release.sh beta",
24
38
  "npmPublish": "yarn prepublishOnly && npm publish"
25
39
  },
26
40
  "engines": {
27
- "node": ">=16.20.0 <=18.x"
41
+ "node": ">=20.10.0 <=22.x"
28
42
  },
29
43
  "keywords": [
30
44
  "react",
@@ -39,11 +53,11 @@
39
53
  "peerDependencies": {
40
54
  "@emotion/react": "^11.11.4",
41
55
  "@emotion/styled": "^11.11.5",
42
- "@mui/icons-material": "^5.15.20",
43
- "@mui/material": "^5.15.20",
44
- "@mui/styles": "^5.15.20",
45
- "react": "^17.0.0",
46
- "react-dom": "^17.0.0"
56
+ "@mui/icons-material": "^5.15.20 || ^6.0.0 || ^7.0.0",
57
+ "@mui/material": "^5.15.20 || ^6.0.0 || ^7.0.0",
58
+ "@mui/styles": "^5.15.20 || ^6.0.0",
59
+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
60
+ "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
47
61
  },
48
62
  "devDependencies": {
49
63
  "@babel/core": "^7.22.0",
@@ -1,62 +0,0 @@
1
- <?xml version="1.0" standalone="no"?>
2
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
3
- "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
4
- <svg version="1.0" xmlns="http://www.w3.org/2000/svg"
5
- width="1336.000000pt" height="270.000000pt" viewBox="0 0 1336.000000 270.000000"
6
- preserveAspectRatio="xMidYMid meet">
7
-
8
- <g transform="translate(0.000000,270.000000) scale(0.100000,-0.100000)"
9
- fill="#000000" stroke="none">
10
- <path d="M330 1355 l0 -1035 1035 0 1035 0 0 1035 0 1035 -1035 0 -1035 0 0
11
- -1035z m1584 330 c136 -179 246 -327 246 -330 0 -3 -249 -5 -552 -5 l-553 1
12
- -229 318 c-127 175 -232 323 -234 329 -3 9 134 12 537 12 l540 0 245 -325z"/>
13
- <path d="M3590 2071 c-165 -23 -301 -91 -421 -211 -73 -72 -94 -101 -133 -181
14
- -105 -216 -103 -441 5 -652 61 -118 191 -247 309 -304 200 -98 406 -107 604
15
- -27 59 24 196 109 196 123 0 3 -42 48 -92 98 l-93 92 -55 -34 c-255 -158 -590
16
- -13 -656 284 -36 162 15 324 139 438 142 131 371 146 533 37 l37 -26 94 94
17
- c51 51 93 95 93 98 0 8 -118 85 -167 109 -100 50 -278 78 -393 62z"/>
18
- <path d="M4417 2034 c-4 -4 -7 -310 -7 -681 l0 -673 140 0 140 0 -2 678 -3
19
- 677 -131 3 c-71 1 -133 -1 -137 -4z"/>
20
- <path d="M5020 1360 l0 -680 135 0 135 0 0 400 c0 220 3 400 8 400 4 -1 110
21
- -181 236 -401 182 -318 232 -397 241 -387 7 7 108 182 225 388 117 206 219
22
- 382 226 390 12 12 14 -49 14 -388 l0 -402 135 0 135 0 0 680 0 680 -133 0
23
- -134 0 -234 -430 c-129 -236 -238 -428 -242 -427 -5 2 -115 195 -244 430
24
- l-235 427 -134 0 -134 0 0 -680z"/>
25
- <path d="M6830 1360 l0 -680 309 0 c169 0 332 5 361 10 127 24 228 98 276 203
26
- 27 57 29 71 29 177 0 106 -2 119 -27 166 -25 48 -109 134 -130 134 -6 0 12 20
27
- 39 44 85 77 121 186 102 308 -27 174 -144 280 -337 308 -37 5 -192 10 -344 10
28
- l-278 0 0 -680z m615 410 c58 -28 79 -70 73 -145 -4 -50 -10 -63 -36 -86 -45
29
- -40 -95 -50 -244 -47 l-133 3 -3 148 -3 147 153 0 c132 0 157 -3 193 -20z
30
- m-25 -531 c77 -18 120 -74 120 -156 0 -57 -26 -105 -72 -133 -29 -18 -51 -20
31
- -200 -20 l-168 0 0 153 c0 85 3 157 7 160 10 11 263 8 313 -4z"/>
32
- <path d="M8170 2021 c0 -18 6 -21 41 -21 62 0 104 -25 126 -73 17 -39 18 -87
33
- 21 -644 l3 -603 89 0 90 0 0 280 0 280 158 0 c228 0 333 31 426 123 69 70 90
34
- 124 94 249 3 78 -1 121 -12 160 -33 108 -123 193 -256 240 -62 21 -81 23 -422
35
- 26 -357 4 -358 3 -358 -17z m653 -79 c64 -28 132 -95 164 -160 23 -48 27 -68
36
- 27 -141 0 -102 -20 -156 -84 -225 -64 -70 -136 -100 -235 -101 -44 0 -97 4
37
- -117 8 l-38 8 0 309 0 309 38 6 c20 4 42 8 47 11 25 10 157 -6 198 -24z"/>
38
- <path d="M10290 1987 c-69 -35 -62 -151 12 -197 39 -24 69 -25 107 -5 34 17
39
- 41 32 41 92 0 39 -5 50 -39 84 -42 42 -75 49 -121 26z"/>
40
- <path d="M9772 1655 c-23 -7 -66 -31 -96 -53 l-53 -40 -26 34 c-35 43 -76 54
41
- -209 54 -99 0 -108 -2 -108 -19 0 -15 10 -20 45 -26 25 -3 56 -16 69 -28 46
42
- -43 49 -67 54 -494 l4 -403 89 0 89 0 0 384 0 384 39 35 c51 46 98 60 179 55
43
- 64 -5 99 -15 133 -40 13 -9 23 -6 53 17 20 15 36 33 36 39 0 26 -71 95 -108
44
- 106 -50 14 -138 12 -190 -5z"/>
45
- <path d="M11128 1656 c-26 -7 -72 -29 -103 -50 l-56 -37 -25 30 c-34 41 -77
46
- 51 -216 51 -111 0 -118 -1 -118 -20 0 -16 7 -20 30 -20 54 0 107 -28 127 -68
47
- 16 -34 18 -74 21 -449 l3 -413 90 0 89 0 0 391 0 391 38 35 c111 103 243 106
48
- 300 5 34 -62 42 -149 42 -494 l0 -328 90 0 90 0 0 389 0 389 40 35 c102 93
49
- 207 108 274 39 53 -56 58 -94 63 -489 l5 -363 90 0 89 0 -3 383 c-3 374 -4
50
- 383 -27 441 -45 111 -131 166 -262 166 -103 0 -238 -57 -290 -123 -17 -20 -17
51
- -20 -32 10 -49 94 -204 138 -349 99z"/>
52
- <path d="M12623 1655 c-197 -61 -317 -276 -298 -537 20 -299 196 -472 460
53
- -455 137 9 222 53 307 160 l40 51 -23 17 c-22 16 -23 15 -76 -41 -146 -158
54
- -372 -139 -463 39 -25 50 -50 152 -50 209 l0 42 309 0 c348 0 321 -7 321 83
55
- -2 242 -111 401 -299 437 -72 14 -177 12 -228 -5z m161 -76 c91 -23 151 -125
56
- 163 -280 l6 -79 -218 0 -218 0 6 63 c14 138 69 245 147 285 51 25 56 26 114
57
- 11z"/>
58
- <path d="M10090 1631 c0 -15 10 -19 51 -23 28 -3 62 -14 77 -25 57 -42 57 -43
59
- 60 -490 l3 -413 90 0 89 0 0 428 c0 424 0 428 -22 472 -30 59 -60 69 -220 69
60
- -119 1 -128 0 -128 -18z"/>
61
- </g>
62
- </svg>