@b3dotfun/sdk 0.1.69-alpha.21 → 0.1.69-alpha.23

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 (57) hide show
  1. package/dist/cjs/anyspend/react/components/AnySpend.d.ts +2 -0
  2. package/dist/cjs/anyspend/react/components/AnySpend.js +12 -4
  3. package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
  4. package/dist/cjs/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
  5. package/dist/cjs/anyspend/react/components/AnySpendCustom.d.ts +2 -0
  6. package/dist/cjs/anyspend/react/components/AnySpendCustom.js +7 -3
  7. package/dist/cjs/anyspend/react/components/AnySpendDeposit.d.ts +3 -1
  8. package/dist/cjs/anyspend/react/components/AnySpendDeposit.js +3 -3
  9. package/dist/cjs/anyspend/react/components/AnySpendNFT.d.ts +3 -1
  10. package/dist/cjs/anyspend/react/components/AnySpendNFT.js +2 -2
  11. package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.d.ts +3 -1
  12. package/dist/cjs/anyspend/react/components/AnySpendStakeUpside.js +2 -2
  13. package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthResetPassword.js +3 -2
  14. package/dist/cjs/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +13 -3
  15. package/dist/cjs/global-account/react/components/SignInWithB3/components/PasswordInput.d.ts +10 -0
  16. package/dist/cjs/global-account/react/components/SignInWithB3/components/PasswordInput.js +10 -0
  17. package/dist/cjs/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +6 -3
  18. package/dist/cjs/global-account/react/stores/useModalStore.d.ts +2 -0
  19. package/dist/esm/anyspend/react/components/AnySpend.d.ts +2 -0
  20. package/dist/esm/anyspend/react/components/AnySpend.js +12 -4
  21. package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
  22. package/dist/esm/anyspend/react/components/AnySpendCollectorClubPurchase.js +2 -2
  23. package/dist/esm/anyspend/react/components/AnySpendCustom.d.ts +2 -0
  24. package/dist/esm/anyspend/react/components/AnySpendCustom.js +7 -3
  25. package/dist/esm/anyspend/react/components/AnySpendDeposit.d.ts +3 -1
  26. package/dist/esm/anyspend/react/components/AnySpendDeposit.js +3 -3
  27. package/dist/esm/anyspend/react/components/AnySpendNFT.d.ts +3 -1
  28. package/dist/esm/anyspend/react/components/AnySpendNFT.js +2 -2
  29. package/dist/esm/anyspend/react/components/AnySpendStakeUpside.d.ts +3 -1
  30. package/dist/esm/anyspend/react/components/AnySpendStakeUpside.js +2 -2
  31. package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthResetPassword.js +4 -3
  32. package/dist/esm/global-account/react/components/SignInWithB3/BetterAuthSignIn.js +14 -4
  33. package/dist/esm/global-account/react/components/SignInWithB3/components/PasswordInput.d.ts +10 -0
  34. package/dist/esm/global-account/react/components/SignInWithB3/components/PasswordInput.js +7 -0
  35. package/dist/esm/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.js +6 -3
  36. package/dist/esm/global-account/react/stores/useModalStore.d.ts +2 -0
  37. package/dist/styles/index.css +1 -1
  38. package/dist/types/anyspend/react/components/AnySpend.d.ts +2 -0
  39. package/dist/types/anyspend/react/components/AnySpendCollectorClubPurchase.d.ts +5 -1
  40. package/dist/types/anyspend/react/components/AnySpendCustom.d.ts +2 -0
  41. package/dist/types/anyspend/react/components/AnySpendDeposit.d.ts +3 -1
  42. package/dist/types/anyspend/react/components/AnySpendNFT.d.ts +3 -1
  43. package/dist/types/anyspend/react/components/AnySpendStakeUpside.d.ts +3 -1
  44. package/dist/types/global-account/react/components/SignInWithB3/components/PasswordInput.d.ts +10 -0
  45. package/dist/types/global-account/react/stores/useModalStore.d.ts +2 -0
  46. package/package.json +1 -1
  47. package/src/anyspend/react/components/AnySpend.tsx +24 -12
  48. package/src/anyspend/react/components/AnySpendCollectorClubPurchase.tsx +6 -0
  49. package/src/anyspend/react/components/AnySpendCustom.tsx +12 -2
  50. package/src/anyspend/react/components/AnySpendDeposit.tsx +38 -31
  51. package/src/anyspend/react/components/AnySpendNFT.tsx +4 -0
  52. package/src/anyspend/react/components/AnySpendStakeUpside.tsx +4 -0
  53. package/src/global-account/react/components/SignInWithB3/BetterAuthResetPassword.tsx +6 -7
  54. package/src/global-account/react/components/SignInWithB3/BetterAuthSignIn.tsx +20 -6
  55. package/src/global-account/react/components/SignInWithB3/components/PasswordInput.tsx +62 -0
  56. package/src/global-account/react/components/SignInWithB3/steps/LoginStepBetterAuth.tsx +9 -4
  57. package/src/global-account/react/stores/useModalStore.ts +2 -0
