@funkit/connect 11.6.0 → 11.7.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.
- package/CHANGELOG.md +20 -0
- package/dist/clients/{chunk-UPB4JKJG.js → chunk-44USAVWK.js} +12 -7
- package/dist/clients/{chunk-FNB7OPJI.js → chunk-AXLGZ5XX.js} +10 -1
- package/dist/clients/{chunk-ZQZDPRWC.js → chunk-FGUMPXTO.js} +1 -1
- package/dist/clients/{chunk-DUBZPIDN.js → chunk-I4B5AKZC.js} +1 -1
- package/dist/clients/{chunk-SX3CX34W.js → chunk-NM2NAKI3.js} +106 -88
- package/dist/clients/{chunk-LYZLETOM.js → chunk-OASVWVSV.js} +1 -1
- package/dist/clients/{chunk-WNZ6QV5Q.js → chunk-SG4ZS447.js} +16 -0
- package/dist/clients/fanatics.js +2 -2
- package/dist/clients/internal/nado/withdrawalCallback.js +3 -3
- package/dist/clients/internal/nado/withdrawalErrors.js +2 -2
- package/dist/clients/internal/nado/withdrawalForm.js +3 -3
- package/dist/clients/internal/nado/withdrawalStatus.js +3 -3
- package/dist/clients/lighter.js +4 -4
- package/dist/clients/mallard.js +2 -2
- package/dist/clients/nado.js +3 -3
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +5 -5
- package/dist/clients/polymarket/index.js +5 -5
- package/dist/hooks/track/analytics/checkout.d.ts +10 -0
- package/dist/hooks/track/analytics/events.d.ts +2 -1
- package/dist/hooks/track/analytics/resolveExecutionProgressContext.d.ts +2 -1
- package/dist/hooks/track/analytics/useDepositAnalytics.d.ts +0 -16
- package/dist/hooks/useTextMeasurer.d.ts +1 -1
- package/dist/index.js +3359 -3014
- package/dist/modals/WithdrawalModal/RecipientAddress.d.ts +5 -0
- package/dist/providers/FunkitCheckoutContext/types.d.ts +14 -17
- package/dist/providers/FunkitShadowHostProvider.d.ts +31 -0
- package/dist/providers/FunkitThemeStyle.d.ts +12 -0
- package/dist/shadow/loadShadowCss.d.ts +9 -0
- package/dist/shadow/useMountShadowHost.d.ts +18 -0
- package/dist/shadow/useShadowCss.d.ts +6 -0
- package/dist/shadow-css.js +1 -1
- package/dist/wallets/walletConnectors/index.js +4 -4
- package/package.json +4 -4
|
@@ -12,6 +12,11 @@ export declare function shouldShowUseConnectedWallet({ disableConnectedWallet, i
|
|
|
12
12
|
isConnected: boolean;
|
|
13
13
|
connectedWalletAddress: string | undefined;
|
|
14
14
|
}): boolean;
|
|
15
|
+
export declare function getFittedRecipientAddressFontSize({ availableWidth, textWidthAtMaxFontSize, maxFontSize, }: {
|
|
16
|
+
availableWidth: number;
|
|
17
|
+
textWidthAtMaxFontSize: number;
|
|
18
|
+
maxFontSize: number;
|
|
19
|
+
}): number;
|
|
15
20
|
export declare function WithdrawRecipientAddress({ config, recipientAddress, setRecipientAddress: setRecipientAddressProp, selectedChainId, selectedToken, isValidAddress, isRiskyAddress, onAddressAutofilled, onAddressChanged, }: {
|
|
16
21
|
config: FunkitWithdrawalConfig;
|
|
17
22
|
recipientAddress: string;
|
|
@@ -513,16 +513,6 @@ interface UseFunkitCheckoutBaseProps {
|
|
|
513
513
|
onCheckoutBlocked?: (params: {
|
|
514
514
|
blockedReason: CheckoutBlockedReason;
|
|
515
515
|
}) => void;
|
|
516
|
-
}
|
|
517
|
-
/**
|
|
518
|
-
* Cashier form factor: the withdraw tab is explicitly requested. The coupling
|
|
519
|
-
* is compile-time — `withdrawalConfig` is required, so cashier intent can never
|
|
520
|
-
* be confused with a dropped config, and withdrawal callbacks are permitted
|
|
521
|
-
* only here.
|
|
522
|
-
*/
|
|
523
|
-
interface CashierFormFactorProps {
|
|
524
|
-
formFactor: 'cashier';
|
|
525
|
-
withdrawalConfig: FunkitWithdrawalConfig;
|
|
526
516
|
/**
|
|
527
517
|
* @optional fires once the withdrawal has been submitted — after the wallet
|
|
528
518
|
* transaction is sent or the custom withdrawCallback resolves. `formData`
|
|
@@ -530,24 +520,33 @@ interface CashierFormFactorProps {
|
|
|
530
520
|
* ({@link WithdrawalFormData}) so integrators can track cross-chain
|
|
531
521
|
* withdrawals (e.g. security flows). The first argument is kept for
|
|
532
522
|
* backwards compatibility: the destination address on wallet flows, the
|
|
533
|
-
* quoteId on custom-callback flows.
|
|
523
|
+
* quoteId on custom-callback flows. Fires for both `beginWithdrawal` and the
|
|
524
|
+
* cashier withdraw tab.
|
|
534
525
|
*/
|
|
535
526
|
onWithdrawalConfirmation?: (withdrawalId: string, formData: WithdrawalFormData) => void;
|
|
536
527
|
/** @optional fires if the withdrawal fails at any point **/
|
|
537
528
|
onWithdrawalError?: (result: FunkitCheckoutResult) => void;
|
|
538
529
|
}
|
|
539
|
-
/**
|
|
530
|
+
/**
|
|
531
|
+
* Cashier form factor: the withdraw tab is explicitly requested. The coupling
|
|
532
|
+
* is compile-time — `withdrawalConfig` is required, so cashier intent can never
|
|
533
|
+
* be confused with a dropped config. `beginWithdrawal` takes its config as an
|
|
534
|
+
* argument and needs neither.
|
|
535
|
+
*/
|
|
536
|
+
interface CashierFormFactorProps {
|
|
537
|
+
formFactor: 'cashier';
|
|
538
|
+
withdrawalConfig: FunkitWithdrawalConfig;
|
|
539
|
+
}
|
|
540
|
+
/** Default checkout form factor: no withdraw tab, so no tab config. */
|
|
540
541
|
interface CheckoutFormFactorProps {
|
|
541
542
|
formFactor?: 'checkout';
|
|
542
543
|
withdrawalConfig?: never;
|
|
543
|
-
onWithdrawalConfirmation?: never;
|
|
544
|
-
onWithdrawalError?: never;
|
|
545
544
|
}
|
|
546
545
|
export type UseFunkitCheckoutProps = UseFunkitCheckoutBaseProps & (CashierFormFactorProps | CheckoutFormFactorProps);
|
|
547
546
|
/**
|
|
548
547
|
* Resolved settings stored on the checkout item (config guaranteed). This is a
|
|
549
548
|
* structural superset of both public-prop union members — the `never`-typed
|
|
550
|
-
*
|
|
549
|
+
* `withdrawalConfig` is relaxed — so internal rebuilds of `initSettings` don't
|
|
551
550
|
* fight the discriminant. The compile-time cashier↔withdrawalConfig coupling
|
|
552
551
|
* lives on the public `UseFunkitCheckoutProps` surface, which flows in here.
|
|
553
552
|
*/
|
|
@@ -555,8 +554,6 @@ export interface UseFunkitCheckoutPropsWithFullConfig extends UseFunkitCheckoutB
|
|
|
555
554
|
config: FunkitCheckoutConfig;
|
|
556
555
|
formFactor?: 'cashier' | 'checkout';
|
|
557
556
|
withdrawalConfig?: FunkitWithdrawalConfig;
|
|
558
|
-
onWithdrawalConfirmation?: (withdrawalId: string, formData: WithdrawalFormData) => void;
|
|
559
|
-
onWithdrawalError?: (result: FunkitCheckoutResult) => void;
|
|
560
557
|
}
|
|
561
558
|
/**
|
|
562
559
|
* Checkout Item for frontend use
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve the container to render portalled UI into: the shadow container when
|
|
4
|
+
* shadow mode is on, `document.body` otherwise, null during SSR (caller must
|
|
5
|
+
* guard). Anything new that portals resolves its container here rather than
|
|
6
|
+
* hardcoding `document.body`, or it escapes the boundary in shadow mode.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useShadowContainer(): HTMLElement | null;
|
|
9
|
+
/**
|
|
10
|
+
* Resolve the DOM root for id lookups of nodes that live inside the portal
|
|
11
|
+
* (modal bottom bars, dropdown scroll targets): the shadow root when shadow
|
|
12
|
+
* mode is on, `document` otherwise. `document.getElementById` cannot see into
|
|
13
|
+
* a shadow root, so portal-internal lookups must go through this.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useRootNode(): Document | ShadowRoot;
|
|
16
|
+
interface FunkitShadowHostProviderProps {
|
|
17
|
+
themeId: string;
|
|
18
|
+
selector: string;
|
|
19
|
+
useStyleRefForTheme: boolean;
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Overlay-only shadow mode, activated entirely by the `enable-shadow-dom`
|
|
24
|
+
* Statsig gate — integrators opt in to nothing. When the gate is on, a
|
|
25
|
+
* body-level open shadow root is mounted and portalled UI (modals, dropdowns)
|
|
26
|
+
* targets it via the container context, isolating the overlay from host-page
|
|
27
|
+
* CSS. Inline content and the host app are untouched. Gate off, or the
|
|
28
|
+
* stylesheet failing to load, means light DOM exactly as before.
|
|
29
|
+
*/
|
|
30
|
+
export declare function FunkitShadowHostProvider({ themeId, selector, useStyleRefForTheme, children, }: FunkitShadowHostProviderProps): React.JSX.Element;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface FunkitThemeStyleProps {
|
|
3
|
+
selector: string;
|
|
4
|
+
useStyleRefForTheme: boolean;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The `<style>` tag carrying the theme's CSS custom properties. A standalone
|
|
8
|
+
* component so shadow mode can render a second copy inside the overlay shadow
|
|
9
|
+
* root — CSS vars declared in the document don't cross the shadow boundary.
|
|
10
|
+
*/
|
|
11
|
+
export declare function FunkitThemeStyle({ selector, useStyleRefForTheme, }: FunkitThemeStyleProps): React.JSX.Element | null;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch the compiled shadow stylesheet at runtime. `dist/shadow-css.js` is a
|
|
3
|
+
* build artifact of this same build, so it can't be imported statically —
|
|
4
|
+
* and a static import would ship the ~800KB CSS string to every integrator.
|
|
5
|
+
* The dynamic specifier survives esbuild (bare imports are externalized) and
|
|
6
|
+
* resolves through node_modules from inside the published package, so the
|
|
7
|
+
* chunk is only fetched when shadow mode actually turns on.
|
|
8
|
+
*/
|
|
9
|
+
export declare function loadShadowCss(): Promise<string | null>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const SHADOW_HOST_ATTR = "data-funkit-shadow-host";
|
|
2
|
+
export declare const SHADOW_CONTAINER_ATTR = "data-funkit-container";
|
|
3
|
+
interface ShadowHost {
|
|
4
|
+
host: HTMLElement;
|
|
5
|
+
container: HTMLElement;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Build the body-level shadow host and the container inside it that all
|
|
9
|
+
* portalled UI renders into. Returns the host for cleanup and the container
|
|
10
|
+
* for the portals.
|
|
11
|
+
*/
|
|
12
|
+
export declare function mountShadowHost(shadowCss: string, themeId: string): ShadowHost;
|
|
13
|
+
/**
|
|
14
|
+
* Keep a shadow host mounted while a stylesheet is available. Returns the
|
|
15
|
+
* container for portalled UI, or null while there is nothing to mount into.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useMountShadowHost(shadowCss: string | null, themeId: string): HTMLElement | null;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The compiled shadow stylesheet, loaded once when shadow mode is enabled.
|
|
3
|
+
* Null while loading, when disabled, or when the load failed — the caller
|
|
4
|
+
* stays in light DOM for all three.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useShadowCss(enabled: boolean): string | null;
|