@funkit/connect 1.2.5 → 1.2.7

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 (41) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/components/Box/Box.d.ts +3 -3
  3. package/dist/components/CloseButton/CloseButton.d.ts +1 -1
  4. package/dist/components/FunButton/FunIconButton.d.ts +7 -7
  5. package/dist/components/FunCheckoutHistoryModal/FunCheckoutHistoryDetail.d.ts +1 -1
  6. package/dist/components/FunNotification/FunCheckoutNotification.d.ts +1 -1
  7. package/dist/components/FunTransactionSummary/FunTxSummaryHistory.d.ts +1 -1
  8. package/dist/components/FunkitProvider/AppContext.d.ts +3 -3
  9. package/dist/components/FunkitProvider/CoolModeContext.d.ts +0 -1
  10. package/dist/components/FunkitProvider/FunkitCheckoutContext.d.ts +2 -7
  11. package/dist/components/FunkitProvider/FunkitConfigContext.d.ts +1 -1
  12. package/dist/components/FunkitProvider/FunkitSandboxContext.d.ts +0 -1
  13. package/dist/components/FunkitProvider/FunkitWeb2Provider.d.ts +2 -15
  14. package/dist/components/FunkitProvider/GeneralWalletProvider.d.ts +8 -8
  15. package/dist/components/FunkitProvider/ShowRecentTransactionsContext.d.ts +0 -1
  16. package/dist/components/FunkitProvider/provideFunkitConnectChains.d.ts +1 -1
  17. package/dist/components/FunkitProvider/useCoolMode.d.ts +0 -1
  18. package/dist/components/InfoButton/InfoButton.d.ts +1 -1
  19. package/dist/config/getDefaultConfig.d.ts +510 -510
  20. package/dist/consts/funkit.d.ts +30 -9
  21. package/dist/css/atoms.d.ts +0 -1
  22. package/dist/hooks/useCheckoutAccountBalanceTransfer.d.ts +10 -10
  23. package/dist/hooks/useCheckoutStateBooleans.d.ts +1 -1
  24. package/dist/index.css +8 -8
  25. package/dist/index.d.ts +1 -2
  26. package/dist/index.js +426 -137
  27. package/dist/themes/baseTheme.d.ts +1 -1
  28. package/dist/utils/checkout.d.ts +25 -25
  29. package/dist/utils/flags/config.d.ts +14 -0
  30. package/dist/utils/flags/endpoint.d.ts +22 -0
  31. package/dist/utils/flags/hash.d.ts +13 -0
  32. package/dist/utils/flags/impl.d.ts +26 -0
  33. package/dist/utils/flags/index.d.ts +7 -0
  34. package/dist/utils/flags/types.d.ts +39 -0
  35. package/dist/utils/funLogger.d.ts +7 -1
  36. package/dist/utils/memoize.d.ts +3 -0
  37. package/dist/utils/mesh.d.ts +0 -1
  38. package/dist/wallets/computeWalletConnectMetaData.d.ts +1 -1
  39. package/dist/wallets/walletConnectors/funkitConnectWallet/funkitConnectWallet.js +4 -5
  40. package/dist/wallets/walletConnectors/index.js +45 -45
  41. package/package.json +9 -5
package/dist/index.js CHANGED
@@ -2,12 +2,12 @@
2
2
  import {
3
3
  en_US_default
4
4
  } from "./chunk-SW6GAS7K.js";
5
- import {
6
- darkTheme
7
- } from "./chunk-ICLRFHOV.js";
8
5
  import {
9
6
  lightTheme
10
7
  } from "./chunk-FRT63PFR.js";
8
+ import {
9
+ darkTheme
10
+ } from "./chunk-ICLRFHOV.js";
11
11
  import "./chunk-I24HX4XM.js";
12
12
 
13
13
  // src/components/ConnectButton/ConnectButton.tsx
