@wlloyalty/wll-react-sdk 1.0.61 → 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.
- package/dist/index.d.ts +31 -17
- package/dist/native.js +593 -254
- package/dist/native.js.map +1 -1
- package/dist/types/components/atoms/BaseTile/base-tile-body.d.ts +6 -0
- package/dist/types/components/atoms/BaseTile/base-tile-content.d.ts +11 -4
- package/dist/types/components/atoms/BaseTile/base-tile-header.d.ts +11 -4
- package/dist/types/components/atoms/BaseTile/base-tile-media.d.ts +6 -0
- package/dist/types/components/atoms/BaseTile/base-tile-title.d.ts +5 -0
- package/dist/types/components/atoms/BaseTile/index.d.ts +9 -8
- package/dist/types/components/atoms/BaseTile/styles.d.ts +27 -0
- 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/BadgeTile/badge-tile-date-earned.d.ts +5 -0
- package/dist/types/components/organisms/BadgeTile/badge-tile-description.d.ts +5 -0
- package/dist/types/components/organisms/BadgeTile/badge-tile-media.d.ts +5 -0
- package/dist/types/components/organisms/BadgeTile/badge-tile-status.d.ts +5 -0
- package/dist/types/components/organisms/BadgeTile/badge-tile-title.d.ts +5 -0
- package/dist/types/components/organisms/BadgeTile/styles.d.ts +6 -0
- package/dist/types/components/organisms/BannerTile/banner-tile-cta.d.ts +5 -0
- package/dist/types/components/organisms/BannerTile/banner-tile-description.d.ts +5 -0
- package/dist/types/components/organisms/BannerTile/banner-tile-media.d.ts +5 -0
- package/dist/types/components/organisms/BannerTile/banner-tile-title.d.ts +5 -0
- package/dist/types/components/organisms/BannerTile/styles.d.ts +6 -0
- package/dist/types/components/organisms/ContentTile/content-tile-container.d.ts +2 -4
- package/dist/types/components/organisms/ContentTile/content-tile-content.d.ts +2 -4
- package/dist/types/components/organisms/ContentTile/index.d.ts +2 -6
- package/dist/types/components/organisms/ContentTile/styles.d.ts +6 -0
- package/dist/types/components/organisms/Group/index.d.ts +26 -3
- package/dist/types/components/organisms/PointsTile/points-tile-formatted-points.d.ts +5 -0
- package/dist/types/components/organisms/PointsTile/points-tile-media.d.ts +5 -0
- package/dist/types/components/organisms/PointsTile/points-tile-title.d.ts +5 -0
- package/dist/types/components/organisms/PointsTile/styles.d.ts +6 -0
- package/dist/types/components/organisms/RewardCategoryTile/reward-category-header.d.ts +5 -0
- package/dist/types/components/organisms/RewardCategoryTile/reward-category-media.d.ts +5 -0
- package/dist/types/components/organisms/RewardCategoryTile/styles.d.ts +6 -0
- package/dist/types/components/organisms/RewardTile/reward-tile-chevron.d.ts +5 -0
- package/dist/types/components/organisms/RewardTile/reward-tile-media.d.ts +7 -0
- package/dist/types/components/organisms/RewardTile/reward-tile-points.d.ts +5 -0
- package/dist/types/components/organisms/RewardTile/reward-tile-summary.d.ts +5 -0
- package/dist/types/components/organisms/RewardTile/reward-tile-title.d.ts +5 -0
- package/dist/types/components/organisms/RewardTile/styles.d.ts +6 -0
- package/dist/types/components/organisms/Section/index.d.ts +8 -0
- package/dist/types/components/organisms/Section/styles.d.ts +6 -0
- package/dist/types/context/WllSdkContext.d.ts +2 -3
- package/dist/types/types/helpers.d.ts +11 -0
- package/dist/types/types/responsive.d.ts +4 -4
- package/dist/types/types/theme.d.ts +2 -3
- package/dist/types/types/tile.d.ts +4 -0
- package/dist/types/utils/contextHelpers.d.ts +17 -0
- package/dist/web.js +593 -254
- package/dist/web.js.map +1 -1
- package/package.json +1 -1
package/dist/web.js
CHANGED
|
@@ -19105,17 +19105,26 @@ var useTileSize = function (tile) {
|
|
|
19105
19105
|
}, [tile.tileHeight]);
|
|
19106
19106
|
};
|
|
19107
19107
|
|
|
19108
|
+
/**
|
|
19109
|
+
* Renders the body text of a BaseTile component.
|
|
19110
|
+
*
|
|
19111
|
+
* @param {BaseTileBodyProps} props - Component props including text styling options
|
|
19112
|
+
* @returns {JSX.Element|null} The rendered body text or null if conditions for display are not met
|
|
19113
|
+
*/
|
|
19108
19114
|
var BaseTileBody = function (props) {
|
|
19109
|
-
var
|
|
19110
|
-
var
|
|
19111
|
-
|
|
19112
|
-
|
|
19113
|
-
|
|
19114
|
-
|
|
19115
|
-
|
|
19116
|
-
|
|
19115
|
+
var tileContext = useTileContext();
|
|
19116
|
+
var responsive = useResponsive$1();
|
|
19117
|
+
if (!tileContext || !tileContext.configuration || !responsive) return null;
|
|
19118
|
+
var isDesktop = responsive.isDesktop,
|
|
19119
|
+
isTablet = responsive.isTablet;
|
|
19120
|
+
var _a = tileContext.configuration,
|
|
19121
|
+
body = _a.body,
|
|
19122
|
+
artworkUrl = _a.artworkUrl;
|
|
19123
|
+
var sizeInfo = useTileSize(tileContext);
|
|
19124
|
+
if (!sizeInfo) return null;
|
|
19125
|
+
var isHalfSize = sizeInfo.isHalfSize;
|
|
19126
|
+
// Don't show body for half tiles with image
|
|
19117
19127
|
if (isHalfSize && artworkUrl || !body) return null;
|
|
19118
|
-
// Helper function to determine the number of lines
|
|
19119
19128
|
var getNumberOfLines = function () {
|
|
19120
19129
|
if (!isHalfSize && !artworkUrl) return undefined;
|
|
19121
19130
|
return isDesktop ? 3 : isTablet ? 4 : 3;
|
|
@@ -19123,12 +19132,35 @@ var BaseTileBody = function (props) {
|
|
|
19123
19132
|
return /*#__PURE__*/React.createElement(Text, _extends({
|
|
19124
19133
|
variant: "body"
|
|
19125
19134
|
}, props, {
|
|
19135
|
+
accessibilityRole: "text",
|
|
19126
19136
|
accessibilityLabel: body,
|
|
19127
19137
|
numberOfLines: getNumberOfLines(),
|
|
19128
19138
|
testID: "tile-body"
|
|
19129
19139
|
}), body);
|
|
19130
19140
|
};
|
|
19131
19141
|
|
|
19142
|
+
/**
|
|
19143
|
+
* Utility function that checks if a component context and its configuration exist.
|
|
19144
|
+
* Works for both tile contexts and banner contexts.
|
|
19145
|
+
*
|
|
19146
|
+
* @param context - The component context to validate (tileContext or bannerContext)
|
|
19147
|
+
* @returns `true` if both the context and its configuration exist, otherwise `false`
|
|
19148
|
+
*/
|
|
19149
|
+
function isContextValid(context) {
|
|
19150
|
+
return context !== null && context !== undefined && context.configuration !== null && context.configuration !== undefined;
|
|
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
|
+
};
|
|
19163
|
+
|
|
19132
19164
|
var baseStyles = StyleSheet$1.create({
|
|
19133
19165
|
container: {
|
|
19134
19166
|
width: '100%',
|
|
@@ -19144,15 +19176,35 @@ var baseStyles = StyleSheet$1.create({
|
|
|
19144
19176
|
objectFit: 'cover'
|
|
19145
19177
|
}
|
|
19146
19178
|
});
|
|
19147
|
-
|
|
19179
|
+
/**
|
|
19180
|
+
* Custom hook that returns the styles for the BaseTile component.
|
|
19181
|
+
* Applies responsive styling based on the current device.
|
|
19182
|
+
*
|
|
19183
|
+
* @returns StyleSheet styles for the BaseTile component
|
|
19184
|
+
*/
|
|
19148
19185
|
var useBaseTileStyles = function () {
|
|
19149
|
-
var
|
|
19186
|
+
var tileContext = useTileContext();
|
|
19150
19187
|
var theme = useWllSdk().theme;
|
|
19151
19188
|
var _a = useResponsive$1(),
|
|
19152
19189
|
isDesktop = _a.isDesktop,
|
|
19153
19190
|
isTablet = _a.isTablet;
|
|
19154
|
-
|
|
19155
|
-
|
|
19191
|
+
if (!tileContext || !tileContext.configuration) {
|
|
19192
|
+
return StyleSheet$1.create({
|
|
19193
|
+
container: baseStyles.container,
|
|
19194
|
+
content: baseStyles.content,
|
|
19195
|
+
header: {
|
|
19196
|
+
marginBottom: 0,
|
|
19197
|
+
marginTop: 0,
|
|
19198
|
+
flexDirection: 'row',
|
|
19199
|
+
alignItems: 'center',
|
|
19200
|
+
justifyContent: 'space-between'
|
|
19201
|
+
},
|
|
19202
|
+
media: baseStyles.media
|
|
19203
|
+
});
|
|
19204
|
+
}
|
|
19205
|
+
var sizeInfo = useTileSize(tileContext);
|
|
19206
|
+
var isHalfSize = (sizeInfo === null || sizeInfo === void 0 ? void 0 : sizeInfo.isHalfSize) || false;
|
|
19207
|
+
var _b = tileContext.configuration,
|
|
19156
19208
|
artworkUrl = _b.artworkUrl,
|
|
19157
19209
|
title = _b.title,
|
|
19158
19210
|
body = _b.body;
|
|
@@ -19183,46 +19235,72 @@ var useBaseTileStyles = function () {
|
|
|
19183
19235
|
});
|
|
19184
19236
|
};
|
|
19185
19237
|
|
|
19238
|
+
/**
|
|
19239
|
+
* Renders the content section of a BaseTile component.
|
|
19240
|
+
*
|
|
19241
|
+
* @param {BaseTileContentProps} props - Component props
|
|
19242
|
+
* @param {ReactNode} props.children - Child elements to render within the content area
|
|
19243
|
+
* @returns {JSX.Element|null} The rendered content or null if conditions for display are not met
|
|
19244
|
+
*/
|
|
19186
19245
|
var BaseTileContent = function (_a) {
|
|
19187
19246
|
var children = _a.children;
|
|
19188
|
-
var
|
|
19189
|
-
|
|
19190
|
-
var
|
|
19191
|
-
|
|
19192
|
-
if (
|
|
19247
|
+
var tileContext = useTileContext();
|
|
19248
|
+
if (!isContextValid(tileContext)) return null;
|
|
19249
|
+
var artworkUrl = tileContext.configuration.artworkUrl;
|
|
19250
|
+
var sizeInfo = useTileSize(tileContext);
|
|
19251
|
+
if (!sizeInfo) return null;
|
|
19252
|
+
if (shouldHideContentForHalfTile(sizeInfo, artworkUrl)) return null;
|
|
19193
19253
|
return /*#__PURE__*/React.createElement(View$2, {
|
|
19194
19254
|
testID: "tile-content",
|
|
19195
19255
|
style: [baseStyles.content, {
|
|
19196
19256
|
justifyContent: 'center',
|
|
19197
19257
|
height: !artworkUrl ? '100%' : undefined
|
|
19198
|
-
}]
|
|
19258
|
+
}],
|
|
19259
|
+
accessibilityRole: "none"
|
|
19199
19260
|
}, children);
|
|
19200
19261
|
};
|
|
19201
19262
|
|
|
19263
|
+
/**
|
|
19264
|
+
* Renders the header section of a BaseTile component.
|
|
19265
|
+
*
|
|
19266
|
+
* @param {BaseTileHeaderProps} props - Component props
|
|
19267
|
+
* @param {ReactNode} props.children - Child elements to render within the header
|
|
19268
|
+
* @returns {JSX.Element|null} The rendered header or null if conditions for display are not met
|
|
19269
|
+
*/
|
|
19202
19270
|
var BaseTileHeader = function (_a) {
|
|
19203
19271
|
var children = _a.children;
|
|
19204
|
-
var
|
|
19205
|
-
|
|
19206
|
-
var
|
|
19207
|
-
|
|
19208
|
-
if (
|
|
19272
|
+
var tileContext = useTileContext();
|
|
19273
|
+
if (!isContextValid(tileContext)) return null;
|
|
19274
|
+
var artworkUrl = tileContext.configuration.artworkUrl;
|
|
19275
|
+
var sizeInfo = useTileSize(tileContext);
|
|
19276
|
+
if (!sizeInfo) return null;
|
|
19277
|
+
if (shouldHideContentForHalfTile(sizeInfo, artworkUrl)) return null;
|
|
19209
19278
|
var dynamicStyles = useBaseTileStyles();
|
|
19279
|
+
var combinedStyle = __assign(__assign(__assign({}, dynamicStyles.header), {
|
|
19280
|
+
marginTop: sizeInfo.isHalfSize ? 0 : dynamicStyles.header.marginTop
|
|
19281
|
+
}), sizeInfo.isHalfSize ? {
|
|
19282
|
+
alignItems: 'center'
|
|
19283
|
+
} : {});
|
|
19210
19284
|
return /*#__PURE__*/React.createElement(View$2, {
|
|
19211
|
-
style:
|
|
19212
|
-
|
|
19213
|
-
|
|
19214
|
-
textAlign: isHalfSize && 'center'
|
|
19215
|
-
}],
|
|
19216
|
-
numberOfLines: 1,
|
|
19217
|
-
testID: "tile-header"
|
|
19285
|
+
style: combinedStyle,
|
|
19286
|
+
testID: "tile-header",
|
|
19287
|
+
accessibilityRole: "header"
|
|
19218
19288
|
}, children);
|
|
19219
19289
|
};
|
|
19220
19290
|
|
|
19291
|
+
/**
|
|
19292
|
+
* Renders the media (image) for a BaseTile component.
|
|
19293
|
+
*
|
|
19294
|
+
* @param {ImagePropsNoSource} props - The image props excluding source
|
|
19295
|
+
* @returns {JSX.Element|null} The rendered image or null if no artwork URL is present
|
|
19296
|
+
*/
|
|
19221
19297
|
var BaseTileMedia = function (props) {
|
|
19222
|
-
var
|
|
19223
|
-
|
|
19298
|
+
var tileContext = useTileContext();
|
|
19299
|
+
if (!isContextValid(tileContext)) return null;
|
|
19300
|
+
var _a = tileContext.configuration,
|
|
19224
19301
|
artworkUrl = _a.artworkUrl,
|
|
19225
|
-
|
|
19302
|
+
_b = _a.title,
|
|
19303
|
+
title = _b === void 0 ? '' : _b;
|
|
19226
19304
|
var styles = useBaseTileStyles();
|
|
19227
19305
|
if (!artworkUrl) return null;
|
|
19228
19306
|
return /*#__PURE__*/React.createElement(ProgressiveImage, _extends({}, props, {
|
|
@@ -19232,29 +19310,40 @@ var BaseTileMedia = function (props) {
|
|
|
19232
19310
|
testID: "tile-media",
|
|
19233
19311
|
style: [props.style, baseStyles.media, styles.media],
|
|
19234
19312
|
alt: "Content image".concat(title ? " for ".concat(title) : ''),
|
|
19235
|
-
|
|
19236
|
-
importantForAccessibility: "no-hide-descendants"
|
|
19313
|
+
accessibilityRole: "image"
|
|
19237
19314
|
}));
|
|
19238
19315
|
};
|
|
19239
19316
|
|
|
19317
|
+
/**
|
|
19318
|
+
* Renders the title of a BaseTile component.
|
|
19319
|
+
*
|
|
19320
|
+
* @returns {JSX.Element|null} The rendered title or null if conditions for display are not met
|
|
19321
|
+
*/
|
|
19240
19322
|
var BaseTileTitle = function () {
|
|
19241
|
-
var
|
|
19242
|
-
var
|
|
19243
|
-
var
|
|
19244
|
-
|
|
19245
|
-
|
|
19246
|
-
|
|
19247
|
-
|
|
19323
|
+
var _a, _b;
|
|
19324
|
+
var tileContext = useTileContext();
|
|
19325
|
+
var sdk = useWllSdk();
|
|
19326
|
+
if (!tileContext || !tileContext.configuration || !sdk) return null;
|
|
19327
|
+
var config = tileContext.configuration;
|
|
19328
|
+
var title = config.title,
|
|
19329
|
+
_c = config.ctaLink,
|
|
19330
|
+
ctaLink = _c === void 0 ? '' : _c,
|
|
19331
|
+
artworkUrl = config.artworkUrl;
|
|
19332
|
+
var sizeInfo = useTileSize(tileContext);
|
|
19333
|
+
if (!sizeInfo) return null;
|
|
19334
|
+
var isHalfSize = sizeInfo.isHalfSize;
|
|
19248
19335
|
// Don't show title for half tiles with image
|
|
19249
19336
|
if (isHalfSize && artworkUrl || !title) return null;
|
|
19250
19337
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, {
|
|
19251
19338
|
variant: "title",
|
|
19339
|
+
accessibilityRole: "header",
|
|
19252
19340
|
accessibilityLabel: title,
|
|
19253
19341
|
numberOfLines: 1,
|
|
19254
19342
|
testID: "tile-title"
|
|
19255
19343
|
}, title), ctaLink && /*#__PURE__*/React.createElement(Icon, {
|
|
19256
19344
|
name: "ChevronRight",
|
|
19257
|
-
color: theme.derivedSurfaceText[20]
|
|
19345
|
+
color: (_b = (_a = sdk.theme) === null || _a === void 0 ? void 0 : _a.derivedSurfaceText) === null || _b === void 0 ? void 0 : _b[20],
|
|
19346
|
+
accessibilityLabel: "View details"
|
|
19258
19347
|
}));
|
|
19259
19348
|
};
|
|
19260
19349
|
|
|
@@ -19264,6 +19353,9 @@ var BaseTileTitle = function () {
|
|
|
19264
19353
|
var TileContext = /*#__PURE__*/React.createContext(null);
|
|
19265
19354
|
/**
|
|
19266
19355
|
* Custom hook to access the TileContext.
|
|
19356
|
+
*
|
|
19357
|
+
* @returns {Tile} The current tile from context
|
|
19358
|
+
* @throws {Error} If used outside of a BaseTile
|
|
19267
19359
|
*/
|
|
19268
19360
|
var useTileContext = function () {
|
|
19269
19361
|
var context = React.useContext(TileContext);
|
|
@@ -19274,19 +19366,27 @@ var useTileContext = function () {
|
|
|
19274
19366
|
};
|
|
19275
19367
|
/**
|
|
19276
19368
|
* BaseTileContainer component to handle layout and pressable behavior.
|
|
19369
|
+
*
|
|
19370
|
+
* @param {BaseTileRootProps} props - Component props
|
|
19371
|
+
* @returns {JSX.Element} The rendered BaseTileContainer
|
|
19277
19372
|
*/
|
|
19278
19373
|
var BaseTileContainer = function (_a) {
|
|
19279
19374
|
var children = _a.children,
|
|
19280
19375
|
style = _a.style;
|
|
19281
19376
|
var tile = useTileContext();
|
|
19282
|
-
var
|
|
19283
|
-
var
|
|
19377
|
+
var sdk = useWllSdk();
|
|
19378
|
+
var sizeInfo = useTileSize(tile);
|
|
19379
|
+
var isHalfSize = (sizeInfo === null || sizeInfo === void 0 ? void 0 : sizeInfo.isHalfSize) || false;
|
|
19284
19380
|
var _b = tile.configuration,
|
|
19285
|
-
|
|
19381
|
+
_c = _b.ctaLink,
|
|
19382
|
+
ctaLink = _c === void 0 ? '' : _c,
|
|
19286
19383
|
ctaLinkTarget = _b.ctaLinkTarget,
|
|
19287
|
-
|
|
19384
|
+
_d = _b.title,
|
|
19385
|
+
title = _d === void 0 ? 'Tile' : _d;
|
|
19386
|
+
var theme = (sdk === null || sdk === void 0 ? void 0 : sdk.theme) || {
|
|
19387
|
+
surface: '#ffffff'
|
|
19388
|
+
};
|
|
19288
19389
|
var handlePress = useHandleTilePress(tile, ctaLink, ctaLinkTarget);
|
|
19289
|
-
// Dynamic layout and styles
|
|
19290
19390
|
var layout = {
|
|
19291
19391
|
flexDirection: 'column',
|
|
19292
19392
|
justifyContent: isHalfSize ? 'center' : 'flex-start',
|
|
@@ -19304,19 +19404,32 @@ var BaseTileContainer = function (_a) {
|
|
|
19304
19404
|
onPress: handlePress,
|
|
19305
19405
|
disabled: tile.type !== 'REWARD' && tile.type !== 'REWARD_CATEGORY' && !ctaLink,
|
|
19306
19406
|
accessible: true,
|
|
19307
|
-
|
|
19308
|
-
accessibilityLabel: "".concat(title).concat(ctaLink ? ' - Click to open' : '')
|
|
19407
|
+
accessibilityRole: "button",
|
|
19408
|
+
accessibilityLabel: "".concat(title).concat(ctaLink ? ' - Click to open' : ''),
|
|
19409
|
+
accessibilityState: {
|
|
19410
|
+
disabled: !ctaLink
|
|
19411
|
+
}
|
|
19309
19412
|
}, children);
|
|
19310
19413
|
};
|
|
19311
19414
|
/**
|
|
19312
19415
|
* BaseTileRoot component to provide context and render children.
|
|
19416
|
+
*
|
|
19417
|
+
* @param {BaseTileProps} props - Component props
|
|
19418
|
+
* @returns {JSX.Element|null} The rendered BaseTileRoot or null if no tile is provided
|
|
19313
19419
|
*/
|
|
19314
19420
|
var BaseTileRoot = function (_a) {
|
|
19315
19421
|
var tile = _a.tile,
|
|
19316
|
-
children = _a.children
|
|
19422
|
+
children = _a.children,
|
|
19423
|
+
style = _a.style;
|
|
19424
|
+
if (!tile) {
|
|
19425
|
+
console.warn('BaseTile: No tile provided');
|
|
19426
|
+
return null;
|
|
19427
|
+
}
|
|
19317
19428
|
return /*#__PURE__*/React.createElement(TileContext.Provider, {
|
|
19318
19429
|
value: tile
|
|
19319
|
-
}, /*#__PURE__*/React.createElement(BaseTile.Container,
|
|
19430
|
+
}, /*#__PURE__*/React.createElement(BaseTile.Container, {
|
|
19431
|
+
style: style
|
|
19432
|
+
}, children));
|
|
19320
19433
|
};
|
|
19321
19434
|
/**
|
|
19322
19435
|
* BaseTile component with subcomponents attached.
|
|
@@ -19555,6 +19668,12 @@ function withTileFetching(WrappedComponent) {
|
|
|
19555
19668
|
};
|
|
19556
19669
|
}
|
|
19557
19670
|
|
|
19671
|
+
/**
|
|
19672
|
+
* Custom hook that returns the styles for the BadgeTile component.
|
|
19673
|
+
* Applies responsive styling based on the current device.
|
|
19674
|
+
*
|
|
19675
|
+
* @returns StyleSheet styles for the BadgeTile component
|
|
19676
|
+
*/
|
|
19558
19677
|
var useBadgeTileStyles = function () {
|
|
19559
19678
|
var _a = useResponsive$1(),
|
|
19560
19679
|
isDesktop = _a.isDesktop,
|
|
@@ -19603,16 +19722,22 @@ var useBadgeTileStyles = function () {
|
|
|
19603
19722
|
});
|
|
19604
19723
|
};
|
|
19605
19724
|
|
|
19725
|
+
/**
|
|
19726
|
+
* Renders the date earned for a Badge Tile.
|
|
19727
|
+
*
|
|
19728
|
+
* @returns JSX.Element or null if badge is not earned or badgeNotEarnedMessage exists
|
|
19729
|
+
*/
|
|
19606
19730
|
var BadgeTileDateEarned = function () {
|
|
19607
19731
|
var styles = useBadgeTileStyles();
|
|
19608
|
-
var
|
|
19609
|
-
var configuration = tile.configuration;
|
|
19610
|
-
var count = configuration.count,
|
|
19611
|
-
awardedDatePrefix = configuration.awardedDatePrefix,
|
|
19612
|
-
createdAt = configuration.createdAt,
|
|
19613
|
-
badgeNotEarnedMessage = configuration.badgeNotEarnedMessage,
|
|
19614
|
-
type = configuration.type;
|
|
19732
|
+
var tileContext = useTileContext();
|
|
19615
19733
|
var theme = useWllSdk().theme;
|
|
19734
|
+
if (!isContextValid(tileContext)) return null;
|
|
19735
|
+
var _a = tileContext.configuration,
|
|
19736
|
+
count = _a.count,
|
|
19737
|
+
awardedDatePrefix = _a.awardedDatePrefix,
|
|
19738
|
+
createdAt = _a.createdAt,
|
|
19739
|
+
badgeNotEarnedMessage = _a.badgeNotEarnedMessage,
|
|
19740
|
+
type = _a.type;
|
|
19616
19741
|
// Don't show for Latest type with count=0
|
|
19617
19742
|
if (type === exports.BadgeTileType.Latest && count === 0) {
|
|
19618
19743
|
return null;
|
|
@@ -19645,12 +19770,18 @@ var BadgeTileDateEarned = function () {
|
|
|
19645
19770
|
}, displayText));
|
|
19646
19771
|
};
|
|
19647
19772
|
|
|
19773
|
+
/**
|
|
19774
|
+
* Renders the description for a Badge Tile.
|
|
19775
|
+
*
|
|
19776
|
+
* @returns JSX.Element or null if description is not present
|
|
19777
|
+
*/
|
|
19648
19778
|
var BadgeTileDescription = function () {
|
|
19649
|
-
var
|
|
19650
|
-
|
|
19651
|
-
var
|
|
19652
|
-
|
|
19653
|
-
|
|
19779
|
+
var tileContext = useTileContext();
|
|
19780
|
+
if (!isContextValid(tileContext)) return null;
|
|
19781
|
+
var _a = tileContext.configuration,
|
|
19782
|
+
count = _a.count,
|
|
19783
|
+
description = _a.description,
|
|
19784
|
+
type = _a.type;
|
|
19654
19785
|
if (!description) return null;
|
|
19655
19786
|
// For Latest type, hide description when count = 0
|
|
19656
19787
|
// For Specific type, always show description
|
|
@@ -19668,18 +19799,24 @@ var BadgeTileDescription = function () {
|
|
|
19668
19799
|
}, description));
|
|
19669
19800
|
};
|
|
19670
19801
|
|
|
19802
|
+
/**
|
|
19803
|
+
* Renders the media for a Badge Tile.
|
|
19804
|
+
*
|
|
19805
|
+
* @returns JSX.Element or null if media is not present
|
|
19806
|
+
*/
|
|
19671
19807
|
var BadgeTileMedia = function (_a) {
|
|
19672
19808
|
var children = _a.children,
|
|
19673
19809
|
alt = _a.alt,
|
|
19674
19810
|
props = __rest(_a, ["children", "alt"]);
|
|
19675
19811
|
var styles = useBadgeTileStyles();
|
|
19676
|
-
var
|
|
19677
|
-
|
|
19678
|
-
var
|
|
19679
|
-
|
|
19680
|
-
|
|
19681
|
-
|
|
19682
|
-
|
|
19812
|
+
var tileContext = useTileContext();
|
|
19813
|
+
if (!isContextValid(tileContext)) return null;
|
|
19814
|
+
var _b = tileContext.configuration,
|
|
19815
|
+
count = _b.count,
|
|
19816
|
+
artworkUrl = _b.artworkUrl,
|
|
19817
|
+
emptyBadgeArtworkUrl = _b.emptyBadgeArtworkUrl,
|
|
19818
|
+
type = _b.type,
|
|
19819
|
+
name = _b.name;
|
|
19683
19820
|
var displayUrl = type === exports.BadgeTileType.Specific ? artworkUrl : count === 0 ? emptyBadgeArtworkUrl : artworkUrl;
|
|
19684
19821
|
if (!displayUrl) return null;
|
|
19685
19822
|
return /*#__PURE__*/React.createElement(View$2, {
|
|
@@ -19696,12 +19833,18 @@ var BadgeTileMedia = function (_a) {
|
|
|
19696
19833
|
})), children);
|
|
19697
19834
|
};
|
|
19698
19835
|
|
|
19836
|
+
/**
|
|
19837
|
+
* Renders the status for a Badge Tile.
|
|
19838
|
+
*
|
|
19839
|
+
* @returns JSX.Element or null if badge is not earned or badgeNotEarnedMessage exists
|
|
19840
|
+
*/
|
|
19699
19841
|
var BadgeTileStatus = function () {
|
|
19700
19842
|
var styles = useBadgeTileStyles();
|
|
19701
|
-
var
|
|
19702
|
-
|
|
19703
|
-
var
|
|
19704
|
-
|
|
19843
|
+
var tileContext = useTileContext();
|
|
19844
|
+
if (!isContextValid(tileContext)) return null;
|
|
19845
|
+
var _a = tileContext.configuration,
|
|
19846
|
+
count = _a.count,
|
|
19847
|
+
type = _a.type;
|
|
19705
19848
|
if (type !== exports.BadgeTileType.Specific || count === 1) {
|
|
19706
19849
|
return null;
|
|
19707
19850
|
}
|
|
@@ -19725,14 +19868,20 @@ var BadgeTileStatus = function () {
|
|
|
19725
19868
|
}, count, "x"));
|
|
19726
19869
|
};
|
|
19727
19870
|
|
|
19871
|
+
/**
|
|
19872
|
+
* Renders the title for a Badge Tile.
|
|
19873
|
+
*
|
|
19874
|
+
* @returns JSX.Element or null if name is not present
|
|
19875
|
+
*/
|
|
19728
19876
|
var BadgeTileTitle = function () {
|
|
19729
19877
|
var styles = useBadgeTileStyles();
|
|
19730
|
-
var
|
|
19731
|
-
|
|
19732
|
-
var
|
|
19733
|
-
|
|
19734
|
-
|
|
19735
|
-
|
|
19878
|
+
var tileContext = useTileContext();
|
|
19879
|
+
if (!isContextValid(tileContext)) return null;
|
|
19880
|
+
var _a = tileContext.configuration,
|
|
19881
|
+
count = _a.count,
|
|
19882
|
+
name = _a.name,
|
|
19883
|
+
emptyBadgeMessage = _a.emptyBadgeMessage,
|
|
19884
|
+
type = _a.type;
|
|
19736
19885
|
var displayText = type === exports.BadgeTileType.Specific ? name : count === 0 ? emptyBadgeMessage : name;
|
|
19737
19886
|
if (!displayText) return null;
|
|
19738
19887
|
return /*#__PURE__*/React.createElement(View$2, {
|
|
@@ -19751,7 +19900,7 @@ var BadgeTileTitle = function () {
|
|
|
19751
19900
|
|
|
19752
19901
|
/**
|
|
19753
19902
|
* The main BadgeTile component.
|
|
19754
|
-
*
|
|
19903
|
+
* @returns JSX.Element or null if tile is not active or tileHeight is not full.
|
|
19755
19904
|
* This component renders a badge tile with optional media, status, title, description, and date earned.
|
|
19756
19905
|
*/
|
|
19757
19906
|
var BadgeTileRoot = function (_a) {
|
|
@@ -19776,15 +19925,23 @@ var BadgeTile = Object.assign(BadgeTileRoot, {
|
|
|
19776
19925
|
});
|
|
19777
19926
|
var BadgeTile$1 = withTileFetching(BadgeTile);
|
|
19778
19927
|
|
|
19928
|
+
/**
|
|
19929
|
+
* Renders the call to action of a Banner Tile.
|
|
19930
|
+
*
|
|
19931
|
+
* @returns JSX.Element or null if no text or required props are present
|
|
19932
|
+
*/
|
|
19779
19933
|
var BannerTileCTA = function () {
|
|
19780
|
-
var
|
|
19781
|
-
|
|
19782
|
-
|
|
19783
|
-
|
|
19934
|
+
var bannerContext = useBannerContext();
|
|
19935
|
+
if (!isContextValid(bannerContext)) return null;
|
|
19936
|
+
var _a = bannerContext.configuration,
|
|
19937
|
+
_b = _a.ctaText,
|
|
19938
|
+
ctaText = _b === void 0 ? '' : _b,
|
|
19939
|
+
_c = _a.ctaLink,
|
|
19940
|
+
ctaLink = _c === void 0 ? '' : _c,
|
|
19784
19941
|
ctaLinkTarget = _a.ctaLinkTarget;
|
|
19785
|
-
|
|
19786
|
-
|
|
19787
|
-
var hint = ctaLinkTarget ===
|
|
19942
|
+
if (!ctaText || !ctaLink) return null;
|
|
19943
|
+
var handlePress = useHandleTilePress(bannerContext, ctaLink, ctaLinkTarget);
|
|
19944
|
+
var hint = ctaLink ? ctaLinkTarget === exports.CTALinkTarget.newWindow ? "Opens ".concat(ctaLink, " in a new window") : "Takes you to ".concat(ctaLink) : '';
|
|
19788
19945
|
return /*#__PURE__*/React.createElement(Button, {
|
|
19789
19946
|
testID: "banner-tile-cta",
|
|
19790
19947
|
title: ctaText,
|
|
@@ -19794,6 +19951,12 @@ var BannerTileCTA = function () {
|
|
|
19794
19951
|
});
|
|
19795
19952
|
};
|
|
19796
19953
|
|
|
19954
|
+
/**
|
|
19955
|
+
* Custom hook that returns the styles for the BannerTile component.
|
|
19956
|
+
* Applies responsive styling based on the current device.
|
|
19957
|
+
*
|
|
19958
|
+
* @returns StyleSheet styles for the BannerTile component
|
|
19959
|
+
*/
|
|
19797
19960
|
var useBannerTileStyles = function () {
|
|
19798
19961
|
var _a = useResponsive$1(),
|
|
19799
19962
|
isDesktop = _a.isDesktop,
|
|
@@ -19830,42 +19993,45 @@ var useBannerTileStyles = function () {
|
|
|
19830
19993
|
});
|
|
19831
19994
|
};
|
|
19832
19995
|
|
|
19996
|
+
/**
|
|
19997
|
+
* Renders the description text of a Banner Tile.
|
|
19998
|
+
*
|
|
19999
|
+
* @returns JSX.Element or null if no description is present
|
|
20000
|
+
*/
|
|
19833
20001
|
var BannerTileDescription = function () {
|
|
19834
20002
|
var styles = useBannerTileStyles();
|
|
19835
|
-
var
|
|
19836
|
-
|
|
19837
|
-
var
|
|
20003
|
+
var bannerContext = useBannerContext();
|
|
20004
|
+
if (!isContextValid(bannerContext)) return null;
|
|
20005
|
+
var description = bannerContext.configuration.description;
|
|
19838
20006
|
if (!description) return null;
|
|
19839
|
-
return /*#__PURE__*/React.createElement(
|
|
19840
|
-
|
|
20007
|
+
return /*#__PURE__*/React.createElement(Text, {
|
|
20008
|
+
style: styles.description,
|
|
20009
|
+
accessibilityRole: "text",
|
|
19841
20010
|
accessibilityLabel: description,
|
|
19842
20011
|
testID: "banner-tile-description"
|
|
19843
|
-
},
|
|
19844
|
-
style: [styles.description, {
|
|
19845
|
-
color: theme.derivedSurfaceText[20]
|
|
19846
|
-
}],
|
|
19847
|
-
accessibilityElementsHidden: true,
|
|
19848
|
-
importantForAccessibility: "no-hide-descendants"
|
|
19849
|
-
}, description));
|
|
20012
|
+
}, description);
|
|
19850
20013
|
};
|
|
19851
20014
|
|
|
20015
|
+
/**
|
|
20016
|
+
* Renders the media of a Banner Tile.
|
|
20017
|
+
*
|
|
20018
|
+
* @returns JSX.Element or null if no media is present
|
|
20019
|
+
*/
|
|
19852
20020
|
var BannerTileMedia = function (_a) {
|
|
19853
20021
|
var isArtworkOnly = _a.isArtworkOnly;
|
|
19854
20022
|
var styles = useBannerTileStyles();
|
|
19855
|
-
var
|
|
19856
|
-
|
|
20023
|
+
var bannerContext = useBannerContext();
|
|
20024
|
+
if (!isContextValid(bannerContext)) return null;
|
|
20025
|
+
var _b = bannerContext.configuration,
|
|
19857
20026
|
artworkUrl = _b.artworkUrl,
|
|
19858
20027
|
title = _b.title;
|
|
19859
20028
|
if (!artworkUrl) return null;
|
|
19860
20029
|
var containerStyle = {
|
|
19861
20030
|
width: isArtworkOnly ? '100%' : '30%'
|
|
19862
20031
|
};
|
|
19863
|
-
return /*#__PURE__*/React.createElement(View$2
|
|
19864
|
-
// @ts-ignore: We are using percentage values for width, which is valid in React Native but TypeScript expects a number.
|
|
19865
|
-
, {
|
|
20032
|
+
return /*#__PURE__*/React.createElement(View$2, {
|
|
19866
20033
|
style: [styles.mediaContainer, containerStyle],
|
|
19867
|
-
|
|
19868
|
-
role: "img",
|
|
20034
|
+
accessibilityRole: "image",
|
|
19869
20035
|
accessibilityLabel: "Banner image".concat(title ? " for ".concat(title) : ''),
|
|
19870
20036
|
testID: "banner-tile-media"
|
|
19871
20037
|
}, /*#__PURE__*/React.createElement(ProgressiveImage, {
|
|
@@ -19873,27 +20039,28 @@ var BannerTileMedia = function (_a) {
|
|
|
19873
20039
|
uri: artworkUrl
|
|
19874
20040
|
},
|
|
19875
20041
|
style: styles.media,
|
|
19876
|
-
alt: "Banner image".concat(title ? " for ".concat(title) : '')
|
|
19877
|
-
accessibilityElementsHidden: true,
|
|
19878
|
-
importantForAccessibility: "no-hide-descendants"
|
|
20042
|
+
alt: "Banner image".concat(title ? " for ".concat(title) : '')
|
|
19879
20043
|
}));
|
|
19880
20044
|
};
|
|
19881
20045
|
|
|
20046
|
+
/**
|
|
20047
|
+
* Renders the title of a Banner Tile.
|
|
20048
|
+
*
|
|
20049
|
+
* @returns JSX.Element or null if no title is present
|
|
20050
|
+
*/
|
|
19882
20051
|
var BannerTileTitle = function () {
|
|
19883
20052
|
var styles = useBannerTileStyles();
|
|
19884
|
-
var
|
|
19885
|
-
|
|
20053
|
+
var bannerContext = useBannerContext();
|
|
20054
|
+
if (!isContextValid(bannerContext)) return null;
|
|
20055
|
+
var title = bannerContext.configuration.title;
|
|
19886
20056
|
if (!title) return null;
|
|
19887
|
-
return /*#__PURE__*/React.createElement(
|
|
19888
|
-
accessible: true,
|
|
19889
|
-
accessibilityLabel: title
|
|
19890
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
20057
|
+
return /*#__PURE__*/React.createElement(Text, {
|
|
19891
20058
|
variant: "title",
|
|
19892
20059
|
testID: "banner-tile-title",
|
|
19893
20060
|
style: styles.title,
|
|
19894
|
-
|
|
19895
|
-
|
|
19896
|
-
}, title)
|
|
20061
|
+
accessibilityRole: "header",
|
|
20062
|
+
accessibilityLabel: title
|
|
20063
|
+
}, title);
|
|
19897
20064
|
};
|
|
19898
20065
|
|
|
19899
20066
|
/**
|
|
@@ -19903,16 +20070,20 @@ var BannerTileTitle = function () {
|
|
|
19903
20070
|
* @returns `true` if the tile has no title, description, or CTA text.
|
|
19904
20071
|
*/
|
|
19905
20072
|
var isArtworkOnly$1 = function (configuration) {
|
|
20073
|
+
if (!configuration) return true;
|
|
19906
20074
|
return !configuration.title && !configuration.description && !configuration.ctaText;
|
|
19907
20075
|
};
|
|
19908
20076
|
/**
|
|
19909
20077
|
* The main BannerTile component.
|
|
19910
20078
|
*
|
|
19911
20079
|
* This component renders a banner tile with optional media, title, description, and CTA.
|
|
20080
|
+
*
|
|
20081
|
+
* @param {BannerTileProps} props - Component props
|
|
20082
|
+
* @returns {JSX.Element | null} Rendered component or null if tile is inactive
|
|
19912
20083
|
*/
|
|
19913
20084
|
var BannerTileRoot = function (_a) {
|
|
19914
20085
|
var tile = _a.tile;
|
|
19915
|
-
if (!tile || !tile.active) return null;
|
|
20086
|
+
if (!tile || !tile.active || !tile.configuration) return null;
|
|
19916
20087
|
var configuration = tile.configuration;
|
|
19917
20088
|
return /*#__PURE__*/React.createElement(BaseBanner, {
|
|
19918
20089
|
tile: tile
|
|
@@ -19940,6 +20111,12 @@ var ContentTileContainer = function (_a) {
|
|
|
19940
20111
|
return /*#__PURE__*/React.createElement(BaseTile.Container, null, children);
|
|
19941
20112
|
};
|
|
19942
20113
|
|
|
20114
|
+
/**
|
|
20115
|
+
* Custom hook that returns the styles for the ContentTile component.
|
|
20116
|
+
* Applies responsive styling based on the current device.
|
|
20117
|
+
*
|
|
20118
|
+
* @returns StyleSheet styles for the ContentTile component
|
|
20119
|
+
*/
|
|
19943
20120
|
var useContentTileStyles = function () {
|
|
19944
20121
|
var theme = useWllSdk().theme;
|
|
19945
20122
|
var _a = useResponsive$1(),
|
|
@@ -19966,8 +20143,9 @@ var ContentTileContent = function (_a) {
|
|
|
19966
20143
|
};
|
|
19967
20144
|
|
|
19968
20145
|
var ContentTileHeader = function () {
|
|
19969
|
-
var
|
|
19970
|
-
|
|
20146
|
+
var tileContext = useTileContext();
|
|
20147
|
+
if (!isContextValid(tileContext)) return null;
|
|
20148
|
+
var title = tileContext.configuration.title;
|
|
19971
20149
|
if (!title) return null;
|
|
19972
20150
|
return /*#__PURE__*/React.createElement(BaseTile.Header, null, /*#__PURE__*/React.createElement(BaseTile.Title, null));
|
|
19973
20151
|
};
|
|
@@ -20494,6 +20672,12 @@ var styles$1 = StyleSheet$1.create({
|
|
|
20494
20672
|
}
|
|
20495
20673
|
});
|
|
20496
20674
|
|
|
20675
|
+
/**
|
|
20676
|
+
* Custom hook that returns the styles for the Section component.
|
|
20677
|
+
* Applies responsive styling based on the current device.
|
|
20678
|
+
*
|
|
20679
|
+
* @returns StyleSheet styles for the Section component
|
|
20680
|
+
*/
|
|
20497
20681
|
var useSectionStyles = function () {
|
|
20498
20682
|
var _a = useResponsive$1(),
|
|
20499
20683
|
isDesktop = _a.isDesktop,
|
|
@@ -20515,9 +20699,13 @@ var useSectionStyles = function () {
|
|
|
20515
20699
|
var SectionContext = /*#__PURE__*/React.createContext(undefined);
|
|
20516
20700
|
/**
|
|
20517
20701
|
* Custom hook to fetch section data.
|
|
20702
|
+
*
|
|
20703
|
+
* @param {TSection} [section] - The section data if provided directly
|
|
20704
|
+
* @param {string} [sectionId] - The ID of the section to fetch
|
|
20705
|
+
* @returns {Object} Object containing section data, loading state, and any error
|
|
20518
20706
|
*/
|
|
20519
20707
|
var useSectionData = function (section, sectionId) {
|
|
20520
|
-
var
|
|
20708
|
+
var sdk = useWllSdk();
|
|
20521
20709
|
var _a = React.useState(section || null),
|
|
20522
20710
|
sectionData = _a[0],
|
|
20523
20711
|
setSectionData = _a[1];
|
|
@@ -20530,7 +20718,7 @@ var useSectionData = function (section, sectionId) {
|
|
|
20530
20718
|
React.useEffect(function () {
|
|
20531
20719
|
if (section) {
|
|
20532
20720
|
setSectionData(section);
|
|
20533
|
-
} else if (sectionId) {
|
|
20721
|
+
} else if (sectionId && sdk && sdk.getSectionByID) {
|
|
20534
20722
|
var fetchSection = function () {
|
|
20535
20723
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
20536
20724
|
var response, err_1;
|
|
@@ -20541,13 +20729,13 @@ var useSectionData = function (section, sectionId) {
|
|
|
20541
20729
|
_a.label = 1;
|
|
20542
20730
|
case 1:
|
|
20543
20731
|
_a.trys.push([1, 3, 4, 5]);
|
|
20544
|
-
return [4 /*yield*/, getSectionByID(sectionId)];
|
|
20732
|
+
return [4 /*yield*/, sdk.getSectionByID(sectionId)];
|
|
20545
20733
|
case 2:
|
|
20546
20734
|
response = _a.sent();
|
|
20547
|
-
if (response.status === 'success' && response.data) {
|
|
20735
|
+
if (response && response.status === 'success' && response.data) {
|
|
20548
20736
|
setSectionData(response.data);
|
|
20549
20737
|
} else {
|
|
20550
|
-
setError(response.error || 'Failed to fetch section data.');
|
|
20738
|
+
setError(response && response.error || 'Failed to fetch section data.');
|
|
20551
20739
|
}
|
|
20552
20740
|
return [3 /*break*/, 5];
|
|
20553
20741
|
case 3:
|
|
@@ -20565,7 +20753,7 @@ var useSectionData = function (section, sectionId) {
|
|
|
20565
20753
|
};
|
|
20566
20754
|
fetchSection();
|
|
20567
20755
|
}
|
|
20568
|
-
}, [section, sectionId,
|
|
20756
|
+
}, [section, sectionId, sdk]);
|
|
20569
20757
|
return {
|
|
20570
20758
|
sectionData: sectionData,
|
|
20571
20759
|
isLoading: isLoading,
|
|
@@ -20574,20 +20762,26 @@ var useSectionData = function (section, sectionId) {
|
|
|
20574
20762
|
};
|
|
20575
20763
|
/**
|
|
20576
20764
|
* Component to display an empty state with a message.
|
|
20765
|
+
*
|
|
20766
|
+
* @param {Object} props - Component props
|
|
20767
|
+
* @param {string} props.message - Message to display in the empty state
|
|
20768
|
+
* @returns {JSX.Element} The empty state component
|
|
20577
20769
|
*/
|
|
20578
20770
|
var EmptyState = function (_a) {
|
|
20579
20771
|
var message = _a.message;
|
|
20580
20772
|
return /*#__PURE__*/React.createElement(View$2, {
|
|
20581
20773
|
style: commonStyles.emptyContainer,
|
|
20582
|
-
|
|
20774
|
+
accessibilityRole: "text",
|
|
20583
20775
|
accessibilityLabel: "Empty state: ".concat(message)
|
|
20584
|
-
}, /*#__PURE__*/React.createElement(Text$3,
|
|
20585
|
-
accessibilityElementsHidden: true,
|
|
20586
|
-
importantForAccessibility: "no-hide-descendants"
|
|
20587
|
-
}, message));
|
|
20776
|
+
}, /*#__PURE__*/React.createElement(Text$3, null, message));
|
|
20588
20777
|
};
|
|
20589
20778
|
/**
|
|
20590
20779
|
* The Section component renders a section based on its type (e.g., Banner, Grid).
|
|
20780
|
+
*
|
|
20781
|
+
* @param {SectionProps} props - Component props
|
|
20782
|
+
* @param {TSection} [props.section] - The section data
|
|
20783
|
+
* @param {string} [props.sectionId] - The ID of the section to fetch
|
|
20784
|
+
* @returns {JSX.Element|null} The rendered section or null if invalid props
|
|
20591
20785
|
*/
|
|
20592
20786
|
var Section = function (_a) {
|
|
20593
20787
|
var section = _a.section,
|
|
@@ -20614,12 +20808,23 @@ var Section = function (_a) {
|
|
|
20614
20808
|
});
|
|
20615
20809
|
}
|
|
20616
20810
|
// Filter out inactive tiles before passing to child components
|
|
20617
|
-
var activeTiles = sortByPriority(sectionData.tiles.filter(function (tile) {
|
|
20618
|
-
return tile.active;
|
|
20811
|
+
var activeTiles = sectionData.tiles && sortByPriority(sectionData.tiles.filter(function (tile) {
|
|
20812
|
+
return tile && tile.active;
|
|
20619
20813
|
}));
|
|
20814
|
+
if (!activeTiles || activeTiles.length === 0) {
|
|
20815
|
+
return /*#__PURE__*/React.createElement(EmptyState, {
|
|
20816
|
+
message: "No active tiles available."
|
|
20817
|
+
});
|
|
20818
|
+
}
|
|
20620
20819
|
var sectionWithActiveTiles = __assign(__assign({}, sectionData), {
|
|
20621
20820
|
tiles: activeTiles
|
|
20622
20821
|
});
|
|
20822
|
+
if (!sectionData.type) {
|
|
20823
|
+
console.warn('Section is missing a type');
|
|
20824
|
+
return /*#__PURE__*/React.createElement(EmptyState, {
|
|
20825
|
+
message: "Invalid section configuration."
|
|
20826
|
+
});
|
|
20827
|
+
}
|
|
20623
20828
|
switch (sectionData.type) {
|
|
20624
20829
|
case exports.SectionType.Banner:
|
|
20625
20830
|
return /*#__PURE__*/React.createElement(Carousel, {
|
|
@@ -20643,13 +20848,21 @@ var Section = function (_a) {
|
|
|
20643
20848
|
}, /*#__PURE__*/React.createElement(View$2, {
|
|
20644
20849
|
style: styles.section,
|
|
20645
20850
|
accessible: true,
|
|
20646
|
-
|
|
20647
|
-
|
|
20648
|
-
"aria-description": sectionData.description || undefined
|
|
20851
|
+
accessibilityLabel: "Section: ".concat(sectionData.title || 'Untitled section'),
|
|
20852
|
+
accessibilityHint: sectionData.description || undefined
|
|
20649
20853
|
}, renderSectionContent())) : null;
|
|
20650
20854
|
};
|
|
20651
20855
|
|
|
20856
|
+
/**
|
|
20857
|
+
* Context for providing group data to child components
|
|
20858
|
+
*/
|
|
20652
20859
|
var GroupContext = /*#__PURE__*/React.createContext(undefined);
|
|
20860
|
+
/**
|
|
20861
|
+
* Custom hook to access the GroupContext
|
|
20862
|
+
*
|
|
20863
|
+
* @returns {GroupContextType} The group context data
|
|
20864
|
+
* @throws {Error} If used outside of a GroupProvider
|
|
20865
|
+
*/
|
|
20653
20866
|
var useGroupContext = function () {
|
|
20654
20867
|
var context = React.useContext(GroupContext);
|
|
20655
20868
|
if (!context) {
|
|
@@ -20657,9 +20870,14 @@ var useGroupContext = function () {
|
|
|
20657
20870
|
}
|
|
20658
20871
|
return context;
|
|
20659
20872
|
};
|
|
20660
|
-
|
|
20873
|
+
/**
|
|
20874
|
+
* Custom hook to fetch and manage group data
|
|
20875
|
+
*
|
|
20876
|
+
* @param {string} id - The ID of the group to fetch
|
|
20877
|
+
* @returns {Object} Object containing group data, loading state, and any error
|
|
20878
|
+
*/
|
|
20661
20879
|
var useGroupData = function (id) {
|
|
20662
|
-
var
|
|
20880
|
+
var sdk = useWllSdk();
|
|
20663
20881
|
var _a = React.useState(null),
|
|
20664
20882
|
groupData = _a[0],
|
|
20665
20883
|
setGroupData = _a[1];
|
|
@@ -20671,27 +20889,33 @@ var useGroupData = function (id) {
|
|
|
20671
20889
|
setIsLoading = _c[1];
|
|
20672
20890
|
var fetchGroup = React.useCallback(function () {
|
|
20673
20891
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
20674
|
-
var response;
|
|
20892
|
+
var response, err_1;
|
|
20675
20893
|
return __generator(this, function (_a) {
|
|
20676
20894
|
switch (_a.label) {
|
|
20677
20895
|
case 0:
|
|
20896
|
+
if (!id || !sdk || !sdk.getGroupByID) {
|
|
20897
|
+
setError('Unable to fetch group data: invalid configuration');
|
|
20898
|
+
setIsLoading(false);
|
|
20899
|
+
return [2 /*return*/];
|
|
20900
|
+
}
|
|
20678
20901
|
setIsLoading(true);
|
|
20679
20902
|
setError(null);
|
|
20680
20903
|
_a.label = 1;
|
|
20681
20904
|
case 1:
|
|
20682
20905
|
_a.trys.push([1, 3, 4, 5]);
|
|
20683
|
-
return [4 /*yield*/, getGroupByID(id)];
|
|
20906
|
+
return [4 /*yield*/, sdk.getGroupByID(id)];
|
|
20684
20907
|
case 2:
|
|
20685
20908
|
response = _a.sent();
|
|
20686
|
-
if (response.status === 'success' && response.data) {
|
|
20909
|
+
if (response && response.status === 'success' && response.data) {
|
|
20687
20910
|
setGroupData(response.data);
|
|
20688
20911
|
} else {
|
|
20689
|
-
setError(response.error || 'Failed to fetch group data.');
|
|
20912
|
+
setError(response && response.error || 'Failed to fetch group data.');
|
|
20690
20913
|
}
|
|
20691
20914
|
return [3 /*break*/, 5];
|
|
20692
20915
|
case 3:
|
|
20693
|
-
_a.sent();
|
|
20916
|
+
err_1 = _a.sent();
|
|
20694
20917
|
setError('Failed to fetch group data. Please try again later.');
|
|
20918
|
+
console.error('Error fetching group:', err_1);
|
|
20695
20919
|
return [3 /*break*/, 5];
|
|
20696
20920
|
case 4:
|
|
20697
20921
|
setIsLoading(false);
|
|
@@ -20701,7 +20925,7 @@ var useGroupData = function (id) {
|
|
|
20701
20925
|
}
|
|
20702
20926
|
});
|
|
20703
20927
|
});
|
|
20704
|
-
}, [id,
|
|
20928
|
+
}, [id, sdk]);
|
|
20705
20929
|
React.useEffect(function () {
|
|
20706
20930
|
fetchGroup();
|
|
20707
20931
|
}, [fetchGroup]);
|
|
@@ -20711,6 +20935,55 @@ var useGroupData = function (id) {
|
|
|
20711
20935
|
error: error
|
|
20712
20936
|
};
|
|
20713
20937
|
};
|
|
20938
|
+
/**
|
|
20939
|
+
* Component to display an empty state with a message
|
|
20940
|
+
*
|
|
20941
|
+
* @param {GroupEmptyStateProps} props - Component props
|
|
20942
|
+
* @param {string} props.message - Message to display
|
|
20943
|
+
* @returns {JSX.Element} The empty state component
|
|
20944
|
+
*/
|
|
20945
|
+
var GroupEmptyState = function (_a) {
|
|
20946
|
+
var message = _a.message;
|
|
20947
|
+
return /*#__PURE__*/React.createElement(View$2, {
|
|
20948
|
+
style: commonStyles.emptyContainer,
|
|
20949
|
+
accessible: true,
|
|
20950
|
+
accessibilityLabel: "Empty state: ".concat(message)
|
|
20951
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
20952
|
+
variant: "body"
|
|
20953
|
+
}, message));
|
|
20954
|
+
};
|
|
20955
|
+
/**
|
|
20956
|
+
* Component to render all sections in a group
|
|
20957
|
+
*
|
|
20958
|
+
* @returns {JSX.Element} The sections component
|
|
20959
|
+
*/
|
|
20960
|
+
var GroupSections = function () {
|
|
20961
|
+
var groupData = useGroupContext().groupData;
|
|
20962
|
+
if (!groupData || !groupData.sections || groupData.sections.length === 0) {
|
|
20963
|
+
return /*#__PURE__*/React.createElement(GroupEmptyState, {
|
|
20964
|
+
message: "This group doesn't have any sections"
|
|
20965
|
+
});
|
|
20966
|
+
}
|
|
20967
|
+
// Filter out inactive sections and null/undefined values before sorting
|
|
20968
|
+
var activeSections = groupData.sections.filter(function (section) {
|
|
20969
|
+
return section && section.active;
|
|
20970
|
+
});
|
|
20971
|
+
if (activeSections.length === 0) {
|
|
20972
|
+
return /*#__PURE__*/React.createElement(GroupEmptyState, {
|
|
20973
|
+
message: "This group doesn't have any active sections"
|
|
20974
|
+
});
|
|
20975
|
+
}
|
|
20976
|
+
var sortedSections = sortByPriority(activeSections);
|
|
20977
|
+
return /*#__PURE__*/React.createElement(View$2, {
|
|
20978
|
+
accessible: true,
|
|
20979
|
+
accessibilityLabel: "Group: ".concat(groupData.name || 'Unnamed group')
|
|
20980
|
+
}, sortedSections.map(function (section) {
|
|
20981
|
+
return /*#__PURE__*/React.createElement(Section, {
|
|
20982
|
+
key: section.id,
|
|
20983
|
+
section: section
|
|
20984
|
+
});
|
|
20985
|
+
}));
|
|
20986
|
+
};
|
|
20714
20987
|
/**
|
|
20715
20988
|
* A page-level component that represents a Group view in the application.
|
|
20716
20989
|
*
|
|
@@ -20719,18 +20992,25 @@ var useGroupData = function (id) {
|
|
|
20719
20992
|
* loading, errors, and empty states, providing a complete page experience for
|
|
20720
20993
|
* viewing group content.
|
|
20721
20994
|
*
|
|
20722
|
-
* @param
|
|
20995
|
+
* @param {GroupProps} props - Component props
|
|
20996
|
+
* @param {string} props.id - The unique identifier of the group to fetch and display
|
|
20997
|
+
* @returns {JSX.Element|null} The rendered group or null if invalid ID
|
|
20723
20998
|
*/
|
|
20724
20999
|
var Group = function (_a) {
|
|
20725
21000
|
var id = _a.id;
|
|
20726
|
-
if (!id)
|
|
21001
|
+
if (!id) {
|
|
21002
|
+
console.warn('Group component requires id prop');
|
|
21003
|
+
return null;
|
|
21004
|
+
}
|
|
20727
21005
|
var _b = useGroupData(id),
|
|
20728
21006
|
groupData = _b.groupData,
|
|
20729
21007
|
isLoading = _b.isLoading,
|
|
20730
21008
|
error = _b.error;
|
|
20731
21009
|
if (isLoading) {
|
|
20732
21010
|
return /*#__PURE__*/React.createElement(View$2, {
|
|
20733
|
-
style: commonStyles.emptyContainer
|
|
21011
|
+
style: commonStyles.emptyContainer,
|
|
21012
|
+
accessible: true,
|
|
21013
|
+
accessibilityLabel: "Loading group data"
|
|
20734
21014
|
}, /*#__PURE__*/React.createElement(Skeleton, null));
|
|
20735
21015
|
}
|
|
20736
21016
|
if (error || !groupData) {
|
|
@@ -20746,33 +21026,6 @@ var Group = function (_a) {
|
|
|
20746
21026
|
"data-testid": "group-container"
|
|
20747
21027
|
}, /*#__PURE__*/React.createElement(GroupSections, null)));
|
|
20748
21028
|
};
|
|
20749
|
-
var GroupSections = function () {
|
|
20750
|
-
var groupData = useGroupContext().groupData;
|
|
20751
|
-
if (!groupData.sections || groupData.sections.length === 0) {
|
|
20752
|
-
return /*#__PURE__*/React.createElement(GroupEmptyState, {
|
|
20753
|
-
message: "This group doesn't have any sections"
|
|
20754
|
-
});
|
|
20755
|
-
}
|
|
20756
|
-
// Filter out inactive sections before sorting
|
|
20757
|
-
var activeSections = groupData.sections.filter(function (section) {
|
|
20758
|
-
return section.active;
|
|
20759
|
-
});
|
|
20760
|
-
var sortedSections = sortByPriority(activeSections);
|
|
20761
|
-
return /*#__PURE__*/React.createElement(View$2, null, sortedSections.map(function (section) {
|
|
20762
|
-
return /*#__PURE__*/React.createElement(Section, {
|
|
20763
|
-
key: section.id,
|
|
20764
|
-
section: section
|
|
20765
|
-
});
|
|
20766
|
-
}));
|
|
20767
|
-
};
|
|
20768
|
-
var GroupEmptyState = function (_a) {
|
|
20769
|
-
var message = _a.message;
|
|
20770
|
-
return /*#__PURE__*/React.createElement(View$2, {
|
|
20771
|
-
style: commonStyles.emptyContainer
|
|
20772
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
20773
|
-
variant: "body"
|
|
20774
|
-
}, message));
|
|
20775
|
-
};
|
|
20776
21029
|
|
|
20777
21030
|
/**
|
|
20778
21031
|
* Cleans up a number by removing any whitespace and ensuring it's a valid number
|
|
@@ -20980,6 +21233,12 @@ var Spacer = function (_a) {
|
|
|
20980
21233
|
}, rest));
|
|
20981
21234
|
};
|
|
20982
21235
|
|
|
21236
|
+
/**
|
|
21237
|
+
* Custom hook that returns the styles for the PointsTile component.
|
|
21238
|
+
* Applies responsive styling based on the current device.
|
|
21239
|
+
*
|
|
21240
|
+
* @returns StyleSheet styles for the PointsTile component
|
|
21241
|
+
*/
|
|
20983
21242
|
var usePointsTileStyles = function (isFullSize) {
|
|
20984
21243
|
var _a = useResponsive$1(),
|
|
20985
21244
|
isDesktop = _a.isDesktop,
|
|
@@ -21023,23 +21282,30 @@ var usePointsTileStyles = function (isFullSize) {
|
|
|
21023
21282
|
});
|
|
21024
21283
|
};
|
|
21025
21284
|
|
|
21285
|
+
/**
|
|
21286
|
+
* Renders formatted points value for a Points Tile.
|
|
21287
|
+
*
|
|
21288
|
+
* @returns JSX.Element or null if points are undefined or zero
|
|
21289
|
+
*/
|
|
21026
21290
|
var PointsTileFormattedPoints = function () {
|
|
21027
21291
|
var styles = usePointsTileStyles();
|
|
21028
|
-
var
|
|
21029
|
-
|
|
21292
|
+
var tileContext = useTileContext();
|
|
21293
|
+
if (!isContextValid(tileContext)) return null;
|
|
21294
|
+
var _a = tileContext.configuration,
|
|
21030
21295
|
_b = _a.pointsMultiplier,
|
|
21031
21296
|
pointsMultiplier = _b === void 0 ? 1 : _b,
|
|
21032
21297
|
_c = _a.pointsPrefix,
|
|
21033
21298
|
pointsPrefix = _c === void 0 ? '' : _c,
|
|
21034
21299
|
_d = _a.pointsSuffix,
|
|
21035
21300
|
pointsSuffix = _d === void 0 ? 'pts' : _d,
|
|
21036
|
-
|
|
21301
|
+
_e = _a.points,
|
|
21302
|
+
points = _e === void 0 ? 0 : _e;
|
|
21037
21303
|
if (points === undefined || points === 0) return null;
|
|
21038
21304
|
var calculatedPoints = applyMultiplier(points, pointsMultiplier);
|
|
21039
|
-
var fullPointsText = "".concat(pointsPrefix).concat(calculatedPoints, " ").concat(pointsSuffix);
|
|
21305
|
+
var fullPointsText = "".concat(pointsPrefix).concat(calculatedPoints, " ").concat(pointsSuffix).trim();
|
|
21040
21306
|
return /*#__PURE__*/React.createElement(View$2, {
|
|
21041
21307
|
testID: "points-tile-points",
|
|
21042
|
-
|
|
21308
|
+
accessibilityRole: "text",
|
|
21043
21309
|
accessibilityLabel: "Points value: ".concat(fullPointsText)
|
|
21044
21310
|
}, /*#__PURE__*/React.createElement(Row, {
|
|
21045
21311
|
align: "center",
|
|
@@ -21057,55 +21323,64 @@ var PointsTileFormattedPoints = function () {
|
|
|
21057
21323
|
}, pointsSuffix) : null));
|
|
21058
21324
|
};
|
|
21059
21325
|
|
|
21326
|
+
/**
|
|
21327
|
+
* Renders the media of a Points Tile.
|
|
21328
|
+
*
|
|
21329
|
+
* @returns JSX.Element or null if media is not present
|
|
21330
|
+
*/
|
|
21060
21331
|
var PointsTileMedia = function (_a) {
|
|
21061
21332
|
var isFullSize = _a.isFullSize;
|
|
21062
|
-
var
|
|
21063
|
-
|
|
21333
|
+
var tileContext = useTileContext();
|
|
21334
|
+
if (!isContextValid(tileContext)) return null;
|
|
21335
|
+
var _b = tileContext.configuration,
|
|
21064
21336
|
artworkUrl = _b.artworkUrl,
|
|
21065
|
-
|
|
21337
|
+
_c = _b.title,
|
|
21338
|
+
title = _c === void 0 ? 'Points' : _c;
|
|
21066
21339
|
var styles = usePointsTileStyles(isFullSize);
|
|
21067
21340
|
if (!artworkUrl) return null;
|
|
21068
21341
|
return /*#__PURE__*/React.createElement(View$2, {
|
|
21069
21342
|
testID: "points-tile-media",
|
|
21070
|
-
|
|
21071
|
-
|
|
21072
|
-
|
|
21343
|
+
style: styles.imageContainer,
|
|
21344
|
+
accessibilityRole: "image",
|
|
21345
|
+
accessibilityLabel: "Points tile image for ".concat(title)
|
|
21073
21346
|
}, /*#__PURE__*/React.createElement(Image$2, {
|
|
21074
21347
|
source: {
|
|
21075
21348
|
uri: artworkUrl
|
|
21076
21349
|
},
|
|
21077
21350
|
style: styles.image,
|
|
21078
|
-
resizeMode: isFullSize ? 'cover' : 'contain'
|
|
21079
|
-
accessibilityElementsHidden: true,
|
|
21080
|
-
accessibilityLabel: "Points tile image for ".concat(title),
|
|
21081
|
-
importantForAccessibility: "no-hide-descendants"
|
|
21351
|
+
resizeMode: isFullSize ? 'cover' : 'contain'
|
|
21082
21352
|
}));
|
|
21083
21353
|
};
|
|
21084
21354
|
|
|
21355
|
+
/**
|
|
21356
|
+
* Renders the title of a Points Tile.
|
|
21357
|
+
*
|
|
21358
|
+
* @returns JSX.Element or null if no title is present
|
|
21359
|
+
*/
|
|
21085
21360
|
var PointsTileTitle = function () {
|
|
21086
|
-
var
|
|
21087
|
-
|
|
21361
|
+
var tileContext = useTileContext();
|
|
21362
|
+
if (!isContextValid(tileContext)) return null;
|
|
21363
|
+
var title = tileContext.configuration.title;
|
|
21088
21364
|
if (!title) return null;
|
|
21089
|
-
return /*#__PURE__*/React.createElement(
|
|
21090
|
-
testID: "points-tile-title",
|
|
21091
|
-
accessible: true,
|
|
21092
|
-
accessibilityLabel: title,
|
|
21093
|
-
role: "banner"
|
|
21094
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
21365
|
+
return /*#__PURE__*/React.createElement(Text, {
|
|
21095
21366
|
variant: "eyebrow",
|
|
21096
|
-
|
|
21097
|
-
|
|
21098
|
-
|
|
21367
|
+
testID: "points-tile-title",
|
|
21368
|
+
accessibilityRole: "header",
|
|
21369
|
+
accessibilityLabel: title
|
|
21370
|
+
}, title);
|
|
21099
21371
|
};
|
|
21100
21372
|
|
|
21101
21373
|
/**
|
|
21102
21374
|
* The PointsTile component renders a tile with media, title, and formatted points.
|
|
21103
21375
|
*
|
|
21104
|
-
* @param
|
|
21376
|
+
* @param props - Component props
|
|
21377
|
+
* @returns JSX.Element or null if tile is inactive or missing required props
|
|
21105
21378
|
*/
|
|
21106
21379
|
var PointsTileRoot = function (_a) {
|
|
21107
21380
|
var tile = _a.tile;
|
|
21108
|
-
if (!tile || !tile.active) return null;
|
|
21381
|
+
if (!tile || !tile.active || !tile.configuration) return null;
|
|
21382
|
+
var config = tile.configuration;
|
|
21383
|
+
if (!config) return null;
|
|
21109
21384
|
var isFullSize = useTileSize(tile).isFullSize;
|
|
21110
21385
|
var styles = usePointsTileStyles(isFullSize);
|
|
21111
21386
|
return /*#__PURE__*/React.createElement(BaseTile, {
|
|
@@ -21130,6 +21405,12 @@ var PointsTile = Object.assign(PointsTileRoot, {
|
|
|
21130
21405
|
});
|
|
21131
21406
|
var PointsTile$1 = withTileFetching(PointsTile);
|
|
21132
21407
|
|
|
21408
|
+
/**
|
|
21409
|
+
* Custom hook that returns the styles for the RewardCategory component.
|
|
21410
|
+
* Applies responsive styling based on the current device.
|
|
21411
|
+
*
|
|
21412
|
+
* @returns StyleSheet styles for the RewardCategory component
|
|
21413
|
+
*/
|
|
21133
21414
|
var useRewardCategoryTileStyles = function () {
|
|
21134
21415
|
var _a = useResponsive$1(),
|
|
21135
21416
|
isDesktop = _a.isDesktop,
|
|
@@ -21161,21 +21442,29 @@ var useRewardCategoryTileStyles = function () {
|
|
|
21161
21442
|
});
|
|
21162
21443
|
};
|
|
21163
21444
|
|
|
21445
|
+
/**
|
|
21446
|
+
* Renders the header for a Reward Category Tile.
|
|
21447
|
+
*
|
|
21448
|
+
* @returns JSX.Element or null if showName is false or name is not present
|
|
21449
|
+
*/
|
|
21164
21450
|
var RewardCategoryHeader = function () {
|
|
21165
21451
|
var styles = useRewardCategoryTileStyles();
|
|
21166
21452
|
var theme = useWllSdk().theme;
|
|
21167
|
-
var
|
|
21168
|
-
|
|
21169
|
-
|
|
21170
|
-
|
|
21453
|
+
var tileContext = useTileContext();
|
|
21454
|
+
if (!isContextValid(tileContext)) return null;
|
|
21455
|
+
var _a = tileContext.configuration,
|
|
21456
|
+
_b = _a.showName,
|
|
21457
|
+
showName = _b === void 0 ? true : _b,
|
|
21458
|
+
_c = _a.name,
|
|
21459
|
+
name = _c === void 0 ? '' : _c;
|
|
21171
21460
|
if (!showName || !name) return null;
|
|
21172
21461
|
return /*#__PURE__*/React.createElement(View$2, {
|
|
21173
21462
|
style: [styles.header, {
|
|
21174
21463
|
backgroundColor: theme.primary
|
|
21175
21464
|
}],
|
|
21176
|
-
|
|
21177
|
-
|
|
21178
|
-
|
|
21465
|
+
testID: "reward-category-header",
|
|
21466
|
+
accessibilityRole: "header",
|
|
21467
|
+
accessibilityLabel: "Reward category: ".concat(name)
|
|
21179
21468
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
21180
21469
|
style: [styles.headerText, {
|
|
21181
21470
|
color: theme.primaryText
|
|
@@ -21185,12 +21474,19 @@ var RewardCategoryHeader = function () {
|
|
|
21185
21474
|
}, name));
|
|
21186
21475
|
};
|
|
21187
21476
|
|
|
21477
|
+
/**
|
|
21478
|
+
* Renders the background media for a Reward Category Tile.
|
|
21479
|
+
*
|
|
21480
|
+
* @returns JSX.Element or null if no artwork URL is present
|
|
21481
|
+
*/
|
|
21188
21482
|
var RewardCategoryMedia = function () {
|
|
21189
21483
|
var styles = useRewardCategoryTileStyles();
|
|
21190
|
-
var
|
|
21191
|
-
|
|
21484
|
+
var tileContext = useTileContext();
|
|
21485
|
+
if (!isContextValid(tileContext)) return null;
|
|
21486
|
+
var _a = tileContext.configuration,
|
|
21192
21487
|
artworkUrl = _a.artworkUrl,
|
|
21193
|
-
|
|
21488
|
+
_b = _a.name,
|
|
21489
|
+
name = _b === void 0 ? 'Reward' : _b;
|
|
21194
21490
|
if (!artworkUrl) return null;
|
|
21195
21491
|
return /*#__PURE__*/React.createElement(ProgressiveImage, {
|
|
21196
21492
|
testID: "reward-category-media",
|
|
@@ -21199,19 +21495,20 @@ var RewardCategoryMedia = function () {
|
|
|
21199
21495
|
},
|
|
21200
21496
|
style: styles.background,
|
|
21201
21497
|
alt: "Reward category image for ".concat(name),
|
|
21202
|
-
|
|
21203
|
-
importantForAccessibility: "no-hide-descendants"
|
|
21498
|
+
accessibilityRole: "image"
|
|
21204
21499
|
});
|
|
21205
21500
|
};
|
|
21206
21501
|
|
|
21207
21502
|
/**
|
|
21208
21503
|
* The RewardCategoryTile component renders a tile with a header and media.
|
|
21209
21504
|
*
|
|
21210
|
-
* @param
|
|
21505
|
+
* @param {RewardCategoryTileProps} props - The component props
|
|
21506
|
+
* @param {Tile} props.tile - The tile data to render
|
|
21507
|
+
* @returns {JSX.Element|null} Rendered component or null if tile is inactive or missing configuration
|
|
21211
21508
|
*/
|
|
21212
21509
|
var RewardCategoryTileRoot = function (_a) {
|
|
21213
21510
|
var tile = _a.tile;
|
|
21214
|
-
if (!tile || !tile.active) return null;
|
|
21511
|
+
if (!tile || !tile.active || !tile.configuration) return null;
|
|
21215
21512
|
return /*#__PURE__*/React.createElement(BaseTile, {
|
|
21216
21513
|
tile: tile
|
|
21217
21514
|
}, /*#__PURE__*/React.createElement(RewardCategoryTile.Header, null), /*#__PURE__*/React.createElement(RewardCategoryTile.Media, null));
|
|
@@ -21225,14 +21522,28 @@ var RewardCategoryTile = Object.assign(RewardCategoryTileRoot, {
|
|
|
21225
21522
|
});
|
|
21226
21523
|
var RewardCategoryTile$1 = withTileFetching(RewardCategoryTile);
|
|
21227
21524
|
|
|
21525
|
+
/**
|
|
21526
|
+
* Renders a chevron icon for a Reward Tile.
|
|
21527
|
+
*
|
|
21528
|
+
* @returns JSX.Element
|
|
21529
|
+
*/
|
|
21228
21530
|
var RewardTileChevron = function () {
|
|
21531
|
+
var _a;
|
|
21229
21532
|
var theme = useWllSdk().theme;
|
|
21230
21533
|
return /*#__PURE__*/React.createElement(Icon, {
|
|
21231
21534
|
name: "ChevronRight",
|
|
21232
|
-
color: theme.derivedSurfaceText[20]
|
|
21535
|
+
color: ((_a = theme === null || theme === void 0 ? void 0 : theme.derivedSurfaceText) === null || _a === void 0 ? void 0 : _a[20]) || '#000000',
|
|
21536
|
+
accessibilityRole: "image",
|
|
21537
|
+
accessibilityLabel: "View reward details"
|
|
21233
21538
|
});
|
|
21234
21539
|
};
|
|
21235
21540
|
|
|
21541
|
+
/**
|
|
21542
|
+
* Custom hook that returns the styles for the RewardTile component.
|
|
21543
|
+
* Applies responsive styling based on the current device.
|
|
21544
|
+
*
|
|
21545
|
+
* @returns StyleSheet styles for the RewardTile component
|
|
21546
|
+
*/
|
|
21236
21547
|
var useRewardTileStyles = function () {
|
|
21237
21548
|
var _a = useResponsive$1(),
|
|
21238
21549
|
isDesktop = _a.isDesktop,
|
|
@@ -21276,24 +21587,33 @@ var useRewardTileStyles = function () {
|
|
|
21276
21587
|
});
|
|
21277
21588
|
};
|
|
21278
21589
|
|
|
21590
|
+
/**
|
|
21591
|
+
* Renders the media for a Reward Tile.
|
|
21592
|
+
*
|
|
21593
|
+
* @param props {RewardTileMediaProps} - Component props
|
|
21594
|
+
* @param props.isArtworkOnly {boolean} - Whether the media should be rendered as an artwork only component
|
|
21595
|
+
* @returns JSX.Element or null if no artwork URL is present or artwork should not be shown
|
|
21596
|
+
*/
|
|
21279
21597
|
var RewardTileMedia = function (_a) {
|
|
21280
21598
|
var isArtworkOnly = _a.isArtworkOnly;
|
|
21281
21599
|
var styles = useRewardTileStyles();
|
|
21282
|
-
var
|
|
21283
|
-
|
|
21600
|
+
var tileContext = useTileContext();
|
|
21601
|
+
if (!isContextValid(tileContext)) return null;
|
|
21602
|
+
var _b = tileContext.configuration,
|
|
21284
21603
|
artworkUrl = _b.artworkUrl,
|
|
21285
21604
|
_c = _b.showArtwork,
|
|
21286
21605
|
showArtwork = _c === void 0 ? true : _c,
|
|
21287
|
-
|
|
21606
|
+
_d = _b.name,
|
|
21607
|
+
name = _d === void 0 ? 'Reward' : _d;
|
|
21288
21608
|
if (!artworkUrl || !showArtwork) return null;
|
|
21289
21609
|
var containerStyle = {
|
|
21290
21610
|
flexBasis: isArtworkOnly ? '100%' : '50%'
|
|
21291
21611
|
};
|
|
21292
|
-
return /*#__PURE__*/React.createElement(View$2
|
|
21293
|
-
// @ts-ignore: We are using percentage values for flexBasis, which is valid in React Native but TypeScript expects a number.
|
|
21294
|
-
, {
|
|
21612
|
+
return /*#__PURE__*/React.createElement(View$2, {
|
|
21295
21613
|
style: [styles.imageContainer, containerStyle],
|
|
21296
|
-
testID: "reward-tile-media"
|
|
21614
|
+
testID: "reward-tile-media",
|
|
21615
|
+
accessibilityRole: "image",
|
|
21616
|
+
accessibilityLabel: "Reward image for ".concat(name)
|
|
21297
21617
|
}, /*#__PURE__*/React.createElement(ProgressiveImage, {
|
|
21298
21618
|
source: {
|
|
21299
21619
|
uri: artworkUrl
|
|
@@ -21303,26 +21623,32 @@ var RewardTileMedia = function (_a) {
|
|
|
21303
21623
|
}));
|
|
21304
21624
|
};
|
|
21305
21625
|
|
|
21626
|
+
/**
|
|
21627
|
+
* Renders the points value of a Reward Tile.
|
|
21628
|
+
*
|
|
21629
|
+
* @returns JSX.Element or null if price should not be shown or is zero/undefined
|
|
21630
|
+
*/
|
|
21306
21631
|
var RewardTilePoints = function () {
|
|
21307
21632
|
var styles = useRewardTileStyles();
|
|
21308
|
-
var
|
|
21309
|
-
|
|
21310
|
-
|
|
21311
|
-
|
|
21312
|
-
|
|
21313
|
-
|
|
21314
|
-
|
|
21315
|
-
|
|
21316
|
-
|
|
21317
|
-
|
|
21318
|
-
|
|
21633
|
+
var tileContext = useTileContext();
|
|
21634
|
+
if (!isContextValid(tileContext)) return null;
|
|
21635
|
+
var _a = tileContext.configuration,
|
|
21636
|
+
_b = _a.showPrice,
|
|
21637
|
+
showPrice = _b === void 0 ? true : _b,
|
|
21638
|
+
_c = _a.price,
|
|
21639
|
+
price = _c === void 0 ? 0 : _c,
|
|
21640
|
+
_d = _a.pointsMultiplier,
|
|
21641
|
+
pointsMultiplier = _d === void 0 ? 1 : _d,
|
|
21642
|
+
_e = _a.pointsPrefix,
|
|
21643
|
+
pointsPrefix = _e === void 0 ? '' : _e,
|
|
21644
|
+
_f = _a.pointsSuffix,
|
|
21645
|
+
pointsSuffix = _f === void 0 ? 'pts' : _f;
|
|
21319
21646
|
if (!showPrice || price === undefined || price === 0) return null;
|
|
21320
|
-
// Calculate points
|
|
21321
21647
|
var calculatedPoints = applyMultiplier(price, pointsMultiplier);
|
|
21322
21648
|
var accessibilityLabel = getPointsLabel('Reward points:', calculatedPoints, pointsPrefix, pointsSuffix);
|
|
21323
21649
|
return /*#__PURE__*/React.createElement(View$2, {
|
|
21324
21650
|
testID: "reward-tile-points",
|
|
21325
|
-
|
|
21651
|
+
accessibilityRole: "text",
|
|
21326
21652
|
accessibilityLabel: accessibilityLabel
|
|
21327
21653
|
}, /*#__PURE__*/React.createElement(Row, {
|
|
21328
21654
|
align: "center",
|
|
@@ -21341,29 +21667,39 @@ var RewardTilePoints = function () {
|
|
|
21341
21667
|
}, pointsSuffix) : null));
|
|
21342
21668
|
};
|
|
21343
21669
|
|
|
21670
|
+
/**
|
|
21671
|
+
* Renders the summary of a Reward Tile.
|
|
21672
|
+
*
|
|
21673
|
+
* @returns JSX.Element or null if no summary is present
|
|
21674
|
+
*/
|
|
21344
21675
|
var RewardTileSummary = function () {
|
|
21345
|
-
var
|
|
21346
|
-
|
|
21676
|
+
var tileContext = useTileContext();
|
|
21677
|
+
if (!isContextValid(tileContext)) return null;
|
|
21678
|
+
var summary = tileContext.configuration.summary;
|
|
21347
21679
|
if (!summary) return null;
|
|
21348
|
-
return /*#__PURE__*/React.createElement(
|
|
21349
|
-
accessible: true,
|
|
21350
|
-
accessibilityLabel: summary
|
|
21351
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
21680
|
+
return /*#__PURE__*/React.createElement(Text, {
|
|
21352
21681
|
variant: "body",
|
|
21353
|
-
|
|
21354
|
-
|
|
21682
|
+
accessibilityRole: "text",
|
|
21683
|
+
accessibilityLabel: summary,
|
|
21355
21684
|
testID: "reward-tile-summary"
|
|
21356
|
-
}, summary)
|
|
21685
|
+
}, summary);
|
|
21357
21686
|
};
|
|
21358
21687
|
|
|
21688
|
+
/**
|
|
21689
|
+
* Renders the title of a Reward Tile.
|
|
21690
|
+
*
|
|
21691
|
+
* @returns JSX.Element or null if no name is present
|
|
21692
|
+
*/
|
|
21359
21693
|
var RewardTileTitle = function () {
|
|
21360
|
-
var
|
|
21361
|
-
|
|
21694
|
+
var tileContext = useTileContext();
|
|
21695
|
+
if (!isContextValid(tileContext)) return null;
|
|
21696
|
+
var name = tileContext.configuration.name;
|
|
21362
21697
|
if (!name) return null;
|
|
21363
21698
|
return /*#__PURE__*/React.createElement(Text, {
|
|
21364
21699
|
variant: "title",
|
|
21365
21700
|
ellipsizeMode: "tail",
|
|
21366
21701
|
numberOfLines: 1,
|
|
21702
|
+
accessibilityRole: "header",
|
|
21367
21703
|
accessibilityLabel: "Reward title: ".concat(name),
|
|
21368
21704
|
testID: "reward-tile-title"
|
|
21369
21705
|
}, name);
|
|
@@ -21376,17 +21712,20 @@ var RewardTileTitle = function () {
|
|
|
21376
21712
|
* @returns `true` if the tile should display artwork only.
|
|
21377
21713
|
*/
|
|
21378
21714
|
var isArtworkOnly = function (configuration) {
|
|
21715
|
+
if (!configuration) return false;
|
|
21379
21716
|
return !configuration.showDetails;
|
|
21380
21717
|
};
|
|
21381
21718
|
/**
|
|
21382
21719
|
* The RewardTile component renders a tile with media, title, summary, points, and a chevron.
|
|
21383
21720
|
*
|
|
21384
|
-
* @param
|
|
21721
|
+
* @param {RewardTileProps} props - Component props
|
|
21722
|
+
* @param {Tile} props.tile - The tile data to render
|
|
21723
|
+
* @returns JSX.Element or null if tile is inactive or not a full-height tile
|
|
21385
21724
|
*/
|
|
21386
21725
|
var RewardTileRoot = function (_a) {
|
|
21387
21726
|
var tile = _a.tile;
|
|
21388
21727
|
var styles = useRewardTileStyles();
|
|
21389
|
-
if (!tile || tile.tileHeight !== exports.TileHeight.Full || !tile.active) return null;
|
|
21728
|
+
if (!tile || tile.tileHeight !== exports.TileHeight.Full || !tile.active || !tile.configuration) return null;
|
|
21390
21729
|
var configuration = tile.configuration;
|
|
21391
21730
|
return /*#__PURE__*/React.createElement(BaseTile, {
|
|
21392
21731
|
tile: tile
|