@funkit/connect 12.3.0 → 12.4.0

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 (54) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/components/FunNotification/FunNotification.d.ts +15 -2
  3. package/dist/consts/quote.d.ts +13 -13
  4. package/dist/domains/checkoutErrors.d.ts +3 -3
  5. package/dist/domains/relay.d.ts +3 -3
  6. package/dist/hooks/queries/useMeldLimits.d.ts +2 -1
  7. package/dist/hooks/track/analytics/events.d.ts +8 -0
  8. package/dist/hooks/track/analytics/useTrackErrorShown.d.ts +12 -0
  9. package/dist/hooks/useCheckoutQuoteNotification.d.ts +1 -1
  10. package/dist/index.js +624 -415
  11. package/dist/interfaces/solanaWallet.d.ts +2 -22
  12. package/dist/modals/CheckoutModal/ConfirmationStep/usePostCheckout.d.ts +2 -2
  13. package/dist/modals/CheckoutModal/InputAmount/useMeld.d.ts +2 -2
  14. package/dist/providers/FunkitQuoteContext.d.ts +2 -1
  15. package/dist/utils/solanaRelayWallet.d.ts +9 -0
  16. package/dist/utils/swapped.d.ts +2 -0
  17. package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
  18. package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
  19. package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
  20. package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
  21. package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
  22. package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
  23. package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
  24. package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
  25. package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
  26. package/dist/wallets/walletConnectors/index.js +55 -55
  27. package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
  28. package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
  29. package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
  30. package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
  31. package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
  32. package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
  33. package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
  34. package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
  35. package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
  36. package/package.json +7 -5
  37. package/dist/wallets/walletConnectors/chunk-53MYTA42.js +0 -94
  38. package/dist/wallets/walletConnectors/chunk-65ULY6OC.js +0 -70
  39. package/dist/wallets/walletConnectors/chunk-A5POD5SV.js +0 -103
  40. package/dist/wallets/walletConnectors/chunk-ANODOMIN.js +0 -218
  41. package/dist/wallets/walletConnectors/chunk-ASTCNVJC.js +0 -96
  42. package/dist/wallets/walletConnectors/chunk-F45CUFRR.js +0 -66
  43. package/dist/wallets/walletConnectors/chunk-FYPQ3HP4.js +0 -92
  44. package/dist/wallets/walletConnectors/chunk-IWPW26AL.js +0 -98
  45. package/dist/wallets/walletConnectors/chunk-JJBLW4IU.js +0 -87
  46. package/dist/wallets/walletConnectors/chunk-KE4CWI3A.js +0 -93
  47. package/dist/wallets/walletConnectors/chunk-MWB6LFSG.js +0 -110
  48. package/dist/wallets/walletConnectors/chunk-OVDCDVFX.js +0 -100
  49. package/dist/wallets/walletConnectors/chunk-PPQ6L4K2.js +0 -106
  50. package/dist/wallets/walletConnectors/chunk-RJF2YEZ5.js +0 -92
  51. package/dist/wallets/walletConnectors/chunk-RQYEGJKL.js +0 -96
  52. package/dist/wallets/walletConnectors/chunk-TIHTQ3OB.js +0 -95
  53. package/dist/wallets/walletConnectors/chunk-TM7UBV3Q.js +0 -69
  54. package/dist/wallets/walletConnectors/chunk-USLZMUJ3.js +0 -99
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @funkit/connect
2
2
 
3
+ ## 12.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - b948af2: `SolanaWalletConnection`'s `signAndSendTransaction` resolves the raw 64-byte signature instead of a base58 string
8
+
9
+ ### Patch Changes
10
+
11
+ - f15fc2a: The Swapped embed now renders themes whose colors use modern CSS color functions such as `oklch()` or `lab()`.
12
+ - 140dc65: Track when checkout errors are shown to users.
13
+ - b631d39: Generalize error notification structure
14
+ - 2b07abc: Track displayed errors across checkout and withdrawal flows.
15
+ - Updated dependencies [b948af2]
16
+ - Updated dependencies [3a6256a]
17
+ - Updated dependencies [b948af2]
18
+ - Updated dependencies [46d5375]
19
+ - Updated dependencies [50e2acc]
20
+ - Updated dependencies [78f075b]
21
+ - @funkit/api-base@8.2.0
22
+ - @funkit/connect-core@6.1.0
23
+ - @funkit/fun-relay@3.0.0
24
+
3
25
  ## 12.3.0
4
26
 
5
27
  ### Minor Changes
@@ -8,10 +8,23 @@ interface FunNotificationProps {
8
8
  testId?: string;
9
9
  }
10
10
  export type FunNotificationType = 'default' | 'error' | 'warning' | 'hint' | 'warningAlert';
