@ludo.ninja/components 2.2.24 → 2.2.26
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.
|
@@ -2,31 +2,35 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ProfileDataInitialization = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const store_1 = require("../store");
|
|
6
|
+
const ui_1 = require("../../../store/ui");
|
|
5
7
|
const api_1 = require("@ludo.ninja/api");
|
|
6
8
|
const api_2 = require("@ludo.ninja/api");
|
|
7
9
|
const type_1 = require("@ludo.ninja/ui/build/system/Alert/type");
|
|
8
|
-
const store_1 = require("../store");
|
|
9
|
-
const ui_1 = require("../../../store/ui");
|
|
10
10
|
const FetcherMyProfile = ( /*{ userId }: { userId: string }*/) => {
|
|
11
11
|
const openAlert = (0, ui_1.useUiStore)((state) => state.openAlert);
|
|
12
12
|
const { setIsLoadingProfileData, setProfileData,
|
|
13
13
|
// profileData,
|
|
14
|
-
setUserExp, setInviteCodes, } = (0, store_1.useUserStore)((state) => ({
|
|
14
|
+
setUserExp, setInviteCodes, setMyShareLink, } = (0, store_1.useUserStore)((state) => ({
|
|
15
15
|
setIsLoadingProfileData: state.setIsLoadingProfileData,
|
|
16
16
|
setProfileData: state.setProfileData,
|
|
17
17
|
profileData: state.profileData,
|
|
18
18
|
setUserExp: state.setUserExp,
|
|
19
19
|
setInviteCodes: state.setInviteCodes,
|
|
20
|
+
setMyShareLink: state.setMyShareLink,
|
|
20
21
|
}));
|
|
21
22
|
// console.log('profileData', profileData);
|
|
22
23
|
api_2.identitySchema.useFetchMyProfileV2Query({
|
|
23
24
|
context: {
|
|
24
25
|
uri: api_1.hosts.identityHost,
|
|
25
26
|
},
|
|
27
|
+
fetchPolicy: "no-cache",
|
|
26
28
|
onCompleted: ({ fetchMyProfileV2: fetchMyProfile }) => {
|
|
27
29
|
// console.log('fetchMyProfile', fetchMyProfile);
|
|
28
30
|
setProfileData(fetchMyProfile);
|
|
29
|
-
|
|
31
|
+
if (fetchMyProfile.shareLink) {
|
|
32
|
+
setMyShareLink(fetchMyProfile.shareLink);
|
|
33
|
+
}
|
|
30
34
|
if (fetchMyProfile.xps) {
|
|
31
35
|
setUserExp({
|
|
32
36
|
levelMaxXps: fetchMyProfile.levelMaxXps,
|
|
@@ -38,6 +42,7 @@ const FetcherMyProfile = ( /*{ userId }: { userId: string }*/) => {
|
|
|
38
42
|
if (fetchMyProfile.inviteCodes) {
|
|
39
43
|
setInviteCodes(fetchMyProfile.inviteCodes);
|
|
40
44
|
}
|
|
45
|
+
setIsLoadingProfileData(false);
|
|
41
46
|
},
|
|
42
47
|
onError: (err) => {
|
|
43
48
|
openAlert({
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ApolloError } from '@apollo/client';
|
|
2
|
-
import { experiencesSchema as schema } from '@ludo.ninja/api';
|
|
3
|
-
import { identitySchema } from '@ludo.ninja/api';
|
|
4
|
-
import { ProfileEntity } from '@ludo.ninja/core';
|
|
5
1
|
import { IUser } from '../../entities/user/type';
|
|
6
|
-
|
|
2
|
+
import { ApolloError } from "@apollo/client";
|
|
3
|
+
import { experiencesSchema as schema } from "@ludo.ninja/api";
|
|
4
|
+
import { identitySchema } from "@ludo.ninja/api";
|
|
5
|
+
import { ProfileEntity } from "@ludo.ninja/core";
|
|
6
|
+
type TMyProfile = identitySchema.IFetchMyProfileV2Query["fetchMyProfileV2"];
|
|
7
7
|
export interface IUserStore {
|
|
8
8
|
user: IUser | null;
|
|
9
9
|
setUser: (user: IUser | null) => void;
|
|
@@ -20,9 +20,11 @@ export interface IUserStore {
|
|
|
20
20
|
profileData: ProfileEntity | null;
|
|
21
21
|
setProfileData: (profileObject: TMyProfile | null) => void;
|
|
22
22
|
profileObject: TMyProfile | null;
|
|
23
|
-
updateProfileData: (profile: Pick<TMyProfile,
|
|
23
|
+
updateProfileData: (profile: Pick<TMyProfile, "showNsfw" | "social" | "about" | "username" | "userpic">) => void;
|
|
24
24
|
inviteCodes: identitySchema.IInviteCode[];
|
|
25
25
|
setInviteCodes: (inviteCodes: identitySchema.IInviteCode[]) => void;
|
|
26
|
+
myShareLink: string;
|
|
27
|
+
setMyShareLink: (myShareLink: string) => void;
|
|
26
28
|
}
|
|
27
29
|
export declare const UserProvider: ({ children, initialState }: {
|
|
28
30
|
children: import("react").ReactNode;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useUserStore = exports.UserProvider = void 0;
|
|
4
|
+
const core_1 = require("@ludo.ninja/core");
|
|
4
5
|
const next_zustand_1 = require("next-zustand");
|
|
5
6
|
const shallow_1 = require("zustand/shallow");
|
|
6
|
-
const core_1 = require("@ludo.ninja/core");
|
|
7
7
|
const initialUserExp = {
|
|
8
8
|
xps: 0,
|
|
9
9
|
level: 1,
|
|
@@ -68,6 +68,10 @@ const creators = (0, next_zustand_1.createProvider)()((setState) => ({
|
|
|
68
68
|
setInviteCodes: (inviteCodes) => {
|
|
69
69
|
setState({ inviteCodes });
|
|
70
70
|
},
|
|
71
|
+
myShareLink: "",
|
|
72
|
+
setMyShareLink: (myShareLink) => {
|
|
73
|
+
setState({ myShareLink });
|
|
74
|
+
},
|
|
71
75
|
}), shallow_1.shallow);
|
|
72
76
|
exports.UserProvider = creators.Provider;
|
|
73
77
|
exports.useUserStore = creators.getUseStore();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ludo.ninja/components",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.26",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"publish": "npm publish --access public -workspace @ludo.ninja/components"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@ludo.ninja/api": "^3.0.
|
|
26
|
+
"@ludo.ninja/api": "^3.0.21",
|
|
27
27
|
"@react-three/drei": "^9.68.3",
|
|
28
28
|
"@react-three/fiber": "^8.13.0",
|
|
29
29
|
"chart.js": "^4.4.3",
|