@wlloyalty/wll-react-sdk 1.10.0 → 1.11.0
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 +56 -7
- package/dist/native.js +321 -88
- package/dist/native.js.map +1 -1
- package/dist/types/components/atoms/ProgressBar/ProgressBar.stories.d.ts +4 -0
- package/dist/types/components/atoms/ProgressBar/index.d.ts +4 -1
- package/dist/types/components/organisms/CampaignTile/CampaignTile.spec.d.ts +1 -0
- package/dist/types/components/organisms/CampaignTile/CampaignTile.stories.d.ts +27 -0
- package/dist/types/components/organisms/CampaignTile/campaign-tile-chevron.d.ts +7 -0
- package/dist/types/components/organisms/CampaignTile/campaign-tile-description.d.ts +7 -0
- package/dist/types/components/organisms/CampaignTile/campaign-tile-media.d.ts +13 -0
- package/dist/types/components/organisms/CampaignTile/campaign-tile-progress.d.ts +15 -0
- package/dist/types/components/organisms/CampaignTile/campaign-tile-title.d.ts +7 -0
- package/dist/types/components/organisms/CampaignTile/index.d.ts +21 -0
- package/dist/types/components/organisms/CampaignTile/styles.d.ts +8 -0
- package/dist/types/components/organisms/index.d.ts +1 -0
- package/dist/types/mocks/tiles/campaignTile.d.ts +6 -0
- package/dist/types/types/tile.d.ts +43 -2
- package/dist/web.js +413 -103
- package/dist/web.js.map +1 -1
- package/package.json +3 -3
package/dist/web.js
CHANGED
|
@@ -19206,17 +19206,131 @@ var Animated$1 = _objectSpread2({
|
|
|
19206
19206
|
View
|
|
19207
19207
|
}, Animated);
|
|
19208
19208
|
|
|
19209
|
+
var Text = function (_a) {
|
|
19210
|
+
var _b = _a.variant,
|
|
19211
|
+
variant = _b === void 0 ? 'body' : _b,
|
|
19212
|
+
style = _a.style;
|
|
19213
|
+
_a.isSurface;
|
|
19214
|
+
var props = __rest(_a, ["variant", "style", "isSurface"]);
|
|
19215
|
+
var theme = useWllSdk().theme;
|
|
19216
|
+
var _d = useResponsive(),
|
|
19217
|
+
isDesktop = _d.isDesktop,
|
|
19218
|
+
isTablet = _d.isTablet;
|
|
19219
|
+
var getVariantStyle = function (variant) {
|
|
19220
|
+
var baseStyle = {
|
|
19221
|
+
color: theme.surfaceText
|
|
19222
|
+
};
|
|
19223
|
+
switch (variant) {
|
|
19224
|
+
case 'eyebrow':
|
|
19225
|
+
return __assign(__assign({}, baseStyle), {
|
|
19226
|
+
fontSize: useResponsiveValue(theme.sizes.md, theme.sizes.sm, isDesktop, isTablet),
|
|
19227
|
+
marginBottom: useResponsiveValue(theme.sizes.xxs, theme.sizes.xxxs, isDesktop, isTablet)
|
|
19228
|
+
});
|
|
19229
|
+
case 'title':
|
|
19230
|
+
return __assign(__assign({}, baseStyle), {
|
|
19231
|
+
fontSize: useResponsiveValue(theme.sizes.xl, theme.sizes.md, isDesktop, isTablet),
|
|
19232
|
+
fontWeight: 'bold'
|
|
19233
|
+
});
|
|
19234
|
+
case 'body':
|
|
19235
|
+
return {
|
|
19236
|
+
color: theme.derivedSurfaceText[20],
|
|
19237
|
+
fontSize: useResponsiveValue(theme.sizes.md, theme.sizes.sm, isDesktop, isTablet)
|
|
19238
|
+
};
|
|
19239
|
+
case 'caption':
|
|
19240
|
+
return __assign(__assign({}, baseStyle), {
|
|
19241
|
+
fontWeight: 'bold',
|
|
19242
|
+
fontSize: useResponsiveValue(theme.sizes.xxl, theme.sizes.xl, isDesktop, isTablet),
|
|
19243
|
+
color: theme.primary
|
|
19244
|
+
});
|
|
19245
|
+
case 'description':
|
|
19246
|
+
case 'label':
|
|
19247
|
+
default:
|
|
19248
|
+
return __assign(__assign({}, baseStyle), {
|
|
19249
|
+
fontSize: useResponsiveValue(theme.sizes.sm, theme.sizes.xxs, isDesktop, isTablet)
|
|
19250
|
+
});
|
|
19251
|
+
}
|
|
19252
|
+
};
|
|
19253
|
+
var variantStyle = getVariantStyle(variant);
|
|
19254
|
+
// NOTE: React Native Web has different style resolution rules compared to CSS.
|
|
19255
|
+
// 1. We create styles using StyleSheet.create for better performance
|
|
19256
|
+
// 2. Base styles set the initial fontFamily
|
|
19257
|
+
// 3. variantStyle contains responsive fontSize and other variant-specific styles
|
|
19258
|
+
// 4. webOverrides ensures fontFamily is correctly applied on web platform
|
|
19259
|
+
// (prevents system font stack from being incorrectly applied)
|
|
19260
|
+
// 5. custom style prop has highest precedence
|
|
19261
|
+
// The order matters because RN Web resolves styles by specific properties
|
|
19262
|
+
// rather than last-declaration-wins like in CSS
|
|
19263
|
+
// https://necolas.github.io/react-native-web/docs/styling/#how-it-works
|
|
19264
|
+
var styles = StyleSheet$1.create({
|
|
19265
|
+
base: {
|
|
19266
|
+
fontFamily: theme.fontFamily
|
|
19267
|
+
},
|
|
19268
|
+
webOverrides: IS_WEB ? {
|
|
19269
|
+
fontFamily: theme.fontFamily
|
|
19270
|
+
} : {}
|
|
19271
|
+
});
|
|
19272
|
+
// Determine appropriate accessibility role based on variant
|
|
19273
|
+
// This helps screen readers understand the semantic meaning
|
|
19274
|
+
var accessibilityRole;
|
|
19275
|
+
switch (variant) {
|
|
19276
|
+
case 'title':
|
|
19277
|
+
accessibilityRole = IS_MOBILE ? 'heading' : 'header';
|
|
19278
|
+
break;
|
|
19279
|
+
case 'caption':
|
|
19280
|
+
accessibilityRole = IS_MOBILE ? 'contentinfo' : 'text';
|
|
19281
|
+
break;
|
|
19282
|
+
case 'eyebrow':
|
|
19283
|
+
accessibilityRole = IS_MOBILE ? 'contentinfo' : 'text';
|
|
19284
|
+
break;
|
|
19285
|
+
case 'description':
|
|
19286
|
+
accessibilityRole = IS_MOBILE ? 'article' : 'paragraph';
|
|
19287
|
+
break;
|
|
19288
|
+
case 'label':
|
|
19289
|
+
accessibilityRole = IS_MOBILE ? 'option' : 'text';
|
|
19290
|
+
break;
|
|
19291
|
+
default:
|
|
19292
|
+
accessibilityRole = IS_MOBILE ? 'contentinfo' : 'text';
|
|
19293
|
+
}
|
|
19294
|
+
var combinedStyles = [styles.base, variantStyle, styles.webOverrides, style];
|
|
19295
|
+
return /*#__PURE__*/React__namespace.createElement(RNText, __assign({
|
|
19296
|
+
style: combinedStyles
|
|
19297
|
+
}, props, {
|
|
19298
|
+
accessible: true,
|
|
19299
|
+
role: accessibilityRole
|
|
19300
|
+
}));
|
|
19301
|
+
};
|
|
19302
|
+
|
|
19209
19303
|
/* istanbul ignore file */
|
|
19210
19304
|
var useStyles = function (theme) {
|
|
19211
19305
|
return StyleSheet$1.create({
|
|
19306
|
+
wrapper: {
|
|
19307
|
+
flexDirection: 'row',
|
|
19308
|
+
alignItems: 'center',
|
|
19309
|
+
width: '100%'
|
|
19310
|
+
},
|
|
19212
19311
|
container: {
|
|
19213
|
-
|
|
19312
|
+
flex: 1,
|
|
19214
19313
|
borderRadius: theme.sizes.borderRadiusRounded,
|
|
19215
19314
|
overflow: 'hidden'
|
|
19216
19315
|
},
|
|
19217
19316
|
progress: {
|
|
19218
19317
|
borderRadius: theme.sizes.borderRadiusRounded,
|
|
19219
19318
|
height: '100%'
|
|
19319
|
+
},
|
|
19320
|
+
labelContainer: {
|
|
19321
|
+
flexDirection: 'row',
|
|
19322
|
+
alignItems: 'baseline',
|
|
19323
|
+
marginLeft: 8,
|
|
19324
|
+
flexShrink: 0
|
|
19325
|
+
},
|
|
19326
|
+
labelCurrent: {
|
|
19327
|
+
fontSize: 15,
|
|
19328
|
+
fontWeight: 'bold',
|
|
19329
|
+
color: theme.primary
|
|
19330
|
+
},
|
|
19331
|
+
labelTarget: {
|
|
19332
|
+
fontSize: 12,
|
|
19333
|
+
color: theme.derivedSurfaceText[20]
|
|
19220
19334
|
}
|
|
19221
19335
|
});
|
|
19222
19336
|
};
|
|
@@ -19262,7 +19376,11 @@ var ProgressBar = function (_a) {
|
|
|
19262
19376
|
_c = _a.height,
|
|
19263
19377
|
height = _c === void 0 ? 'sm' : _c,
|
|
19264
19378
|
_d = _a.animationDuration,
|
|
19265
|
-
animationDuration = _d === void 0 ? 300 : _d
|
|
19379
|
+
animationDuration = _d === void 0 ? 300 : _d,
|
|
19380
|
+
currentValue = _a.currentValue,
|
|
19381
|
+
targetValue = _a.targetValue,
|
|
19382
|
+
_e = _a.showProgressLabel,
|
|
19383
|
+
showProgressLabel = _e === void 0 ? false : _e;
|
|
19266
19384
|
var theme = useWllSdk().theme;
|
|
19267
19385
|
var styles = useStyles(theme);
|
|
19268
19386
|
var containerStyles = useContainerStyles(theme);
|
|
@@ -19284,11 +19402,30 @@ var ProgressBar = function (_a) {
|
|
|
19284
19402
|
outputRange: ['0%', '100%']
|
|
19285
19403
|
})
|
|
19286
19404
|
};
|
|
19405
|
+
var shouldShowLabel = showProgressLabel && currentValue !== undefined && targetValue !== undefined;
|
|
19406
|
+
if (!shouldShowLabel) {
|
|
19407
|
+
return /*#__PURE__*/React__namespace.createElement(View$2, {
|
|
19408
|
+
style: [containerStyle, {
|
|
19409
|
+
width: '100%'
|
|
19410
|
+
}]
|
|
19411
|
+
}, /*#__PURE__*/React__namespace.createElement(Animated$1.View, {
|
|
19412
|
+
style: [styles.progress, progressStyles, progressWidth]
|
|
19413
|
+
}));
|
|
19414
|
+
}
|
|
19287
19415
|
return /*#__PURE__*/React__namespace.createElement(View$2, {
|
|
19288
|
-
style:
|
|
19416
|
+
style: styles.wrapper
|
|
19417
|
+
}, /*#__PURE__*/React__namespace.createElement(View$2, {
|
|
19418
|
+
style: [containerStyle]
|
|
19289
19419
|
}, /*#__PURE__*/React__namespace.createElement(Animated$1.View, {
|
|
19290
19420
|
style: [styles.progress, progressStyles, progressWidth]
|
|
19291
|
-
}))
|
|
19421
|
+
})), /*#__PURE__*/React__namespace.createElement(View$2, {
|
|
19422
|
+
style: styles.labelContainer,
|
|
19423
|
+
accessibilityLabel: "".concat(currentValue, " of ").concat(targetValue, " completed")
|
|
19424
|
+
}, /*#__PURE__*/React__namespace.createElement(Text, {
|
|
19425
|
+
style: styles.labelCurrent
|
|
19426
|
+
}, currentValue), /*#__PURE__*/React__namespace.createElement(Text, {
|
|
19427
|
+
style: styles.labelTarget
|
|
19428
|
+
}, " / ".concat(targetValue))));
|
|
19292
19429
|
};
|
|
19293
19430
|
|
|
19294
19431
|
exports.CTALinkTarget = void 0;
|
|
@@ -19317,6 +19454,7 @@ exports.TileType = void 0;
|
|
|
19317
19454
|
TileType["Tier"] = "TIER";
|
|
19318
19455
|
TileType["Roundup"] = "ROUND_UP_BALANCE";
|
|
19319
19456
|
TileType["Venue"] = "VENUE";
|
|
19457
|
+
TileType["Campaign"] = "EARNING_CAMPAIGN";
|
|
19320
19458
|
})(exports.TileType || (exports.TileType = {}));
|
|
19321
19459
|
exports.TileHeight = void 0;
|
|
19322
19460
|
(function (TileHeight) {
|
|
@@ -19445,6 +19583,32 @@ var TierTileConfig = /** @class */function () {
|
|
|
19445
19583
|
}
|
|
19446
19584
|
return TierTileConfig;
|
|
19447
19585
|
}();
|
|
19586
|
+
var CampaignTileConfig = /** @class */function () {
|
|
19587
|
+
function CampaignTileConfig() {
|
|
19588
|
+
this.campaignId = '';
|
|
19589
|
+
this.type = '';
|
|
19590
|
+
this.status = '';
|
|
19591
|
+
this.name = '';
|
|
19592
|
+
this.description = '';
|
|
19593
|
+
this.artworkUrl = '';
|
|
19594
|
+
this.effectivity = {
|
|
19595
|
+
start: null,
|
|
19596
|
+
end: null
|
|
19597
|
+
};
|
|
19598
|
+
this.progress = {
|
|
19599
|
+
currentValue: 0,
|
|
19600
|
+
targetValue: 0,
|
|
19601
|
+
windowStart: null,
|
|
19602
|
+
windowEnd: null,
|
|
19603
|
+
optedInAt: null,
|
|
19604
|
+
completedAt: null,
|
|
19605
|
+
availableAgainAt: null,
|
|
19606
|
+
cooldownCycle: null
|
|
19607
|
+
};
|
|
19608
|
+
this.missions = [];
|
|
19609
|
+
}
|
|
19610
|
+
return CampaignTileConfig;
|
|
19611
|
+
}();
|
|
19448
19612
|
|
|
19449
19613
|
var useHandleTilePress = function (tile, ctaLink, ctaLinkTarget) {
|
|
19450
19614
|
var handleNavigation = useWllSdk().handleNavigation;
|
|
@@ -19465,8 +19629,15 @@ var useHandleTilePress = function (tile, ctaLink, ctaLinkTarget) {
|
|
|
19465
19629
|
}
|
|
19466
19630
|
if ((tile === null || tile === void 0 ? void 0 : tile.type) === exports.TileType.RewardCategory) {
|
|
19467
19631
|
var config = tile.configuration;
|
|
19468
|
-
var url = "/category?id=".concat(config.rewardCategoryId);
|
|
19469
19632
|
if (config === null || config === void 0 ? void 0 : config.rewardCategoryId) {
|
|
19633
|
+
var url = "/category?id=".concat(config.rewardCategoryId);
|
|
19634
|
+
return handleNavigation(url, exports.CTALinkTarget.sameWindow);
|
|
19635
|
+
}
|
|
19636
|
+
}
|
|
19637
|
+
if ((tile === null || tile === void 0 ? void 0 : tile.type) === exports.TileType.Campaign) {
|
|
19638
|
+
var config = tile.configuration;
|
|
19639
|
+
if (config === null || config === void 0 ? void 0 : config.campaignId) {
|
|
19640
|
+
var url = "/campaigns/".concat(config.campaignId);
|
|
19470
19641
|
return handleNavigation(url, exports.CTALinkTarget.sameWindow);
|
|
19471
19642
|
}
|
|
19472
19643
|
}
|
|
@@ -19486,100 +19657,6 @@ var useTileSize = function (tile) {
|
|
|
19486
19657
|
}, [tile.tileHeight]);
|
|
19487
19658
|
};
|
|
19488
19659
|
|
|
19489
|
-
var Text = function (_a) {
|
|
19490
|
-
var _b = _a.variant,
|
|
19491
|
-
variant = _b === void 0 ? 'body' : _b,
|
|
19492
|
-
style = _a.style;
|
|
19493
|
-
_a.isSurface;
|
|
19494
|
-
var props = __rest(_a, ["variant", "style", "isSurface"]);
|
|
19495
|
-
var theme = useWllSdk().theme;
|
|
19496
|
-
var _d = useResponsive(),
|
|
19497
|
-
isDesktop = _d.isDesktop,
|
|
19498
|
-
isTablet = _d.isTablet;
|
|
19499
|
-
var getVariantStyle = function (variant) {
|
|
19500
|
-
var baseStyle = {
|
|
19501
|
-
color: theme.surfaceText
|
|
19502
|
-
};
|
|
19503
|
-
switch (variant) {
|
|
19504
|
-
case 'eyebrow':
|
|
19505
|
-
return __assign(__assign({}, baseStyle), {
|
|
19506
|
-
fontSize: useResponsiveValue(theme.sizes.md, theme.sizes.sm, isDesktop, isTablet),
|
|
19507
|
-
marginBottom: useResponsiveValue(theme.sizes.xxs, theme.sizes.xxxs, isDesktop, isTablet)
|
|
19508
|
-
});
|
|
19509
|
-
case 'title':
|
|
19510
|
-
return __assign(__assign({}, baseStyle), {
|
|
19511
|
-
fontSize: useResponsiveValue(theme.sizes.xl, theme.sizes.md, isDesktop, isTablet),
|
|
19512
|
-
fontWeight: 'bold'
|
|
19513
|
-
});
|
|
19514
|
-
case 'body':
|
|
19515
|
-
return {
|
|
19516
|
-
color: theme.derivedSurfaceText[20],
|
|
19517
|
-
fontSize: useResponsiveValue(theme.sizes.md, theme.sizes.sm, isDesktop, isTablet)
|
|
19518
|
-
};
|
|
19519
|
-
case 'caption':
|
|
19520
|
-
return __assign(__assign({}, baseStyle), {
|
|
19521
|
-
fontWeight: 'bold',
|
|
19522
|
-
fontSize: useResponsiveValue(theme.sizes.xxl, theme.sizes.xl, isDesktop, isTablet),
|
|
19523
|
-
color: theme.primary
|
|
19524
|
-
});
|
|
19525
|
-
case 'description':
|
|
19526
|
-
case 'label':
|
|
19527
|
-
default:
|
|
19528
|
-
return __assign(__assign({}, baseStyle), {
|
|
19529
|
-
fontSize: useResponsiveValue(theme.sizes.sm, theme.sizes.xxs, isDesktop, isTablet)
|
|
19530
|
-
});
|
|
19531
|
-
}
|
|
19532
|
-
};
|
|
19533
|
-
var variantStyle = getVariantStyle(variant);
|
|
19534
|
-
// NOTE: React Native Web has different style resolution rules compared to CSS.
|
|
19535
|
-
// 1. We create styles using StyleSheet.create for better performance
|
|
19536
|
-
// 2. Base styles set the initial fontFamily
|
|
19537
|
-
// 3. variantStyle contains responsive fontSize and other variant-specific styles
|
|
19538
|
-
// 4. webOverrides ensures fontFamily is correctly applied on web platform
|
|
19539
|
-
// (prevents system font stack from being incorrectly applied)
|
|
19540
|
-
// 5. custom style prop has highest precedence
|
|
19541
|
-
// The order matters because RN Web resolves styles by specific properties
|
|
19542
|
-
// rather than last-declaration-wins like in CSS
|
|
19543
|
-
// https://necolas.github.io/react-native-web/docs/styling/#how-it-works
|
|
19544
|
-
var styles = StyleSheet$1.create({
|
|
19545
|
-
base: {
|
|
19546
|
-
fontFamily: theme.fontFamily
|
|
19547
|
-
},
|
|
19548
|
-
webOverrides: IS_WEB ? {
|
|
19549
|
-
fontFamily: theme.fontFamily
|
|
19550
|
-
} : {}
|
|
19551
|
-
});
|
|
19552
|
-
// Determine appropriate accessibility role based on variant
|
|
19553
|
-
// This helps screen readers understand the semantic meaning
|
|
19554
|
-
var accessibilityRole;
|
|
19555
|
-
switch (variant) {
|
|
19556
|
-
case 'title':
|
|
19557
|
-
accessibilityRole = IS_MOBILE ? 'heading' : 'header';
|
|
19558
|
-
break;
|
|
19559
|
-
case 'caption':
|
|
19560
|
-
accessibilityRole = IS_MOBILE ? 'contentinfo' : 'text';
|
|
19561
|
-
break;
|
|
19562
|
-
case 'eyebrow':
|
|
19563
|
-
accessibilityRole = IS_MOBILE ? 'contentinfo' : 'text';
|
|
19564
|
-
break;
|
|
19565
|
-
case 'description':
|
|
19566
|
-
accessibilityRole = IS_MOBILE ? 'article' : 'paragraph';
|
|
19567
|
-
break;
|
|
19568
|
-
case 'label':
|
|
19569
|
-
accessibilityRole = IS_MOBILE ? 'option' : 'text';
|
|
19570
|
-
break;
|
|
19571
|
-
default:
|
|
19572
|
-
accessibilityRole = IS_MOBILE ? 'contentinfo' : 'text';
|
|
19573
|
-
}
|
|
19574
|
-
var combinedStyles = [styles.base, variantStyle, styles.webOverrides, style];
|
|
19575
|
-
return /*#__PURE__*/React__namespace.createElement(RNText, __assign({
|
|
19576
|
-
style: combinedStyles
|
|
19577
|
-
}, props, {
|
|
19578
|
-
accessible: true,
|
|
19579
|
-
role: accessibilityRole
|
|
19580
|
-
}));
|
|
19581
|
-
};
|
|
19582
|
-
|
|
19583
19660
|
/**
|
|
19584
19661
|
* Renders the body text of a BaseTile component.
|
|
19585
19662
|
*
|
|
@@ -19907,7 +19984,8 @@ var BaseTileContainer = function (_a) {
|
|
|
19907
19984
|
surface: '#ffffff'
|
|
19908
19985
|
};
|
|
19909
19986
|
var handlePress = useHandleTilePress(tile, ctaLink, ctaLinkTarget);
|
|
19910
|
-
var
|
|
19987
|
+
var interactiveTiles = [exports.TileType.Reward, exports.TileType.RewardCategory, exports.TileType.Venue, exports.TileType.Campaign];
|
|
19988
|
+
var isInteractive = Boolean(ctaLink || tile.type && interactiveTiles.includes(tile.type));
|
|
19911
19989
|
var layout = {
|
|
19912
19990
|
flexDirection: 'column',
|
|
19913
19991
|
justifyContent: isHalfSize ? 'center' : 'flex-start',
|
|
@@ -20842,7 +20920,7 @@ var BannerTileTitle = function () {
|
|
|
20842
20920
|
* @param configuration - The configuration object of the tile.
|
|
20843
20921
|
* @returns `true` if the tile has no title, description, or CTA text.
|
|
20844
20922
|
*/
|
|
20845
|
-
var isArtworkOnly$
|
|
20923
|
+
var isArtworkOnly$3 = function (configuration) {
|
|
20846
20924
|
if (!configuration) return true;
|
|
20847
20925
|
return !configuration.title && !configuration.description && !configuration.ctaText;
|
|
20848
20926
|
};
|
|
@@ -20861,7 +20939,7 @@ var BannerTileRoot = function (_a) {
|
|
|
20861
20939
|
return /*#__PURE__*/React.createElement(BaseBanner, {
|
|
20862
20940
|
tile: tile
|
|
20863
20941
|
}, /*#__PURE__*/React.createElement(BannerTile.Media, {
|
|
20864
|
-
isArtworkOnly: isArtworkOnly$
|
|
20942
|
+
isArtworkOnly: isArtworkOnly$3(configuration)
|
|
20865
20943
|
}), /*#__PURE__*/React.createElement(FullFlex, null, /*#__PURE__*/React.createElement(BannerTile.Title, null), /*#__PURE__*/React.createElement(BannerTile.Description, null), /*#__PURE__*/React.createElement(BannerTile.CTA, null)));
|
|
20866
20944
|
};
|
|
20867
20945
|
/**
|
|
@@ -20875,6 +20953,236 @@ var BannerTile = Object.assign(BannerTileRoot, {
|
|
|
20875
20953
|
});
|
|
20876
20954
|
var BannerTile$1 = withTileFetching(BannerTile);
|
|
20877
20955
|
|
|
20956
|
+
/**
|
|
20957
|
+
* Renders the description of a Campaign Tile.
|
|
20958
|
+
*
|
|
20959
|
+
* @returns React.ReactElement or null if no description is present
|
|
20960
|
+
*/
|
|
20961
|
+
var CampaignTileDescription = function () {
|
|
20962
|
+
var tileContext = useTileContext();
|
|
20963
|
+
if (!isContextValid(tileContext)) return null;
|
|
20964
|
+
var description = tileContext.configuration.description;
|
|
20965
|
+
if (!description) return null;
|
|
20966
|
+
return /*#__PURE__*/React.createElement(Text, {
|
|
20967
|
+
variant: "body",
|
|
20968
|
+
role: "article",
|
|
20969
|
+
accessibilityLabel: description,
|
|
20970
|
+
testID: "campaign-tile-description",
|
|
20971
|
+
numberOfLines: 2,
|
|
20972
|
+
ellipsizeMode: "tail"
|
|
20973
|
+
}, description);
|
|
20974
|
+
};
|
|
20975
|
+
|
|
20976
|
+
/**
|
|
20977
|
+
* Custom hook that returns the styles for the CampaignTile component.
|
|
20978
|
+
* Applies responsive styling based on the current device.
|
|
20979
|
+
*
|
|
20980
|
+
* @returns StyleSheet styles for the CampaignTile component
|
|
20981
|
+
*/
|
|
20982
|
+
var useCampaignTileStyles = function () {
|
|
20983
|
+
var _a = useResponsive$1(),
|
|
20984
|
+
isDesktop = _a.isDesktop,
|
|
20985
|
+
isTablet = _a.isTablet;
|
|
20986
|
+
var theme = useWllSdk().theme;
|
|
20987
|
+
return StyleSheet$1.create({
|
|
20988
|
+
imageContainer: {
|
|
20989
|
+
width: '100%',
|
|
20990
|
+
minHeight: 130
|
|
20991
|
+
},
|
|
20992
|
+
image: {
|
|
20993
|
+
width: '100%',
|
|
20994
|
+
height: '100%',
|
|
20995
|
+
objectFit: 'cover'
|
|
20996
|
+
},
|
|
20997
|
+
titleRow: {
|
|
20998
|
+
width: '100%',
|
|
20999
|
+
marginTop: useResponsiveValue(theme.sizes.xxs, theme.sizes.xxxs, isDesktop, isTablet),
|
|
21000
|
+
marginBottom: useResponsiveValue(theme.sizes.xxs, theme.sizes.xxxs, isDesktop, isTablet)
|
|
21001
|
+
},
|
|
21002
|
+
titleText: {
|
|
21003
|
+
maxWidth: '90%',
|
|
21004
|
+
flex: 1
|
|
21005
|
+
},
|
|
21006
|
+
progressContainer: {
|
|
21007
|
+
width: '100%',
|
|
21008
|
+
marginTop: useResponsiveValue(theme.sizes.xxs, theme.sizes.xxxs, isDesktop, isTablet)
|
|
21009
|
+
}
|
|
21010
|
+
});
|
|
21011
|
+
};
|
|
21012
|
+
|
|
21013
|
+
/**
|
|
21014
|
+
* Renders the media header for a Campaign Tile.
|
|
21015
|
+
*
|
|
21016
|
+
* @param props {CampaignTileMediaProps} - Component props
|
|
21017
|
+
* @param props.isArtworkOnly {boolean} - Whether the media should occupy the full tile height
|
|
21018
|
+
* @returns React.ReactElement or null if no artworkUrl is present
|
|
21019
|
+
*/
|
|
21020
|
+
var CampaignTileMedia = function (_a) {
|
|
21021
|
+
var _b = _a.isArtworkOnly,
|
|
21022
|
+
isArtworkOnly = _b === void 0 ? false : _b;
|
|
21023
|
+
var styles = useCampaignTileStyles();
|
|
21024
|
+
var tileContext = useTileContext();
|
|
21025
|
+
if (!isContextValid(tileContext)) return null;
|
|
21026
|
+
var _c = tileContext.configuration,
|
|
21027
|
+
artworkUrl = _c.artworkUrl,
|
|
21028
|
+
_d = _c.name,
|
|
21029
|
+
name = _d === void 0 ? 'Campaign' : _d;
|
|
21030
|
+
var containerStyle = isArtworkOnly ? {
|
|
21031
|
+
flexBasis: '100%',
|
|
21032
|
+
flex: 1,
|
|
21033
|
+
height: '100%',
|
|
21034
|
+
marginBottom: 0,
|
|
21035
|
+
minHeight: 0,
|
|
21036
|
+
aspectRatio: tileContext.tileHeight === exports.TileHeight.Half ? 2 : 1
|
|
21037
|
+
} : __assign({
|
|
21038
|
+
flexBasis: '50%'
|
|
21039
|
+
}, tileContext.tileHeight === exports.TileHeight.Half && {
|
|
21040
|
+
minHeight: 0
|
|
21041
|
+
});
|
|
21042
|
+
return /*#__PURE__*/React.createElement(View$2, {
|
|
21043
|
+
style: [styles.imageContainer, containerStyle],
|
|
21044
|
+
testID: "campaign-tile-media",
|
|
21045
|
+
role: "img",
|
|
21046
|
+
accessibilityLabel: "Campaign image for ".concat(name)
|
|
21047
|
+
}, /*#__PURE__*/React.createElement(ProgressiveImage, {
|
|
21048
|
+
source: {
|
|
21049
|
+
uri: artworkUrl
|
|
21050
|
+
},
|
|
21051
|
+
style: styles.image,
|
|
21052
|
+
alt: "Campaign image for ".concat(name)
|
|
21053
|
+
}));
|
|
21054
|
+
};
|
|
21055
|
+
|
|
21056
|
+
/**
|
|
21057
|
+
* Renders the progress bar and progress label for a Campaign Tile.
|
|
21058
|
+
* If progress is null, nothing is rendered.
|
|
21059
|
+
*
|
|
21060
|
+
* @param props - Component props
|
|
21061
|
+
* @param props.progress - The campaign progress data
|
|
21062
|
+
* @returns React.ReactElement or null if progress is null
|
|
21063
|
+
*/
|
|
21064
|
+
var CampaignTileProgress = function (_a) {
|
|
21065
|
+
var progress = _a.progress;
|
|
21066
|
+
var styles = useCampaignTileStyles();
|
|
21067
|
+
if (!progress) return null;
|
|
21068
|
+
var currentValue = progress.currentValue,
|
|
21069
|
+
targetValue = progress.targetValue;
|
|
21070
|
+
var percentage = targetValue > 0 ? currentValue / targetValue * 100 : 0;
|
|
21071
|
+
return /*#__PURE__*/React.createElement(View$2, {
|
|
21072
|
+
style: styles.progressContainer,
|
|
21073
|
+
testID: "campaign-tile-progress"
|
|
21074
|
+
}, /*#__PURE__*/React.createElement(ProgressBar, {
|
|
21075
|
+
percentage: percentage,
|
|
21076
|
+
variant: "primary",
|
|
21077
|
+
height: "sm",
|
|
21078
|
+
currentValue: currentValue,
|
|
21079
|
+
targetValue: targetValue,
|
|
21080
|
+
showProgressLabel: true
|
|
21081
|
+
}));
|
|
21082
|
+
};
|
|
21083
|
+
|
|
21084
|
+
/**
|
|
21085
|
+
* Renders the title of a Campaign Tile.
|
|
21086
|
+
*
|
|
21087
|
+
* @returns React.ReactElement or null if no name is present
|
|
21088
|
+
*/
|
|
21089
|
+
var CampaignTileTitle = function () {
|
|
21090
|
+
var tileContext = useTileContext();
|
|
21091
|
+
var styles = useCampaignTileStyles();
|
|
21092
|
+
if (!isContextValid(tileContext)) return null;
|
|
21093
|
+
var name = tileContext.configuration.name;
|
|
21094
|
+
if (!name) return null;
|
|
21095
|
+
return /*#__PURE__*/React.createElement(Text, {
|
|
21096
|
+
variant: "title",
|
|
21097
|
+
ellipsizeMode: "tail",
|
|
21098
|
+
numberOfLines: 1,
|
|
21099
|
+
role: "heading",
|
|
21100
|
+
accessibilityLabel: "Campaign title: ".concat(name),
|
|
21101
|
+
testID: "campaign-tile-title",
|
|
21102
|
+
style: styles.titleText
|
|
21103
|
+
}, name);
|
|
21104
|
+
};
|
|
21105
|
+
|
|
21106
|
+
/**
|
|
21107
|
+
* Renders a chevron icon for a Campaign Tile.
|
|
21108
|
+
*
|
|
21109
|
+
* @returns React.ReactElement
|
|
21110
|
+
*/
|
|
21111
|
+
var CampaignTileChevron = function () {
|
|
21112
|
+
var _a;
|
|
21113
|
+
var theme = useWllSdk().theme;
|
|
21114
|
+
return /*#__PURE__*/React.createElement(Icon, {
|
|
21115
|
+
name: "ChevronRight",
|
|
21116
|
+
size: IS_MOBILE ? 16 : undefined,
|
|
21117
|
+
color: ((_a = theme === null || theme === void 0 ? void 0 : theme.derivedSurfaceText) === null || _a === void 0 ? void 0 : _a[20]) || '#000000',
|
|
21118
|
+
role: "img",
|
|
21119
|
+
accessibilityLabel: "View Campaign details"
|
|
21120
|
+
});
|
|
21121
|
+
};
|
|
21122
|
+
|
|
21123
|
+
/**
|
|
21124
|
+
* Helper function to determine if the tile should display artwork only.
|
|
21125
|
+
*
|
|
21126
|
+
* @param configuration - The configuration object of the tile.
|
|
21127
|
+
* @returns `true` if the tile should display artwork only.
|
|
21128
|
+
*/
|
|
21129
|
+
var isArtworkOnly$2 = function (configuration) {
|
|
21130
|
+
if (!configuration) return false;
|
|
21131
|
+
return !configuration.showDetails;
|
|
21132
|
+
};
|
|
21133
|
+
/**
|
|
21134
|
+
* The CampaignTile component renders a tile displaying campaign progress.
|
|
21135
|
+
* It shows a campaign image, title, description, and a progress bar
|
|
21136
|
+
* indicating the user's current progress towards the campaign goal.
|
|
21137
|
+
*
|
|
21138
|
+
* If progress is null, the progress bar is hidden completely.
|
|
21139
|
+
* If showDetails is false, only the artwork is displayed.
|
|
21140
|
+
*
|
|
21141
|
+
* @param {CampaignTileProps} props - Component props
|
|
21142
|
+
* @param {Tile} props.tile - The tile data to render
|
|
21143
|
+
* @returns React.ReactElement or null if tile is inactive or missing configuration
|
|
21144
|
+
*/
|
|
21145
|
+
var CampaignTileRoot = function (_a) {
|
|
21146
|
+
var tile = _a.tile;
|
|
21147
|
+
var styles = useCampaignTileStyles();
|
|
21148
|
+
if (!tile || !tile.active || !tile.configuration) return null;
|
|
21149
|
+
var configuration = tile.configuration;
|
|
21150
|
+
var progress = configuration.progress;
|
|
21151
|
+
var artworkOnly = isArtworkOnly$2(configuration);
|
|
21152
|
+
return /*#__PURE__*/React.createElement(BaseTile, {
|
|
21153
|
+
tile: tile
|
|
21154
|
+
}, /*#__PURE__*/React.createElement(CampaignTile.Media, {
|
|
21155
|
+
isArtworkOnly: artworkOnly
|
|
21156
|
+
}), !artworkOnly && (/*#__PURE__*/React.createElement(Layout, null, /*#__PURE__*/React.createElement(Row, {
|
|
21157
|
+
justify: "between",
|
|
21158
|
+
align: "center",
|
|
21159
|
+
style: styles.titleRow
|
|
21160
|
+
}, /*#__PURE__*/React.createElement(CampaignTile.Title, null), /*#__PURE__*/React.createElement(CampaignTile.Chevron, null)), /*#__PURE__*/React.createElement(View$2, {
|
|
21161
|
+
style: {
|
|
21162
|
+
width: '100%',
|
|
21163
|
+
maxWidth: '100%',
|
|
21164
|
+
minWidth: 0
|
|
21165
|
+
}
|
|
21166
|
+
}, /*#__PURE__*/React.createElement(CampaignTile.Description, null)), /*#__PURE__*/React.createElement(Row, {
|
|
21167
|
+
justify: "between",
|
|
21168
|
+
align: "center",
|
|
21169
|
+
style: styles.titleRow
|
|
21170
|
+
}, /*#__PURE__*/React.createElement(CampaignTile.Progress, {
|
|
21171
|
+
progress: progress
|
|
21172
|
+
})))));
|
|
21173
|
+
};
|
|
21174
|
+
/**
|
|
21175
|
+
* The CampaignTile component with subcomponents attached.
|
|
21176
|
+
*/
|
|
21177
|
+
var CampaignTile = Object.assign(CampaignTileRoot, {
|
|
21178
|
+
Media: CampaignTileMedia,
|
|
21179
|
+
Title: CampaignTileTitle,
|
|
21180
|
+
Description: CampaignTileDescription,
|
|
21181
|
+
Progress: CampaignTileProgress,
|
|
21182
|
+
Chevron: CampaignTileChevron
|
|
21183
|
+
});
|
|
21184
|
+
var CampaignTile$1 = withTileFetching(CampaignTile);
|
|
21185
|
+
|
|
20878
21186
|
var ContentTileChevron = function () {
|
|
20879
21187
|
var _a, _b;
|
|
20880
21188
|
var tileContext = useTileContext();
|
|
@@ -23634,7 +23942,7 @@ var VenueTile = Object.assign(VenueTileRoot, {
|
|
|
23634
23942
|
var VenueTile$1 = withTileFetching(VenueTile);
|
|
23635
23943
|
|
|
23636
23944
|
var _a;
|
|
23637
|
-
var TILE_COMPONENTS = (_a = {}, _a[exports.TileType.Content] = ContentTile$1, _a[exports.TileType.Badge] = BadgeTile$1, _a[exports.TileType.Tier] = TierTile, _a[exports.TileType.Points] = PointsTile$1, _a[exports.TileType.Reward] = RewardTile$1, _a[exports.TileType.RewardCategory] = RewardCategoryTile$1, _a[exports.TileType.Banner] = BannerTile$1, _a[exports.TileType.Roundup] = RoundupTile$1, _a[exports.TileType.Venue] = VenueTile$1, _a);
|
|
23945
|
+
var TILE_COMPONENTS = (_a = {}, _a[exports.TileType.Content] = ContentTile$1, _a[exports.TileType.Badge] = BadgeTile$1, _a[exports.TileType.Tier] = TierTile, _a[exports.TileType.Points] = PointsTile$1, _a[exports.TileType.Reward] = RewardTile$1, _a[exports.TileType.RewardCategory] = RewardCategoryTile$1, _a[exports.TileType.Banner] = BannerTile$1, _a[exports.TileType.Roundup] = RoundupTile$1, _a[exports.TileType.Venue] = VenueTile$1, _a[exports.TileType.Campaign] = CampaignTile$1, _a);
|
|
23638
23946
|
/**
|
|
23639
23947
|
* TileContainer component to render a list of tiles with proper layout and spacing.
|
|
23640
23948
|
*/
|
|
@@ -23813,6 +24121,8 @@ exports.BaseBanner = BaseBanner;
|
|
|
23813
24121
|
exports.BaseTile = BaseTile;
|
|
23814
24122
|
exports.Button = Button;
|
|
23815
24123
|
exports.COLOR_CONSTANTS = COLOR_CONSTANTS;
|
|
24124
|
+
exports.CampaignTile = CampaignTile$1;
|
|
24125
|
+
exports.CampaignTileConfig = CampaignTileConfig;
|
|
23816
24126
|
exports.Carousel = Carousel;
|
|
23817
24127
|
exports.CarouselNavButton = CarouselNavButton;
|
|
23818
24128
|
exports.Chip = Chip;
|