@@ -141,10 +141,8 @@ import React143, {
141
141
  import { useConfig as useConfig5, useConnect as useConnect2, useDisconnect as useDisconnect3 } from "wagmi";
142
142
 
143
143
  // src/consts/funkit.ts
144
- import {
145
- CheckoutState,
146
- FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS
147
- } from "@funkit/core";
144
+ import { CheckoutState } from "@funkit/api-base";
145
+ import { FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS } from "@funkit/core";
148
146
  var NATIVE_TOKEN = FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS;
149
147
  var FUNKIT_CONNECT_WALLET_ID = "funkitConnectWallet";
150
148
  var RESERVED_GROUP_NAME = "funkit-web2";
@@ -169,14 +167,24 @@ var IN_PROGRESS_CHECKOUT_STATES = [
169
167
  var TERMINAL_CHECKOUT_STATES = [
170
168
  CheckoutState.EXPIRED,
171
169
  CheckoutState.CHECKOUT_ERROR,
172
- CheckoutState.COMPLETED
170
+ CheckoutState.COMPLETED,
171
+ CheckoutState.CANCELLED
173
172
  ];
173
+ var FunkitSocialLoginMethod = /* @__PURE__ */ ((FunkitSocialLoginMethod2) => {
174
+ FunkitSocialLoginMethod2["GOOGLE"] = "google_oauth" /* google_oauth */;
175
+ FunkitSocialLoginMethod2["TWITTER"] = "twitter_oauth" /* twitter_oauth */;
176
+ FunkitSocialLoginMethod2["APPLE"] = "apple_oauth" /* apple_oauth */;
177
+ FunkitSocialLoginMethod2["FARCASTER"] = "farcaster" /* farcaster */;
178
+ return FunkitSocialLoginMethod2;
179
+ })(FunkitSocialLoginMethod || {});
174
180
  var PLACEHOLDER_FUNKIT_USER_INFO = {
175
- userId: null,
176
- accountLabel: "Email",
177
- accountName: "Loading...",
178
- accountNameDisplay: "Loading...",
179
- accountPicSrc: ""
181
+ id: "0x",
182
+ address: "0x",
183
+ name: "Guest",
184
+ nameTruncated: "Guest",
185
+ type: "unknown",
186
+ typeLabel: "",
187
+ iconSrc: ""
180
188
  };
181
189
 
182
190
  // src/utils/funLogger.ts
@@ -195,6 +203,9 @@ var FunLogger = class {
195
203
  this.apiKey = null;
196
204
  this.isDebugMode = false;
197
205
  this.userId = null;
206
+ this.userAddress = null;
207
+ this.userName = null;
208
+ this.userLoginType = null;
198
209
  this.sdkVersion = null;
199
210
  }
200
211
  getFunLogEnv() {
@@ -209,6 +220,9 @@ var FunLogger = class {
209
220
  data,
210
221
  apiKey: this.apiKey,
211
222
  userId: this.userId,
223
+ userName: this.userName,
224
+ userAddress: this.userAddress,
225
+ userLoginType: this.userLoginType,
212
226
  sdkVersion: this.sdkVersion
213
227
  };
214
228
  }
@@ -272,8 +286,20 @@ var FunLogger = class {
272
286
  getUserId() {
273
287
  return this.userId;
274
288
  }
275
- setUserId(userId) {
289
+ getUserAddress() {
290
+ return this.userAddress;
291
+ }
292
+ getUserName() {
293
+ return this.userName;
294
+ }
295
+ getUserLoginType() {
296
+ return this.userLoginType;
297
+ }
298
+ setUserInfo(userId, userAddress, userName, userLoginType) {
276
299
  this.userId = userId;
300
+ this.userAddress = userAddress;
301
+ this.userName = userName;
302
+ this.userLoginType = userLoginType;
277
303
  }
278
304
  };
279
305
  datadogLogs.init({
@@ -314,6 +340,255 @@ import React5, {
314
340
  } from "react";
315
341
  import { useConfig } from "wagmi";
316
342
 
343
+ // src/utils/memoize.ts
344
+ var memoize = (fn) => {
345
+ const cache = /* @__PURE__ */ new Map();
346
+ const memoizedFn = (...args) => {
347
+ const key = JSON.stringify(args);
348
+ if (cache.has(key)) {
349
+ return cache.get(key);
350
+ }
351
+ const result = fn(...args);
352
+ cache.set(key, result);
353
+ return result;
354
+ };
355
+ memoizedFn.cache = cache;
356
+ return memoizedFn;
357
+ };
358
+
359
+ // src/utils/flags/config.ts
360
+ var flagConfig = {
361
+ ["connect_sign_in_show_social_label" /* ConnectSignInShowSocialLabel */]: {
362
+ type: "boolean",
363
+ default_value: false,
364
+ overrides: [
365
+ {
366
+ if_any: [
367
+ {
368
+ key: "apiKey",
369
+ type: "isAnyOf",
370
+ values: ["hnHevQR0y394nBprGrvNx4HgoZHUwMet5mXTOBhf"]
371
+ }
372
+ ],
373
+ value: true
374
+ }
375
+ ]
376
+ }
377
+ };
378
+
379
+ // src/utils/flags/impl.ts
380
+ import { datadogLogs as datadogLogs2 } from "@datadog/browser-logs";
381
+ import fetch2 from "node-fetch";
382
+
383
+ // src/utils/flags/endpoint.ts
384
+ var FLAG_ENDPOINT_HOST = "sdk-cdn.fun.xyz";
385
+ var FLAG_PROD_ENDPOINT_PATH = "flags/v0/config.json";
386
+ var FLAG_PROD_ENDPOINT = `https://${FLAG_ENDPOINT_HOST}/${FLAG_PROD_ENDPOINT_PATH}`;
387
+
388
+ // src/utils/flags/hash.ts
389
+ var cyrb53 = (str, seed = 0) => {
390
+ let h1 = 3735928559 ^ seed;
391
+ let h2 = 1103547991 ^ seed;
392
+ for (let i = 0; i < str.length; i++) {
393
+ const ch = str.charCodeAt(i);
394
+ h1 = Math.imul(h1 ^ ch, 2654435761);
395
+ h2 = Math.imul(h2 ^ ch, 1597334677);
396
+ }
397
+ h1 = Math.imul(h1 ^ h1 >>> 16, 2246822507);
398
+ h1 ^= Math.imul(h2 ^ h2 >>> 13, 3266489909);
399
+ h2 = Math.imul(h2 ^ h2 >>> 16, 2246822507);
400
+ h2 ^= Math.imul(h1 ^ h1 >>> 13, 3266489909);
401
+ return 4294967296 * (2097151 & h2) + (h1 >>> 0);
402
+ };
403
+ var hashPct = (flag_key, value, pct) => {
404
+ const hashKey = `${flag_key}__${value}`;
405
+ return cyrb53(hashKey) % 100 < pct;
406
+ };
407
+
408
+ // src/utils/flags/impl.ts
409
+ async function fetchWithTimeout(url, options = {}, timeout = 15e3) {
410
+ const controller = new AbortController();
411
+ const id = setTimeout(() => controller.abort(), timeout);
412
+ options.signal = controller.signal;
413
+ try {
414
+ const response = await fetch2(url, options);
415
+ clearTimeout(id);
416
+ return response;
417
+ } catch (error) {
418
+ if (error.name === "AbortError") {
419
+ throw new Error(`Request timed out after ${timeout / 1e3} seconds`);
420
+ }
421
+ throw error;
422
+ }
423
+ }
424
+ var warn = (...args) => {
425
+ };
426
+ var fetchConfigFromServer = async () => {
427
+ const response = await fetchWithTimeout(FLAG_PROD_ENDPOINT, {}, 5e3);
428
+ const configData = await response.json();
429
+ logger.log("flag_fetchConfigFromServer", {
430
+ configData
431
+ });
432
+ return configData.flags;
433
+ };
434
+ var FeatureFlag = class {
435
+ constructor(_config, fetchFlagConfig = fetchConfigFromServer) {
436
+ this._config = _config;
437
+ this.userContext = null;
438
+ this.derivedFlags = null;
439
+ this.isUsingOnlineConfig = false;
440
+ this.flagConfig = _config;
441
+ this.fetchFlagConfig = memoize(fetchFlagConfig);
442
+ }
443
+ static createForTesting(flags2, fetchFlagConfig) {
444
+ return new FeatureFlag(flags2, fetchFlagConfig);
445
+ }
446
+ async init(userContext) {
447
+ try {
448
+ if (!this.isUsingOnlineConfig) {
449
+ this.flagConfig = await this.fetchFlagConfig();
450
+ this.isUsingOnlineConfig = true;
451
+ this.deriveAllFlags(userContext);
452
+ }
453
+ } catch (err) {
454
+ warn("Failed to fetch config:", err);
455
+ this.flagConfig = this._config;
456
+ this.isUsingOnlineConfig = false;
457
+ this.deriveAllFlags(userContext);
458
+ } finally {
459
+ }
460
+ }
461
+ deriveAllFlags(userContext) {
462
+ if (this.userContext && this.userContext.apiKey === userContext.apiKey && this.userContext.userId === userContext.userId) {
463
+ return;
464
+ }
465
+ this.derivedFlags = Object.fromEntries(
466
+ Object.entries(this.flagConfig).map(([key, flag]) => [
467
+ key,
468
+ this.deriveFlag(key, flag, userContext)
469
+ ])
470
+ );
471
+ this.userContext = userContext;
472
+ logger.log("flag_deriveAllFlags", {
473
+ flags: this.derivedFlags,
474
+ userContext
475
+ });
476
+ datadogLogs2.setGlobalContextProperty("flags", this.derivedFlags);
477
+ }
478
+ deriveFlag(flagKey, flagConfig2, context) {
479
+ let finalValue = flagConfig2.default_value;
480
+ for (const override of flagConfig2.overrides || []) {
481
+ if (override.if_any.some(
482
+ (condition) => this.evalCondition(flagKey, condition, context)
483
+ )) {
484
+ finalValue = override.value;
485
+ break;
486
+ }
487
+ }
488
+ return finalValue;
489
+ }
490
+ evalCondition(flagKey, condition, context) {
491
+ var _a, _b;
492
+ const needle = condition.key === "userId" ? context.userId : context.apiKey;
493
+ if (!needle) {
494
+ return false;
495
+ }
496
+ switch (condition.type) {
497
+ case "pctRollout": {
498
+ return hashPct(flagKey, needle, condition.pct);
499
+ }
500
+ case "isAnyOf": {
501
+ return (_b = (_a = condition.values) == null ? void 0 : _a.includes(needle)) != null ? _b : false;
502
+ }
503
+ default: {
504
+ }
505
+ }
506
+ const _ = condition;
507
+ throw new Error(`Unknown condition type: ${JSON.stringify(_)}`);
508
+ }
509
+ getBool(flagKey, fallback) {
510
+ var _a;
511
+ if (this.derivedFlags === null) {
512
+ logger.warn("flag_notInitialized", {
513
+ flagKey,
514
+ fallback
515
+ });
516
+ return fallback;
517
+ }
518
+ const flagValue = (_a = this.derivedFlags) == null ? void 0 : _a[flagKey];
519
+ return typeof flagValue === "boolean" ? flagValue : fallback;
520
+ }
521
+ getNumber(flagKey, fallback) {
522
+ var _a;
523
+ if (this.derivedFlags === null) {
524
+ logger.warn("flag_notInitialized", {
525
+ flagKey,
526
+ fallback
527
+ });
528
+ return fallback;
529
+ }
530
+ const flagValue = (_a = this.derivedFlags) == null ? void 0 : _a[flagKey];
531
+ return typeof flagValue === "number" ? flagValue : fallback;
532
+ }
533
+ getString(flagKey, fallback) {
534
+ var _a;
535
+ if (this.derivedFlags === null) {
536
+ logger.warn("flag_notInitialized", {
537
+ flagKey,
538
+ fallback
539
+ });
540
+ return fallback;
541
+ }
542
+ const flagValue = (_a = this.derivedFlags) == null ? void 0 : _a[flagKey];
543
+ return typeof flagValue === "string" ? flagValue : fallback;
544
+ }
545
+ };
546
+
547
+ // src/utils/flags/index.ts
548
+ var singleton = new FeatureFlag(flagConfig);
549
+ var getBool = memoize((...args) => {
550
+ const result = singleton.getBool(...args);
551
+ logger.log("flag_exposure", {
552
+ flagKey: args[0],
553
+ fallback: args[1],
554
+ flagValue: result,
555
+ type: "bool"
556
+ });
557
+ return result;
558
+ });
559
+ var getNumber = memoize((...args) => {
560
+ const result = singleton.getNumber(...args);
561
+ logger.log("flag_exposure", {
562
+ flagKey: args[0],
563
+ fallback: args[1],
564
+ flagValue: result,
565
+ type: "number"
566
+ });
567
+ return result;
568
+ });
569
+ var getString = memoize((...args) => {
570
+ const result = singleton.getString(...args);
571
+ logger.log("flag_exposure", {
572
+ flagKey: args[0],
573
+ fallback: args[1],
574
+ flagValue: result,
575
+ type: "string"
576
+ });
577
+ return result;
578
+ });
579
+ var init = (context) => {
580
+ singleton.init(context);
581
+ getBool.cache = /* @__PURE__ */ new Map();
582
+ getNumber.cache = /* @__PURE__ */ new Map();
583
+ getString.cache = /* @__PURE__ */ new Map();
584
+ };
585
+ var flags = {
586
+ init,
587
+ getBool,
588
+ getNumber,
589
+ getString
590
+ };
591
+
317
592
  // src/components/FunkitProvider/FunkitConfigContext.tsx
318
593
  import React4, { createContext as createContext2, useContext as useContext2, useMemo as useMemo2 } from "react";
319
594
 
@@ -793,7 +1068,12 @@ function FunkitConnectChainProvider({
793
1068
  configureEnvironment({
794
1069
  chain: initialChainFinal,
795
1070
  apiKey
796
- }).then(() => logger.log("Core configured"));
1071
+ }).then(() => {
1072
+ logger.log("Core configured");
1073
+ flags.init({
1074
+ apiKey
1075
+ });
1076
+ });
797
1077
  }
798
1078
  }, [apiKey, initialChainFinal]);
799
1079
  return /* @__PURE__ */ React5.createElement(FunkitConnectChainContext.Provider, {
@@ -1497,7 +1777,7 @@ var GeneralWalletContext = createContext7({
1497
1777
  isUserLoggedIn: false,
1498
1778
  isWeb2Login: false,
1499
1779
  isWeb3Login: false,
1500
- userInfo: { ...PLACEHOLDER_FUNKIT_USER_INFO, globalFunkitUserId: "" },
1780
+ userInfo: PLACEHOLDER_FUNKIT_USER_INFO,
1501
1781
  isFetchingAssets: false,
1502
1782
  walletAssets: null,
1503
1783
  startAssetsListener: () => void 0,
@@ -1511,7 +1791,7 @@ function GeneralWalletProvider({ children }) {
1511
1791
  const { address, connector, isConnected, chain: activeChain } = useAccount2();
1512
1792
  const { connectors, disconnectAsync } = useDisconnect();
1513
1793
  const ensName = useMainnetEnsName(address);
1514
- const { web2AccountInfo, handleFunkitWeb2Logout } = useFunkitWeb2Login();
1794
+ const { web2UserInfo, handleFunkitWeb2Logout } = useFunkitWeb2Login();
1515
1795
  const { apiKey, accountModalConfig, paymentsConfig } = useFunkitConfig();
1516
1796
  const isWeb2Login = useMemo4(() => {
1517
1797
  return connector && connector.id === FUNKIT_CONNECT_WALLET_ID;
@@ -1523,37 +1803,46 @@ function GeneralWalletProvider({ children }) {
1523
1803
  return isWeb2Login || isWeb3Login;
1524
1804
  }, [isWeb2Login, isWeb3Login]);
1525
1805
  const userInfo = useMemo4(() => {
1526
- let baseInfo;
1527
- if (isWeb2Login) {
1528
- baseInfo = web2AccountInfo;
1529
- } else if (isWeb3Login) {
1530
- baseInfo = {
1531
- userId: address,
1532
- accountLabel: connector == null ? void 0 : connector.name,
1533
- accountName: ensName ? ensName : address,
1534
- accountNameDisplay: ensName ? formatENS(ensName) : formatAddress(address || "")
1806
+ if (!address)
1807
+ return PLACEHOLDER_FUNKIT_USER_INFO;
1808
+ if (isWeb2Login)
1809
+ return {
1810
+ ...web2UserInfo,
1811
+ address
1812
+ };
1813
+ if (isWeb3Login) {
1814
+ return {
1815
+ id: address,
1816
+ address,
1817
+ name: ensName ? ensName : address,
1818
+ nameTruncated: ensName ? formatENS(ensName) : formatAddress(address || ""),
1819
+ type: "eoa",
1820
+ typeLabel: (connector == null ? void 0 : connector.name) || "",
1821
+ iconSrc: ""
1535
1822
  };
1536
- } else {
1537
- baseInfo = PLACEHOLDER_FUNKIT_USER_INFO;
1538
1823
  }
1539
- return {
1540
- ...baseInfo,
1541
- globalFunkitUserId: isUserLoggedIn ? `${address}|${baseInfo.accountName}|${apiKey}` : `0x|UnknownGuest|${apiKey}`
1542
- };
1824
+ return PLACEHOLDER_FUNKIT_USER_INFO;
1543
1825
  }, [
1544
1826
  address,
1545
- apiKey,
1546
1827
  connector == null ? void 0 : connector.name,
1547
1828
  ensName,
1548
- isUserLoggedIn,
1549
1829
  isWeb2Login,
1550
1830
  isWeb3Login,
1551
- web2AccountInfo
1831
+ web2UserInfo
1552
1832
  ]);
1553
1833
  useEffect6(() => {
1554
- if (userInfo.globalFunkitUserId !== logger.getUserId()) {
1555
- logger.log("settingUserId", { newUserId: userInfo.globalFunkitUserId });
1556
- logger.setUserId(userInfo.globalFunkitUserId);
1834
+ if (userInfo.id !== logger.getUserId() || userInfo.address !== logger.getUserAddress() || userInfo.name !== logger.getUserName() || userInfo.type !== logger.getUserLoginType()) {
1835
+ logger.log("settingUserInfo", userInfo);
1836
+ logger.setUserInfo(
1837
+ userInfo.id,
1838
+ userInfo.address,
1839
+ userInfo.name,
1840
+ userInfo.type
1841
+ );
1842
+ void flags.init({
1843
+ apiKey,
1844
+ userId: userInfo.id
1845
+ });
1557
1846
  }
1558
1847
  }, [userInfo]);
1559
1848
  const intervalRef = useRef2();
@@ -1600,7 +1889,7 @@ function GeneralWalletProvider({ children }) {
1600
1889
  setIsFetchingAssets(false);
1601
1890
  }
1602
1891
  }
1603
- }, [isConnected, address, accountModalConfig.showUnknownTokens]);
1892
+ }, [isConnected, address, apiKey, accountModalConfig.showUnknownTokens]);
1604
1893
  useEffect6(() => {
1605
1894
  _fetchAssetsIfPossible();
1606
1895
  }, [refreshSymbol, activeChain]);
@@ -1861,6 +2150,7 @@ import React91, { useCallback as useCallback22, useMemo as useMemo26, useState a
1861
2150
 
1862
2151
  // src/components/FunkitProvider/FunkitCheckoutContext.tsx
1863
2152
  import {
2153
+ CheckoutState as CheckoutState3,
1864
2154
  getAssetPriceInfo as getAssetPriceInfo2,
1865
2155
  getCheckoutByDepositAddress,
1866
2156
  getCheckoutQuote as getApiCheckoutQuote,
@@ -1966,10 +2256,12 @@ function generateQuoteApiErrorForDisplay(errorMessage = "") {
1966
2256
  }
1967
2257
 
1968
2258
  // src/utils/checkout.ts
1969
- import { getAssetPriceInfo } from "@funkit/api-base";
1970
2259
  import {
1971
- CHECKOUT_SPONSOR_SUPPORT_CHAINS,
1972
2260
  CheckoutState as CheckoutState2,
2261
+ getAssetPriceInfo
2262
+ } from "@funkit/api-base";
2263
+ import {
2264
+ CHECKOUT_SPONSOR_SUPPORT_CHAINS,
1973
2265
  CONTRACT_ADDRESSES,
1974
2266
  FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS as FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS2,
1975
2267
  FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO3,
@@ -2592,7 +2884,7 @@ function FunkitCheckoutProvider({ children }) {
2592
2884
  newCheckoutHistoryList = singleCheckoutHistory ? [singleCheckoutHistory] : [];
2593
2885
  }
2594
2886
  setCheckoutHistoryList(
2595
- newCheckoutHistoryList.sort((a, b) => b.createdTimeMs - a.createdTimeMs)
2887
+ newCheckoutHistoryList.filter((item) => item.state !== CheckoutState3.CANCELLED).sort((a, b) => b.createdTimeMs - a.createdTimeMs)
2596
2888
  );
2597
2889
  setIsCheckoutHistoryInited(true);
2598
2890
  } catch (err) {
@@ -3696,12 +3988,12 @@ var animateContentInClass = "stgjxl2";
3696
3988
  var animateContentOutClass = "stgjxl3";
3697
3989
 
3698
3990
  // src/hooks/useCheckoutStateBooleans.ts
3699
- import { CheckoutState as CheckoutState3 } from "@funkit/core";
3991
+ import { CheckoutState as CheckoutState4 } from "@funkit/api-base";
3700
3992
  function useCheckoutStateBooleans(checkoutState) {
3701
3993
  const isProcessing = IN_PROGRESS_CHECKOUT_STATES.includes(checkoutState);
3702
- const isCompleted = checkoutState === CheckoutState3.COMPLETED;
3703
- const isError = checkoutState === CheckoutState3.CHECKOUT_ERROR;
3704
- const isExpired = checkoutState === CheckoutState3.EXPIRED;
3994
+ const isCompleted = checkoutState === CheckoutState4.COMPLETED;
3995
+ const isError = checkoutState === CheckoutState4.CHECKOUT_ERROR;
3996
+ const isExpired = checkoutState === CheckoutState4.EXPIRED;
3705
3997
  const isFailed = isError || isExpired;
3706
3998
  const isTerminal = TERMINAL_CHECKOUT_STATES.includes(checkoutState);
3707
3999
  return {
@@ -4543,7 +4835,6 @@ import {
4543
4835
  } from "@funkit/api-base";
4544
4836
  import { FUNKIT_CONNECT_SUPPORTED_CHAINS_ID_LIST } from "@funkit/core";
4545
4837
  var FUNKIT_MESH_CLIENT_ID = "8132aff4-56c9-4b1d-85b4-08dbdcc6199d";
4546
- var MESH_DEFAULT_USER_ID = "meshconnectkit";
4547
4838
  var MeshExchanges = /* @__PURE__ */ ((MeshExchanges4) => {
4548
4839
  MeshExchanges4["Robinhood"] = "Robinhood";
4549
4840
  MeshExchanges4["ETrade"] = "ETrade";
@@ -4726,6 +5017,7 @@ function useFunkitMesh({
4726
5017
  onMeshModalClose
4727
5018
  }) {
4728
5019
  const { apiKey } = useFunkitConfig();
5020
+ const { userInfo } = useGeneralWallet();
4729
5021
  const { meshBrokerDataMap, setDataMapAndCache } = useContext10(FunkitMeshContext);
4730
5022
  const handleIntegrationConnected = useCallback10(
4731
5023
  (brokerData) => {
@@ -4770,7 +5062,7 @@ function useFunkitMesh({
4770
5062
  onConnected == null ? void 0 : onConnected(meshBrokerDataMap[brokerage]);
4771
5063
  } else {
4772
5064
  const response = await fetchMeshLinkToken(
4773
- MESH_DEFAULT_USER_ID,
5065
+ userInfo.id,
4774
5066
  brokerage,
4775
5067
  apiKey
4776
5068
  );
@@ -4788,7 +5080,8 @@ function useFunkitMesh({
4788
5080
  hasActiveConnectionCheck,
4789
5081
  meshBrokerDataMap,
4790
5082
  onBeforeConnect,
4791
- onConnected
5083
+ onConnected,
5084
+ userInfo.id
4792
5085
  ]
4793
5086
  );
4794
5087
  const unlinkBrokerage = useCallback10(
@@ -6436,7 +6729,7 @@ function FunPaymentMoonpayType({
6436
6729
  },
6437
6730
  theme: active2.moonpayTheme,
6438
6731
  colorCode: moonpayButtonColor,
6439
- externalCustomerId: userInfo.globalFunkitUserId
6732
+ externalCustomerId: userInfo.id
6440
6733
  })), paymentFlow === 0 /* DEPOSIT */ ? /* @__PURE__ */ React59.createElement(Box, {
6441
6734
  width: "full"
6442
6735
  }, /* @__PURE__ */ React59.createElement(FunButton, {
@@ -9720,9 +10013,7 @@ function CheckoutPrimaryInfo({
9720
10013
  }
9721
10014
 
9722
10015
  // src/components/FunTransactionSummary/FunTxSummaryHistory.tsx
9723
- import {
9724
- FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO9
9725
- } from "@funkit/core";
10016
+ import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO9 } from "@funkit/core";
9726
10017
  import React87, { useMemo as useMemo24 } from "react";
9727
10018
 
9728
10019
  // src/components/Icons/RedirectIcon.tsx
@@ -10183,7 +10474,13 @@ function FunCheckoutHistoryHelp({
10183
10474
 
10184
10475
  App ID: ${apiKey}
10185
10476
 
10186
- User ID: ${userInfo.globalFunkitUserId}
10477
+ User ID: ${userInfo.id}
10478
+
10479
+ User Name: ${userInfo.name}
10480
+
10481
+ User Address: ${userInfo.address}
10482
+
10483
+ Checkout Recipient Address: ${checkoutHistoryInfo.recipientAddr}
10187
10484
 
10188
10485
  =========================
10189
10486
 
@@ -10390,7 +10687,7 @@ function FunCheckoutHistoryContent({
10390
10687
  }
10391
10688
 
10392
10689
  // src/components/ProfileDetails/FunProfileViews/ActivityHistory/ActivityHistory.tsx
10393
- import { CheckoutState as CheckoutState4 } from "@funkit/core";
10690
+ import { CheckoutState as CheckoutState5 } from "@funkit/api-base";
10394
10691
  import React95, { useEffect as useEffect22, useMemo as useMemo28, useState as useState27 } from "react";
10395
10692
 
10396
10693
  // src/components/FunNotification/FunCheckoutNotification.tsx
@@ -10654,11 +10951,11 @@ function ActivityHistory({
10654
10951
  });
10655
10952
  } else if (activeTab === "Failed" /* FAILED */) {
10656
10953
  sortedList = [
10657
- ...checkoutHistoryStateMap[CheckoutState4.EXPIRED],
10658
- ...checkoutHistoryStateMap[CheckoutState4.CHECKOUT_ERROR]
10954
+ ...checkoutHistoryStateMap[CheckoutState5.EXPIRED],
10955
+ ...checkoutHistoryStateMap[CheckoutState5.CHECKOUT_ERROR]
10659
10956
  ];
10660
10957
  } else if (activeTab === "Completed" /* COMPLETED */) {
10661
- sortedList = checkoutHistoryStateMap[CheckoutState4.COMPLETED];
10958
+ sortedList = checkoutHistoryStateMap[CheckoutState5.COMPLETED];
10662
10959
  }
10663
10960
  return sortedList.sort((a, b) => b.createdTimeMs - a.createdTimeMs);
10664
10961
  }, [activeTab, checkoutHistoryList, checkoutHistoryStateMap]);
@@ -11085,7 +11382,7 @@ var ProfileTitleSection = ({
11085
11382
  className: animateOut ? animateAvatarOutClass : animateAvatarInClass
11086
11383
  }, /* @__PURE__ */ React105.createElement(Avatar, {
11087
11384
  address: account.address,
11088
- imageUrl: account.ensAvatar || userInfo.accountPicSrc,
11385
+ imageUrl: account.ensAvatar || userInfo.iconSrc,
11089
11386
  loading: account.hasPendingTransactions,
11090
11387
  size: 24
11091
11388
  })), /* @__PURE__ */ React105.createElement(Text, {
@@ -11093,7 +11390,7 @@ var ProfileTitleSection = ({
11093
11390
  size: "16",
11094
11391
  weight: "semibold",
11095
11392
  className: animateOut ? animateTitleOutClass2 : animateTitleInClass2
11096
- }, userInfo.accountNameDisplay)), /* @__PURE__ */ React105.createElement(Box, {
11393
+ }, userInfo.nameTruncated)), /* @__PURE__ */ React105.createElement(Box, {
11097
11394
  display: "flex",
11098
11395
  alignItems: "center",
11099
11396
  flexDirection: "row",
@@ -11295,8 +11592,8 @@ function Settings({
11295
11592
  paddingBottom: "28",
11296
11593
  className: animateOut ? animateContentOutClass : animateContentInClass
11297
11594
  }, /* @__PURE__ */ React106.createElement(LineItem, {
11298
- label: isWeb3Login ? "Wallet" : userInfo.accountLabel,
11299
- value: isWeb3Login ? userInfo.accountLabel : userInfo.accountName
11595
+ label: isWeb3Login ? "Wallet" : userInfo.typeLabel,
11596
+ value: isWeb3Login ? userInfo.typeLabel : userInfo.name
11300
11597
  }), /* @__PURE__ */ React106.createElement(LineItem, {
11301
11598
  label: "Address",
11302
11599
  value: formatAddress(walletAddress),
@@ -12438,7 +12735,15 @@ function FunSignInStep({
12438
12735
  display: "flex",
12439
12736
  flexDirection: "column",
12440
12737
  gap: "14"
12441
- }, /* @__PURE__ */ React118.createElement(Box, {
12738
+ }, flags.getBool("connect_sign_in_show_social_label" /* ConnectSignInShowSocialLabel */, false) ? /* @__PURE__ */ React118.createElement(Box, {
12739
+ display: "flex",
12740
+ justifyContent: "center",
12741
+ width: "full"
12742
+ }, /* @__PURE__ */ React118.createElement(Text, {
12743
+ size: "14",
12744
+ color: "modalTextSecondary",
12745
+ weight: "medium"
12746
+ }, "or continue with")) : null, /* @__PURE__ */ React118.createElement(Box, {
12442
12747
  display: "flex",
12443
12748
  gap: "10"
12444
12749
  }, ENABLED_SOCIAL_ITEMS.map((socialItem) => /* @__PURE__ */ React118.createElement(FunIconButton, {
@@ -15097,7 +15402,7 @@ var FunkitWeb2Context = createContext19({
15097
15402
  loginErrorMessage: "",
15098
15403
  clearLoginError: () => void 0,
15099
15404
  handleFunkitWeb2Logout: () => Promise.resolve(void 0),
15100
- web2AccountInfo: PLACEHOLDER_FUNKIT_USER_INFO
15405
+ web2UserInfo: PLACEHOLDER_FUNKIT_USER_INFO
15101
15406
  });
15102
15407
  var LOGIN_METHOD_CACHE = "privy:login:method";
15103
15408
  var PRIVY_AUTH_URL = "https://auth.privy.io";
@@ -15105,13 +15410,6 @@ var PRIVY_IFRAME_ID = "privy-funkit-iframe";
15105
15410
  var PRIVY_OAUTH_CODE_URL_PARAM = "privy_oauth_code";
15106
15411
  var PRIVY_OAUTH_STATE_URL_PARAM = "privy_oauth_state";
15107
15412
  var RESEND_EMAIL_TIMEOUT_MS = 3e3;
15108
- var FunkitSocialLoginMethod = /* @__PURE__ */ ((FunkitSocialLoginMethod2) => {
15109
- FunkitSocialLoginMethod2["GOOGLE"] = "google_oauth" /* google_oauth */;
15110
- FunkitSocialLoginMethod2["TWITTER"] = "twitter_oauth" /* twitter_oauth */;
15111
- FunkitSocialLoginMethod2["APPLE"] = "apple_oauth" /* apple_oauth */;
15112
- FunkitSocialLoginMethod2["FARCASTER"] = "farcaster" /* farcaster */;
15113
- return FunkitSocialLoginMethod2;
15114
- })(FunkitSocialLoginMethod || {});
15115
15413
  var getLoginMethodFromCache = () => {
15116
15414
  try {
15117
15415
  return window.localStorage.getItem(LOGIN_METHOD_CACHE) || "";
@@ -15158,7 +15456,7 @@ var FunkitWeb2Provider = ({
15158
15456
  });
15159
15457
  setPrivyIframeUrl(newPrivy.embeddedWallet.getURL());
15160
15458
  setPrivy(newPrivy);
15161
- }, [funkitConfig.privyAppId]);
15459
+ }, [chains, funkitConfig.privyAppId]);
15162
15460
  const handleIframeMessage = useCallback31(
15163
15461
  (e) => {
15164
15462
  if (e.origin === PRIVY_AUTH_URL && privy) {
@@ -15470,69 +15768,60 @@ var FunkitWeb2Provider = ({
15470
15768
  },
15471
15769
  [privy]
15472
15770
  );
15473
- const userAccountInfo = useMemo35(() => {
15474
- if (loggedInUser && loggedInUser.linked_accounts && loggedInUser.linked_accounts.length > 0) {
15475
- const loggedInAccount = loggedInUser.linked_accounts.find(
15476
- (account) => (account == null ? void 0 : account.type) === loginMethod
15477
- );
15478
- if (!loggedInAccount)
15479
- return PLACEHOLDER_FUNKIT_USER_INFO;
15480
- switch (loggedInAccount.type) {
15481
- case "email" /* email */:
15482
- return {
15483
- userId: loggedInAccount.address,
15484
- accountLabel: "Email",
15485
- accountName: loggedInAccount.address,
15486
- accountNameDisplay: formatAccountName(
15487
- loggedInAccount.address,
15488
- true
15489
- ),
15490
- accountPicSrc: ""
15491
- };
15492
- case "farcaster" /* farcaster */:
15493
- return {
15494
- userId: `@${loggedInAccount.username}`,
15495
- accountLabel: "Farcaster ID",
15496
- accountName: `@${loggedInAccount.username}`,
15497
- accountNameDisplay: formatAccountName(
15498
- `@${loggedInAccount.username}`,
15499
- false
15500
- ),
15501
- accountPicSrc: loggedInAccount.profile_picture_url || ""
15502
- };
15503
- case "google_oauth" /* google_oauth */:
15504
- return {
15505
- userId: loggedInAccount.email,
15506
- accountLabel: "Email",
15507
- accountName: loggedInAccount.email,
15508
- accountNameDisplay: formatAccountName(loggedInAccount.email, true),
15509
- accountPicSrc: ""
15510
- };
15511
- case "twitter_oauth" /* twitter_oauth */:
15512
- return {
15513
- userId: `@${loggedInAccount.username}`,
15514
- accountLabel: "Twitter ID",
15515
- accountName: `@${loggedInAccount.username}`,
15516
- accountNameDisplay: formatAccountName(
15517
- `@${loggedInAccount.username}`,
15518
- false
15519
- ),
15520
- accountPicSrc: loggedInAccount.profile_picture_url || ""
15521
- };
15522
- case "apple_oauth" /* apple_oauth */:
15523
- return {
15524
- userId: loggedInAccount.email,
15525
- accountLabel: "Apple ID",
15526
- accountName: loggedInAccount.email,
15527
- accountNameDisplay: formatAccountName(loggedInAccount.email, true),
15528
- accountPicSrc: ""
15529
- };
15530
- default:
15531
- return PLACEHOLDER_FUNKIT_USER_INFO;
15532
- }
15533
- } else {
15771
+ const web2UserInfo = useMemo35(() => {
15772
+ var _a;
15773
+ if (!loggedInUser || !(loggedInUser == null ? void 0 : loggedInUser.linked_accounts) || !((_a = loggedInUser == null ? void 0 : loggedInUser.linked_accounts) == null ? void 0 : _a.length)) {
15534
15774
  return PLACEHOLDER_FUNKIT_USER_INFO;
15535
15775
  }
15776
+ const loggedInAccount = loggedInUser.linked_accounts.find(
15777
+ (account) => (account == null ? void 0 : account.type) === loginMethod
15778
+ );
15779
+ if (!loggedInAccount)
15780
+ return PLACEHOLDER_FUNKIT_USER_INFO;
15781
+ const id = loggedInUser.id;
15782
+ const type = loggedInAccount.type;
15783
+ let name = "";
15784
+ let nameTruncated = "";
15785
+ let iconSrc = "";
15786
+ let typeLabel = "";
15787
+ switch (loggedInAccount.type) {
15788
+ case "email" /* email */:
15789
+ name = loggedInAccount.address;
15790
+ nameTruncated = formatAccountName(loggedInAccount.address, true);
15791
+ typeLabel = "Email";
15792
+ break;
15793
+ case "google_oauth" /* google_oauth */:
15794
+ name = loggedInAccount.email;
15795
+ nameTruncated = formatAccountName(loggedInAccount.email, true);
15796
+ typeLabel = "Email";
15797
+ break;
15798
+ case "twitter_oauth" /* twitter_oauth */:
15799
+ name = `@${loggedInAccount.username}`;
15800
+ nameTruncated = formatAccountName(name, false);
15801
+ typeLabel = "Twitter ID";
15802
+ iconSrc = loggedInAccount.profile_picture_url || "";
15803
+ break;
15804
+ case "apple_oauth" /* apple_oauth */:
15805
+ name = loggedInAccount.email;
15806
+ nameTruncated = formatAccountName(loggedInAccount.email, true);
15807
+ typeLabel = "Apple ID";
15808
+ iconSrc = loggedInAccount.profile_picture_url || "";
15809
+ break;
15810
+ case "farcaster" /* farcaster */:
15811
+ name = `@${loggedInAccount.username}`;
15812
+ nameTruncated = formatAccountName(name, false);
15813
+ typeLabel = "Farcaster ID";
15814
+ iconSrc = loggedInAccount.profile_picture_url || "";
15815
+ break;
15816
+ }
15817
+ return {
15818
+ id,
15819
+ name,
15820
+ nameTruncated,
15821
+ type,
15822
+ typeLabel,
15823
+ iconSrc
15824
+ };
15536
15825
  }, [loggedInUser, loginMethod]);
15537
15826
  const contextValue = {
15538
15827
  isSendingOtpEmail,
@@ -15546,7 +15835,7 @@ var FunkitWeb2Provider = ({
15546
15835
  clearLoginError,
15547
15836
  handleFunkitWeb2Login,
15548
15837
  handleFunkitWeb2Logout,
15549
- web2AccountInfo: userAccountInfo
15838
+ web2UserInfo
15550
15839
  };
15551
15840
  return /* @__PURE__ */ React143.createElement(FunkitWeb2Context.Provider, {
15552
15841
  value: contextValue
@@ -16082,7 +16371,7 @@ function AccountButton({
16082
16371
  )
16083
16372
  }, /* @__PURE__ */ React148.createElement(Avatar, {
16084
16373
  address: account.address,
16085
- imageUrl: account.ensAvatar || userInfo.accountPicSrc,
16374
+ imageUrl: account.ensAvatar || userInfo.iconSrc,
16086
16375
  loading: account.hasPendingTransactions,
16087
16376
  size: 24
16088
16377
  })), /* @__PURE__ */ React148.createElement(Box, {
@@ -16095,7 +16384,7 @@ function AccountButton({
16095
16384
  (value) => value === "full" || value === "address" ? "block" : "none"
16096
16385
  ),
16097
16386
  style: { textWrap: "nowrap" }
16098
- }, userInfo.accountNameDisplay), /* @__PURE__ */ React148.createElement(DropdownIcon, null)))));
16387
+ }, userInfo.nameTruncated), /* @__PURE__ */ React148.createElement(DropdownIcon, null)))));
16099
16388
  }
16100
16389
  function ConnectButton({
16101
16390
  accountStatus = defaultProps.accountStatus,
@@ -16995,7 +17284,7 @@ function setFunkitConnectVersion({ version }) {
16995
17284
  localStorage.setItem(storageKey6, version);
16996
17285
  }
16997
17286
  function getCurrentSdkVersion() {
16998
- return "1.2.5";
17287
+ return "1.2.7";
16999
17288
  }
17000
17289
  function useFingerprint() {
17001
17290
  const fingerprint = useCallback33(() => {