@wlloyalty/wll-react-sdk 1.6.0 → 1.6.9

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.
@@ -3,6 +3,7 @@ export declare const baseStyles: {
3
3
  position: "relative";
4
4
  };
5
5
  container: {
6
+ flex: number;
6
7
  width: "100%";
7
8
  height: "100%";
8
9
  overflow: "hidden";
@@ -24,6 +25,7 @@ export declare const baseStyles: {
24
25
  */
25
26
  export declare const useBaseTileStyles: () => {
26
27
  container: {
28
+ flex: number;
27
29
  width: "100%";
28
30
  height: "100%";
29
31
  overflow: "hidden";
@@ -56,13 +58,23 @@ export declare const useBaseTileStyles: () => {
56
58
  };
57
59
  } | {
58
60
  container: {
59
- backgroundColor: string;
60
- aspectRatio: number;
61
61
  borderRadius: number;
62
62
  justifyContent: "center";
63
63
  alignItems: "center";
64
+ height: undefined;
65
+ backgroundColor: string;
66
+ flex: number;
64
67
  width: "100%";
68
+ overflow: "hidden";
69
+ position: "relative";
70
+ } | {
71
+ borderRadius: number;
72
+ justifyContent: "center";
73
+ alignItems: "center";
65
74
  height: "100%";
75
+ backgroundColor: string;
76
+ flex: number;
77
+ width: "100%";
66
78
  overflow: "hidden";
67
79
  position: "relative";
68
80
  };
@@ -6,7 +6,7 @@ type ContentTileProps = {
6
6
  /**
7
7
  * The ContentTile component with subcomponents attached.
8
8
  */
9
- export declare const ContentTile: (({ tile }: ContentTileProps) => React.ReactElement | null) & {
9
+ export declare const ContentTile: (({ tile, }: ContentTileProps) => React.ReactElement | null) & {
10
10
  Media: ({ isArtworkOnly, }: {
11
11
  isArtworkOnly: boolean;
12
12
  }) => React.ReactElement | null;
@@ -16,3 +16,6 @@ export declare const Locked: import("@storybook/csf").AnnotatedStoryFn<import("@
16
16
  export declare const ArtworkOnlyLocked: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, Omit<{
17
17
  tile: import("../../..").Tile;
18
18
  }, "tile"> & import("../../hoc/withTileFetching").WithTileFetchingProps>;
19
+ export declare const TwoPerRow: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, Omit<{
20
+ tile: import("../../..").Tile;
21
+ }, "tile"> & import("../../hoc/withTileFetching").WithTileFetchingProps>;
@@ -6,7 +6,7 @@ type RewardTileProps = {
6
6
  /**
7
7
  * The RewardTile component with subcomponents attached.
8
8
  */
9
- export declare const RewardTile: (({ tile }: RewardTileProps) => React.ReactElement | null) & {
9
+ export declare const RewardTile: (({ tile, }: RewardTileProps) => React.ReactElement | null) & {
10
10
  Media: ({ isArtworkOnly, }: {
11
11
  isArtworkOnly: boolean;
12
12
  }) => React.ReactElement | null;
@@ -1,6 +1,5 @@
1
1
  export declare const useTierTileStyles: () => {
2
2
  header: {
3
- flexBasis: "50%";
4
3
  width: "100%";
5
4
  overflow: "hidden";
6
5
  marginBottom: number;
@@ -1,5 +1,7 @@
1
1
  import * as React from 'react';
2
- export declare const TileWrapper: ({ isHalfTile, children, }: {
2
+ import { ViewStyle } from 'react-native';
3
+ export declare const TileWrapper: ({ isHalfTile, containerStyle, children, }: {
3
4
  isHalfTile?: boolean;
5
+ containerStyle?: ViewStyle;
4
6
  children: React.ReactNode;
5
7
  }) => React.ReactElement;
package/dist/web.js CHANGED
@@ -19007,7 +19007,8 @@ var styles$7 = StyleSheet$1.create({
19007
19007
  alignItems: 'center',
19008
19008
  justifyContent: 'center',
19009
19009
  width: '100%',
19010
- height: '100%'
19010
+ height: '100%',
19011
+ minHeight: 130
19011
19012
  }
19012
19013
  });
19013
19014
 
@@ -19039,7 +19040,7 @@ var Text = function (_a) {
19039
19040
  case 'body':
19040
19041
  return {
19041
19042
  color: theme.derivedSurfaceText[20],
19042
- fontSize: useResponsiveValue(theme.sizes.md, theme.sizes.xs, isDesktop, isTablet)
19043
+ fontSize: useResponsiveValue(theme.sizes.md, theme.sizes.sm, isDesktop, isTablet)
19043
19044
  };
19044
19045
  case 'caption':
19045
19046
  return __assign(__assign({}, baseStyle), {
@@ -19425,6 +19426,7 @@ var baseStyles = StyleSheet$1.create({
19425
19426
  position: 'relative'
19426
19427
  },
19427
19428
  container: {
19429
+ flex: 1,
19428
19430
  width: '100%',
19429
19431
  height: '100%',
19430
19432
  overflow: 'hidden',
@@ -19481,10 +19483,20 @@ var useBaseTileStyles = function () {
19481
19483
  artworkUrl = _b.artworkUrl,
19482
19484
  title = _b.title,
19483
19485
  body = _b.body;
19486
+ // Access showDetails safely only for Reward tiles to avoid type errors on ContentTileConfig
19487
+ var rewardShowDetails = tileContext.type === 'REWARD' ? tileContext.configuration.showDetails : undefined;
19488
+ // In Reward tiles that show details (title, summary, points), the content height
19489
+ // can exceed a square aspect ratio. To prevent clipping (e.g., points cut off in
19490
+ // TwoPerRow), allow the container to naturally size and do not enforce aspectRatio.
19491
+ var isRewardWithDetails = tileContext.type === 'REWARD' && rewardShowDetails !== false;
19484
19492
  return StyleSheet$1.create({
19485
- container: __assign(__assign({}, baseStyles.container), {
19486
- backgroundColor: theme.surface,
19487
- aspectRatio: isHalfSize ? 2 : 1,
19493
+ container: __assign(__assign(__assign(__assign({}, baseStyles.container), {
19494
+ backgroundColor: theme.surface
19495
+ }), isRewardWithDetails ? {
19496
+ height: undefined
19497
+ } : {
19498
+ height: '100%'
19499
+ }), {
19488
19500
  borderRadius: useResponsiveValue(theme.sizes.borderRadiusLg, theme.sizes.borderRadiusSm, isDesktop, isTablet),
19489
19501
  justifyContent: 'center',
19490
19502
  alignItems: 'center'
@@ -19856,7 +19868,6 @@ var SkeletonTile = function (_a) {
19856
19868
  };
19857
19869
  var styles$4 = StyleSheet$1.create({
19858
19870
  container: {
19859
- aspectRatio: 1,
19860
19871
  overflow: 'hidden'
19861
19872
  }
19862
19873
  });
@@ -19932,10 +19943,6 @@ var styles$3 = StyleSheet$1.create({
19932
19943
  },
19933
19944
  skeleton: {
19934
19945
  overflow: 'hidden'
19935
- },
19936
- square: {
19937
- width: 1000 / 4,
19938
- aspectRatio: 1
19939
19946
  }
19940
19947
  });
19941
19948
 
@@ -20075,7 +20082,9 @@ var handleLastEarnedDate = function (date, userLocale) {
20075
20082
  */
20076
20083
  var BadgeTileDateEarned = function () {
20077
20084
  var tileContext = useTileContext();
20078
- if (!isContextValid(tileContext)) return null;
20085
+ if (!isContextValid(tileContext)) {
20086
+ return null;
20087
+ }
20079
20088
  var _a = tileContext.configuration,
20080
20089
  count = _a.count,
20081
20090
  awardedDatePrefix = _a.awardedDatePrefix,
@@ -20174,7 +20183,6 @@ var useBadgeTileStyles = function () {
20174
20183
  fontWeight: 'bold'
20175
20184
  },
20176
20185
  header: {
20177
- flexBasis: '50%',
20178
20186
  alignItems: 'center',
20179
20187
  justifyContent: 'center',
20180
20188
  position: 'relative',
@@ -20238,7 +20246,9 @@ var BadgeTileMedia = function (_a) {
20238
20246
  var BadgeTileStatus = function () {
20239
20247
  var styles = useBadgeTileStyles();
20240
20248
  var tileContext = useTileContext();
20241
- if (!isContextValid(tileContext)) return null;
20249
+ if (!isContextValid(tileContext)) {
20250
+ return null;
20251
+ }
20242
20252
  var _a = tileContext.configuration,
20243
20253
  count = _a.count,
20244
20254
  type = _a.type;
@@ -20543,13 +20553,6 @@ var useContentTileStyles = function (hasArtwork) {
20543
20553
  overflow: 'hidden'
20544
20554
  },
20545
20555
  image: {
20546
- position: 'absolute',
20547
- top: -1,
20548
- left: -1,
20549
- bottom: -1,
20550
- right: -1,
20551
- width: '102%',
20552
- height: '102%',
20553
20556
  resizeMode: 'cover'
20554
20557
  },
20555
20558
  content: {
@@ -20686,7 +20689,7 @@ var ContentTileRoot = function (_a) {
20686
20689
  tile: tile
20687
20690
  }, /*#__PURE__*/React.createElement(ContentTile.Media, {
20688
20691
  isArtworkOnly: isArtworkOnly$1(configuration)
20689
- }), /*#__PURE__*/React.createElement(Layout, {
20692
+ }), !isArtworkOnly$1(configuration) && (/*#__PURE__*/React.createElement(Layout, {
20690
20693
  justify: hasArtwork ? 'start' : 'center',
20691
20694
  style: {
20692
20695
  paddingBottom: 0,
@@ -20696,7 +20699,7 @@ var ContentTileRoot = function (_a) {
20696
20699
  justify: "between",
20697
20700
  align: "center",
20698
20701
  style: styles.header
20699
- }, /*#__PURE__*/React.createElement(ContentTile.Title, null), /*#__PURE__*/React.createElement(ContentTile.Chevron, null)), /*#__PURE__*/React.createElement(ContentTile.Summary, null)));
20702
+ }, /*#__PURE__*/React.createElement(ContentTile.Title, null), /*#__PURE__*/React.createElement(ContentTile.Chevron, null)), /*#__PURE__*/React.createElement(ContentTile.Summary, null))));
20700
20703
  };
20701
20704
  /**
20702
20705
  * The ContentTile component with subcomponents attached.
@@ -21300,9 +21303,7 @@ var Grid = function (_a) {
21300
21303
  if (IS_WEB) {
21301
21304
  return {
21302
21305
  width: "calc(".concat(100 / columns, "% - ").concat((columns - 1) * GRID_GAP / columns, "px)"),
21303
- marginBottom: GRID_GAP,
21304
- height: 'auto',
21305
- aspectRatio: 1
21306
+ marginBottom: GRID_GAP
21306
21307
  };
21307
21308
  } else {
21308
21309
  var availableWidth = SCREEN_WIDTH - GRID_GAP * 2;
@@ -21310,8 +21311,7 @@ var Grid = function (_a) {
21310
21311
  var tileWidth = Math.floor((availableWidth - gapSpace) / columns);
21311
21312
  return {
21312
21313
  width: tileWidth,
21313
- marginBottom: GRID_GAP,
21314
- aspectRatio: 1
21314
+ marginBottom: GRID_GAP
21315
21315
  };
21316
21316
  }
21317
21317
  }, []);
@@ -21886,7 +21886,8 @@ var FullFlex = function (_a) {
21886
21886
  rest = __rest(_a, ["children", "style"]);
21887
21887
  return /*#__PURE__*/React.createElement(View$2, __assign({
21888
21888
  style: [{
21889
- flex: 1
21889
+ flex: 1,
21890
+ direction: 'inherit'
21890
21891
  }, style]
21891
21892
  }, rest), children);
21892
21893
  };
@@ -21917,7 +21918,7 @@ var Layout = function (_a) {
21917
21918
  isTablet = _f.isTablet;
21918
21919
  var dynamicStyles = StyleSheet$1.create({
21919
21920
  container: {
21920
- flex: 1,
21921
+ flexGrow: 1,
21921
21922
  paddingHorizontal: useResponsiveValue(theme.sizes.sm, theme.sizes.xxs, isDesktop, isTablet),
21922
21923
  paddingBottom: useResponsiveValue(theme.sizes.sm, theme.sizes.xxs, isDesktop, isTablet),
21923
21924
  justifyContent: justifyMap[justify],
@@ -22297,7 +22298,11 @@ var RewardCategoryTileRoot = function (_a) {
22297
22298
  if (!tile || !tile.active || !tile.configuration) return null;
22298
22299
  return /*#__PURE__*/React.createElement(BaseTile, {
22299
22300
  tile: tile
22300
- }, /*#__PURE__*/React.createElement(RewardCategoryTile.Header, null), /*#__PURE__*/React.createElement(RewardCategoryTile.Media, null));
22301
+ }, /*#__PURE__*/React.createElement(View$2, {
22302
+ style: {
22303
+ aspectRatio: 1
22304
+ }
22305
+ }, /*#__PURE__*/React.createElement(RewardCategoryTile.Header, null), /*#__PURE__*/React.createElement(RewardCategoryTile.Media, null)));
22301
22306
  };
22302
22307
  /**
22303
22308
  * The RewardCategoryTile component with subcomponents attached.
@@ -22339,17 +22344,13 @@ var useRewardTileStyles = function () {
22339
22344
  return StyleSheet$1.create({
22340
22345
  imageContainer: {
22341
22346
  width: '100%',
22347
+ minHeight: 130,
22342
22348
  marginBottom: useResponsiveValue(theme.sizes.sm, theme.sizes.xxs, isDesktop, isTablet)
22343
22349
  },
22344
22350
  image: {
22345
- position: 'absolute',
22346
- top: 0,
22347
- left: 0,
22348
- bottom: 0,
22349
- right: 0,
22350
22351
  width: '100%',
22351
22352
  height: '100%',
22352
- resizeMode: 'cover'
22353
+ objectFit: 'cover'
22353
22354
  },
22354
22355
  lockIcon: {
22355
22356
  position: 'absolute',
@@ -22361,8 +22362,7 @@ var useRewardTileStyles = function () {
22361
22362
  height: '100%'
22362
22363
  },
22363
22364
  content: {
22364
- paddingHorizontal: useResponsiveValue(theme.sizes.sm, theme.sizes.xxs, isDesktop, isTablet),
22365
- flex: 1
22365
+ paddingHorizontal: useResponsiveValue(theme.sizes.sm, theme.sizes.xxs, isDesktop, isTablet)
22366
22366
  },
22367
22367
  footer: {
22368
22368
  marginTop: 8
@@ -22419,8 +22419,19 @@ var RewardTileMedia = function (_a) {
22419
22419
  _e = _b.isLocked,
22420
22420
  isLocked = _e === void 0 ? false : _e;
22421
22421
  if (!artworkUrl || !showArtwork) return null;
22422
- var containerStyle = {
22423
- flexBasis: isArtworkOnly ? '100%' : '50%'
22422
+ // When artwork-only, the media should occupy the full tile height and compensate
22423
+ // for any content layout that might be hidden. We therefore force the media
22424
+ // container to flex and take the entire available height, removing default
22425
+ // bottom margins and min-heights coming from styles.
22426
+ var containerStyle = isArtworkOnly ? {
22427
+ flexBasis: '100%',
22428
+ flex: 1,
22429
+ height: '100%',
22430
+ marginBottom: 0,
22431
+ minHeight: 0,
22432
+ aspectRatio: 1
22433
+ } : {
22434
+ flexBasis: '50%'
22424
22435
  };
22425
22436
  return /*#__PURE__*/React.createElement(View$2, {
22426
22437
  style: [styles.imageContainer, containerStyle],
@@ -22467,15 +22478,15 @@ var RewardTilePoints = function () {
22467
22478
  var calculatedPoints = applyMultiplier(price, pointsMultiplier);
22468
22479
  var accessibilityLabel = getPointsLabel('Reward points:', calculatedPoints, pointsPrefix, pointsSuffix);
22469
22480
  return /*#__PURE__*/React.createElement(View$2, {
22481
+ style: {
22482
+ marginTop: 'auto'
22483
+ },
22470
22484
  testID: "reward-tile-points",
22471
22485
  role: "article",
22472
22486
  accessibilityLabel: accessibilityLabel
22473
22487
  }, /*#__PURE__*/React.createElement(Row, {
22474
22488
  align: "center",
22475
- justify: "start",
22476
- style: {
22477
- marginTop: 8
22478
- }
22489
+ justify: "start"
22479
22490
  }, pointsPrefix ? /*#__PURE__*/React.createElement(Text, {
22480
22491
  variant: "caption"
22481
22492
  }, pointsPrefix) : null, /*#__PURE__*/React.createElement(Text, {
@@ -22501,7 +22512,7 @@ var RewardTileSummary = function () {
22501
22512
  showPrice = _b === void 0 ? true : _b,
22502
22513
  price = _a.price;
22503
22514
  var shouldShowPrice = showPrice && price !== undefined && price !== null && price !== 0;
22504
- var numberOfLines = shouldShowPrice ? 1 : 3;
22515
+ var numberOfLines = shouldShowPrice ? 2 : 3;
22505
22516
  if (!summary) return null;
22506
22517
  return /*#__PURE__*/React.createElement(Text, {
22507
22518
  variant: "body",
@@ -22562,15 +22573,22 @@ var RewardTileRoot = function (_a) {
22562
22573
  var styles = useRewardTileStyles();
22563
22574
  if (!tile || tile.tileHeight !== exports.TileHeight.Full || !tile.active || !tile.configuration) return null;
22564
22575
  var configuration = tile.configuration;
22576
+ var artworkOnly = isArtworkOnly(configuration);
22565
22577
  return /*#__PURE__*/React.createElement(BaseTile, {
22566
22578
  tile: tile
22567
22579
  }, /*#__PURE__*/React.createElement(RewardTile.Media, {
22568
- isArtworkOnly: isArtworkOnly(configuration)
22569
- }), /*#__PURE__*/React.createElement(Layout, null, /*#__PURE__*/React.createElement(Row, {
22580
+ isArtworkOnly: artworkOnly
22581
+ }), !artworkOnly && (/*#__PURE__*/React.createElement(Layout, null, /*#__PURE__*/React.createElement(Row, {
22570
22582
  justify: "between",
22571
22583
  align: "center",
22572
22584
  style: styles.header
22573
- }, /*#__PURE__*/React.createElement(RewardTile.Title, null), /*#__PURE__*/React.createElement(RewardTile.Chevron, null)), /*#__PURE__*/React.createElement(RewardTile.Summary, null), /*#__PURE__*/React.createElement(RewardTile.Points, null)));
22585
+ }, /*#__PURE__*/React.createElement(RewardTile.Title, null), /*#__PURE__*/React.createElement(RewardTile.Chevron, null)), /*#__PURE__*/React.createElement(View$2, {
22586
+ style: {
22587
+ width: '100%',
22588
+ maxWidth: '100%',
22589
+ minWidth: 0
22590
+ }
22591
+ }, /*#__PURE__*/React.createElement(RewardTile.Summary, null)), /*#__PURE__*/React.createElement(RewardTile.Points, null))));
22574
22592
  };
22575
22593
  /**
22576
22594
  * The RewardTile component with subcomponents attached.
@@ -22591,7 +22609,6 @@ var useTierTileStyles = function () {
22591
22609
  var theme = useWllSdk().theme;
22592
22610
  return StyleSheet$1.create({
22593
22611
  header: {
22594
- flexBasis: '50%',
22595
22612
  width: '100%',
22596
22613
  overflow: 'hidden',
22597
22614
  marginBottom: useResponsiveValue(theme.sizes.sm, theme.sizes.xxs, isDesktop, isTablet)
@@ -23189,7 +23206,7 @@ var TileContainer = function (_a) {
23189
23206
  });
23190
23207
  var halfHeightGap = allHalfHeight ? GRID_GAP / 2 : GRID_GAP;
23191
23208
  return /*#__PURE__*/React.createElement(View$2, {
23192
- style: [styles.container, allHalfHeight && styles.aspectContainer],
23209
+ style: styles.container,
23193
23210
  testID: "tile-container"
23194
23211
  }, tiles.map(function (tile, index) {
23195
23212
  var TileComponent = TILE_COMPONENTS[tile.type];
@@ -23209,9 +23226,6 @@ var styles = StyleSheet$1.create({
23209
23226
  flex: 1,
23210
23227
  width: '100%'
23211
23228
  },
23212
- aspectContainer: {
23213
- aspectRatio: 1
23214
- },
23215
23229
  tileWrapper: {
23216
23230
  flex: 1,
23217
23231
  width: '100%'
@@ -23280,7 +23294,7 @@ var Chip = function (_a) {
23280
23294
  _b = _a.variant,
23281
23295
  variant = _b === void 0 ? exports.StatusVariant.PRIMARY : _b,
23282
23296
  _c = _a.role,
23283
- role = _c === void 0 ? 'status' : _c,
23297
+ role = _c === void 0 ? 'text' : _c,
23284
23298
  _d = _a.ariaLive,
23285
23299
  ariaLive = _d === void 0 ? 'polite' : _d,
23286
23300
  accessibilityLabel = _a.accessibilityLabel,