@wlloyalty/wll-react-sdk 1.0.88 → 1.0.90

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/index.d.ts CHANGED
@@ -528,6 +528,12 @@ type CarouselProps = {
528
528
  };
529
529
  declare const Carousel: ({ section }: CarouselProps) => JSX.Element | null;
530
530
 
531
+ type CarouselNavButtonProps = {
532
+ direction: 'left' | 'right';
533
+ onPress: () => void;
534
+ };
535
+ declare const CarouselNavButton: ({ direction, onPress, }: CarouselNavButtonProps) => JSX.Element;
536
+
531
537
  type GridProps = {
532
538
  section: TSection;
533
539
  };
@@ -681,4 +687,4 @@ type WllSdkProviderProps = WithChildren & {
681
687
  declare const WllSdkProvider: ({ children, theme: providedTheme, config, navigationConfig, }: WllSdkProviderProps) => JSX.Element;
682
688
  declare const useWllSdk: () => WllSdkContextType;
683
689
 
684
- export { type APIResponse, type Align, type Availability, type Badge, type BadgeDetail, _default$5 as BadgeTile, BadgeTileConfig, BadgeTileType, _default$4 as BannerTile, BannerTileConfig, BaseBanner, type BaseThemeObject, BaseTile, Button, CTALinkTarget, Carousel, Column, _default$3 as ContentTile, ContentTileConfig, type DerivedColors, type DerivedProperties, type DesaturationType, type FlexDirection, FullFlex, Grid, Group, Icon, type ImagePropsNoSource, Indicator, type Justify, Layout, type LayoutProps$1 as LayoutProps, LoadingIndicator, type NavigationConfig, type NavigationType, type PercentageKey, _default$2 as PointsTile, PointsTileConfig, type ProgessType, ProgressBar, ProgressIndicator, ProgressType, ProgressiveImage, Reward, type RewardCategory, _default$1 as RewardCategoryTile, RewardCategoryTileConfig, _default as RewardTile, RewardTileConfig, Row, type SDKConfig, Section, SectionHeader, SectionType, type Size, Skeleton, Spacer, type TGroup, type TSection, Text, type ThemeContextType, type ThemeObject, type ThemeProviderProps, TierTileConfig, TierTileType, TierTile as TierTileUpdated, type TierType, type Tile, type TileConfig, TileContainer, TileHeight, type TileSizeInfo, TileType, type Variant, WllSdkProvider, alignMap, justifyMap, useWllSdk };
690
+ export { type APIResponse, type Align, type Availability, type Badge, type BadgeDetail, _default$5 as BadgeTile, BadgeTileConfig, BadgeTileType, _default$4 as BannerTile, BannerTileConfig, BaseBanner, type BaseThemeObject, BaseTile, Button, CTALinkTarget, Carousel, CarouselNavButton, Column, _default$3 as ContentTile, ContentTileConfig, type DerivedColors, type DerivedProperties, type DesaturationType, type FlexDirection, FullFlex, Grid, Group, Icon, type ImagePropsNoSource, Indicator, type Justify, Layout, type LayoutProps$1 as LayoutProps, LoadingIndicator, type NavigationConfig, type NavigationType, type PercentageKey, _default$2 as PointsTile, PointsTileConfig, type ProgessType, ProgressBar, ProgressIndicator, ProgressType, ProgressiveImage, Reward, type RewardCategory, _default$1 as RewardCategoryTile, RewardCategoryTileConfig, _default as RewardTile, RewardTileConfig, Row, type SDKConfig, Section, SectionHeader, SectionType, type Size, Skeleton, Spacer, type TGroup, type TSection, Text, type ThemeContextType, type ThemeObject, type ThemeProviderProps, TierTileConfig, TierTileType, TierTile as TierTileUpdated, type TierType, type Tile, type TileConfig, TileContainer, TileHeight, type TileSizeInfo, TileType, type Variant, WllSdkProvider, alignMap, justifyMap, useWllSdk };
package/dist/native.js CHANGED
@@ -1550,11 +1550,9 @@ var useMakeRequest = function (config) {
1550
1550
  case 2: return [4 /*yield*/, fetch(url, createRequestOptions())];
1551
1551
  case 3:
1552
1552
  response = _a.sent();
1553
- console.log('response', response);
1554
1553
  return [4 /*yield*/, response.json()];
1555
1554
  case 4:
1556
1555
  json = _a.sent();
1557
- console.log('json', json);
1558
1556
  if (json.status === 'fail') {
1559
1557
  return [2 /*return*/, {
1560
1558
  status: 'fail',
@@ -3377,6 +3375,11 @@ var useContentTileStyles = function (hasArtwork) {
3377
3375
  flex: 1,
3378
3376
  },
3379
3377
  header: getHeaderStyle(hasArtwork),
3378
+ tileTitle: {
3379
+ maxWidth: '90%',
3380
+ flex: 1,
3381
+ marginRight: 8,
3382
+ },
3380
3383
  });
3381
3384
  };
3382
3385
 
@@ -3415,12 +3418,18 @@ var ContentTileSummary = function () {
3415
3418
 
3416
3419
  var ContentTileTitle = function () {
3417
3420
  var tileContext = useTileContext();
3421
+ var styles = useContentTileStyles();
3418
3422
  if (!isContextValid(tileContext))
3419
3423
  return null;
3420
- var title = tileContext.configuration.title;
3424
+ var _a = tileContext.configuration, title = _a.title, ctaLink = _a.ctaLink;
3421
3425
  if (!title)
3422
3426
  return null;
3423
- return (jsxRuntimeExports.jsx(Text, { variant: "title", accessibilityRole: "header", accessibilityLabel: title, numberOfLines: 1, testID: "content-tile-title", children: title }));
3427
+ var handleTitleWidth = function () {
3428
+ if (IS_MOBILE && ctaLink) {
3429
+ return styles.titleWithLink;
3430
+ }
3431
+ };
3432
+ return (jsxRuntimeExports.jsx(Text, { variant: "title", accessibilityRole: "header", accessibilityLabel: title, numberOfLines: 1, style: handleTitleWidth(), testID: "content-tile-title", children: title }));
3424
3433
  };
3425
3434
 
3426
3435
  /**
@@ -3669,22 +3678,14 @@ var Carousel = function (_a) {
3669
3678
  return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(SectionHeader, { title: section.title, description: section.description }), jsxRuntimeExports.jsxs(reactNative.View, { ref: containerRef, style: styles.container, onLayout: function (event) {
3670
3679
  var width = event.nativeEvent.layout.width;
3671
3680
  dispatch({ type: 'SET_CONTAINER_WIDTH', payload: width });
3672
- }, children: [jsxRuntimeExports.jsxs(reactNative.View, { style: styles.carouselContainer, children: [showPrevButton && (jsxRuntimeExports.jsx(reactNative.Pressable, { style: [
3673
- styles.navButton,
3674
- styles.navButtonLeft,
3675
- { backgroundColor: theme.background },
3676
- ], onPress: handlePrev, accessibilityLabel: "Previous slide", role: "button", children: jsxRuntimeExports.jsx(Icon, { name: "ArrowLeft", size: 20, color: theme.primary }) })), jsxRuntimeExports.jsx(reactNative.ScrollView, { ref: scrollViewRef, horizontal: true, pagingEnabled: true, showsHorizontalScrollIndicator: false, onScroll: handleScroll, onMomentumScrollEnd: handleScrollEnd, scrollEventThrottle: 16, style: [styles.carouselContent], contentContainerStyle: {
3681
+ }, children: [jsxRuntimeExports.jsxs(reactNative.View, { style: styles.carouselContainer, children: [showPrevButton && (jsxRuntimeExports.jsx(CarouselNavButton, { direction: "left", onPress: handlePrev })), jsxRuntimeExports.jsx(reactNative.ScrollView, { ref: scrollViewRef, horizontal: true, pagingEnabled: true, showsHorizontalScrollIndicator: false, onScroll: handleScroll, onMomentumScrollEnd: handleScrollEnd, scrollEventThrottle: 16, style: styles.carouselContent, contentContainerStyle: {
3677
3682
  width: containerWidth * sortedTiles.length,
3678
3683
  }, decelerationRate: "fast", snapToInterval: containerWidth, snapToAlignment: "start", children: sortedTiles.map(function (tile, index) { return (jsxRuntimeExports.jsx(reactNative.View, { style: [
3679
3684
  styles.slideContainer,
3680
3685
  {
3681
3686
  width: containerWidth,
3682
3687
  },
3683
- ], children: jsxRuntimeExports.jsx(BannerTile$1, { tile: tile }) }, index)); }) }), showNextButton && (jsxRuntimeExports.jsx(reactNative.Pressable, { style: [
3684
- styles.navButton,
3685
- styles.navButtonRight,
3686
- { backgroundColor: theme.background },
3687
- ], onPress: handleNext, accessibilityLabel: "Next slide", role: "button", children: jsxRuntimeExports.jsx(Icon, { name: "ArrowRight", size: 20, color: theme.primary }) }))] }), displayControls && (jsxRuntimeExports.jsx(reactNative.View, { style: dynamicStyles.indicators, children: sortedTiles.map(function (_, index) {
3688
+ ], children: jsxRuntimeExports.jsx(BannerTile$1, { tile: tile }) }, index)); }) }), showNextButton && (jsxRuntimeExports.jsx(CarouselNavButton, { direction: "right", onPress: handleNext }))] }), displayControls && (jsxRuntimeExports.jsx(reactNative.View, { style: dynamicStyles.indicators, children: sortedTiles.map(function (_, index) {
3688
3689
  var width = animatedIndex.interpolate({
3689
3690
  inputRange: [index - 1, index, index + 1],
3690
3691
  outputRange: [8, 30, 8],
@@ -3700,6 +3701,43 @@ var Carousel = function (_a) {
3700
3701
  }) }))] })] }));
3701
3702
  };
3702
3703
 
3704
+ var useNavButtonStyles = function () {
3705
+ var theme = useWllSdk().theme;
3706
+ var buttonSize = IS_MOBILE ? BUTTON_SIZE * 0.75 : BUTTON_SIZE;
3707
+ return reactNative.StyleSheet.create({
3708
+ navButton: {
3709
+ position: 'absolute',
3710
+ top: '50%',
3711
+ transform: [{ translateY: -buttonSize / 2 }],
3712
+ width: buttonSize,
3713
+ height: buttonSize,
3714
+ borderRadius: buttonSize / 2,
3715
+ backgroundColor: theme.background,
3716
+ justifyContent: 'center',
3717
+ alignItems: 'center',
3718
+ zIndex: 1,
3719
+ },
3720
+ navButtonLeft: {
3721
+ left: -buttonSize / 2,
3722
+ },
3723
+ navButtonRight: {
3724
+ right: -buttonSize / 2,
3725
+ },
3726
+ });
3727
+ };
3728
+
3729
+ var CarouselNavButton = function (_a) {
3730
+ var direction = _a.direction, onPress = _a.onPress;
3731
+ var theme = useWllSdk().theme;
3732
+ var isRight = direction === 'right';
3733
+ var styles = useNavButtonStyles();
3734
+ return (jsxRuntimeExports.jsx(reactNative.Pressable, { style: [
3735
+ styles.navButton,
3736
+ isRight ? styles.navButtonRight : styles.navButtonLeft,
3737
+ { backgroundColor: theme.background },
3738
+ ], onPress: onPress, accessibilityLabel: "".concat(isRight ? 'Next' : 'Previous', " slide"), role: "button", children: jsxRuntimeExports.jsx(Icon, { name: isRight ? 'ArrowRight' : 'ArrowLeft', size: 20, color: theme.primary }) }));
3739
+ };
3740
+
3703
3741
  var Grid = function (_a) {
3704
3742
  var section = _a.section;
3705
3743
  if (section.type !== exports.SectionType.Grid) {
@@ -4491,6 +4529,11 @@ var useRewardTileStyles = function () {
4491
4529
  width: '100%',
4492
4530
  marginBottom: useResponsiveValue(theme.sizes.xxs, theme.sizes.xxxs, isDesktop, isTablet),
4493
4531
  },
4532
+ tileTitle: {
4533
+ maxWidth: '90%',
4534
+ flex: 1,
4535
+ marginRight: 8,
4536
+ },
4494
4537
  });
4495
4538
  };
4496
4539
 
@@ -4556,12 +4599,18 @@ var RewardTileSummary = function () {
4556
4599
  */
4557
4600
  var RewardTileTitle = function () {
4558
4601
  var tileContext = useTileContext();
4602
+ var styles = useRewardTileStyles();
4559
4603
  if (!isContextValid(tileContext))
4560
4604
  return null;
4561
4605
  var name = tileContext.configuration.name;
4562
4606
  if (!name)
4563
4607
  return null;
4564
- return (jsxRuntimeExports.jsx(Text, { variant: "title", ellipsizeMode: "tail", numberOfLines: 1, accessibilityRole: "header", accessibilityLabel: "Reward title: ".concat(name), testID: "reward-tile-title", style: { flex: 1, marginRight: 8 }, children: name }));
4608
+ var handleTitleWidth = function () {
4609
+ if (IS_MOBILE) {
4610
+ return styles.titleWithLink;
4611
+ }
4612
+ };
4613
+ return (jsxRuntimeExports.jsx(Text, { variant: "title", ellipsizeMode: "tail", numberOfLines: 1, accessibilityRole: "header", accessibilityLabel: "Reward title: ".concat(name), testID: "reward-tile-title", style: handleTitleWidth(), children: name }));
4565
4614
  };
4566
4615
 
4567
4616
  /**
@@ -4750,6 +4799,7 @@ exports.BaseBanner = BaseBanner;
4750
4799
  exports.BaseTile = BaseTile;
4751
4800
  exports.Button = Button;
4752
4801
  exports.Carousel = Carousel;
4802
+ exports.CarouselNavButton = CarouselNavButton;
4753
4803
  exports.Column = Column;
4754
4804
  exports.ContentTile = ContentTile$1;
4755
4805
  exports.ContentTileConfig = ContentTileConfig;