@wlloyalty/wll-react-sdk 1.0.86 → 1.0.87

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
@@ -1635,10 +1635,17 @@ var defaultTheme = {
1635
1635
  negative: '#ff0000',
1636
1636
  };
1637
1637
 
1638
+ var IS_WEB = reactNative.Platform.OS === "web";
1639
+ var IS_IOS = reactNative.Platform.OS === "ios";
1640
+ var IS_ANDROID = reactNative.Platform.OS === "android";
1641
+ var IS_MOBILE = IS_IOS || IS_ANDROID;
1642
+ var _a$1 = reactNative.Dimensions.get("window"), width = _a$1.width; _a$1.height;
1643
+ var SCREEN_WIDTH = width;
1644
+
1638
1645
  var COLOR_CONSTANTS = {
1639
1646
  MINIMUM_CONTRAST_RATIO: 2,
1640
1647
  DEFAULT_LIGHTNESS_ADJUSTMENT: 0.2,
1641
- DESATURATION_LIGHTEN_AMOUNT: 0.8,
1648
+ DESATURATION_LIGHTEN_AMOUNT: IS_WEB ? 0.8 : 0.2,
1642
1649
  DEFAULT_COLOR: '#FFFFFF',
1643
1650
  };
1644
1651
 
@@ -2205,12 +2212,6 @@ var ProgressBar = function (_a) {
2205
2212
  return (jsxRuntimeExports.jsx(reactNative.View, { style: containerStyle, children: jsxRuntimeExports.jsx(reactNative.Animated.View, { style: [styles.progress, progressStyles, progressWidth] }) }));
2206
2213
  };
2207
2214
 
2208
- var IS_WEB = reactNative.Platform.OS === "web";
2209
- reactNative.Platform.OS === "ios";
2210
- reactNative.Platform.OS === "android";
2211
- var _a$1 = reactNative.Dimensions.get("window"), width = _a$1.width; _a$1.height;
2212
- var SCREEN_WIDTH = width;
2213
-
2214
2215
  var ProgressiveImage = function (_a) {
2215
2216
  var source = _a.source, style = _a.style, _b = _a.isDesaturated, isDesaturated = _b === void 0 ? false : _b, alt = _a.alt, props = __rest(_a, ["source", "style", "isDesaturated", "alt"]);
2216
2217
  var imageAnimated = React.useRef(new reactNative.Animated.Value(0)).current;
@@ -2227,12 +2228,13 @@ var ProgressiveImage = function (_a) {
2227
2228
  var baseColor = theme.alphaDerivedPrimary[20];
2228
2229
  var desaturatedColor = desaturateColor(baseColor);
2229
2230
  var backgroundColor = isDesaturated ? desaturatedColor : baseColor;
2230
- // Platform-specific logic for desaturation
2231
- var desaturationStyle = IS_WEB
2232
- ? {
2233
- filter: isDesaturated ? 'grayscale(100%)' : undefined,
2234
- }
2235
- : {};
2231
+ // Create base animated image
2232
+ var baseImage = (jsxRuntimeExports.jsx(reactNative.Animated.Image, __assign({}, props, { source: source, style: [
2233
+ styles$7.imageOverlay,
2234
+ __assign({ opacity: imageAnimated }, (IS_WEB && {
2235
+ filter: isDesaturated ? 'grayscale(100%)' : undefined,
2236
+ })),
2237
+ ], onLoad: onImageLoad, accessibilityLabel: alt })));
2236
2238
  return (jsxRuntimeExports.jsxs(reactNative.View, { style: [styles$7.container, style, { backgroundColor: backgroundColor }], children: [jsxRuntimeExports.jsx(reactNative.Animated.View, { style: [
2237
2239
  styles$7.imageOverlay,
2238
2240
  {
@@ -2242,10 +2244,18 @@ var ProgressiveImage = function (_a) {
2242
2244
  outputRange: [1, 0],
2243
2245
  }),
2244
2246
  },
2245
- ] }), jsxRuntimeExports.jsx(reactNative.Animated.Image, __assign({}, props, { source: source, style: [
2246
- styles$7.imageOverlay,
2247
- __assign({ opacity: imageAnimated }, desaturationStyle),
2248
- ], onLoad: onImageLoad, accessibilityLabel: alt }))] }));
2247
+ ] }), IS_WEB ? (baseImage) : (
2248
+ // For React Native, use the overlay technique
2249
+ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [baseImage, isDesaturated && (jsxRuntimeExports.jsx(reactNative.Animated.Image, __assign({}, props, { source: source, style: [
2250
+ styles$7.imageOverlay,
2251
+ {
2252
+ opacity: imageAnimated.interpolate({
2253
+ inputRange: [0, 1],
2254
+ outputRange: [0, 0.8],
2255
+ }),
2256
+ tintColor: 'gray',
2257
+ },
2258
+ ] })))] }))] }));
2249
2259
  };