11
- export interface ErrorNotification {
11
+ export type DisplayedError = {
12
+ /**
13
+ * Stable error code for analytics
14
+ */
15
+ code: string | null;
16
+ /**
17
+ * Stable message key for analytics
18
+ * - should not forward arbitrary 3rd-party error messages
19
+ * - should not depend on locale
20
+ */
21
+ messageKey: string | null;
22
+ /** User-visible error message */
12
23
  message: ReactNode;
24
+ };
25
+ export type ErrorNotification = DisplayedError & {
13
26
  type: FunNotificationType;
14
- }
27
+ };
15
28
  /**
16
29
  * A notification/message component with height resizing animation.
17
30
  * Control visibility by enabling/disabling `isVisible` prop instead of doing an outer conditional rendering.
@@ -1,5 +1,5 @@
1
1
  import type { TFunction } from 'i18next';
2
- import type { ReactNode } from 'react';
2
+ import type { DisplayedError, ErrorNotification } from '../components/FunNotification/FunNotification';
3
3
  export declare enum PendingQuoteMessage {
4
4
  PREPARING = 0,
5
5
  VERIFYING_PROVIDER = 1,
@@ -15,31 +15,31 @@ export declare const getPendingQuoteMessageGenerator: (t: TFunction) => {
15
15
  export declare const getQuoteApiErrorDisplayInfo: (t: TFunction) => {
16
16
  0: {
17
17
  check: string;
18
- display: ReactNode;
18
+ display: ErrorNotification;
19
19
  };
20
20
  1: {
21
21
  check: string;
22
- display: ReactNode;
22
+ display: ErrorNotification;
23
23
  };
24
24
  6: {
25
25
  check: string;
26
- display: string;
26
+ display: DisplayedError;
27
27
  };
28
28
  2: {
29
29
  check: string;
30
- display: string;
30
+ display: DisplayedError;
31
31
  };
32
32
  3: {
33
33
  check: string;
34
- display: string;
34
+ display: DisplayedError;
35
35
  };
36
36
  4: {
37
37
  check: string;
38
- display: string;
38
+ display: DisplayedError;
39
39
  };
40
40
  5: {
41
41
  check: string;
42
- display: string;
42
+ display: DisplayedError;
43
43
  };
44
44
  };
45
45
  export declare enum QuoteCustomErrorType {
@@ -51,19 +51,19 @@ export declare enum QuoteCustomErrorType {
51
51
  export declare const getQuoteCustomErrorDisplayInfo: (t: TFunction) => {
52
52
  0: {
53
53
  check: string;
54
- display: string;
54
+ display: DisplayedError;
55
55
  };
56
56
  1: {
57
57
  check: string;
58
- display: string;
58
+ display: DisplayedError;
59
59
  };
60
60
  2: {
61
61
  check: string;
62
- display: string;
62
+ display: DisplayedError;
63
63
  };
64
64
  3: {
65
65
  check: string;
66
- display: string;
66
+ display: DisplayedError;
67
67
  };
68
68
  };
69
- export declare function generateQuoteApiErrorForDisplay(err: Error, t: TFunction): ReactNode;
69
+ export declare function generateQuoteApiErrorForDisplay(err: Error, t: TFunction): DisplayedError;
@@ -1,10 +1,10 @@
1
1
  import type { TFunction } from 'i18next';
2
2
  import type { ErrorNotification } from '../components/FunNotification/FunNotification';
3
3
  import type { Config, Connector } from '../wagmi/hooks';
4
- export interface CheckoutConfirmationError extends ErrorNotification {
5
- durationMs?: number;
4
+ export type CheckoutConfirmationError = ErrorNotification & {
6
5
  code: ConfirmationErrorCode;
7
- }
6
+ durationMs?: number;
7
+ };
8
8
  export declare enum ConfirmationErrorCode {
9
9
  QUOTE_EXPIRED = "QUOTE_EXPIRED",
10
10
  GENERIC_ERROR = "GENERIC_ERROR",
@@ -2,7 +2,7 @@ import type { FeeBreakdownV2 } from '@funkit/api-base';
2
2
  import { RelayQuoteError } from '@funkit/api-base';
3
3
  import type { RelayExecute, RelayQuote } from '@funkit/fun-relay';
4
4
  import type { TFunction } from 'i18next';
5
- import type { ReactNode } from 'react';
5
+ import type { DisplayedError } from '../components/FunNotification/FunNotification';
6
6
  export type RelayQuoteMetadata = {
7
7
  relayQuote: RelayQuote['metadata']['relayQuote'];
8
8
  feeBreakdown?: FeeBreakdownV2;
@@ -55,6 +55,6 @@ export declare enum RelayUnexpectedErrorCodes {
55
55
  PERMIT_FAILED = "PERMIT_FAILED"
56
56
  }
57
57
  export type RelayErrorCodes = RelayExpectedErrorCodes | RelayUnexpectedErrorCodes;
58
- export declare function getRelayErrorMessages(t: TFunction): Partial<Record<RelayErrorCodes, ReactNode>>;
59
- export declare function getRelayQuoteErrorDisplayMessage(error: RelayQuoteError, t: TFunction, fallback: ReactNode): ReactNode;
58
+ export declare function getRelayErrorMessages(t: TFunction): Partial<Record<RelayErrorCodes, Omit<DisplayedError, 'code'>>>;
59
+ export declare function getRelayQuoteErrorDisplayMessage(error: RelayQuoteError, t: TFunction, fallback: DisplayedError): DisplayedError;
60
60
  export {};
@@ -1,3 +1,4 @@
1
+ import type { ErrorNotification } from '../../components/FunNotification/FunNotification';
1
2
  /**
2
3
  * @returns limits for all fiat currencies
3
4
  */
