@wlloyalty/wll-react-sdk 1.2.1 → 1.3.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.
package/dist/native.js CHANGED
@@ -1917,8 +1917,8 @@ var DIMENSION_MODES = {
1917
1917
  TABLET: 'tablet',
1918
1918
  MOBILE: 'mobile',
1919
1919
  };
1920
- var TABLET_SCREEN_WIDTH = 728;
1921
- var SMALL_SCREEN_WIDTH = 530;
1920
+ var TABLET_SCREEN_WIDTH = 768;
1921
+ var SMALL_SCREEN_WIDTH = 480;
1922
1922
 
1923
1923
  var isWeb = reactNative.Platform.OS === 'web';
1924
1924
  function getDimensionMode(window) {
@@ -2387,7 +2387,7 @@ var Text = function (_a) {
2387
2387
  case 'eyebrow':
2388
2388
  return __assign(__assign({}, baseStyle), { fontSize: useResponsiveValue(theme.sizes.md, theme.sizes.sm, isDesktop, isTablet), marginBottom: useResponsiveValue(theme.sizes.xxs, theme.sizes.xxxs, isDesktop, isTablet) });
2389
2389
  case 'title':
2390
- return __assign(__assign({}, baseStyle), { fontSize: useResponsiveValue(theme.sizes.xxl, theme.sizes.md, isDesktop, isTablet), fontWeight: 'bold' });
2390
+ return __assign(__assign({}, baseStyle), { fontSize: useResponsiveValue(theme.sizes.xl, theme.sizes.md, isDesktop, isTablet), fontWeight: 'bold' });
2391
2391
  case 'body':
2392
2392
  return {
2393
2393
  color: theme.derivedSurfaceText[20],
@@ -2398,7 +2398,7 @@ var Text = function (_a) {
2398
2398
  case 'description':
2399
2399
  case 'label':
2400
2400
  default:
2401
- return __assign(__assign({}, baseStyle), { fontSize: useResponsiveValue(theme.sizes.sm, theme.sizes.xs, isDesktop, isTablet) });
2401
+ return __assign(__assign({}, baseStyle), { fontSize: useResponsiveValue(theme.sizes.sm, theme.sizes.xxs, isDesktop, isTablet) });
2402
2402
  }
2403
2403
  };
2404
2404
  var variantStyle = getVariantStyle(variant);
@@ -3323,6 +3323,7 @@ var BadgeTileDateEarned = function () {
3323
3323
  */
3324
3324
  var BadgeTileDescription = function () {
3325
3325
  var tileContext = useTileContext();
3326
+ var width = reactNative.useWindowDimensions().width;
3326
3327
  if (!isContextValid(tileContext))
3327
3328
  return null;
3328
3329
  var _a = tileContext.configuration, count = _a.count, description = _a.description, type = _a.type;
@@ -3332,7 +3333,19 @@ var BadgeTileDescription = function () {
3332
3333
  // For Specific type, always show description
3333
3334
  if (count === 0 && type === exports.BadgeTileType.Latest)
3334
3335
  return null;
3335
- return (jsxRuntimeExports.jsx(reactNative.View, { accessible: true, accessibilityLabel: "Badge description: ".concat(description), testID: "badge-tile-description", children: jsxRuntimeExports.jsx(Text, { variant: "body", numberOfLines: 2, ellipsizeMode: "tail", accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", children: description }) }));
3336
+ var numberOfLines = React.useMemo(function () {
3337
+ if (width <= 480)
3338
+ return 2;
3339
+ if (width <= 768)
3340
+ return 3;
3341
+ if (width <= 1024)
3342
+ return 1;
3343
+ return 2;
3344
+ }, [width]);
3345
+ return (jsxRuntimeExports.jsx(reactNative.View, { accessible: true, accessibilityLabel: "Badge description: ".concat(description), testID: "badge-tile-description", style: {
3346
+ width: '100%',
3347
+ overflow: 'hidden',
3348
+ }, children: jsxRuntimeExports.jsx(Text, { variant: "body", numberOfLines: numberOfLines, ellipsizeMode: "tail", accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", children: description }) }));
3336
3349
  };
3337
3350
 
3338
3351
  /**
@@ -3394,7 +3407,7 @@ var BadgeTileTitle = function () {
3394
3407
  : name;
3395
3408
  if (!displayText)
3396
3409
  return null;
3397
- return (jsxRuntimeExports.jsx(reactNative.View, { accessible: true, accessibilityLabel: "Badge title: ".concat(displayText), testID: "badge-tile-title", children: jsxRuntimeExports.jsx(Text, { variant: "title", style: styles.titleText, numberOfLines: count === 0 ? 2 : 1, ellipsizeMode: "tail", accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", children: displayText }) }));
3410
+ return (jsxRuntimeExports.jsx(reactNative.View, { accessible: true, accessibilityLabel: "Badge title: ".concat(displayText), testID: "badge-tile-title", children: jsxRuntimeExports.jsx(Text, { variant: "title", style: styles.titleText, numberOfLines: 1, ellipsizeMode: "tail", accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", children: displayText }) }));
3398
3411
  };
3399
3412
 
3400
3413
  /**
@@ -3631,27 +3644,58 @@ var ContentTileMedia = function (_a) {
3631
3644
 
3632
3645
  var ContentTileSummary = function () {
3633
3646
  var tileContext = useTileContext();
3647
+ var sizeInfo = useTileSize(tileContext);
3634
3648
  if (!isContextValid(tileContext))
3635
3649
  return null;
3636
- var body = tileContext.configuration.body;
3650
+ var _a = tileContext.configuration, body = _a.body, title = _a.title, artworkUrl = _a.artworkUrl;
3637
3651
  if (!body)
3638
3652
  return null;
3639
- var sizeInfo = useTileSize(tileContext);
3640
3653
  if (!sizeInfo)
3641
3654
  return null;
3642
- var isFullSize = sizeInfo.isFullSize, isHalfSize = sizeInfo.isHalfSize;
3643
- var getNumberOfLines = function () {
3644
- return isFullSize ? 3 : isHalfSize ? 4 : 3;
3645
- };
3646
- return (jsxRuntimeExports.jsx(Text, { variant: "body", role: "article", accessibilityLabel: body, numberOfLines: getNumberOfLines(), testID: "content-tile-summary", children: body }));
3655
+ var isHalfSize = sizeInfo.isHalfSize;
3656
+ var numberOfLines = React.useMemo(function () {
3657
+ if (!body)
3658
+ return undefined;
3659
+ if (isHalfSize) {
3660
+ if (!title && body)
3661
+ return 4;
3662
+ if (title && body)
3663
+ return 2;
3664
+ }
3665
+ if (artworkUrl)
3666
+ return 3;
3667
+ if (!title)
3668
+ return 8;
3669
+ return 6;
3670
+ }, [title, body, artworkUrl, isHalfSize]);
3671
+ return (jsxRuntimeExports.jsx(Text, { variant: "body", role: "article", accessibilityLabel: body, numberOfLines: numberOfLines, testID: "content-tile-summary", children: body }));
3647
3672
  };
3648
3673
 
3649
3674
  var ContentTileTitle = function () {
3650
3675
  var tileContext = useTileContext();
3651
3676
  var styles = useContentTileStyles();
3677
+ var sizeInfo = useTileSize(tileContext);
3652
3678
  if (!isContextValid(tileContext))
3653
3679
  return null;
3654
- var _a = tileContext.configuration, title = _a.title, ctaLink = _a.ctaLink;
3680
+ var _a = tileContext.configuration, title = _a.title, ctaLink = _a.ctaLink, body = _a.body, artworkUrl = _a.artworkUrl;
3681
+ if (!sizeInfo)
3682
+ return null;
3683
+ var isHalfSize = sizeInfo.isHalfSize;
3684
+ var numberOfLines = React.useMemo(function () {
3685
+ if (!title)
3686
+ return undefined;
3687
+ if (isHalfSize) {
3688
+ if (title && !body)
3689
+ return 3;
3690
+ if (title && body)
3691
+ return 1;
3692
+ }
3693
+ if (artworkUrl)
3694
+ return 1;
3695
+ if (!body)
3696
+ return 7;
3697
+ return 2;
3698
+ }, [title, body, artworkUrl, isHalfSize]);
3655
3699
  if (!title)
3656
3700
  return null;
3657
3701
  var handleTitleWidth = function () {
@@ -3659,7 +3703,7 @@ var ContentTileTitle = function () {
3659
3703
  return styles.titleWithLink;
3660
3704
  }
3661
3705
  };
3662
- return (jsxRuntimeExports.jsx(Text, { variant: "title", role: "heading", accessibilityLabel: title, numberOfLines: 1, style: handleTitleWidth(), testID: "content-tile-title", children: title }));
3706
+ return (jsxRuntimeExports.jsx(Text, { variant: "title", role: "heading", accessibilityLabel: title, numberOfLines: numberOfLines, style: handleTitleWidth(), testID: "content-tile-title", children: title }));
3663
3707
  };
3664
3708
 
3665
3709
  /**
@@ -3821,14 +3865,14 @@ var useSectionHeaderStyles = function () {
3821
3865
  marginBottom: useResponsiveValue(theme.sizes.lg, theme.sizes.xxs, isDesktop, isTablet),
3822
3866
  },
3823
3867
  sectionTitle: {
3824
- fontSize: useResponsiveValue(theme.sizes.xxxl, theme.sizes.xl, isDesktop, isTablet),
3868
+ fontSize: useResponsiveValue(theme.sizes.xxl, theme.sizes.xl, isDesktop, isTablet),
3825
3869
  marginBottom: useResponsiveValue(theme.sizes.xxs, theme.sizes.xxxs, isDesktop, isTablet),
3826
3870
  fontWeight: '700',
3827
3871
  color: theme.text,
3828
3872
  fontFamily: theme.fontFamily,
3829
3873
  },
3830
3874
  sectionDescription: {
3831
- fontSize: useResponsiveValue(theme.sizes.xxl, theme.sizes.md, isDesktop, isTablet),
3875
+ fontSize: useResponsiveValue(theme.sizes.xl, theme.sizes.md, isDesktop, isTablet),
3832
3876
  color: theme.alphaDerivedText[80],
3833
3877
  fontFamily: theme.fontFamily,
3834
3878
  },
@@ -4934,10 +4978,12 @@ var RewardTileSummary = function () {
4934
4978
  var tileContext = useTileContext();
4935
4979
  if (!isContextValid(tileContext))
4936
4980
  return null;
4937
- var summary = tileContext.configuration.summary;
4981
+ var _a = tileContext.configuration, summary = _a.summary, _b = _a.showPrice, showPrice = _b === void 0 ? true : _b, price = _a.price;
4982
+ var shouldShowPrice = showPrice && price !== undefined && price !== null && price !== 0;
4983
+ var numberOfLines = shouldShowPrice ? 1 : 3;
4938
4984
  if (!summary)
4939
4985
  return null;
4940
- return (jsxRuntimeExports.jsx(Text, { variant: "body", role: "article", accessibilityLabel: summary, testID: "reward-tile-summary", children: summary }));
4986
+ return (jsxRuntimeExports.jsx(Text, { variant: "body", role: "article", accessibilityLabel: summary, testID: "reward-tile-summary", numberOfLines: numberOfLines, ellipsizeMode: "tail", children: summary }));
4941
4987
  };
4942
4988
 
4943
4989
  /**