@wlloyalty/wll-react-sdk 1.0.106 → 1.0.108

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
@@ -1655,6 +1655,13 @@ var EventEmitter = /** @class */ (function () {
1655
1655
  */
1656
1656
  var sdkEventEmitter = new EventEmitter();
1657
1657
 
1658
+ var IS_WEB = reactNative.Platform.OS === "web";
1659
+ var IS_IOS = reactNative.Platform.OS === "ios";
1660
+ var IS_ANDROID = reactNative.Platform.OS === "android";
1661
+ var IS_MOBILE = IS_IOS || IS_ANDROID;
1662
+ var _a$1 = reactNative.Dimensions.get("window"), width = _a$1.width; _a$1.height;
1663
+ var SCREEN_WIDTH = width;
1664
+
1658
1665
  var sizes = {
1659
1666
  borderRadiusSm: 15,
1660
1667
  borderRadiusLg: 20,
@@ -1693,13 +1700,24 @@ var defaultTheme = {
1693
1700
  positive: '#008000',
1694
1701
  negative: '#ff0000',
1695
1702
  };
1696
-
1697
- var IS_WEB = reactNative.Platform.OS === "web";
1698
- var IS_IOS = reactNative.Platform.OS === "ios";
1699
- var IS_ANDROID = reactNative.Platform.OS === "android";
1700
- var IS_MOBILE = IS_IOS || IS_ANDROID;
1701
- var _a$1 = reactNative.Dimensions.get("window"), width = _a$1.width; _a$1.height;
1702
- var SCREEN_WIDTH = width;
1703
+ /**
1704
+ * Creates appropriate directional margin styles for both web and native platforms.
1705
+ * Handles RTL layouts correctly across platforms by using the I18nManager.
1706
+ *
1707
+ * @param value - The margin value to apply
1708
+ * @returns An object with the appropriate margin style property
1709
+ */
1710
+ var getDirectionalMargin = function (value) {
1711
+ if (IS_WEB) {
1712
+ // Check document direction for web
1713
+ // We need to use this because React Native Web does not support I18nManager
1714
+ // and marginStart/marginEnd resolves to margin-left/margin-right and not margin-inline-start/end
1715
+ var isRTL = typeof document !== 'undefined' && document.documentElement.dir === 'rtl';
1716
+ return isRTL ? { marginLeft: value } : { marginRight: value };
1717
+ }
1718
+ // For native platforms, use marginEnd which automatically handles RTL
1719
+ return { marginEnd: value };
1720
+ };
1703
1721
 
1704
1722
  var COLOR_CONSTANTS = {
1705
1723
  MINIMUM_CONTRAST_RATIO: 2,
@@ -2409,22 +2427,22 @@ var Text = function (_a) {
2409
2427
  var accessibilityRole;
2410
2428
  switch (variant) {
2411
2429
  case 'title':
2412
- accessibilityRole = 'header';
2430
+ accessibilityRole = IS_MOBILE ? 'heading' : 'header';
2413
2431
  break;
2414
2432
  case 'caption':
2415
- accessibilityRole = 'text';
2433
+ accessibilityRole = IS_MOBILE ? 'contentinfo' : 'text';
2416
2434
  break;
2417
2435
  case 'eyebrow':
2418
- accessibilityRole = 'text';
2436
+ accessibilityRole = IS_MOBILE ? 'contentinfo' : 'text';
2419
2437
  break;
2420
2438
  case 'description':
2421
- accessibilityRole = 'paragraph';
2439
+ accessibilityRole = IS_MOBILE ? 'article' : 'paragraph';
2422
2440
  break;
2423
2441
  case 'label':
2424
- accessibilityRole = 'text';
2442
+ accessibilityRole = IS_MOBILE ? 'option' : 'text';
2425
2443
  break;
2426
2444
  default:
2427
- accessibilityRole = 'text';
2445
+ accessibilityRole = IS_MOBILE ? 'contentinfo' : 'text';
2428
2446
  }
2429
2447
  var combinedStyles = [
2430
2448
  styles.base,
@@ -2977,6 +2995,13 @@ var SkeletonTile = function (_a) {
2977
2995
  var style = _a.style;
2978
2996
  var theme = useWllSdk().theme;
2979
2997
  var animatedValue = React__namespace.useRef(new reactNative.Animated.Value(0)).current;
2998
+ var width = reactNative.useWindowDimensions().width;
2999
+ var tileWidth = 1000 / 4;
3000
+ var tileHeight = tileWidth;
3001
+ if (IS_MOBILE) {
3002
+ tileWidth = width / 2 - theme.sizes.lg * 2;
3003
+ tileHeight = tileWidth;
3004
+ }
2980
3005
  React__namespace.useEffect(function () {
2981
3006
  var pulseAnimation = reactNative.Animated.loop(reactNative.Animated.sequence([
2982
3007
  reactNative.Animated.timing(animatedValue, {
@@ -3003,6 +3028,8 @@ var SkeletonTile = function (_a) {
3003
3028
  opacity: opacity,
3004
3029
  backgroundColor: theme.alphaDerivedText[20],
3005
3030
  borderRadius: theme.sizes.borderRadiusLg,
3031
+ width: tileWidth,
3032
+ height: tileHeight,
3006
3033
  },
3007
3034
  style,
3008
3035
  ] }));
@@ -3011,7 +3038,6 @@ var styles$4 = reactNative.StyleSheet.create({
3011
3038
  container: {
3012
3039
  aspectRatio: 1,
3013
3040
  overflow: 'hidden',
3014
- width: 1000 / 4,
3015
3041
  },
3016
3042
  });
3017
3043
 
@@ -3422,14 +3448,7 @@ var useBannerTileStyles = function () {
3422
3448
  slideContent: {
3423
3449
  flex: 1,
3424
3450
  },
3425
- mediaContainer: {
3426
- aspectRatio: 1,
3427
- position: 'relative',
3428
- overflow: 'hidden',
3429
- marginEnd: useResponsiveValue(theme.sizes.xxl, theme.sizes.xxs, isDesktop, isTablet),
3430
- maxHeight: useResponsiveValue(253, 120, isDesktop, isTablet),
3431
- minHeight: 120,
3432
- },
3451
+ mediaContainer: __assign(__assign({ aspectRatio: 1, position: 'relative', overflow: 'hidden' }, getDirectionalMargin(useResponsiveValue(theme.sizes.xxl, theme.sizes.xxs, isDesktop, isTablet))), { maxHeight: useResponsiveValue(253, 120, isDesktop, isTablet), minHeight: 120 }),
3433
3452
  media: {
3434
3453
  position: 'absolute',
3435
3454
  width: '100%',
@@ -3583,11 +3602,7 @@ var useContentTileStyles = function (hasArtwork) {
3583
3602
  flex: 1,
3584
3603
  },
3585
3604
  header: getHeaderStyle(hasArtwork),
3586
- tileTitle: {
3587
- maxWidth: '90%',
3588
- flex: 1,
3589
- marginEnd: 8,
3590
- },
3605
+ tileTitle: __assign({ maxWidth: '90%', flex: 1 }, getDirectionalMargin(8)),
3591
3606
  });
3592
3607
  };
3593
3608
 
@@ -4016,7 +4031,7 @@ var Grid = function (_a) {
4016
4031
  tileContainers.push(jsxRuntimeExports.jsx(reactNative.View, { style: [
4017
4032
  // @ts-ignore Web uses CSS calc strings for responsive layouts, while ViewStyle expects numbers
4018
4033
  getTileWidth(columnsPerRow),
4019
- !isLastInRow && { marginEnd: GRID_GAP },
4034
+ !isLastInRow && getDirectionalMargin(GRID_GAP),
4020
4035
  ], children: jsxRuntimeExports.jsx(TileContainer, { tiles: currentTiles }) }, "container-".concat(index)));
4021
4036
  currentTiles = [];
4022
4037
  }
@@ -4173,7 +4188,7 @@ var Section = function (_a) {
4173
4188
  }
4174
4189
  var renderSectionContent = function () {
4175
4190
  if (isLoading) {
4176
- return (jsxRuntimeExports.jsx(Skeleton, { "aria-label": "Loading section content", numberOfSquares: 4 }));
4191
+ return (jsxRuntimeExports.jsx(Skeleton, { "aria-label": "Loading section content", numberOfSquares: IS_WEB ? 4 : 2 }));
4177
4192
  }
4178
4193
  if (error || !sectionData) {
4179
4194
  return jsxRuntimeExports.jsx(EmptyState, { message: error || 'No section data available.' });
@@ -4369,8 +4384,12 @@ var Group = function (_a) {
4369
4384
  return null;
4370
4385
  }
4371
4386
  var _b = useGroupData(id), groupData = _b.groupData, isLoading = _b.isLoading, error = _b.error;
4387
+ var theme = useWllSdk().theme;
4372
4388
  if (isLoading) {
4373
- return (jsxRuntimeExports.jsx(reactNative.View, { style: commonStyles.emptyContainer, accessible: true, accessibilityLabel: "Loading group data", children: jsxRuntimeExports.jsx(Skeleton, {}) }));
4389
+ return (jsxRuntimeExports.jsx(reactNative.View, { style: {
4390
+ flex: 1,
4391
+ padding: theme.sizes.lg,
4392
+ }, accessible: true, accessibilityLabel: "Loading group data", children: jsxRuntimeExports.jsx(Skeleton, { numberOfSquares: IS_WEB ? 4 : 2 }) }));
4374
4393
  }
4375
4394
  if (error || !groupData) {
4376
4395
  return jsxRuntimeExports.jsx(GroupEmptyState, { message: error || 'No group data available' });
@@ -4795,11 +4814,7 @@ var useRewardTileStyles = function () {
4795
4814
  width: '100%',
4796
4815
  marginBottom: useResponsiveValue(theme.sizes.xxs, theme.sizes.xxxs, isDesktop, isTablet),
4797
4816
  },
4798
- tileTitle: {
4799
- maxWidth: '90%',
4800
- flex: 1,
4801
- marginEnd: 8,
4802
- },
4817
+ tileTitle: __assign({ maxWidth: '90%', flex: 1 }, getDirectionalMargin(8)),
4803
4818
  });
4804
4819
  };
4805
4820