@wlloyalty/wll-react-sdk 1.8.0 → 1.8.1
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 +5 -5
- package/dist/index.d.ts +4 -0
- package/dist/native.js +39 -3
- package/dist/native.js.map +1 -1
- package/dist/types/components/organisms/RewardTile/RewardTile.stories.d.ts +15 -0
- package/dist/types/components/organisms/RewardTile/index.d.ts +1 -0
- package/dist/types/components/organisms/RewardTile/reward-tile-status.d.ts +7 -0
- package/dist/types/types/tile.d.ts +4 -0
- package/dist/web.js +45 -6
- package/dist/web.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://conventionalcommits.org)
|
|
6
6
|
[](https://reactjs.org/)
|
|
7
|
-
[](https://reactnative.dev/)
|
|
8
8
|
|
|
9
9
|
## ✨ Features
|
|
10
10
|
|
|
11
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
|
|
12
|
+
- 🧩 **Composable Tiles** - Pre-built components for rewards, points, badges, banners, venues, and tiers that work together seamlessly
|
|
13
13
|
- 🔌 **Platform Agnostic** - Bring your own navigation and network layer to integrate with any React application
|
|
14
14
|
- 📱 **Mobile First** - Responsive components optimized for both mobile and desktop experiences
|
|
15
15
|
- 🔒 **Secure by Design** - Built-in support for custom API integration through your own backend proxy
|
|
@@ -35,8 +35,8 @@ yarn add @wlloyalty/wll-react-sdk
|
|
|
35
35
|
|
|
36
36
|
The SDK is compatible with:
|
|
37
37
|
|
|
38
|
-
- React:
|
|
39
|
-
- React Native: >=0.
|
|
38
|
+
- React: >=18.0.0
|
|
39
|
+
- React Native: >=0.77.0
|
|
40
40
|
|
|
41
41
|
Please ensure your project meets these version requirements for optimal compatibility.
|
|
42
42
|
|
|
@@ -140,7 +140,7 @@ The script will generate a new component with the proper file structure and boil
|
|
|
140
140
|
|
|
141
141
|
MIT License - See [LICENSE](LICENSE) for more information.
|
|
142
142
|
|
|
143
|
-
Copyright (c)
|
|
143
|
+
Copyright (c) 2026 WLL
|
|
144
144
|
|
|
145
145
|
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:
|
|
146
146
|
|
package/dist/index.d.ts
CHANGED
|
@@ -203,6 +203,10 @@ declare class RewardTileConfig {
|
|
|
203
203
|
priority: number;
|
|
204
204
|
availability: Availability;
|
|
205
205
|
purchasable: boolean;
|
|
206
|
+
stockCapacity?: number;
|
|
207
|
+
stockConsumed?: number;
|
|
208
|
+
outOfStockMessage?: string;
|
|
209
|
+
stockRemainingMessage?: string;
|
|
206
210
|
tier: string | null;
|
|
207
211
|
category: RewardCategory;
|
|
208
212
|
discounts: any[];
|
package/dist/native.js
CHANGED
|
@@ -4136,7 +4136,8 @@ var useRewardTileStyles = function () {
|
|
|
4136
4136
|
paddingHorizontal: useResponsiveValue(theme.sizes.sm, theme.sizes.xxs, isDesktop, isTablet),
|
|
4137
4137
|
},
|
|
4138
4138
|
footer: {
|
|
4139
|
-
|
|
4139
|
+
width: '100%',
|
|
4140
|
+
marginTop: useResponsiveValue(theme.sizes.xxs, theme.sizes.xxxs, isDesktop, isTablet),
|
|
4140
4141
|
},
|
|
4141
4142
|
pointsContainer: {
|
|
4142
4143
|
flexDirection: 'row',
|
|
@@ -4163,6 +4164,10 @@ var useRewardTileStyles = function () {
|
|
|
4163
4164
|
alignItems: 'center',
|
|
4164
4165
|
zIndex: 10,
|
|
4165
4166
|
},
|
|
4167
|
+
statusChip: {
|
|
4168
|
+
flexShrink: 1,
|
|
4169
|
+
marginLeft: 'auto',
|
|
4170
|
+
},
|
|
4166
4171
|
});
|
|
4167
4172
|
};
|
|
4168
4173
|
|
|
@@ -4214,7 +4219,27 @@ var RewardTilePoints = function () {
|
|
|
4214
4219
|
return null;
|
|
4215
4220
|
var calculatedPoints = applyMultiplier(price, pointsMultiplier);
|
|
4216
4221
|
var accessibilityLabel = getPointsLabel('Reward points:', calculatedPoints, pointsPrefix, pointsSuffix);
|
|
4217
|
-
return (jsxRuntimeExports.jsx(reactNative.View, {
|
|
4222
|
+
return (jsxRuntimeExports.jsx(reactNative.View, { testID: "reward-tile-points", role: "article", accessibilityLabel: accessibilityLabel, children: jsxRuntimeExports.jsxs(Row, { align: "center", justify: "start", children: [pointsPrefix ? jsxRuntimeExports.jsx(Text, { variant: "caption", children: pointsPrefix }) : null, jsxRuntimeExports.jsx(Text, { variant: "caption", testID: "reward-tile-points-value", children: calculatedPoints }), pointsSuffix ? (jsxRuntimeExports.jsx(Text, { variant: "caption", style: styles.suffix, children: pointsSuffix })) : null] }) }));
|
|
4223
|
+
};
|
|
4224
|
+
|
|
4225
|
+
/**
|
|
4226
|
+
* Renders availability status for a Reward Tile.
|
|
4227
|
+
*
|
|
4228
|
+
* @returns React.ReactElement or null if the reward is purchasable
|
|
4229
|
+
*/
|
|
4230
|
+
var RewardTileStatus = function () {
|
|
4231
|
+
var styles = useRewardTileStyles();
|
|
4232
|
+
var tileContext = useTileContext();
|
|
4233
|
+
if (!isContextValid(tileContext))
|
|
4234
|
+
return null;
|
|
4235
|
+
var _a = tileContext.configuration, stockCapacity = _a.stockCapacity, stockConsumed = _a.stockConsumed, outOfStockMessage = _a.outOfStockMessage, stockRemainingMessage = _a.stockRemainingMessage;
|
|
4236
|
+
var isOutOfStock = stockCapacity !== undefined &&
|
|
4237
|
+
stockConsumed !== undefined &&
|
|
4238
|
+
stockCapacity <= stockConsumed;
|
|
4239
|
+
var label = isOutOfStock ? outOfStockMessage : stockRemainingMessage;
|
|
4240
|
+
if (!label)
|
|
4241
|
+
return null;
|
|
4242
|
+
return (jsxRuntimeExports.jsx(Chip, { label: label, role: "status", ariaLive: "off", accessibilityLabel: label, testID: "reward-tile-status", variant: exports.StatusVariant.GREY, style: styles.statusChip }));
|
|
4218
4243
|
};
|
|
4219
4244
|
|
|
4220
4245
|
/**
|
|
@@ -4283,7 +4308,17 @@ var RewardTileRoot = function (_a) {
|
|
|
4283
4308
|
return null;
|
|
4284
4309
|
var configuration = tile.configuration;
|
|
4285
4310
|
var artworkOnly = isArtworkOnly(configuration);
|
|
4286
|
-
|
|
4311
|
+
var hasPoints = configuration.showPrice !== false &&
|
|
4312
|
+
configuration.price !== undefined &&
|
|
4313
|
+
configuration.price !== 0;
|
|
4314
|
+
var isOutOfStock = configuration.stockCapacity !== undefined &&
|
|
4315
|
+
configuration.stockConsumed !== undefined &&
|
|
4316
|
+
configuration.stockCapacity <= configuration.stockConsumed;
|
|
4317
|
+
var hasStatus = isOutOfStock
|
|
4318
|
+
? !!configuration.outOfStockMessage
|
|
4319
|
+
: !!configuration.stockRemainingMessage;
|
|
4320
|
+
var hasFooter = hasPoints || hasStatus;
|
|
4321
|
+
return (jsxRuntimeExports.jsxs(BaseTile, { tile: tile, children: [jsxRuntimeExports.jsx(RewardTile.Media, { isArtworkOnly: artworkOnly }), !artworkOnly && (jsxRuntimeExports.jsxs(Layout, { children: [jsxRuntimeExports.jsxs(Row, { justify: "between", align: "center", style: styles.header, children: [jsxRuntimeExports.jsx(RewardTile.Title, {}), jsxRuntimeExports.jsx(RewardTile.Chevron, {})] }), jsxRuntimeExports.jsx(reactNative.View, { style: { width: '100%', maxWidth: '100%', minWidth: 0 }, children: jsxRuntimeExports.jsx(RewardTile.Summary, {}) }), hasFooter && (jsxRuntimeExports.jsxs(Row, { justify: "between", align: "center", style: styles.footer, children: [jsxRuntimeExports.jsx(RewardTile.Points, {}), jsxRuntimeExports.jsx(RewardTile.Status, {})] }))] }))] }));
|
|
4287
4322
|
};
|
|
4288
4323
|
/**
|
|
4289
4324
|
* The RewardTile component with subcomponents attached.
|
|
@@ -4294,6 +4329,7 @@ var RewardTile = Object.assign(RewardTileRoot, {
|
|
|
4294
4329
|
Summary: RewardTileSummary,
|
|
4295
4330
|
Points: RewardTilePoints,
|
|
4296
4331
|
Chevron: RewardTileChevron,
|
|
4332
|
+
Status: RewardTileStatus,
|
|
4297
4333
|
});
|
|
4298
4334
|
var RewardTile$1 = withTileFetching(RewardTile);
|
|
4299
4335
|
|