@lmnto/h-mall-shared 1.0.2 → 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 +1 -1
- package/shared/components/HomeBanners.tsx +1 -2
- package/shared/components/ListItemComponent.tsx +1 -1
- package/shared/components/SubscriptionBanner.tsx +83 -0
- package/shared/components/payments/DisclaimerAlertDialog.tsx +4 -4
- package/shared/components/payments/EmptyAssets.tsx +2 -1
- package/shared/components/payments/PaybyWalletItemComponent.tsx +4 -8
- package/shared/components/payments/PaymentAssetItemComponent.tsx +2 -6
- package/shared/components/payments/RequestProcessingDialog.tsx +3 -3
- package/shared/components/payments/WalletSectionManager.tsx +4 -7
- package/shared/components/payments/WalletSliderComponent.tsx +7 -6
- package/shared/components/payments/WalletTermsAndConditionComponent.tsx +5 -4
- package/shared/hooks/usePayments.ts +2 -2
- package/shared/types/payments.ts +1 -1
- package/tailwind.config.ts +4 -1
package/package.json
CHANGED
|
@@ -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;
|
|
@@ -33,7 +33,7 @@ export default function ListItemComponent({
|
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
35
|
<ListItem
|
|
36
|
-
className={`p-3 lg:p-2.5 xl:p-3 text-slate-600 rounded-lg
|
|
36
|
+
className={`relative p-3 lg:p-2.5 xl:p-3 text-slate-600 rounded-lg
|
|
37
37
|
hover:text-purple-500 hover:bg-purple-100
|
|
38
38
|
focus:text-purple-500 focus:bg-purple-200
|
|
39
39
|
active:text-purple-500 active:bg-purple-50
|
|
@@ -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
|
+
}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import alertIcon from "@hms/packages/public/img/alert-Icon.png";
|
|
2
|
-
import ButtonCustom from "@hms/packages/shared/components/Button";
|
|
3
|
-
import CustomNextImage from "@hms/packages/shared/components/CustomNextImage";
|
|
4
|
-
import { _useScopedI18n } from "@hms/packages/shared/i18n/client";
|
|
5
1
|
import {
|
|
6
2
|
Checkbox,
|
|
7
3
|
Dialog,
|
|
@@ -13,7 +9,11 @@ import {
|
|
|
13
9
|
} from "@material-tailwind/react";
|
|
14
10
|
import React, { useEffect, useState } from "react";
|
|
15
11
|
|
|
12
|
+
import alertIcon from "../../../public/img/alert-Icon.png";
|
|
13
|
+
import ButtonCustom from "../../components/Button";
|
|
14
|
+
import CustomNextImage from "../../components/CustomNextImage";
|
|
16
15
|
import { ROUTES } from "../../constants/routes";
|
|
16
|
+
import { _useScopedI18n } from "../../i18n/client";
|
|
17
17
|
|
|
18
18
|
type DisclaimerAlertDialogProps = {
|
|
19
19
|
open: boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { _useScopedI18n } from "@hms/packages/shared/i18n/client";
|
|
2
1
|
import { Typography } from "@material-tailwind/react";
|
|
3
2
|
|
|
3
|
+
import { _useScopedI18n } from "../../i18n/client";
|
|
4
|
+
|
|
4
5
|
export default function EmptyAssets() {
|
|
5
6
|
const scopeT = _useScopedI18n("sharedComponents.emptyAssets");
|
|
6
7
|
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import CustomNextImage from "@hms/packages/shared/components/CustomNextImage";
|
|
2
|
-
import { _useScopedI18n } from "@hms/packages/shared/i18n/client";
|
|
3
|
-
import {
|
|
4
|
-
Asset,
|
|
5
|
-
Option,
|
|
6
|
-
PaymentsMethod,
|
|
7
|
-
} from "@hms/packages/shared/types/payments";
|
|
8
|
-
import { displayExactWalletBalance } from "@hms/packages/shared/utils/app.util";
|
|
9
1
|
import { Tooltip, Typography } from "@material-tailwind/react";
|
|
10
2
|
|
|
11
3
|
import walletIcon from "../../../public/img/wallet-icon.png";
|
|
4
|
+
import { _useScopedI18n } from "../../i18n/client";
|
|
5
|
+
import { Asset, Option, PaymentsMethod } from "../../types/payments";
|
|
6
|
+
import { displayExactWalletBalance } from "../../utils/app.util";
|
|
7
|
+
import CustomNextImage from "../CustomNextImage";
|
|
12
8
|
|
|
13
9
|
export type PaybyWalletItemComponentProps = {
|
|
14
10
|
paymentMethodData: PaymentsMethod;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import CustomNextImage from "@hms/packages/shared/components/CustomNextImage";
|
|
2
|
-
import {
|
|
3
|
-
Asset,
|
|
4
|
-
Option,
|
|
5
|
-
PaymentsMethod,
|
|
6
|
-
} from "@hms/packages/shared/types/payments";
|
|
7
1
|
import { Tooltip, Typography } from "@material-tailwind/react";
|
|
8
2
|
|
|
9
3
|
import cardIcon from "../../../public/img/card-icon.png";
|
|
4
|
+
import { Asset, Option, PaymentsMethod } from "../../types/payments";
|
|
5
|
+
import CustomNextImage from "../CustomNextImage";
|
|
10
6
|
|
|
11
7
|
export type PaymentAssetItemComponentProps = {
|
|
12
8
|
paymentMethodData: PaymentsMethod;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
// import AppLoadingComponent from "
|
|
2
|
-
import ButtonCustom from "@hms/packages/shared/components/Button";
|
|
3
|
-
import { _useScopedI18n } from "@hms/packages/shared/i18n/client";
|
|
1
|
+
// import AppLoadingComponent from "../AppLoadingComponent";
|
|
4
2
|
import {
|
|
5
3
|
Dialog,
|
|
6
4
|
DialogBody,
|
|
@@ -11,6 +9,8 @@ import {
|
|
|
11
9
|
import React from "react";
|
|
12
10
|
import { IoRefresh } from "react-icons/io5";
|
|
13
11
|
|
|
12
|
+
import { _useScopedI18n } from "../../i18n/client";
|
|
13
|
+
import ButtonCustom from "../Button";
|
|
14
14
|
import LoadingIconComponent from "../LoadingIconComponent";
|
|
15
15
|
|
|
16
16
|
type RequestProcessingDialogProps = {
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import WalletTermsAndConditionComponent from "@hms/packages/shared/components/payments/WalletTermsAndConditionComponent";
|
|
2
|
-
import { usePayments } from "@hms/packages/shared/hooks/usePayments";
|
|
3
|
-
import { useUserStore } from "@hms/packages/shared/stores/userStore";
|
|
4
|
-
import {
|
|
5
|
-
PaymentsMethod,
|
|
6
|
-
PaymentType,
|
|
7
|
-
} from "@hms/packages/shared/types/payments";
|
|
8
1
|
import React, { useCallback, useEffect, useState } from "react";
|
|
9
2
|
|
|
10
3
|
import { PAYMENTS_TYPE } from "../../constants/app";
|
|
4
|
+
import { usePayments } from "../../hooks/usePayments";
|
|
5
|
+
import { useUserStore } from "../../stores/userStore";
|
|
6
|
+
import { PaymentsMethod, PaymentType } from "../../types/payments";
|
|
7
|
+
import WalletTermsAndConditionComponent from "./WalletTermsAndConditionComponent";
|
|
11
8
|
|
|
12
9
|
type WalletSectionManagerProps = {
|
|
13
10
|
paymentMethodData: PaymentsMethod;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import ButtonCustom from "@hms/packages/shared/components/Button";
|
|
2
|
-
import CustomNextLink from "@hms/packages/shared/components/CustomNextLink";
|
|
3
|
-
import { ROUTES } from "@hms/packages/shared/constants/routes";
|
|
4
|
-
import { useGlobalDebounce } from "@hms/packages/shared/hooks/useDebounce";
|
|
5
|
-
import { _useScopedI18n } from "@hms/packages/shared/i18n/client";
|
|
6
|
-
import { Asset, Commission, Option } from "@hms/packages/shared/types/payments";
|
|
7
1
|
import {
|
|
8
2
|
Button,
|
|
9
3
|
Menu,
|
|
@@ -17,6 +11,13 @@ import React, { Dispatch, useEffect, useMemo, useState } from "react";
|
|
|
17
11
|
import { GoChevronDown } from "react-icons/go";
|
|
18
12
|
import { HiOutlineArrowSmLeft } from "react-icons/hi";
|
|
19
13
|
|
|
14
|
+
import { ROUTES } from "../../constants/routes";
|
|
15
|
+
import { useGlobalDebounce } from "../../hooks/useDebounce";
|
|
16
|
+
import { _useScopedI18n } from "../../i18n/client";
|
|
17
|
+
import { Asset, Commission, Option } from "../../types/payments";
|
|
18
|
+
import ButtonCustom from "../Button";
|
|
19
|
+
import CustomNextLink from "../CustomNextLink";
|
|
20
|
+
|
|
20
21
|
// Payment method update function type
|
|
21
22
|
type PaymentUpdateFunction = (params: any) => Promise<void> | void;
|
|
22
23
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import ButtonCustom from "@hms/packages/shared/components/Button";
|
|
2
|
-
import { usePayments } from "@hms/packages/shared/hooks/usePayments";
|
|
3
|
-
import { _useScopedI18n } from "@hms/packages/shared/i18n/client";
|
|
4
|
-
import { notification } from "@hms/packages/shared/utils/notifications.util";
|
|
5
1
|
import { Checkbox, Typography } from "@material-tailwind/react";
|
|
6
2
|
import React, { useState } from "react";
|
|
7
3
|
|
|
4
|
+
import { usePayments } from "../../hooks/usePayments";
|
|
5
|
+
import { _useScopedI18n } from "../../i18n/client";
|
|
6
|
+
import { notification } from "../../utils/notifications.util";
|
|
7
|
+
import ButtonCustom from "../Button";
|
|
8
|
+
|
|
8
9
|
type WalletTermsAndConditionComponentProps = {
|
|
9
10
|
onConsentAccepted: () => void; // Prop to accept the consent
|
|
10
11
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { QueryKeys } from "@hms/packages/shared/constants/query-keys";
|
|
2
|
-
import { UsersService } from "@hms/packages/shared/services/api";
|
|
3
1
|
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
4
2
|
import { useMemo, useState } from "react";
|
|
5
3
|
|
|
6
4
|
import { PAYMENTS_TYPE } from "../constants/app";
|
|
5
|
+
import { QueryKeys } from "../constants/query-keys";
|
|
6
|
+
import { UsersService } from "../services/api";
|
|
7
7
|
import {
|
|
8
8
|
proceedGetPaymentMethodAssetsAsync,
|
|
9
9
|
proceedGetPaymentMethodsAsync,
|
package/shared/types/payments.ts
CHANGED
package/tailwind.config.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
|
|
1
3
|
import withMT from "@material-tailwind/react/utils/withMT";
|
|
2
4
|
import type { Config } from "tailwindcss";
|
|
3
5
|
|
|
4
6
|
export const sharedConfig: Config = {
|
|
5
|
-
|
|
7
|
+
// Absolute glob so when web-app imports this config, paths are not resolved from web-app/.
|
|
8
|
+
content: [path.join(__dirname, "shared/**/*.{js,ts,jsx,tsx,mdx}")],
|
|
6
9
|
safelist: [
|
|
7
10
|
"bg-yellow-50",
|
|
8
11
|
"bg-red-100",
|