@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
|
@@ -16,6 +16,21 @@ export declare const Locked: import("@storybook/core/csf").AnnotatedStoryFn<impo
|
|
|
16
16
|
export declare const ArtworkOnlyLocked: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, Omit<{
|
|
17
17
|
tile: import("../../..").Tile;
|
|
18
18
|
}, "tile"> & import("../../hoc/withTileFetching").WithTileFetchingProps>;
|
|
19
|
+
export declare const OutOfStock: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, Omit<{
|
|
20
|
+
tile: import("../../..").Tile;
|
|
21
|
+
}, "tile"> & import("../../hoc/withTileFetching").WithTileFetchingProps>;
|
|
22
|
+
export declare const ArtworkOnlyOutOfStock: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, Omit<{
|
|
23
|
+
tile: import("../../..").Tile;
|
|
24
|
+
}, "tile"> & import("../../hoc/withTileFetching").WithTileFetchingProps>;
|
|
25
|
+
export declare const StockRemaining: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, Omit<{
|
|
26
|
+
tile: import("../../..").Tile;
|
|
27
|
+
}, "tile"> & import("../../hoc/withTileFetching").WithTileFetchingProps>;
|
|
28
|
+
export declare const StockRemainingWithPoints: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, Omit<{
|
|
29
|
+
tile: import("../../..").Tile;
|
|
30
|
+
}, "tile"> & import("../../hoc/withTileFetching").WithTileFetchingProps>;
|
|
19
31
|
export declare const TwoPerRow: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, Omit<{
|
|
20
32
|
tile: import("../../..").Tile;
|
|
21
33
|
}, "tile"> & import("../../hoc/withTileFetching").WithTileFetchingProps>;
|
|
34
|
+
export declare const TwoPerRowMerchandise: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, Omit<{
|
|
35
|
+
tile: import("../../..").Tile;
|
|
36
|
+
}, "tile"> & import("../../hoc/withTileFetching").WithTileFetchingProps>;
|
|
@@ -14,6 +14,7 @@ export declare const RewardTile: (({ tile, }: RewardTileProps) => React.ReactEle
|
|
|
14
14
|
Summary: () => React.ReactElement | null;
|
|
15
15
|
Points: () => React.ReactElement | null;
|
|
16
16
|
Chevron: () => React.ReactElement;
|
|
17
|
+
Status: () => React.ReactElement | null;
|
|
17
18
|
};
|
|
18
19
|
declare const _default: (props: Omit<RewardTileProps, "tile"> & import("../../hoc/withTileFetching").WithTileFetchingProps) => React.JSX.Element;
|
|
19
20
|
export default _default;
|
|
@@ -84,6 +84,10 @@ export declare class RewardTileConfig {
|
|
|
84
84
|
priority: number;
|
|
85
85
|
availability: Availability;
|
|
86
86
|
purchasable: boolean;
|
|
87
|
+
stockCapacity?: number;
|
|
88
|
+
stockConsumed?: number;
|
|
89
|
+
outOfStockMessage?: string;
|
|
90
|
+
stockRemainingMessage?: string;
|
|
87
91
|
tier: string | null;
|
|
88
92
|
category: RewardCategory;
|
|
89
93
|
discounts: any[];
|
package/dist/web.js
CHANGED
|
@@ -22740,7 +22740,8 @@ var useRewardTileStyles = function () {
|
|
|
22740
22740
|
paddingHorizontal: useResponsiveValue(theme.sizes.sm, theme.sizes.xxs, isDesktop, isTablet)
|
|
22741
22741
|
},
|
|
22742
22742
|
footer: {
|
|
22743
|
-
|
|
22743
|
+
width: '100%',
|
|
22744
|
+
marginTop: useResponsiveValue(theme.sizes.xxs, theme.sizes.xxxs, isDesktop, isTablet)
|
|
22744
22745
|
},
|
|
22745
22746
|
pointsContainer: {
|
|
22746
22747
|
flexDirection: 'row',
|
|
@@ -22769,6 +22770,10 @@ var useRewardTileStyles = function () {
|
|
|
22769
22770
|
justifyContent: 'center',
|
|
22770
22771
|
alignItems: 'center',
|
|
22771
22772
|
zIndex: 10
|
|
22773
|
+
},
|
|
22774
|
+
statusChip: {
|
|
22775
|
+
flexShrink: 1,
|
|
22776
|
+
marginLeft: 'auto'
|
|
22772
22777
|
}
|
|
22773
22778
|
});
|
|
22774
22779
|
};
|
|
@@ -22855,9 +22860,6 @@ var RewardTilePoints = function () {
|
|
|
22855
22860
|
var calculatedPoints = applyMultiplier(price, pointsMultiplier);
|
|
22856
22861
|
var accessibilityLabel = getPointsLabel('Reward points:', calculatedPoints, pointsPrefix, pointsSuffix);
|
|
22857
22862
|
return /*#__PURE__*/React.createElement(View$2, {
|
|
22858
|
-
style: {
|
|
22859
|
-
marginTop: 'auto'
|
|
22860
|
-
},
|
|
22861
22863
|
testID: "reward-tile-points",
|
|
22862
22864
|
role: "article",
|
|
22863
22865
|
accessibilityLabel: accessibilityLabel
|
|
@@ -22875,6 +22877,34 @@ var RewardTilePoints = function () {
|
|
|
22875
22877
|
}, pointsSuffix)) : null));
|
|
22876
22878
|
};
|
|
22877
22879
|
|
|
22880
|
+
/**
|
|
22881
|
+
* Renders availability status for a Reward Tile.
|
|
22882
|
+
*
|
|
22883
|
+
* @returns React.ReactElement or null if the reward is purchasable
|
|
22884
|
+
*/
|
|
22885
|
+
var RewardTileStatus = function () {
|
|
22886
|
+
var styles = useRewardTileStyles();
|
|
22887
|
+
var tileContext = useTileContext();
|
|
22888
|
+
if (!isContextValid(tileContext)) return null;
|
|
22889
|
+
var _a = tileContext.configuration,
|
|
22890
|
+
stockCapacity = _a.stockCapacity,
|
|
22891
|
+
stockConsumed = _a.stockConsumed,
|
|
22892
|
+
outOfStockMessage = _a.outOfStockMessage,
|
|
22893
|
+
stockRemainingMessage = _a.stockRemainingMessage;
|
|
22894
|
+
var isOutOfStock = stockCapacity !== undefined && stockConsumed !== undefined && stockCapacity <= stockConsumed;
|
|
22895
|
+
var label = isOutOfStock ? outOfStockMessage : stockRemainingMessage;
|
|
22896
|
+
if (!label) return null;
|
|
22897
|
+
return /*#__PURE__*/React.createElement(Chip, {
|
|
22898
|
+
label: label,
|
|
22899
|
+
role: "status",
|
|
22900
|
+
ariaLive: "off",
|
|
22901
|
+
accessibilityLabel: label,
|
|
22902
|
+
testID: "reward-tile-status",
|
|
22903
|
+
variant: exports.StatusVariant.GREY,
|
|
22904
|
+
style: styles.statusChip
|
|
22905
|
+
});
|
|
22906
|
+
};
|
|
22907
|
+
|
|
22878
22908
|
/**
|
|
22879
22909
|
* Renders the summary of a Reward Tile.
|
|
22880
22910
|
*
|
|
@@ -22951,6 +22981,10 @@ var RewardTileRoot = function (_a) {
|
|
|
22951
22981
|
if (!tile || tile.tileHeight !== exports.TileHeight.Full || !tile.active || !tile.configuration) return null;
|
|
22952
22982
|
var configuration = tile.configuration;
|
|
22953
22983
|
var artworkOnly = isArtworkOnly(configuration);
|
|
22984
|
+
var hasPoints = configuration.showPrice !== false && configuration.price !== undefined && configuration.price !== 0;
|
|
22985
|
+
var isOutOfStock = configuration.stockCapacity !== undefined && configuration.stockConsumed !== undefined && configuration.stockCapacity <= configuration.stockConsumed;
|
|
22986
|
+
var hasStatus = isOutOfStock ? !!configuration.outOfStockMessage : !!configuration.stockRemainingMessage;
|
|
22987
|
+
var hasFooter = hasPoints || hasStatus;
|
|
22954
22988
|
return /*#__PURE__*/React.createElement(BaseTile, {
|
|
22955
22989
|
tile: tile
|
|
22956
22990
|
}, /*#__PURE__*/React.createElement(RewardTile.Media, {
|
|
@@ -22965,7 +22999,11 @@ var RewardTileRoot = function (_a) {
|
|
|
22965
22999
|
maxWidth: '100%',
|
|
22966
23000
|
minWidth: 0
|
|
22967
23001
|
}
|
|
22968
|
-
}, /*#__PURE__*/React.createElement(RewardTile.Summary, null)), /*#__PURE__*/React.createElement(
|
|
23002
|
+
}, /*#__PURE__*/React.createElement(RewardTile.Summary, null)), hasFooter && (/*#__PURE__*/React.createElement(Row, {
|
|
23003
|
+
justify: "between",
|
|
23004
|
+
align: "center",
|
|
23005
|
+
style: styles.footer
|
|
23006
|
+
}, /*#__PURE__*/React.createElement(RewardTile.Points, null), /*#__PURE__*/React.createElement(RewardTile.Status, null))))));
|
|
22969
23007
|
};
|
|
22970
23008
|
/**
|
|
22971
23009
|
* The RewardTile component with subcomponents attached.
|
|
@@ -22975,7 +23013,8 @@ var RewardTile = Object.assign(RewardTileRoot, {
|
|
|
22975
23013
|
Title: RewardTileTitle,
|
|
22976
23014
|
Summary: RewardTileSummary,
|
|
22977
23015
|
Points: RewardTilePoints,
|
|
22978
|
-
Chevron: RewardTileChevron
|
|
23016
|
+
Chevron: RewardTileChevron,
|
|
23017
|
+
Status: RewardTileStatus
|
|
22979
23018
|
});
|
|
22980
23019
|
var RewardTile$1 = withTileFetching(RewardTile);
|
|
22981
23020
|
|