@ludo.ninja/components 2.4.47 → 2.4.49

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.
@@ -14,7 +14,7 @@ function useCheckFollow(twitterUserName, targetId = '1566713352138760197') {
14
14
  setLoading(true);
15
15
  setError(null);
16
16
  try {
17
- const urlGetUserTwitterId = `https://twitter-api47.p.rapidapi.com/v2/user/by-username?username=${twitterUserName}`;
17
+ const urlGetUserTwitterId = `https://twitter-api47.p.rapidapi.com/v3/user/by-username?username=${twitterUserName}`;
18
18
  const userRes = await fetch(urlGetUserTwitterId, {
19
19
  headers: {
20
20
  'x-rapidapi-host': 'twitter-api47.p.rapidapi.com',
@@ -22,11 +22,11 @@ function useCheckFollow(twitterUserName, targetId = '1566713352138760197') {
22
22
  },
23
23
  });
24
24
  const userData = await userRes.json();
25
- const twitterUserId = userData?.rest_id;
25
+ const twitterUserId = userData?.data?.id;
26
26
  if (!twitterUserId) {
27
27
  throw new Error('Error loading twitter user ID');
28
28
  }
29
- const urlCheckFollow = `https://twitter-api47.p.rapidapi.com/v2/user/friendship?subjectId=${twitterUserId}&targetId=${targetId}`;
29
+ const urlCheckFollow = `https://twitter-api47.p.rapidapi.com/v3/user/friendship?subjectId=${twitterUserId}&targetId=${targetId}`;
30
30
  const followRes = await fetch(urlCheckFollow, {
31
31
  headers: {
32
32
  'x-rapidapi-host': 'twitter-api47.p.rapidapi.com',
@@ -35,7 +35,7 @@ function useCheckFollow(twitterUserName, targetId = '1566713352138760197') {
35
35
  });
36
36
  const followData = await followRes.json();
37
37
  setStatus({
38
- following: followData?.relationship?.source?.following || false,
38
+ following: followData?.data?.following || false,
39
39
  });
40
40
  }
41
41
  catch (err) {
@@ -113,8 +113,8 @@ const LudoEducatorModal = ({ userId, onBoostAdded, boostType, className, style }
113
113
  const twitterUserName = social?.twitter?.split("https://x.com/")?.[1] || "";
114
114
  const { followStatus, followStatusLoading } = (0, useCheckFollow_1.useCheckFollow)(twitterUserName);
115
115
  const { followDiscordStatus, followDiscordStatusLoading } = (0, useCheckDiscordFollow_1.useCheckDiscordFollow)();
116
- const { setEducatorBoost, loadingSetEducatorBoost } = (0, useSetEducatorBoost_1.default)();
117
- const { setShootingStarBoost, loadingSetShootingStarBoost } = (0, useSetShootingStarBoost_1.default)();
116
+ const { setEducatorBoost, loadingSetEducatorBoost, isSetEducatorBoost } = (0, useSetEducatorBoost_1.default)();
117
+ const { setShootingStarBoost, loadingSetShootingStarBoost, isSetShootingStarBoost } = (0, useSetShootingStarBoost_1.default)();
118
118
  const isSocialsConnected = social?.twitter && social?.telegramLink;
119
119
  const isCheckListDone = followStatus?.following && isSocialsConnected && social?.telegramId;
120
120
  const isShootingStarCheckListDone = isCheckListDone && followDiscordStatus?.following && social?.discordId;
@@ -123,6 +123,8 @@ const LudoEducatorModal = ({ userId, onBoostAdded, boostType, className, style }
123
123
  const closeModalSidebarPortal = (0, ui_1.useUiStore)((state) => state.closeModalSidebarPortal);
124
124
  const handleBecomeLudoEducator = () => {
125
125
  setEducatorBoost().then(() => {
126
+ if (!isSetEducatorBoost)
127
+ return;
126
128
  onBoostAdded && onBoostAdded();
127
129
  closeModalSidebarPortal();
128
130
  openModalSidebarPortal((0, jsx_runtime_1.jsx)(Congratulations_1.default, {}));
@@ -130,6 +132,8 @@ const LudoEducatorModal = ({ userId, onBoostAdded, boostType, className, style }
130
132
  };
131
133
  const handleBecomeLudoShootingStar = () => {
132
134
  setShootingStarBoost().then(() => {
135
+ if (!isSetShootingStarBoost)
136
+ return;
133
137
  onBoostAdded && onBoostAdded();
134
138
  closeModalSidebarPortal();
135
139
  openModalSidebarPortal((0, jsx_runtime_1.jsx)(Congratulations_1.default, { message: "You are now a Ludo Shooting Star! Check how you can take advantage of it." }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ludo.ninja/components",
3
- "version": "2.4.47",
3
+ "version": "2.4.49",
4
4
  "private": false,
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",