@avalabs/avacloud-waas-react 1.0.8 → 1.0.10

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.
Files changed (3) hide show
  1. package/dist/index.js +13 -135
  2. package/dist/index.mjs +13 -135
  3. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -96,14 +96,10 @@ function usePostMessage({
96
96
  const isExpired = Date.now() - timestamp > 30 * 60 * 1e3;
97
97
  if (!isExpired) {
98
98
  const { _timestamp, ...configWithoutTimestamp } = cachedConfig;
99
- console.log("Using cached org config:", configWithoutTimestamp);
100
99
  onOrgConfigUpdate(configWithoutTimestamp);
101
- } else {
102
- console.log("Cached org config expired, will fetch fresh data");
103
100
  }
104
101
  }
105
102
  } catch (error) {
106
- console.error("Error loading cached org config:", error);
107
103
  }
108
104
  }
109
105
  }, [orgId, environment, onOrgConfigUpdate]);
@@ -112,12 +108,10 @@ function usePostMessage({
112
108
  try {
113
109
  if (message.type === "SIGNUP_REQUEST") {
114
110
  if (globalAuthState.signupInProgress) {
115
- console.log("Global signup already in progress, ignoring duplicate request");
116
111
  return;
117
112
  }
118
113
  const now = Date.now();
119
114
  if (now - globalAuthState.lastSignupTimestamp < 3e3) {
120
- console.log("Ignoring duplicate signup attempt (global debounce)");
121
115
  return;
122
116
  }
123
117
  globalAuthState.signupInProgress = true;
@@ -141,18 +135,15 @@ function usePostMessage({
141
135
  if ("requestId" in messageToSend && messageToSend.requestId) {
142
136
  globalAuthState.processingMessageIds.add(messageToSend.requestId);
143
137
  }
144
- console.log("Sending message to auth iframe:", messageToSend);
145
138
  iframe.contentWindow.postMessage(messageToSend, authServiceUrl);
146
139
  return;
147
140
  }
148
141
  if (message.type === "LOGIN_REQUEST") {
149
142
  if (globalAuthState.loginInProgress) {
150
- console.log("Global login already in progress, ignoring duplicate request");
151
143
  return;
152
144
  }
153
145
  const now = Date.now();
154
146
  if (now - globalAuthState.lastLoginTimestamp < 3e3) {
155
- console.log("Ignoring duplicate login attempt (global debounce)");
156
147
  return;
157
148
  }
158
149
  globalAuthState.loginInProgress = true;
@@ -167,14 +158,11 @@ function usePostMessage({
167
158
  if (finalMessage.requestId) {
168
159
  globalAuthState.processingMessageIds.add(finalMessage.requestId);
169
160
  }
170
- console.log("Sending message to auth iframe:", finalMessage);
171
161
  iframe.contentWindow.postMessage(finalMessage, authServiceUrl);
172
162
  return;
173
163
  }
174
- console.log("Sending message to auth iframe:", message);
175
164
  iframe.contentWindow.postMessage(message, authServiceUrl);
176
165
  } catch (error) {
177
- console.error("Error sending message to iframe:", error);
178
166
  if (message.type === "SIGNUP_REQUEST") {
179
167
  globalAuthState.signupInProgress = false;
180
168
  }
@@ -182,15 +170,12 @@ function usePostMessage({
182
170
  globalAuthState.loginInProgress = false;
183
171
  }
184
172
  }
185
- } else {
186
- console.error("No iframe available to send message");
187
173
  }
188
174
  }, [iframe, authServiceUrl]);
189
175
  useEffect(() => {
190
176
  const handleMessage = async (event) => {
191
177
  var _a, _b, _c, _d, _e, _f, _g;
192
178
  if (isHandlingMessageRef.current) {
193
- console.log("Already handling a message, skipping");
194
179
  return;
195
180
  }
196
181
  if (event.origin !== new URL(authServiceUrl).origin) {
@@ -200,12 +185,10 @@ function usePostMessage({
200
185
  return;
201
186
  }
202
187
  if (event.data.requestId && globalAuthState.processingMessageIds.has(event.data.requestId)) {
203
- console.log(`Already processed message with requestId: ${event.data.requestId}, ignoring duplicate`);
204
188
  return;
205
189
  }
206
190
  try {
207
191
  isHandlingMessageRef.current = true;
208
- console.log("Received message from iframe:", event.data);
209
192
  if (event.data.type === "ERROR") {
210
193
  globalAuthState.signupInProgress = false;
211
194
  globalAuthState.loginInProgress = false;
@@ -219,19 +202,14 @@ function usePostMessage({
219
202
  }
220
203
  switch (event.data.type) {
221
204
  case "IFRAME_READY":
222
- console.log("Iframe ready message received, setting isIframeReady to true");
223
- console.log("\u2705 Connection established: Parent received IFRAME_READY from auth service.");
224
205
  setIsIframeReady(true);
225
206
  break;
226
207
  case "RECEIVE_OIDC":
227
- console.log("Received OIDC token payload:", event.data.payload);
228
208
  if (typeof ((_b = event.data.payload) == null ? void 0 : _b.idToken) === "string") {
229
209
  const oidcToken = event.data.payload.idToken;
230
- console.log("Triggering onOidcReceived callback with token...");
231
210
  hasRequestedOidcRef.current = false;
232
211
  onOidcReceived == null ? void 0 : onOidcReceived(oidcToken);
233
212
  } else {
234
- console.warn("RECEIVE_OIDC message missing idToken in payload.");
235
213
  hasRequestedOidcRef.current = false;
236
214
  }
237
215
  break;
@@ -244,7 +222,6 @@ function usePostMessage({
244
222
  }
245
223
  const authStateChanged = lastAuthStateRef.current.isAuthenticated !== newIsAuthenticated || lastAuthStateRef.current.userId !== newUserId;
246
224
  if (authStateChanged) {
247
- console.log("Auth status changed:", { newIsAuthenticated, newUserId });
248
225
  setIsAuthenticated(newIsAuthenticated);
249
226
  if (event.data.user) {
250
227
  const userInfo = {
@@ -254,11 +231,9 @@ function usePostMessage({
254
231
  displayName: event.data.user.nickname || event.data.user.name || ((_e = event.data.user.email) == null ? void 0 : _e.split("@")[0]) || "User",
255
232
  rawUserData: event.data.user
256
233
  };
257
- console.log("Setting user info:", userInfo);
258
234
  setUser(userInfo);
259
235
  if (newIsAuthenticated && !cubistClient && !hasRequestedOidcRef.current) {
260
236
  hasRequestedOidcRef.current = true;
261
- console.log("User newly authenticated, sending GET_OIDC message");
262
237
  sendMessage({ type: "GET_OIDC" });
263
238
  return;
264
239
  }
@@ -283,7 +258,6 @@ function usePostMessage({
283
258
  }
284
259
  }
285
260
  if (event.data.orgConfig && onOrgConfigUpdate) {
286
- console.log("Received organization config:", event.data.orgConfig);
287
261
  onOrgConfigUpdate(event.data.orgConfig);
288
262
  if (orgId) {
289
263
  try {
@@ -293,9 +267,7 @@ function usePostMessage({
293
267
  _timestamp: Date.now()
294
268
  };
295
269
  localStorage.setItem(cachedConfigKey, JSON.stringify(configWithTimestamp));
296
- console.log("Cached organization config for future use");
297
270
  } catch (error) {
298
- console.error("Error caching org config:", error);
299
271
  }
300
272
  }
301
273
  }
@@ -305,12 +277,10 @@ function usePostMessage({
305
277
  break;
306
278
  }
307
279
  case "REGISTER_SUCCESS": {
308
- console.log("Registration successful:", event.data.payload);
309
280
  const userId = (_f = event.data.payload) == null ? void 0 : _f.userId;
310
281
  if (userId) {
311
282
  localStorage.setItem(CUBIST_USER_ID_KEY, userId);
312
283
  if (!hasRequestedOidcRef.current) {
313
- console.log("Registration complete, sending GET_OIDC message");
314
284
  hasRequestedOidcRef.current = true;
315
285
  sendMessage({ type: "GET_OIDC" });
316
286
  }
@@ -319,11 +289,9 @@ function usePostMessage({
319
289
  }
320
290
  case "ERROR":
321
291
  if (event.data.error === "User not authenticated in iframe") {
322
- console.log("Ignoring expected auth iframe error:", event.data.error);
323
292
  isHandlingMessageRef.current = false;
324
293
  return;
325
294
  }
326
- console.error("Error from auth service:", event.data.error);
327
295
  onAuthError == null ? void 0 : onAuthError(new Error((_g = event.data.error) != null ? _g : "Unknown error"));
328
296
  setIsLoading(false);
329
297
  break;
@@ -351,7 +319,6 @@ function usePostMessage({
351
319
  ]);
352
320
  useEffect(() => {
353
321
  if (isIframeReady && (iframe == null ? void 0 : iframe.contentWindow)) {
354
- console.log("\u23F3 Connection attempt: Parent sending CHECK_AUTH_STATUS to auth service.");
355
322
  sendMessage({
356
323
  type: "CHECK_AUTH_STATUS",
357
324
  payload: {
@@ -391,6 +358,10 @@ function PoweredByAvaCloud() {
391
358
  ] });
392
359
  }
393
360
 
361
+ // src/constants/legal.ts
362
+ var TERMS_OF_SERVICE_URL = "https://app.avacloud.io/legal/waas/user-terms";
363
+ var PRIVACY_POLICY_URL = "https://www.avalabs.org/privacy-policy";
364
+
394
365
  // src/components/SignInContent.tsx
395
366
  import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
396
367
  function SignInContent({
@@ -475,7 +446,6 @@ function SignInContent({
475
446
  onEmailSignup(email, password);
476
447
  };
477
448
  const handleForgotPassword = () => {
478
- console.log("Forgot password clicked");
479
449
  };
480
450
  const handleToggleSignup = () => {
481
451
  setIsSignupMode(!isSignupMode);
@@ -617,7 +587,7 @@ function SignInContent({
617
587
  {
618
588
  variant: "text",
619
589
  component: "a",
620
- href: "https://avacloud.io/terms",
590
+ href: TERMS_OF_SERVICE_URL,
621
591
  target: "_blank",
622
592
  rel: "noopener noreferrer",
623
593
  sx: {
@@ -643,7 +613,7 @@ function SignInContent({
643
613
  {
644
614
  variant: "text",
645
615
  component: "a",
646
- href: "https://avacloud.io/privacy",
616
+ href: PRIVACY_POLICY_URL,
647
617
  target: "_blank",
648
618
  rel: "noopener noreferrer",
649
619
  sx: {
@@ -760,14 +730,14 @@ function SignInContent({
760
730
  }
761
731
  },
762
732
  children: [
763
- "By connecting, you agree to the",
733
+ "By continuing, you agree to our",
764
734
  " ",
765
735
  /* @__PURE__ */ jsx2(
766
736
  Button,
767
737
  {
768
738
  variant: "text",
769
739
  component: "a",
770
- href: "https://app.avacloud.io/legal/generalterms/",
740
+ href: TERMS_OF_SERVICE_URL,
771
741
  target: "_blank",
772
742
  rel: "noopener noreferrer",
773
743
  sx: {
@@ -782,7 +752,7 @@ function SignInContent({
782
752
  backgroundColor: "transparent"
783
753
  }
784
754
  },
785
- children: "Terms of Service"
755
+ children: "Terms of Use"
786
756
  }
787
757
  ),
788
758
  " ",
@@ -793,7 +763,7 @@ function SignInContent({
793
763
  {
794
764
  variant: "text",
795
765
  component: "a",
796
- href: "https://www.avalabs.org/privacy-policy",
766
+ href: PRIVACY_POLICY_URL,
797
767
  target: "_blank",
798
768
  rel: "noopener noreferrer",
799
769
  sx: {
@@ -925,7 +895,7 @@ function SignInContent({
925
895
  {
926
896
  variant: "text",
927
897
  component: "a",
928
- href: "https://app.avacloud.io/legal/generalterms/",
898
+ href: TERMS_OF_SERVICE_URL,
929
899
  target: "_blank",
930
900
  rel: "noopener noreferrer",
931
901
  sx: {
@@ -951,7 +921,7 @@ function SignInContent({
951
921
  {
952
922
  variant: "text",
953
923
  component: "a",
954
- href: "https://www.avalabs.org/privacy-policy",
924
+ href: PRIVACY_POLICY_URL,
955
925
  target: "_blank",
956
926
  rel: "noopener noreferrer",
957
927
  sx: {
@@ -992,14 +962,8 @@ function LoginModal({ open, onClose }) {
992
962
  if (!event.data || typeof event.data.type !== "string") {
993
963
  return;
994
964
  }
995
- console.log(
996
- "Modal received message from iframe:",
997
- event.data.type,
998
- event.data.payload ? "has payload" : "no payload"
999
- );
1000
965
  if (event.data.type === "ERROR") {
1001
966
  if (event.data.payload === "User not authenticated in iframe") {
1002
- console.log("Ignoring transient auth error during signup process");
1003
967
  return;
1004
968
  }
1005
969
  setError(event.data.payload);
@@ -1010,7 +974,6 @@ function LoginModal({ open, onClose }) {
1010
974
  timeoutIdRef.current = null;
1011
975
  }
1012
976
  } else if (event.data.type === "AUTH_STATUS" && event.data.isAuthenticated) {
1013
- console.log("Auth successful, resetting state and closing modal");
1014
977
  setIsSubmitting(false);
1015
978
  signupInProgressRef.current = false;
1016
979
  requestInProgress = false;
@@ -1037,11 +1000,9 @@ function LoginModal({ open, onClose }) {
1037
1000
  var _a2;
1038
1001
  setError("");
1039
1002
  if (!iframe) {
1040
- console.error("Auth service iframe not found");
1041
1003
  setError("Authentication service not available");
1042
1004
  return;
1043
1005
  }
1044
- console.log(`Sending LOGIN_REQUEST to auth service iframe with ${provider} connection`);
1045
1006
  (_a2 = iframe.contentWindow) == null ? void 0 : _a2.postMessage({
1046
1007
  type: "LOGIN_REQUEST",
1047
1008
  connection: provider,
@@ -1054,7 +1015,6 @@ function LoginModal({ open, onClose }) {
1054
1015
  setError("");
1055
1016
  setIsSubmitting(true);
1056
1017
  if (!iframe) {
1057
- console.error("Auth service iframe not found");
1058
1018
  setError("Authentication service not available");
1059
1019
  setIsSubmitting(false);
1060
1020
  return;
@@ -1063,7 +1023,6 @@ function LoginModal({ open, onClose }) {
1063
1023
  clearTimeout(timeoutIdRef.current);
1064
1024
  timeoutIdRef.current = null;
1065
1025
  }
1066
- console.log("Sending email/password LOGIN_REQUEST to auth service iframe");
1067
1026
  (_a2 = iframe.contentWindow) == null ? void 0 : _a2.postMessage({
1068
1027
  type: "LOGIN_REQUEST",
1069
1028
  email,
@@ -1071,7 +1030,6 @@ function LoginModal({ open, onClose }) {
1071
1030
  requestId: `login-${Date.now()}`
1072
1031
  }, "*");
1073
1032
  timeoutIdRef.current = setTimeout(() => {
1074
- console.log("No response received from auth service iframe");
1075
1033
  setError("Authentication service timed out");
1076
1034
  setIsSubmitting(false);
1077
1035
  timeoutIdRef.current = null;
@@ -1079,12 +1037,10 @@ function LoginModal({ open, onClose }) {
1079
1037
  };
1080
1038
  const handleEmailSignup = (email, password) => {
1081
1039
  if (signupInProgressRef.current) {
1082
- console.log("Signup already in progress, ignoring duplicate request");
1083
1040
  return;
1084
1041
  }
1085
1042
  const now = Date.now();
1086
1043
  if (now - lastSignupAttemptRef.current < 2e3) {
1087
- console.log("Ignoring duplicate signup attempt (debounce)");
1088
1044
  return;
1089
1045
  }
1090
1046
  lastSignupAttemptRef.current = now;
@@ -1098,14 +1054,12 @@ function LoginModal({ open, onClose }) {
1098
1054
  try {
1099
1055
  signup(email, password);
1100
1056
  } catch (error2) {
1101
- console.error("Error initiating signup:", error2);
1102
1057
  setError("Failed to initiate signup");
1103
1058
  setIsSubmitting(false);
1104
1059
  signupInProgressRef.current = false;
1105
1060
  return;
1106
1061
  }
1107
1062
  timeoutIdRef.current = setTimeout(() => {
1108
- console.log("No response received from auth service iframe");
1109
1063
  setError("Authentication service timed out");
1110
1064
  setIsSubmitting(false);
1111
1065
  signupInProgressRef.current = false;
@@ -1600,7 +1554,7 @@ var queryClient = new QueryClient({
1600
1554
  }
1601
1555
  });
1602
1556
  function getCubistEnv(environment) {
1603
- return environment === "production" ? envs.prod : envs.gamma;
1557
+ return environment === "gamma" || environment === "development" ? envs.gamma : envs.prod;
1604
1558
  }
1605
1559
  function ViemProviderWrapper({ children, chainId }) {
1606
1560
  const { data: blockchain } = useBlockchain(chainId.toString());
@@ -1648,32 +1602,25 @@ function AvaCloudWalletProvider({
1648
1602
  try {
1649
1603
  const sessionKeys = await client.sessionKeys();
1650
1604
  if (!sessionKeys.length) {
1651
- console.log("[getWalletInfo] No session keys found");
1652
1605
  return null;
1653
1606
  }
1654
1607
  const key = sessionKeys[0];
1655
1608
  const address = key.materialId;
1656
1609
  if (!(orgConfig == null ? void 0 : orgConfig.walletProviderOrgID)) {
1657
- console.error("[getWalletInfo] Missing walletProviderOrgID in organization config");
1658
1610
  throw new Error("Missing required walletProviderOrgID in organization configuration");
1659
1611
  }
1660
- console.log("[getWalletInfo] Returning wallet info with address:", address);
1661
1612
  return {
1662
1613
  address,
1663
1614
  sessionId,
1664
1615
  orgId: orgConfig.walletProviderOrgID
1665
1616
  };
1666
1617
  } catch (err) {
1667
- console.error("[getWalletInfo] Error:", err);
1668
1618
  setCubistError(err instanceof Error ? err : new Error("Failed to get wallet info"));
1669
1619
  return null;
1670
1620
  }
1671
1621
  }, [orgConfig]);
1672
1622
  const loginWithCubist = useCallback5(async (oidcToken) => {
1673
- console.log("[loginWithCubist] Starting...");
1674
- console.log("[loginWithCubist] Current orgConfig:", orgConfig);
1675
1623
  if (!orgConfig || !orgConfig.walletProviderOrgID) {
1676
- console.error("[loginWithCubist] PREVENTED: Missing walletProviderOrgID in organization config");
1677
1624
  const error = new Error("Missing required walletProviderOrgID in organization configuration");
1678
1625
  setCubistError(error);
1679
1626
  onAuthError == null ? void 0 : onAuthError(error);
@@ -1684,15 +1631,12 @@ function AvaCloudWalletProvider({
1684
1631
  setIsCubistLoading(true);
1685
1632
  setCubistError(null);
1686
1633
  if (!(orgConfig == null ? void 0 : orgConfig.walletProviderOrgID)) {
1687
- console.error("[loginWithCubist] Missing walletProviderOrgID in organization config");
1688
1634
  throw new Error("Missing required walletProviderOrgID in organization configuration");
1689
1635
  }
1690
1636
  let accessToken;
1691
1637
  if (oidcToken) {
1692
- console.log("[loginWithCubist] Using provided OIDC token.");
1693
1638
  accessToken = oidcToken;
1694
1639
  } else {
1695
- console.log("[loginWithCubist] Attempting to get OIDC token from localStorage.");
1696
1640
  const tokens = localStorage.getItem(AUTH_TOKENS_KEY);
1697
1641
  if (!tokens) {
1698
1642
  throw new Error("No authentication tokens found in localStorage");
@@ -1701,7 +1645,6 @@ function AvaCloudWalletProvider({
1701
1645
  accessToken = parsed.access_token;
1702
1646
  }
1703
1647
  try {
1704
- console.log(`[loginWithCubist] Attempting CubeSignerClient.createOidcSession for Org: ${orgConfig.walletProviderOrgID}`);
1705
1648
  const resp = await CubeSignerClient.createOidcSession(
1706
1649
  getCubistEnv(environment),
1707
1650
  orgConfig.walletProviderOrgID,
@@ -1716,39 +1659,27 @@ function AvaCloudWalletProvider({
1716
1659
  // 90 days
1717
1660
  }
1718
1661
  );
1719
- console.log("[loginWithCubist] createOidcSession response received.");
1720
1662
  if (resp.requiresMfa()) {
1721
- console.warn("[loginWithCubist] MFA required, aborting.");
1722
1663
  throw new Error("MFA required for Cubist login");
1723
1664
  }
1724
1665
  const sessionData = resp.data();
1725
- console.log("[loginWithCubist] Session data obtained, attempting CubeSignerClient.create");
1726
1666
  const newClient = await CubeSignerClient.create(sessionData);
1727
1667
  const sessionId = sessionData.session_info.session_id;
1728
- console.log(`[loginWithCubist] CubeSignerClient created successfully. Session ID: ${sessionId}`);
1729
- console.log("[loginWithCubist] Attempting getWalletInfo");
1730
1668
  const cubistWallet = await getWalletInfo(newClient, sessionId);
1731
- console.log("[loginWithCubist] getWalletInfo result:", cubistWallet);
1732
- console.log("[loginWithCubist] Setting cubistClient state.");
1733
1669
  setCubistClient(newClient);
1734
1670
  if (cubistWallet) {
1735
- console.log("[loginWithCubist] Setting wallet state with cubistWallet.");
1736
1671
  setWallet((prev) => ({
1737
1672
  ...prev,
1738
1673
  address: cubistWallet.address,
1739
1674
  cubistWallet
1740
1675
  }));
1741
- console.log("[loginWithCubist] Calling onWalletUpdate callback.");
1742
1676
  onWalletUpdate == null ? void 0 : onWalletUpdate({
1743
1677
  ...wallet,
1744
1678
  // Use current wallet state potentially
1745
1679
  cubistWallet
1746
1680
  });
1747
- } else {
1748
- console.warn("[loginWithCubist] cubistWallet is null, not updating wallet state further.");
1749
1681
  }
1750
1682
  } catch (error) {
1751
- console.error("[loginWithCubist] Error during Cubist session creation/wallet info:", error);
1752
1683
  localStorage.removeItem(AUTH_TOKENS_KEY);
1753
1684
  localStorage.removeItem(AUTH0_STORAGE_KEYS.IS_AUTHENTICATED);
1754
1685
  setIsAuthenticated(false);
@@ -1758,11 +1689,9 @@ function AvaCloudWalletProvider({
1758
1689
  }
1759
1690
  } catch (error) {
1760
1691
  const err = error instanceof Error ? error : new Error("Failed to create Cubist session");
1761
- console.error("[loginWithCubist] Final catch block error:", err);
1762
1692
  setCubistError(err);
1763
1693
  onAuthError == null ? void 0 : onAuthError(err);
1764
1694
  } finally {
1765
- console.log("[loginWithCubist] Setting isCubistLoading to false.");
1766
1695
  setIsCubistLoading(false);
1767
1696
  }
1768
1697
  }, [wallet, onWalletUpdate, onAuthError, getWalletInfo, orgConfig, environment]);
@@ -1773,62 +1702,46 @@ function AvaCloudWalletProvider({
1773
1702
  iframe,
1774
1703
  isIframeReady,
1775
1704
  onAuthSuccess: () => {
1776
- console.log("[onAuthSuccess] Called");
1777
1705
  if (user) {
1778
1706
  if (wallet.address) {
1779
- console.log("[onAuthSuccess] Calling onAuthSuccess callback with user");
1780
1707
  onAuthSuccess == null ? void 0 : onAuthSuccess(user);
1781
- } else {
1782
- console.log("[onAuthSuccess] Not calling callback yet, waiting for wallet");
1783
1708
  }
1784
- } else {
1785
- console.log("[onAuthSuccess] No user available");
1786
1709
  }
1787
1710
  },
1788
1711
  onAuthError: (error) => {
1789
- console.log("[onAuthError] Called with error:", error);
1790
1712
  const errorMessage = (error == null ? void 0 : error.message) || "";
1791
1713
  if (errorMessage === "User not authenticated in iframe" || errorMessage === "Unknown error" || // Generic error that often appears during signup
1792
1714
  errorMessage.includes("OIDC user not found")) {
1793
- console.log("[onAuthError] Ignoring expected error during auth flow:", errorMessage);
1794
1715
  return;
1795
1716
  }
1796
1717
  setIsCubistLoading(false);
1797
1718
  onAuthError == null ? void 0 : onAuthError(error);
1798
1719
  },
1799
1720
  onWalletUpdate: (newWallet) => {
1800
- console.log("[onWalletUpdate] Called with wallet:", newWallet);
1801
1721
  setWallet(newWallet);
1802
1722
  if (user && isAuthenticated) {
1803
- console.log("[onWalletUpdate] Calling onAuthSuccess callback");
1804
1723
  onAuthSuccess == null ? void 0 : onAuthSuccess(user);
1805
1724
  }
1806
1725
  queryClient.invalidateQueries({ queryKey: ["wallet"] });
1807
1726
  onWalletUpdate == null ? void 0 : onWalletUpdate(newWallet);
1808
1727
  },
1809
1728
  onOidcReceived: (token) => {
1810
- console.log("[onOidcReceived] Received OIDC token - storing in state only");
1811
1729
  setIsCubistLoading(true);
1812
1730
  setPendingOidcToken(token);
1813
- console.log("[onOidcReceived] Current orgConfig:", orgConfig);
1814
1731
  const originalLoginWithCubist = loginWithCubist;
1815
1732
  window.___tempSafeguard_loginWithCubist = (oidcToken) => {
1816
1733
  if (!(orgConfig == null ? void 0 : orgConfig.walletProviderOrgID)) {
1817
- console.error("[SAFEGUARD] Prevented direct call to loginWithCubist without orgConfig");
1818
1734
  return Promise.reject(new Error("Missing required walletProviderOrgID in organization configuration"));
1819
1735
  }
1820
1736
  return originalLoginWithCubist(oidcToken);
1821
1737
  };
1822
1738
  },
1823
1739
  onOrgConfigUpdate: (config) => {
1824
- console.log("[onOrgConfigUpdate] Received org config with walletProviderOrgID:", config == null ? void 0 : config.walletProviderOrgID);
1825
- console.log("[onOrgConfigUpdate] Current pendingOidcToken:", !!pendingOidcToken);
1826
1740
  setOrgConfig(config);
1827
1741
  },
1828
1742
  setIsAuthenticated,
1829
1743
  setUser,
1830
1744
  setIsLoading: (isLoading2) => {
1831
- console.log("[setIsLoading] Setting isLoading to:", isLoading2);
1832
1745
  setIsLoading(isLoading2);
1833
1746
  },
1834
1747
  setIsIframeReady,
@@ -1836,16 +1749,12 @@ function AvaCloudWalletProvider({
1836
1749
  cubistClient
1837
1750
  });
1838
1751
  const login = useCallback5(() => {
1839
- console.log("[login] Called");
1840
1752
  if (iframe == null ? void 0 : iframe.contentWindow) {
1841
1753
  setIsCubistLoading(true);
1842
1754
  sendMessage({ type: "LOGIN_REQUEST" });
1843
- } else {
1844
- console.error("[login] No iframe available for login");
1845
1755
  }
1846
1756
  }, [iframe, sendMessage]);
1847
1757
  const signup = useCallback5((email, password) => {
1848
- console.log("[signup] Called with email:", email);
1849
1758
  if (iframe == null ? void 0 : iframe.contentWindow) {
1850
1759
  setIsCubistLoading(true);
1851
1760
  sendMessage({
@@ -1856,12 +1765,9 @@ function AvaCloudWalletProvider({
1856
1765
  },
1857
1766
  requestId: `signup-${Date.now()}`
1858
1767
  });
1859
- } else {
1860
- console.error("[signup] No iframe available for signup");
1861
1768
  }
1862
1769
  }, [iframe, sendMessage]);
1863
1770
  const logout = useCallback5(() => {
1864
- console.log("[logout] Called");
1865
1771
  sendMessage({ type: "LOGOUT_REQUEST" });
1866
1772
  setUser(null);
1867
1773
  setWallet({ address: null });
@@ -1882,7 +1788,6 @@ function AvaCloudWalletProvider({
1882
1788
  setPendingOidcToken(null);
1883
1789
  }, [sendMessage, orgId, env]);
1884
1790
  const addAccount = useCallback5(async (accountIndex) => {
1885
- console.log("[addAccount] Called with accountIndex:", accountIndex);
1886
1791
  if (!isAuthenticated || !user || !wallet.mnemonicId) {
1887
1792
  throw new Error("User must be authenticated and have a wallet to add an account");
1888
1793
  }
@@ -1903,19 +1808,13 @@ function AvaCloudWalletProvider({
1903
1808
  });
1904
1809
  }, [sendMessage, isAuthenticated, user, wallet.mnemonicId]);
1905
1810
  useEffect5(() => {
1906
- console.log("[useEffect Auth] Running effect with dependencies...");
1907
- console.log("[useEffect Auth] pendingOidcToken:", !!pendingOidcToken);
1908
- console.log("[useEffect Auth] orgConfig?.walletProviderOrgID:", orgConfig == null ? void 0 : orgConfig.walletProviderOrgID);
1909
1811
  const hasOrgConfig = !!(orgConfig == null ? void 0 : orgConfig.walletProviderOrgID);
1910
1812
  const hasOidcToken = !!pendingOidcToken;
1911
- console.log(`[useEffect Auth] Checking conditions - hasOrgConfig: ${hasOrgConfig}, hasOidcToken: ${hasOidcToken}`);
1912
1813
  if (hasOrgConfig && hasOidcToken && pendingOidcToken) {
1913
- console.log("[useEffect Auth] Both orgConfig and oidcToken are available, calling loginWithCubist");
1914
1814
  const doLogin = async () => {
1915
1815
  try {
1916
1816
  await loginWithCubist(pendingOidcToken);
1917
1817
  } catch (error) {
1918
- console.error("[useEffect Auth] Error in loginWithCubist:", error);
1919
1818
  onAuthError == null ? void 0 : onAuthError(error instanceof Error ? error : new Error("Failed to create Cubist session"));
1920
1819
  } finally {
1921
1820
  setIsCubistLoading(false);
@@ -1926,7 +1825,6 @@ function AvaCloudWalletProvider({
1926
1825
  }
1927
1826
  }, [orgConfig, pendingOidcToken, loginWithCubist, onAuthError]);
1928
1827
  useEffect5(() => {
1929
- console.log("[useEffect Iframe] Setting up iframe...");
1930
1828
  if (typeof window === "undefined" || typeof document === "undefined") {
1931
1829
  return;
1932
1830
  }
@@ -1943,9 +1841,7 @@ function AvaCloudWalletProvider({
1943
1841
  document.body.appendChild(frame);
1944
1842
  iframeRef.current = frame;
1945
1843
  setIframe(frame);
1946
- console.log("[useEffect Iframe] Iframe created and added to DOM");
1947
1844
  const timeoutId = setTimeout(() => {
1948
- console.log("[useEffect Iframe] Timeout reached, setting isCubistLoading to false");
1949
1845
  setIsCubistLoading(false);
1950
1846
  }, 5e3);
1951
1847
  return () => {
@@ -1953,7 +1849,6 @@ function AvaCloudWalletProvider({
1953
1849
  if (iframeRef.current) {
1954
1850
  iframeRef.current.remove();
1955
1851
  iframeRef.current = null;
1956
- console.log("[useEffect Iframe] Iframe removed in cleanup");
1957
1852
  }
1958
1853
  };
1959
1854
  }, [authServiceUrl]);
@@ -1967,7 +1862,6 @@ function AvaCloudWalletProvider({
1967
1862
  }
1968
1863
  const existingOidcToken = sessionStorage.getItem(OIDC_TOKEN_KEY);
1969
1864
  if (existingOidcToken) {
1970
- console.log("[useEffect Init] Found existing OIDC token in sessionStorage");
1971
1865
  setPendingOidcToken(existingOidcToken);
1972
1866
  } else {
1973
1867
  try {
@@ -1975,13 +1869,11 @@ function AvaCloudWalletProvider({
1975
1869
  if (tokensJson) {
1976
1870
  const tokens = JSON.parse(tokensJson);
1977
1871
  if (tokens.access_token) {
1978
- console.log("[useEffect Init] Using access_token from localStorage as OIDC token");
1979
1872
  sessionStorage.setItem(OIDC_TOKEN_KEY, tokens.access_token);
1980
1873
  setPendingOidcToken(tokens.access_token);
1981
1874
  }
1982
1875
  }
1983
1876
  } catch (error) {
1984
- console.error("[useEffect Init] Error parsing tokens from localStorage:", error);
1985
1877
  }
1986
1878
  }
1987
1879
  }, []);
@@ -2204,7 +2096,6 @@ function useTransferTokens() {
2204
2096
  const actualBaseFee = formatEther(baseFeePerGas * receipt.gasUsed);
2205
2097
  const actualPriorityFee = formatEther(effectivePriorityFee * receipt.gasUsed);
2206
2098
  const actualTotalFee = formatEther(receipt.effectiveGasPrice * receipt.gasUsed);
2207
- console.log("Transaction confirmed:", receipt);
2208
2099
  if ((wallet == null ? void 0 : wallet.address) && ((_a = publicClient.chain) == null ? void 0 : _a.id)) {
2209
2100
  const chainId = publicClient.chain.id.toString();
2210
2101
  queryClient2.invalidateQueries({
@@ -2219,7 +2110,6 @@ function useTransferTokens() {
2219
2110
  actualTotalFee: Number(actualTotalFee).toFixed(6)
2220
2111
  }));
2221
2112
  } catch (err) {
2222
- console.error("Failed to send transaction:", err);
2223
2113
  setState((prev) => ({
2224
2114
  ...prev,
2225
2115
  error: err instanceof Error ? err.message : "Failed to send transaction",
@@ -2297,7 +2187,6 @@ function useTransferTokens() {
2297
2187
  const actualBaseFee = formatEther(baseFeePerGas * receipt.gasUsed);
2298
2188
  const actualPriorityFee = formatEther(effectivePriorityFee * receipt.gasUsed);
2299
2189
  const actualTotalFee = formatEther(receipt.effectiveGasPrice * receipt.gasUsed);
2300
- console.log("Transaction confirmed:", receipt);
2301
2190
  if ((wallet == null ? void 0 : wallet.address) && ((_a = publicClient.chain) == null ? void 0 : _a.id)) {
2302
2191
  const chainId = publicClient.chain.id.toString();
2303
2192
  queryClient2.invalidateQueries({
@@ -2315,7 +2204,6 @@ function useTransferTokens() {
2315
2204
  actualTotalFee: Number(actualTotalFee).toFixed(6)
2316
2205
  }));
2317
2206
  } catch (err) {
2318
- console.error("Failed to send transaction:", err);
2319
2207
  setState((prev) => ({
2320
2208
  ...prev,
2321
2209
  error: err instanceof Error ? err.message : "Failed to send transaction",
@@ -2405,7 +2293,6 @@ function useGasEstimation() {
2405
2293
  totalWithAmount
2406
2294
  }));
2407
2295
  } catch (err) {
2408
- console.error("Failed to estimate gas:", err);
2409
2296
  setState((prev) => ({
2410
2297
  ...prev,
2411
2298
  error: err instanceof Error ? err.message : "Failed to estimate gas",
@@ -3395,7 +3282,6 @@ function ExportView({ onBack }) {
3395
3282
  };
3396
3283
  window.addEventListener("message", handleResponse);
3397
3284
  } catch (err) {
3398
- console.error("Export failed:", err);
3399
3285
  setError("Failed to export private key. Please try again.");
3400
3286
  }
3401
3287
  };
@@ -4572,12 +4458,6 @@ function useSignTransaction() {
4572
4458
  }, []);
4573
4459
  const signTransaction = useCallback9(async (transaction) => {
4574
4460
  var _a, _b, _c, _d;
4575
- console.log("Signing transaction with:", {
4576
- wallet: wallet == null ? void 0 : wallet.address,
4577
- hasClient: !!cubistClient,
4578
- hasPublicClient: !!publicClient,
4579
- chain: publicClient == null ? void 0 : publicClient.chain
4580
- });
4581
4461
  if (!(wallet == null ? void 0 : wallet.address)) {
4582
4462
  setState((prev) => ({
4583
4463
  ...prev,
@@ -4622,7 +4502,6 @@ function useSignTransaction() {
4622
4502
  maxPriorityFeePerGas: (_d = transaction.maxPriorityFeePerGas) == null ? void 0 : _d.toString()
4623
4503
  }
4624
4504
  };
4625
- console.log("Signing request:", signReq);
4626
4505
  const sig = await key.signEvm(signReq);
4627
4506
  const signedTx = sig.data().rlp_signed_tx;
4628
4507
  setState((prev) => ({
@@ -4630,7 +4509,6 @@ function useSignTransaction() {
4630
4509
  signedTransaction: signedTx
4631
4510
  }));
4632
4511
  } catch (err) {
4633
- console.error("Error signing transaction:", err);
4634
4512
  setState((prev) => ({
4635
4513
  ...prev,
4636
4514
  error: err instanceof Error ? err.message : "Failed to sign transaction"