@wlloyalty/wll-react-sdk 1.0.33 → 1.0.34
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.js +75 -61
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -18872,62 +18872,6 @@ var Pressable$1 = MemoedPressable;
|
|
|
18872
18872
|
var MAX_WIDTH = 1080;
|
|
18873
18873
|
var BUTTON_SIZE = 42;
|
|
18874
18874
|
|
|
18875
|
-
var useHandleTilePress = function (ctaLink, ctaLinkTarget) {
|
|
18876
|
-
var handleNavigation = useWllSdk().handleNavigation;
|
|
18877
|
-
return React$1.useCallback(function () {
|
|
18878
|
-
if (ctaLink) {
|
|
18879
|
-
var target = ctaLinkTarget || 'SAME_FRAME';
|
|
18880
|
-
handleNavigation(ctaLink, target);
|
|
18881
|
-
}
|
|
18882
|
-
}, [ctaLink, ctaLinkTarget, handleNavigation]);
|
|
18883
|
-
};
|
|
18884
|
-
|
|
18885
|
-
var BannerContext = /*#__PURE__*/React__namespace.createContext(null);
|
|
18886
|
-
var useBannerContext = function () {
|
|
18887
|
-
var context = React__namespace.useContext(BannerContext);
|
|
18888
|
-
if (!context) {
|
|
18889
|
-
throw new Error('Tile components must be used within a BaseTile');
|
|
18890
|
-
}
|
|
18891
|
-
return context;
|
|
18892
|
-
};
|
|
18893
|
-
var BaseBanner = function (_a) {
|
|
18894
|
-
var tile = _a.tile,
|
|
18895
|
-
children = _a.children;
|
|
18896
|
-
var theme = useWllSdk().theme;
|
|
18897
|
-
var _b = tile.configuration,
|
|
18898
|
-
ctaLink = _b.ctaLink,
|
|
18899
|
-
ctaLinkTarget = _b.ctaLinkTarget,
|
|
18900
|
-
title = _b.title;
|
|
18901
|
-
var handlePress = useHandleTilePress(ctaLink, ctaLinkTarget);
|
|
18902
|
-
return /*#__PURE__*/React__namespace.createElement(BannerContext.Provider, {
|
|
18903
|
-
value: tile
|
|
18904
|
-
}, /*#__PURE__*/React__namespace.createElement(Pressable$1, {
|
|
18905
|
-
style: function (_a) {
|
|
18906
|
-
var pressed = _a.pressed;
|
|
18907
|
-
return [styles$7.container, {
|
|
18908
|
-
backgroundColor: theme.surface,
|
|
18909
|
-
borderRadius: theme.sizes.borderRadiusLg,
|
|
18910
|
-
opacity: pressed ? 0.7 : 1
|
|
18911
|
-
}];
|
|
18912
|
-
},
|
|
18913
|
-
onPress: handlePress,
|
|
18914
|
-
disabled: !ctaLink,
|
|
18915
|
-
accessible: true,
|
|
18916
|
-
accessibilityRole: "button",
|
|
18917
|
-
accessibilityLabel: "".concat(title).concat(ctaLink ? ' - Click to open' : '')
|
|
18918
|
-
}, children));
|
|
18919
|
-
};
|
|
18920
|
-
var styles$7 = StyleSheet$1.create({
|
|
18921
|
-
container: {
|
|
18922
|
-
width: '100%',
|
|
18923
|
-
maxWidth: MAX_WIDTH,
|
|
18924
|
-
flexDirection: 'row',
|
|
18925
|
-
alignItems: 'center',
|
|
18926
|
-
justifyContent: 'space-between',
|
|
18927
|
-
overflow: 'hidden'
|
|
18928
|
-
}
|
|
18929
|
-
});
|
|
18930
|
-
|
|
18931
18875
|
exports.CTALinkTarget = void 0;
|
|
18932
18876
|
(function (CTALinkTarget) {
|
|
18933
18877
|
CTALinkTarget["sameWindow"] = "SAME_FRAME";
|
|
@@ -19061,6 +19005,76 @@ var TierTileConfig = /** @class */function () {
|
|
|
19061
19005
|
return TierTileConfig;
|
|
19062
19006
|
}();
|
|
19063
19007
|
|
|
19008
|
+
var useHandleTilePress = function (tile, ctaLink, ctaLinkTarget) {
|
|
19009
|
+
var handleNavigation = useWllSdk().handleNavigation;
|
|
19010
|
+
return React$1.useCallback(function () {
|
|
19011
|
+
if ((tile === null || tile === void 0 ? void 0 : tile.type) === exports.TileType.Reward) {
|
|
19012
|
+
var config = tile.configuration;
|
|
19013
|
+
if (config === null || config === void 0 ? void 0 : config.rewardId) {
|
|
19014
|
+
var link = "/reward?id=".concat(config.rewardId);
|
|
19015
|
+
return handleNavigation(link, exports.CTALinkTarget.sameWindow);
|
|
19016
|
+
}
|
|
19017
|
+
}
|
|
19018
|
+
if ((tile === null || tile === void 0 ? void 0 : tile.type) === exports.TileType.RewardCategory) {
|
|
19019
|
+
var config = tile.configuration;
|
|
19020
|
+
if (config === null || config === void 0 ? void 0 : config.rewardCategoryId) {
|
|
19021
|
+
var link = "/category?id=".concat(config.rewardCategoryId);
|
|
19022
|
+
return handleNavigation(link, exports.CTALinkTarget.sameWindow);
|
|
19023
|
+
}
|
|
19024
|
+
}
|
|
19025
|
+
if (ctaLink) {
|
|
19026
|
+
var target = ctaLinkTarget || exports.CTALinkTarget.sameWindow;
|
|
19027
|
+
return handleNavigation(ctaLink, target);
|
|
19028
|
+
}
|
|
19029
|
+
}, [tile, ctaLink, ctaLinkTarget, handleNavigation]);
|
|
19030
|
+
};
|
|
19031
|
+
|
|
19032
|
+
var BannerContext = /*#__PURE__*/React__namespace.createContext(null);
|
|
19033
|
+
var useBannerContext = function () {
|
|
19034
|
+
var context = React__namespace.useContext(BannerContext);
|
|
19035
|
+
if (!context) {
|
|
19036
|
+
throw new Error('Tile components must be used within a BaseTile');
|
|
19037
|
+
}
|
|
19038
|
+
return context;
|
|
19039
|
+
};
|
|
19040
|
+
var BaseBanner = function (_a) {
|
|
19041
|
+
var tile = _a.tile,
|
|
19042
|
+
children = _a.children;
|
|
19043
|
+
var theme = useWllSdk().theme;
|
|
19044
|
+
var _b = tile.configuration,
|
|
19045
|
+
ctaLink = _b.ctaLink,
|
|
19046
|
+
ctaLinkTarget = _b.ctaLinkTarget,
|
|
19047
|
+
title = _b.title;
|
|
19048
|
+
var handlePress = useHandleTilePress(tile, ctaLink, ctaLinkTarget);
|
|
19049
|
+
return /*#__PURE__*/React__namespace.createElement(BannerContext.Provider, {
|
|
19050
|
+
value: tile
|
|
19051
|
+
}, /*#__PURE__*/React__namespace.createElement(Pressable$1, {
|
|
19052
|
+
style: function (_a) {
|
|
19053
|
+
var pressed = _a.pressed;
|
|
19054
|
+
return [styles$7.container, {
|
|
19055
|
+
backgroundColor: theme.surface,
|
|
19056
|
+
borderRadius: theme.sizes.borderRadiusLg,
|
|
19057
|
+
opacity: pressed ? 0.7 : 1
|
|
19058
|
+
}];
|
|
19059
|
+
},
|
|
19060
|
+
onPress: handlePress,
|
|
19061
|
+
disabled: !ctaLink,
|
|
19062
|
+
accessible: true,
|
|
19063
|
+
accessibilityRole: "button",
|
|
19064
|
+
accessibilityLabel: "".concat(title).concat(ctaLink ? ' - Click to open' : '')
|
|
19065
|
+
}, children));
|
|
19066
|
+
};
|
|
19067
|
+
var styles$7 = StyleSheet$1.create({
|
|
19068
|
+
container: {
|
|
19069
|
+
width: '100%',
|
|
19070
|
+
maxWidth: MAX_WIDTH,
|
|
19071
|
+
flexDirection: 'row',
|
|
19072
|
+
alignItems: 'center',
|
|
19073
|
+
justifyContent: 'space-between',
|
|
19074
|
+
overflow: 'hidden'
|
|
19075
|
+
}
|
|
19076
|
+
});
|
|
19077
|
+
|
|
19064
19078
|
var useTileSize = function (tile) {
|
|
19065
19079
|
return React$1.useMemo(function () {
|
|
19066
19080
|
return {
|
|
@@ -19095,7 +19109,7 @@ var BaseTileRoot = function (_a) {
|
|
|
19095
19109
|
ctaLink = _b.ctaLink,
|
|
19096
19110
|
ctaLinkTarget = _b.ctaLinkTarget,
|
|
19097
19111
|
title = _b.title;
|
|
19098
|
-
var handlePress = useHandleTilePress(ctaLink, ctaLinkTarget);
|
|
19112
|
+
var handlePress = useHandleTilePress(tile, ctaLink, ctaLinkTarget);
|
|
19099
19113
|
var _c = useResponsive$1(),
|
|
19100
19114
|
isDesktop = _c.isDesktop,
|
|
19101
19115
|
isTablet = _c.isTablet;
|
|
@@ -19121,7 +19135,7 @@ var BaseTileRoot = function (_a) {
|
|
|
19121
19135
|
}, dynamicStyles.container, layout, style];
|
|
19122
19136
|
},
|
|
19123
19137
|
onPress: handlePress,
|
|
19124
|
-
disabled: !ctaLink,
|
|
19138
|
+
disabled: tile.type !== 'REWARD' && tile.type !== 'REWARD_CATEGORY' && !ctaLink,
|
|
19125
19139
|
accessible: true,
|
|
19126
19140
|
accessibilityRole: "button",
|
|
19127
19141
|
accessibilityLabel: "".concat(title).concat(ctaLink ? ' - Click to open' : '')
|
|
@@ -19530,12 +19544,12 @@ BadgeTile.DateEarned = BadgeTileDateEarned;
|
|
|
19530
19544
|
BadgeTile.Status = BadgeTileStatus;
|
|
19531
19545
|
|
|
19532
19546
|
var BannerTileCTA = function () {
|
|
19533
|
-
var
|
|
19534
|
-
var _a = configuration,
|
|
19547
|
+
var tile = useBannerContext();
|
|
19548
|
+
var _a = tile.configuration,
|
|
19535
19549
|
ctaText = _a.ctaText,
|
|
19536
19550
|
ctaLink = _a.ctaLink,
|
|
19537
19551
|
ctaLinkTarget = _a.ctaLinkTarget;
|
|
19538
|
-
var handlePress = useHandleTilePress(ctaLink, ctaLinkTarget);
|
|
19552
|
+
var handlePress = useHandleTilePress(tile, ctaLink, ctaLinkTarget);
|
|
19539
19553
|
if (!ctaText) return null;
|
|
19540
19554
|
return /*#__PURE__*/React$1.createElement(Button, {
|
|
19541
19555
|
title: ctaText,
|