@delopay/sdk 0.70.0 → 0.71.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.cts CHANGED
@@ -5682,6 +5682,30 @@ interface TrustBadge {
5682
5682
  backgroundColor: string;
5683
5683
  borderColor: string | null;
5684
5684
  }
5685
+ type CustomFieldType = 'text' | 'textarea' | 'password' | 'email' | 'select';
5686
+ type CustomFieldTranslations = Record<string, string>;
5687
+ interface CustomFieldOption {
5688
+ value: string;
5689
+ label: string;
5690
+ labelTranslations: CustomFieldTranslations;
5691
+ }
5692
+ interface CheckoutCustomField {
5693
+ id: string;
5694
+ key: string;
5695
+ type: CustomFieldType;
5696
+ label: string;
5697
+ labelTranslations: CustomFieldTranslations;
5698
+ placeholder: string;
5699
+ placeholderTranslations: CustomFieldTranslations;
5700
+ helpText: string;
5701
+ helpTextTranslations: CustomFieldTranslations;
5702
+ required: boolean;
5703
+ enabled: boolean;
5704
+ minLength: number | null;
5705
+ maxLength: number | null;
5706
+ defaultValue: string;
5707
+ options: CustomFieldOption[];
5708
+ }
5685
5709
  interface CheckoutBranding {
5686
5710
  displayName: string;
5687
5711
  logoUrl: string;
@@ -5719,6 +5743,7 @@ interface CheckoutBranding {
5719
5743
  showCurrencyCode: boolean;
5720
5744
  showOrderItems: boolean;
5721
5745
  trustBadges: TrustBadge[];
5746
+ customFields: CheckoutCustomField[];
5722
5747
  headerText: string;
5723
5748
  payButtonLabel: string;
5724
5749
  cardTermsMessage: string;
@@ -5748,6 +5773,7 @@ declare const DEFAULT_BRANDING: CheckoutBranding;
5748
5773
  declare const DEFAULT_BRANDING_DARK: CheckoutBranding;
5749
5774
  declare function defaultBranding(): CheckoutBranding;
5750
5775
  declare function cloneBranding(b: CheckoutBranding): CheckoutBranding;
5776
+ declare function cloneCustomField(f: CheckoutCustomField): CheckoutCustomField;
5751
5777
  declare const CUSTOM_CSS_MAX_LENGTH = 50000;
5752
5778
  declare function sanitizeCustomCss(raw: string | null | undefined): string | null;
5753
5779
  interface BrandingSource {
@@ -5770,6 +5796,14 @@ interface BrandingSource {
5770
5796
  }
5771
5797
  declare function decodeBadges(raw: string | undefined): TrustBadge[] | null;
5772
5798
  declare function encodeBadges(badges: TrustBadge[]): string;
5799
+ declare const CUSTOM_FIELDS_MAX = 20;
5800
+ declare const CUSTOM_FIELD_KEY_PATTERN: RegExp;
5801
+ declare const ALL_CUSTOM_FIELD_TYPES: readonly CustomFieldType[];
5802
+ declare function parseCustomFieldsLoose(raw: unknown): CheckoutCustomField[] | null;
5803
+ declare function decodeCustomFields(raw: string | undefined): CheckoutCustomField[] | null;
5804
+ declare function encodeCustomFields(fields: CheckoutCustomField[]): string;
5805
+ declare function customFieldText(field: CheckoutCustomField, part: 'label' | 'placeholder' | 'helpText', locale?: string): string;
5806
+ declare function customFieldOptionLabel(option: CustomFieldOption, locale?: string): string;
5773
5807
  declare function decodeBranding(source: BrandingSource | null | undefined): CheckoutBranding;
5774
5808
  interface EncodedBranding {
5775
5809
  theme: string;
@@ -5800,4 +5834,4 @@ declare function parseImportedBranding(raw: unknown): CheckoutBranding;
5800
5834
  declare function applyBrandingVariables(el: HTMLElement, b: CheckoutBranding): void;
5801
5835
  declare function shadowFor(style: SurfaceStyle): string;
5802
5836
 
5803
- export { type AddUserRequest, type AddUserResponse, type Address, type AddressDetails, type AllocationListResponse, type AllocationResponse, type AllocationTransferRequest, type AllocationTransferResponse, Analytics, type AnalyticsChild, type AnalyticsConnectorDay, type AnalyticsConnectorSeries, AnalyticsDashboard, type AnalyticsDayBucket, type AnalyticsMethodSlice, type AnalyticsScopeRequest, type AnalyticsScopeResponse, type ApiKeyCreateRequest, type ApiKeyCreateResponse, type ApiKeyExpiration, type ApiKeyListConstraints, type ApiKeyResponse, type ApiKeyRevokeResponse, type ApiKeyUpdateRequest, type ApplePayVerificationRequest, type ApplePayVerificationResponse, type ApplePayVerifiedDomainsResponse, type AttemptStatus, type AuthResponse, type AuthenticationCreateRequest, type AuthenticationResponse, type AuthenticationStatus, type AuthenticationType, type AutoRechargeConfig, type AutoRechargeUpdateRequest, type AvailabilityOverrideCreateRequest, type AvailabilityOverrideResponse, AvailabilityOverrides, type AvailabilityPreviewMethod, type AvailabilityPreviewParams, type AvailabilityPreviewResponse, BRANDING_EXPORT_FORMAT, BRANDING_EXPORT_VERSION, type BillingCompleteSetupRequest, type BillingProfileResponse, type BillingSetupRequest, type BillingSetupResponse, type BlockedAttempt, type BlockedAttemptListParams, type BlockedAttemptListResponse, type BlocklistAddRequest, type BlocklistDataKind, type BlocklistResponse, type BrandingExport, type BrandingSource, type BuiltInRegionGroupResponse, type BusinessPaymentLinkConfig, CUSTOM_CSS_MAX_LENGTH, type CancelSubscriptionRequest, type CancelSubscriptionResponse, type CaptureMethod, type CardDetail, type CardDetailFromLocker, Cards, type ChangePasswordRequest, type CheckoutBranding, type ConditionNode, type ConfirmSubscriptionPaymentDetails, type ConfirmSubscriptionRequest, type ConfirmSubscriptionResponse, type Connector, type ConnectorCloneRequest, type ConnectorCreateRequest, type ConnectorListResponse, type ConnectorResponse, type ConnectorSelection, type ConnectorType, type ConnectorUpdateRequest, type ConnectorVolumeSplit, type ConnectorWebhookEntry, type ConnectorWebhookEventType, type ConnectorWebhookListResponse, type ConnectorWebhookRegisterRequest, type ConnectorWebhookRegisterResponse, type CornerRadius, type CreateAndConfirmSubscriptionRequest, type CreateSubscriptionPaymentDetails, type CreateSubscriptionRequest, type Currency, type CurrencyRevenue, type CustomerCreateRequest, type CustomerListParams, type CustomerPaymentMethodsListParams, type CustomerPaymentMethodsListResponse, type CustomerResponse, type CustomerUpdateRequest, DEFAULT_BADGES, DEFAULT_BADGES_DARK, DEFAULT_BRANDING, DEFAULT_BRANDING_DARK, type DeleteAccountRequest, type DeleteUserRoleRequest, Delopay, DelopayAuthenticationError, DelopayError, type DelopayLogger, type DelopayOptions, type DisputeEvidenceBlock, type DisputeEvidenceRequest, type DisputeEvidenceType, type DisputeListParams, type DisputeResponse, type DisputeStage, type DisputeStatus, type EncodedBranding, type EphemeralKeyCreateRequest, type EphemeralKeyCreateResponse, type EuclidComparison, type EuclidComparisonType, type EuclidIfStatement, type EuclidValue, type EventClass, type EventDeliveryAttemptResponse, type EventDetailResponse, type EventListParams, type EventListResponse, type EventResponse, type EventType, Export, FeatureMatrix, type FeeOwner, FeeProgramBuilder, type FeeRuleConditions, type FeeRuleInput, type FeeRulePreviewRequest, type FeeRulePreviewResponse, type FeeScheduleCreateRequest, type FeeScheduleResponse, type FeeScheduleUpdateRequest, type FeeSpecInput, type FeeType, Files, type FontFamily, type FontWeight, Forex, type ForgotPasswordRequest, type FromEmailRequest, type FutureUsage, type GatewayConnectRequest, type GatewayResponse, type GetSubscriptionItemsParams, type GetSubscriptionItemsResponse, type GlobalSearchRequest, type GroupNode, type ImpersonateEmployeeRequest, type IntentStatus, type InviteUsersRequest, type InviteUsersResponse, type InvoiceStatus, type LabelStyle, type LayoutStyle, type LeafNode, type LedgerEntry, type LedgerListParams, type LedgerResponse, type LinkedRoutingConfigRetrieveResponse, type ListInvitableRolesParams, type ListUsersInLineageParams, type LoginHistoryEntry, type LoginHistoryParams, type LoginHistoryResponse, type LogoShape, type LogoSize, type MandateListParams, type MandateResponse, type MandateRevokedResponse, type MandateStatus, type MandateType, type MerchantAccountCreateRequest, type MerchantAccountResponse, type MerchantAccountType, type MerchantAccountUpdateRequest, type MerchantOverviewResponse, type MerchantOverviewStat, type MerchantRoutingAlgorithm, type MethodSurcharge, type MinimalRoleInfo, type NonPillRadius, type OverrideAction, type OverrideScope, type ParentGroup, type ParentGroupInfo, type PauseSubscriptionRequest, type PauseSubscriptionResponse, type PaymentAttemptResponse, type PaymentAttemptsListResponse, type PaymentCancelRequest, type PaymentCaptureRequest, type PaymentConfirmRequest, type PaymentCreateRequest, type PaymentErrorDetails, type PaymentExperience, type PaymentIdFormatConfig, type PaymentIdStyle, type PaymentIntentStateMetadata, type PaymentLayout, type PaymentLinkBackgroundImageConfig, type PaymentLinkConfigRequest, type PaymentLinkListParams, type PaymentLinkListResponse, type PaymentLinkResponse, type PaymentLinkTransactionDetails, type PaymentListParams, type PaymentListResponse, type PaymentMethod, type PaymentMethodCreateRequest, type PaymentMethodDeleteResponse, type PaymentMethodListParams, type PaymentMethodResponse, type PaymentMethodType, type PaymentMethodUpdateRequest, type PaymentResponse, type PaymentRetrieveOptions, type PaymentStatusHistoryEntityType, type PaymentStatusHistoryEvent, type PaymentStatusHistoryResponse, type PaymentUpdateRequest, type PayoutCreateRequest, type PayoutListParams, type PayoutListResponse, type PayoutResponse, type PayoutStatus, type PayoutType, type PayoutUpdateRequest, type PerMethodSurchargeItem, type PermissionScope, type PhoneDetails, type PhoneOtpRequest, type PhoneOtpResponse, type PhoneOtpVerifyRequest, type PhoneOtpVerifyResponse, type PlatformFeeKind, type PlatformFeeOutput, type PlatformFeeProgram, type PlatformFeeRule, type PlatformFeeRuleInput, type PlatformFeeRuleOutput, type PlatformFeeRuleRecord, type PlatformFeeRuleRequest, type PollStatus, type PollStatusResponse, type ProfileAcquirerCreateRequest, type ProfileAcquirerResponse, type ProfileAcquirerUpdateRequest, type ProfileCreateRequest, type ProfileDefaultRoutingConfig, type ProfileDeniedConnectorsResponse, type ProfileLogoUploadResponse, type ProfileResponse, type ProfileUpdateRequest, type ProgramConnectorSelection, type ProjectCreateRequest, type ProjectResponse, type ProjectStats, type ProjectStatsResponse, type ProjectUpdateRequest, type RecoveryCodesResponse, type RefundAggregateResponse, type RefundCreateRequest, type RefundListParams, type RefundListResponse, type RefundResponse, type RefundStatus, type RefundType, type RefundUpdateRequest, type RegionCountriesResponse, type RegionCreateRequest, type RegionResponse, type RegionSetCountriesRequest, type RegionUpdateRequest, Regions, type RelayRequest, type RelayResponse, type RelayStatus, type RelayType, type RequestExtras, type RequestFn, type RequestOptions, type ResetPasswordRequest, type ResumeSubscriptionRequest, type ResumeSubscriptionResponse, type RoutableConnectorChoice, type RoutingActivatePayload, type RoutingConfigCreateRequest, type RoutingConfigResponse, type RoutingDeactivateRequest, type RoutingDictionary, type RoutingDictionaryRecord, type RuleConnectorSelection, Search, type SearchGroupResponse, type SearchIndex, type SearchStatus, type ShopCreateRequest, type ShopResponse, type ShopStats, type ShopStatsResponse, type ShopUpdateRequest, type SignInRequest, type SignUpRequest, type SignUpWithMerchantIdRequest, type SignUpWithMerchantRequest, type SizeScale, type SpacingScale, type StaticRoutingAlgorithm, type StatsPeriod, type StripeConnectAccountRequest, type StripeConnectAccountResponse, type StripeConnectLinkRequest, type StripeConnectLinkResponse, type SubscriptionEstimateParams, type SubscriptionEstimateResponse, type SubscriptionInvoice, type SubscriptionItem, type SubscriptionItemPrice, type SubscriptionItemType, type SubscriptionLineItem, type SubscriptionListParams, type SubscriptionPaymentData, type SubscriptionPaymentDetails, type SubscriptionPeriodUnit, type SubscriptionResponse, type SubscriptionStatus, Subscriptions, type SummaryPosition, type SurchargeRuleRequest, type SurchargeRuleResponse, type SurfaceStyle, type SwitchMerchantRequest, type SwitchProfileRequest, type Terminate2faQueryParams, type ThreeDSDecision, type ThreeDsRuleExecuteRequest, type ThreeDsRuleResponse, type TierSummary, type TokenPurpose, type TokenResponse, type TopupRequest, type TopupResponse, type TotpResponse, type TransactionType, type TrustBadge, type UpdateSubscriptionRequest, type UpdateUserDetailsRequest, type UpdateUserRoleRequest, type UserInLineage, type UserResponse, type UserSessionEntry, type UserSessionListResponse, type UserSessionRevokeResponse, type VerifyTotpRequest, type WebhookDeliveryAttempt, type WebhookEvent, type WebhookRegistrationEnvironment, Webhooks, allOf, anyOf, applyBrandingVariables, buildBrandingExport, buttonPadValue, cloneBranding, decodeBadges, decodeBranding, defaultBranding, encodeBadges, encodeBranding, feeProgram, fontStack, fontWeightValue, inputPadValue, isDarkSurface, isHexColor, leaf, logoDimensions, parseImportedBranding, programToTree, radiusValue, ruleMatchToTree, sanitizeCustomCss, shadowFor, surfacePadValue, verticalGapValue };
5837
+ export { ALL_CUSTOM_FIELD_TYPES, type AddUserRequest, type AddUserResponse, type Address, type AddressDetails, type AllocationListResponse, type AllocationResponse, type AllocationTransferRequest, type AllocationTransferResponse, Analytics, type AnalyticsChild, type AnalyticsConnectorDay, type AnalyticsConnectorSeries, AnalyticsDashboard, type AnalyticsDayBucket, type AnalyticsMethodSlice, type AnalyticsScopeRequest, type AnalyticsScopeResponse, type ApiKeyCreateRequest, type ApiKeyCreateResponse, type ApiKeyExpiration, type ApiKeyListConstraints, type ApiKeyResponse, type ApiKeyRevokeResponse, type ApiKeyUpdateRequest, type ApplePayVerificationRequest, type ApplePayVerificationResponse, type ApplePayVerifiedDomainsResponse, type AttemptStatus, type AuthResponse, type AuthenticationCreateRequest, type AuthenticationResponse, type AuthenticationStatus, type AuthenticationType, type AutoRechargeConfig, type AutoRechargeUpdateRequest, type AvailabilityOverrideCreateRequest, type AvailabilityOverrideResponse, AvailabilityOverrides, type AvailabilityPreviewMethod, type AvailabilityPreviewParams, type AvailabilityPreviewResponse, BRANDING_EXPORT_FORMAT, BRANDING_EXPORT_VERSION, type BillingCompleteSetupRequest, type BillingProfileResponse, type BillingSetupRequest, type BillingSetupResponse, type BlockedAttempt, type BlockedAttemptListParams, type BlockedAttemptListResponse, type BlocklistAddRequest, type BlocklistDataKind, type BlocklistResponse, type BrandingExport, type BrandingSource, type BuiltInRegionGroupResponse, type BusinessPaymentLinkConfig, CUSTOM_CSS_MAX_LENGTH, CUSTOM_FIELDS_MAX, CUSTOM_FIELD_KEY_PATTERN, type CancelSubscriptionRequest, type CancelSubscriptionResponse, type CaptureMethod, type CardDetail, type CardDetailFromLocker, Cards, type ChangePasswordRequest, type CheckoutBranding, type CheckoutCustomField, type ConditionNode, type ConfirmSubscriptionPaymentDetails, type ConfirmSubscriptionRequest, type ConfirmSubscriptionResponse, type Connector, type ConnectorCloneRequest, type ConnectorCreateRequest, type ConnectorListResponse, type ConnectorResponse, type ConnectorSelection, type ConnectorType, type ConnectorUpdateRequest, type ConnectorVolumeSplit, type ConnectorWebhookEntry, type ConnectorWebhookEventType, type ConnectorWebhookListResponse, type ConnectorWebhookRegisterRequest, type ConnectorWebhookRegisterResponse, type CornerRadius, type CreateAndConfirmSubscriptionRequest, type CreateSubscriptionPaymentDetails, type CreateSubscriptionRequest, type Currency, type CurrencyRevenue, type CustomFieldOption, type CustomFieldTranslations, type CustomFieldType, type CustomerCreateRequest, type CustomerListParams, type CustomerPaymentMethodsListParams, type CustomerPaymentMethodsListResponse, type CustomerResponse, type CustomerUpdateRequest, DEFAULT_BADGES, DEFAULT_BADGES_DARK, DEFAULT_BRANDING, DEFAULT_BRANDING_DARK, type DeleteAccountRequest, type DeleteUserRoleRequest, Delopay, DelopayAuthenticationError, DelopayError, type DelopayLogger, type DelopayOptions, type DisputeEvidenceBlock, type DisputeEvidenceRequest, type DisputeEvidenceType, type DisputeListParams, type DisputeResponse, type DisputeStage, type DisputeStatus, type EncodedBranding, type EphemeralKeyCreateRequest, type EphemeralKeyCreateResponse, type EuclidComparison, type EuclidComparisonType, type EuclidIfStatement, type EuclidValue, type EventClass, type EventDeliveryAttemptResponse, type EventDetailResponse, type EventListParams, type EventListResponse, type EventResponse, type EventType, Export, FeatureMatrix, type FeeOwner, FeeProgramBuilder, type FeeRuleConditions, type FeeRuleInput, type FeeRulePreviewRequest, type FeeRulePreviewResponse, type FeeScheduleCreateRequest, type FeeScheduleResponse, type FeeScheduleUpdateRequest, type FeeSpecInput, type FeeType, Files, type FontFamily, type FontWeight, Forex, type ForgotPasswordRequest, type FromEmailRequest, type FutureUsage, type GatewayConnectRequest, type GatewayResponse, type GetSubscriptionItemsParams, type GetSubscriptionItemsResponse, type GlobalSearchRequest, type GroupNode, type ImpersonateEmployeeRequest, type IntentStatus, type InviteUsersRequest, type InviteUsersResponse, type InvoiceStatus, type LabelStyle, type LayoutStyle, type LeafNode, type LedgerEntry, type LedgerListParams, type LedgerResponse, type LinkedRoutingConfigRetrieveResponse, type ListInvitableRolesParams, type ListUsersInLineageParams, type LoginHistoryEntry, type LoginHistoryParams, type LoginHistoryResponse, type LogoShape, type LogoSize, type MandateListParams, type MandateResponse, type MandateRevokedResponse, type MandateStatus, type MandateType, type MerchantAccountCreateRequest, type MerchantAccountResponse, type MerchantAccountType, type MerchantAccountUpdateRequest, type MerchantOverviewResponse, type MerchantOverviewStat, type MerchantRoutingAlgorithm, type MethodSurcharge, type MinimalRoleInfo, type NonPillRadius, type OverrideAction, type OverrideScope, type ParentGroup, type ParentGroupInfo, type PauseSubscriptionRequest, type PauseSubscriptionResponse, type PaymentAttemptResponse, type PaymentAttemptsListResponse, type PaymentCancelRequest, type PaymentCaptureRequest, type PaymentConfirmRequest, type PaymentCreateRequest, type PaymentErrorDetails, type PaymentExperience, type PaymentIdFormatConfig, type PaymentIdStyle, type PaymentIntentStateMetadata, type PaymentLayout, type PaymentLinkBackgroundImageConfig, type PaymentLinkConfigRequest, type PaymentLinkListParams, type PaymentLinkListResponse, type PaymentLinkResponse, type PaymentLinkTransactionDetails, type PaymentListParams, type PaymentListResponse, type PaymentMethod, type PaymentMethodCreateRequest, type PaymentMethodDeleteResponse, type PaymentMethodListParams, type PaymentMethodResponse, type PaymentMethodType, type PaymentMethodUpdateRequest, type PaymentResponse, type PaymentRetrieveOptions, type PaymentStatusHistoryEntityType, type PaymentStatusHistoryEvent, type PaymentStatusHistoryResponse, type PaymentUpdateRequest, type PayoutCreateRequest, type PayoutListParams, type PayoutListResponse, type PayoutResponse, type PayoutStatus, type PayoutType, type PayoutUpdateRequest, type PerMethodSurchargeItem, type PermissionScope, type PhoneDetails, type PhoneOtpRequest, type PhoneOtpResponse, type PhoneOtpVerifyRequest, type PhoneOtpVerifyResponse, type PlatformFeeKind, type PlatformFeeOutput, type PlatformFeeProgram, type PlatformFeeRule, type PlatformFeeRuleInput, type PlatformFeeRuleOutput, type PlatformFeeRuleRecord, type PlatformFeeRuleRequest, type PollStatus, type PollStatusResponse, type ProfileAcquirerCreateRequest, type ProfileAcquirerResponse, type ProfileAcquirerUpdateRequest, type ProfileCreateRequest, type ProfileDefaultRoutingConfig, type ProfileDeniedConnectorsResponse, type ProfileLogoUploadResponse, type ProfileResponse, type ProfileUpdateRequest, type ProgramConnectorSelection, type ProjectCreateRequest, type ProjectResponse, type ProjectStats, type ProjectStatsResponse, type ProjectUpdateRequest, type RecoveryCodesResponse, type RefundAggregateResponse, type RefundCreateRequest, type RefundListParams, type RefundListResponse, type RefundResponse, type RefundStatus, type RefundType, type RefundUpdateRequest, type RegionCountriesResponse, type RegionCreateRequest, type RegionResponse, type RegionSetCountriesRequest, type RegionUpdateRequest, Regions, type RelayRequest, type RelayResponse, type RelayStatus, type RelayType, type RequestExtras, type RequestFn, type RequestOptions, type ResetPasswordRequest, type ResumeSubscriptionRequest, type ResumeSubscriptionResponse, type RoutableConnectorChoice, type RoutingActivatePayload, type RoutingConfigCreateRequest, type RoutingConfigResponse, type RoutingDeactivateRequest, type RoutingDictionary, type RoutingDictionaryRecord, type RuleConnectorSelection, Search, type SearchGroupResponse, type SearchIndex, type SearchStatus, type ShopCreateRequest, type ShopResponse, type ShopStats, type ShopStatsResponse, type ShopUpdateRequest, type SignInRequest, type SignUpRequest, type SignUpWithMerchantIdRequest, type SignUpWithMerchantRequest, type SizeScale, type SpacingScale, type StaticRoutingAlgorithm, type StatsPeriod, type StripeConnectAccountRequest, type StripeConnectAccountResponse, type StripeConnectLinkRequest, type StripeConnectLinkResponse, type SubscriptionEstimateParams, type SubscriptionEstimateResponse, type SubscriptionInvoice, type SubscriptionItem, type SubscriptionItemPrice, type SubscriptionItemType, type SubscriptionLineItem, type SubscriptionListParams, type SubscriptionPaymentData, type SubscriptionPaymentDetails, type SubscriptionPeriodUnit, type SubscriptionResponse, type SubscriptionStatus, Subscriptions, type SummaryPosition, type SurchargeRuleRequest, type SurchargeRuleResponse, type SurfaceStyle, type SwitchMerchantRequest, type SwitchProfileRequest, type Terminate2faQueryParams, type ThreeDSDecision, type ThreeDsRuleExecuteRequest, type ThreeDsRuleResponse, type TierSummary, type TokenPurpose, type TokenResponse, type TopupRequest, type TopupResponse, type TotpResponse, type TransactionType, type TrustBadge, type UpdateSubscriptionRequest, type UpdateUserDetailsRequest, type UpdateUserRoleRequest, type UserInLineage, type UserResponse, type UserSessionEntry, type UserSessionListResponse, type UserSessionRevokeResponse, type VerifyTotpRequest, type WebhookDeliveryAttempt, type WebhookEvent, type WebhookRegistrationEnvironment, Webhooks, allOf, anyOf, applyBrandingVariables, buildBrandingExport, buttonPadValue, cloneBranding, cloneCustomField, customFieldOptionLabel, customFieldText, decodeBadges, decodeBranding, decodeCustomFields, defaultBranding, encodeBadges, encodeBranding, encodeCustomFields, feeProgram, fontStack, fontWeightValue, inputPadValue, isDarkSurface, isHexColor, leaf, logoDimensions, parseCustomFieldsLoose, parseImportedBranding, programToTree, radiusValue, ruleMatchToTree, sanitizeCustomCss, shadowFor, surfacePadValue, verticalGapValue };
package/dist/index.d.ts CHANGED
@@ -5682,6 +5682,30 @@ interface TrustBadge {
5682
5682
  backgroundColor: string;
5683
5683
  borderColor: string | null;
5684
5684
  }
5685
+ type CustomFieldType = 'text' | 'textarea' | 'password' | 'email' | 'select';
5686
+ type CustomFieldTranslations = Record<string, string>;
5687
+ interface CustomFieldOption {
5688
+ value: string;
5689
+ label: string;
5690
+ labelTranslations: CustomFieldTranslations;
5691
+ }
5692
+ interface CheckoutCustomField {
5693
+ id: string;
5694
+ key: string;
5695
+ type: CustomFieldType;
5696
+ label: string;
5697
+ labelTranslations: CustomFieldTranslations;
5698
+ placeholder: string;
5699
+ placeholderTranslations: CustomFieldTranslations;
5700
+ helpText: string;
5701
+ helpTextTranslations: CustomFieldTranslations;
5702
+ required: boolean;
5703
+ enabled: boolean;
5704
+ minLength: number | null;
5705
+ maxLength: number | null;
5706
+ defaultValue: string;
5707
+ options: CustomFieldOption[];
5708
+ }
5685
5709
  interface CheckoutBranding {
5686
5710
  displayName: string;
5687
5711
  logoUrl: string;
@@ -5719,6 +5743,7 @@ interface CheckoutBranding {
5719
5743
  showCurrencyCode: boolean;
5720
5744
  showOrderItems: boolean;
5721
5745
  trustBadges: TrustBadge[];
5746
+ customFields: CheckoutCustomField[];
5722
5747
  headerText: string;
5723
5748
  payButtonLabel: string;
5724
5749
  cardTermsMessage: string;
@@ -5748,6 +5773,7 @@ declare const DEFAULT_BRANDING: CheckoutBranding;
5748
5773
  declare const DEFAULT_BRANDING_DARK: CheckoutBranding;
5749
5774
  declare function defaultBranding(): CheckoutBranding;
5750
5775
  declare function cloneBranding(b: CheckoutBranding): CheckoutBranding;
5776
+ declare function cloneCustomField(f: CheckoutCustomField): CheckoutCustomField;
5751
5777
  declare const CUSTOM_CSS_MAX_LENGTH = 50000;
5752
5778
  declare function sanitizeCustomCss(raw: string | null | undefined): string | null;
5753
5779
  interface BrandingSource {
@@ -5770,6 +5796,14 @@ interface BrandingSource {
5770
5796
  }
5771
5797
  declare function decodeBadges(raw: string | undefined): TrustBadge[] | null;
5772
5798
  declare function encodeBadges(badges: TrustBadge[]): string;
5799
+ declare const CUSTOM_FIELDS_MAX = 20;
5800
+ declare const CUSTOM_FIELD_KEY_PATTERN: RegExp;
5801
+ declare const ALL_CUSTOM_FIELD_TYPES: readonly CustomFieldType[];
5802
+ declare function parseCustomFieldsLoose(raw: unknown): CheckoutCustomField[] | null;
5803
+ declare function decodeCustomFields(raw: string | undefined): CheckoutCustomField[] | null;
5804
+ declare function encodeCustomFields(fields: CheckoutCustomField[]): string;
5805
+ declare function customFieldText(field: CheckoutCustomField, part: 'label' | 'placeholder' | 'helpText', locale?: string): string;
5806
+ declare function customFieldOptionLabel(option: CustomFieldOption, locale?: string): string;
5773
5807
  declare function decodeBranding(source: BrandingSource | null | undefined): CheckoutBranding;
5774
5808
  interface EncodedBranding {
5775
5809
  theme: string;
@@ -5800,4 +5834,4 @@ declare function parseImportedBranding(raw: unknown): CheckoutBranding;
5800
5834
  declare function applyBrandingVariables(el: HTMLElement, b: CheckoutBranding): void;
5801
5835
  declare function shadowFor(style: SurfaceStyle): string;
5802
5836
 
5803
- export { type AddUserRequest, type AddUserResponse, type Address, type AddressDetails, type AllocationListResponse, type AllocationResponse, type AllocationTransferRequest, type AllocationTransferResponse, Analytics, type AnalyticsChild, type AnalyticsConnectorDay, type AnalyticsConnectorSeries, AnalyticsDashboard, type AnalyticsDayBucket, type AnalyticsMethodSlice, type AnalyticsScopeRequest, type AnalyticsScopeResponse, type ApiKeyCreateRequest, type ApiKeyCreateResponse, type ApiKeyExpiration, type ApiKeyListConstraints, type ApiKeyResponse, type ApiKeyRevokeResponse, type ApiKeyUpdateRequest, type ApplePayVerificationRequest, type ApplePayVerificationResponse, type ApplePayVerifiedDomainsResponse, type AttemptStatus, type AuthResponse, type AuthenticationCreateRequest, type AuthenticationResponse, type AuthenticationStatus, type AuthenticationType, type AutoRechargeConfig, type AutoRechargeUpdateRequest, type AvailabilityOverrideCreateRequest, type AvailabilityOverrideResponse, AvailabilityOverrides, type AvailabilityPreviewMethod, type AvailabilityPreviewParams, type AvailabilityPreviewResponse, BRANDING_EXPORT_FORMAT, BRANDING_EXPORT_VERSION, type BillingCompleteSetupRequest, type BillingProfileResponse, type BillingSetupRequest, type BillingSetupResponse, type BlockedAttempt, type BlockedAttemptListParams, type BlockedAttemptListResponse, type BlocklistAddRequest, type BlocklistDataKind, type BlocklistResponse, type BrandingExport, type BrandingSource, type BuiltInRegionGroupResponse, type BusinessPaymentLinkConfig, CUSTOM_CSS_MAX_LENGTH, type CancelSubscriptionRequest, type CancelSubscriptionResponse, type CaptureMethod, type CardDetail, type CardDetailFromLocker, Cards, type ChangePasswordRequest, type CheckoutBranding, type ConditionNode, type ConfirmSubscriptionPaymentDetails, type ConfirmSubscriptionRequest, type ConfirmSubscriptionResponse, type Connector, type ConnectorCloneRequest, type ConnectorCreateRequest, type ConnectorListResponse, type ConnectorResponse, type ConnectorSelection, type ConnectorType, type ConnectorUpdateRequest, type ConnectorVolumeSplit, type ConnectorWebhookEntry, type ConnectorWebhookEventType, type ConnectorWebhookListResponse, type ConnectorWebhookRegisterRequest, type ConnectorWebhookRegisterResponse, type CornerRadius, type CreateAndConfirmSubscriptionRequest, type CreateSubscriptionPaymentDetails, type CreateSubscriptionRequest, type Currency, type CurrencyRevenue, type CustomerCreateRequest, type CustomerListParams, type CustomerPaymentMethodsListParams, type CustomerPaymentMethodsListResponse, type CustomerResponse, type CustomerUpdateRequest, DEFAULT_BADGES, DEFAULT_BADGES_DARK, DEFAULT_BRANDING, DEFAULT_BRANDING_DARK, type DeleteAccountRequest, type DeleteUserRoleRequest, Delopay, DelopayAuthenticationError, DelopayError, type DelopayLogger, type DelopayOptions, type DisputeEvidenceBlock, type DisputeEvidenceRequest, type DisputeEvidenceType, type DisputeListParams, type DisputeResponse, type DisputeStage, type DisputeStatus, type EncodedBranding, type EphemeralKeyCreateRequest, type EphemeralKeyCreateResponse, type EuclidComparison, type EuclidComparisonType, type EuclidIfStatement, type EuclidValue, type EventClass, type EventDeliveryAttemptResponse, type EventDetailResponse, type EventListParams, type EventListResponse, type EventResponse, type EventType, Export, FeatureMatrix, type FeeOwner, FeeProgramBuilder, type FeeRuleConditions, type FeeRuleInput, type FeeRulePreviewRequest, type FeeRulePreviewResponse, type FeeScheduleCreateRequest, type FeeScheduleResponse, type FeeScheduleUpdateRequest, type FeeSpecInput, type FeeType, Files, type FontFamily, type FontWeight, Forex, type ForgotPasswordRequest, type FromEmailRequest, type FutureUsage, type GatewayConnectRequest, type GatewayResponse, type GetSubscriptionItemsParams, type GetSubscriptionItemsResponse, type GlobalSearchRequest, type GroupNode, type ImpersonateEmployeeRequest, type IntentStatus, type InviteUsersRequest, type InviteUsersResponse, type InvoiceStatus, type LabelStyle, type LayoutStyle, type LeafNode, type LedgerEntry, type LedgerListParams, type LedgerResponse, type LinkedRoutingConfigRetrieveResponse, type ListInvitableRolesParams, type ListUsersInLineageParams, type LoginHistoryEntry, type LoginHistoryParams, type LoginHistoryResponse, type LogoShape, type LogoSize, type MandateListParams, type MandateResponse, type MandateRevokedResponse, type MandateStatus, type MandateType, type MerchantAccountCreateRequest, type MerchantAccountResponse, type MerchantAccountType, type MerchantAccountUpdateRequest, type MerchantOverviewResponse, type MerchantOverviewStat, type MerchantRoutingAlgorithm, type MethodSurcharge, type MinimalRoleInfo, type NonPillRadius, type OverrideAction, type OverrideScope, type ParentGroup, type ParentGroupInfo, type PauseSubscriptionRequest, type PauseSubscriptionResponse, type PaymentAttemptResponse, type PaymentAttemptsListResponse, type PaymentCancelRequest, type PaymentCaptureRequest, type PaymentConfirmRequest, type PaymentCreateRequest, type PaymentErrorDetails, type PaymentExperience, type PaymentIdFormatConfig, type PaymentIdStyle, type PaymentIntentStateMetadata, type PaymentLayout, type PaymentLinkBackgroundImageConfig, type PaymentLinkConfigRequest, type PaymentLinkListParams, type PaymentLinkListResponse, type PaymentLinkResponse, type PaymentLinkTransactionDetails, type PaymentListParams, type PaymentListResponse, type PaymentMethod, type PaymentMethodCreateRequest, type PaymentMethodDeleteResponse, type PaymentMethodListParams, type PaymentMethodResponse, type PaymentMethodType, type PaymentMethodUpdateRequest, type PaymentResponse, type PaymentRetrieveOptions, type PaymentStatusHistoryEntityType, type PaymentStatusHistoryEvent, type PaymentStatusHistoryResponse, type PaymentUpdateRequest, type PayoutCreateRequest, type PayoutListParams, type PayoutListResponse, type PayoutResponse, type PayoutStatus, type PayoutType, type PayoutUpdateRequest, type PerMethodSurchargeItem, type PermissionScope, type PhoneDetails, type PhoneOtpRequest, type PhoneOtpResponse, type PhoneOtpVerifyRequest, type PhoneOtpVerifyResponse, type PlatformFeeKind, type PlatformFeeOutput, type PlatformFeeProgram, type PlatformFeeRule, type PlatformFeeRuleInput, type PlatformFeeRuleOutput, type PlatformFeeRuleRecord, type PlatformFeeRuleRequest, type PollStatus, type PollStatusResponse, type ProfileAcquirerCreateRequest, type ProfileAcquirerResponse, type ProfileAcquirerUpdateRequest, type ProfileCreateRequest, type ProfileDefaultRoutingConfig, type ProfileDeniedConnectorsResponse, type ProfileLogoUploadResponse, type ProfileResponse, type ProfileUpdateRequest, type ProgramConnectorSelection, type ProjectCreateRequest, type ProjectResponse, type ProjectStats, type ProjectStatsResponse, type ProjectUpdateRequest, type RecoveryCodesResponse, type RefundAggregateResponse, type RefundCreateRequest, type RefundListParams, type RefundListResponse, type RefundResponse, type RefundStatus, type RefundType, type RefundUpdateRequest, type RegionCountriesResponse, type RegionCreateRequest, type RegionResponse, type RegionSetCountriesRequest, type RegionUpdateRequest, Regions, type RelayRequest, type RelayResponse, type RelayStatus, type RelayType, type RequestExtras, type RequestFn, type RequestOptions, type ResetPasswordRequest, type ResumeSubscriptionRequest, type ResumeSubscriptionResponse, type RoutableConnectorChoice, type RoutingActivatePayload, type RoutingConfigCreateRequest, type RoutingConfigResponse, type RoutingDeactivateRequest, type RoutingDictionary, type RoutingDictionaryRecord, type RuleConnectorSelection, Search, type SearchGroupResponse, type SearchIndex, type SearchStatus, type ShopCreateRequest, type ShopResponse, type ShopStats, type ShopStatsResponse, type ShopUpdateRequest, type SignInRequest, type SignUpRequest, type SignUpWithMerchantIdRequest, type SignUpWithMerchantRequest, type SizeScale, type SpacingScale, type StaticRoutingAlgorithm, type StatsPeriod, type StripeConnectAccountRequest, type StripeConnectAccountResponse, type StripeConnectLinkRequest, type StripeConnectLinkResponse, type SubscriptionEstimateParams, type SubscriptionEstimateResponse, type SubscriptionInvoice, type SubscriptionItem, type SubscriptionItemPrice, type SubscriptionItemType, type SubscriptionLineItem, type SubscriptionListParams, type SubscriptionPaymentData, type SubscriptionPaymentDetails, type SubscriptionPeriodUnit, type SubscriptionResponse, type SubscriptionStatus, Subscriptions, type SummaryPosition, type SurchargeRuleRequest, type SurchargeRuleResponse, type SurfaceStyle, type SwitchMerchantRequest, type SwitchProfileRequest, type Terminate2faQueryParams, type ThreeDSDecision, type ThreeDsRuleExecuteRequest, type ThreeDsRuleResponse, type TierSummary, type TokenPurpose, type TokenResponse, type TopupRequest, type TopupResponse, type TotpResponse, type TransactionType, type TrustBadge, type UpdateSubscriptionRequest, type UpdateUserDetailsRequest, type UpdateUserRoleRequest, type UserInLineage, type UserResponse, type UserSessionEntry, type UserSessionListResponse, type UserSessionRevokeResponse, type VerifyTotpRequest, type WebhookDeliveryAttempt, type WebhookEvent, type WebhookRegistrationEnvironment, Webhooks, allOf, anyOf, applyBrandingVariables, buildBrandingExport, buttonPadValue, cloneBranding, decodeBadges, decodeBranding, defaultBranding, encodeBadges, encodeBranding, feeProgram, fontStack, fontWeightValue, inputPadValue, isDarkSurface, isHexColor, leaf, logoDimensions, parseImportedBranding, programToTree, radiusValue, ruleMatchToTree, sanitizeCustomCss, shadowFor, surfacePadValue, verticalGapValue };
5837
+ export { ALL_CUSTOM_FIELD_TYPES, type AddUserRequest, type AddUserResponse, type Address, type AddressDetails, type AllocationListResponse, type AllocationResponse, type AllocationTransferRequest, type AllocationTransferResponse, Analytics, type AnalyticsChild, type AnalyticsConnectorDay, type AnalyticsConnectorSeries, AnalyticsDashboard, type AnalyticsDayBucket, type AnalyticsMethodSlice, type AnalyticsScopeRequest, type AnalyticsScopeResponse, type ApiKeyCreateRequest, type ApiKeyCreateResponse, type ApiKeyExpiration, type ApiKeyListConstraints, type ApiKeyResponse, type ApiKeyRevokeResponse, type ApiKeyUpdateRequest, type ApplePayVerificationRequest, type ApplePayVerificationResponse, type ApplePayVerifiedDomainsResponse, type AttemptStatus, type AuthResponse, type AuthenticationCreateRequest, type AuthenticationResponse, type AuthenticationStatus, type AuthenticationType, type AutoRechargeConfig, type AutoRechargeUpdateRequest, type AvailabilityOverrideCreateRequest, type AvailabilityOverrideResponse, AvailabilityOverrides, type AvailabilityPreviewMethod, type AvailabilityPreviewParams, type AvailabilityPreviewResponse, BRANDING_EXPORT_FORMAT, BRANDING_EXPORT_VERSION, type BillingCompleteSetupRequest, type BillingProfileResponse, type BillingSetupRequest, type BillingSetupResponse, type BlockedAttempt, type BlockedAttemptListParams, type BlockedAttemptListResponse, type BlocklistAddRequest, type BlocklistDataKind, type BlocklistResponse, type BrandingExport, type BrandingSource, type BuiltInRegionGroupResponse, type BusinessPaymentLinkConfig, CUSTOM_CSS_MAX_LENGTH, CUSTOM_FIELDS_MAX, CUSTOM_FIELD_KEY_PATTERN, type CancelSubscriptionRequest, type CancelSubscriptionResponse, type CaptureMethod, type CardDetail, type CardDetailFromLocker, Cards, type ChangePasswordRequest, type CheckoutBranding, type CheckoutCustomField, type ConditionNode, type ConfirmSubscriptionPaymentDetails, type ConfirmSubscriptionRequest, type ConfirmSubscriptionResponse, type Connector, type ConnectorCloneRequest, type ConnectorCreateRequest, type ConnectorListResponse, type ConnectorResponse, type ConnectorSelection, type ConnectorType, type ConnectorUpdateRequest, type ConnectorVolumeSplit, type ConnectorWebhookEntry, type ConnectorWebhookEventType, type ConnectorWebhookListResponse, type ConnectorWebhookRegisterRequest, type ConnectorWebhookRegisterResponse, type CornerRadius, type CreateAndConfirmSubscriptionRequest, type CreateSubscriptionPaymentDetails, type CreateSubscriptionRequest, type Currency, type CurrencyRevenue, type CustomFieldOption, type CustomFieldTranslations, type CustomFieldType, type CustomerCreateRequest, type CustomerListParams, type CustomerPaymentMethodsListParams, type CustomerPaymentMethodsListResponse, type CustomerResponse, type CustomerUpdateRequest, DEFAULT_BADGES, DEFAULT_BADGES_DARK, DEFAULT_BRANDING, DEFAULT_BRANDING_DARK, type DeleteAccountRequest, type DeleteUserRoleRequest, Delopay, DelopayAuthenticationError, DelopayError, type DelopayLogger, type DelopayOptions, type DisputeEvidenceBlock, type DisputeEvidenceRequest, type DisputeEvidenceType, type DisputeListParams, type DisputeResponse, type DisputeStage, type DisputeStatus, type EncodedBranding, type EphemeralKeyCreateRequest, type EphemeralKeyCreateResponse, type EuclidComparison, type EuclidComparisonType, type EuclidIfStatement, type EuclidValue, type EventClass, type EventDeliveryAttemptResponse, type EventDetailResponse, type EventListParams, type EventListResponse, type EventResponse, type EventType, Export, FeatureMatrix, type FeeOwner, FeeProgramBuilder, type FeeRuleConditions, type FeeRuleInput, type FeeRulePreviewRequest, type FeeRulePreviewResponse, type FeeScheduleCreateRequest, type FeeScheduleResponse, type FeeScheduleUpdateRequest, type FeeSpecInput, type FeeType, Files, type FontFamily, type FontWeight, Forex, type ForgotPasswordRequest, type FromEmailRequest, type FutureUsage, type GatewayConnectRequest, type GatewayResponse, type GetSubscriptionItemsParams, type GetSubscriptionItemsResponse, type GlobalSearchRequest, type GroupNode, type ImpersonateEmployeeRequest, type IntentStatus, type InviteUsersRequest, type InviteUsersResponse, type InvoiceStatus, type LabelStyle, type LayoutStyle, type LeafNode, type LedgerEntry, type LedgerListParams, type LedgerResponse, type LinkedRoutingConfigRetrieveResponse, type ListInvitableRolesParams, type ListUsersInLineageParams, type LoginHistoryEntry, type LoginHistoryParams, type LoginHistoryResponse, type LogoShape, type LogoSize, type MandateListParams, type MandateResponse, type MandateRevokedResponse, type MandateStatus, type MandateType, type MerchantAccountCreateRequest, type MerchantAccountResponse, type MerchantAccountType, type MerchantAccountUpdateRequest, type MerchantOverviewResponse, type MerchantOverviewStat, type MerchantRoutingAlgorithm, type MethodSurcharge, type MinimalRoleInfo, type NonPillRadius, type OverrideAction, type OverrideScope, type ParentGroup, type ParentGroupInfo, type PauseSubscriptionRequest, type PauseSubscriptionResponse, type PaymentAttemptResponse, type PaymentAttemptsListResponse, type PaymentCancelRequest, type PaymentCaptureRequest, type PaymentConfirmRequest, type PaymentCreateRequest, type PaymentErrorDetails, type PaymentExperience, type PaymentIdFormatConfig, type PaymentIdStyle, type PaymentIntentStateMetadata, type PaymentLayout, type PaymentLinkBackgroundImageConfig, type PaymentLinkConfigRequest, type PaymentLinkListParams, type PaymentLinkListResponse, type PaymentLinkResponse, type PaymentLinkTransactionDetails, type PaymentListParams, type PaymentListResponse, type PaymentMethod, type PaymentMethodCreateRequest, type PaymentMethodDeleteResponse, type PaymentMethodListParams, type PaymentMethodResponse, type PaymentMethodType, type PaymentMethodUpdateRequest, type PaymentResponse, type PaymentRetrieveOptions, type PaymentStatusHistoryEntityType, type PaymentStatusHistoryEvent, type PaymentStatusHistoryResponse, type PaymentUpdateRequest, type PayoutCreateRequest, type PayoutListParams, type PayoutListResponse, type PayoutResponse, type PayoutStatus, type PayoutType, type PayoutUpdateRequest, type PerMethodSurchargeItem, type PermissionScope, type PhoneDetails, type PhoneOtpRequest, type PhoneOtpResponse, type PhoneOtpVerifyRequest, type PhoneOtpVerifyResponse, type PlatformFeeKind, type PlatformFeeOutput, type PlatformFeeProgram, type PlatformFeeRule, type PlatformFeeRuleInput, type PlatformFeeRuleOutput, type PlatformFeeRuleRecord, type PlatformFeeRuleRequest, type PollStatus, type PollStatusResponse, type ProfileAcquirerCreateRequest, type ProfileAcquirerResponse, type ProfileAcquirerUpdateRequest, type ProfileCreateRequest, type ProfileDefaultRoutingConfig, type ProfileDeniedConnectorsResponse, type ProfileLogoUploadResponse, type ProfileResponse, type ProfileUpdateRequest, type ProgramConnectorSelection, type ProjectCreateRequest, type ProjectResponse, type ProjectStats, type ProjectStatsResponse, type ProjectUpdateRequest, type RecoveryCodesResponse, type RefundAggregateResponse, type RefundCreateRequest, type RefundListParams, type RefundListResponse, type RefundResponse, type RefundStatus, type RefundType, type RefundUpdateRequest, type RegionCountriesResponse, type RegionCreateRequest, type RegionResponse, type RegionSetCountriesRequest, type RegionUpdateRequest, Regions, type RelayRequest, type RelayResponse, type RelayStatus, type RelayType, type RequestExtras, type RequestFn, type RequestOptions, type ResetPasswordRequest, type ResumeSubscriptionRequest, type ResumeSubscriptionResponse, type RoutableConnectorChoice, type RoutingActivatePayload, type RoutingConfigCreateRequest, type RoutingConfigResponse, type RoutingDeactivateRequest, type RoutingDictionary, type RoutingDictionaryRecord, type RuleConnectorSelection, Search, type SearchGroupResponse, type SearchIndex, type SearchStatus, type ShopCreateRequest, type ShopResponse, type ShopStats, type ShopStatsResponse, type ShopUpdateRequest, type SignInRequest, type SignUpRequest, type SignUpWithMerchantIdRequest, type SignUpWithMerchantRequest, type SizeScale, type SpacingScale, type StaticRoutingAlgorithm, type StatsPeriod, type StripeConnectAccountRequest, type StripeConnectAccountResponse, type StripeConnectLinkRequest, type StripeConnectLinkResponse, type SubscriptionEstimateParams, type SubscriptionEstimateResponse, type SubscriptionInvoice, type SubscriptionItem, type SubscriptionItemPrice, type SubscriptionItemType, type SubscriptionLineItem, type SubscriptionListParams, type SubscriptionPaymentData, type SubscriptionPaymentDetails, type SubscriptionPeriodUnit, type SubscriptionResponse, type SubscriptionStatus, Subscriptions, type SummaryPosition, type SurchargeRuleRequest, type SurchargeRuleResponse, type SurfaceStyle, type SwitchMerchantRequest, type SwitchProfileRequest, type Terminate2faQueryParams, type ThreeDSDecision, type ThreeDsRuleExecuteRequest, type ThreeDsRuleResponse, type TierSummary, type TokenPurpose, type TokenResponse, type TopupRequest, type TopupResponse, type TotpResponse, type TransactionType, type TrustBadge, type UpdateSubscriptionRequest, type UpdateUserDetailsRequest, type UpdateUserRoleRequest, type UserInLineage, type UserResponse, type UserSessionEntry, type UserSessionListResponse, type UserSessionRevokeResponse, type VerifyTotpRequest, type WebhookDeliveryAttempt, type WebhookEvent, type WebhookRegistrationEnvironment, Webhooks, allOf, anyOf, applyBrandingVariables, buildBrandingExport, buttonPadValue, cloneBranding, cloneCustomField, customFieldOptionLabel, customFieldText, decodeBadges, decodeBranding, decodeCustomFields, defaultBranding, encodeBadges, encodeBranding, encodeCustomFields, feeProgram, fontStack, fontWeightValue, inputPadValue, isDarkSurface, isHexColor, leaf, logoDimensions, parseCustomFieldsLoose, parseImportedBranding, programToTree, radiusValue, ruleMatchToTree, sanitizeCustomCss, shadowFor, surfacePadValue, verticalGapValue };
package/dist/index.js CHANGED
@@ -1,10 +1,13 @@
1
1
  import {
2
+ ALL_CUSTOM_FIELD_TYPES,
2
3
  Analytics,
3
4
  AnalyticsDashboard,
4
5
  AvailabilityOverrides,
5
6
  BRANDING_EXPORT_FORMAT,
6
7
  BRANDING_EXPORT_VERSION,
7
8
  CUSTOM_CSS_MAX_LENGTH,
9
+ CUSTOM_FIELDS_MAX,
10
+ CUSTOM_FIELD_KEY_PATTERN,
8
11
  Cards,
9
12
  DEFAULT_BADGES,
10
13
  DEFAULT_BADGES_DARK,
@@ -28,11 +31,16 @@ import {
28
31
  buildBrandingExport,
29
32
  buttonPadValue,
30
33
  cloneBranding,
34
+ cloneCustomField,
35
+ customFieldOptionLabel,
36
+ customFieldText,
31
37
  decodeBadges,
32
38
  decodeBranding,
39
+ decodeCustomFields,
33
40
  defaultBranding,
34
41
  encodeBadges,
35
42
  encodeBranding,
43
+ encodeCustomFields,
36
44
  feeProgram,
37
45
  fontStack,
38
46
  fontWeightValue,
@@ -41,6 +49,7 @@ import {
41
49
  isHexColor,
42
50
  leaf,
43
51
  logoDimensions,
52
+ parseCustomFieldsLoose,
44
53
  parseImportedBranding,
45
54
  programToTree,
46
55
  radiusValue,
@@ -49,14 +58,17 @@ import {
49
58
  shadowFor,
50
59
  surfacePadValue,
51
60
  verticalGapValue
52
- } from "./chunk-ASCCS4NN.js";
61
+ } from "./chunk-RGA6KEKL.js";
53
62
  export {
63
+ ALL_CUSTOM_FIELD_TYPES,
54
64
  Analytics,
55
65
  AnalyticsDashboard,
56
66
  AvailabilityOverrides,
57
67
  BRANDING_EXPORT_FORMAT,
58
68
  BRANDING_EXPORT_VERSION,
59
69
  CUSTOM_CSS_MAX_LENGTH,
70
+ CUSTOM_FIELDS_MAX,
71
+ CUSTOM_FIELD_KEY_PATTERN,
60
72
  Cards,
61
73
  DEFAULT_BADGES,
62
74
  DEFAULT_BADGES_DARK,
@@ -80,11 +92,16 @@ export {
80
92
  buildBrandingExport,
81
93
  buttonPadValue,
82
94
  cloneBranding,
95
+ cloneCustomField,
96
+ customFieldOptionLabel,
97
+ customFieldText,
83
98
  decodeBadges,
84
99
  decodeBranding,
100
+ decodeCustomFields,
85
101
  defaultBranding,
86
102
  encodeBadges,
87
103
  encodeBranding,
104
+ encodeCustomFields,
88
105
  feeProgram,
89
106
  fontStack,
90
107
  fontWeightValue,
@@ -93,6 +110,7 @@ export {
93
110
  isHexColor,
94
111
  leaf,
95
112
  logoDimensions,
113
+ parseCustomFieldsLoose,
96
114
  parseImportedBranding,
97
115
  programToTree,
98
116
  radiusValue,
package/dist/internal.cjs CHANGED
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/internal.ts
21
21
  var internal_exports = {};
22
22
  __export(internal_exports, {
23
+ ALL_CUSTOM_FIELD_TYPES: () => ALL_CUSTOM_FIELD_TYPES,
23
24
  Admin: () => Admin,
24
25
  AdminPortal: () => AdminPortal,
25
26
  Analytics: () => Analytics,
@@ -29,6 +30,8 @@ __export(internal_exports, {
29
30
  BRANDING_EXPORT_FORMAT: () => BRANDING_EXPORT_FORMAT,
30
31
  BRANDING_EXPORT_VERSION: () => BRANDING_EXPORT_VERSION,
31
32
  CUSTOM_CSS_MAX_LENGTH: () => CUSTOM_CSS_MAX_LENGTH,
33
+ CUSTOM_FIELDS_MAX: () => CUSTOM_FIELDS_MAX,
34
+ CUSTOM_FIELD_KEY_PATTERN: () => CUSTOM_FIELD_KEY_PATTERN,
32
35
  Cache: () => Cache,
33
36
  CardIssuers: () => CardIssuers,
34
37
  Cards: () => Cards,
@@ -61,11 +64,16 @@ __export(internal_exports, {
61
64
  buildBrandingExport: () => buildBrandingExport,
62
65
  buttonPadValue: () => buttonPadValue,
63
66
  cloneBranding: () => cloneBranding,
67
+ cloneCustomField: () => cloneCustomField,
68
+ customFieldOptionLabel: () => customFieldOptionLabel,
69
+ customFieldText: () => customFieldText,
64
70
  decodeBadges: () => decodeBadges,
65
71
  decodeBranding: () => decodeBranding,
72
+ decodeCustomFields: () => decodeCustomFields,
66
73
  defaultBranding: () => defaultBranding,
67
74
  encodeBadges: () => encodeBadges,
68
75
  encodeBranding: () => encodeBranding,
76
+ encodeCustomFields: () => encodeCustomFields,
69
77
  feeProgram: () => feeProgram,
70
78
  fontStack: () => fontStack,
71
79
  fontWeightValue: () => fontWeightValue,
@@ -74,6 +82,7 @@ __export(internal_exports, {
74
82
  isHexColor: () => isHexColor,
75
83
  leaf: () => leaf,
76
84
  logoDimensions: () => logoDimensions,
85
+ parseCustomFieldsLoose: () => parseCustomFieldsLoose,
77
86
  parseImportedBranding: () => parseImportedBranding,
78
87
  programToTree: () => programToTree,
79
88
  radiusValue: () => radiusValue,
@@ -3959,7 +3968,8 @@ var DEFAULT_BRANDING_BASE = {
3959
3968
  var DEFAULT_BRANDING = {
3960
3969
  ...DEFAULT_BRANDING_BASE,
3961
3970
  ...LIGHT_PALETTE,
3962
- trustBadges: DEFAULT_BADGES.map((b) => ({ ...b }))
3971
+ trustBadges: DEFAULT_BADGES.map((b) => ({ ...b })),
3972
+ customFields: []
3963
3973
  };
3964
3974
  var DEFAULT_BRANDING_DARK = {
3965
3975
  ...DEFAULT_BRANDING_BASE,
@@ -3974,13 +3984,27 @@ var DEFAULT_BRANDING_DARK = {
3974
3984
  buttonBackground: "#1E4FEB",
3975
3985
  buttonText: "#ffffff",
3976
3986
  surfaceStyle: "flat",
3977
- trustBadges: DEFAULT_BADGES_DARK.map((b) => ({ ...b }))
3987
+ trustBadges: DEFAULT_BADGES_DARK.map((b) => ({ ...b })),
3988
+ customFields: []
3978
3989
  };
3979
3990
  function defaultBranding() {
3980
3991
  return cloneBranding(DEFAULT_BRANDING);
3981
3992
  }
3982
3993
  function cloneBranding(b) {
3983
- return { ...b, trustBadges: b.trustBadges.map((badge) => ({ ...badge })) };
3994
+ return {
3995
+ ...b,
3996
+ trustBadges: b.trustBadges.map((badge) => ({ ...badge })),
3997
+ customFields: b.customFields.map(cloneCustomField)
3998
+ };
3999
+ }
4000
+ function cloneCustomField(f) {
4001
+ return {
4002
+ ...f,
4003
+ labelTranslations: { ...f.labelTranslations },
4004
+ placeholderTranslations: { ...f.placeholderTranslations },
4005
+ helpTextTranslations: { ...f.helpTextTranslations },
4006
+ options: f.options.map((o) => ({ ...o, labelTranslations: { ...o.labelTranslations } }))
4007
+ };
3984
4008
  }
3985
4009
  var CUSTOM_CSS_MAX_LENGTH = 5e4;
3986
4010
  function sanitizeCustomCss(raw) {
@@ -4058,10 +4082,135 @@ function encodeBadges(badges) {
4058
4082
  }))
4059
4083
  );
4060
4084
  }
4085
+ var CUSTOM_FIELDS_MAX = 20;
4086
+ var CUSTOM_FIELD_KEY_PATTERN = /^[A-Za-z][A-Za-z0-9_-]{0,39}$/;
4087
+ var ALL_CUSTOM_FIELD_TYPES = [
4088
+ "text",
4089
+ "textarea",
4090
+ "password",
4091
+ "email",
4092
+ "select"
4093
+ ];
4094
+ function parseTranslations(raw) {
4095
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return {};
4096
+ const out = {};
4097
+ for (const [k, v] of Object.entries(raw)) {
4098
+ if (typeof v === "string" && v.length > 0) out[k] = v;
4099
+ }
4100
+ return out;
4101
+ }
4102
+ function parseBoundedInt(raw) {
4103
+ const n = typeof raw === "number" ? raw : typeof raw === "string" ? Number(raw) : NaN;
4104
+ if (!Number.isInteger(n) || n < 0) return null;
4105
+ return Math.min(n, 5e3);
4106
+ }
4107
+ function normalizeCustomField(raw, index) {
4108
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return null;
4109
+ const f = raw;
4110
+ const key = typeof f["key"] === "string" ? f["key"].trim() : "";
4111
+ if (!CUSTOM_FIELD_KEY_PATTERN.test(key)) return null;
4112
+ const type = pickEnum(f["type"], ALL_CUSTOM_FIELD_TYPES, "text");
4113
+ const options = type === "select" && Array.isArray(f["options"]) ? f["options"].filter((o) => !!o && typeof o === "object").map((o) => {
4114
+ const value = typeof o["value"] === "string" ? o["value"] : "";
4115
+ return {
4116
+ value,
4117
+ label: typeof o["label"] === "string" && o["label"] ? o["label"] : value,
4118
+ labelTranslations: parseTranslations(o["labelTranslations"])
4119
+ };
4120
+ }).filter((o) => o.value.length > 0) : [];
4121
+ const minLength = parseBoundedInt(f["minLength"]);
4122
+ const maxLength = parseBoundedInt(f["maxLength"]);
4123
+ return {
4124
+ id: typeof f["id"] === "string" && f["id"] ? f["id"] : `field-${index}`,
4125
+ key,
4126
+ type,
4127
+ label: typeof f["label"] === "string" && f["label"] ? f["label"] : key,
4128
+ labelTranslations: parseTranslations(f["labelTranslations"]),
4129
+ placeholder: typeof f["placeholder"] === "string" ? f["placeholder"] : "",
4130
+ placeholderTranslations: parseTranslations(f["placeholderTranslations"]),
4131
+ helpText: typeof f["helpText"] === "string" ? f["helpText"] : "",
4132
+ helpTextTranslations: parseTranslations(f["helpTextTranslations"]),
4133
+ required: parseBool(f["required"], false),
4134
+ enabled: parseBool(f["enabled"], true),
4135
+ minLength,
4136
+ // Guard inverted bounds at decode so consumers never see min > max.
4137
+ maxLength: maxLength !== null && minLength !== null && maxLength < minLength ? null : maxLength,
4138
+ defaultValue: typeof f["defaultValue"] === "string" ? f["defaultValue"] : "",
4139
+ options
4140
+ };
4141
+ }
4142
+ function parseCustomFieldsLoose(raw) {
4143
+ if (!Array.isArray(raw)) return null;
4144
+ const seen = /* @__PURE__ */ new Set();
4145
+ const out = [];
4146
+ for (let i = 0; i < raw.length && out.length < CUSTOM_FIELDS_MAX; i++) {
4147
+ const field = normalizeCustomField(raw[i], i);
4148
+ if (!field || seen.has(field.key)) continue;
4149
+ seen.add(field.key);
4150
+ out.push(field);
4151
+ }
4152
+ return out;
4153
+ }
4154
+ function decodeCustomFields(raw) {
4155
+ if (raw === void 0) return null;
4156
+ try {
4157
+ return parseCustomFieldsLoose(JSON.parse(raw));
4158
+ } catch {
4159
+ return null;
4160
+ }
4161
+ }
4162
+ function encodeCustomFields(fields) {
4163
+ const nonEmpty = (m) => {
4164
+ const entries = Object.entries(m).filter(([, v]) => v.trim().length > 0);
4165
+ return entries.length > 0 ? Object.fromEntries(entries) : void 0;
4166
+ };
4167
+ return JSON.stringify(
4168
+ fields.map((f) => ({
4169
+ id: f.id,
4170
+ key: f.key,
4171
+ type: f.type,
4172
+ label: f.label,
4173
+ ...nonEmpty(f.labelTranslations) ? { labelTranslations: nonEmpty(f.labelTranslations) } : {},
4174
+ ...f.placeholder ? { placeholder: f.placeholder } : {},
4175
+ ...nonEmpty(f.placeholderTranslations) ? { placeholderTranslations: nonEmpty(f.placeholderTranslations) } : {},
4176
+ ...f.helpText ? { helpText: f.helpText } : {},
4177
+ ...nonEmpty(f.helpTextTranslations) ? { helpTextTranslations: nonEmpty(f.helpTextTranslations) } : {},
4178
+ ...f.required ? { required: true } : {},
4179
+ ...f.enabled ? {} : { enabled: false },
4180
+ ...f.minLength !== null ? { minLength: f.minLength } : {},
4181
+ ...f.maxLength !== null ? { maxLength: f.maxLength } : {},
4182
+ ...f.defaultValue ? { defaultValue: f.defaultValue } : {},
4183
+ ...f.type === "select" ? { options: f.options } : {}
4184
+ }))
4185
+ );
4186
+ }
4187
+ function translationFor(map, locale) {
4188
+ if (!locale) return null;
4189
+ const own = (k) => {
4190
+ const v = Object.prototype.hasOwnProperty.call(map, k) ? map[k] : void 0;
4191
+ return typeof v === "string" && v.length > 0 ? v : null;
4192
+ };
4193
+ const exact = own(locale);
4194
+ if (exact) return exact;
4195
+ const base = locale.split("-")[0];
4196
+ return base && base !== locale ? own(base) : null;
4197
+ }
4198
+ function customFieldText(field, part, locale) {
4199
+ const map = part === "label" ? field.labelTranslations : part === "placeholder" ? field.placeholderTranslations : field.helpTextTranslations;
4200
+ const translated = translationFor(map, locale);
4201
+ if (translated) return translated;
4202
+ const fallback = field[part];
4203
+ if (fallback) return fallback;
4204
+ return part === "label" ? field.key : "";
4205
+ }
4206
+ function customFieldOptionLabel(option, locale) {
4207
+ return translationFor(option.labelTranslations, locale) ?? (option.label || option.value);
4208
+ }
4061
4209
  function decodeBranding(source) {
4062
4210
  if (!source) return cloneBranding(DEFAULT_BRANDING);
4063
4211
  const extras = source.sdk_ui_rules?.[BRANDING_GROUP_KEY] ?? {};
4064
4212
  const decodedBadges = decodeBadges(extras["trustBadges"]);
4213
+ const decodedCustomFields = decodeCustomFields(extras["customFields"]);
4065
4214
  const displayName = s(source.merchant_name) || s(source.seller_name);
4066
4215
  const logoUrl = s(source.merchant_logo) || s(source.logo);
4067
4216
  const tagline = s(extras["tagline"]) || s(source.merchant_description);
@@ -4163,6 +4312,7 @@ function decodeBranding(source) {
4163
4312
  showCurrencyCode: parseBool(extras["showCurrencyCode"], DEFAULT_BRANDING.showCurrencyCode),
4164
4313
  showOrderItems: parseBool(extras["showOrderItems"], DEFAULT_BRANDING.showOrderItems),
4165
4314
  trustBadges: decodedBadges ?? DEFAULT_BRANDING.trustBadges.map((b) => ({ ...b })),
4315
+ customFields: decodedCustomFields ?? [],
4166
4316
  headerText: s(source.payment_form_header_text),
4167
4317
  payButtonLabel: s(source.payment_button_text),
4168
4318
  cardTermsMessage: s(source.custom_message_for_card_terms),
@@ -4216,6 +4366,9 @@ function encodeBranding(branding, base) {
4216
4366
  labelStyle: branding.labelStyle,
4217
4367
  trustBadges: encodeBadges(branding.trustBadges)
4218
4368
  };
4369
+ if (branding.customFields.length > 0) {
4370
+ extras["customFields"] = encodeCustomFields(branding.customFields);
4371
+ }
4219
4372
  const tagline = trim(branding.tagline);
4220
4373
  if (tagline) extras["tagline"] = tagline;
4221
4374
  const footer = trim(branding.footerText);
@@ -4266,6 +4419,7 @@ function parseImportedBranding(raw) {
4266
4419
  const sStr = (v, fallback) => typeof v === "string" ? v : fallback;
4267
4420
  const sHex = (v, fallback) => typeof v === "string" && isHexColor(v) ? v : fallback;
4268
4421
  const trustBadges = parseTrustBadgesLoose(root["trustBadges"]) ?? dflt.trustBadges.map((b) => ({ ...b }));
4422
+ const customFields = parseCustomFieldsLoose(root["customFields"]) ?? [];
4269
4423
  const labelStyle = (() => {
4270
4424
  const v = root["labelStyle"];
4271
4425
  if (v === "above" || v === "hidden") return v;
@@ -4336,6 +4490,7 @@ function parseImportedBranding(raw) {
4336
4490
  showCurrencyCode: parseBool(root["showCurrencyCode"], dflt.showCurrencyCode),
4337
4491
  showOrderItems: parseBool(root["showOrderItems"], dflt.showOrderItems),
4338
4492
  trustBadges,
4493
+ customFields,
4339
4494
  headerText: sStr(root["headerText"], dflt.headerText),
4340
4495
  payButtonLabel: sStr(root["payButtonLabel"], dflt.payButtonLabel),
4341
4496
  cardTermsMessage: sStr(root["cardTermsMessage"], dflt.cardTermsMessage),
@@ -4969,6 +5124,7 @@ var DelopayInternal = class extends Delopay {
4969
5124
  };
4970
5125
  // Annotate the CommonJS export names for ESM import in node:
4971
5126
  0 && (module.exports = {
5127
+ ALL_CUSTOM_FIELD_TYPES,
4972
5128
  Admin,
4973
5129
  AdminPortal,
4974
5130
  Analytics,
@@ -4978,6 +5134,8 @@ var DelopayInternal = class extends Delopay {
4978
5134
  BRANDING_EXPORT_FORMAT,
4979
5135
  BRANDING_EXPORT_VERSION,
4980
5136
  CUSTOM_CSS_MAX_LENGTH,
5137
+ CUSTOM_FIELDS_MAX,
5138
+ CUSTOM_FIELD_KEY_PATTERN,
4981
5139
  Cache,
4982
5140
  CardIssuers,
4983
5141
  Cards,
@@ -5010,11 +5168,16 @@ var DelopayInternal = class extends Delopay {
5010
5168
  buildBrandingExport,
5011
5169
  buttonPadValue,
5012
5170
  cloneBranding,
5171
+ cloneCustomField,
5172
+ customFieldOptionLabel,
5173
+ customFieldText,
5013
5174
  decodeBadges,
5014
5175
  decodeBranding,
5176
+ decodeCustomFields,
5015
5177
  defaultBranding,
5016
5178
  encodeBadges,
5017
5179
  encodeBranding,
5180
+ encodeCustomFields,
5018
5181
  feeProgram,
5019
5182
  fontStack,
5020
5183
  fontWeightValue,
@@ -5023,6 +5186,7 @@ var DelopayInternal = class extends Delopay {
5023
5186
  isHexColor,
5024
5187
  leaf,
5025
5188
  logoDimensions,
5189
+ parseCustomFieldsLoose,
5026
5190
  parseImportedBranding,
5027
5191
  programToTree,
5028
5192
  radiusValue,