@wlloyalty/wll-react-sdk 1.0.62 → 1.0.63

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.
@@ -1,10 +1,10 @@
1
1
  import { ViewStyle } from 'react-native';
2
- interface SkeletonProps {
2
+ type SkeletonProps = {
3
3
  width?: number | `${number}%`;
4
4
  height?: number | `${number}%`;
5
5
  borderRadius?: number;
6
6
  style?: ViewStyle;
7
7
  numberOfSquares?: number;
8
- }
8
+ };
9
9
  declare const Skeleton: ({ style, numberOfSquares, }: SkeletonProps) => JSX.Element;
10
10
  export default Skeleton;
@@ -1,6 +1,6 @@
1
1
  import { ViewStyle } from 'react-native';
2
- interface SkeletonTileProps {
2
+ type SkeletonTileProps = {
3
3
  style?: ViewStyle;
4
- }
4
+ };
5
5
  declare const SkeletonTile: ({ style }: SkeletonTileProps) => JSX.Element;
6
6
  export default SkeletonTile;
@@ -12,12 +12,7 @@ export declare const RewardTile: (({ tile }: RewardTileProps) => JSX.Element | n
12
12
  }) => JSX.Element | null;
13
13
  Title: () => JSX.Element | null;
14
14
  Summary: () => JSX.Element | null;
15
- Points: () => JSX.Element /**
16
- * Helper function to determine if the tile should display artwork only.
17
- *
18
- * @param configuration - The configuration object of the tile.
19
- * @returns `true` if the tile should display artwork only.
20
- */ | null;
15
+ Points: () => JSX.Element | null;
21
16
  Chevron: () => JSX.Element;
22
17
  };
23
18
  declare const _default: (props: Omit<RewardTileProps, "tile"> & import("../../hoc/withTileFetching").WithTileFetchingProps) => React.JSX.Element;
@@ -1,11 +1,11 @@
1
1
  export type DimensionMode = 'desktop' | 'tablet' | 'mobile';
2
- export interface WindowDimensions {
2
+ export type WindowDimensions = {
3
3
  width: number;
4
4
  height: number;
5
- }
6
- export interface ResponsiveContextType {
5
+ };
6
+ export type ResponsiveContextType = {
7
7
  dimensionMode: DimensionMode;
8
8
  isTablet: boolean;
9
9
  isMobile: boolean;
10
10
  isDesktop: boolean;
11
- }
11
+ };
@@ -155,4 +155,8 @@ export type Tile = {
155
155
  };
156
156
  declare const getConfigForTileType: (tileType: TileType) => typeof BannerTileConfig | typeof PointsTileConfig | typeof ContentTileConfig | typeof RewardTileConfig | typeof BadgeTileConfig | typeof RewardCategoryTileConfig | typeof TierTileConfig;
157
157
  export type TileConfig = InstanceType<ReturnType<typeof getConfigForTileType>>;
158
+ export type TileSizeInfo = {
159
+ isFullSize: boolean;
160
+ isHalfSize: boolean;
161
+ };
158
162
  export {};
@@ -1,3 +1,4 @@
1
+ import { TileSizeInfo } from '../types/tile';
1
2
  /**
2
3
  * Utility function that checks if a component context and its configuration exist.
3
4
  * Works for both tile contexts and banner contexts.
@@ -6,3 +7,11 @@
6
7
  * @returns `true` if both the context and its configuration exist, otherwise `false`
7
8
  */
8
9
  export declare function isContextValid(context: any): boolean;
10
+ /**
11
+ * Checks if a tile's content should be hidden based on its size and artwork configuration.
12
+ *
13
+ * @param {TileSizeInfo | null} sizeInfo - The size information for the tile
14
+ * @param {string | null | undefined} artworkUrl - The URL of the tile's artwork
15
+ * @returns {boolean} True if the content should be hidden, false otherwise
16
+ */
17
+ export declare const shouldHideContentForHalfTile: (sizeInfo: TileSizeInfo | null, artworkUrl?: string | null) => boolean;
package/dist/web.js CHANGED
@@ -19149,6 +19149,17 @@ var BaseTileBody = function (props) {
19149
19149
  function isContextValid(context) {
19150
19150
  return context !== null && context !== undefined && context.configuration !== null && context.configuration !== undefined;
19151
19151
  }
19152
+ /**
19153
+ * Checks if a tile's content should be hidden based on its size and artwork configuration.
19154
+ *
19155
+ * @param {TileSizeInfo | null} sizeInfo - The size information for the tile
19156
+ * @param {string | null | undefined} artworkUrl - The URL of the tile's artwork
19157
+ * @returns {boolean} True if the content should be hidden, false otherwise
19158
+ */
19159
+ var shouldHideContentForHalfTile = function (sizeInfo, artworkUrl) {
19160
+ if (!sizeInfo) return false;
19161
+ return sizeInfo.isHalfSize && !!artworkUrl;
19162
+ };
19152
19163
 
19153
19164
  var baseStyles = StyleSheet$1.create({
19154
19165
  container: {
@@ -19238,9 +19249,7 @@ var BaseTileContent = function (_a) {
19238
19249
  var artworkUrl = tileContext.configuration.artworkUrl;
19239
19250
  var sizeInfo = useTileSize(tileContext);
19240
19251
  if (!sizeInfo) return null;
19241
- var isHalfSize = sizeInfo.isHalfSize;
19242
- // For half tiles with an image, don't show other content
19243
- if (isHalfSize && artworkUrl) return null;
19252
+ if (shouldHideContentForHalfTile(sizeInfo, artworkUrl)) return null;
19244
19253
  return /*#__PURE__*/React.createElement(View$2, {
19245
19254
  testID: "tile-content",
19246
19255
  style: [baseStyles.content, {
@@ -19265,13 +19274,11 @@ var BaseTileHeader = function (_a) {
19265
19274
  var artworkUrl = tileContext.configuration.artworkUrl;
19266
19275
  var sizeInfo = useTileSize(tileContext);
19267
19276
  if (!sizeInfo) return null;
19268
- var isHalfSize = sizeInfo.isHalfSize;
19269
- // For half tiles with an image, don't show header
19270
- if (isHalfSize && artworkUrl) return null;
19277
+ if (shouldHideContentForHalfTile(sizeInfo, artworkUrl)) return null;
19271
19278
  var dynamicStyles = useBaseTileStyles();
19272
19279
  var combinedStyle = __assign(__assign(__assign({}, dynamicStyles.header), {
19273
- marginTop: isHalfSize ? 0 : dynamicStyles.header.marginTop
19274
- }), isHalfSize ? {
19280
+ marginTop: sizeInfo.isHalfSize ? 0 : dynamicStyles.header.marginTop
19281
+ }), sizeInfo.isHalfSize ? {
19275
19282
  alignItems: 'center'
19276
19283
  } : {});
19277
19284
  return /*#__PURE__*/React.createElement(View$2, {