Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/lazy-rabbits-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@clerk/clerk-js": patch
"@clerk/types": patch
---

Add type for \_\_internal_country
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ const CountryCodeListItem = memo((props: CountryCodeListItemProps) => {

export const PhoneInput = forwardRef<HTMLInputElement, PhoneInputProps & { feedbackType?: FeedbackType }>(
(props, ref) => {
// @ts-expect-error
const { __internal_country } = useClerk();

return (
Expand Down
2 changes: 2 additions & 0 deletions packages/types/src/clerk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ export interface Clerk {

telemetry: TelemetryCollector | undefined;

__internal_country?: string | null;

/**
* Signs out the current user on single-session instances, or all users on multi-session instances
* @param signOutCallback - Optional A callback that runs after sign out completes.
Expand Down
5 changes: 2 additions & 3 deletions packages/ui/src/common/phone-number-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { extractDigits, formatPhoneNumber, parsePhoneString } from '~/utils/phon

type UseFormattedPhoneNumberProps = {
initPhoneWithCode: string;
locationBasedCountryIso?: CountryIso;
locationBasedCountryIso?: CountryIso | null;
};

const format = (str: string, iso: CountryIso) => {
Expand Down Expand Up @@ -93,8 +93,7 @@ export const PhoneNumberField = React.forwardRef(function PhoneNumberField(
forwardedRef: React.ForwardedRef<HTMLInputElement>,
) {
const clerk = useClerk();
// TODO to fix IsomorphicClerk
const locationBasedCountryIso = (clerk as any)?.clerkjs.__internal_country;
const locationBasedCountryIso = clerk.__internal_country as UseFormattedPhoneNumberProps['locationBasedCountryIso'];
const { t, translateError } = useLocalizations();
const [isOpen, setOpen] = React.useState(false);
const [selectedCountry, setSelectedCountry] = React.useState(countryOptions[0]);
Expand Down