@wlloyalty/wll-react-sdk 1.8.0 → 1.9.0

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.
@@ -6,7 +6,7 @@ export declare const useChipStyles: () => {
6
6
  flexDirection: "row";
7
7
  paddingHorizontal: number;
8
8
  paddingVertical: number;
9
- borderRadius: 9999;
9
+ borderRadius: number;
10
10
  overflow: "hidden";
11
11
  flexShrink: number;
12
12
  };
@@ -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;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ /**
3
+ * Renders availability status for a Reward Tile.
4
+ *
5
+ * @returns React.ReactElement or null if the reward is purchasable
6
+ */
7
+ export declare const RewardTileStatus: () => React.ReactElement | null;
@@ -1,4 +1,3 @@
1
- import { sizes } from '../utils/styling';
2
1
  import { WithChildren } from './helpers';
3
2
  import { BadgeTileType } from './tile';
4
3
  export type PercentageKey = 5 | 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 | 90 | 95;
@@ -6,6 +5,23 @@ export type DerivedColors = {
6
5
  [K in PercentageKey]: string;
7
6
  };
8
7
  export type DesaturationType = BadgeTileType.Specific | BadgeTileType.Latest;
8
+ export type Sizes = {
9
+ borderRadiusSm: number;
10
+ borderRadiusLg: number;
11
+ borderRadiusButton: number;
12
+ borderRadiusRounded: number;
13
+ xxxs: number;
14
+ xxs: number;
15
+ xs: number;
16
+ sm: number;
17
+ md: number;
18
+ lg: number;
19
+ xl: number;
20
+ xxl: number;
21
+ xxxl: number;
22
+ xxxxl: number;
23
+ xxxxxl: number;
24
+ };
9
25
  export type BaseThemeObject = {
10
26
  fontFamily: string;
11
27
  accent: string;
@@ -19,6 +35,7 @@ export type BaseThemeObject = {
19
35
  surface: string;
20
36
  surfaceText: string;
21
37
  text: string;
38
+ sizes?: Partial<Sizes>;
22
39
  };
23
40
  export type DerivedProperties = {
24
41
  accentText: string;
@@ -32,7 +49,7 @@ export type DerivedProperties = {
32
49
  alphaDerivedText: DerivedColors;
33
50
  };
34
51
  export type ThemeObject = BaseThemeObject & DerivedProperties & {
35
- readonly sizes: typeof sizes;
52
+ sizes: Sizes;
36
53
  };
37
54
  export type ThemeContextType = {
38
55
  theme: ThemeObject;
@@ -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[];
@@ -13,6 +13,7 @@ export declare const storyBookThemes: {
13
13
  pageButtonText: string;
14
14
  positive: string;
15
15
  text: string;
16
+ sizes?: Partial<import("../types/theme").Sizes>;
16
17
  };
17
18
  warm: {
18
19
  primary: string;
@@ -27,6 +28,7 @@ export declare const storyBookThemes: {
27
28
  pageButtonText: string;
28
29
  positive: string;
29
30
  text: string;
31
+ sizes?: Partial<import("../types/theme").Sizes>;
30
32
  };
31
33
  dark: {
32
34
  background: string;
@@ -41,6 +43,7 @@ export declare const storyBookThemes: {
41
43
  pageButtonBackground: string;
42
44
  pageButtonText: string;
43
45
  positive: string;
46
+ sizes?: Partial<import("../types/theme").Sizes>;
44
47
  };
45
48
  forest: {
46
49
  primary: string;
@@ -55,6 +58,7 @@ export declare const storyBookThemes: {
55
58
  pageButtonText: string;
56
59
  positive: string;
57
60
  text: string;
61
+ sizes?: Partial<import("../types/theme").Sizes>;
58
62
  };
59
63
  sunset: {
60
64
  primary: string;
@@ -69,6 +73,7 @@ export declare const storyBookThemes: {
69
73
  pageButtonText: string;
70
74
  positive: string;
71
75
  text: string;
76
+ sizes?: Partial<import("../types/theme").Sizes>;
72
77
  };
73
78
  };
74
79
  export type ThemeName = 'default' | 'dark' | 'modern' | 'warm' | 'forest' | 'sunset';
package/dist/web.js CHANGED
@@ -8914,9 +8914,11 @@ var createTheme = function (baseTheme) {
8914
8914
  if (baseTheme === void 0) {
8915
8915
  baseTheme = {};
8916
8916
  }
8917
- var mergedTheme = __assign(__assign({}, defaultTheme), baseTheme);
8917
+ var userSizes = baseTheme.sizes,
8918
+ restBaseTheme = __rest(baseTheme, ["sizes"]);
8919
+ var mergedTheme = __assign(__assign({}, defaultTheme), restBaseTheme);
8918
8920
  return __assign(__assign({}, mergedTheme), {
8919
- sizes: sizes,
8921
+ sizes: __assign(__assign({}, sizes), userSizes),
8920
8922
  derivedBackground: getDerivedColor(mergedTheme.background),
8921
8923
  primaryText: getReadableTextColor(mergedTheme.primary),
8922
8924
  accentText: getReadableTextColor(mergedTheme.accent),
@@ -22740,7 +22742,8 @@ var useRewardTileStyles = function () {
22740
22742
  paddingHorizontal: useResponsiveValue(theme.sizes.sm, theme.sizes.xxs, isDesktop, isTablet)
22741
22743
  },
22742
22744
  footer: {
22743
- marginTop: 8
22745
+ width: '100%',
22746
+ marginTop: useResponsiveValue(theme.sizes.xxs, theme.sizes.xxxs, isDesktop, isTablet)
22744
22747
  },
22745
22748
  pointsContainer: {
22746
22749
  flexDirection: 'row',
@@ -22769,6 +22772,10 @@ var useRewardTileStyles = function () {
22769
22772
  justifyContent: 'center',
22770
22773
  alignItems: 'center',
22771
22774
  zIndex: 10
22775
+ },
22776
+ statusChip: {
22777
+ flexShrink: 1,
22778
+ marginLeft: 'auto'
22772
22779
  }
22773
22780
  });
22774
22781
  };
@@ -22855,9 +22862,6 @@ var RewardTilePoints = function () {
22855
22862
  var calculatedPoints = applyMultiplier(price, pointsMultiplier);
22856
22863
  var accessibilityLabel = getPointsLabel('Reward points:', calculatedPoints, pointsPrefix, pointsSuffix);
22857
22864
  return /*#__PURE__*/React.createElement(View$2, {
22858
- style: {
22859
- marginTop: 'auto'
22860
- },
22861
22865
  testID: "reward-tile-points",
22862
22866
  role: "article",
22863
22867
  accessibilityLabel: accessibilityLabel
@@ -22875,6 +22879,34 @@ var RewardTilePoints = function () {
22875
22879
  }, pointsSuffix)) : null));
22876
22880
  };
22877
22881
 
22882
+ /**
22883
+ * Renders availability status for a Reward Tile.
22884
+ *
22885
+ * @returns React.ReactElement or null if the reward is purchasable
22886
+ */
22887
+ var RewardTileStatus = function () {
22888
+ var styles = useRewardTileStyles();
22889
+ var tileContext = useTileContext();
22890
+ if (!isContextValid(tileContext)) return null;
22891
+ var _a = tileContext.configuration,
22892
+ stockCapacity = _a.stockCapacity,
22893
+ stockConsumed = _a.stockConsumed,
22894
+ outOfStockMessage = _a.outOfStockMessage,
22895
+ stockRemainingMessage = _a.stockRemainingMessage;
22896
+ var isOutOfStock = stockCapacity !== undefined && stockConsumed !== undefined && stockCapacity <= stockConsumed;
22897
+ var label = isOutOfStock ? outOfStockMessage : stockRemainingMessage;
22898
+ if (!label) return null;
22899
+ return /*#__PURE__*/React.createElement(Chip, {
22900
+ label: label,
22901
+ role: "status",
22902
+ ariaLive: "off",
22903
+ accessibilityLabel: label,
22904
+ testID: "reward-tile-status",
22905
+ variant: exports.StatusVariant.GREY,
22906
+ style: styles.statusChip
22907
+ });
22908
+ };
22909
+
22878
22910
  /**
22879
22911
  * Renders the summary of a Reward Tile.
22880
22912
  *
@@ -22951,6 +22983,10 @@ var RewardTileRoot = function (_a) {
22951
22983
  if (!tile || tile.tileHeight !== exports.TileHeight.Full || !tile.active || !tile.configuration) return null;
22952
22984
  var configuration = tile.configuration;
22953
22985
  var artworkOnly = isArtworkOnly(configuration);
22986
+ var hasPoints = configuration.showPrice !== false && configuration.price !== undefined && configuration.price !== 0;
22987
+ var isOutOfStock = configuration.stockCapacity !== undefined && configuration.stockConsumed !== undefined && configuration.stockCapacity <= configuration.stockConsumed;
22988
+ var hasStatus = isOutOfStock ? !!configuration.outOfStockMessage : !!configuration.stockRemainingMessage;
22989
+ var hasFooter = hasPoints || hasStatus;
22954
22990
  return /*#__PURE__*/React.createElement(BaseTile, {
22955
22991
  tile: tile
22956
22992
  }, /*#__PURE__*/React.createElement(RewardTile.Media, {
@@ -22965,7 +23001,11 @@ var RewardTileRoot = function (_a) {
22965
23001
  maxWidth: '100%',
22966
23002
  minWidth: 0
22967
23003
  }
22968
- }, /*#__PURE__*/React.createElement(RewardTile.Summary, null)), /*#__PURE__*/React.createElement(RewardTile.Points, null))));
23004
+ }, /*#__PURE__*/React.createElement(RewardTile.Summary, null)), hasFooter && (/*#__PURE__*/React.createElement(Row, {
23005
+ justify: "between",
23006
+ align: "center",
23007
+ style: styles.footer
23008
+ }, /*#__PURE__*/React.createElement(RewardTile.Points, null), /*#__PURE__*/React.createElement(RewardTile.Status, null))))));
22969
23009
  };
22970
23010
  /**
22971
23011
  * The RewardTile component with subcomponents attached.
@@ -22975,7 +23015,8 @@ var RewardTile = Object.assign(RewardTileRoot, {
22975
23015
  Title: RewardTileTitle,
22976
23016
  Summary: RewardTileSummary,
22977
23017
  Points: RewardTilePoints,
22978
- Chevron: RewardTileChevron
23018
+ Chevron: RewardTileChevron,
23019
+ Status: RewardTileStatus
22979
23020
  });
22980
23021
  var RewardTile$1 = withTileFetching(RewardTile);
22981
23022