@wlloyalty/wll-react-sdk 1.0.10 → 1.0.20

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 CHANGED
@@ -1,8 +1,101 @@
1
- ## Compatibility
1
+ # Loyalty Tiles SDK
2
2
 
3
- This library is compatible with:
3
+ > A React SDK for building customisable loyalty experiences with configurable tiles, themes, and navigation
4
4
 
5
+ [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits&logoColor=white)](https://conventionalcommits.org)
6
+ [![React Support](https://img.shields.io/badge/React-18.0.0+-61DAFB?logo=react&logoColor=white)](https://reactjs.org/)
7
+ [![React Native Support](https://img.shields.io/badge/React%20Native-0.70--0.72-61DAFB?logo=react&logoColor=white)](https://reactnative.dev/)
8
+
9
+ ## ✨ Features
10
+
11
+ - 🎨 **Flexible Theming** - Full control over visual styling with automatic color derivation and responsive design system
12
+ - 🧩 **Composable Tiles** - Pre-built components for rewards, points, badges, and tiers that work together seamlessly
13
+ - 🔌 **Platform Agnostic** - Bring your own navigation and network layer to integrate with any React application
14
+ - 📱 **Mobile First** - Responsive components optimized for both mobile and desktop experiences
15
+ - 🔒 **Secure by Design** - Built-in support for custom API integration through your own backend proxy
16
+ - ⚡ **Easy Integration** - Simple setup with customisable configuration for navigation, theming, and API handling
17
+
18
+ ## 📚 Documentation
19
+
20
+ - [Getting Started Guide](https://wll-react-sdk.vercel.app/guide/getting-started)
21
+ - [Component Library](https://wll-react-sdk.vercel.app/components/)
22
+ - [Live Storybook Demo](https://66c36701bb14ec551f38279c-ueompbfvfq.chromatic.com/)
23
+
24
+ ## 🚀 Quick Start
25
+
26
+ ```bash
27
+ # npm
28
+ npm install @wll/react-sdk
29
+
30
+ # yarn
31
+ yarn add @wll/react-sdk
32
+ ```
33
+
34
+ ## 💻 System Requirements
35
+
36
+ The SDK is compatible with:
5
37
  - React: ^18.0.0
6
38
  - React Native: >=0.70.0 <0.73.0
7
39
 
8
- Please ensure your project's React and React Native versions fall within these ranges for optimal compatibility.
40
+ Please ensure your project meets these version requirements for optimal compatibility.
41
+
42
+ ## 🤝 Contributing
43
+
44
+ We welcome contributions! This project follows the [Conventional Commits](https://www.conventionalcommits.org/) specification to ensure consistent commit messages and automated versioning.
45
+
46
+ ### Commit Message Format
47
+
48
+ ```
49
+ type(scope?): subject
50
+
51
+ [optional body]
52
+
53
+ [optional footer(s)]
54
+ ```
55
+
56
+ ### Types
57
+ | Type | Description |
58
+ |------|-------------|
59
+ | `feat` | New features (e.g., `feat(auth): add Google OAuth login`) |
60
+ | `fix` | Bug fixes (e.g., `fix(api): correct rate limiting logic`) |
61
+ | `hotfix` | Critical bug fixes requiring immediate deployment |
62
+ | `docs` | Documentation changes |
63
+ | `style` | Code style changes (formatting, etc) |
64
+ | `refactor` | Code changes that neither fix bugs nor add features |
65
+ | `perf` | Performance improvements |
66
+ | `test` | Adding or updating tests |
67
+ | `build` | Changes to build system or dependencies |
68
+ | `ci` | Changes to CI configuration |
69
+ | `chore` | Other changes that don't modify src or test files |
70
+ | `revert` | Reverting previous changes |
71
+ | `wip` | Work in progress |
72
+
73
+ ### Development Workflow
74
+
75
+ We use several tools to maintain code quality:
76
+ - **Commitlint**: Validates commit message format
77
+ - **Commitizen**: Interactive commit message formatter
78
+ - **Husky**: Git hooks for enforcing conventions
79
+
80
+ ```bash
81
+ # Make a commit using the interactive tool
82
+ yarn commit
83
+
84
+ # Reinstall git hooks if needed
85
+ yarn prepare
86
+ ```
87
+
88
+ ## 📄 License
89
+
90
+ MIT License - See [LICENSE](LICENSE) for more information.
91
+
92
+ Copyright (c) 2024 WLL
93
+
94
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
95
+
96
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
97
+
98
+ ## 🆘 Support
99
+
100
+ - [Documentation](https://wll-react-sdk.vercel.app/)
101
+ - [Issues](https://github.com/white-label-loyalty/wll-react-sdk/issues)
package/dist/index.d.ts CHANGED
@@ -144,8 +144,8 @@ type TierType = {
144
144
  attained?: boolean;
145
145
  };
146
146
 
147
- declare enum UrlTarget {
148
- sameWindow = "SAME_WINDOW",
147
+ declare enum CTALinkTarget {
148
+ sameWindow = "SAME_FRAME",
149
149
  newWindow = "NEW_WINDOW"
150
150
  }
151
151
  declare enum TierTileType {
@@ -176,7 +176,7 @@ declare class BannerTileConfig {
176
176
  description?: string | null;
177
177
  ctaText?: string | null;
178
178
  ctaLink?: string | null;
179
- ctaLinkTarget?: UrlTarget;
179
+ ctaLinkTarget?: CTALinkTarget;
180
180
  }
181
181
  declare class PointsTileConfig {
182
182
  title?: string | null;
@@ -190,7 +190,8 @@ declare class ContentTileConfig {
190
190
  title?: string | null;
191
191
  body?: string | null;
192
192
  artworkUrl?: string | null;
193
- linkURL?: string | null;
193
+ ctaLinkTarget?: CTALinkTarget;
194
+ ctaLink?: string | null;
194
195
  }
195
196
  declare class RewardTileConfig {
196
197
  rewardId: string;
@@ -447,12 +448,12 @@ type BannerTileProps = {
447
448
  tile: Tile;
448
449
  };
449
450
  declare const BannerTile: React.FC<BannerTileProps> & {
450
- Image: typeof BannerTileImage;
451
+ Media: typeof BannerTileMedia;
451
452
  Title: typeof BannerTileTitle;
452
453
  Description: typeof BannerTileDescription;
453
454
  CTA: typeof BannerTileCTA;
454
455
  };
455
- declare const BannerTileImage: React.FC;
456
+ declare const BannerTileMedia: React.FC;
456
457
  declare const BannerTileTitle: React.FC;
457
458
  declare const BannerTileDescription: React.FC;
458
459
  declare const BannerTileCTA: React.FC;
@@ -578,6 +579,19 @@ type TGroup = {
578
579
  sections: TSection[];
579
580
  };
580
581
 
582
+ type NavigationHandlerParams = {
583
+ target: string;
584
+ windowTarget: string;
585
+ };
586
+ type NavigationConfig = {
587
+ navigationHandlers?: {
588
+ external?: (params: NavigationHandlerParams) => void;
589
+ internal?: (params: NavigationHandlerParams) => void;
590
+ modal?: (params: NavigationHandlerParams) => void;
591
+ };
592
+ baseUrl?: string;
593
+ };
594
+
581
595
  type Fetcher = <T>(endpoint: string, options?: RequestInit) => Promise<APIResponse<T>>;
582
596
  type SDKConfig = {
583
597
  apiKey: string;
@@ -594,13 +608,15 @@ type WllSdkContextType = ThemeContextType & {
594
608
  getGroupByID: (id: string) => Promise<APIResponse<TGroup>>;
595
609
  getSectionByID: (id: string) => Promise<APIResponse<TSection>>;
596
610
  getTileByID: (id: string) => Promise<APIResponse<Tile>>;
611
+ handleNavigation: (link: string, target: CTALinkTarget) => void;
597
612
  };
598
613
  type WllSdkProviderProps = {
599
614
  children: React__default.ReactNode;
600
615
  theme?: Partial<BaseThemeObject>;
601
616
  config: SDKConfig;
617
+ navigationConfig?: NavigationConfig;
602
618
  };
603
619
  declare const WllSdkProvider: React__default.FC<WllSdkProviderProps>;
604
620
  declare const useWllSdk: () => WllSdkContextType;
605
621
 
606
- export { type APIResponse, type Availability, type Badge, type BadgeDetail, BadgeTile$1 as BadgeTile, BadgeTileConfig, BadgeTileType, BadgeTile as BadgeTileUpdated, BannerTile, BannerTileConfig, BaseBanner, type BaseThemeObject, BaseTile, Button, Carousel, Column as Content, ContentTile, ContentTileConfig, type DerivedProperties, Grid, Group, Icon, type ImagePropsNoSource, LoadingIndicator, PointsTile, PointsTileConfig, type ProgessType, ProgressBar, ProgressIndicator, ProgressType, ProgressiveImage, Reward, type RewardCategory, RewardCategoryTile, RewardCategoryTileConfig, RewardTile, RewardTileConfig, RowHeader, type SDKConfig, Section, SectionHeader, SectionType, type Size, type TSection, Text, type ThemeContextType, type ThemeObject, type ThemeProviderProps, TierTile$1 as TierTile, TierTileConfig, TierTileType, TierTile as TierTileUpdated, type TierType, type Tile, type TileConfig, TileContainer, TileHeight, TileType, UrlTarget, type Variant, WllSdkProvider, useWllSdk };
622
+ export { type APIResponse, type Availability, type Badge, type BadgeDetail, BadgeTile$1 as BadgeTile, BadgeTileConfig, BadgeTileType, BadgeTile as BadgeTileUpdated, BannerTile, BannerTileConfig, BaseBanner, type BaseThemeObject, BaseTile, Button, CTALinkTarget, Carousel, Column as Content, ContentTile, ContentTileConfig, type DerivedProperties, Grid, Group, Icon, type ImagePropsNoSource, LoadingIndicator, PointsTile, PointsTileConfig, type ProgessType, ProgressBar, ProgressIndicator, ProgressType, ProgressiveImage, Reward, type RewardCategory, RewardCategoryTile, RewardCategoryTileConfig, RewardTile, RewardTileConfig, RowHeader, type SDKConfig, Section, SectionHeader, SectionType, type Size, type TSection, Text, type ThemeContextType, type ThemeObject, type ThemeProviderProps, TierTile$1 as TierTile, TierTileConfig, TierTileType, TierTile as TierTileUpdated, type TierType, type Tile, type TileConfig, TileContainer, TileHeight, TileType, type Variant, WllSdkProvider, useWllSdk };