@@ -1,6 +1,6 @@
1
1
  import { components } from "@b3dotfun/sdk/anyspend/types/api";
2
2
  import type { AnySpendContent, AnySpendSlots, AnySpendTheme } from "./types/customization";
3
- export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab, senderAddress, slots, content, theme, }: {
3
+ export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddress, stakeAmount, stakingContractAddress, token, onSuccess, activeTab, senderAddress, slots, content, theme, showFiatOption, }: {
4
4
  loadOrder?: string;
5
5
  mode?: "modal" | "page";
6
6
  beneficiaryAddress: string;
@@ -14,4 +14,6 @@ export declare function AnySpendStakeUpside({ loadOrder, mode, beneficiaryAddres
14
14
  slots?: AnySpendSlots;
15
15
  content?: AnySpendContent;
16
16
  theme?: AnySpendTheme;
17
+ /** Whether to show the "Pay with fiat" tab. Defaults to true. */
18
+ showFiatOption?: boolean;
17
19
  }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,10 @@
1
+ interface PasswordInputProps {
2
+ value: string;
3
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
4
+ disabled?: boolean;
5
+ placeholder?: string;
6
+ onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
7
+ className?: string;
8
+ }
9
+ export declare function PasswordInput({ value, onChange, disabled, placeholder, onKeyDown, className, }: PasswordInputProps): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -609,6 +609,8 @@ export interface AnySpendDepositModalProps extends BaseModalProps {
609
609
  actionLabel?: string;
610
610
  /** Whether to show chain selection step. Defaults to true if sourceTokenChainId is not provided */
611
611
  showChainSelection?: boolean;
612
+ /** Whether to show the "Fund with Fiat" option in the deposit options list. Defaults to true */
613
+ showFiatOption?: boolean;
612
614
  /** Minimum pool size for filtering tokens (default: 1,000,000) */
613
615
  minPoolSize?: number;
614
616
  /** Custom title for chain selection step */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b3dotfun/sdk",
3
- "version": "0.1.69-alpha.21",
3
+ "version": "0.1.69-alpha.23",
4
4
  "source": "src/index.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "react-native": "./dist/cjs/index.native.js",
@@ -148,6 +148,8 @@ export function AnySpend(props: {
148
148
  theme?: AnySpendTheme;
149
149
  /** When true, shows a KYC gate before Stripe Web2 (credit card) payments. Default false. */
150
150
  kycEnabled?: boolean;
151
+ /** Whether to show the "Pay with Fiat" tab. Defaults to true. When false, the fiat tab is hidden and activeTab is forced to "crypto". */
152
+ showFiatOption?: boolean;
151
153
  }) {
152
154
  const fingerprintConfig = getFingerprintConfig();
153
155
 
@@ -184,6 +186,7 @@ function AnySpendInner({
184
186
  callbackMetadata,
185
187
  senderAddress,
186
188
  kycEnabled = false,
189
+ showFiatOption = true,
187
190
  }: {
188
191
  sourceChainId?: number;
189
192
  destinationTokenAddress?: string;
@@ -211,6 +214,7 @@ function AnySpendInner({
211
214
  content?: AnySpendContent;
212
215
  theme?: AnySpendTheme;
213
216
  kycEnabled?: boolean;
217
+ showFiatOption?: boolean;
214
218
  }) {
215
219
  const { slots, content } = useAnySpendCustomization();
216
220
  const searchParams = useSearchParamsSSR();
@@ -253,6 +257,7 @@ function AnySpendInner({
253
257
  const previousPanel = useRef<PanelView>(PanelView.MAIN);
254
258
 
255
259
  const [activeTab, setActiveTab] = useState<"crypto" | "fiat">(() => {
260
+ if (!showFiatOption) return "crypto";
256
261
  if (typeof window !== "undefined") {
257
262
  const stored = sessionStorage.getItem("anyspend_active_tab") as "crypto" | "fiat" | null;
258
263
  if (stored === "crypto" || stored === "fiat") return stored;
@@ -261,8 +266,13 @@ function AnySpendInner({
261
266
  });
262
267
 
263
268
  useEffect(() => {
269
+ if (!showFiatOption && activeTab === "fiat") setActiveTab("crypto");
270
+ }, [showFiatOption, activeTab]);
271
+
272
+ useEffect(() => {
273
+ if (!showFiatOption) return;
264
274
  sessionStorage.setItem("anyspend_active_tab", activeTab);
265
- }, [activeTab]);
275
+ }, [activeTab, showFiatOption]);
266
276
 
267
277
  const [orderId, setOrderId] = useState<string | undefined>(loadOrder);
268
278
  const [directTransferTxHash, setDirectTransferTxHash] = useState<string | undefined>();
@@ -1312,17 +1322,19 @@ function AnySpendInner({
1312
1322
  )}
1313
1323
 
1314
1324
  {/* Tab section */}
1315
- <TabSection
1316
- activeTab={activeTab}
1317
- setActiveTab={tab => {
1318
- setActiveTab(tab);
1319
- // Reset payment methods when switching tabs
1320
- resetPaymentMethods();
1321
- setSelectedFiatPaymentMethod(FiatPaymentMethod.NONE);
1322
- }}
1323
- setSelectedCryptoPaymentMethod={setSelectedCryptoPaymentMethod}
1324
- setSelectedFiatPaymentMethod={setSelectedFiatPaymentMethod}
1325
- />
1325
+ {showFiatOption && (
1326
+ <TabSection
1327
+ activeTab={activeTab}
1328
+ setActiveTab={tab => {
1329
+ setActiveTab(tab);
1330
+ // Reset payment methods when switching tabs
1331
+ resetPaymentMethods();
1332
+ setSelectedFiatPaymentMethod(FiatPaymentMethod.NONE);
1333
+ }}
1334
+ setSelectedCryptoPaymentMethod={setSelectedCryptoPaymentMethod}
1335
+ setSelectedFiatPaymentMethod={setSelectedFiatPaymentMethod}
1336
+ />
1337
+ )}
1326
1338
 
1327
1339
  <div className="relative flex w-full max-w-[calc(100vw-32px)] flex-col gap-2">
1328
1340
  {/* Send section */}
@@ -119,6 +119,10 @@ export interface AnySpendCollectorClubPurchaseProps {
119
119
  * Force fiat payment
120
120
  */
121
121
  forceFiatPayment?: boolean;
122
+ /**
123
+ * Whether to show the "Pay with fiat" tab. Defaults to true.
124
+ */
125
+ showFiatOption?: boolean;
122
126
  /**
123
127
  * Optional discount code to apply to the purchase.
124
128
  * When provided, validates on-chain and adjusts the price accordingly.
@@ -146,6 +150,7 @@ export function AnySpendCollectorClubPurchase({
146
150
  vendingMachineId,
147
151
  packType,
148
152
  forceFiatPayment,
153
+ showFiatOption = true,
149
154
  discountCode,
150
155
  slots,
151
156
  content,
@@ -398,6 +403,7 @@ export function AnySpendCollectorClubPurchase({
398
403
  showRecipient={showRecipient}
399
404
  srcFiatAmount={srcFiatAmount}
400
405
  forceFiatPayment={forceFiatPayment}
406
+ showFiatOption={showFiatOption}
401
407
  slots={slots}
402
408
  content={content}
403
409
  theme={theme}
@@ -178,6 +178,8 @@ export function AnySpendCustom(props: {
178
178
  dstToken: components["schemas"]["Token"];
179
179
  dstAmount: string;
180
180
  forceFiatPayment?: boolean;
181
+ /** Whether to show the "Pay with fiat" tab. Defaults to true. When false, the fiat tab is hidden and activeTab is forced to "crypto". */
182
+ showFiatOption?: boolean;
181
183
  contractAddress: string;
182
184
  encodedData: string;
183
185
  metadata: any;
@@ -232,6 +234,7 @@ function AnySpendCustomInner({
232
234
  onShowPointsDetail,
233
235
  srcFiatAmount: srcFiatAmountProps,
234
236
  forceFiatPayment,
237
+ showFiatOption = true,
235
238
  senderAddress,
236
239
  }: {
237
240
  loadOrder?: string;
@@ -258,6 +261,7 @@ function AnySpendCustomInner({
258
261
  onShowPointsDetail?: () => void;
259
262
  srcFiatAmount?: string;
260
263
  forceFiatPayment?: boolean;
264
+ showFiatOption?: boolean;
261
265
  senderAddress?: string;
262
266
  slots?: AnySpendSlots;
263
267
  content?: AnySpendContent;
@@ -271,7 +275,13 @@ function AnySpendCustomInner({
271
275
  const [activePanel, setActivePanel] = useState<PanelView>(
272
276
  loadOrder ? PanelView.ORDER_DETAILS : PanelView.CONFIRM_ORDER,
273
277
  );
274
- const [activeTab, setActiveTab] = useState<"crypto" | "fiat">(forceFiatPayment ? "fiat" : activeTabProps);
278
+ const [activeTab, setActiveTab] = useState<"crypto" | "fiat">(
279
+ !showFiatOption ? "crypto" : forceFiatPayment ? "fiat" : activeTabProps,
280
+ );
281
+
282
+ useEffect(() => {
283
+ if (!showFiatOption && activeTab === "fiat") setActiveTab("crypto");
284
+ }, [showFiatOption, activeTab]);
275
285
 
276
286
  // Payment method state with dual-state system (auto + explicit user selection)
277
287
  // Note: AnySpendCustom doesn't use auto-selection, only explicit user selection
@@ -867,7 +877,7 @@ function AnySpendCustomInner({
867
877
  onValueChange={value => setActiveTab(value as "crypto" | "fiat")}
868
878
  className="bg-b3-react-background max-h-[60dvh] w-full overflow-y-auto p-5"
869
879
  >
870
- {!forceFiatPayment && (
880
+ {!forceFiatPayment && showFiatOption && (
871
881
  <div className="w-full">
872
882
  <div className="bg-as-surface-secondary relative mb-4 grid h-10 grid-cols-2 rounded-xl">
873
883
  <div
@@ -95,6 +95,8 @@ export interface AnySpendDepositProps {
95
95
  depositContractConfig?: DepositContractConfig;
96
96
  /** Whether to show chain selection step. Defaults to true if sourceTokenChainId is not provided */
97
97
  showChainSelection?: boolean;
98
+ /** Whether to show the "Fund with Fiat" option in the deposit options list. Defaults to true */
99
+ showFiatOption?: boolean;
98
100
  /** Custom list of supported chains. If not provided, uses default chains */
99
101
  supportedChains?: ChainConfig[];
100
102
  /** Minimum pool size for filtering tokens (default: 1,000,000) */
@@ -248,6 +250,7 @@ export function AnySpendDeposit({
248
250
  orderType,
249
251
  depositContractConfig,
250
252
  showChainSelection,
253
+ showFiatOption = true,
251
254
  supportedChains = DEFAULT_SUPPORTED_CHAINS,
252
255
  minPoolSize = DEFAULT_MIN_POOL_SIZE,
253
256
  topChainsCount = 3,
@@ -585,39 +588,43 @@ export function AnySpendDeposit({
585
588
  </button>
586
589
 
587
590
  {/* Fund with Fiat */}
588
- <button
589
- onClick={handleSelectFiat}
590
- className={
591
- depositClasses?.fiatButton ||
592
- "anyspend-deposit-option-button anyspend-deposit-fiat-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left transition-all"
593
- }
594
- >
595
- <div
596
- className={depositClasses?.optionContent || "anyspend-deposit-option-content flex items-center gap-3"}
591
+ {showFiatOption && (
592
+ <button
593
+ onClick={handleSelectFiat}
594
+ className={
595
+ depositClasses?.fiatButton ||
596
+ "anyspend-deposit-option-button anyspend-deposit-fiat-button border-border-primary hover:border-as-brand hover:bg-as-surface-secondary flex w-full items-center justify-between rounded-xl border p-4 text-left transition-all"
597
+ }
597
598
  >
598
- <CreditCardIcon className={depositClasses?.optionIcon || "anyspend-deposit-option-icon h-10 w-10"} />
599
- <div className={depositClasses?.optionInfo || "anyspend-deposit-option-info"}>
600
- <span
601
- className={
602
- depositClasses?.optionTitle || "anyspend-deposit-option-title text-as-primary font-medium"
603
- }
604
- >
605
- Fund with Fiat
606
- </span>
607
- <p
608
- className={
609
- depositClasses?.optionDescription ||
610
- "anyspend-deposit-option-description text-as-secondary text-xs"
611
- }
612
- >
613
- Pay with card or bank transfer
614
- </p>
599
+ <div
600
+ className={depositClasses?.optionContent || "anyspend-deposit-option-content flex items-center gap-3"}
601
+ >
602
+ <CreditCardIcon className={depositClasses?.optionIcon || "anyspend-deposit-option-icon h-10 w-10"} />
603
+ <div className={depositClasses?.optionInfo || "anyspend-deposit-option-info"}>
604
+ <span
605
+ className={
606
+ depositClasses?.optionTitle || "anyspend-deposit-option-title text-as-primary font-medium"
607
+ }
608
+ >
609
+ Fund with Fiat
610
+ </span>
611
+ <p
612
+ className={
613
+ depositClasses?.optionDescription ||
614
+ "anyspend-deposit-option-description text-as-secondary text-xs"
615
+ }
616
+ >
617
+ Pay with card or bank transfer
618
+ </p>
619
+ </div>
615
620
  </div>
616
- </div>
617
- <ChevronRight
618
- className={depositClasses?.optionChevron || "anyspend-deposit-option-chevron text-as-secondary h-5 w-5"}
619
- />
620
- </button>
621
+ <ChevronRight
622
+ className={
623
+ depositClasses?.optionChevron || "anyspend-deposit-option-chevron text-as-secondary h-5 w-5"
624
+ }
625
+ />
626
+ </button>
627
+ )}
621
628
  </div>
622
629
 
623
630
  {/* Chain-specific warning */}
@@ -42,6 +42,7 @@ export function AnySpendNFT({
42
42
  slots,
43
43
  content,
44
44
  theme,
45
+ showFiatOption = true,
45
46
  }: {
46
47
  loadOrder?: string;
47
48
  mode?: "modal" | "page";
@@ -54,6 +55,8 @@ export function AnySpendNFT({
54
55
  slots?: AnySpendSlots;
55
56
  content?: AnySpendContent;
56
57
  theme?: AnySpendTheme;
58
+ /** Whether to show the "Pay with fiat" tab. Defaults to true. */
59
+ showFiatOption?: boolean;
57
60
  }) {
58
61
  const [imageUrlWithFallback, setFallbackImageUrl] = useState<string | null>(nftContract.imageUrl);
59
62
  const hasFetchedRef = useRef(false);
@@ -164,6 +167,7 @@ export function AnySpendNFT({
164
167
  loadOrder={loadOrder}
165
168
  mode={mode}
166
169
  activeTab="fiat"
170
+ showFiatOption={showFiatOption}
167
171
  recipientAddress={recipientAddress}
168
172
  orderType={"mint_nft"}
169
173
  dstChainId={nftContract.chainId}
@@ -30,6 +30,7 @@ export function AnySpendStakeUpside({
30
30
  slots,
31
31
  content,
32
32
  theme,
33
+ showFiatOption = true,
33
34
  }: {
34
35
  loadOrder?: string;
35
36
  mode?: "modal" | "page";
@@ -44,6 +45,8 @@ export function AnySpendStakeUpside({
44
45
  slots?: AnySpendSlots;
45
46
  content?: AnySpendContent;
46
47
  theme?: AnySpendTheme;
48
+ /** Whether to show the "Pay with fiat" tab. Defaults to true. */
49
+ showFiatOption?: boolean;
47
50
  }) {
48
51
  const header = () => (
49
52
  <>
@@ -90,6 +93,7 @@ export function AnySpendStakeUpside({
90
93
  onSuccess={onSuccess}
91
94
  showRecipient={true}
92
95
  activeTab={activeTab}
96
+ showFiatOption={showFiatOption}
93
97
  senderAddress={senderAddress}
94
98
  slots={slots}
95
99
  content={content}
@@ -1,7 +1,8 @@
1
- import { Button, Input } from "@b3dotfun/sdk/global-account/react";
1
+ import { Button } from "@b3dotfun/sdk/global-account/react";
2
2
  import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
3
3
  import { useState } from "react";
4
4
  import { useBetterAuth } from "../../hooks/useBetterAuth";
5
+ import { PasswordInput } from "./components/PasswordInput";
5
6
 
6
7
  const debug = debugB3React("BetterAuthResetPassword");
7
8
 
@@ -103,13 +104,12 @@ export function BetterAuthResetPassword({ token, onSuccess, onError, className }
103
104
  <label className="mb-2 block text-xs font-medium uppercase tracking-wide text-gray-700 dark:text-gray-300">
104
105
  New password
105
106
  </label>
106
- <Input
107
- type="password"
107
+ <PasswordInput
108
108
  placeholder="At least 8 characters"
109
109
  value={password}
110
110
  onChange={e => setPassword(e.target.value)}
111
111
  disabled={isLoading}
112
- className="h-11 px-4 text-[15px]"
112
+ className="h-11 px-4 pr-11 text-[15px]"
113
113
  />
114
114
  </div>
115
115
 
@@ -117,8 +117,7 @@ export function BetterAuthResetPassword({ token, onSuccess, onError, className }
117
117
  <label className="mb-2 block text-xs font-medium uppercase tracking-wide text-gray-700 dark:text-gray-300">
118
118
  Confirm password
119
119
  </label>
120
- <Input
121
- type="password"
120
+ <PasswordInput
122
121
  placeholder="Repeat your password"
123
122
  value={confirmPassword}
124
123
  onChange={e => setConfirmPassword(e.target.value)}
@@ -126,7 +125,7 @@ export function BetterAuthResetPassword({ token, onSuccess, onError, className }
126
125
  onKeyDown={e => {
127
126
  if (e.key === "Enter") handleSubmit();
128
127
  }}
129
- className="h-11 px-4 text-[15px]"
128
+ className="h-11 px-4 pr-11 text-[15px]"
130
129
  />
131
130
  </div>
132
131
 
@@ -1,4 +1,4 @@
1
- import { Button, Input, useAuthStore } from "@b3dotfun/sdk/global-account/react";
1
+ import { Button, Input, Loading, useAuthStore } from "@b3dotfun/sdk/global-account/react";
2
2
  import { debugB3React } from "@b3dotfun/sdk/shared/utils/debug";
3
3
  import { useState } from "react";
4
4
  import {
@@ -6,6 +6,7 @@ import {
6
6
  type BetterAuthSocialProvider,
7
7
  useBetterAuth,
8
8
  } from "../../hooks/useBetterAuth";
9
+ import { PasswordInput } from "./components/PasswordInput";
9
10
  import { strategyIcons, strategyLabels } from "./utils/signInUtils";
10
11
 
11
12
  const debug = debugB3React("BetterAuthSignIn");
@@ -66,6 +67,8 @@ export function BetterAuthSignIn({
66
67
  }: BetterAuthSignInProps) {
67
68
  const { signInWithEmail, signUpWithEmail, signInWithSocial, requestPasswordReset } = useBetterAuth();
68
69
  const isAuthenticated = useAuthStore(state => state.isAuthenticated);
70
+ const isAuthenticating = useAuthStore(state => state.isAuthenticating);
71
+ const hasStartedConnecting = useAuthStore(state => state.hasStartedConnecting);
69
72
 
70
73
  const [mode, setMode] = useState<"sign-in" | "sign-up" | "forgot-password">("sign-in");
71
74
  const [email, setEmail] = useState("");
@@ -83,7 +86,9 @@ export function BetterAuthSignIn({
83
86
 
84
87
  const resolvedSubtitle =
85
88
  mode === "forgot-password"
86
- ? "Enter your email and we'll send you a reset link"
89
+ ? resetEmailSent
90
+ ? "We've sent a password reset link to your email"
91
+ : "Enter your email and we'll send you a reset link"
87
92
  : subtitle || "Enter your credentials to access your account";
88
93
 
89
94
  const handleForgotPassword = async () => {
@@ -111,6 +116,16 @@ export function BetterAuthSignIn({
111
116
  .map(id => DEFAULT_SOCIAL_PROVIDERS.find(p => p.id === id))
112
117
  .filter((p): p is SocialProviderConfig => !!p);
113
118
 
119
+ // Show loading during session restore (before any user interaction) to prevent
120
+ // the login form from flashing briefly after OAuth redirect.
121
+ if (isAuthenticating && !hasStartedConnecting) {
122
+ return (
123
+ <div className={`flex w-full max-w-[400px] items-center justify-center px-6 py-20 ${className || ""}`}>
124
+ <Loading variant="primary" size="lg" />
125
+ </div>
126
+ );
127
+ }
128
+
114
129
  if (isAuthenticated) {
115
130
  return null;
116
131
  }
@@ -334,16 +349,15 @@ export function BetterAuthSignIn({
334
349
  </button>
335
350
  )}
336
351
  </div>
337
- <Input
338
- type="password"
339
- placeholder="Password"
352
+ <PasswordInput
353
+ key={mode}
340
354
  value={password}
341
355
  onChange={e => setPassword(e.target.value)}
342
356
  disabled={isLoading}
343
357
  onKeyDown={e => {
344
358
  if (e.key === "Enter") handleEmailSubmit();
345
359
  }}
346
- className="h-11 px-4 text-[15px]"
360
+ className="h-11 px-4 pr-11 text-[15px]"
347
361
  />
348
362
  </div>
349
363
 
@@ -0,0 +1,62 @@
1
+ import { Input } from "@b3dotfun/sdk/global-account/react";
2
+ import { useState } from "react";
3
+
4
+ interface PasswordInputProps {
5
+ value: string;
6
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
7
+ disabled?: boolean;
8
+ placeholder?: string;
9
+ onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
10
+ className?: string;
11
+ }
12
+
13
+ export function PasswordInput({
14
+ value,
15
+ onChange,
16
+ disabled,
17
+ placeholder = "Password",
18
+ onKeyDown,
19
+ className,
20
+ }: PasswordInputProps) {
21
+ const [showPassword, setShowPassword] = useState(false);
22
+
23
+ return (
24
+ <div className="relative">
25
+ <Input
26
+ type={showPassword ? "text" : "password"}
27
+ placeholder={placeholder}
28
+ value={value}
29
+ onChange={onChange}
30
+ disabled={disabled}
31
+ onKeyDown={onKeyDown}
32
+ className={className}
33
+ />
34
+ <button
35
+ type="button"
36
+ onClick={() => setShowPassword(!showPassword)}
37
+ aria-label={showPassword ? "Hide password" : "Show password"}
38
+ className="absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300"
39
+ tabIndex={-1}
40
+ >
41
+ {showPassword ? (
42
+ <svg className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={1.5}>
43
+ <path
44
+ strokeLinecap="round"
45
+ strokeLinejoin="round"
46
+ d="M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"
47
+ />
48
+ </svg>
49
+ ) : (
50
+ <svg className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={1.5}>
51
+ <path
52
+ strokeLinecap="round"
53
+ strokeLinejoin="round"
54
+ d="M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"
55
+ />
56
+ <path strokeLinecap="round" strokeLinejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
57
+ </svg>
58
+ )}
59
+ </button>
60
+ </div>
61
+ );
62
+ }
@@ -7,6 +7,7 @@ import {
7
7
  useBetterAuth,
8
8
  } from "../../../hooks/useBetterAuth";
9
9
  import { AuthButton } from "../components/AuthButton";
10
+ import { PasswordInput } from "../components/PasswordInput";
10
11
 
11
12
  const debug = debugB3React("LoginStepBetterAuth");
12
13
  const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
@@ -160,7 +161,11 @@ export function LoginStepBetterAuth({ onSuccess, onError }: LoginStepBetterAuthP
160
161
  {mode === "forgot-password" ? (
161
162
  <div className="mb-6 w-full space-y-3 px-3">
162
163
  <p className="text-center text-sm font-medium text-gray-900 dark:text-gray-100">Reset password</p>
163
- <p className="text-center text-xs text-gray-500">Enter your email and we'll send you a reset link</p>
164
+ <p className="text-center text-xs text-gray-500">
165
+ {resetEmailSent
166
+ ? "We've sent a password reset link to your email"
167
+ : "Enter your email and we'll send you a reset link"}
168
+ </p>
164
169
 
165
170
  {resetEmailSent ? (
166
171
  <div className="space-y-3 py-4 text-center">
@@ -223,15 +228,15 @@ export function LoginStepBetterAuth({ onSuccess, onError }: LoginStepBetterAuthP
223
228
  disabled={isLoading}
224
229
  />
225
230
 
226
- <Input
227
- type="password"
228
- placeholder="Password"
231
+ <PasswordInput
232
+ key={mode}
229
233
  value={password}
230
234
  onChange={event => setPassword(event.target.value)}
231
235
  disabled={isLoading}
232
236
  onKeyDown={event => {
233
237
  if (event.key === "Enter") handleEmailSubmit();
234
238
  }}
239
+ className="pr-11"
235
240
  />
236
241
 
237
242
  {error && <p className="text-sm text-red-500">{error}</p>}
@@ -635,6 +635,8 @@ export interface AnySpendDepositModalProps extends BaseModalProps {
635
635
  actionLabel?: string;
636
636
  /** Whether to show chain selection step. Defaults to true if sourceTokenChainId is not provided */
637
637
  showChainSelection?: boolean;
638
+ /** Whether to show the "Fund with Fiat" option in the deposit options list. Defaults to true */
639
+ showFiatOption?: boolean;
638
640
  /** Minimum pool size for filtering tokens (default: 1,000,000) */
639
641
  minPoolSize?: number;
640
642
  /** Custom title for chain selection step */