2250
2260
  var styles$7 = reactNative.StyleSheet.create({
2251
2261
  imageOverlay: {
@@ -3291,7 +3301,7 @@ var BannerTileTitle = function () {
3291
3301
  * @param configuration - The configuration object of the tile.
3292
3302
  * @returns `true` if the tile has no title, description, or CTA text.
3293
3303
  */
3294
- var isArtworkOnly$1 = function (configuration) {
3304
+ var isArtworkOnly$2 = function (configuration) {
3295
3305
  if (!configuration)
3296
3306
  return true;
3297
3307
  return (!configuration.title && !configuration.description && !configuration.ctaText);
@@ -3309,7 +3319,7 @@ var BannerTileRoot = function (_a) {
3309
3319
  if (!tile || !tile.active || !tile.configuration)
3310
3320
  return null;
3311
3321
  var configuration = tile.configuration;
3312
- return (jsxRuntimeExports.jsxs(BaseBanner, { tile: tile, children: [jsxRuntimeExports.jsx(BannerTile.Media, { isArtworkOnly: isArtworkOnly$1(configuration) }), jsxRuntimeExports.jsxs(FullFlex, { children: [jsxRuntimeExports.jsx(BannerTile.Title, {}), jsxRuntimeExports.jsx(BannerTile.Description, {}), jsxRuntimeExports.jsx(BannerTile.CTA, {})] })] }));
3322
+ return (jsxRuntimeExports.jsxs(BaseBanner, { tile: tile, children: [jsxRuntimeExports.jsx(BannerTile.Media, { isArtworkOnly: isArtworkOnly$2(configuration) }), jsxRuntimeExports.jsxs(FullFlex, { children: [jsxRuntimeExports.jsx(BannerTile.Title, {}), jsxRuntimeExports.jsx(BannerTile.Description, {}), jsxRuntimeExports.jsx(BannerTile.CTA, {})] })] }));
3313
3323
  };
3314
3324
  /**
3315
3325
  * The BannerTile component with subcomponents attached.
@@ -3322,11 +3332,16 @@ var BannerTile = Object.assign(BannerTileRoot, {
3322
3332
  });
3323
3333
  var BannerTile$1 = withTileFetching(BannerTile);
3324
3334
 
3325
- var ContentTileBody = function () { return jsxRuntimeExports.jsx(BaseTile.Body, {}); };
3326
-
3327
- var ContentTileContainer = function (_a) {
3328
- var children = _a.children;
3329
- return (jsxRuntimeExports.jsx(BaseTile.Container, { children: children }));
3335
+ var ContentTileChevron = function () {
3336
+ var _a, _b;
3337
+ var tileContext = useTileContext();
3338
+ var sdk = useWllSdk();
3339
+ if (!isContextValid(tileContext))
3340
+ return null;
3341
+ var ctaLink = tileContext.configuration.ctaLink;
3342
+ if (!ctaLink)
3343
+ return null;
3344
+ return (jsxRuntimeExports.jsx(Icon, { name: "ChevronRight", size: IS_MOBILE ? 16 : undefined, color: (_b = (_a = sdk.theme) === null || _a === void 0 ? void 0 : _a.derivedSurfaceText) === null || _b === void 0 ? void 0 : _b[20], accessibilityLabel: "View details", testID: "content-tile-chevron" }));
3330
3345
  };
3331
3346
 
3332
3347
  /**
@@ -3335,62 +3350,115 @@ var ContentTileContainer = function (_a) {
3335
3350
  *
3336
3351
  * @returns StyleSheet styles for the ContentTile component
3337
3352
  */
3338
- var useContentTileStyles = function () {
3339
- var theme = useWllSdk().theme;
3353
+ var useContentTileStyles = function (hasArtwork) {
3354
+ if (hasArtwork === void 0) { hasArtwork = false; }
3340
3355
  var _a = useResponsive$1(), isDesktop = _a.isDesktop, isTablet = _a.isTablet;
3356
+ var theme = useWllSdk().theme;
3357
+ var getHeaderStyle = function (hasArtwork) { return (__assign({ width: '100%', marginBottom: useResponsiveValue(theme.sizes.xxs, theme.sizes.xxxs, isDesktop, isTablet) }, (hasArtwork && {
3358
+ marginTop: useResponsiveValue(theme.sizes.xs, theme.sizes.xxs, isDesktop, isTablet),
3359
+ }))); };
3341
3360
  return reactNative.StyleSheet.create({
3361
+ imageContainer: {
3362
+ width: '100%',
3363
+ marginBottom: 0,
3364
+ },
3365
+ image: {
3366
+ position: 'absolute',
3367
+ top: 0,
3368
+ left: 0,
3369
+ bottom: 0,
3370
+ right: 0,
3371
+ width: '100%',
3372
+ height: '100%',
3373
+ resizeMode: 'cover',
3374
+ },
3342
3375
  content: {
3343
3376
  paddingHorizontal: useResponsiveValue(theme.sizes.sm, theme.sizes.xxs, isDesktop, isTablet),
3344
3377
  flex: 1,
3345
- justifyContent: 'center',
3346
- },
3347
- media: {
3348
- width: '100%',
3349
3378
  },
3379
+ header: getHeaderStyle(hasArtwork),
3350
3380
  });
3351
3381
  };
3352
3382
 
3353
- var ContentTileContent = function (_a) {
3354
- var children = _a.children;
3355
- var styles = useContentTileStyles();
3356
- return (jsxRuntimeExports.jsx(BaseTile.Content, { children: jsxRuntimeExports.jsx(reactNative.View, { style: styles.content, children: children }) }));
3383
+ var ContentTileMedia = function (_a) {
3384
+ var isArtworkOnly = _a.isArtworkOnly;
3385
+ var tileContext = useTileContext();
3386
+ if (!isContextValid(tileContext))
3387
+ return null;
3388
+ var _b = tileContext.configuration, artworkUrl = _b.artworkUrl, _c = _b.title, title = _c === void 0 ? '' : _c;
3389
+ if (!artworkUrl)
3390
+ return null;
3391
+ var hasArtwork = Boolean(artworkUrl);
3392
+ var styles = useContentTileStyles(hasArtwork);
3393
+ var containerStyle = {
3394
+ flexBasis: isArtworkOnly ? '100%' : '50%',
3395
+ };
3396
+ return (jsxRuntimeExports.jsx(reactNative.View, { style: [styles.imageContainer, containerStyle], testID: "content-tile-media", accessibilityRole: "image", accessibilityLabel: "Image for ".concat(title), children: jsxRuntimeExports.jsx(ProgressiveImage, { source: { uri: artworkUrl }, style: styles.image, alt: "Image for ".concat(title) }) }));
3397
+ };
3398
+
3399
+ var ContentTileSummary = function () {
3400
+ var tileContext = useTileContext();
3401
+ if (!isContextValid(tileContext))
3402
+ return null;
3403
+ var body = tileContext.configuration.body;
3404
+ if (!body)
3405
+ return null;
3406
+ var sizeInfo = useTileSize(tileContext);
3407
+ if (!sizeInfo)
3408
+ return null;
3409
+ var isFullSize = sizeInfo.isFullSize, isHalfSize = sizeInfo.isHalfSize;
3410
+ var getNumberOfLines = function () {
3411
+ return isFullSize ? 3 : isHalfSize ? 4 : 3;
3412
+ };
3413
+ return (jsxRuntimeExports.jsx(Text, { variant: "body", accessibilityRole: "text", accessibilityLabel: body, numberOfLines: getNumberOfLines(), testID: "content-tile-summary", children: body }));
3357
3414
  };
3358
3415
 
3359
- var ContentTileHeader = function () {
3416
+ var ContentTileTitle = function () {
3360
3417
  var tileContext = useTileContext();
3361
3418
  if (!isContextValid(tileContext))
3362
3419
  return null;
3363
3420
  var title = tileContext.configuration.title;
3364
3421
  if (!title)
3365
3422
  return null;
3366
- return (jsxRuntimeExports.jsx(BaseTile.Header, { children: jsxRuntimeExports.jsx(BaseTile.Title, {}) }));
3423
+ return (jsxRuntimeExports.jsx(Text, { variant: "title", accessibilityRole: "header", accessibilityLabel: title, numberOfLines: 1, testID: "content-tile-title", children: title }));
3367
3424
  };
3368
3425
 
3369
- var ContentTileMedia = function () {
3370
- var styles = useContentTileStyles();
3371
- return jsxRuntimeExports.jsx(BaseTile.Media, { style: styles.media });
3426
+ /**
3427
+ * Helper function to determine if the tile should display artwork only.
3428
+ *
3429
+ * @param configuration - The configuration object of the tile.
3430
+ * @returns `true` if the tile should display artwork only.
3431
+ */
3432
+ var isArtworkOnly$1 = function (configuration) {
3433
+ if (!configuration)
3434
+ return false;
3435
+ return !configuration.title && !configuration.body;
3372
3436
  };
3373
-
3374
3437
  /**
3375
- * The ContentTile component renders a tile with a container, media, content, header, and body.
3438
+ * The ContentTile component renders a tile with media, title, summary, and a chevron.
3439
+ * This follows the same structure as RewardTile for consistent layout.
3376
3440
  *
3377
- * @param tile - The tile data to render.
3441
+ * @param {ContentTileProps} props - Component props
3442
+ * @param {Tile} props.tile - The tile data to render
3443
+ * @returns JSX.Element or null if tile is inactive
3378
3444
  */
3379
3445
  var ContentTileRoot = function (_a) {
3380
3446
  var tile = _a.tile;
3381
- if (!tile || !tile.active)
3447
+ if (!tile || !tile.active || !tile.configuration)
3382
3448
  return null;
3383
- return (jsxRuntimeExports.jsx(BaseTile, { tile: tile, children: jsxRuntimeExports.jsxs(ContentTile.Container, { children: [jsxRuntimeExports.jsx(ContentTile.Media, {}), jsxRuntimeExports.jsxs(ContentTile.Content, { children: [jsxRuntimeExports.jsx(ContentTile.Header, {}), jsxRuntimeExports.jsx(ContentTile.Body, {})] })] }) }));
3449
+ var configuration = tile.configuration;
3450
+ var hasArtwork = Boolean(configuration.artworkUrl);
3451
+ var styles = useContentTileStyles(hasArtwork);
3452
+ return (jsxRuntimeExports.jsxs(BaseTile, { tile: tile, children: [jsxRuntimeExports.jsx(ContentTile.Media, { isArtworkOnly: isArtworkOnly$1(configuration) }), jsxRuntimeExports.jsxs(Layout, { justify: hasArtwork ? 'start' : 'center', style: { paddingBottom: 0, marginBottom: 0 }, children: [jsxRuntimeExports.jsxs(Row, { justify: "between", align: "center", style: styles.header, children: [jsxRuntimeExports.jsx(ContentTile.Title, {}), jsxRuntimeExports.jsx(ContentTile.Chevron, {})] }), jsxRuntimeExports.jsx(ContentTile.Summary, {})] })] }));
3384
3453
  };
3385
3454
  /**
3386
3455
  * The ContentTile component with subcomponents attached.
3387
3456
  */
3388
3457
  var ContentTile = Object.assign(ContentTileRoot, {
3389
- Container: ContentTileContainer,
3390
3458
  Media: ContentTileMedia,
3391
- Content: ContentTileContent,
3392
- Header: ContentTileHeader,
3393
- Body: ContentTileBody,
3459
+ Title: ContentTileTitle,
3460
+ Summary: ContentTileSummary,
3461
+ Chevron: ContentTileChevron,
3394
3462
  });
3395
3463
  var ContentTile$1 = withTileFetching(ContentTile);
3396
3464
 
@@ -3651,21 +3719,9 @@ var Grid = function (_a) {
3651
3719
  };
3652
3720
  }
3653
3721
  else {
3654
- // Calculate available width accounting for screen width and section padding
3655
3722
  var availableWidth = SCREEN_WIDTH - GRID_GAP * 2;
3656
3723
  var gapSpace = (columns - 1) * GRID_GAP;
3657
3724
  var tileWidth = Math.floor((availableWidth - gapSpace) / columns);
3658
- var halfTileHeight = Math.floor(tileWidth / 2);
3659
- // Detailed logging for debugging
3660
- console.log('=== GRID DEBUG ===');
3661
- console.log("SCREEN_WIDTH: ".concat(SCREEN_WIDTH, "px, GRID_GAP: ").concat(GRID_GAP, "px"));
3662
- console.log("Columns: ".concat(columns, ", Section padding: ").concat(GRID_GAP * 2, "px"));
3663
- console.log("Available width: ".concat(availableWidth, "px, Gap space: ").concat(gapSpace, "px"));
3664
- console.log("Calculated tile width: ".concat(tileWidth, "px"));
3665
- console.log("Half tile height should be: ".concat(halfTileHeight, "px"));
3666
- console.log("Expected full tile: ".concat(tileWidth, "x").concat(tileWidth, "px"));
3667
- console.log("Expected half tile: ".concat(tileWidth, "x").concat(halfTileHeight, "px"));
3668
- console.log('=== END DEBUG ===');
3669
3725
  return {
3670
3726
  width: tileWidth,
3671
3727
  marginBottom: GRID_GAP,
@@ -4648,44 +4704,35 @@ var TILE_COMPONENTS = (_a = {},
4648
4704
  */
4649
4705
  var TileContainer = function (_a) {
4650
4706
  var tiles = _a.tiles;
4651
- return (jsxRuntimeExports.jsx(reactNative.View, { style: styles.container, testID: "tile-container", children: tiles.map(function (tile, index) {
4707
+ var allHalfHeight = tiles.length > 0 &&
4708
+ tiles.every(function (tile) { return tile.tileHeight === exports.TileHeight.Half; });
4709
+ var halfHeightGap = allHalfHeight ? GRID_GAP / 2 : GRID_GAP;
4710
+ return (jsxRuntimeExports.jsx(reactNative.View, { style: [styles.container, allHalfHeight && styles.aspectContainer], testID: "tile-container", children: tiles.map(function (tile, index) {
4652
4711
  var TileComponent = TILE_COMPONENTS[tile.type];
4653
- var isHalfSize = useTileSize(tile).isHalfSize;
4654
- // Log tile dimensions for debugging
4655
- if (!__DEV__) {
4656
- console.log("Tile ".concat(index, " (").concat(tile.id, "): ").concat(isHalfSize ? 'Half' : 'Full', " size"));
4657
- }
4712
+ var isHalfHeight = tile.tileHeight === exports.TileHeight.Half;
4658
4713
  return (jsxRuntimeExports.jsx(reactNative.View, { style: [
4659
- styles.tileContainer,
4660
- isHalfSize && styles.halfTileContainer,
4661
- index > 0 && { marginTop: GRID_GAP },
4662
- ], onLayout: function (event) {
4663
- if (__DEV__) {
4664
- var _a = event.nativeEvent.layout, width = _a.width, height = _a.height;
4665
- console.log("=== TILE ".concat(index, " LAYOUT ==="));
4666
- console.log("Tile ID: ".concat(tile.id, ", Type: ").concat(tile.type));
4667
- console.log("Is Half Size: ".concat(isHalfSize));
4668
- console.log("Actual dimensions: ".concat(width.toFixed(2), "x").concat(height.toFixed(2), "px"));
4669
- }
4670
- }, children: TileComponent ? jsxRuntimeExports.jsx(TileComponent, { tile: tile }) : null }, tile.id));
4714
+ styles.tileWrapper,
4715
+ isHalfHeight && styles.halfHeightTile,
4716
+ index > 0 && {
4717
+ marginTop: allHalfHeight ? halfHeightGap : GRID_GAP,
4718
+ },
4719
+ ], children: TileComponent ? jsxRuntimeExports.jsx(TileComponent, { tile: tile }) : null }, tile.id));
4671
4720
  }) }));
4672
4721
  };
4673
4722
  var styles = reactNative.StyleSheet.create({
4674
4723
  container: {
4675
- flexDirection: 'column',
4676
4724
  flex: 1,
4677
4725
  width: '100%',
4678
- height: '100%',
4679
4726
  },
4680
- tileContainer: {
4681
- flexGrow: 1,
4682
- flexShrink: 1,
4683
- flexBasis: '100%',
4727
+ aspectContainer: {
4728
+ aspectRatio: 1,
4729
+ },
4730
+ tileWrapper: {
4731
+ flex: 1,
4684
4732
  width: '100%',
4685
4733
  },
4686
- halfTileContainer: {
4687
- aspectRatio: 2,
4688
- backgroundColor: 'red',
4734
+ halfHeightTile: {
4735
+ flex: 0.5,
4689
4736
  },
4690
4737
  });
4691
4738