@b3dotfun/sdk 0.1.69-alpha.10 → 0.1.69-alpha.11

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.
Files changed (38) hide show
  1. package/dist/cjs/global-account/bsmnt.d.ts +0 -1
  2. package/dist/cjs/global-account/bsmnt.js +0 -6
  3. package/dist/cjs/global-account/react/utils/index.d.ts +0 -1
  4. package/dist/cjs/global-account/react/utils/index.js +0 -1
  5. package/dist/esm/global-account/bsmnt.d.ts +0 -1
  6. package/dist/esm/global-account/bsmnt.js +0 -5
  7. package/dist/esm/global-account/react/utils/index.d.ts +0 -1
  8. package/dist/esm/global-account/react/utils/index.js +0 -1
  9. package/dist/styles/index.css +1 -1
  10. package/dist/types/global-account/bsmnt.d.ts +0 -1
  11. package/dist/types/global-account/react/utils/index.d.ts +0 -1
  12. package/package.json +1 -6
  13. package/src/global-account/bsmnt.ts +0 -6
  14. package/src/global-account/react/utils/index.ts +0 -1
  15. package/dist/cjs/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +0 -6
  16. package/dist/cjs/global-account/react/components/AvatarCreator/AvatarCreator.js +0 -54
  17. package/dist/cjs/global-account/react/components/ProfileAvatar.d.ts +0 -0
  18. package/dist/cjs/global-account/react/components/ProfileAvatar.js +0 -127
  19. package/dist/cjs/global-account/react/hooks/useRPMToken.d.ts +0 -7
  20. package/dist/cjs/global-account/react/hooks/useRPMToken.js +0 -11
  21. package/dist/cjs/global-account/react/utils/updateAvatar.d.ts +0 -4
  22. package/dist/cjs/global-account/react/utils/updateAvatar.js +0 -54
  23. package/dist/esm/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +0 -6
  24. package/dist/esm/global-account/react/components/AvatarCreator/AvatarCreator.js +0 -51
  25. package/dist/esm/global-account/react/components/ProfileAvatar.d.ts +0 -0
  26. package/dist/esm/global-account/react/components/ProfileAvatar.js +0 -127
  27. package/dist/esm/global-account/react/hooks/useRPMToken.d.ts +0 -7
  28. package/dist/esm/global-account/react/hooks/useRPMToken.js +0 -8
  29. package/dist/esm/global-account/react/utils/updateAvatar.d.ts +0 -4
  30. package/dist/esm/global-account/react/utils/updateAvatar.js +0 -18
  31. package/dist/types/global-account/react/components/AvatarCreator/AvatarCreator.d.ts +0 -6
  32. package/dist/types/global-account/react/components/ProfileAvatar.d.ts +0 -0
  33. package/dist/types/global-account/react/hooks/useRPMToken.d.ts +0 -7
  34. package/dist/types/global-account/react/utils/updateAvatar.d.ts +0 -4
  35. package/src/global-account/react/components/AvatarCreator/AvatarCreator.tsx +0 -90
  36. package/src/global-account/react/components/ProfileAvatar.tsx +0 -138
  37. package/src/global-account/react/hooks/useRPMToken.ts +0 -17
  38. package/src/global-account/react/utils/updateAvatar.ts +0 -21
@@ -1,4 +1,3 @@
1
1
  export * from "./notificationsAPI";
2
2
  export * from "./profileDisplay";
3
3
  export * from "./toast";
4
- export * from "./updateAvatar";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.1.69-alpha.10",
3
+ "version": "0.1.69-alpha.11",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -388,8 +388,6 @@
388
388
  "@fingerprintjs/fingerprintjs-pro-react": "^2.7.0",
389
389
  "@privy-io/react-auth": "^2.8.0",
390
390
  "@react-three/postprocessing": "2.16.6",
391
- "@readyplayerme/react-avatar-creator": "0.5.0",
392
- "@readyplayerme/visage": "6.10.0",
393
391
  "@tanstack/react-query": "5.55.0",
394
392
  "@wagmi/core": "2.20.3",
