@ludo.ninja/components 2.2.27 → 2.2.28

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.
@@ -1,4 +1,5 @@
1
1
  interface IShareDialog {
2
+ shareMyProfileLink?: string;
2
3
  link: string | null;
3
4
  onHide: () => void;
4
5
  params?: {
@@ -29,5 +30,5 @@ interface IShareDialog {
29
30
  };
30
31
  };
31
32
  }
32
- declare const ShareDialog: ({ link, onHide, params }: IShareDialog) => import("react/jsx-runtime").JSX.Element;
33
+ declare const ShareDialog: ({ link, onHide, params, shareMyProfileLink }: IShareDialog) => import("react/jsx-runtime").JSX.Element;
33
34
  export default ShareDialog;
@@ -18,6 +18,7 @@ const styled_components_1 = __importDefault(require("styled-components"));
18
18
  const STitle = (0, styled_components_1.default)(index_1.H1) `
19
19
  margin-bottom: 24px;
20
20
  color: ${colors_1.BlackColor};
21
+
21
22
  ${ScreenWidth_1.mediaQuery.minWidthFourK} {
22
23
  margin-bottom: ${(0, _4k_1.adaptiveValueCalc)(24)};
23
24
  }
@@ -73,10 +74,10 @@ const StyledShare = styled_components_1.default.div `
73
74
  }
74
75
  }
75
76
  `;
76
- const ShareDialog = ({ link, onHide, params }) => {
77
+ const ShareDialog = ({ link, onHide, params, shareMyProfileLink }) => {
77
78
  const url = new URL(link || "");
78
79
  url.search = "";
79
- const urlWithoutGetParameters = url.toString();
80
+ const urlWithoutGetParameters = shareMyProfileLink || url.toString();
80
81
  const openAlert = (0, ui_1.useUiStore)((state) => state.openAlert);
81
82
  return ((0, jsx_runtime_1.jsxs)(StyledShare, { children: [(0, jsx_runtime_1.jsx)(index_1.Flex, { alignItems: "center", justifyContent: "center", children: (0, jsx_runtime_1.jsx)(STitle, { children: "Share to..." }) }), (0, jsx_runtime_1.jsxs)("div", { className: "shareButtons", children: [(0, jsx_runtime_1.jsxs)("button", { onClick: () => {
82
83
  onHide();
@@ -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
- setIsLoadingProfileData(false);
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
- type TMyProfile = identitySchema.IFetchMyProfileV2Query['fetchMyProfileV2'];
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, 'showNsfw' | 'social' | 'about' | 'username' | 'userpic'>) => void;
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.27",
3
+ "version": "2.2.28",
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.20",
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",