thirdweb 5.100.2-nightly-5ab59ff400cc32caa414354855fa07831ed90f3a-20250523000413 → 5.100.2
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/dist/cjs/engine/get-status.js +1 -0
- package/dist/cjs/engine/get-status.js.map +1 -1
- package/dist/cjs/engine/server-wallet.js +4 -1
- package/dist/cjs/engine/server-wallet.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/PayProviderSelection.js +27 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/PayProviderSelection.js.map +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js +17 -16
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js +2 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/Providers.js +6 -9
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/Providers.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/utils.js +9 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/utils.js.map +1 -1
- package/dist/cjs/react/web/wallets/in-app/CountrySelector.js +10 -8
- package/dist/cjs/react/web/wallets/in-app/CountrySelector.js.map +1 -1
- package/dist/cjs/react/web/wallets/in-app/InputSelectionUI.js +6 -2
- package/dist/cjs/react/web/wallets/in-app/InputSelectionUI.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js +1 -1
- package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
- package/dist/cjs/utils/bytecode/resolveImplementation.js +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/engine/get-status.js +1 -0
- package/dist/esm/engine/get-status.js.map +1 -1
- package/dist/esm/engine/server-wallet.js +4 -1
- package/dist/esm/engine/server-wallet.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/PayProviderSelection.js +23 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/PayProviderSelection.js.map +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js +17 -16
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js +2 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/Providers.js +6 -9
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/Providers.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/utils.js +8 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/utils.js.map +1 -1
- package/dist/esm/react/web/wallets/in-app/CountrySelector.js +10 -8
- package/dist/esm/react/web/wallets/in-app/CountrySelector.js.map +1 -1
- package/dist/esm/react/web/wallets/in-app/InputSelectionUI.js +6 -2
- package/dist/esm/react/web/wallets/in-app/InputSelectionUI.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js +1 -1
- package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
- package/dist/esm/utils/bytecode/resolveImplementation.js +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/engine/get-status.d.ts.map +1 -1
- package/dist/types/engine/server-wallet.d.ts.map +1 -1
- package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts +1 -0
- package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/PayProviderSelection.d.ts +12 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/PayProviderSelection.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.d.ts +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/Providers.d.ts +2 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/Providers.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/utils.d.ts +6 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/utils.d.ts.map +1 -1
- package/dist/types/react/web/wallets/in-app/CountrySelector.d.ts +2 -1
- package/dist/types/react/web/wallets/in-app/CountrySelector.d.ts.map +1 -1
- package/dist/types/react/web/wallets/in-app/InputSelectionUI.d.ts +1 -0
- package/dist/types/react/web/wallets/in-app/InputSelectionUI.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/ConnectWalletSocialOptions.d.ts.map +1 -1
- package/dist/types/utils/bytecode/resolveImplementation.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/dist/types/wallets/ecosystem/types.d.ts +4 -0
- package/dist/types/wallets/ecosystem/types.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/wallet/types.d.ts +4 -0
- package/dist/types/wallets/in-app/core/wallet/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/engine/get-status.ts +1 -0
- package/src/engine/server-wallet.test.ts +16 -16
- package/src/engine/server-wallet.ts +4 -1
- package/src/react/core/hooks/connection/ConnectButtonProps.ts +1 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/PayProviderSelection.tsx +68 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.tsx +27 -36
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.tsx +2 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/Providers.tsx +30 -33
- package/src/react/web/ui/ConnectWallet/screens/Buy/utils.ts +9 -0
- package/src/react/web/wallets/in-app/CountrySelector.tsx +14 -7
- package/src/react/web/wallets/in-app/InputSelectionUI.test.tsx +23 -0
- package/src/react/web/wallets/in-app/InputSelectionUI.tsx +7 -1
- package/src/react/web/wallets/shared/ConnectWalletSocialOptions.tsx +3 -0
- package/src/utils/bytecode/resolveImplementation.ts +1 -1
- package/src/version.ts +1 -1
- package/src/wallets/ecosystem/types.ts +5 -0
- package/src/wallets/in-app/core/wallet/types.ts +5 -0
@@ -1,3 +1,12 @@
|
|
1
1
|
export function getBuyTokenAmountFontSize(value: string) {
|
2
2
|
return value.length > 10 ? "26px" : value.length > 6 ? "34px" : "50px";
|
3
3
|
}
|
4
|
+
|
5
|
+
/**
|
6
|
+
*
|
7
|
+
* @param str accepts any string but expects a fully upppercased string / type FiatProvider
|
8
|
+
* @returns Fiat provider label to be rendered used within presentation logic
|
9
|
+
*/
|
10
|
+
export function getProviderLabel(str: string) {
|
11
|
+
return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
|
12
|
+
}
|
@@ -21,19 +21,26 @@ export function getCountrySelector(countryIsoCode: SupportedSmsCountry) {
|
|
21
21
|
export function CountrySelector({
|
22
22
|
countryCode,
|
23
23
|
setCountryCode,
|
24
|
+
allowedCountryCodes,
|
24
25
|
}: {
|
25
26
|
countryCode: string;
|
26
27
|
setCountryCode: React.Dispatch<React.SetStateAction<string>>;
|
28
|
+
allowedCountryCodes?: SupportedSmsCountry[];
|
27
29
|
}) {
|
28
30
|
const selectRef = useRef<HTMLSelectElement>(null);
|
29
31
|
|
30
|
-
const supportedCountriesForSms =
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
const supportedCountriesForSms =
|
33
|
+
allowedCountryCodes && allowedCountryCodes.length > 0
|
34
|
+
? supportedSmsCountries.filter((c) =>
|
35
|
+
allowedCountryCodes.includes(c.countryIsoCode as SupportedSmsCountry),
|
36
|
+
)
|
37
|
+
: (supportedSmsCountries ?? [
|
38
|
+
{
|
39
|
+
countryIsoCode: "US",
|
40
|
+
countryName: "United States",
|
41
|
+
phoneNumberCode: 1,
|
42
|
+
},
|
43
|
+
]);
|
37
44
|
|
38
45
|
return (
|
39
46
|
<>
|
@@ -42,4 +42,27 @@ describe("InputSelectionUI", () => {
|
|
42
42
|
|
43
43
|
expect(screen.getByRole("combobox")).toHaveValue("US +1");
|
44
44
|
});
|
45
|
+
|
46
|
+
it("should filter countries based on allowedSmsCountryCodes", () => {
|
47
|
+
const mockGetCountrySelector = vi.mocked(getCountrySelector);
|
48
|
+
mockGetCountrySelector.mockReturnValue("IN +91");
|
49
|
+
|
50
|
+
render(
|
51
|
+
<InputSelectionUI
|
52
|
+
onSelect={vi.fn()}
|
53
|
+
placeholder=""
|
54
|
+
name=""
|
55
|
+
type=""
|
56
|
+
submitButtonText=""
|
57
|
+
format="phone"
|
58
|
+
allowedSmsCountryCodes={["IN", "BR"]}
|
59
|
+
/>,
|
60
|
+
);
|
61
|
+
|
62
|
+
const options = screen.getAllByRole("option");
|
63
|
+
const optionTexts = options.map((o) => o.textContent);
|
64
|
+
expect(optionTexts.some((t) => t?.includes("India"))).toBe(true);
|
65
|
+
expect(optionTexts.some((t) => t?.includes("Brazil"))).toBe(true);
|
66
|
+
expect(optionTexts.some((t) => t?.includes("United States"))).toBe(false);
|
67
|
+
});
|
45
68
|
});
|
@@ -24,11 +24,16 @@ export function InputSelectionUI(props: {
|
|
24
24
|
format?: "phone";
|
25
25
|
disabled?: boolean;
|
26
26
|
defaultSmsCountryCode?: SupportedSmsCountry;
|
27
|
+
allowedSmsCountryCodes?: SupportedSmsCountry[];
|
27
28
|
}) {
|
28
29
|
const [countryCodeInfo, setCountryCodeInfo] = useState(
|
29
30
|
props.defaultSmsCountryCode
|
30
31
|
? getCountrySelector(props.defaultSmsCountryCode)
|
31
|
-
:
|
32
|
+
: props.allowedSmsCountryCodes &&
|
33
|
+
props.allowedSmsCountryCodes.length > 0 &&
|
34
|
+
props.allowedSmsCountryCodes[0]
|
35
|
+
? getCountrySelector(props.allowedSmsCountryCodes[0])
|
36
|
+
: "US +1",
|
32
37
|
);
|
33
38
|
const [input, setInput] = useState("");
|
34
39
|
const [error, setError] = useState<string | undefined>();
|
@@ -69,6 +74,7 @@ export function InputSelectionUI(props: {
|
|
69
74
|
<CountrySelector
|
70
75
|
countryCode={countryCodeInfo}
|
71
76
|
setCountryCode={setCountryCodeInfo}
|
77
|
+
allowedCountryCodes={props.allowedSmsCountryCodes}
|
72
78
|
/>
|
73
79
|
)}
|
74
80
|
<Input
|
@@ -451,6 +451,9 @@ export const ConnectWalletSocialOptions = (
|
|
451
451
|
defaultSmsCountryCode={
|
452
452
|
wallet.getConfig()?.auth?.defaultSmsCountryCode
|
453
453
|
}
|
454
|
+
allowedSmsCountryCodes={
|
455
|
+
wallet.getConfig()?.auth?.allowedSmsCountryCodes
|
456
|
+
}
|
454
457
|
/>
|
455
458
|
) : (
|
456
459
|
<WalletTypeRowButton
|
@@ -18,7 +18,7 @@ const ZERO_BYTES32 =
|
|
18
18
|
* @returns A promise that resolves to an object containing the implementation address and bytecode.
|
19
19
|
* @example
|
20
20
|
* ```ts
|
21
|
-
* import { resolveImplementation } from "thirdweb";
|
21
|
+
* import { resolveImplementation } from "thirdweb/utils";
|
22
22
|
* const implementation = await resolveImplementation(contract);
|
23
23
|
* ```
|
24
24
|
* @contract
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.100.2
|
1
|
+
export const version = "5.100.2";
|
@@ -19,6 +19,11 @@ export type EcosystemWalletCreationOptions = {
|
|
19
19
|
* The default country code to use for SMS authentication
|
20
20
|
*/
|
21
21
|
defaultSmsCountryCode?: SupportedSmsCountry;
|
22
|
+
|
23
|
+
/**
|
24
|
+
* The list of allowed country codes to display in the country selector
|
25
|
+
*/
|
26
|
+
allowedSmsCountryCodes?: SupportedSmsCountry[];
|
22
27
|
};
|
23
28
|
/**
|
24
29
|
* The partnerId of the ecosystem wallet to connect to
|
@@ -83,6 +83,11 @@ export type InAppWalletCreationOptions =
|
|
83
83
|
* The default country code to use for SMS authentication
|
84
84
|
*/
|
85
85
|
defaultSmsCountryCode?: SupportedSmsCountry;
|
86
|
+
|
87
|
+
/**
|
88
|
+
* The list of allowed country codes to display in the country selector
|
89
|
+
*/
|
90
|
+
allowedSmsCountryCodes?: SupportedSmsCountry[];
|
86
91
|
};
|
87
92
|
/**
|
88
93
|
* Metadata to display in the Connect Modal
|