@ludo.ninja/components 2.4.11 → 2.4.13

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,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useCheckDiscordFollow = useCheckDiscordFollow;
4
4
  const react_1 = require("react");
5
- const PUBLIC_BOT_TOKEN = 'MTQyNTUxNzk0NzkyNDkwNTk5Ng.Gw3gFJ.RqMrnFGVC3yuyB13oCh2m0GDUYpeSRzfMnEXfc';
5
+ const PUBLIC_BOT_TOKEN = 'MTQyNTUxNzk0NzkyNDkwNTk5Ng.GxKVUP.DlgMRxCmLVlCzmCnIm6dBgEw5g8CtciSCCpnNI';
6
6
  function useCheckDiscordFollow(discordUserId, guildId = '854266585862504459') {
7
7
  const [status, setStatus] = (0, react_1.useState)(null);
8
8
  const [loading, setLoading] = (0, react_1.useState)(false);
@@ -3,7 +3,7 @@ import { identitySchema as schema } from "@ludo.ninja/api";
3
3
  import { IBoostType } from "@ludo.ninja/api/build/graphql_tools/__generated__/identityHost/schema";
4
4
  import React, { FC } from "react";
5
5
  export declare const Wrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
6
- type Props = Pick<schema.IProfile, "social"> & {
6
+ type Props = Pick<schema.IProfile, "social" | "userId"> & {
7
7
  refetchProfile: (variables?: Partial<OperationVariables> | undefined) => Promise<ApolloQueryResult<any>>;
8
8
  boostType: IBoostType;
9
9
  className?: string;
@@ -104,7 +104,7 @@ const ActionButton = (0, styled_components_1.default)(MainButton_1.default) `
104
104
  margin-top: ${(0, _4k_1.adaptiveValueCalc)(26)};
105
105
  }
106
106
  `;
107
- const LudoEducatorModal = ({ social, refetchProfile, boostType, className, style }) => {
107
+ const LudoEducatorModal = ({ social, refetchProfile, userId, boostType, className, style }) => {
108
108
  const twitterUserName = social?.twitter?.split("https://x.com/")?.[1] || "";
109
109
  const { followStatus, followStatusLoading } = (0, useCheckFollow_1.useCheckFollow)(twitterUserName);
110
110
  const { followDiscordStatus, followDiscordStatusLoading } = (0, useCheckDiscordFollow_1.useCheckDiscordFollow)(social?.discordId);
@@ -170,6 +170,6 @@ const LudoEducatorModal = ({ social, refetchProfile, boostType, className, style
170
170
  borderRadius: "12px",
171
171
  border: "none",
172
172
  },
173
- }, overlay: (0, jsx_runtime_1.jsx)(index_1.H6, { style: { fontWeight: 500 }, children: "You have to connect the same X account to proceed" }), children: (0, jsx_runtime_1.jsxs)(FollowLink, { onClick: () => closeModalSidebarPortal(), target: "_blank", href: (0, utils_1.appendUtmParam)("https://x.com/LudoHQ"), children: [(0, jsx_runtime_1.jsx)(index_1.H6, { children: "Follow @LudoHQ" }), (0, jsx_runtime_1.jsx)(ArrowIcon_1.default, {})] }) }) })), (0, jsx_runtime_1.jsx)(CheckListItem_1.default, { isDone: Boolean(social?.telegramId), title: (0, jsx_runtime_1.jsxs)(FollowLink, { onClick: () => closeModalSidebarPortal(), target: "_blank", href: (0, utils_1.appendUtmParam)("https://t.me/LudoAppBot"), children: [(0, jsx_runtime_1.jsx)(index_1.H6, { children: "Subscribe to @LudoAppBot" }), (0, jsx_runtime_1.jsx)(ArrowIcon_1.default, {})] }) }), boostType === schema_1.IBoostType.Ambassador && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(CheckListItem_1.default, { isDone: !!social?.discordId, title: social?.discordId ? ("Connect Discord") : ((0, jsx_runtime_1.jsxs)(StyledLink, { href: `${ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["account"]}/settings`, children: [(0, jsx_runtime_1.jsx)(index_1.H6, { children: "Connect Discord" }), (0, jsx_runtime_1.jsx)(ArrowIcon_1.default, {})] })) }), followDiscordStatusLoading ? ((0, jsx_runtime_1.jsx)(StyledSkeleton, {})) : ((0, jsx_runtime_1.jsx)(CheckListItem_1.default, { isDone: Boolean(followDiscordStatus?.following), title: (0, jsx_runtime_1.jsxs)(FollowLink, { onClick: () => closeModalSidebarPortal(), target: "_blank", href: (0, utils_1.appendUtmParam)("https://discord.gg/m2bjPqGbyj"), children: [(0, jsx_runtime_1.jsx)(index_1.H6, { children: "Join Ludo server" }), (0, jsx_runtime_1.jsx)(ArrowIcon_1.default, {})] }) }))] }))] }), isSocialsConnected && ((0, jsx_runtime_1.jsx)(ActionButton, { className: "modal-action-btn", variant: "primaryM", text: getSubmitButtonLabel(), disabled: getSubmitButtonDisabled(), onClick: handleSubmit }))] }));
173
+ }, overlay: (0, jsx_runtime_1.jsx)(index_1.H6, { style: { fontWeight: 500 }, children: "You have to connect the same X account to proceed" }), children: (0, jsx_runtime_1.jsxs)(FollowLink, { onClick: () => closeModalSidebarPortal(), target: "_blank", href: (0, utils_1.appendUtmParam)("https://x.com/LudoHQ"), children: [(0, jsx_runtime_1.jsx)(index_1.H6, { children: "Follow @LudoHQ" }), (0, jsx_runtime_1.jsx)(ArrowIcon_1.default, {})] }) }) })), (0, jsx_runtime_1.jsx)(CheckListItem_1.default, { isDone: Boolean(social?.telegramId), title: (0, jsx_runtime_1.jsxs)(FollowLink, { onClick: () => closeModalSidebarPortal(), target: "_blank", href: (0, utils_1.appendUtmParam)(`https://t.me/LudoAppBot?start=${userId}`), children: [(0, jsx_runtime_1.jsx)(index_1.H6, { children: "Subscribe to @LudoAppBot" }), (0, jsx_runtime_1.jsx)(ArrowIcon_1.default, {})] }) }), boostType === schema_1.IBoostType.Ambassador && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(CheckListItem_1.default, { isDone: !!social?.discordId, title: social?.discordId ? ("Connect Discord") : ((0, jsx_runtime_1.jsxs)(StyledLink, { href: `${ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["account"]}/settings`, children: [(0, jsx_runtime_1.jsx)(index_1.H6, { children: "Connect Discord" }), (0, jsx_runtime_1.jsx)(ArrowIcon_1.default, {})] })) }), followDiscordStatusLoading ? ((0, jsx_runtime_1.jsx)(StyledSkeleton, {})) : ((0, jsx_runtime_1.jsx)(CheckListItem_1.default, { isDone: Boolean(followDiscordStatus?.following), title: (0, jsx_runtime_1.jsxs)(FollowLink, { onClick: () => closeModalSidebarPortal(), target: "_blank", href: (0, utils_1.appendUtmParam)("https://discord.gg/m2bjPqGbyj"), children: [(0, jsx_runtime_1.jsx)(index_1.H6, { children: "Join Ludo server" }), (0, jsx_runtime_1.jsx)(ArrowIcon_1.default, {})] }) }))] }))] }), isSocialsConnected && ((0, jsx_runtime_1.jsx)(ActionButton, { className: "modal-action-btn", variant: "primaryM", text: getSubmitButtonLabel(), disabled: getSubmitButtonDisabled(), onClick: handleSubmit }))] }));
174
174
  };
