@ludo.ninja/components 2.3.96 → 2.3.99

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.
@@ -0,0 +1,2 @@
1
+ declare const useFetchMyExperience: () => void;
2
+ export default useFetchMyExperience;
@@ -6,7 +6,7 @@ const api_1 = require("@ludo.ninja/api");
6
6
  const store_1 = require("../../../../modules/user/store");
7
7
  const ui_1 = require("../../../../store/ui");
8
8
  const getErrorAlertProps_1 = require("../../../../utils/getErrorAlertProps");
9
- const useFetchMyExperienceWithLevel = () => {
9
+ const useFetchMyExperience = () => {
10
10
  const { isSignedIn, setUserExp, resetUserExp, setErrorExp, setIsLoadingExp, } = (0, store_1.useUserStore)((state) => ({
11
11
  user: state.user,
12
12
  isSignedIn: state.isSignedIn,
@@ -18,17 +18,14 @@ const useFetchMyExperienceWithLevel = () => {
18
18
  const { openAlert } = (0, ui_1.useUiStore)((state) => ({
19
19
  openAlert: state.openAlert
20
20
  }));
21
- const [fetchExp] = (0, client_1.useLazyQuery)(api_1.experiencesSchema.FetchMyExperienceV2Document, {
21
+ const [fetchExp] = (0, client_1.useLazyQuery)(api_1.experiencesSchema.FetchMyExperienceDocument, {
22
22
  context: {
23
23
  uri: api_1.hosts.experiencesHost,
24
24
  },
25
- onCompleted: ({ fetchMyExperienceV2: { xps, level, levelMaxXps, levelMinXps }, }) => {
25
+ onCompleted: ({ fetchMyExperience: xps }) => {
26
26
  setIsLoadingExp(false);
27
27
  setUserExp({
28
28
  xps,
29
- level,
30
- levelMaxXps,
31
- levelMinXps,
32
29
  });
33
30
  },
34
31
  onError: (err) => {
@@ -45,4 +42,4 @@ const useFetchMyExperienceWithLevel = () => {
45
42
  }
46
43
  }, [isSignedIn]);
47
44
  };
48
- exports.default = useFetchMyExperienceWithLevel;
45
+ exports.default = useFetchMyExperience;
@@ -19,14 +19,13 @@ const Overlay_1 = __importDefault(require("../system/Overlay"));
19
19
  const screen_1 = require("../utils/screen");
20
20
  const useMultiAudio_1 = __importDefault(require("../hooks/audio/useMultiAudio"));
21
21
  const CreatorNotifications_1 = require("../modules/notifications/CreatorNotifications");
22
- const useFetchMyExperienceWithLevel_1 = __importDefault(require("../api/server-experiences/queries/useFetchMyExperienceWithLevel"));
22
+ // import useFetchMyExperience from '@/api/server-experiences/queries/useFetchMyExperience';
23
23
  const sessionScroll_1 = require("../modules/sessionScroll");
24
24
  const SubscriberNotifications_1 = require("../api/subscriptions/SubscriberNotifications");
25
25
  const GlobalLayout = ({ children }) => {
26
- (0, useFetchMyExperienceWithLevel_1.default)();
26
+ // useFetchMyExperience();
27
27
  (0, useMultiAudio_1.default)();
28
28
  (0, useAuthVerification_1.useAuthVerification)();
29
- (0, useFetchMyExperienceWithLevel_1.default)();
30
29
  const NEXT_PUBLIC_ENV_VALUE = (0, env_1.useEnvStore)((state) => state.NEXT_PUBLIC_ENV_VALUE);
31
30
  const envValue = NEXT_PUBLIC_ENV_VALUE !== 'prod' ? NEXT_PUBLIC_ENV_VALUE : '';
32
31
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(profileDataInitialization_1.ProfileDataInitialization, {}), (0, jsx_runtime_1.jsx)(envLine_1.default, { isNeedToShow: envValue }), (0, jsx_runtime_1.jsx)(globalStyles_1.default, {}), children, (0, jsx_runtime_1.jsx)(CreatorNotifications_1.CreatorNotifications, {}), (0, jsx_runtime_1.jsx)(screen_1.InitializeAppHeight, {}), (0, jsx_runtime_1.jsx)(SubscriberNotifications_1.SubscriberNotification, {}), (0, jsx_runtime_1.jsx)(Overlay_1.default, {}), (0, jsx_runtime_1.jsx)(initializer_1.SidebarInitializer, {}), (0, jsx_runtime_1.jsx)(Alert_1.default, {}), (0, jsx_runtime_1.jsx)(Modal_1.default, {}), (0, jsx_runtime_1.jsx)(ModalSidebar_1.default, {}), (0, jsx_runtime_1.jsx)(CreatorModalSidebarPortal_1.CreatorModalSidebarPortal, {}), (0, jsx_runtime_1.jsx)(sessionScroll_1.DeleteScrollStateInterceptor, {})] }));
@@ -3,14 +3,17 @@ import { ApolloError } from "@apollo/client";
3
3
  import { experiencesSchema as schema } from "@ludo.ninja/api";
4
4
  import { identitySchema } from "@ludo.ninja/api";
5
5
  import { ProfileEntity } from "@ludo.ninja/core";
6
+ export type UserXp = {
7
+ xps: number;
8
+ };
6
9
  export declare const initialUserStreak: Omit<schema.IActivityStreak, 'userId'>;
7
10
  type TMyProfile = identitySchema.IFetchMyProfileV2Query["fetchMyProfileV2"];
8
11
  export interface IUserStore {
9
12
  user: IUser | null;
10
13
  setUser: (user: IUser | null) => void;
11
14
  isSignedIn: boolean;
12
- userExp: schema.IUserXp;
13
- setUserExp: (userExp: schema.IUserXp) => void;
15
+ userExp: UserXp;
16
+ setUserExp: (userExp: UserXp) => void;
14
17
  resetUserExp: () => void;
15
18
  isLoadingExp: boolean;
16
19
  setIsLoadingExp: (isLoadingExp: boolean) => void;
@@ -6,9 +6,9 @@ const next_zustand_1 = require("next-zustand");
6
6
  const shallow_1 = require("zustand/shallow");
7
7
  const initialUserExp = {
8
8
  xps: 0,
9
- level: 1,
10
- levelMaxXps: 0,
11
- levelMinXps: 0,
9
+ // level: 1,
10
+ // levelMaxXps: 0,
11
+ // levelMinXps: 0,
12
12
  };
13
13
  exports.initialUserStreak = {
14
14
  totalDays: 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ludo.ninja/components",
3
- "version": "2.3.96",
3
+ "version": "2.3.99",
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.2.44",
26
+ "@ludo.ninja/api": "^3.2.45",
27
27
  "@next/third-parties": "^15.3.4",
28
28
  "@react-three/drei": "^9.68.3",
29
29
  "@react-three/fiber": "^8.13.0",
@@ -1,2 +0,0 @@
1
- declare const useFetchMyExperienceWithLevel: () => void;
2
- export default useFetchMyExperienceWithLevel;
@@ -1 +0,0 @@
1
- export declare const SubscriberInviteNotification: () => import("react/jsx-runtime").JSX.Element | null;
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SubscriberInviteNotification = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const router_1 = require("next/router");
7
- const client_1 = require("@apollo/client");
8
- const api_1 = require("@ludo.ninja/api");
9
- const store_1 = require("../../modules/user/store");
10
- const ui_1 = require("../../store/ui");
11
- const notifications_1 = require("../../modules/notifications");
12
- const ludoDomains_1 = require("@ludo.ninja/core/build/ludoDomains");
13
- const env_1 = require("../../store/env");
14
- const Subscription = () => {
15
- const NEXT_PUBLIC_ENV_VALUE = (0, env_1.useEnvStore)(state => state.NEXT_PUBLIC_ENV_VALUE);
16
- const { authToken } = api_1.authCookies.getCookies();
17
- const router = (0, router_1.useRouter)();
18
- const addNotification = (0, ui_1.useUiStore)((state) => state.addNotification);
19
- (0, client_1.useSubscription)(api_1.experiencesSchema.OnInviteCodeUsedDocument, {
20
- variables: { authToken },
21
- // onComplete: () => {
22
- // console.log('complete');
23
- // },
24
- onData: (options) => {
25
- const inviteCode = options.data.data?.onInviteCodeUsed.inviteCode;
26
- // console.log('onData', inviteCode);
27
- if (inviteCode) {
28
- addNotification((0, notifications_1.createInviteNotification)({
29
- inviteCode,
30
- onClick: () => {
31
- const domain = ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["app"];
32
- if (domain === window.origin) {
33
- router.push(`/invite-codes`);
34
- }
35
- else {
36
- window.open(`${domain}/invite-codes`, '_self');
37
- }
38
- },
39
- }));
40
- }
41
- },
42
- });
43
- return null;
44
- };
45
- const SubscriberInviteNotification = () => {
46
- const isSignedIn = (0, store_1.useUserStore)((state) => state.isSignedIn);
47
- const [startSubscription, setStartSubscription] = (0, react_1.useState)(false);
48
- (0, react_1.useEffect)(() => {
49
- setStartSubscription(isSignedIn);
50
- }, [isSignedIn]);
51
- return startSubscription ? (0, jsx_runtime_1.jsx)(Subscription, {}) : null;
52
- };
53
- exports.SubscriberInviteNotification = SubscriberInviteNotification;
@@ -1 +0,0 @@
1
- export declare const SubscriberOpportunityNotification: () => import("react/jsx-runtime").JSX.Element;
@@ -1,75 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SubscriberOpportunityNotification = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const client_1 = require("@apollo/client");
7
- const api_1 = require("@ludo.ninja/api");
8
- const notifications_1 = require("../../modules/notifications");
9
- const store_1 = require("../../modules/user/store");
10
- const env_1 = require("../../store/env");
11
- const ui_1 = require("../../store/ui");
12
- const Subscription = () => {
13
- const { authToken } = api_1.authCookies.getCookies();
14
- const addNotification = (0, ui_1.useUiStore)((state) => state.addNotification);
15
- const getMediaENVDomain = (0, env_1.useEnvStore)((state) => state.getMediaDomain);
16
- (0, client_1.useSubscription)(api_1.experiencesSchema.OnUserOpportunityNotificationDocument, {
17
- variables: { authToken },
18
- // onComplete: () => {
19
- // console.log('complete');
20
- // },
21
- onData: (options) => {
22
- const opportunity = options.data.data?.onUserOpportunityNotification;
23
- // console.log('OnUser', opportunity);
24
- if (opportunity) {
25
- addNotification((0, notifications_1.createOpportunityNotification)({
26
- image: opportunity.media
27
- ? `${getMediaENVDomain()}/opportunity-medias/${opportunity.media}`
28
- : '',
29
- title: opportunity.name || 'Opportunity',
30
- description: opportunity.description || '',
31
- onClick: () => {
32
- if (opportunity.projectUrl) {
33
- window.open(opportunity.projectUrl, '_blank');
34
- }
35
- },
36
- }));
37
- }
38
- },
39
- });
40
- return null;
41
- };
42
- const SubscriptionCommon = () => {
43
- const addNotification = (0, ui_1.useUiStore)((state) => state.addNotification);
44
- const getMediaENVDomain = (0, env_1.useEnvStore)((state) => state.getMediaDomain);
45
- (0, client_1.useSubscription)(api_1.experiencesSchema.OnCommonOpportunityNotificationDocument, {
46
- onData: (options) => {
47
- const opportunity = options.data.data?.onCommonOpportunityNotification;
48
- // console.log('OnCommon', opportunity);
49
- if (opportunity && opportunity.notificationType === 'push') {
50
- addNotification((0, notifications_1.createOpportunityNotification)({
51
- image: opportunity.media
52
- ? `${getMediaENVDomain()}/opportunity-medias/${opportunity.media}`
53
- : '',
54
- title: opportunity.name || 'Opportunity',
55
- description: opportunity.description || '',
56
- onClick: () => {
57
- if (opportunity.projectUrl) {
58
- window.open(opportunity.projectUrl, '_blank');
59
- }
60
- },
61
- }));
62
- }
63
- },
64
- });
65
- return null;
66
- };
67
- const SubscriberOpportunityNotification = () => {
68
- const isSignedIn = (0, store_1.useUserStore)((state) => state.isSignedIn);
69
- const [startSubscription, setStartSubscription] = (0, react_1.useState)(false);
70
- (0, react_1.useEffect)(() => {
71
- setStartSubscription(isSignedIn);
72
- }, [isSignedIn]);
73
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SubscriptionCommon, {}), startSubscription && (0, jsx_runtime_1.jsx)(Subscription, {})] }));
74
- };
75
- exports.SubscriberOpportunityNotification = SubscriberOpportunityNotification;