anymal-protocol 1.0.101 → 1.0.103

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.
package/dist/index.d.mts CHANGED
@@ -10,7 +10,7 @@ declare function useVerifyWeb3AuthSession(): (idToken: string, publicKey: string
10
10
 
11
11
  declare function useCreateWeb3Account(): (idToken: string, publicKey: string, userPid: string, authServiceBaseUrl: string) => Promise<any>;
12
12
 
13
- declare function useFetchUserData(): (dbAuthToken: string, endpoint: string) => Promise<any>;
13
+ declare function useFetchUserData(): (dbAuthToken: string, endpoint: string, walletAddress: string) => Promise<any>;
14
14
 
15
15
  declare function useUpdateUserEmail(): (dbAuthToken: string, docID: string, email: string, endpoint: string) => Promise<void>;
16
16
 
@@ -315,9 +315,8 @@ declare const convertToMultipleActionDefinitions: (frs: ActionDefinition[]) => A
315
315
 
316
316
  interface ActionReferral {
317
317
  referralCampaign?: string;
318
- referralSourceType?: ActionSourceType;
319
318
  referralActionId?: string;
320
- referralSourcePid?: string;
319
+ referralCode?: string;
321
320
  }
322
321
  /**
323
322
  * Base fields sent with every action
package/dist/index.d.ts CHANGED
@@ -10,7 +10,7 @@ declare function useVerifyWeb3AuthSession(): (idToken: string, publicKey: string
10
10
 
11
11
  declare function useCreateWeb3Account(): (idToken: string, publicKey: string, userPid: string, authServiceBaseUrl: string) => Promise<any>;
12
12
 
13
- declare function useFetchUserData(): (dbAuthToken: string, endpoint: string) => Promise<any>;
13
+ declare function useFetchUserData(): (dbAuthToken: string, endpoint: string, walletAddress: string) => Promise<any>;
14
14
 
15
15
  declare function useUpdateUserEmail(): (dbAuthToken: string, docID: string, email: string, endpoint: string) => Promise<void>;
16
16
 
@@ -315,9 +315,8 @@ declare const convertToMultipleActionDefinitions: (frs: ActionDefinition[]) => A
315
315
 
316
316
  interface ActionReferral {
317
317
  referralCampaign?: string;
318
- referralSourceType?: ActionSourceType;
319
318
  referralActionId?: string;
320
- referralSourcePid?: string;
319
+ referralCode?: string;
321
320
  }
322
321
  /**
323
322
  * Base fields sent with every action
package/dist/index.js CHANGED
@@ -145,45 +145,47 @@ function useCreateWeb3Account() {
145
145
  // src/utils/account/useFetchUserData.ts
146
146
  var import_react4 = require("react");
147
147
  function useFetchUserData() {
148
- return (0, import_react4.useCallback)(async (dbAuthToken, endpoint) => {
149
- try {
150
- const query = `
148
+ return (0, import_react4.useCallback)(
149
+ async (dbAuthToken, endpoint, walletAddress) => {
150
+ try {
151
+ const query = `
151
152
  query User {
152
- User {
153
+ User(filter: { baseWalletAddress: { _eq: ${walletAddress} } }) {
153
154
  _docID
154
155
  pid
155
156
  email
156
157
  name
157
158
  isVerified
158
159
  showTooltips
159
- accountType
160
160
  baseWalletAddress
161
161
  stripeCustomerId
162
162
  }
163
163
  }
164
164
  `;
165
- const response = await fetch(endpoint, {
166
- method: "POST",
167
- headers: {
168
- "Content-Type": "application/json",
169
- Authorization: `Bearer ${dbAuthToken}`
170
- },
171
- body: JSON.stringify({ query })
172
- });
173
- if (!response.ok) {
174
- throw new Error(`HTTP error! Status: ${response.status}`);
175
- }
176
- const data = await response.json();
177
- if (data && data.data && data.data.User && data.data.User.length > 0) {
178
- return data.data.User[0];
179
- } else {
165
+ const response = await fetch(endpoint, {
166
+ method: "POST",
167
+ headers: {
168
+ "Content-Type": "application/json",
169
+ Authorization: `Bearer ${dbAuthToken}`
170
+ },
171
+ body: JSON.stringify({ query })
172
+ });
173
+ if (!response.ok) {
174
+ throw new Error(`HTTP error! Status: ${response.status}`);
175
+ }
176
+ const data = await response.json();
177
+ if (data && data.data && data.data.User && data.data.User.length > 0) {
178
+ return data.data.User[0];
179
+ } else {
180
+ return null;
181
+ }
182
+ } catch (error) {
183
+ console.error("Error fetching user data:", error);
180
184
  return null;
181
185
  }
182
- } catch (error) {
183
- console.error("Error fetching user data:", error);
184
- return null;
185
- }
186
- }, []);
186
+ },
187
+ []
188
+ );
187
189
  }
188
190
 
189
191
  // src/utils/account/useUpdateUserEmail.ts
package/dist/index.mjs CHANGED
@@ -82,45 +82,47 @@ function useCreateWeb3Account() {
82
82
  // src/utils/account/useFetchUserData.ts
83
83
  import { useCallback as useCallback4 } from "react";
84
84
  function useFetchUserData() {
85
- return useCallback4(async (dbAuthToken, endpoint) => {
86
- try {
87
- const query = `
85
+ return useCallback4(
86
+ async (dbAuthToken, endpoint, walletAddress) => {
87
+ try {
88
+ const query = `
88
89
  query User {
89
- User {
90
+ User(filter: { baseWalletAddress: { _eq: ${walletAddress} } }) {
90
91
  _docID
91
92
  pid
92
93
  email
93
94
  name
94
95
  isVerified
95
96
  showTooltips
96
- accountType
97
97
  baseWalletAddress
98
98
  stripeCustomerId
99
99
  }
100
100
  }
101
101
  `;
102
- const response = await fetch(endpoint, {
103
- method: "POST",
104
- headers: {
105
- "Content-Type": "application/json",
106
- Authorization: `Bearer ${dbAuthToken}`
107
- },
108
- body: JSON.stringify({ query })
109
- });
110
- if (!response.ok) {
111
- throw new Error(`HTTP error! Status: ${response.status}`);
112
- }
113
- const data = await response.json();
114
- if (data && data.data && data.data.User && data.data.User.length > 0) {
115
- return data.data.User[0];
116
- } else {
102
+ const response = await fetch(endpoint, {
103
+ method: "POST",
104
+ headers: {
105
+ "Content-Type": "application/json",
106
+ Authorization: `Bearer ${dbAuthToken}`
107
+ },
108
+ body: JSON.stringify({ query })
109
+ });
110
+ if (!response.ok) {
111
+ throw new Error(`HTTP error! Status: ${response.status}`);
112
+ }
113
+ const data = await response.json();
114
+ if (data && data.data && data.data.User && data.data.User.length > 0) {
115
+ return data.data.User[0];
116
+ } else {
117
+ return null;
118
+ }
119
+ } catch (error) {
120
+ console.error("Error fetching user data:", error);
117
121
  return null;
118
122
  }
119
- } catch (error) {
120
- console.error("Error fetching user data:", error);
121
- return null;
122
- }
123
- }, []);
123
+ },
124
+ []
125
+ );
124
126
  }
125
127
 
126
128
  // src/utils/account/useUpdateUserEmail.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anymal-protocol",
3
- "version": "1.0.101",
3
+ "version": "1.0.103",
4
4
  "description": "A React/TypeScript-based utility library for reusable functions and hooks inside of the Anymal Ecosystem.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {