kupos-ui-components-lib 10.4.4 → 10.4.5
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/ui/OfferBanner.js +5 -5
- package/package.json +1 -1
- package/src/ui/OfferBanner.tsx +7 -8
package/dist/ui/OfferBanner.js
CHANGED
|
@@ -57,25 +57,25 @@ const ViewersCount = ({ serviceItem, viewersConfig, getAnimationIcon, }) => {
|
|
|
57
57
|
};
|
|
58
58
|
// ─── Main Component ───────────────────────────────────────────────────────────
|
|
59
59
|
const OfferBanner = ({ offerGradient, isSoldOut, serviceItem, isLoggedIn, showLoginModal, viewersConfig, getAnimationIcon, showLoginOption, isNewUiEnabled, colors, isLinatal, coachKey, isExpand, }) => {
|
|
60
|
-
const isDiscountBelow20 = (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.discount_value) > 0 &&
|
|
60
|
+
const isDiscountBelow20 = (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.discount_value) > 0 &&
|
|
61
|
+
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.discount_value) < 20;
|
|
61
62
|
const offerText = isDiscountBelow20 ? "" : (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.offer_text) || "";
|
|
62
63
|
const isLegacyOffer = !!offerText &&
|
|
63
64
|
isNewUiEnabled &&
|
|
64
65
|
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.ui_type) === 1 &&
|
|
65
66
|
!(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_dp_enabled);
|
|
66
|
-
const isDpEnabledWithoutDiscounts = (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_dp_enabled) && hasDpDiscounts(serviceItem);
|
|
67
67
|
const showViewers = (isNewUiEnabled && (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.ui_type) !== 1) ||
|
|
68
68
|
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_dp_enabled);
|
|
69
69
|
const background = isLegacyOffer ? colors === null || colors === void 0 ? void 0 : colors.bottomStripColor : offerGradient;
|
|
70
70
|
const renderLeftContent = () => {
|
|
71
|
-
|
|
71
|
+
const hasDp = hasDpDiscounts(serviceItem);
|
|
72
|
+
if ((serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.is_dp_enabled) && !hasDp) {
|
|
72
73
|
return React.createElement(PopularServiceBanner, { getAnimationIcon: getAnimationIcon });
|
|
73
74
|
}
|
|
74
75
|
if (isLegacyOffer) {
|
|
75
76
|
return (React.createElement(LegacyOfferBanner, { offerText: offerText, getAnimationIcon: getAnimationIcon }));
|
|
76
77
|
}
|
|
77
|
-
|
|
78
|
-
if (isNewUiEnabled && (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.ui_type) === 2) {
|
|
78
|
+
if (hasDp || (isNewUiEnabled && (serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.ui_type) === 2)) {
|
|
79
79
|
return (React.createElement(NewUiOfferBanner, { offerText: offerText, isLoggedIn: isLoggedIn, showLoginModal: showLoginModal, showLoginOption: showLoginOption, getAnimationIcon: getAnimationIcon, hideRegister: hasDp, isNewUiEnabled: isNewUiEnabled, showLoginButton: serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.show_register_button, ui_type: serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.ui_type }));
|
|
80
80
|
}
|
|
81
81
|
return null;
|
package/package.json
CHANGED
package/src/ui/OfferBanner.tsx
CHANGED
|
@@ -225,7 +225,9 @@ const OfferBanner: React.FC<OfferBannerProps> = ({
|
|
|
225
225
|
coachKey,
|
|
226
226
|
isExpand,
|
|
227
227
|
}) => {
|
|
228
|
-
const isDiscountBelow20 =
|
|
228
|
+
const isDiscountBelow20 =
|
|
229
|
+
(serviceItem as any)?.discount_value > 0 &&
|
|
230
|
+
(serviceItem as any)?.discount_value < 20;
|
|
229
231
|
const offerText = isDiscountBelow20 ? "" : serviceItem?.offer_text || "";
|
|
230
232
|
|
|
231
233
|
const isLegacyOffer =
|
|
@@ -234,9 +236,6 @@ const OfferBanner: React.FC<OfferBannerProps> = ({
|
|
|
234
236
|
serviceItem?.ui_type === 1 &&
|
|
235
237
|
!serviceItem?.is_dp_enabled;
|
|
236
238
|
|
|
237
|
-
const isDpEnabledWithoutDiscounts =
|
|
238
|
-
serviceItem?.is_dp_enabled && hasDpDiscounts(serviceItem);
|
|
239
|
-
|
|
240
239
|
const showViewers =
|
|
241
240
|
(isNewUiEnabled && serviceItem?.ui_type !== 1) ||
|
|
242
241
|
serviceItem?.is_dp_enabled;
|
|
@@ -244,7 +243,9 @@ const OfferBanner: React.FC<OfferBannerProps> = ({
|
|
|
244
243
|
const background = isLegacyOffer ? colors?.bottomStripColor : offerGradient;
|
|
245
244
|
|
|
246
245
|
const renderLeftContent = () => {
|
|
247
|
-
|
|
246
|
+
const hasDp = hasDpDiscounts(serviceItem);
|
|
247
|
+
|
|
248
|
+
if (serviceItem?.is_dp_enabled && !hasDp) {
|
|
248
249
|
return <PopularServiceBanner getAnimationIcon={getAnimationIcon} />;
|
|
249
250
|
}
|
|
250
251
|
|
|
@@ -257,9 +258,7 @@ const OfferBanner: React.FC<OfferBannerProps> = ({
|
|
|
257
258
|
);
|
|
258
259
|
}
|
|
259
260
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
if (isNewUiEnabled && serviceItem?.ui_type === 2) {
|
|
261
|
+
if (hasDp || (isNewUiEnabled && serviceItem?.ui_type === 2)) {
|
|
263
262
|
return (
|
|
264
263
|
<NewUiOfferBanner
|
|
265
264
|
offerText={offerText}
|