@medialane/ui 0.232.0 → 0.233.0
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/components/account/input-otp.d.cts +2 -2
- package/dist/components/account/input-otp.d.ts +2 -2
- package/dist/components/badge.d.cts +1 -1
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/button.d.cts +2 -2
- package/dist/components/button.d.ts +2 -2
- package/dist/components/claim-route-shell.cjs +35 -0
- package/dist/components/claim-route-shell.cjs.map +1 -0
- package/dist/components/claim-route-shell.d.cts +7 -0
- package/dist/components/claim-route-shell.d.ts +7 -0
- package/dist/components/claim-route-shell.js +11 -0
- package/dist/components/claim-route-shell.js.map +1 -0
- package/dist/components/fast-mint/fast-mint.d.cts +2 -2
- package/dist/components/fast-mint/fast-mint.d.ts +2 -2
- package/dist/components/rewards/reward-earned.cjs +38 -34
- package/dist/components/rewards/reward-earned.cjs.map +1 -1
- package/dist/components/rewards/reward-earned.d.cts +2 -3
- package/dist/components/rewards/reward-earned.d.ts +2 -3
- package/dist/components/rewards/reward-earned.js +37 -33
- package/dist/components/rewards/reward-earned.js.map +1 -1
- package/dist/components/sheet.d.cts +1 -1
- package/dist/components/sheet.d.ts +1 -1
- package/dist/components/wallet-required.cjs +62 -0
- package/dist/components/wallet-required.cjs.map +1 -0
- package/dist/components/wallet-required.d.cts +13 -0
- package/dist/components/wallet-required.d.ts +13 -0
- package/dist/components/wallet-required.js +38 -0
- package/dist/components/wallet-required.js.map +1 -0
- package/dist/index.cjs +14 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/utils/portfolio-cache.cjs +34 -0
- package/dist/utils/portfolio-cache.cjs.map +1 -0
- package/dist/utils/portfolio-cache.d.cts +3 -0
- package/dist/utils/portfolio-cache.d.ts +3 -0
- package/dist/utils/portfolio-cache.js +10 -0
- package/dist/utils/portfolio-cache.js.map +1 -0
- package/dist/utils/use-launchpad-image-upload.cjs +103 -0
- package/dist/utils/use-launchpad-image-upload.cjs.map +1 -0
- package/dist/utils/use-launchpad-image-upload.d.cts +21 -0
- package/dist/utils/use-launchpad-image-upload.d.ts +21 -0
- package/dist/utils/use-launchpad-image-upload.js +79 -0
- package/dist/utils/use-launchpad-image-upload.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as input_otp from 'input-otp';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
|
-
declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
4
|
+
declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
5
5
|
value?: string;
|
|
6
6
|
onChange?: (newValue: string) => unknown;
|
|
7
7
|
maxLength: number;
|
|
@@ -14,7 +14,7 @@ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHT
|
|
|
14
14
|
} & {
|
|
15
15
|
render: (props: input_otp.RenderProps) => React.ReactNode;
|
|
16
16
|
children?: never;
|
|
17
|
-
} & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
17
|
+
} & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
18
18
|
value?: string;
|
|
19
19
|
onChange?: (newValue: string) => unknown;
|
|
20
20
|
maxLength: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as input_otp from 'input-otp';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
|
-
declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
4
|
+
declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
5
5
|
value?: string;
|
|
6
6
|
onChange?: (newValue: string) => unknown;
|
|
7
7
|
maxLength: number;
|
|
@@ -14,7 +14,7 @@ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHT
|
|
|
14
14
|
} & {
|
|
15
15
|
render: (props: input_otp.RenderProps) => React.ReactNode;
|
|
16
16
|
children?: never;
|
|
17
|
-
} & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
17
|
+
} & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
18
18
|
value?: string;
|
|
19
19
|
onChange?: (newValue: string) => unknown;
|
|
20
20
|
maxLength: number;
|
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
|
|
6
6
|
declare const badgeVariants: (props?: ({
|
|
7
|
-
variant?: "
|
|
7
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
10
10
|
}
|
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
|
|
6
6
|
declare const badgeVariants: (props?: ({
|
|
7
|
-
variant?: "
|
|
7
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
10
10
|
}
|
|
@@ -3,8 +3,8 @@ import * as React from 'react';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
|
|
5
5
|
declare const buttonVariants: (props?: ({
|
|
6
|
-
variant?: "
|
|
7
|
-
size?: "
|
|
6
|
+
variant?: "ghost" | "link" | "default" | "destructive" | "outline" | "secondary" | "premium" | "tonal" | "gradient-border" | "gradient-fill" | null | undefined;
|
|
7
|
+
size?: "icon" | "default" | "sm" | "lg" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
10
10
|
asChild?: boolean;
|
|
@@ -3,8 +3,8 @@ import * as React from 'react';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
|
|
5
5
|
declare const buttonVariants: (props?: ({
|
|
6
|
-
variant?: "
|
|
7
|
-
size?: "
|
|
6
|
+
variant?: "ghost" | "link" | "default" | "destructive" | "outline" | "secondary" | "premium" | "tonal" | "gradient-border" | "gradient-fill" | null | undefined;
|
|
7
|
+
size?: "icon" | "default" | "sm" | "lg" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
10
10
|
asChild?: boolean;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var claim_route_shell_exports = {};
|
|
21
|
+
__export(claim_route_shell_exports, {
|
|
22
|
+
ClaimRouteShell: () => ClaimRouteShell
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(claim_route_shell_exports);
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import_back_button = require("./back-button.js");
|
|
27
|
+
var import_service_form_shell = require("./service-form-shell.js");
|
|
28
|
+
function ClaimRouteShell(props) {
|
|
29
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_service_form_shell.ServiceFormShell, { ...props, backSlot: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_back_button.BackButton, {}) });
|
|
30
|
+
}
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
ClaimRouteShell
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=claim-route-shell.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/claim-route-shell.tsx"],"sourcesContent":["\"use client\";\n\nimport { BackButton } from \"./back-button.js\";\nimport { ServiceFormShell, type ServiceFormShellProps } from \"./service-form-shell.js\";\n\nexport function ClaimRouteShell(props: Omit<ServiceFormShellProps, \"backSlot\">) {\n return <ServiceFormShell {...props} backSlot={<BackButton />} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMgD;AAJhD,yBAA2B;AAC3B,gCAA6D;AAEtD,SAAS,gBAAgB,OAAgD;AAC9E,SAAO,4CAAC,8CAAkB,GAAG,OAAO,UAAU,4CAAC,iCAAW,GAAI;AAChE;","names":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ServiceFormShellProps } from './service-form-shell.cjs';
|
|
3
|
+
import 'react';
|
|
4
|
+
|
|
5
|
+
declare function ClaimRouteShell(props: Omit<ServiceFormShellProps, "backSlot">): react_jsx_runtime.JSX.Element;
|
|
6
|
+
|
|
7
|
+
export { ClaimRouteShell };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ServiceFormShellProps } from './service-form-shell.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
|
|
5
|
+
declare function ClaimRouteShell(props: Omit<ServiceFormShellProps, "backSlot">): react_jsx_runtime.JSX.Element;
|
|
6
|
+
|
|
7
|
+
export { ClaimRouteShell };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { BackButton } from "./back-button.js";
|
|
4
|
+
import { ServiceFormShell } from "./service-form-shell.js";
|
|
5
|
+
function ClaimRouteShell(props) {
|
|
6
|
+
return /* @__PURE__ */ jsx(ServiceFormShell, { ...props, backSlot: /* @__PURE__ */ jsx(BackButton, {}) });
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
ClaimRouteShell
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=claim-route-shell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/claim-route-shell.tsx"],"sourcesContent":["\"use client\";\n\nimport { BackButton } from \"./back-button.js\";\nimport { ServiceFormShell, type ServiceFormShellProps } from \"./service-form-shell.js\";\n\nexport function ClaimRouteShell(props: Omit<ServiceFormShellProps, \"backSlot\">) {\n return <ServiceFormShell {...props} backSlot={<BackButton />} />;\n}\n"],"mappings":";AAMgD;AAJhD,SAAS,kBAAkB;AAC3B,SAAS,wBAAoD;AAEtD,SAAS,gBAAgB,OAAgD;AAC9E,SAAO,oBAAC,oBAAkB,GAAG,OAAO,UAAU,oBAAC,cAAW,GAAI;AAChE;","names":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import { FastMintProps } from './types.cjs';
|
|
4
4
|
import 'starknet';
|
|
5
5
|
import '@medialane/sdk';
|
|
6
6
|
import '@medialane/sdk/starknet';
|
|
7
7
|
|
|
8
|
-
declare function FastMint(props: FastMintProps): string | number | bigint | boolean |
|
|
8
|
+
declare function FastMint(props: FastMintProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
9
9
|
|
|
10
10
|
export { FastMint };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import { FastMintProps } from './types.js';
|
|
4
4
|
import 'starknet';
|
|
5
5
|
import '@medialane/sdk';
|
|
6
6
|
import '@medialane/sdk/starknet';
|
|
7
7
|
|
|
8
|
-
declare function FastMint(props: FastMintProps): string | number | bigint | boolean |
|
|
8
|
+
declare function FastMint(props: FastMintProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
9
9
|
|
|
10
10
|
export { FastMint };
|
|
@@ -19,47 +19,51 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
19
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
20
|
var reward_earned_exports = {};
|
|
21
21
|
__export(reward_earned_exports, {
|
|
22
|
-
|
|
22
|
+
RewardEarned: () => RewardEarned
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(reward_earned_exports);
|
|
25
25
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
26
|
var import_react = require("react");
|
|
27
27
|
var import_xp_earned = require("./xp-earned.js");
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
28
|
+
var import_medialane_app = require("../medialane-app.js");
|
|
29
|
+
const configs = /* @__PURE__ */ new WeakMap();
|
|
30
|
+
function RewardEarned({ actionType, snapshot, className }) {
|
|
31
|
+
const api = (0, import_medialane_app.useMedialaneApp)().getClient().api;
|
|
32
|
+
const [config, setConfig] = (0, import_react.useState)(null);
|
|
33
|
+
(0, import_react.useEffect)(() => {
|
|
34
|
+
let alive = true;
|
|
35
|
+
let pending = configs.get(api);
|
|
36
|
+
if (!pending) {
|
|
37
|
+
pending = api.rewards.config();
|
|
38
|
+
configs.set(api, pending);
|
|
39
|
+
}
|
|
40
|
+
pending.then((loaded) => {
|
|
41
|
+
if (alive) setConfig(loaded);
|
|
42
|
+
}).catch((err) => {
|
|
43
|
+
console.error("rewards config could not be loaded", err);
|
|
44
|
+
configs.delete(api);
|
|
45
|
+
});
|
|
46
|
+
return () => {
|
|
47
|
+
alive = false;
|
|
48
|
+
};
|
|
49
|
+
}, [api]);
|
|
50
|
+
const action = config?.actions.find((a) => a.type === actionType);
|
|
51
|
+
if (!config || !action) return null;
|
|
52
|
+
const level = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel) : void 0;
|
|
53
|
+
const nextLevel = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel + 1) : void 0;
|
|
54
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
55
|
+
import_xp_earned.XpEarned,
|
|
56
|
+
{
|
|
57
|
+
xp: action.xp,
|
|
58
|
+
label: action.label,
|
|
59
|
+
totalXp: snapshot?.totalXp,
|
|
60
|
+
levelXp: snapshot ? level?.xpRequired ?? 0 : void 0,
|
|
61
|
+
nextLevelXp: snapshot ? nextLevel?.xpRequired ?? null : void 0
|
|
62
|
+
}
|
|
63
|
+
) });
|
|
60
64
|
}
|
|
61
65
|
// Annotate the CommonJS export names for ESM import in node:
|
|
62
66
|
0 && (module.exports = {
|
|
63
|
-
|
|
67
|
+
RewardEarned
|
|
64
68
|
});
|
|
65
69
|
//# sourceMappingURL=reward-earned.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/rewards/reward-earned.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { XpEarned } from \"./xp-earned.js\";\nimport type { ApiRewardsConfig } from \"@medialane/sdk\";\n\nexport interface RewardSnapshot {\n totalXp: number;\n currentLevel: number;\n}\n\nexport interface RewardEarnedProps {\n actionType: string;\n snapshot?: RewardSnapshot;\n className?: string;\n}\n\
|
|
1
|
+
{"version":3,"sources":["../../../src/components/rewards/reward-earned.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { XpEarned } from \"./xp-earned.js\";\nimport type { ApiRewardsConfig } from \"@medialane/sdk\";\nimport { useMedialaneApp } from \"../medialane-app.js\";\n\nexport interface RewardSnapshot {\n totalXp: number;\n currentLevel: number;\n}\n\nexport interface RewardEarnedProps {\n actionType: string;\n snapshot?: RewardSnapshot;\n className?: string;\n}\n\nconst configs = new WeakMap<object, Promise<ApiRewardsConfig>>();\n\nexport function RewardEarned({ actionType, snapshot, className }: RewardEarnedProps) {\n const api = useMedialaneApp().getClient().api;\n const [config, setConfig] = useState<ApiRewardsConfig | null>(null);\n\n useEffect(() => {\n let alive = true;\n let pending = configs.get(api);\n if (!pending) {\n pending = api.rewards.config();\n configs.set(api, pending);\n }\n pending\n .then((loaded) => {\n if (alive) setConfig(loaded);\n })\n .catch((err) => {\n console.error(\"rewards config could not be loaded\", err);\n configs.delete(api);\n });\n return () => {\n alive = false;\n };\n }, [api]);\n\n const action = config?.actions.find((a) => a.type === actionType);\n if (!config || !action) return null;\n\n const level = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel) : undefined;\n const nextLevel = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel + 1) : undefined;\n\n return (\n <div className={className}>\n <XpEarned\n xp={action.xp}\n label={action.label}\n totalXp={snapshot?.totalXp}\n levelXp={snapshot ? level?.xpRequired ?? 0 : undefined}\n nextLevelXp={snapshot ? nextLevel?.xpRequired ?? null : undefined}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoDM;AAlDN,mBAAoC;AACpC,uBAAyB;AAEzB,2BAAgC;AAahC,MAAM,UAAU,oBAAI,QAA2C;AAExD,SAAS,aAAa,EAAE,YAAY,UAAU,UAAU,GAAsB;AACnF,QAAM,UAAM,sCAAgB,EAAE,UAAU,EAAE;AAC1C,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAkC,IAAI;AAElE,8BAAU,MAAM;AACd,QAAI,QAAQ;AACZ,QAAI,UAAU,QAAQ,IAAI,GAAG;AAC7B,QAAI,CAAC,SAAS;AACZ,gBAAU,IAAI,QAAQ,OAAO;AAC7B,cAAQ,IAAI,KAAK,OAAO;AAAA,IAC1B;AACA,YACG,KAAK,CAAC,WAAW;AAChB,UAAI,MAAO,WAAU,MAAM;AAAA,IAC7B,CAAC,EACA,MAAM,CAAC,QAAQ;AACd,cAAQ,MAAM,sCAAsC,GAAG;AACvD,cAAQ,OAAO,GAAG;AAAA,IACpB,CAAC;AACH,WAAO,MAAM;AACX,cAAQ;AAAA,IACV;AAAA,EACF,GAAG,CAAC,GAAG,CAAC;AAER,QAAM,SAAS,QAAQ,QAAQ,KAAK,CAAC,MAAM,EAAE,SAAS,UAAU;AAChE,MAAI,CAAC,UAAU,CAAC,OAAQ,QAAO;AAE/B,QAAM,QAAQ,WAAW,OAAO,OAAO,KAAK,CAAC,MAAM,EAAE,UAAU,SAAS,YAAY,IAAI;AACxF,QAAM,YAAY,WAAW,OAAO,OAAO,KAAK,CAAC,MAAM,EAAE,UAAU,SAAS,eAAe,CAAC,IAAI;AAEhG,SACE,4CAAC,SAAI,WACH;AAAA,IAAC;AAAA;AAAA,MACC,IAAI,OAAO;AAAA,MACX,OAAO,OAAO;AAAA,MACd,SAAS,UAAU;AAAA,MACnB,SAAS,WAAW,OAAO,cAAc,IAAI;AAAA,MAC7C,aAAa,WAAW,WAAW,cAAc,OAAO;AAAA;AAAA,EAC1D,GACF;AAEJ;","names":[]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ApiRewardsConfig } from '@medialane/sdk';
|
|
3
2
|
|
|
4
3
|
interface RewardSnapshot {
|
|
5
4
|
totalXp: number;
|
|
@@ -10,6 +9,6 @@ interface RewardEarnedProps {
|
|
|
10
9
|
snapshot?: RewardSnapshot;
|
|
11
10
|
className?: string;
|
|
12
11
|
}
|
|
13
|
-
declare function
|
|
12
|
+
declare function RewardEarned({ actionType, snapshot, className }: RewardEarnedProps): react_jsx_runtime.JSX.Element | null;
|
|
14
13
|
|
|
15
|
-
export { type RewardEarnedProps, type RewardSnapshot
|
|
14
|
+
export { RewardEarned, type RewardEarnedProps, type RewardSnapshot };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ApiRewardsConfig } from '@medialane/sdk';
|
|
3
2
|
|
|
4
3
|
interface RewardSnapshot {
|
|
5
4
|
totalXp: number;
|
|
@@ -10,6 +9,6 @@ interface RewardEarnedProps {
|
|
|
10
9
|
snapshot?: RewardSnapshot;
|
|
11
10
|
className?: string;
|
|
12
11
|
}
|
|
13
|
-
declare function
|
|
12
|
+
declare function RewardEarned({ actionType, snapshot, className }: RewardEarnedProps): react_jsx_runtime.JSX.Element | null;
|
|
14
13
|
|
|
15
|
-
export { type RewardEarnedProps, type RewardSnapshot
|
|
14
|
+
export { RewardEarned, type RewardEarnedProps, type RewardSnapshot };
|
|
@@ -2,40 +2,44 @@
|
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
4
|
import { XpEarned } from "./xp-earned.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
5
|
+
import { useMedialaneApp } from "../medialane-app.js";
|
|
6
|
+
const configs = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
function RewardEarned({ actionType, snapshot, className }) {
|
|
8
|
+
const api = useMedialaneApp().getClient().api;
|
|
9
|
+
const [config, setConfig] = useState(null);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
let alive = true;
|
|
12
|
+
let pending = configs.get(api);
|
|
13
|
+
if (!pending) {
|
|
14
|
+
pending = api.rewards.config();
|
|
15
|
+
configs.set(api, pending);
|
|
16
|
+
}
|
|
17
|
+
pending.then((loaded) => {
|
|
18
|
+
if (alive) setConfig(loaded);
|
|
19
|
+
}).catch((err) => {
|
|
20
|
+
console.error("rewards config could not be loaded", err);
|
|
21
|
+
configs.delete(api);
|
|
22
|
+
});
|
|
23
|
+
return () => {
|
|
24
|
+
alive = false;
|
|
25
|
+
};
|
|
26
|
+
}, [api]);
|
|
27
|
+
const action = config?.actions.find((a) => a.type === actionType);
|
|
28
|
+
if (!config || !action) return null;
|
|
29
|
+
const level = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel) : void 0;
|
|
30
|
+
const nextLevel = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel + 1) : void 0;
|
|
31
|
+
return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(
|
|
32
|
+
XpEarned,
|
|
33
|
+
{
|
|
34
|
+
xp: action.xp,
|
|
35
|
+
label: action.label,
|
|
36
|
+
totalXp: snapshot?.totalXp,
|
|
37
|
+
levelXp: snapshot ? level?.xpRequired ?? 0 : void 0,
|
|
38
|
+
nextLevelXp: snapshot ? nextLevel?.xpRequired ?? null : void 0
|
|
39
|
+
}
|
|
40
|
+
) });
|
|
37
41
|
}
|
|
38
42
|
export {
|
|
39
|
-
|
|
43
|
+
RewardEarned
|
|
40
44
|
};
|
|
41
45
|
//# sourceMappingURL=reward-earned.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/rewards/reward-earned.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { XpEarned } from \"./xp-earned.js\";\nimport type { ApiRewardsConfig } from \"@medialane/sdk\";\n\nexport interface RewardSnapshot {\n totalXp: number;\n currentLevel: number;\n}\n\nexport interface RewardEarnedProps {\n actionType: string;\n snapshot?: RewardSnapshot;\n className?: string;\n}\n\
|
|
1
|
+
{"version":3,"sources":["../../../src/components/rewards/reward-earned.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { XpEarned } from \"./xp-earned.js\";\nimport type { ApiRewardsConfig } from \"@medialane/sdk\";\nimport { useMedialaneApp } from \"../medialane-app.js\";\n\nexport interface RewardSnapshot {\n totalXp: number;\n currentLevel: number;\n}\n\nexport interface RewardEarnedProps {\n actionType: string;\n snapshot?: RewardSnapshot;\n className?: string;\n}\n\nconst configs = new WeakMap<object, Promise<ApiRewardsConfig>>();\n\nexport function RewardEarned({ actionType, snapshot, className }: RewardEarnedProps) {\n const api = useMedialaneApp().getClient().api;\n const [config, setConfig] = useState<ApiRewardsConfig | null>(null);\n\n useEffect(() => {\n let alive = true;\n let pending = configs.get(api);\n if (!pending) {\n pending = api.rewards.config();\n configs.set(api, pending);\n }\n pending\n .then((loaded) => {\n if (alive) setConfig(loaded);\n })\n .catch((err) => {\n console.error(\"rewards config could not be loaded\", err);\n configs.delete(api);\n });\n return () => {\n alive = false;\n };\n }, [api]);\n\n const action = config?.actions.find((a) => a.type === actionType);\n if (!config || !action) return null;\n\n const level = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel) : undefined;\n const nextLevel = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel + 1) : undefined;\n\n return (\n <div className={className}>\n <XpEarned\n xp={action.xp}\n label={action.label}\n totalXp={snapshot?.totalXp}\n levelXp={snapshot ? level?.xpRequired ?? 0 : undefined}\n nextLevelXp={snapshot ? nextLevel?.xpRequired ?? null : undefined}\n />\n </div>\n );\n}\n"],"mappings":";AAoDM;AAlDN,SAAS,WAAW,gBAAgB;AACpC,SAAS,gBAAgB;AAEzB,SAAS,uBAAuB;AAahC,MAAM,UAAU,oBAAI,QAA2C;AAExD,SAAS,aAAa,EAAE,YAAY,UAAU,UAAU,GAAsB;AACnF,QAAM,MAAM,gBAAgB,EAAE,UAAU,EAAE;AAC1C,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAkC,IAAI;AAElE,YAAU,MAAM;AACd,QAAI,QAAQ;AACZ,QAAI,UAAU,QAAQ,IAAI,GAAG;AAC7B,QAAI,CAAC,SAAS;AACZ,gBAAU,IAAI,QAAQ,OAAO;AAC7B,cAAQ,IAAI,KAAK,OAAO;AAAA,IAC1B;AACA,YACG,KAAK,CAAC,WAAW;AAChB,UAAI,MAAO,WAAU,MAAM;AAAA,IAC7B,CAAC,EACA,MAAM,CAAC,QAAQ;AACd,cAAQ,MAAM,sCAAsC,GAAG;AACvD,cAAQ,OAAO,GAAG;AAAA,IACpB,CAAC;AACH,WAAO,MAAM;AACX,cAAQ;AAAA,IACV;AAAA,EACF,GAAG,CAAC,GAAG,CAAC;AAER,QAAM,SAAS,QAAQ,QAAQ,KAAK,CAAC,MAAM,EAAE,SAAS,UAAU;AAChE,MAAI,CAAC,UAAU,CAAC,OAAQ,QAAO;AAE/B,QAAM,QAAQ,WAAW,OAAO,OAAO,KAAK,CAAC,MAAM,EAAE,UAAU,SAAS,YAAY,IAAI;AACxF,QAAM,YAAY,WAAW,OAAO,OAAO,KAAK,CAAC,MAAM,EAAE,UAAU,SAAS,eAAe,CAAC,IAAI;AAEhG,SACE,oBAAC,SAAI,WACH;AAAA,IAAC;AAAA;AAAA,MACC,IAAI,OAAO;AAAA,MACX,OAAO,OAAO;AAAA,MACd,SAAS,UAAU;AAAA,MACnB,SAAS,WAAW,OAAO,cAAc,IAAI;AAAA,MAC7C,aAAa,WAAW,WAAW,cAAc,OAAO;AAAA;AAAA,EAC1D,GACF;AAEJ;","names":[]}
|
|
@@ -10,7 +10,7 @@ declare const SheetClose: React.ForwardRefExoticComponent<SheetPrimitive.DialogC
|
|
|
10
10
|
declare const SheetPortal: React.FC<SheetPrimitive.DialogPortalProps>;
|
|
11
11
|
declare const SheetOverlay: React.ForwardRefExoticComponent<Omit<SheetPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
12
|
declare const sheetVariants: (props?: ({
|
|
13
|
-
side?: "
|
|
13
|
+
side?: "left" | "right" | "bottom" | "top" | null | undefined;
|
|
14
14
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
15
15
|
interface SheetContentProps extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>, VariantProps<typeof sheetVariants> {
|
|
16
16
|
overlayClassName?: string;
|
|
@@ -10,7 +10,7 @@ declare const SheetClose: React.ForwardRefExoticComponent<SheetPrimitive.DialogC
|
|
|
10
10
|
declare const SheetPortal: React.FC<SheetPrimitive.DialogPortalProps>;
|
|
11
11
|
declare const SheetOverlay: React.ForwardRefExoticComponent<Omit<SheetPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
12
|
declare const sheetVariants: (props?: ({
|
|
13
|
-
side?: "
|
|
13
|
+
side?: "left" | "right" | "bottom" | "top" | null | undefined;
|
|
14
14
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
15
15
|
interface SheetContentProps extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>, VariantProps<typeof sheetVariants> {
|
|
16
16
|
overlayClassName?: string;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var wallet_required_exports = {};
|
|
21
|
+
__export(wallet_required_exports, {
|
|
22
|
+
WalletRequired: () => WalletRequired
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(wallet_required_exports);
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import_lucide_react = require("lucide-react");
|
|
27
|
+
var import_button = require("./button.js");
|
|
28
|
+
var import_skeleton = require("./skeleton.js");
|
|
29
|
+
var import_medialane_app = require("./medialane-app.js");
|
|
30
|
+
function WalletRequired({ icon: Icon, iconClassName = "text-muted-foreground", title, description, children }) {
|
|
31
|
+
const { walletAddress, walletLoading, onRequireWallet, connectLabel } = (0, import_medialane_app.useMedialaneApp)();
|
|
32
|
+
if (walletAddress) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
33
|
+
if (walletLoading) {
|
|
34
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "max-w-lg mx-auto px-4 pt-24 pb-8 space-y-4", children: [
|
|
35
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: "h-10 w-10 rounded-full mx-auto" }),
|
|
36
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: "h-7 w-56 mx-auto" }),
|
|
37
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: "h-4 w-72 mx-auto" }),
|
|
38
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: "h-10 w-44 mx-auto rounded-md" })
|
|
39
|
+
] });
|
|
40
|
+
}
|
|
41
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "max-w-lg mx-auto px-4 pt-24 pb-8 text-center space-y-4", children: [
|
|
42
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { className: `h-10 w-10 mx-auto ${iconClassName}` }),
|
|
43
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { className: "text-2xl font-bold", children: title }),
|
|
44
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-muted-foreground", children: description }),
|
|
45
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btn-border-animated inline-block p-[1px] rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
46
|
+
import_button.Button,
|
|
47
|
+
{
|
|
48
|
+
onClick: onRequireWallet,
|
|
49
|
+
className: "bg-transparent text-white rounded-[7px] hover:bg-transparent hover:brightness-110 active:scale-[0.98] transition-all",
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Wallet, { className: "h-4 w-4 mr-1.5" }),
|
|
52
|
+
connectLabel ?? "Connect"
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
) })
|
|
56
|
+
] });
|
|
57
|
+
}
|
|
58
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
59
|
+
0 && (module.exports = {
|
|
60
|
+
WalletRequired
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=wallet-required.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/wallet-required.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ElementType, ReactNode } from \"react\";\nimport { Wallet } from \"lucide-react\";\nimport { Button } from \"./button.js\";\nimport { Skeleton } from \"./skeleton.js\";\nimport { useMedialaneApp } from \"./medialane-app.js\";\n\nexport interface WalletRequiredProps {\n icon: ElementType;\n iconClassName?: string;\n title: string;\n description: string;\n children: ReactNode;\n}\n\nexport function WalletRequired({ icon: Icon, iconClassName = \"text-muted-foreground\", title, description, children }: WalletRequiredProps) {\n const { walletAddress, walletLoading, onRequireWallet, connectLabel } = useMedialaneApp();\n\n if (walletAddress) return <>{children}</>;\n\n if (walletLoading) {\n return (\n <div className=\"max-w-lg mx-auto px-4 pt-24 pb-8 space-y-4\">\n <Skeleton className=\"h-10 w-10 rounded-full mx-auto\" />\n <Skeleton className=\"h-7 w-56 mx-auto\" />\n <Skeleton className=\"h-4 w-72 mx-auto\" />\n <Skeleton className=\"h-10 w-44 mx-auto rounded-md\" />\n </div>\n );\n }\n\n return (\n <div className=\"max-w-lg mx-auto px-4 pt-24 pb-8 text-center space-y-4\">\n <Icon className={`h-10 w-10 mx-auto ${iconClassName}`} />\n <h1 className=\"text-2xl font-bold\">{title}</h1>\n <p className=\"text-muted-foreground\">{description}</p>\n <div className=\"btn-border-animated inline-block p-[1px] rounded-lg\">\n <Button\n onClick={onRequireWallet}\n className=\"bg-transparent text-white rounded-[7px] hover:bg-transparent hover:brightness-110 active:scale-[0.98] transition-all\"\n >\n <Wallet className=\"h-4 w-4 mr-1.5\" />\n {connectLabel ?? \"Connect\"}\n </Button>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmB4B;AAhB5B,0BAAuB;AACvB,oBAAuB;AACvB,sBAAyB;AACzB,2BAAgC;AAUzB,SAAS,eAAe,EAAE,MAAM,MAAM,gBAAgB,yBAAyB,OAAO,aAAa,SAAS,GAAwB;AACzI,QAAM,EAAE,eAAe,eAAe,iBAAiB,aAAa,QAAI,sCAAgB;AAExF,MAAI,cAAe,QAAO,2EAAG,UAAS;AAEtC,MAAI,eAAe;AACjB,WACE,6CAAC,SAAI,WAAU,8CACb;AAAA,kDAAC,4BAAS,WAAU,kCAAiC;AAAA,MACrD,4CAAC,4BAAS,WAAU,oBAAmB;AAAA,MACvC,4CAAC,4BAAS,WAAU,oBAAmB;AAAA,MACvC,4CAAC,4BAAS,WAAU,gCAA+B;AAAA,OACrD;AAAA,EAEJ;AAEA,SACE,6CAAC,SAAI,WAAU,0DACb;AAAA,gDAAC,QAAK,WAAW,qBAAqB,aAAa,IAAI;AAAA,IACvD,4CAAC,QAAG,WAAU,sBAAsB,iBAAM;AAAA,IAC1C,4CAAC,OAAE,WAAU,yBAAyB,uBAAY;AAAA,IAClD,4CAAC,SAAI,WAAU,uDACb;AAAA,MAAC;AAAA;AAAA,QACC,SAAS;AAAA,QACT,WAAU;AAAA,QAEV;AAAA,sDAAC,8BAAO,WAAU,kBAAiB;AAAA,UAClC,gBAAgB;AAAA;AAAA;AAAA,IACnB,GACF;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ElementType, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface WalletRequiredProps {
|
|
5
|
+
icon: ElementType;
|
|
6
|
+
iconClassName?: string;
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
declare function WalletRequired({ icon: Icon, iconClassName, title, description, children }: WalletRequiredProps): react_jsx_runtime.JSX.Element;
|
|
12
|
+
|
|
13
|
+
export { WalletRequired, type WalletRequiredProps };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ElementType, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface WalletRequiredProps {
|
|
5
|
+
icon: ElementType;
|
|
6
|
+
iconClassName?: string;
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
declare function WalletRequired({ icon: Icon, iconClassName, title, description, children }: WalletRequiredProps): react_jsx_runtime.JSX.Element;
|
|
12
|
+
|
|
13
|
+
export { WalletRequired, type WalletRequiredProps };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Wallet } from "lucide-react";
|
|
4
|
+
import { Button } from "./button.js";
|
|
5
|
+
import { Skeleton } from "./skeleton.js";
|
|
6
|
+
import { useMedialaneApp } from "./medialane-app.js";
|
|
7
|
+
function WalletRequired({ icon: Icon, iconClassName = "text-muted-foreground", title, description, children }) {
|
|
8
|
+
const { walletAddress, walletLoading, onRequireWallet, connectLabel } = useMedialaneApp();
|
|
9
|
+
if (walletAddress) return /* @__PURE__ */ jsx(Fragment, { children });
|
|
10
|
+
if (walletLoading) {
|
|
11
|
+
return /* @__PURE__ */ jsxs("div", { className: "max-w-lg mx-auto px-4 pt-24 pb-8 space-y-4", children: [
|
|
12
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-10 rounded-full mx-auto" }),
|
|
13
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-7 w-56 mx-auto" }),
|
|
14
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-72 mx-auto" }),
|
|
15
|
+
/* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-44 mx-auto rounded-md" })
|
|
16
|
+
] });
|
|
17
|
+
}
|
|
18
|
+
return /* @__PURE__ */ jsxs("div", { className: "max-w-lg mx-auto px-4 pt-24 pb-8 text-center space-y-4", children: [
|
|
19
|
+
/* @__PURE__ */ jsx(Icon, { className: `h-10 w-10 mx-auto ${iconClassName}` }),
|
|
20
|
+
/* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold", children: title }),
|
|
21
|
+
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: description }),
|
|
22
|
+
/* @__PURE__ */ jsx("div", { className: "btn-border-animated inline-block p-[1px] rounded-lg", children: /* @__PURE__ */ jsxs(
|
|
23
|
+
Button,
|
|
24
|
+
{
|
|
25
|
+
onClick: onRequireWallet,
|
|
26
|
+
className: "bg-transparent text-white rounded-[7px] hover:bg-transparent hover:brightness-110 active:scale-[0.98] transition-all",
|
|
27
|
+
children: [
|
|
28
|
+
/* @__PURE__ */ jsx(Wallet, { className: "h-4 w-4 mr-1.5" }),
|
|
29
|
+
connectLabel ?? "Connect"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
) })
|
|
33
|
+
] });
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
WalletRequired
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=wallet-required.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/wallet-required.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ElementType, ReactNode } from \"react\";\nimport { Wallet } from \"lucide-react\";\nimport { Button } from \"./button.js\";\nimport { Skeleton } from \"./skeleton.js\";\nimport { useMedialaneApp } from \"./medialane-app.js\";\n\nexport interface WalletRequiredProps {\n icon: ElementType;\n iconClassName?: string;\n title: string;\n description: string;\n children: ReactNode;\n}\n\nexport function WalletRequired({ icon: Icon, iconClassName = \"text-muted-foreground\", title, description, children }: WalletRequiredProps) {\n const { walletAddress, walletLoading, onRequireWallet, connectLabel } = useMedialaneApp();\n\n if (walletAddress) return <>{children}</>;\n\n if (walletLoading) {\n return (\n <div className=\"max-w-lg mx-auto px-4 pt-24 pb-8 space-y-4\">\n <Skeleton className=\"h-10 w-10 rounded-full mx-auto\" />\n <Skeleton className=\"h-7 w-56 mx-auto\" />\n <Skeleton className=\"h-4 w-72 mx-auto\" />\n <Skeleton className=\"h-10 w-44 mx-auto rounded-md\" />\n </div>\n );\n }\n\n return (\n <div className=\"max-w-lg mx-auto px-4 pt-24 pb-8 text-center space-y-4\">\n <Icon className={`h-10 w-10 mx-auto ${iconClassName}`} />\n <h1 className=\"text-2xl font-bold\">{title}</h1>\n <p className=\"text-muted-foreground\">{description}</p>\n <div className=\"btn-border-animated inline-block p-[1px] rounded-lg\">\n <Button\n onClick={onRequireWallet}\n className=\"bg-transparent text-white rounded-[7px] hover:bg-transparent hover:brightness-110 active:scale-[0.98] transition-all\"\n >\n <Wallet className=\"h-4 w-4 mr-1.5\" />\n {connectLabel ?? \"Connect\"}\n </Button>\n </div>\n </div>\n );\n}\n"],"mappings":";AAmB4B,wBAItB,YAJsB;AAhB5B,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAUzB,SAAS,eAAe,EAAE,MAAM,MAAM,gBAAgB,yBAAyB,OAAO,aAAa,SAAS,GAAwB;AACzI,QAAM,EAAE,eAAe,eAAe,iBAAiB,aAAa,IAAI,gBAAgB;AAExF,MAAI,cAAe,QAAO,gCAAG,UAAS;AAEtC,MAAI,eAAe;AACjB,WACE,qBAAC,SAAI,WAAU,8CACb;AAAA,0BAAC,YAAS,WAAU,kCAAiC;AAAA,MACrD,oBAAC,YAAS,WAAU,oBAAmB;AAAA,MACvC,oBAAC,YAAS,WAAU,oBAAmB;AAAA,MACvC,oBAAC,YAAS,WAAU,gCAA+B;AAAA,OACrD;AAAA,EAEJ;AAEA,SACE,qBAAC,SAAI,WAAU,0DACb;AAAA,wBAAC,QAAK,WAAW,qBAAqB,aAAa,IAAI;AAAA,IACvD,oBAAC,QAAG,WAAU,sBAAsB,iBAAM;AAAA,IAC1C,oBAAC,OAAE,WAAU,yBAAyB,uBAAY;AAAA,IAClD,oBAAC,SAAI,WAAU,uDACb;AAAA,MAAC;AAAA;AAAA,QACC,SAAS;AAAA,QACT,WAAU;AAAA,QAEV;AAAA,8BAAC,UAAO,WAAU,kBAAiB;AAAA,UAClC,gBAAgB;AAAA;AAAA;AAAA,IACnB,GACF;AAAA,KACF;AAEJ;","names":[]}
|