395
393
  "react": "^18.0.0 || ^19.0.0",
@@ -404,9 +402,6 @@
404
402
  "@react-three/postprocessing": {
405
403
  "optional": true
406
404
  },
407
- "@readyplayerme/visage": {
408
- "optional": true
409
- },
410
405
  "react-native-mmkv": {
411
406
  "optional": true
412
407
  },
@@ -73,12 +73,6 @@ export const resetSocket = () => {
73
73
  // reset the socket connection
74
74
  };
75
75
 
76
- export function extractAvatarIdFromUrl(url: string): string | null {
77
- const regex = /https:\/\/models\.readyplayer\.me\/([a-f0-9]{24})\.[a-zA-Z0-9]+/;
78
- const match = url.match(regex);
79
- return match ? match[1] : null;
80
- }
81
-
82
76
  export const authenticateWithB3JWT = async (fullToken: string, params?: Record<string, any>) => {
83
77
  // Do not authenticate if there is no token
84
78
  if (!fullToken) {
@@ -1,4 +1,3 @@
1
1
  export * from "./notificationsAPI";
2
2
  export * from "./profileDisplay";
3
3
  export * from "./toast";
4
- export * from "./updateAvatar";
@@ -1,6 +0,0 @@
1
- interface AvatarCreatorProps {
2
- onSetAvatar?: () => void;
3
- className?: string;
4
- }
5
- export declare function AvatarCreator({ onSetAvatar, className }: AvatarCreatorProps): import("react/jsx-runtime").JSX.Element;
6
- export {};
@@ -1,54 +0,0 @@
1
- "use strict";
2
- "use client";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.AvatarCreator = AvatarCreator;
5
- const jsx_runtime_1 = require("react/jsx-runtime");
6
- const react_1 = require("../../../../global-account/react");
7
- const useRPMToken_1 = require("../../../../global-account/react/hooks/useRPMToken");
8
- const updateAvatar_1 = require("../../../../global-account/react/utils/updateAvatar");
9
- const cn_1 = require("../../../../shared/utils/cn");
10
- const debug_1 = require("../../../../shared/utils/debug");
11
- const react_avatar_creator_1 = require("@readyplayerme/react-avatar-creator");
12
- const react_2 = require("react");
13
- const react_3 = require("thirdweb/react");
14
- const debug = (0, debug_1.debugB3React)("AvatarCreator");
15
- const config = {
16
- clearCache: true,
17
- bodyType: "fullbody",
18
- quickStart: true,
19
- language: "en",
20
- };
21
- function AvatarCreator({ onSetAvatar, className }) {
22
- const { token, refetch: refetchRPMToken } = (0, useRPMToken_1.useRPMToken)();
23
- const [loading, setIsLoading] = (0, react_2.useState)(false);
24
- const account = (0, react_3.useActiveAccount)();
25
- const { data: profile, refetch: refreshProfile } = (0, react_1.useProfile)({
26
- address: account?.address,
27
- fresh: true,
28
- });
29
- const hasAvatar = profile?.avatar;
30
- const handleOnAvatarExported = async (event) => {
31
- setIsLoading(true);
32
- debug("@@AvatarExportedEvent", event);
33
- try {
34
- const avatarUpload = await (0, updateAvatar_1.updateAvatar)(event.data.url);
35
- debug("@@avatarUpload", avatarUpload);
36
- await refreshProfile();
37
- react_1.toast.success(hasAvatar ? "Nice look! Your avatar has been updated!" : "Looks great! Your avatar has been saved!");
38
- onSetAvatar?.();
39
- await refetchRPMToken(undefined);
40
- }
41
- catch (e) {
42
- debug("@@error:AvatarCreator", e);
43
- react_1.toast.error("Failed to update avatar. Please try again.");
44
- }
45
- setIsLoading(false);
46
- };
47
- if (loading) {
48
- return ((0, jsx_runtime_1.jsxs)("div", { className: "flex h-[80vh] w-full flex-col items-center justify-center gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "border-primary h-8 w-8 animate-spin rounded-full border-4 border-t-transparent" }), (0, jsx_runtime_1.jsx)("p", { className: "text-muted-foreground text-sm font-medium", children: "Saving your avatar" })] }));
49
- }
50
- if (!token) {
51
- return ((0, jsx_runtime_1.jsxs)("div", { className: "flex h-[80vh] w-full flex-col items-center justify-center gap-4", children: [(0, jsx_runtime_1.jsx)("div", { className: "border-primary h-8 w-8 animate-spin rounded-full border-4 border-t-transparent" }), (0, jsx_runtime_1.jsx)("p", { className: "text-muted-foreground text-sm font-medium", children: "Loading avatar creator" })] }));
52
- }
53
- return ((0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("h-[calc(90vh-2px)] w-full", className), children: (0, jsx_runtime_1.jsx)(react_avatar_creator_1.AvatarCreator, { className: "h-full w-full", subdomain: "b3", config: { ...config, token }, onAvatarExported: handleOnAvatarExported }) }));
54
- }
@@ -1,127 +0,0 @@
1
- "use strict";
2
- // "use client";
3
- // import { AnimatePresence, motion } from "motion/react";
4
- // import { useEffect, useState } from "react";
5
- // import ClientOnly from "./custom/ClientOnly";
6
- // interface ProfileAvatarProps {
7
- // avatarId: string;
8
- // timestamp?: number;
9
- // }
10
- // // this function was taken from b3-shared
11
- // function createUrlFromAvatarId(avatarId: string, extension: string = "png"): string {
12
- // if (extension === "png") {
13
- // return `https://avatars.basement.fun/${avatarId}.png`;
14
- // }
15
- // return `https://models.readyplayer.me/${avatarId}.${extension}`;
16
- // }
17
- // // Sub component for the avatar image
18
- // const ProfileAvatar = ({ avatarId, timestamp }: ProfileAvatarProps) => {
19
- // const [avatarLoading, setAvatarLoading] = useState(true);
20
- // const [avatarError, setAvatarError] = useState(false);
21
- // const [ReadyPlayerMeAvatar, setReadyPlayerMeAvatar] = useState<any>(null);
22
- // const [Vector3, setVector3] = useState<any>(null);
23
- // const [dependenciesLoaded, setDependenciesLoaded] = useState(false);
24
- // // Dynamically import dependencies only when component is used
25
- // useEffect(() => {
26
- // let isMounted = true;
27
- // const loadDependencies = async () => {
28
- // try {
29
- // const [visageModule, threeModule] = await Promise.all([
30
- // // @ts-ignore - Optional peer dependency
31
- // import("@readyplayerme/visage"),
32
- // // @ts-ignore - Optional peer dependency
33
- // import("three")
34
- // ]);
35
- // if (isMounted) {
36
- // setReadyPlayerMeAvatar(() => visageModule.Avatar);
37
- // setVector3(() => threeModule.Vector3);
38
- // setDependenciesLoaded(true);
39
- // }
40
- // } catch (error) {
41
- // console.warn("ProfileAvatar: 3D dependencies not available, falling back to 2D avatar:", error);
42
- // if (isMounted) {
43
- // setAvatarLoading(false);
44
- // setDependenciesLoaded(false);
45
- // }
46
- // }
47
- // };
48
- // loadDependencies();
49
- // return () => {
50
- // isMounted = false;
51
- // };
52
- // }, []);
53
- // if (!avatarId) {
54
- // return (
55
- // <div className="flex h-full w-full items-center justify-center">
56
- // <p className="text-white/50">No avatar available</p>
57
- // </div>
58
- // );
59
- // }
60
- // return (
61
- // <AnimatePresence mode="wait">
62
- // {(avatarLoading || !dependenciesLoaded) && !avatarError && (
63
- // <motion.img
64
- // key="avatar-image"
65
- // src={`https://models.readyplayer.me/${avatarId}.png?camera=fullbody&size=1024&expression=happy&t=${timestamp || ""}`}
66
- // alt="avatar"
67
- // className="absolute left-0 top-0 h-full w-full object-cover"
68
- // initial={{ opacity: 0 }}
69
- // animate={{ opacity: 1 }}
70
- // exit={{ opacity: 0 }}
71
- // transition={{ duration: 0.3, ease: "easeInOut" }}
72
- // onError={() => setAvatarError(true)}
73
- // />
74
- // )}
75
- // {dependenciesLoaded && (
76
- // <ClientOnly>
77
- // <motion.div
78
- // key={`avatar-3d-${timestamp}`}
79
- // className="absolute left-0 top-0 h-full w-full"
80
- // initial={{ opacity: 0 }}
81
- // animate={{ opacity: avatarLoading ? 0 : 1 }}
82
- // exit={{ opacity: 0 }}
83
- // transition={{ duration: 0.3, ease: "easeInOut" }}
84
- // >
85
- // {ReadyPlayerMeAvatar && Vector3 && (
86
- // <ReadyPlayerMeAvatar
87
- // animationSrc="https://readyplayerme-assets.s3.amazonaws.com/animations/visage/male-idle.glb"
88
- // onLoadedAnimation={{
89
- // src: "https://readyplayerme-assets.s3.amazonaws.com/animations/visage/male-spawn-animation.fbx",
90
- // loop: 4
91
- // }}
92
- // modelSrc={createUrlFromAvatarId(avatarId, "glb")}
93
- // idleRotation={true}
94
- // headMovement={true}
95
- // scale={0.9}
96
- // keyLightColor="#bca1f4"
97
- // keyLightIntensity={1}
98
- // fillLightColor="#8d4cf6"
99
- // fov={50}
100
- // emotion={{
101
- // browInnerUp: 0.3,
102
- // browOuterUpLeft: 0.37,
103
- // browOuterUpRight: 0.49,
104
- // eyeSquintLeft: 0.4,
105
- // eyeSquintRight: 0.2,
106
- // mouthShrugUpper: 0.27,
107
- // mouthSmileLeft: 0.37,
108
- // mouthSmileRight: 0.36
109
- // }}
110
- // cameraZoomTarget={new Vector3(0, 0.1, 3.2)}
111
- // cameraInitialDistance={3.2}
112
- // cameraTarget={1.55}
113
- // className="h-full w-full"
114
- // onLoaded={() => {
115
- // setAvatarLoading(false);
116
- // setAvatarError(false);
117
- // }}
118
- // shadows
119
- // />
120
- // )}
121
- // </motion.div>
122
- // </ClientOnly>
123
- // )}
124
- // </AnimatePresence>
125
- // );
126
- // };
127
- // export default ProfileAvatar;
@@ -1,7 +0,0 @@
1
- export declare function useRPMToken(): {
2
- token: string;
3
- accountId: string;
4
- refetch: (queryParams: undefined) => Promise<any>;
5
- isLoading: boolean;
6
- isError: Error | null;
7
- };
@@ -1,11 +0,0 @@
1
- "use strict";
2
- "use client";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.useRPMToken = useRPMToken;
5
- const useQueryBSMNT_1 = require("../../../global-account/react/hooks/useQueryBSMNT");
6
- function useRPMToken() {
7
- const { data, runQuery: refetch, isLoading, error: isError, } = (0, useQueryBSMNT_1.useQueryBSMNT)("profiles", "getReadyPlayerMeToken", undefined, true);
8
- const token = data?.token || "";
9
- const accountId = data?.accountId || "";
10
- return { token, accountId, refetch, isLoading, isError };
11
- }
@@ -1,4 +0,0 @@
1
- export declare function updateAvatar(avatar: string): Promise<{
2
- success: boolean;
3
- error?: string;
4
- }>;
@@ -1,54 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.updateAvatar = updateAvatar;
37
- const bsmnt_1 = __importStar(require("../../../global-account/bsmnt"));
38
- const debug_1 = require("../../../shared/utils/debug");
39
- const debug = (0, debug_1.debugB3React)("updateAvatar");
40
- async function updateAvatar(avatar) {
41
- try {
42
- // Extract avatar ID from URL
43
- const avatarID = (0, bsmnt_1.extractAvatarIdFromUrl)(avatar);
44
- if (!avatarID) {
45
- throw new Error("Invalid avatar URL");
46
- }
47
- // Set the avatar in the profiles service
48
- return await bsmnt_1.default.service("profiles").setAvatar({ avatarUrl: String(avatar), avatarID: String(avatarID) }, {});
49
- }
50
- catch (error) {
51
- debug("Failed to update avatar:", error);
52
- throw error; // Re-throw to handle in component
53
- }
54
- }
@@ -1,6 +0,0 @@
1
- interface AvatarCreatorProps {
2
- onSetAvatar?: () => void;
3
- className?: string;
4
- }
5
- export declare function AvatarCreator({ onSetAvatar, className }: AvatarCreatorProps): import("react/jsx-runtime").JSX.Element;
6
- export {};
@@ -1,51 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { toast, useProfile } from "../../../../global-account/react/index.js";
4
- import { useRPMToken } from "../../../../global-account/react/hooks/useRPMToken.js";
5
- import { updateAvatar } from "../../../../global-account/react/utils/updateAvatar.js";
6
- import { cn } from "../../../../shared/utils/cn.js";
7
- import { debugB3React } from "../../../../shared/utils/debug.js";
8
- import { AvatarCreator as AvatarCreatorRPM, } from "@readyplayerme/react-avatar-creator";
9
- import { useState } from "react";
10
- import { useActiveAccount } from "thirdweb/react";
11
- const debug = debugB3React("AvatarCreator");
12
- const config = {
13
- clearCache: true,
14
- bodyType: "fullbody",
15
- quickStart: true,
16
- language: "en",
17
- };
18
- export function AvatarCreator({ onSetAvatar, className }) {
19
- const { token, refetch: refetchRPMToken } = useRPMToken();
20
- const [loading, setIsLoading] = useState(false);
21
- const account = useActiveAccount();
22
- const { data: profile, refetch: refreshProfile } = useProfile({
23
- address: account?.address,
24
- fresh: true,
25
- });
26
- const hasAvatar = profile?.avatar;
27
- const handleOnAvatarExported = async (event) => {
28
- setIsLoading(true);
29
- debug("@@AvatarExportedEvent", event);
30
- try {
31
- const avatarUpload = await updateAvatar(event.data.url);
32
- debug("@@avatarUpload", avatarUpload);
33
- await refreshProfile();
34
- toast.success(hasAvatar ? "Nice look! Your avatar has been updated!" : "Looks great! Your avatar has been saved!");
35
- onSetAvatar?.();
36
- await refetchRPMToken(undefined);
37
- }
38
- catch (e) {
39
- debug("@@error:AvatarCreator", e);
40
- toast.error("Failed to update avatar. Please try again.");
41
- }
42
- setIsLoading(false);
43
- };
44
- if (loading) {
45
- return (_jsxs("div", { className: "flex h-[80vh] w-full flex-col items-center justify-center gap-4", children: [_jsx("div", { className: "border-primary h-8 w-8 animate-spin rounded-full border-4 border-t-transparent" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: "Saving your avatar" })] }));
46
- }
47
- if (!token) {
48
- return (_jsxs("div", { className: "flex h-[80vh] w-full flex-col items-center justify-center gap-4", children: [_jsx("div", { className: "border-primary h-8 w-8 animate-spin rounded-full border-4 border-t-transparent" }), _jsx("p", { className: "text-muted-foreground text-sm font-medium", children: "Loading avatar creator" })] }));
49
- }
50
- return (_jsx("div", { className: cn("h-[calc(90vh-2px)] w-full", className), children: _jsx(AvatarCreatorRPM, { className: "h-full w-full", subdomain: "b3", config: { ...config, token }, onAvatarExported: handleOnAvatarExported }) }));
51
- }
@@ -1,127 +0,0 @@
1
- "use strict";
2
- // "use client";
3
- // import { AnimatePresence, motion } from "motion/react";
4
- // import { useEffect, useState } from "react";
5
- // import ClientOnly from "./custom/ClientOnly.js";
6
- // interface ProfileAvatarProps {
7
- // avatarId: string;
8
- // timestamp?: number;
9
- // }
10
- // // this function was taken from b3-shared
11
- // function createUrlFromAvatarId(avatarId: string, extension: string = "png"): string {
12
- // if (extension === "png") {
13
- // return `https://avatars.basement.fun/${avatarId}.png`;
14
- // }
15
- // return `https://models.readyplayer.me/${avatarId}.${extension}`;
16
- // }
17
- // // Sub component for the avatar image
18
- // const ProfileAvatar = ({ avatarId, timestamp }: ProfileAvatarProps) => {
19
- // const [avatarLoading, setAvatarLoading] = useState(true);
20
- // const [avatarError, setAvatarError] = useState(false);
21
- // const [ReadyPlayerMeAvatar, setReadyPlayerMeAvatar] = useState<any>(null);
22
- // const [Vector3, setVector3] = useState<any>(null);
23
- // const [dependenciesLoaded, setDependenciesLoaded] = useState(false);
24
- // // Dynamically import dependencies only when component is used
25
- // useEffect(() => {
26
- // let isMounted = true;
27
- // const loadDependencies = async () => {
28
- // try {
29
- // const [visageModule, threeModule] = await Promise.all([
30
- // // @ts-ignore - Optional peer dependency
31
- // import("@readyplayerme/visage"),
32
- // // @ts-ignore - Optional peer dependency
33
- // import("three")
34
- // ]);
35
- // if (isMounted) {
36
- // setReadyPlayerMeAvatar(() => visageModule.Avatar);
37
- // setVector3(() => threeModule.Vector3);
38
- // setDependenciesLoaded(true);
39
- // }
40
- // } catch (error) {
41
- // console.warn("ProfileAvatar: 3D dependencies not available, falling back to 2D avatar:", error);
42
- // if (isMounted) {
43
- // setAvatarLoading(false);
44
- // setDependenciesLoaded(false);
45
- // }
46
- // }
47
- // };
48
- // loadDependencies();
49
- // return () => {
50
- // isMounted = false;
51
- // };
52
- // }, []);
53
- // if (!avatarId) {
54
- // return (
55
- // <div className="flex h-full w-full items-center justify-center">
56
- // <p className="text-white/50">No avatar available</p>
57
- // </div>
58
- // );
59
- // }
60
- // return (
61
- // <AnimatePresence mode="wait">
62
- // {(avatarLoading || !dependenciesLoaded) && !avatarError && (
63
- // <motion.img
64
- // key="avatar-image"
65
- // src={`https://models.readyplayer.me/${avatarId}.png?camera=fullbody&size=1024&expression=happy&t=${timestamp || ""}`}
66
- // alt="avatar"
67
- // className="absolute left-0 top-0 h-full w-full object-cover"
68
- // initial={{ opacity: 0 }}
69
- // animate={{ opacity: 1 }}
70
- // exit={{ opacity: 0 }}
71
- // transition={{ duration: 0.3, ease: "easeInOut" }}
72
- // onError={() => setAvatarError(true)}
73
- // />
74
- // )}
75
- // {dependenciesLoaded && (
76
- // <ClientOnly>
77
- // <motion.div
78
- // key={`avatar-3d-${timestamp}`}
79
- // className="absolute left-0 top-0 h-full w-full"
80
- // initial={{ opacity: 0 }}
81
- // animate={{ opacity: avatarLoading ? 0 : 1 }}
82
- // exit={{ opacity: 0 }}
83
- // transition={{ duration: 0.3, ease: "easeInOut" }}
84
- // >
85
- // {ReadyPlayerMeAvatar && Vector3 && (
86
- // <ReadyPlayerMeAvatar
87
- // animationSrc="https://readyplayerme-assets.s3.amazonaws.com/animations/visage/male-idle.glb"
88
- // onLoadedAnimation={{
89
- // src: "https://readyplayerme-assets.s3.amazonaws.com/animations/visage/male-spawn-animation.fbx",
90
- // loop: 4
91
- // }}
92
- // modelSrc={createUrlFromAvatarId(avatarId, "glb")}
93
- // idleRotation={true}
94
- // headMovement={true}
95
- // scale={0.9}
96
- // keyLightColor="#bca1f4"
97
- // keyLightIntensity={1}
98
- // fillLightColor="#8d4cf6"
99
- // fov={50}
100
- // emotion={{
101
- // browInnerUp: 0.3,
102
- // browOuterUpLeft: 0.37,
103
- // browOuterUpRight: 0.49,
104
- // eyeSquintLeft: 0.4,
105
- // eyeSquintRight: 0.2,
106
- // mouthShrugUpper: 0.27,
107
- // mouthSmileLeft: 0.37,
108
- // mouthSmileRight: 0.36
109
- // }}
110
- // cameraZoomTarget={new Vector3(0, 0.1, 3.2)}
111
- // cameraInitialDistance={3.2}
112
- // cameraTarget={1.55}
113
- // className="h-full w-full"
114
- // onLoaded={() => {
115
- // setAvatarLoading(false);
116
- // setAvatarError(false);
117
- // }}
118
- // shadows
119
- // />
120
- // )}
121
- // </motion.div>
122
- // </ClientOnly>
123
- // )}
124
- // </AnimatePresence>
125
- // );
126
- // };
127
- // export default ProfileAvatar;
@@ -1,7 +0,0 @@
1
- export declare function useRPMToken(): {
2
- token: string;
3
- accountId: string;
4
- refetch: (queryParams: undefined) => Promise<any>;
5
- isLoading: boolean;
6
- isError: Error | null;
7
- };
@@ -1,8 +0,0 @@
1
- "use client";
2
- import { useQueryBSMNT } from "../../../global-account/react/hooks/useQueryBSMNT.js";
3
- export function useRPMToken() {
4
- const { data, runQuery: refetch, isLoading, error: isError, } = useQueryBSMNT("profiles", "getReadyPlayerMeToken", undefined, true);
5
- const token = data?.token || "";
6
- const accountId = data?.accountId || "";
7
- return { token, accountId, refetch, isLoading, isError };
8
- }
@@ -1,4 +0,0 @@
1
- export declare function updateAvatar(avatar: string): Promise<{
2
- success: boolean;
3
- error?: string;
4
- }>;
@@ -1,18 +0,0 @@
1
- import app, { extractAvatarIdFromUrl } from "../../../global-account/bsmnt.js";
2
- import { debugB3React } from "../../../shared/utils/debug.js";
3
- const debug = debugB3React("updateAvatar");
4
- export async function updateAvatar(avatar) {
5
- try {
6
- // Extract avatar ID from URL
7
- const avatarID = extractAvatarIdFromUrl(avatar);
8
- if (!avatarID) {
9
- throw new Error("Invalid avatar URL");
10
- }
11
- // Set the avatar in the profiles service
12
- return await app.service("profiles").setAvatar({ avatarUrl: String(avatar), avatarID: String(avatarID) }, {});
13
- }
14
- catch (error) {
15
- debug("Failed to update avatar:", error);
16
- throw error; // Re-throw to handle in component
17
- }
18
- }
@@ -1,6 +0,0 @@
1
- interface AvatarCreatorProps {
2
- onSetAvatar?: () => void;
3
- className?: string;
4
- }
5
- export declare function AvatarCreator({ onSetAvatar, className }: AvatarCreatorProps): import("react/jsx-runtime").JSX.Element;
6
- export {};
@@ -1,7 +0,0 @@
1
- export declare function useRPMToken(): {
2
- token: string;
3
- accountId: string;
4
- refetch: (queryParams: undefined) => Promise<any>;
5
- isLoading: boolean;
6
- isError: Error | null;
7
- };
@@ -1,4 +0,0 @@
1
- export declare function updateAvatar(avatar: string): Promise<{
2
- success: boolean;
3
- error?: string;
4
- }>;