igloo-d2c-components 1.0.50 → 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.
- package/README.md +131 -36
- package/dist/cjs/index.js +1172 -1096
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +1153 -1093
- package/dist/esm/index.js.map +1 -1
- package/dist/types/components/BenefitsSummary/styled.d.ts +3 -3
- package/dist/types/components/BillingToggle/styled.d.ts +1 -1
- package/dist/types/components/CheckoutHeader/styled.d.ts +2 -2
- package/dist/types/components/CheckoutProgress/styled.d.ts +1 -1
- package/dist/types/components/ContactDetailsForm/styled.d.ts +2 -2
- package/dist/types/components/CoverageAmountSlider/styled.d.ts +3 -3
- package/dist/types/components/DesktopHeaderMenuBar/styled.d.ts +5 -5
- package/dist/types/components/FAQAccordion/styled.d.ts +2 -2
- package/dist/types/components/Footer/styled.d.ts +3 -3
- package/dist/types/components/Header/styled.d.ts +9 -12
- package/dist/types/components/HealthQuestionGroup/styled.d.ts +2 -2
- package/dist/types/components/InfoCallout/styled.d.ts +3 -3
- package/dist/types/components/OptionButton/styled.d.ts +1 -1
- package/dist/types/components/PersonalInformationForm/styled.d.ts +1 -1
- package/dist/types/components/ProductCard/styled.d.ts +4 -4
- package/dist/types/components/ProductSelectionDrawer/styled.d.ts +9 -9
- package/dist/types/components/QuestionSection/styled.d.ts +2 -2
- package/dist/types/components/RecommendationsDrawer/styled.d.ts +2 -2
- package/dist/types/components/ToggleGroup/styled.d.ts +1 -1
- package/dist/types/context/TenantThemeContext.d.ts +5 -5
- package/dist/types/index.d.ts +5 -2
- package/dist/types/storybook-components/Banner.stories.d.ts +1 -1
- package/dist/types/storybook-components/BenefitsSummary.stories.d.ts +0 -4
- package/dist/types/storybook-components/BillingToggle.stories.d.ts +0 -1
- package/dist/types/storybook-components/Button.stories.d.ts +1 -1
- package/dist/types/storybook-components/Card.stories.d.ts +1 -1
- package/dist/types/storybook-components/CoverageAmountSlider.stories.d.ts +0 -1
- package/dist/types/storybook-components/FAQAccordion.stories.d.ts +0 -4
- package/dist/types/storybook-components/Footer.stories.d.ts +0 -1
- package/dist/types/storybook-components/Header.stories.d.ts +0 -1
- package/dist/types/storybook-components/InfoCallout.stories.d.ts +0 -1
- package/dist/types/storybook-components/NewHeader.stories.d.ts +0 -4
- package/dist/types/storybook-components/OptionButton.stories.d.ts +1 -1
- package/dist/types/storybook-components/QuestionSection.stories.d.ts +1 -1
- package/dist/types/storybook-components/ToggleGroup.stories.d.ts +1 -1
- package/dist/types/themes/index.d.ts +0 -4
- package/dist/types/themes/typography.d.ts +0 -4
- package/dist/types/types/tenant.d.ts +1 -2
- package/dist/types/utils/assets.d.ts +4 -2
- package/dist/types/utils/image.d.ts +34 -0
- package/dist/types/utils/security.d.ts +48 -0
- package/package.json +21 -7
- package/dist/assets/tenants/cimb/logo-white.png +0 -0
- package/dist/assets/tenants/cimb/logo.svg +0 -62
package/README.md
CHANGED
|
@@ -18,6 +18,7 @@ Reusable React component library with **centralized tenant themes** and tenant-a
|
|
|
18
18
|
- [Hooks & Utilities](#-hooks--utilities)
|
|
19
19
|
- [Asset Management](#-asset-management)
|
|
20
20
|
- [Integration Guide](#-integration-guide)
|
|
21
|
+
- [Next.js Integration](#nextjs-integration)
|
|
21
22
|
- [Multi-Tenant Architecture](#multi-tenant-architecture)
|
|
22
23
|
- [Checkout Flow Integration](#checkout-flow-integration)
|
|
23
24
|
- [Recommendations Feature](#recommendations-feature)
|
|
@@ -49,7 +50,7 @@ We've built a **multi-tenant B2C insurance platform** that enables rapid deploym
|
|
|
49
50
|
|
|
50
51
|
### Key Highlights
|
|
51
52
|
|
|
52
|
-
- 🎨 **Centralized Themes** -
|
|
53
|
+
- 🎨 **Centralized Themes** - Igloo and AmMetLife tenant themes in one library
|
|
53
54
|
- 🧩 **Tenant-Aware Components** - Automatically adapt to tenant branding
|
|
54
55
|
- 📦 **ES2015 Compatible** - Works with older webpack configurations
|
|
55
56
|
- 🔧 **Unminified Output** - Better debugging and tree-shaking
|
|
@@ -62,7 +63,6 @@ We've built a **multi-tenant B2C insurance platform** that enables rapid deploym
|
|
|
62
63
|
| ------------- | ---- | ----------------------- |
|
|
63
64
|
| **Igloo** | 8000 | Default insurance brand |
|
|
64
65
|
| **AmmetLife** | 8001 | Life insurance partner |
|
|
65
|
-
| **CIMB** | 8002 | Banking partner |
|
|
66
66
|
|
|
67
67
|
---
|
|
68
68
|
|
|
@@ -137,7 +137,6 @@ Package Manager: Yarn
|
|
|
137
137
|
| Tenant | Theme Export | Description |
|
|
138
138
|
| ------------- | ---------------- | ----------------------- |
|
|
139
139
|
| **Igloo** | `iglooTheme` | Default insurance brand |
|
|
140
|
-
| **CIMB** | `cimbTheme` | Banking partner theme |
|
|
141
140
|
| **AmmetLife** | `ammetlifeTheme` | Life insurance partner |
|
|
142
141
|
|
|
143
142
|
### Component Categories
|
|
@@ -280,7 +279,6 @@ yarn lib:verify-registry
|
|
|
280
279
|
import {
|
|
281
280
|
TenantThemeProvider,
|
|
282
281
|
iglooTheme,
|
|
283
|
-
cimbTheme,
|
|
284
282
|
ammetlifeTheme
|
|
285
283
|
} from 'igloo-d2c-components'
|
|
286
284
|
|
|
@@ -299,7 +297,7 @@ function App() {
|
|
|
299
297
|
import { TenantThemeProvider, getTenantTheme } from 'igloo-d2c-components'
|
|
300
298
|
|
|
301
299
|
function App({ tenantId }) {
|
|
302
|
-
const theme = getTenantTheme(tenantId) // 'igloo'
|
|
300
|
+
const theme = getTenantTheme(tenantId) // 'igloo' or 'ammetlife'
|
|
303
301
|
|
|
304
302
|
return (
|
|
305
303
|
<TenantThemeProvider tenantId={tenantId} theme={theme}>
|
|
@@ -371,11 +369,10 @@ import { iglooTheme } from 'igloo-d2c-components'
|
|
|
371
369
|
import {
|
|
372
370
|
// Individual themes
|
|
373
371
|
iglooTheme, // Igloo brand theme
|
|
374
|
-
cimbTheme, // CIMB bank theme
|
|
375
372
|
ammetlifeTheme, // AmmetLife insurance theme
|
|
376
373
|
|
|
377
374
|
// Theme registry
|
|
378
|
-
tenantThemes, // { igloo: iglooTheme,
|
|
375
|
+
tenantThemes, // { igloo: iglooTheme, ammetlife: ammetlifeTheme }
|
|
379
376
|
|
|
380
377
|
// Utility functions
|
|
381
378
|
getTenantTheme, // (tenantId: TenantId) => TenantThemeConfig
|
|
@@ -404,9 +401,6 @@ interface TenantThemeConfig {
|
|
|
404
401
|
health: { main, light? }
|
|
405
402
|
life: { main, light }
|
|
406
403
|
pet: { main }
|
|
407
|
-
|
|
408
|
-
// CIMB-specific (optional)
|
|
409
|
-
paCimb?: { main, light, bright, buttonBg }
|
|
410
404
|
}
|
|
411
405
|
typography: {
|
|
412
406
|
fontFamily: string
|
|
@@ -793,7 +787,6 @@ import { CheckoutFormButton } from 'igloo-d2c-components'
|
|
|
793
787
|
**Tenant Theme Support:** The button automatically uses tenant-specific colors:
|
|
794
788
|
|
|
795
789
|
- **AmmetLife**: Blue (#317ABC)
|
|
796
|
-
- **CIMB**: Red (#D71920)
|
|
797
790
|
- **Igloo**: Black (#13131B)
|
|
798
791
|
|
|
799
792
|
#### HealthQuestionGroup
|
|
@@ -947,7 +940,7 @@ Get current tenant ID.
|
|
|
947
940
|
import { useTenantId } from 'igloo-d2c-components'
|
|
948
941
|
|
|
949
942
|
function MyComponent() {
|
|
950
|
-
const tenantId = useTenantId() // 'igloo' | '
|
|
943
|
+
const tenantId = useTenantId() // 'igloo' | 'ammetlife'
|
|
951
944
|
return <div>Current tenant: {tenantId}</div>
|
|
952
945
|
}
|
|
953
946
|
```
|
|
@@ -960,10 +953,10 @@ Check if current tenant matches a specific ID.
|
|
|
960
953
|
import { useIsTenant } from 'igloo-d2c-components'
|
|
961
954
|
|
|
962
955
|
function MyComponent() {
|
|
963
|
-
const
|
|
956
|
+
const isAmmetLife = useIsTenant('ammetlife')
|
|
964
957
|
|
|
965
|
-
if (
|
|
966
|
-
return <
|
|
958
|
+
if (isAmmetLife) {
|
|
959
|
+
return <AmmetLifeSpecificFeature />
|
|
967
960
|
}
|
|
968
961
|
|
|
969
962
|
return <DefaultFeature />
|
|
@@ -1017,7 +1010,7 @@ Get list of all available tenant IDs.
|
|
|
1017
1010
|
import { getAvailableTenants } from 'igloo-d2c-components'
|
|
1018
1011
|
|
|
1019
1012
|
const tenants = getAvailableTenants()
|
|
1020
|
-
// ['igloo', '
|
|
1013
|
+
// ['igloo', 'ammetlife']
|
|
1021
1014
|
```
|
|
1022
1015
|
|
|
1023
1016
|
#### getThemeColor()
|
|
@@ -1049,7 +1042,6 @@ d2c-component-library/src/assets/
|
|
|
1049
1042
|
│ └── index.ts # Icon path utilities
|
|
1050
1043
|
├── tenants/ # Tenant-specific assets
|
|
1051
1044
|
│ ├── igloo/logo.svg
|
|
1052
|
-
│ ├── cimb/logo.svg
|
|
1053
1045
|
│ └── ammetlife/logo.svg
|
|
1054
1046
|
└── index.ts # Main asset exports
|
|
1055
1047
|
```
|
|
@@ -1066,7 +1058,6 @@ d2c-component-library/src/assets/
|
|
|
1066
1058
|
│ ├── icons/ → Common UI icons │
|
|
1067
1059
|
│ └── tenants/ → Tenant logos │
|
|
1068
1060
|
│ ├── igloo/logo.svg │
|
|
1069
|
-
│ ├── cimb/logo.svg │
|
|
1070
1061
|
│ └── ammetlife/logo.svg │
|
|
1071
1062
|
│ │
|
|
1072
1063
|
│ BUILD ⬇️ │
|
|
@@ -1128,6 +1119,42 @@ The theme paths reference `/assets/tenants/{tenant}/logo.svg` which maps to:
|
|
|
1128
1119
|
|
|
1129
1120
|
## 🔌 Integration Guide
|
|
1130
1121
|
|
|
1122
|
+
### Next.js Integration
|
|
1123
|
+
|
|
1124
|
+
📘 **[Complete Next.js Integration Guide](./NEXTJS_MIGRATION.md)**
|
|
1125
|
+
|
|
1126
|
+
The library is fully compatible with Next.js 13+ (both App Router and Pages Router).
|
|
1127
|
+
|
|
1128
|
+
**Quick Start:**
|
|
1129
|
+
|
|
1130
|
+
```bash
|
|
1131
|
+
# Install
|
|
1132
|
+
npm install igloo-d2c-components
|
|
1133
|
+
|
|
1134
|
+
# Configure next.config.js
|
|
1135
|
+
module.exports = {
|
|
1136
|
+
transpilePackages: ['igloo-d2c-components'],
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
# Copy assets
|
|
1140
|
+
npm run copy-assets
|
|
1141
|
+
```
|
|
1142
|
+
|
|
1143
|
+
**Key Features:**
|
|
1144
|
+
- ✅ Server-Side Rendering (SSR) support
|
|
1145
|
+
- ✅ Automatic 'use client' boundaries
|
|
1146
|
+
- ✅ Optimized for Next.js 13+ App Router
|
|
1147
|
+
- ✅ Tree-shaking enabled
|
|
1148
|
+
- ✅ TypeScript support
|
|
1149
|
+
- ✅ ES2020+ modern output
|
|
1150
|
+
|
|
1151
|
+
See [NEXTJS_MIGRATION.md](./NEXTJS_MIGRATION.md) for:
|
|
1152
|
+
- Detailed setup instructions
|
|
1153
|
+
- Asset configuration
|
|
1154
|
+
- Common issues & solutions
|
|
1155
|
+
- Performance optimization tips
|
|
1156
|
+
- Testing strategies
|
|
1157
|
+
|
|
1131
1158
|
### Multi-Tenant Architecture
|
|
1132
1159
|
|
|
1133
1160
|
#### Tenant Configuration Structure
|
|
@@ -1137,8 +1164,7 @@ config/tenants/
|
|
|
1137
1164
|
├── index.ts # Tenant registry and utility functions
|
|
1138
1165
|
├── types.ts # TypeScript interfaces
|
|
1139
1166
|
├── igloo.ts # Igloo tenant configuration
|
|
1140
|
-
|
|
1141
|
-
└── cimb.ts # CIMB tenant configuration
|
|
1167
|
+
└── ammetlife.ts # AmmetLife tenant configuration
|
|
1142
1168
|
```
|
|
1143
1169
|
|
|
1144
1170
|
#### Tenant Configuration Example
|
|
@@ -1501,20 +1527,19 @@ yarn build-storybook
|
|
|
1501
1527
|
|
|
1502
1528
|
### Available Stories
|
|
1503
1529
|
|
|
1504
|
-
**NewHeader Stories (
|
|
1530
|
+
**NewHeader Stories (11 scenarios):**
|
|
1505
1531
|
|
|
1506
1532
|
1. Default - Basic header with Igloo branding
|
|
1507
1533
|
2. Authenticated User - Header with logged-in user menu
|
|
1508
1534
|
3. Mobile View - Responsive mobile layout
|
|
1509
|
-
4.
|
|
1510
|
-
5.
|
|
1511
|
-
6.
|
|
1512
|
-
7.
|
|
1513
|
-
8.
|
|
1514
|
-
9.
|
|
1515
|
-
10.
|
|
1516
|
-
11.
|
|
1517
|
-
12. Responsive Demo - Interactive responsive testing
|
|
1535
|
+
4. AmMetLife Tenant - AmMetLife branding
|
|
1536
|
+
5. Minimal Header - Bare-bones implementation
|
|
1537
|
+
6. Custom Drawer Content - Advanced customization
|
|
1538
|
+
7. Many Menu Items - Stress test with scrolling
|
|
1539
|
+
8. Without Logo - Edge case testing
|
|
1540
|
+
9. With Internationalization - i18n integration
|
|
1541
|
+
10. All Tenants Comparison - Side-by-side view
|
|
1542
|
+
11. Responsive Demo - Interactive responsive testing
|
|
1518
1543
|
|
|
1519
1544
|
**Other Component Stories:**
|
|
1520
1545
|
|
|
@@ -1605,7 +1630,79 @@ before_script:
|
|
|
1605
1630
|
|
|
1606
1631
|
---
|
|
1607
1632
|
|
|
1608
|
-
## 📦 Publishing
|
|
1633
|
+
## 📦 Versioning & Publishing
|
|
1634
|
+
|
|
1635
|
+
### Versioning Strategy
|
|
1636
|
+
|
|
1637
|
+
📘 **[Complete Versioning Guide](./VERSIONING_STRATEGY.md)** | **[Quick Start](./VERSIONING_QUICK_START.md)**
|
|
1638
|
+
|
|
1639
|
+
This library uses **Semantic Versioning** (semver) with multiple release channels:
|
|
1640
|
+
|
|
1641
|
+
| Version | Type | Example | When to Use |
|
|
1642
|
+
|---------|------|---------|-------------|
|
|
1643
|
+
| **Patch** | Bug fix | 1.0.50 → 1.0.51 | Security fixes, bug fixes |
|
|
1644
|
+
| **Minor** | New feature | 1.0.51 → 1.1.0 | New components, new props |
|
|
1645
|
+
| **Major** | Breaking | 1.1.0 → 2.0.0 | API changes, removed features |
|
|
1646
|
+
|
|
1647
|
+
### NPM Dist-tags
|
|
1648
|
+
|
|
1649
|
+
```bash
|
|
1650
|
+
# Latest stable (production)
|
|
1651
|
+
npm install igloo-d2c-components # or @latest
|
|
1652
|
+
|
|
1653
|
+
# Next version (beta features)
|
|
1654
|
+
npm install igloo-d2c-components@next
|
|
1655
|
+
|
|
1656
|
+
# v2 beta (next major version)
|
|
1657
|
+
npm install igloo-d2c-components@v2-beta
|
|
1658
|
+
|
|
1659
|
+
# Specific version (recommended for production)
|
|
1660
|
+
npm install igloo-d2c-components@1.0.51
|
|
1661
|
+
```
|
|
1662
|
+
|
|
1663
|
+
### For Production Apps (@d2c-sales-portal)
|
|
1664
|
+
|
|
1665
|
+
**📘 [Complete Setup Guide](./CONSUMING_APP_SETUP.md)** | **[Environment Versioning](./ENVIRONMENT_VERSIONING.md)**
|
|
1666
|
+
|
|
1667
|
+
**Pin versions by environment:**
|
|
1668
|
+
|
|
1669
|
+
```json
|
|
1670
|
+
// Production
|
|
1671
|
+
{
|
|
1672
|
+
"dependencies": {
|
|
1673
|
+
"igloo-d2c-components": "~1.0.51" // Pin to production versions
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
// DEV/QA/Staging
|
|
1678
|
+
{
|
|
1679
|
+
"dependencies": {
|
|
1680
|
+
"igloo-d2c-components": "non-prod" // Auto-get latest non-prod
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
```
|
|
1684
|
+
|
|
1685
|
+
**Automatic Environment Detection:**
|
|
1686
|
+
- **main branch** → Publishes `1.0.51` (production)
|
|
1687
|
+
- **other branches** → Publishes `1.0.51-non-prod` (DEV/QA/Staging)
|
|
1688
|
+
|
|
1689
|
+
See [VERSIONING_STRATEGY.md](./VERSIONING_STRATEGY.md) for complete version management guide.
|
|
1690
|
+
|
|
1691
|
+
### Quick Release
|
|
1692
|
+
|
|
1693
|
+
```bash
|
|
1694
|
+
# Bug fix release
|
|
1695
|
+
npm run release:patch
|
|
1696
|
+
|
|
1697
|
+
# Feature release (test in staging first)
|
|
1698
|
+
npm run release:minor
|
|
1699
|
+
|
|
1700
|
+
# Breaking change (needs migration guide)
|
|
1701
|
+
npm run release:major
|
|
1702
|
+
|
|
1703
|
+
# Beta release (for testing)
|
|
1704
|
+
npm run release:beta
|
|
1705
|
+
```
|
|
1609
1706
|
|
|
1610
1707
|
### Prerequisites
|
|
1611
1708
|
|
|
@@ -1746,7 +1843,7 @@ yarn install
|
|
|
1746
1843
|
Theme not found for tenant: xxx
|
|
1747
1844
|
```
|
|
1748
1845
|
|
|
1749
|
-
**Solution:** Use valid tenant IDs: `'igloo'
|
|
1846
|
+
**Solution:** Use valid tenant IDs: `'igloo'` or `'ammetlife'`.
|
|
1750
1847
|
|
|
1751
1848
|
### TypeScript Errors with Imports
|
|
1752
1849
|
|
|
@@ -1895,7 +1992,6 @@ Follow [Conventional Commits](https://www.conventionalcommits.org/):
|
|
|
1895
1992
|
|
|
1896
1993
|
export const tenantThemes: Record<TenantId, TenantThemeConfig> = {
|
|
1897
1994
|
igloo: iglooTheme,
|
|
1898
|
-
cimb: cimbTheme,
|
|
1899
1995
|
ammetlife: ammetlifeTheme,
|
|
1900
1996
|
newtenant: newTenantTheme, // Add here
|
|
1901
1997
|
}
|
|
@@ -1904,7 +2000,7 @@ Follow [Conventional Commits](https://www.conventionalcommits.org/):
|
|
|
1904
2000
|
2. **Update TenantId type in `src/types/tenant.ts`:**
|
|
1905
2001
|
|
|
1906
2002
|
```typescript
|
|
1907
|
-
export type TenantId = 'igloo' | '
|
|
2003
|
+
export type TenantId = 'igloo' | 'ammetlife' | 'newtenant'
|
|
1908
2004
|
```
|
|
1909
2005
|
|
|
1910
2006
|
3. **Add logo asset to `src/assets/tenants/newtenant/`**
|
|
@@ -1960,7 +2056,7 @@ yarn add igloo-d2c-components@latest
|
|
|
1960
2056
|
### Import Themes
|
|
1961
2057
|
|
|
1962
2058
|
```typescript
|
|
1963
|
-
import { iglooTheme,
|
|
2059
|
+
import { iglooTheme, ammetlifeTheme, getTenantTheme } from 'igloo-d2c-components'
|
|
1964
2060
|
```
|
|
1965
2061
|
|
|
1966
2062
|
### Import Components
|
|
@@ -1990,7 +2086,6 @@ yarn build
|
|
|
1990
2086
|
```bash
|
|
1991
2087
|
yarn start-igloo # Port 8000
|
|
1992
2088
|
yarn start-ammetlife # Port 8001
|
|
1993
|
-
yarn start-cimb # Port 8002
|
|
1994
2089
|
```
|
|
1995
2090
|
|
|
1996
2091
|
---
|