@@ -159,7 +160,7 @@ export declare const useMeldLimit: (fiatCurrency: string | undefined) => {
159
160
  fetchStatus: import("@tanstack/react-query").FetchStatus;
160
161
  promise: Promise<import("@funkit/api-base").MeldFiatCurrencyLimit[] | undefined>;
161
162
  };
162
- type MeldLimitError = {
163
+ type MeldLimitError = Pick<ErrorNotification, 'code' | 'messageKey'> & {
163
164
  issue: string;
164
165
  suggestion: string;
165
166
  };
@@ -5,6 +5,7 @@ import type { PaymentMethodType } from '../../../hooks/usePaymentSources';
5
5
  import type { FunCheckoutStep } from '../../../modals/CheckoutModal/FunCheckoutStep';
6
6
  import type { AmountSelectionType } from '../../../modals/CheckoutModal/InputAmount/state';
7
7
  import type { WithdrawalModalStep } from '../../../modals/WithdrawalModal/types';
8
+ import type { FunNotificationType } from '../../../components/FunNotification/FunNotification';
8
9
  /**
9
10
  * Analytics v2 — the improved, explicit Statsig event scheme that will replace
10
11
  * the `fc::`/`fw::` enums in `../CheckoutModalEvent.ts` / `../WithdrawModalEvent.ts`.
@@ -26,6 +27,7 @@ export declare enum AnalyticsEvent {
26
27
  DEPOSIT_TRANSFER_INTERACTED = "fc_deposit_transfer_interacted",
27
28
  DEPOSIT_TRANSACTION_BREAKDOWN_CLICKED = "fc_deposit_transaction_breakdown_clicked",
28
29
  DEPOSIT_TRANSACTION_SUBMITTED = "fc_deposit_transaction_submitted",
30
+ ERROR_SHOWN = "fc_error_shown",
29
31
  MODAL_CLOSED = "fc_modal_closed",
30
32
  MODAL_OPENED = "fc_modal_opened",
31
33
  STEP_VIEWED = "fc_step_viewed",
@@ -80,6 +82,11 @@ export type ErrorProperties = {
80
82
  error_code: string | null;
81
83
  error_message: string | null;
82
84
  };
85
+ export type ErrorShownProperties = ErrorProperties & {
86
+ flow: AnalyticsFlow;
87
+ notification_type: FunNotificationType;
88
+ step: AnalyticsStep;
89
+ };
83
90
  /** Payload specific to brokerage account connection lifecycle events. */
84
91
  export type AccountConnectProperties = PaymentMethodProperties;
85
92
  export type AccountConnectFailedProperties = AccountConnectProperties & ErrorProperties;
@@ -349,6 +356,7 @@ export type AnalyticsEventProperties = {
349
356
  [AnalyticsEvent.DEPOSIT_TRANSFER_INTERACTED]: DepositTransferInteractedProperties;
350
357
  [AnalyticsEvent.DEPOSIT_TRANSACTION_BREAKDOWN_CLICKED]: TransactionBreakdownClickedProperties;
351
358
  [AnalyticsEvent.DEPOSIT_TRANSACTION_SUBMITTED]: TransactionSubmittedProperties;
359
+ [AnalyticsEvent.ERROR_SHOWN]: ErrorShownProperties;
352
360
  [AnalyticsEvent.MODAL_CLOSED]: ModalClosedProperties;
353
361
  [AnalyticsEvent.MODAL_OPENED]: ModalOpenedProperties;
354
362
  [AnalyticsEvent.STEP_VIEWED]: StepViewedProperties;
@@ -0,0 +1,12 @@
1
+ import type { ErrorNotification } from '../../../components/FunNotification/FunNotification';
2
+ import type { FunCheckoutStep } from '../../../modals/CheckoutModal/FunCheckoutStep';
3
+ import type { WithdrawalModalStep } from '../../../modals/WithdrawalModal/types';
4
+ import { type AnalyticsFlow } from './events';
5
+ type TrackErrorShownArgs = {
6
+ error: ErrorNotification | null;
7
+ flow: AnalyticsFlow;
8
+ step: FunCheckoutStep | WithdrawalModalStep;
9
+ };
10
+ /** Emits once for each continuous episode in which an error is displayed. */
11
+ export declare function useTrackErrorShown({ error, flow, step }: TrackErrorShownArgs): void;
12
+ export {};
@@ -1,7 +1,7 @@
1
1
  export declare function useCheckoutQuoteNotification(): {
2
2
  quoteNotification: {
3
3
  readonly messageType: "error";
4
- readonly quoteMessage: string | number | bigint | true | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | import("react").ReactPortal | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined>;
4
+ readonly quoteMessage: import("react").ReactNode;
5
5
  } | {
6
6
  readonly messageType: "step";
7
7
  readonly quoteMessage: string;