@lmnto/h-mall-shared 1.0.23 → 1.0.25
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/package.json
CHANGED
|
@@ -23,6 +23,8 @@ export default function HomeBanners({
|
|
|
23
23
|
onCategoryChange,
|
|
24
24
|
}) {
|
|
25
25
|
const { featureFlags } = useMainContext();
|
|
26
|
+
const isMembershipFeatureEnabled =
|
|
27
|
+
featureFlags?.[FeatureCodes.ENABLE_MEMBERSHIP_FEATURE]?.isActive;
|
|
26
28
|
|
|
27
29
|
const renderNote = () => {
|
|
28
30
|
return (
|
|
@@ -291,6 +293,7 @@ export default function HomeBanners({
|
|
|
291
293
|
onCategoryChange(CATEGORY_FOR_SUBSCRIPTION);
|
|
292
294
|
}}
|
|
293
295
|
isSubscriptionActive={isSubscriptionActive}
|
|
296
|
+
isMembershipFeatureEnabled={isMembershipFeatureEnabled}
|
|
294
297
|
/>
|
|
295
298
|
</Carousel>
|
|
296
299
|
</div>
|
|
@@ -8,18 +8,20 @@ import { useMemo } from "react";
|
|
|
8
8
|
|
|
9
9
|
export type SubscriptionBannerProps = {
|
|
10
10
|
isSubscriptionActive: boolean;
|
|
11
|
+
isMembershipFeatureEnabled?: boolean;
|
|
11
12
|
callback: () => void;
|
|
12
13
|
};
|
|
13
14
|
|
|
14
15
|
export default function SubscriptionBanner({
|
|
15
16
|
isSubscriptionActive,
|
|
17
|
+
isMembershipFeatureEnabled = true,
|
|
16
18
|
callback,
|
|
17
19
|
}: SubscriptionBannerProps) {
|
|
18
20
|
const scopeT = _useScopedI18n("products.subscriptionBanner");
|
|
19
21
|
const { user } = useUserStore();
|
|
20
22
|
|
|
21
23
|
const renderBanner = useMemo(() => {
|
|
22
|
-
if (isSubscriptionActive)
|
|
24
|
+
if (isSubscriptionActive) {
|
|
23
25
|
return (
|
|
24
26
|
<div className="justify-between rounded-xl h-[200px] sm:h-[150px] p-[5%] lg:p-[2%] subscriptionBanner">
|
|
25
27
|
<div className="w-full md:w-5/6 lg:w-3/4 xl:w-2/3">
|
|
@@ -39,6 +41,30 @@ export default function SubscriptionBanner({
|
|
|
39
41
|
</div>
|
|
40
42
|
</div>
|
|
41
43
|
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (!isMembershipFeatureEnabled) {
|
|
47
|
+
return (
|
|
48
|
+
<div className="justify-between rounded-xl h-[200px] sm:h-[150px] p-[5%] lg:p-[2%] subscriptionBanner">
|
|
49
|
+
<div className="w-full md:w-5/6 lg:w-3/4 xl:w-2/3">
|
|
50
|
+
<Typography
|
|
51
|
+
variant="h6"
|
|
52
|
+
className="font-medium text-sm text-black-500 mb-1"
|
|
53
|
+
>
|
|
54
|
+
{scopeT("welcome")}
|
|
55
|
+
</Typography>
|
|
56
|
+
|
|
57
|
+
<Typography
|
|
58
|
+
variant="h3"
|
|
59
|
+
className="font-semibold text-sm md:text-base text-black-500"
|
|
60
|
+
>
|
|
61
|
+
{scopeT("membershipFeatureUnavailableWelcome")}
|
|
62
|
+
</Typography>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
42
68
|
return (
|
|
43
69
|
<div className="justify-between rounded-xl h-[200px] p-[5%] lg:p-[2%] subscriptionBannerBuy">
|
|
44
70
|
<div className="w-full md:w-5/6 lg:w-3/4 xl:w-2/3">
|
|
@@ -57,14 +83,12 @@ export default function SubscriptionBanner({
|
|
|
57
83
|
{scopeT("subscriptionActivationPending")}
|
|
58
84
|
</Typography>
|
|
59
85
|
) : (
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
</Typography>
|
|
67
|
-
</>
|
|
86
|
+
<Typography
|
|
87
|
+
variant="h2"
|
|
88
|
+
className="font-semibold text-sm md:text-base text-black-500"
|
|
89
|
+
>
|
|
90
|
+
{scopeT("inactiveSubscription")} 🚀
|
|
91
|
+
</Typography>
|
|
68
92
|
)}
|
|
69
93
|
<ButtonCustom
|
|
70
94
|
onClick={callback}
|
|
@@ -77,7 +101,13 @@ export default function SubscriptionBanner({
|
|
|
77
101
|
</div>
|
|
78
102
|
</div>
|
|
79
103
|
);
|
|
80
|
-
}, [
|
|
104
|
+
}, [
|
|
105
|
+
isSubscriptionActive,
|
|
106
|
+
isMembershipFeatureEnabled,
|
|
107
|
+
callback,
|
|
108
|
+
scopeT,
|
|
109
|
+
user,
|
|
110
|
+
]);
|
|
81
111
|
|
|
82
112
|
return <>{renderBanner}</>;
|
|
83
113
|
}
|
|
@@ -59,6 +59,8 @@ export default {
|
|
|
59
59
|
buySubscriptionBtn: "Buy Subscription",
|
|
60
60
|
subscriptionActivationPending:
|
|
61
61
|
"Subscription activation still in progress. Please check back later or contact support.",
|
|
62
|
+
membershipFeatureUnavailableWelcome:
|
|
63
|
+
"Welcome to H Mall! Explore our products and discover what we have to offer.",
|
|
62
64
|
},
|
|
63
65
|
quantityComponent: {
|
|
64
66
|
quantity: "Quantity",
|
|
@@ -56,6 +56,10 @@ export default {
|
|
|
56
56
|
inactiveSubscription:
|
|
57
57
|
"Sblocca vantaggi esclusivi rinnovando il tuo abbonamento oggi",
|
|
58
58
|
buySubscriptionBtn: "Acquista abbonamento",
|
|
59
|
+
subscriptionActivationPending:
|
|
60
|
+
"Attivazione dell'abbonamento ancora in corso. Riprova più tardi o contatta l'assistenza.",
|
|
61
|
+
membershipFeatureUnavailableWelcome:
|
|
62
|
+
"Benvenuto su H Mall! Esplora i nostri prodotti e scopri cosa abbiamo da offrire.",
|
|
59
63
|
},
|
|
60
64
|
quantityComponent: {
|
|
61
65
|
quantity: "Quantità",
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import plugin from "tailwindcss/plugin";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Material Tailwind Checkbox/Radio/Switch rely on `peer-checked:*` and `group-hover:*`
|
|
5
|
+
* utilities (e.g. icon spans use `opacity-0 peer-checked:opacity-100`). In this
|
|
6
|
+
* project's Tailwind build those matchVariant rules were not emitted, leaving
|
|
7
|
+
* controls permanently invisible (`appearance-none` + `opacity-0`).
|
|
8
|
+
*/
|
|
9
|
+
const peerGroupVariantValues: Record<string, string> = {
|
|
10
|
+
first: ":first-child",
|
|
11
|
+
last: ":last-child",
|
|
12
|
+
only: ":only-child",
|
|
13
|
+
odd: ":nth-child(odd)",
|
|
14
|
+
even: ":nth-child(even)",
|
|
15
|
+
"first-of-type": ":first-of-type",
|
|
16
|
+
"last-of-type": ":last-of-type",
|
|
17
|
+
"only-of-type": ":only-of-type",
|
|
18
|
+
visited: ":visited",
|
|
19
|
+
target: ":target",
|
|
20
|
+
open: ":open",
|
|
21
|
+
default: ":default",
|
|
22
|
+
checked: ":checked",
|
|
23
|
+
indeterminate: ":indeterminate",
|
|
24
|
+
"placeholder-shown": ":placeholder-shown",
|
|
25
|
+
autofill: ":autofill",
|
|
26
|
+
optional: ":optional",
|
|
27
|
+
required: ":required",
|
|
28
|
+
valid: ":valid",
|
|
29
|
+
invalid: ":invalid",
|
|
30
|
+
"in-range": ":in-range",
|
|
31
|
+
"out-of-range": ":out-of-range",
|
|
32
|
+
"read-only": ":read-only",
|
|
33
|
+
empty: ":empty",
|
|
34
|
+
"focus-within": ":focus-within",
|
|
35
|
+
hover: ":hover",
|
|
36
|
+
focus: ":focus",
|
|
37
|
+
"focus-visible": ":focus-visible",
|
|
38
|
+
active: ":active",
|
|
39
|
+
enabled: ":enabled",
|
|
40
|
+
disabled: ":disabled",
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const peerGroupVariantsPlugin = plugin(({ matchVariant }) => {
|
|
44
|
+
matchVariant("peer", (value) => `.peer${value} ~ &`, {
|
|
45
|
+
values: peerGroupVariantValues,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
matchVariant("group", (value) => `.group${value} &`, {
|
|
49
|
+
values: peerGroupVariantValues,
|
|
50
|
+
});
|
|
51
|
+
});
|
package/tailwind.config.ts
CHANGED
|
@@ -3,6 +3,8 @@ import path from "node:path";
|
|
|
3
3
|
import withMT from "@material-tailwind/react/utils/withMT";
|
|
4
4
|
import type { Config } from "tailwindcss";
|
|
5
5
|
|
|
6
|
+
import { peerGroupVariantsPlugin } from "./tailwind-peer-group-variants.plugin";
|
|
7
|
+
|
|
6
8
|
export const sharedConfig: Config = {
|
|
7
9
|
// Absolute glob so when web-app imports this config, paths are not resolved from web-app/.
|
|
8
10
|
content: [path.join(__dirname, "shared/**/*.{js,ts,jsx,tsx,mdx}")],
|
|
@@ -231,7 +233,7 @@ export const sharedConfig: Config = {
|
|
|
231
233
|
},
|
|
232
234
|
},
|
|
233
235
|
},
|
|
234
|
-
plugins: [
|
|
236
|
+
plugins: [peerGroupVariantsPlugin],
|
|
235
237
|
};
|
|
236
238
|
|
|
237
239
|
export const sharedWithMT = withMT;
|