@medialane/ui 0.161.0 → 0.162.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/button.d.cts +1 -1
- package/dist/components/button.d.ts +1 -1
- 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/{badge-unlock-toast-content.cjs → badge-unlocked.cjs} +7 -7
- package/dist/components/rewards/badge-unlocked.cjs.map +1 -0
- package/dist/components/rewards/badge-unlocked.d.cts +9 -0
- package/dist/components/rewards/badge-unlocked.d.ts +9 -0
- package/dist/components/rewards/{badge-unlock-toast-content.js → badge-unlocked.js} +3 -3
- package/dist/components/rewards/badge-unlocked.js.map +1 -0
- package/dist/components/rewards/reward-earned.cjs +65 -0
- package/dist/components/rewards/reward-earned.cjs.map +1 -0
- package/dist/components/rewards/reward-earned.d.cts +15 -0
- package/dist/components/rewards/reward-earned.d.ts +15 -0
- package/dist/components/rewards/reward-earned.js +41 -0
- package/dist/components/rewards/reward-earned.js.map +1 -0
- package/dist/components/rewards/{xp-toast-content.cjs → xp-earned.cjs} +7 -7
- package/dist/components/rewards/xp-earned.cjs.map +1 -0
- package/dist/components/rewards/xp-earned.d.cts +13 -0
- package/dist/components/rewards/xp-earned.d.ts +13 -0
- package/dist/components/rewards/{xp-toast-content.js → xp-earned.js} +3 -3
- package/dist/components/rewards/xp-earned.js.map +1 -0
- package/dist/components/share-button.cjs +0 -2
- package/dist/components/share-button.cjs.map +1 -1
- package/dist/components/share-button.js +0 -2
- package/dist/components/share-button.js.map +1 -1
- package/dist/components/sheet.d.cts +1 -1
- package/dist/components/sheet.d.ts +1 -1
- package/dist/index.cjs +9 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -3
- package/dist/components/rewards/badge-unlock-toast-content.cjs.map +0 -1
- package/dist/components/rewards/badge-unlock-toast-content.d.cts +0 -9
- package/dist/components/rewards/badge-unlock-toast-content.d.ts +0 -9
- package/dist/components/rewards/badge-unlock-toast-content.js.map +0 -1
- package/dist/components/rewards/reward-toast.cjs +0 -66
- package/dist/components/rewards/reward-toast.cjs.map +0 -1
- package/dist/components/rewards/reward-toast.d.cts +0 -9
- package/dist/components/rewards/reward-toast.d.ts +0 -9
- package/dist/components/rewards/reward-toast.js +0 -42
- package/dist/components/rewards/reward-toast.js.map +0 -1
- package/dist/components/rewards/xp-toast-content.cjs.map +0 -1
- package/dist/components/rewards/xp-toast-content.d.cts +0 -13
- package/dist/components/rewards/xp-toast-content.d.ts +0 -13
- package/dist/components/rewards/xp-toast-content.js.map +0 -1
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
|
|
5
5
|
declare const buttonVariants: (props?: ({
|
|
6
|
-
variant?: "
|
|
6
|
+
variant?: "link" | "default" | "destructive" | "outline" | "ghost" | "secondary" | "premium" | "tonal" | "gradient-border" | "gradient-fill" | null | undefined;
|
|
7
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> {
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
|
|
5
5
|
declare const buttonVariants: (props?: ({
|
|
6
|
-
variant?: "
|
|
6
|
+
variant?: "link" | "default" | "destructive" | "outline" | "ghost" | "secondary" | "premium" | "tonal" | "gradient-border" | "gradient-fill" | null | undefined;
|
|
7
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> {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import * as React from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
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 | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> |
|
|
8
|
+
declare function FastMint(props: FastMintProps): string | number | bigint | boolean | react_jsx_runtime.JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined;
|
|
9
9
|
|
|
10
10
|
export { FastMint };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import * as React from 'react';
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
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 | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> |
|
|
8
|
+
declare function FastMint(props: FastMintProps): string | number | bigint | boolean | react_jsx_runtime.JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined;
|
|
9
9
|
|
|
10
10
|
export { FastMint };
|
|
@@ -16,14 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
|
|
19
|
+
var badge_unlocked_exports = {};
|
|
20
|
+
__export(badge_unlocked_exports, {
|
|
21
|
+
BadgeUnlocked: () => BadgeUnlocked
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(badge_unlocked_exports);
|
|
24
24
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
25
|
var import_badge_shelf = require("./badge-shelf.js");
|
|
26
|
-
function
|
|
26
|
+
function BadgeUnlocked({ badge }) {
|
|
27
27
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2.5", children: [
|
|
28
28
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
29
29
|
"span",
|
|
@@ -44,6 +44,6 @@ function BadgeUnlockToastContent({ badge }) {
|
|
|
44
44
|
}
|
|
45
45
|
// Annotate the CommonJS export names for ESM import in node:
|
|
46
46
|
0 && (module.exports = {
|
|
47
|
-
|
|
47
|
+
BadgeUnlocked
|
|
48
48
|
});
|
|
49
|
-
//# sourceMappingURL=badge-
|
|
49
|
+
//# sourceMappingURL=badge-unlocked.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/rewards/badge-unlocked.tsx"],"sourcesContent":["import { BadgeIcon } from \"./badge-shelf.js\";\nimport type { BadgeShelfBadge } from \"./badge-shelf.js\";\n\nexport interface BadgeUnlockedProps {\n badge: BadgeShelfBadge;\n}\n\nexport function BadgeUnlocked({ badge }: BadgeUnlockedProps) {\n return (\n <div className=\"flex items-center gap-2.5\">\n <span\n className=\"flex h-8 w-8 shrink-0 items-center justify-center rounded-full border\"\n style={{ borderColor: `${badge.color}60`, backgroundColor: `${badge.color}18` }}\n >\n <BadgeIcon name={badge.icon} color={badge.color} className=\"h-4 w-4\" />\n </span>\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm font-semibold\">Badge earned · {badge.name}</p>\n <p className=\"text-xs text-muted-foreground truncate\">{badge.description}</p>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAcQ;AAdR,yBAA0B;AAOnB,SAAS,cAAc,EAAE,MAAM,GAAuB;AAC3D,SACE,6CAAC,SAAI,WAAU,6BACb;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,WAAU;AAAA,QACV,OAAO,EAAE,aAAa,GAAG,MAAM,KAAK,MAAM,iBAAiB,GAAG,MAAM,KAAK,KAAK;AAAA,QAE9E,sDAAC,gCAAU,MAAM,MAAM,MAAM,OAAO,MAAM,OAAO,WAAU,WAAU;AAAA;AAAA,IACvE;AAAA,IACA,6CAAC,SAAI,WAAU,WACb;AAAA,mDAAC,OAAE,WAAU,kCAAiC;AAAA;AAAA,QAAgB,MAAM;AAAA,SAAK;AAAA,MACzE,4CAAC,OAAE,WAAU,0CAA0C,gBAAM,aAAY;AAAA,OAC3E;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { BadgeShelfBadge } from './badge-shelf.cjs';
|
|
3
|
+
|
|
4
|
+
interface BadgeUnlockedProps {
|
|
5
|
+
badge: BadgeShelfBadge;
|
|
6
|
+
}
|
|
7
|
+
declare function BadgeUnlocked({ badge }: BadgeUnlockedProps): react_jsx_runtime.JSX.Element;
|
|
8
|
+
|
|
9
|
+
export { BadgeUnlocked, type BadgeUnlockedProps };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { BadgeShelfBadge } from './badge-shelf.js';
|
|
3
|
+
|
|
4
|
+
interface BadgeUnlockedProps {
|
|
5
|
+
badge: BadgeShelfBadge;
|
|
6
|
+
}
|
|
7
|
+
declare function BadgeUnlocked({ badge }: BadgeUnlockedProps): react_jsx_runtime.JSX.Element;
|
|
8
|
+
|
|
9
|
+
export { BadgeUnlocked, type BadgeUnlockedProps };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { BadgeIcon } from "./badge-shelf.js";
|
|
3
|
-
function
|
|
3
|
+
function BadgeUnlocked({ badge }) {
|
|
4
4
|
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5", children: [
|
|
5
5
|
/* @__PURE__ */ jsx(
|
|
6
6
|
"span",
|
|
@@ -20,6 +20,6 @@ function BadgeUnlockToastContent({ badge }) {
|
|
|
20
20
|
] });
|
|
21
21
|
}
|
|
22
22
|
export {
|
|
23
|
-
|
|
23
|
+
BadgeUnlocked
|
|
24
24
|
};
|
|
25
|
-
//# sourceMappingURL=badge-
|
|
25
|
+
//# sourceMappingURL=badge-unlocked.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/rewards/badge-unlocked.tsx"],"sourcesContent":["import { BadgeIcon } from \"./badge-shelf.js\";\nimport type { BadgeShelfBadge } from \"./badge-shelf.js\";\n\nexport interface BadgeUnlockedProps {\n badge: BadgeShelfBadge;\n}\n\nexport function BadgeUnlocked({ badge }: BadgeUnlockedProps) {\n return (\n <div className=\"flex items-center gap-2.5\">\n <span\n className=\"flex h-8 w-8 shrink-0 items-center justify-center rounded-full border\"\n style={{ borderColor: `${badge.color}60`, backgroundColor: `${badge.color}18` }}\n >\n <BadgeIcon name={badge.icon} color={badge.color} className=\"h-4 w-4\" />\n </span>\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm font-semibold\">Badge earned · {badge.name}</p>\n <p className=\"text-xs text-muted-foreground truncate\">{badge.description}</p>\n </div>\n </div>\n );\n}\n"],"mappings":"AAcQ,cAGA,YAHA;AAdR,SAAS,iBAAiB;AAOnB,SAAS,cAAc,EAAE,MAAM,GAAuB;AAC3D,SACE,qBAAC,SAAI,WAAU,6BACb;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,WAAU;AAAA,QACV,OAAO,EAAE,aAAa,GAAG,MAAM,KAAK,MAAM,iBAAiB,GAAG,MAAM,KAAK,KAAK;AAAA,QAE9E,8BAAC,aAAU,MAAM,MAAM,MAAM,OAAO,MAAM,OAAO,WAAU,WAAU;AAAA;AAAA,IACvE;AAAA,IACA,qBAAC,SAAI,WAAU,WACb;AAAA,2BAAC,OAAE,WAAU,kCAAiC;AAAA;AAAA,QAAgB,MAAM;AAAA,SAAK;AAAA,MACzE,oBAAC,OAAE,WAAU,0CAA0C,gBAAM,aAAY;AAAA,OAC3E;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,65 @@
|
|
|
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 reward_earned_exports = {};
|
|
21
|
+
__export(reward_earned_exports, {
|
|
22
|
+
createRewardEarned: () => createRewardEarned
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(reward_earned_exports);
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_xp_earned = require("./xp-earned.js");
|
|
28
|
+
function createRewardEarned(getRewardsConfig) {
|
|
29
|
+
let configPromise = null;
|
|
30
|
+
const loadConfig = () => configPromise ?? (configPromise = getRewardsConfig());
|
|
31
|
+
return function RewardEarned({ actionType, snapshot, className }) {
|
|
32
|
+
const [config, setConfig] = (0, import_react.useState)(null);
|
|
33
|
+
(0, import_react.useEffect)(() => {
|
|
34
|
+
let alive = true;
|
|
35
|
+
loadConfig().then((loaded) => {
|
|
36
|
+
if (alive) setConfig(loaded);
|
|
37
|
+
}).catch((err) => {
|
|
38
|
+
console.error("rewards config could not be loaded", err);
|
|
39
|
+
configPromise = null;
|
|
40
|
+
});
|
|
41
|
+
return () => {
|
|
42
|
+
alive = false;
|
|
43
|
+
};
|
|
44
|
+
}, []);
|
|
45
|
+
const action = config?.actions.find((a) => a.type === actionType);
|
|
46
|
+
if (!config || !action) return null;
|
|
47
|
+
const level = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel) : void 0;
|
|
48
|
+
const nextLevel = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel + 1) : void 0;
|
|
49
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
50
|
+
import_xp_earned.XpEarned,
|
|
51
|
+
{
|
|
52
|
+
xp: action.xp,
|
|
53
|
+
label: action.label,
|
|
54
|
+
totalXp: snapshot?.totalXp,
|
|
55
|
+
levelXp: snapshot ? level?.xpRequired ?? 0 : void 0,
|
|
56
|
+
nextLevelXp: snapshot ? nextLevel?.xpRequired ?? null : void 0
|
|
57
|
+
}
|
|
58
|
+
) });
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
62
|
+
0 && (module.exports = {
|
|
63
|
+
createRewardEarned
|
|
64
|
+
});
|
|
65
|
+
//# sourceMappingURL=reward-earned.cjs.map
|
|
@@ -0,0 +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\nexport function createRewardEarned(getRewardsConfig: () => Promise<ApiRewardsConfig>) {\n let configPromise: Promise<ApiRewardsConfig> | null = null;\n const loadConfig = () => (configPromise ??= getRewardsConfig());\n\n return function RewardEarned({ actionType, snapshot, className }: RewardEarnedProps) {\n const [config, setConfig] = useState<ApiRewardsConfig | null>(null);\n\n useEffect(() => {\n let alive = true;\n loadConfig()\n .then((loaded) => {\n if (alive) setConfig(loaded);\n })\n .catch((err) => {\n console.error(\"rewards config could not be loaded\", err);\n configPromise = null;\n });\n return () => {\n alive = false;\n };\n }, []);\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}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA+CQ;AA7CR,mBAAoC;AACpC,uBAAyB;AAclB,SAAS,mBAAmB,kBAAmD;AACpF,MAAI,gBAAkD;AACtD,QAAM,aAAa,MAAO,kCAAkB,iBAAiB;AAE7D,SAAO,SAAS,aAAa,EAAE,YAAY,UAAU,UAAU,GAAsB;AACnF,UAAM,CAAC,QAAQ,SAAS,QAAI,uBAAkC,IAAI;AAElE,gCAAU,MAAM;AACd,UAAI,QAAQ;AACZ,iBAAW,EACR,KAAK,CAAC,WAAW;AAChB,YAAI,MAAO,WAAU,MAAM;AAAA,MAC7B,CAAC,EACA,MAAM,CAAC,QAAQ;AACd,gBAAQ,MAAM,sCAAsC,GAAG;AACvD,wBAAgB;AAAA,MAClB,CAAC;AACH,aAAO,MAAM;AACX,gBAAQ;AAAA,MACV;AAAA,IACF,GAAG,CAAC,CAAC;AAEL,UAAM,SAAS,QAAQ,QAAQ,KAAK,CAAC,MAAM,EAAE,SAAS,UAAU;AAChE,QAAI,CAAC,UAAU,CAAC,OAAQ,QAAO;AAE/B,UAAM,QAAQ,WAAW,OAAO,OAAO,KAAK,CAAC,MAAM,EAAE,UAAU,SAAS,YAAY,IAAI;AACxF,UAAM,YAAY,WAAW,OAAO,OAAO,KAAK,CAAC,MAAM,EAAE,UAAU,SAAS,eAAe,CAAC,IAAI;AAEhG,WACE,4CAAC,SAAI,WACH;AAAA,MAAC;AAAA;AAAA,QACC,IAAI,OAAO;AAAA,QACX,OAAO,OAAO;AAAA,QACd,SAAS,UAAU;AAAA,QACnB,SAAS,WAAW,OAAO,cAAc,IAAI;AAAA,QAC7C,aAAa,WAAW,WAAW,cAAc,OAAO;AAAA;AAAA,IAC1D,GACF;AAAA,EAEJ;AACF;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ApiRewardsConfig } from '@medialane/sdk';
|
|
3
|
+
|
|
4
|
+
interface RewardSnapshot {
|
|
5
|
+
totalXp: number;
|
|
6
|
+
currentLevel: number;
|
|
7
|
+
}
|
|
8
|
+
interface RewardEarnedProps {
|
|
9
|
+
actionType: string;
|
|
10
|
+
snapshot?: RewardSnapshot;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
declare function createRewardEarned(getRewardsConfig: () => Promise<ApiRewardsConfig>): ({ actionType, snapshot, className }: RewardEarnedProps) => react_jsx_runtime.JSX.Element | null;
|
|
14
|
+
|
|
15
|
+
export { type RewardEarnedProps, type RewardSnapshot, createRewardEarned };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ApiRewardsConfig } from '@medialane/sdk';
|
|
3
|
+
|
|
4
|
+
interface RewardSnapshot {
|
|
5
|
+
totalXp: number;
|
|
6
|
+
currentLevel: number;
|
|
7
|
+
}
|
|
8
|
+
interface RewardEarnedProps {
|
|
9
|
+
actionType: string;
|
|
10
|
+
snapshot?: RewardSnapshot;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
declare function createRewardEarned(getRewardsConfig: () => Promise<ApiRewardsConfig>): ({ actionType, snapshot, className }: RewardEarnedProps) => react_jsx_runtime.JSX.Element | null;
|
|
14
|
+
|
|
15
|
+
export { type RewardEarnedProps, type RewardSnapshot, createRewardEarned };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { XpEarned } from "./xp-earned.js";
|
|
5
|
+
function createRewardEarned(getRewardsConfig) {
|
|
6
|
+
let configPromise = null;
|
|
7
|
+
const loadConfig = () => configPromise ?? (configPromise = getRewardsConfig());
|
|
8
|
+
return function RewardEarned({ actionType, snapshot, className }) {
|
|
9
|
+
const [config, setConfig] = useState(null);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
let alive = true;
|
|
12
|
+
loadConfig().then((loaded) => {
|
|
13
|
+
if (alive) setConfig(loaded);
|
|
14
|
+
}).catch((err) => {
|
|
15
|
+
console.error("rewards config could not be loaded", err);
|
|
16
|
+
configPromise = null;
|
|
17
|
+
});
|
|
18
|
+
return () => {
|
|
19
|
+
alive = false;
|
|
20
|
+
};
|
|
21
|
+
}, []);
|
|
22
|
+
const action = config?.actions.find((a) => a.type === actionType);
|
|
23
|
+
if (!config || !action) return null;
|
|
24
|
+
const level = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel) : void 0;
|
|
25
|
+
const nextLevel = snapshot ? config.levels.find((l) => l.level === snapshot.currentLevel + 1) : void 0;
|
|
26
|
+
return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(
|
|
27
|
+
XpEarned,
|
|
28
|
+
{
|
|
29
|
+
xp: action.xp,
|
|
30
|
+
label: action.label,
|
|
31
|
+
totalXp: snapshot?.totalXp,
|
|
32
|
+
levelXp: snapshot ? level?.xpRequired ?? 0 : void 0,
|
|
33
|
+
nextLevelXp: snapshot ? nextLevel?.xpRequired ?? null : void 0
|
|
34
|
+
}
|
|
35
|
+
) });
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
createRewardEarned
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=reward-earned.js.map
|
|
@@ -0,0 +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\nexport function createRewardEarned(getRewardsConfig: () => Promise<ApiRewardsConfig>) {\n let configPromise: Promise<ApiRewardsConfig> | null = null;\n const loadConfig = () => (configPromise ??= getRewardsConfig());\n\n return function RewardEarned({ actionType, snapshot, className }: RewardEarnedProps) {\n const [config, setConfig] = useState<ApiRewardsConfig | null>(null);\n\n useEffect(() => {\n let alive = true;\n loadConfig()\n .then((loaded) => {\n if (alive) setConfig(loaded);\n })\n .catch((err) => {\n console.error(\"rewards config could not be loaded\", err);\n configPromise = null;\n });\n return () => {\n alive = false;\n };\n }, []);\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}\n"],"mappings":";AA+CQ;AA7CR,SAAS,WAAW,gBAAgB;AACpC,SAAS,gBAAgB;AAclB,SAAS,mBAAmB,kBAAmD;AACpF,MAAI,gBAAkD;AACtD,QAAM,aAAa,MAAO,kCAAkB,iBAAiB;AAE7D,SAAO,SAAS,aAAa,EAAE,YAAY,UAAU,UAAU,GAAsB;AACnF,UAAM,CAAC,QAAQ,SAAS,IAAI,SAAkC,IAAI;AAElE,cAAU,MAAM;AACd,UAAI,QAAQ;AACZ,iBAAW,EACR,KAAK,CAAC,WAAW;AAChB,YAAI,MAAO,WAAU,MAAM;AAAA,MAC7B,CAAC,EACA,MAAM,CAAC,QAAQ;AACd,gBAAQ,MAAM,sCAAsC,GAAG;AACvD,wBAAgB;AAAA,MAClB,CAAC;AACH,aAAO,MAAM;AACX,gBAAQ;AAAA,MACV;AAAA,IACF,GAAG,CAAC,CAAC;AAEL,UAAM,SAAS,QAAQ,QAAQ,KAAK,CAAC,MAAM,EAAE,SAAS,UAAU;AAChE,QAAI,CAAC,UAAU,CAAC,OAAQ,QAAO;AAE/B,UAAM,QAAQ,WAAW,OAAO,OAAO,KAAK,CAAC,MAAM,EAAE,UAAU,SAAS,YAAY,IAAI;AACxF,UAAM,YAAY,WAAW,OAAO,OAAO,KAAK,CAAC,MAAM,EAAE,UAAU,SAAS,eAAe,CAAC,IAAI;AAEhG,WACE,oBAAC,SAAI,WACH;AAAA,MAAC;AAAA;AAAA,QACC,IAAI,OAAO;AAAA,QACX,OAAO,OAAO;AAAA,QACd,SAAS,UAAU;AAAA,QACnB,SAAS,WAAW,OAAO,cAAc,IAAI;AAAA,QAC7C,aAAa,WAAW,WAAW,cAAc,OAAO;AAAA;AAAA,IAC1D,GACF;AAAA,EAEJ;AACF;","names":[]}
|
|
@@ -16,14 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
|
|
19
|
+
var xp_earned_exports = {};
|
|
20
|
+
__export(xp_earned_exports, {
|
|
21
|
+
XpEarned: () => XpEarned
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(xp_earned_exports);
|
|
24
24
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
25
|
var import_xp_progress = require("./xp-progress.js");
|
|
26
|
-
function
|
|
26
|
+
function XpEarned({ xp, label, color = "#8b5cf6", totalXp, levelXp, nextLevelXp }) {
|
|
27
27
|
const showProgress = totalXp !== void 0 && levelXp !== void 0 && nextLevelXp !== void 0;
|
|
28
28
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
|
|
29
29
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2.5", children: [
|
|
@@ -49,6 +49,6 @@ function XpToastContent({ xp, label, color = "#8b5cf6", totalXp, levelXp, nextLe
|
|
|
49
49
|
}
|
|
50
50
|
// Annotate the CommonJS export names for ESM import in node:
|
|
51
51
|
0 && (module.exports = {
|
|
52
|
-
|
|
52
|
+
XpEarned
|
|
53
53
|
});
|
|
54
|
-
//# sourceMappingURL=xp-
|
|
54
|
+
//# sourceMappingURL=xp-earned.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/rewards/xp-earned.tsx"],"sourcesContent":["import { XpProgress } from \"./xp-progress.js\";\n\nexport interface XpEarnedProps {\n xp: number;\n\n label: string;\n color?: string;\n\n totalXp?: number;\n levelXp?: number;\n nextLevelXp?: number | null;\n}\n\nexport function XpEarned({ xp, label, color = \"#8b5cf6\", totalXp, levelXp, nextLevelXp }: XpEarnedProps) {\n const showProgress = totalXp !== undefined && levelXp !== undefined && nextLevelXp !== undefined;\n return (\n <div className=\"flex flex-col gap-1.5\">\n <div className=\"flex items-center gap-2.5\">\n <span\n className=\"flex h-8 shrink-0 items-center rounded-full border px-2.5 text-sm font-black tabular-nums\"\n style={{ borderColor: `${color}60`, backgroundColor: `${color}18`, color }}\n >\n +{xp} XP\n </span>\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm font-semibold\">{label}</p>\n {!showProgress && <p className=\"text-xs text-muted-foreground\">Counts toward your score soon</p>}\n </div>\n </div>\n {showProgress && (\n <XpProgress totalXp={totalXp!} levelXp={levelXp!} nextLevelXp={nextLevelXp!} badgeColor={color} variant=\"bar\" />\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBQ;AAlBR,yBAA2B;AAapB,SAAS,SAAS,EAAE,IAAI,OAAO,QAAQ,WAAW,SAAS,SAAS,YAAY,GAAkB;AACvG,QAAM,eAAe,YAAY,UAAa,YAAY,UAAa,gBAAgB;AACvF,SACE,6CAAC,SAAI,WAAU,yBACb;AAAA,iDAAC,SAAI,WAAU,6BACb;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UACV,OAAO,EAAE,aAAa,GAAG,KAAK,MAAM,iBAAiB,GAAG,KAAK,MAAM,MAAM;AAAA,UAC1E;AAAA;AAAA,YACG;AAAA,YAAG;AAAA;AAAA;AAAA,MACP;AAAA,MACA,6CAAC,SAAI,WAAU,WACb;AAAA,oDAAC,OAAE,WAAU,kCAAkC,iBAAM;AAAA,QACpD,CAAC,gBAAgB,4CAAC,OAAE,WAAU,iCAAgC,2CAA6B;AAAA,SAC9F;AAAA,OACF;AAAA,IACC,gBACC,4CAAC,iCAAW,SAAmB,SAAmB,aAA2B,YAAY,OAAO,SAAQ,OAAM;AAAA,KAElH;AAEJ;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface XpEarnedProps {
|
|
4
|
+
xp: number;
|
|
5
|
+
label: string;
|
|
6
|
+
color?: string;
|
|
7
|
+
totalXp?: number;
|
|
8
|
+
levelXp?: number;
|
|
9
|
+
nextLevelXp?: number | null;
|
|
10
|
+
}
|
|
11
|
+
declare function XpEarned({ xp, label, color, totalXp, levelXp, nextLevelXp }: XpEarnedProps): react_jsx_runtime.JSX.Element;
|
|
12
|
+
|
|
13
|
+
export { XpEarned, type XpEarnedProps };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface XpEarnedProps {
|
|
4
|
+
xp: number;
|
|
5
|
+
label: string;
|
|
6
|
+
color?: string;
|
|
7
|
+
totalXp?: number;
|
|
8
|
+
levelXp?: number;
|
|
9
|
+
nextLevelXp?: number | null;
|
|
10
|
+
}
|
|
11
|
+
declare function XpEarned({ xp, label, color, totalXp, levelXp, nextLevelXp }: XpEarnedProps): react_jsx_runtime.JSX.Element;
|
|
12
|
+
|
|
13
|
+
export { XpEarned, type XpEarnedProps };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { XpProgress } from "./xp-progress.js";
|
|
3
|
-
function
|
|
3
|
+
function XpEarned({ xp, label, color = "#8b5cf6", totalXp, levelXp, nextLevelXp }) {
|
|
4
4
|
const showProgress = totalXp !== void 0 && levelXp !== void 0 && nextLevelXp !== void 0;
|
|
5
5
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
|
|
6
6
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5", children: [
|
|
@@ -25,6 +25,6 @@ function XpToastContent({ xp, label, color = "#8b5cf6", totalXp, levelXp, nextLe
|
|
|
25
25
|
] });
|
|
26
26
|
}
|
|
27
27
|
export {
|
|
28
|
-
|
|
28
|
+
XpEarned
|
|
29
29
|
};
|
|
30
|
-
//# sourceMappingURL=xp-
|
|
30
|
+
//# sourceMappingURL=xp-earned.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/rewards/xp-earned.tsx"],"sourcesContent":["import { XpProgress } from \"./xp-progress.js\";\n\nexport interface XpEarnedProps {\n xp: number;\n\n label: string;\n color?: string;\n\n totalXp?: number;\n levelXp?: number;\n nextLevelXp?: number | null;\n}\n\nexport function XpEarned({ xp, label, color = \"#8b5cf6\", totalXp, levelXp, nextLevelXp }: XpEarnedProps) {\n const showProgress = totalXp !== undefined && levelXp !== undefined && nextLevelXp !== undefined;\n return (\n <div className=\"flex flex-col gap-1.5\">\n <div className=\"flex items-center gap-2.5\">\n <span\n className=\"flex h-8 shrink-0 items-center rounded-full border px-2.5 text-sm font-black tabular-nums\"\n style={{ borderColor: `${color}60`, backgroundColor: `${color}18`, color }}\n >\n +{xp} XP\n </span>\n <div className=\"min-w-0\">\n <p className=\"truncate text-sm font-semibold\">{label}</p>\n {!showProgress && <p className=\"text-xs text-muted-foreground\">Counts toward your score soon</p>}\n </div>\n </div>\n {showProgress && (\n <XpProgress totalXp={totalXp!} levelXp={levelXp!} nextLevelXp={nextLevelXp!} badgeColor={color} variant=\"bar\" />\n )}\n </div>\n );\n}\n"],"mappings":"AAkBQ,SAOE,KAPF;AAlBR,SAAS,kBAAkB;AAapB,SAAS,SAAS,EAAE,IAAI,OAAO,QAAQ,WAAW,SAAS,SAAS,YAAY,GAAkB;AACvG,QAAM,eAAe,YAAY,UAAa,YAAY,UAAa,gBAAgB;AACvF,SACE,qBAAC,SAAI,WAAU,yBACb;AAAA,yBAAC,SAAI,WAAU,6BACb;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,WAAU;AAAA,UACV,OAAO,EAAE,aAAa,GAAG,KAAK,MAAM,iBAAiB,GAAG,KAAK,MAAM,MAAM;AAAA,UAC1E;AAAA;AAAA,YACG;AAAA,YAAG;AAAA;AAAA;AAAA,MACP;AAAA,MACA,qBAAC,SAAI,WAAU,WACb;AAAA,4BAAC,OAAE,WAAU,kCAAkC,iBAAM;AAAA,QACpD,CAAC,gBAAgB,oBAAC,OAAE,WAAU,iCAAgC,2CAA6B;AAAA,SAC9F;AAAA,OACF;AAAA,IACC,gBACC,oBAAC,cAAW,SAAmB,SAAmB,aAA2B,YAAY,OAAO,SAAQ,OAAM;AAAA,KAElH;AAEJ;","names":[]}
|
|
@@ -25,7 +25,6 @@ module.exports = __toCommonJS(share_button_exports);
|
|
|
25
25
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
26
|
var import_react = require("react");
|
|
27
27
|
var import_lucide_react = require("lucide-react");
|
|
28
|
-
var import_sonner = require("sonner");
|
|
29
28
|
var import_cn = require("../utils/cn.js");
|
|
30
29
|
const VARIANT_CLASSES = {
|
|
31
30
|
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
@@ -56,7 +55,6 @@ function ShareButton({
|
|
|
56
55
|
} else {
|
|
57
56
|
await navigator.clipboard.writeText(shareUrl);
|
|
58
57
|
setCopied(true);
|
|
59
|
-
import_sonner.toast.success("Link copied to clipboard");
|
|
60
58
|
setTimeout(() => setCopied(false), 2e3);
|
|
61
59
|
}
|
|
62
60
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/share-button.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { Share2, Check } from \"lucide-react\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/components/share-button.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { Share2, Check } from \"lucide-react\";\nimport { cn } from \"../utils/cn.js\";\n\nexport interface ShareButtonProps {\n title: string;\n url?: string;\n variant?: \"outline\" | \"ghost\" | \"default\";\n size?: \"sm\" | \"default\" | \"lg\" | \"icon\";\n className?: string;\n}\n\nconst VARIANT_CLASSES: Record<NonNullable<ShareButtonProps[\"variant\"]>, string> = {\n outline: \"border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n default: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n};\n\nconst SIZE_CLASSES: Record<NonNullable<ShareButtonProps[\"size\"]>, string> = {\n sm: \"h-9 px-3 text-xs rounded-md\",\n default: \"h-10 px-4 py-2 text-sm rounded-md\",\n lg: \"h-11 px-8 text-sm rounded-md\",\n icon: \"min-h-11 min-w-11 rounded-md\",\n};\n\nexport function ShareButton({\n title,\n url,\n variant = \"outline\",\n size = \"sm\",\n className,\n}: ShareButtonProps) {\n const [copied, setCopied] = useState(false);\n\n const handleShare = async () => {\n const shareUrl = url ?? (typeof window !== \"undefined\" ? window.location.href : \"\");\n if (typeof navigator !== \"undefined\" && navigator.share) {\n try {\n await navigator.share({ title, url: shareUrl });\n } catch {\n\n }\n } else {\n await navigator.clipboard.writeText(shareUrl);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n }\n };\n\n return (\n <button\n onClick={handleShare}\n className={cn(\n \"inline-flex items-center justify-center font-medium transition-colors\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n VARIANT_CLASSES[variant],\n SIZE_CLASSES[size],\n className\n )}\n >\n {copied\n ? <Check className=\"h-3.5 w-3.5 text-emerald-500\" />\n : <Share2 className=\"h-3.5 w-3.5\" />\n }\n {size !== \"icon\" && (\n <span className=\"ml-1.5\">{copied ? \"Copied\" : \"Share\"}</span>\n )}\n </button>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoDI;AAlDJ,mBAAyB;AACzB,0BAA8B;AAC9B,gBAAmB;AAUnB,MAAM,kBAA4E;AAAA,EAChF,SAAS;AAAA,EACT,OAAO;AAAA,EACP,SAAS;AACX;AAEA,MAAM,eAAsE;AAAA,EAC1E,IAAI;AAAA,EACJ,SAAS;AAAA,EACT,IAAI;AAAA,EACJ,MAAM;AACR;AAEO,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,OAAO;AAAA,EACP;AACF,GAAqB;AACnB,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAS,KAAK;AAE1C,QAAM,cAAc,YAAY;AAC9B,UAAM,WAAW,QAAQ,OAAO,WAAW,cAAc,OAAO,SAAS,OAAO;AAChF,QAAI,OAAO,cAAc,eAAe,UAAU,OAAO;AACvD,UAAI;AACF,cAAM,UAAU,MAAM,EAAE,OAAO,KAAK,SAAS,CAAC;AAAA,MAChD,QAAQ;AAAA,MAER;AAAA,IACF,OAAO;AACL,YAAM,UAAU,UAAU,UAAU,QAAQ;AAC5C,gBAAU,IAAI;AACd,iBAAW,MAAM,UAAU,KAAK,GAAG,GAAI;AAAA,IACzC;AAAA,EACF;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAS;AAAA,MACT,eAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA,gBAAgB,OAAO;AAAA,QACvB,aAAa,IAAI;AAAA,QACjB;AAAA,MACF;AAAA,MAEC;AAAA,iBACG,4CAAC,6BAAM,WAAU,gCAA+B,IAChD,4CAAC,8BAAO,WAAU,eAAc;AAAA,QAEnC,SAAS,UACR,4CAAC,UAAK,WAAU,UAAU,mBAAS,WAAW,SAAQ;AAAA;AAAA;AAAA,EAE1D;AAEJ;","names":[]}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { Share2, Check } from "lucide-react";
|
|
5
|
-
import { toast } from "sonner";
|
|
6
5
|
import { cn } from "../utils/cn.js";
|
|
7
6
|
const VARIANT_CLASSES = {
|
|
8
7
|
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
@@ -33,7 +32,6 @@ function ShareButton({
|
|
|
33
32
|
} else {
|
|
34
33
|
await navigator.clipboard.writeText(shareUrl);
|
|
35
34
|
setCopied(true);
|
|
36
|
-
toast.success("Link copied to clipboard");
|
|
37
35
|
setTimeout(() => setCopied(false), 2e3);
|
|
38
36
|
}
|
|
39
37
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/share-button.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { Share2, Check } from \"lucide-react\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/components/share-button.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { Share2, Check } from \"lucide-react\";\nimport { cn } from \"../utils/cn.js\";\n\nexport interface ShareButtonProps {\n title: string;\n url?: string;\n variant?: \"outline\" | \"ghost\" | \"default\";\n size?: \"sm\" | \"default\" | \"lg\" | \"icon\";\n className?: string;\n}\n\nconst VARIANT_CLASSES: Record<NonNullable<ShareButtonProps[\"variant\"]>, string> = {\n outline: \"border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n default: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n};\n\nconst SIZE_CLASSES: Record<NonNullable<ShareButtonProps[\"size\"]>, string> = {\n sm: \"h-9 px-3 text-xs rounded-md\",\n default: \"h-10 px-4 py-2 text-sm rounded-md\",\n lg: \"h-11 px-8 text-sm rounded-md\",\n icon: \"min-h-11 min-w-11 rounded-md\",\n};\n\nexport function ShareButton({\n title,\n url,\n variant = \"outline\",\n size = \"sm\",\n className,\n}: ShareButtonProps) {\n const [copied, setCopied] = useState(false);\n\n const handleShare = async () => {\n const shareUrl = url ?? (typeof window !== \"undefined\" ? window.location.href : \"\");\n if (typeof navigator !== \"undefined\" && navigator.share) {\n try {\n await navigator.share({ title, url: shareUrl });\n } catch {\n\n }\n } else {\n await navigator.clipboard.writeText(shareUrl);\n setCopied(true);\n setTimeout(() => setCopied(false), 2000);\n }\n };\n\n return (\n <button\n onClick={handleShare}\n className={cn(\n \"inline-flex items-center justify-center font-medium transition-colors\",\n \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n VARIANT_CLASSES[variant],\n SIZE_CLASSES[size],\n className\n )}\n >\n {copied\n ? <Check className=\"h-3.5 w-3.5 text-emerald-500\" />\n : <Share2 className=\"h-3.5 w-3.5\" />\n }\n {size !== \"icon\" && (\n <span className=\"ml-1.5\">{copied ? \"Copied\" : \"Share\"}</span>\n )}\n </button>\n );\n}\n"],"mappings":";AAoDI,SAYM,KAZN;AAlDJ,SAAS,gBAAgB;AACzB,SAAS,QAAQ,aAAa;AAC9B,SAAS,UAAU;AAUnB,MAAM,kBAA4E;AAAA,EAChF,SAAS;AAAA,EACT,OAAO;AAAA,EACP,SAAS;AACX;AAEA,MAAM,eAAsE;AAAA,EAC1E,IAAI;AAAA,EACJ,SAAS;AAAA,EACT,IAAI;AAAA,EACJ,MAAM;AACR;AAEO,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,OAAO;AAAA,EACP;AACF,GAAqB;AACnB,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,KAAK;AAE1C,QAAM,cAAc,YAAY;AAC9B,UAAM,WAAW,QAAQ,OAAO,WAAW,cAAc,OAAO,SAAS,OAAO;AAChF,QAAI,OAAO,cAAc,eAAe,UAAU,OAAO;AACvD,UAAI;AACF,cAAM,UAAU,MAAM,EAAE,OAAO,KAAK,SAAS,CAAC;AAAA,MAChD,QAAQ;AAAA,MAER;AAAA,IACF,OAAO;AACL,YAAM,UAAU,UAAU,UAAU,QAAQ;AAC5C,gBAAU,IAAI;AACd,iBAAW,MAAM,UAAU,KAAK,GAAG,GAAI;AAAA,IACzC;AAAA,EACF;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAS;AAAA,MACT,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA,gBAAgB,OAAO;AAAA,QACvB,aAAa,IAAI;AAAA,QACjB;AAAA,MACF;AAAA,MAEC;AAAA,iBACG,oBAAC,SAAM,WAAU,gCAA+B,IAChD,oBAAC,UAAO,WAAU,eAAc;AAAA,QAEnC,SAAS,UACR,oBAAC,UAAK,WAAU,UAAU,mBAAS,WAAW,SAAQ;AAAA;AAAA;AAAA,EAE1D;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?: "bottom" | "left" | "right" | "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?: "bottom" | "left" | "right" | "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;
|
package/dist/index.cjs
CHANGED
|
@@ -53,7 +53,7 @@ __export(index_exports, {
|
|
|
53
53
|
Badge: () => import_badge.Badge,
|
|
54
54
|
BadgeCatalog: () => import_badge_catalog.BadgeCatalog,
|
|
55
55
|
BadgeShelf: () => import_badge_shelf.BadgeShelf,
|
|
56
|
-
|
|
56
|
+
BadgeUnlocked: () => import_badge_unlocked.BadgeUnlocked,
|
|
57
57
|
Button: () => import_button.Button,
|
|
58
58
|
COIN_GRID: () => import_coin_row.COIN_GRID,
|
|
59
59
|
COIN_KINDS: () => import_coins.COIN_KINDS,
|
|
@@ -286,8 +286,8 @@ __export(index_exports, {
|
|
|
286
286
|
TokenCardSkeleton: () => import_token_card.TokenCardSkeleton,
|
|
287
287
|
TokenGlyph: () => import_token_glyph.TokenGlyph,
|
|
288
288
|
WrongNetworkError: () => import_wallet_error.WrongNetworkError,
|
|
289
|
+
XpEarned: () => import_xp_earned.XpEarned,
|
|
289
290
|
XpProgress: () => import_xp_progress.XpProgress,
|
|
290
|
-
XpToastContent: () => import_xp_toast_content.XpToastContent,
|
|
291
291
|
apiFetch: () => import_api_fetch.apiFetch,
|
|
292
292
|
assertCorrectNetwork: () => import_wallet_error.assertCorrectNetwork,
|
|
293
293
|
badgeVariants: () => import_badge.badgeVariants,
|
|
@@ -300,7 +300,7 @@ __export(index_exports, {
|
|
|
300
300
|
coinKindLabelPlural: () => import_coins.coinKindLabelPlural,
|
|
301
301
|
coinServiceIds: () => import_coins.coinServiceIds,
|
|
302
302
|
coinSupply: () => import_coins.coinSupply,
|
|
303
|
-
|
|
303
|
+
createRewardEarned: () => import_reward_earned.createRewardEarned,
|
|
304
304
|
derivePortfolioCounts: () => import_portfolio_counts.derivePortfolioCounts,
|
|
305
305
|
dropCreateSchema: () => import_drop_create_schema.dropCreateSchema,
|
|
306
306
|
fdvUsd: () => import_coins.fdvUsd,
|
|
@@ -492,8 +492,8 @@ var import_score_summary_card = require("./components/rewards/score-summary-card
|
|
|
492
492
|
var import_leaderboard_table = require("./components/rewards/leaderboard-table.js");
|
|
493
493
|
var import_level_journey_list = require("./components/rewards/level-journey-list.js");
|
|
494
494
|
var import_badge_catalog = require("./components/rewards/badge-catalog.js");
|
|
495
|
-
var
|
|
496
|
-
var
|
|
495
|
+
var import_xp_earned = require("./components/rewards/xp-earned.js");
|
|
496
|
+
var import_reward_earned = require("./components/rewards/reward-earned.js");
|
|
497
497
|
var import_load_more_sentinel = require("./components/load-more-sentinel.js");
|
|
498
498
|
var import_rewards_section = require("./components/rewards-section.js");
|
|
499
499
|
var import_action_button = require("./components/action-button.js");
|
|
@@ -507,7 +507,7 @@ var import_hidden_content_banner = require("./components/hidden-content-banner.j
|
|
|
507
507
|
var import_collection_hero_banner = require("./components/collection-hero-banner.js");
|
|
508
508
|
var import_use_rewards_celebrations = require("./components/rewards/use-rewards-celebrations.js");
|
|
509
509
|
var import_level_up_celebration = require("./components/rewards/level-up-celebration.js");
|
|
510
|
-
var
|
|
510
|
+
var import_badge_unlocked = require("./components/rewards/badge-unlocked.js");
|
|
511
511
|
var import_journey_path = require("./components/rewards/journey-path.js");
|
|
512
512
|
var import_skeleton = require("./components/skeleton.js");
|
|
513
513
|
var import_badge = require("./components/badge.js");
|
|
@@ -602,7 +602,7 @@ var import_export_key_section = require("./components/wallet/export-key-section.
|
|
|
602
602
|
Badge,
|
|
603
603
|
BadgeCatalog,
|
|
604
604
|
BadgeShelf,
|
|
605
|
-
|
|
605
|
+
BadgeUnlocked,
|
|
606
606
|
Button,
|
|
607
607
|
COIN_GRID,
|
|
608
608
|
COIN_KINDS,
|
|
@@ -835,8 +835,8 @@ var import_export_key_section = require("./components/wallet/export-key-section.
|
|
|
835
835
|
TokenCardSkeleton,
|
|
836
836
|
TokenGlyph,
|
|
837
837
|
WrongNetworkError,
|
|
838
|
+
XpEarned,
|
|
838
839
|
XpProgress,
|
|
839
|
-
XpToastContent,
|
|
840
840
|
apiFetch,
|
|
841
841
|
assertCorrectNetwork,
|
|
842
842
|
badgeVariants,
|
|
@@ -849,7 +849,7 @@ var import_export_key_section = require("./components/wallet/export-key-section.
|
|
|
849
849
|
coinKindLabelPlural,
|
|
850
850
|
coinServiceIds,
|
|
851
851
|
coinSupply,
|
|
852
|
-
|
|
852
|
+
createRewardEarned,
|
|
853
853
|
derivePortfolioCounts,
|
|
854
854
|
dropCreateSchema,
|
|
855
855
|
fdvUsd,
|