@thenamespace/ens-components 1.2.1 → 1.3.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/dist/index.d.ts CHANGED
@@ -94,7 +94,7 @@ interface EnsNameRegistrationFormProps {
94
94
  onConnectWallet?: () => void;
95
95
  }
96
96
  interface RegistrationSuccessData {
97
- expiryInYears: number;
97
+ durationLabel: string;
98
98
  registrationCost: string;
99
99
  transactionFees: string;
100
100
  total: string;
@@ -152,6 +152,26 @@ declare const getEnsAppUrl: (ensName: string, isTestnet?: boolean) => string;
152
152
 
153
153
  declare const wait: (ms: number) => Promise<void>;
154
154
 
155
+ declare const ONE_DAY = 86400;
156
+ /** Fixed 365-day year. Use secondsFromYears() when calendar accuracy is required (e.g. initial state). */
157
+ declare const ONE_YEAR: number;
158
+ declare const MIN_REGISTRATION_SECONDS: number;
159
+ /** "YYYY-MM-DD" string for <input type="date"> value, from Unix expiry timestamp */
160
+ declare const secondsToDateInput: (expirySeconds: number) => string;
161
+ /** Duration in seconds from nowSeconds to the start of valueAsDate's calendar day (UTC-day aligned).
162
+ * Uses local date parts fed into Date.UTC to count whole calendar days without DST skew. */
163
+ declare const roundDurationWithDay: (valueAsDate: Date, nowSeconds: number) => number;
164
+ /** Calendar-aware seconds for N whole years from startDate (handles leap years) */
165
+ declare const secondsFromYears: (startDate: Date, years: number) => number;
166
+ /** Fractional years from duration seconds */
167
+ declare const yearsFromSeconds: (seconds: number) => number;
168
+ /**
169
+ * Human-readable duration label for display.
170
+ * Examples: "1 year", "2 years", "6 months, 3 days", "28 days"
171
+ * Shows at most 2 parts; omits days when years are present.
172
+ */
173
+ declare const formatDurationSummary: (durationSeconds: number) => string;
174
+
155
175
  interface EnsRecordsFormProps {
156
176
  resolverChainId?: number;
157
177
  resolverAddress?: Address;
@@ -454,14 +474,22 @@ interface PricingDisplayProps {
454
474
  isChecking: boolean;
455
475
  };
456
476
  expiryPicker?: {
457
- years: number;
458
- onYearsChange: (years: number) => void;
477
+ durationSeconds: number;
478
+ onDurationChange: (seconds: number) => void;
479
+ minSeconds?: number;
459
480
  };
460
481
  ethUsdRate?: number | null;
461
482
  className?: string;
462
483
  }
463
484
  declare const PricingDisplay: React__default.FC<PricingDisplayProps>;
464
485
 
486
+ interface DurationPickerProps {
487
+ durationSeconds: number;
488
+ onDurationChange: (seconds: number) => void;
489
+ minSeconds?: number;
490
+ }
491
+ declare const DurationPicker: React__default.FC<DurationPickerProps>;
492
+
465
493
  interface TransactionPendingScreenProps {
466
494
  message?: string;
467
495
  hash: Hash;
@@ -603,7 +631,7 @@ interface RentPriceResponse {
603
631
  interface RegistrationRequest {
604
632
  label: string;
605
633
  owner: Address;
606
- expiryInYears: number;
634
+ durationInSeconds: number;
607
635
  secret: string;
608
636
  records: EnsRecords$1;
609
637
  referrer?: Address;
@@ -612,7 +640,7 @@ declare const useRegisterENS: ({ isTestnet }: {
612
640
  isTestnet?: boolean;
613
641
  }) => {
614
642
  isEnsAvailable: (label: string) => Promise<boolean>;
615
- getRegistrationPrice: (label: string, expiryInYears?: number) => Promise<RentPriceResponse>;
643
+ getRegistrationPrice: (label: string, durationInSeconds?: number) => Promise<RentPriceResponse>;
616
644
  sendCommitmentTx: (request: RegistrationRequest) => Promise<Hash>;
617
645
  sendRegisterTx: (request: RegistrationRequest) => Promise<{
618
646
  txHash: Hash;
@@ -851,5 +879,5 @@ declare const useAvatarClient: ({ isTestnet, domain }: UseAvatarClientParams) =>
851
879
  getErrorMessage: (err: unknown, imageType?: UploadImageType) => string;
852
880
  };
853
881
 
854
- export { Accordion, Alert, Button, Card, ChainIcon, ConnectAndSetChain, ContenthashIcon, ContenthashProtocol, ContractErrorLabel, Dropdown, ENS_RESOLVER_ABI, EnsNameRegistrationForm, EnsRecordsForm, Icon, Input, ListingNetwork, ListingType, MULTICALL, Modal, OffchainSubnameForm, PricingDisplay, ProfileHeader, ProgressBar, SET_ADDRESS_FUNC, SET_CONTENTHASH_FUNC, SET_TEXT_FUNC, SelectRecordsForm, ShurikenSpinner, SubnameMintForm, Text, TextRecordCategory, Textarea, ThemeProvider, Tooltip, TransactionPendingScreen, TxProgress, capitalize, convertEVMChainIdToCoinType, convertToMulticallResolverData, convertToResolverData, createEnsReferer, debounce, deepCopy, diffToEnsRecords, ensureFloatInput, equalsIgnoreCase, formatFloat, getAvatarUploadErrorMessage, getBlockExplorer, getBlockExplorerAddressUrl, getBlockExplorerName, getBlockExplorerTransactionUrl, getChainIdForListingNetwork, getEnsAppUrl, getEnsRecordsDiff, getImageUploadErrorMessage, getSupportedAddressByChainId, getSupportedAddressByCoin, getSupportedAddressByName, getSupportedAddressMap, getSupportedChashByProtocol, getSupportedText, isCommitmentToNewErr, isContenthashValid, isUserDeniedError, supportedAddresses, supportedContenthashRecords, supportedTexts, useAvatarClient, useENSResolver, useEthDollarValue, useMintManager, useMintSubname, useOffchainManager, useRegisterENS, useTheme, useWaitTransaction, validateEnsRecords, wait };
855
- export type { AccordionProps, AlertPosition, AlertProps, AlertVariant, ButtonProps, ButtonSize, ButtonVariant, ChainName$1 as ChainName, ConnectAndSetChainProps, ContractErrorLabelProps, DropdownProps, EnsAddressRecord$1 as EnsAddressRecord, EnsContenthashRecord, EnsRecords$1 as EnsRecords, EnsRecordsDiff, EnsTextRecord$1 as EnsTextRecord, EstimatedFees, IconName, IconProps, InputProps, InputSize, InputType, ModalPresentation, ModalProps, ModalResponsivePresentation, ModalSize, NameListing, OffchainSubnameCreatedData, PricingDisplayProps, ProfileHeaderProps, RecordValidationError, RegistrationRequest, ShurikenSpinnerProps, SupportedContenthashRecord, SupportedEnsAddress, SupportedText, SupportedTextRecord, TextCategory, TextColor, TextProps, TextSize, TextWeight, TextareaProps, TextareaSize, ThemeContextValue, ThemeName, ThemeProviderProps, TooltipPosition, TooltipProps, UploadAvatarParams, UploadImageType };
882
+ export { Accordion, Alert, Button, Card, ChainIcon, ConnectAndSetChain, ContenthashIcon, ContenthashProtocol, ContractErrorLabel, Dropdown, DurationPicker, ENS_RESOLVER_ABI, EnsNameRegistrationForm, EnsRecordsForm, Icon, Input, ListingNetwork, ListingType, MIN_REGISTRATION_SECONDS, MULTICALL, Modal, ONE_DAY, ONE_YEAR, OffchainSubnameForm, PricingDisplay, ProfileHeader, ProgressBar, SET_ADDRESS_FUNC, SET_CONTENTHASH_FUNC, SET_TEXT_FUNC, SelectRecordsForm, ShurikenSpinner, SubnameMintForm, Text, TextRecordCategory, Textarea, ThemeProvider, Tooltip, TransactionPendingScreen, TxProgress, capitalize, convertEVMChainIdToCoinType, convertToMulticallResolverData, convertToResolverData, createEnsReferer, debounce, deepCopy, diffToEnsRecords, ensureFloatInput, equalsIgnoreCase, formatDurationSummary, formatFloat, getAvatarUploadErrorMessage, getBlockExplorer, getBlockExplorerAddressUrl, getBlockExplorerName, getBlockExplorerTransactionUrl, getChainIdForListingNetwork, getEnsAppUrl, getEnsRecordsDiff, getImageUploadErrorMessage, getSupportedAddressByChainId, getSupportedAddressByCoin, getSupportedAddressByName, getSupportedAddressMap, getSupportedChashByProtocol, getSupportedText, isCommitmentToNewErr, isContenthashValid, isUserDeniedError, roundDurationWithDay, secondsFromYears, secondsToDateInput, supportedAddresses, supportedContenthashRecords, supportedTexts, useAvatarClient, useENSResolver, useEthDollarValue, useMintManager, useMintSubname, useOffchainManager, useRegisterENS, useTheme, useWaitTransaction, validateEnsRecords, wait, yearsFromSeconds };
883
+ export type { AccordionProps, AlertPosition, AlertProps, AlertVariant, ButtonProps, ButtonSize, ButtonVariant, ChainName$1 as ChainName, ConnectAndSetChainProps, ContractErrorLabelProps, DropdownProps, DurationPickerProps, EnsAddressRecord$1 as EnsAddressRecord, EnsContenthashRecord, EnsRecords$1 as EnsRecords, EnsRecordsDiff, EnsTextRecord$1 as EnsTextRecord, EstimatedFees, IconName, IconProps, InputProps, InputSize, InputType, ModalPresentation, ModalProps, ModalResponsivePresentation, ModalSize, NameListing, OffchainSubnameCreatedData, PricingDisplayProps, ProfileHeaderProps, RecordValidationError, RegistrationRequest, ShurikenSpinnerProps, SupportedContenthashRecord, SupportedEnsAddress, SupportedText, SupportedTextRecord, TextCategory, TextColor, TextProps, TextSize, TextWeight, TextareaProps, TextareaSize, ThemeContextValue, ThemeName, ThemeProviderProps, TooltipPosition, TooltipProps, UploadAvatarParams, UploadImageType };