@wlloyalty/wll-react-sdk 1.0.62 → 1.0.64
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 +7 -3
- package/dist/native.js +16 -9
- package/dist/native.js.map +1 -1
- package/dist/types/components/atoms/Skeleton/index.d.ts +2 -2
- package/dist/types/components/atoms/SkeletonTile/index.d.ts +2 -2
- package/dist/types/components/organisms/RewardTile/index.d.ts +1 -6
- package/dist/types/types/responsive.d.ts +4 -4
- package/dist/types/types/tile.d.ts +4 -0
- package/dist/types/utils/contextHelpers.d.ts +9 -0
- package/dist/web.js +16 -9
- package/dist/web.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ViewStyle } from 'react-native';
|
|
2
|
-
|
|
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;
|
|
@@ -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
|
|
2
|
+
export type WindowDimensions = {
|
|
3
3
|
width: number;
|
|
4
4
|
height: number;
|
|
5
|
-
}
|
|
6
|
-
export
|
|
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
|
-
|
|
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
|
-
|
|
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, {
|
|
@@ -21026,7 +21033,7 @@ var Group = function (_a) {
|
|
|
21026
21033
|
* @returns A cleaned up number as a number
|
|
21027
21034
|
*/
|
|
21028
21035
|
var cleanNumber = function (value) {
|
|
21029
|
-
return Number(value.toString().trim().replace(/\s+/g, ''));
|
|
21036
|
+
return Number(Number(value.toString().trim().replace(/\s+/g, '')).toFixed(2));
|
|
21030
21037
|
};
|
|
21031
21038
|
/**
|
|
21032
21039
|
* Applies a multiplier to a base value. Handles string multipliers by converting them to numbers.
|