175
175
  exports.default = LudoEducatorModal;
@@ -5,5 +5,5 @@ declare const ExperienceLabel: ({ value, link, loading, className, style }: {
5
5
  loading?: boolean;
6
6
  className?: string;
7
7
  style?: React.CSSProperties;
8
- }) => import("react/jsx-runtime").JSX.Element | null;
8
+ }) => import("react/jsx-runtime").JSX.Element;
9
9
  export default ExperienceLabel;
@@ -88,8 +88,6 @@ const StyledExpTab = styled_components_1.default.div `
88
88
  const ExperienceLabel = ({ value = 0, link, loading, className, style }) => {
89
89
  if (loading)
90
90
  return (0, jsx_runtime_1.jsx)(SkeletonLabel_1.default, {});
91
- if (!value)
92
- return null;
93
91
  return link ? ((0, jsx_runtime_1.jsx)(StyledExpLink, { href: link, className: className, style: style, children: (0, jsx_runtime_1.jsx)(LabelContent, { value: value }) })) : ((0, jsx_runtime_1.jsx)(StyledExpTab, { className: className, style: style, children: (0, jsx_runtime_1.jsx)(LabelContent, { value: value }) }));
94
92
  };
95
93
  const LabelContent = ({ value }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ludo.ninja/components",
3
- "version": "2.4.11",
3
+ "version": "2.4.13",
4
4
  "private": false,
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -1,31 +0,0 @@
1
- import { ApolloClient, NormalizedCacheObject } from '@apollo/client';
2
- import { experiencesSchema as schema } from '@ludo.ninja/api';
3
- export declare const prefetchMyTasks: (apolloClient: ApolloClient<NormalizedCacheObject>) => Promise<import("@apollo/client").ApolloQueryResult<any> | {
4
- data: {
5
- fetchMyTasks: null;
6
- };
7
- }>;
8
- export declare const useFetchMyTasks: ({ prefetchedMyTasks, }: {
9
- prefetchedMyTasks: schema.ITask[] | null;
10
- }) => {
11
- loadingMyTasks: boolean;
12
- errorMyTasks: import("@apollo/client").ApolloError | undefined;
13
- data: any;
14
- clientMyTasksData: schema.ITask[] | null;
15
- };
16
- declare const _default: {
17
- useFetchMyTasks: ({ prefetchedMyTasks, }: {
18
- prefetchedMyTasks: schema.ITask[] | null;
19
- }) => {
20
- loadingMyTasks: boolean;
21
- errorMyTasks: import("@apollo/client").ApolloError | undefined;
22
- data: any;
23
- clientMyTasksData: schema.ITask[] | null;
24
- };
25
- prefetchMyTasks: (apolloClient: ApolloClient<NormalizedCacheObject>) => Promise<import("@apollo/client").ApolloQueryResult<any> | {
26
- data: {
27
- fetchMyTasks: null;
28
- };
29
- }>;
30
- };
31
- export default _default;
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useFetchMyTasks = exports.prefetchMyTasks = void 0;
4
- const react_1 = require("react");
5
- const client_1 = require("@apollo/client");
6
- const api_1 = require("@ludo.ninja/api");
7
- const ui_1 = require("../../../../store/ui");
8
- const getErrorAlertProps_1 = require("../../../../utils/getErrorAlertProps");
9
- const prefetchMyTasks = (apolloClient) => {
10
- return apolloClient
11
- .query({
12
- query: api_1.experiencesSchema.FetchMyTasksDocument,
13
- context: { uri: api_1.hosts.serverExperiencesHost },
14
- fetchPolicy: 'network-only',
15
- })
16
- .catch(() => {
17
- return {
18
- data: { fetchMyTasks: null },
19
- };
20
- });
21
- };
22
- exports.prefetchMyTasks = prefetchMyTasks;
23
- const useFetchMyTasks = ({ prefetchedMyTasks, }) => {
24
- const [myTasks, setMyTasks] = (0, react_1.useState)(prefetchedMyTasks);
25
- const openAlert = (0, ui_1.useUiStore)((state) => state.openAlert);
26
- const { data, error, loading } = (0, client_1.useQuery)(api_1.experiencesSchema.FetchMyTasksDocument, {
27
- context: {
28
- uri: api_1.hosts.experiencesHost,
29
- },
30
- onCompleted: ({ fetchMyTasks }) => {
31
- setMyTasks(fetchMyTasks);
32
- },
33
- onError: (err) => {
34
- openAlert((0, getErrorAlertProps_1.getErrorAlertProps)(err));
35
- setMyTasks([]);
36
- },
37
- });
38
- return {
39
- loadingMyTasks: loading,
40
- errorMyTasks: error,
41
- data,
42
- clientMyTasksData: myTasks,
43
- };
44
- };
45
- exports.useFetchMyTasks = useFetchMyTasks;
46
- exports.default = { useFetchMyTasks: exports.useFetchMyTasks, prefetchMyTasks: exports.prefetchMyTasks };