@lmnto/h-mall-shared 1.0.3 → 1.0.4

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lmnto/h-mall-shared",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "private": false,
5
5
  "sideEffects": false,
6
6
  "scripts": {
@@ -2,8 +2,6 @@
2
2
 
3
3
  import { Carousel, Typography } from "@material-tailwind/react";
4
4
 
5
- import SubscriptionBanner from "@/app/[locale]/(dashboard)/products/components/SubscriptionBanner";
6
-
7
5
  import aiX1BannerImage from "../../public/img/ai-x1-banner.png";
8
6
  import gen3BannerImage from "../../public/img/gen3-image.png";
9
7
  import smartPayChoseIcon from "../../public/img/smart-pay-chose.png";
@@ -12,6 +10,7 @@ import smartPayPaymentIcon from "../../public/img/smart-pay-payment.png";
12
10
  import { FeatureCodes } from "../constants/feature-flags";
13
11
  import { useMainContext } from "../contexts/MainWrapperContext";
14
12
  import CustomNextImage from "./CustomNextImage";
13
+ import SubscriptionBanner from "./SubscriptionBanner";
15
14
 
16
15
  export type HomeBannersProps = {
17
16
  isSubscriptionActive: boolean;
@@ -0,0 +1,83 @@
1
+ "use client";
2
+
3
+ import ButtonCustom from "./Button";
4
+ import { _useScopedI18n } from "../i18n/client";
5
+ import { useUserStore } from "../stores/userStore";
6
+ import { Typography } from "@material-tailwind/react";
7
+ import { useMemo } from "react";
8
+
9
+ export type SubscriptionBannerProps = {
10
+ isSubscriptionActive: boolean;
11
+ callback: () => void;
12
+ };
13
+
14
+ export default function SubscriptionBanner({
15
+ isSubscriptionActive,
16
+ callback,
17
+ }: SubscriptionBannerProps) {
18
+ const scopeT = _useScopedI18n("products.subscriptionBanner");
19
+ const { user } = useUserStore();
20
+
21
+ const renderBanner = useMemo(() => {
22
+ if (isSubscriptionActive)
23
+ return (
24
+ <div className="justify-between rounded-xl h-[200px] sm:h-[150px] p-[5%] lg:p-[2%] subscriptionBanner">
25
+ <div className="w-full md:w-5/6 lg:w-3/4 xl:w-2/3">
26
+ <Typography
27
+ variant="h6"
28
+ className="font-medium text-sm text-black-500 mb-1"
29
+ >
30
+ {scopeT("welcomeBack")}
31
+ </Typography>
32
+
33
+ <Typography
34
+ variant="h3"
35
+ className="font-semibold text-sm md:text-base text-black-500"
36
+ >
37
+ {scopeT("activeSubscription")}
38
+ </Typography>
39
+ </div>
40
+ </div>
41
+ );
42
+ return (
43
+ <div className="justify-between rounded-xl h-[200px] p-[5%] lg:p-[2%] subscriptionBannerBuy">
44
+ <div className="w-full md:w-5/6 lg:w-3/4 xl:w-2/3">
45
+ <Typography
46
+ variant="h5"
47
+ className="font-medium text-sm text-black-500 mb-1"
48
+ >
49
+ {scopeT("welcome")}
50
+ </Typography>
51
+
52
+ {user?.subscriptionActivationPending ? (
53
+ <Typography
54
+ variant="h2"
55
+ className="font-semibold text-sm md:text-base text-black-500"
56
+ >
57
+ {scopeT("subscriptionActivationPending")}
58
+ </Typography>
59
+ ) : (
60
+ <>
61
+ <Typography
62
+ variant="h2"
63
+ className="font-semibold text-sm md:text-base text-black-500"
64
+ >
65
+ {scopeT("inactiveSubscription")} 🚀
66
+ </Typography>
67
+ </>
68
+ )}
69
+ <ButtonCustom
70
+ onClick={callback}
71
+ className="font-medium mt-7"
72
+ icon={undefined}
73
+ disabled={user?.subscriptionActivationPending}
74
+ >
75
+ {scopeT("buySubscriptionBtn")}
76
+ </ButtonCustom>
77
+ </div>
78
+ </div>
79
+ );
80
+ }, [isSubscriptionActive, callback, scopeT, user]);
81
+
82
+ return <>{renderBanner}</>;
83
+ }