@godaddy/react
Version:
The `createCheckoutSession` function creates a new checkout session with GoDaddy's commerce API.
626 lines (625 loc) • 28.1 kB
TypeScript
import { $ as SKUPrice, A as CheckoutType, B as PaymentMethodKey, C as CartTax, D as CheckoutSessionLocation, E as CheckoutSessionInput, F as DraftOrderSession, G as SKU, H as PaymentMethodValue, I as GetCheckoutSessionShippingRatesInput, J as SKUGroupAttribute, K as SKUAttributeValue, L as GetCheckoutSessionTaxesInput, M as DeleteLineItemByIdInput, N as DraftOrder, O as CheckoutSessionOptions, P as DraftOrderPriceAdjustmentsQueryInput, Q as SKUMedia, R as MutationVerifyAddress, S as CartShippingInfo, T as CheckoutSessionAuth, U as PaymentMethods, V as PaymentMethodType, W as PaymentProvider, X as SKUGroupSKU, Y as SKUGroupAttributeValue, Z as SKUInventoryCount, _ as CartLineItemDetails, _t as LinkComponentProps, a as ApplyCheckoutSessionDeliveryMethodInput, at as SkuInput, b as CartOrder, c as ApplyCheckoutSessionShippingMethodInput, ct as UpdateCartOrderInput, d as AvailablePaymentProviders, dt as CSSVariables, et as SKUProduct, f as CalculateCheckoutSessionTaxesInput, ft as GoDaddyAppearance, g as CartLineItem, gt as GoDaddyVariables, h as CartDiscount, ht as GoDaddyTheme, i as Address, it as SkuGroupsInput, j as ConfirmCheckoutMutationInput, k as CheckoutSessionResult, l as ApplyDiscountCodesInput, lt as UpdateDraftOrderInput, m as CalculatedTaxes, mt as GoDaddyProviderProps, n as AddCartOrderInput, nt as ShippingMethod, o as ApplyCheckoutSessionDiscountInput, ot as StoreHours, p as CalculatedAdjustments, pt as GoDaddyProvider, q as SKUGroup, r as AddLineItemBySkuIdInput, rt as SkuGroupInput, s as ApplyCheckoutSessionFulfillmentLocationInput, st as Totals, t as $Values, tt as ShippingLines, u as AuthorizeCheckoutSessionInput, ut as UpdateLineItemByIdInput, v as CartLineItemTotals, vt as queryClient, w as CheckoutSession, x as CartOrderTotals, y as CartNote, yt as useGoDaddyContext, z as PaymentMethodConfig } from "./types-BL0qSMDa.js";
import "./checkout-queries-Csm-yxF9.js";
import { A as UiExtensionRuntimeType, C as UiExtensionComponentTree, D as UiExtensionRuntimeError, E as UiExtensionRuntime, O as UiExtensionRuntimeErrorCode, S as UiExtensionComponentNode, T as UiExtensionInitialProps, _ as DomExtensionContract, a as UiExtensionRuntimeHostProps, b as UiExtensionActionRequest, c as useEnabledStoreUiExtensions, d as EnabledUiExtensionApp, f as TargetProps, g as withReleaseUiExtensions, h as UseEnabledStoreUiExtensionsOptions, i as UiExtensionRuntimeHost, j as UiExtensionRuntimeUpdateInput, k as UiExtensionRuntimeMountInput, l as EnabledStoreUiExtensionApp, m as UiExtensionAppRelease, n as Target, o as DomBundleUiExtensionRuntime, p as UiExtension, r as getUiExtensionScriptUrl, s as buildUiExtensionContext, t as groupAppsByUiExtensionTarget, u as EnabledStoreUiExtensionsData, v as DomExtensionMountInput, w as UiExtensionContext, x as UiExtensionCapabilities, y as DomExtensionUpdateInput } from "./index-DfZ75xt8.js";
import React, { ReactNode } from "react";
import { z } from "zod";
import * as react_jsx_runtime0 from "react/jsx-runtime";
//#region src/components/checkout/delivery/delivery-methods.d.ts
declare enum DeliveryMethods {
NONE = "NONE",
PICKUP = "PICKUP",
SHIP = "SHIP",
CURBSIDE = "CURBSIDE",
DELIVERY = "DELIVERY",
DRIVE_THRU = "DRIVE_THRU",
FOR_HERE = "FOR_HERE",
TO_GO = "TO_GO",
DIGITAL = "DIGITAL",
PURCHASE = "PURCHASE",
GENERAL_CONTAINER = "GENERAL_CONTAINER",
QUICK_STAY = "QUICK_STAY",
REGULAR_STAY = "REGULAR_STAY",
NON_LODGING_NRR = "NON_LODGING_NRR",
NON_LODGING_SALE = "NON_LODGING_SALE",
GIFT_CARD = "GIFT_CARD",
}
//#endregion
//#region src/hooks/use-theme.d.ts
declare const themes: {
readonly base: {
readonly value: "theme-base";
readonly label: "Base";
};
readonly purple: {
readonly value: "theme-purple";
readonly label: "Purple";
};
readonly orange: {
readonly value: "theme-orange";
readonly label: "Orange";
};
};
type Theme = keyof typeof themes;
//#endregion
//#region src/tracking/event-properties.d.ts
type TrackingProperties = {
[key: string]: string | number | boolean | null;
};
//#endregion
//#region src/components/checkout/target/types.d.ts
declare const checkoutTargetIds: readonly ["checkout.before", "checkout.after", "checkout.form.before", "checkout.form.after", "checkout.form.contact.before", "checkout.form.contact.after", "checkout.form.express-checkout.before", "checkout.form.express-checkout.after", "checkout.form.pickup.before", "checkout.form.pickup.after", "checkout.form.pickup.form.before", "checkout.form.delivery.before", "checkout.form.delivery.after", "checkout.form.tips.before", "checkout.form.tips.after", "checkout.form.notes.before", "checkout.form.notes.after", "checkout.form.shipping.before", "checkout.form.shipping.after", "checkout.form.payment.before", "checkout.form.payment.after", "checkout.form.submit.before", "checkout.form.submit.after", "checkout.summary.before", "checkout.summary.line-items.before", "checkout.summary.line-items.after", "checkout.summary.totals.subtotal.before", "checkout.summary.totals.discount.before", "checkout.summary.totals.shipping.before", "checkout.summary.totals.tip.before", "checkout.summary.totals.taxes.before", "checkout.summary.totals.included-taxes.before", "checkout.summary.totals.fees.before", "checkout.summary.totals.total-due.before", "checkout.summary.totals.total-due.after", "checkout.summary.totals.after", "checkout.summary.after"];
type Target$1 = (typeof checkoutTargetIds)[number];
//#endregion
//#region src/components/checkout/checkout.d.ts
declare function redirectToSuccessUrl(successUrl?: string): void;
interface CheckoutElements {
input?: string;
select?: string;
button?: string;
card?: string;
checkbox?: string;
radio?: string;
}
interface Appearance {
theme?: Theme;
elements?: CheckoutElements;
variables?: Omit<GoDaddyVariables, 'checkout'>;
}
type LayoutSection = 'express-checkout' | 'contact' | 'shipping' | 'payment' | 'pickup' | 'tips' | 'delivery' | 'notes';
declare const LayoutSections: {
readonly EXPRESS_CHECKOUT: "express-checkout";
readonly CONTACT: "contact";
readonly SHIPPING: "shipping";
readonly PAYMENT: "payment";
readonly PICKUP: "pickup";
readonly DELIVERY: "delivery";
readonly TIPS: "tips";
readonly NOTES: "notes";
};
type StripeConfig = {
publishableKey: string;
testMode?: boolean;
};
type GodaddyPaymentsConfig = {
businessId?: string;
appId?: string;
};
type SquareConfig = {
locationId: string;
appId: string;
};
type PayPalConfig = {
clientId: string;
merchantId?: string;
disableFunding?: Array<'credit' | 'card' | 'paylater' | 'venmo'>;
};
type MercadoPagoConfig = {
publicKey: string;
country: 'AR' | 'BR' | 'CO' | 'CL' | 'PE' | 'MX';
};
type CCAvenueConfig = {
accessCodeId: string;
};
interface CheckoutContextValue {
elements?: CheckoutElements;
targets?: Partial<Record<Target$1, (session?: CheckoutSession | null) => ReactNode>>;
session?: CheckoutSession | null;
jwt?: string;
isCheckoutDisabled?: boolean;
stripeConfig?: StripeConfig;
godaddyPaymentsConfig?: GodaddyPaymentsConfig;
squareConfig?: SquareConfig;
paypalConfig?: PayPalConfig;
mercadoPagoConfig?: MercadoPagoConfig;
ccavenueConfig?: CCAvenueConfig;
isConfirmingCheckout: boolean;
setIsConfirmingCheckout: (isConfirming: boolean) => void;
checkoutErrors?: string[] | undefined;
setCheckoutErrors: (error?: string[] | undefined) => void;
requiredFields?: {
[key: string]: boolean;
};
}
declare const checkoutContext: React.Context<CheckoutContextValue>;
declare const useCheckoutContext: () => CheckoutContextValue;
declare const baseCheckoutSchema: z.ZodObject<{
contactEmail: z.ZodString;
deliveryMethod: z.ZodNativeEnum<typeof DeliveryMethods>;
paymentUseShippingAddress: z.ZodDefault<z.ZodBoolean>;
shippingFirstName: z.ZodString;
shippingLastName: z.ZodString;
shippingPhone: z.ZodOptional<z.ZodString>;
shippingAddressLine1: z.ZodString;
shippingAddressLine2: z.ZodOptional<z.ZodString>;
shippingAddressLine3: z.ZodOptional<z.ZodString>;
shippingAdminArea4: z.ZodOptional<z.ZodString>;
shippingAdminArea3: z.ZodOptional<z.ZodString>;
shippingAdminArea2: z.ZodString;
shippingAdminArea1: z.ZodString;
shippingPostalCode: z.ZodString;
shippingCountryCode: z.ZodString;
shippingMethod: z.ZodOptional<z.ZodString>;
shippingMethodAutoSelected: z.ZodOptional<z.ZodBoolean>;
billingFirstName: z.ZodString;
billingLastName: z.ZodString;
billingPhone: z.ZodOptional<z.ZodString>;
billingAddressLine1: z.ZodString;
billingAddressLine2: z.ZodOptional<z.ZodString>;
billingAddressLine3: z.ZodOptional<z.ZodString>;
billingAdminArea4: z.ZodOptional<z.ZodString>;
billingAdminArea3: z.ZodOptional<z.ZodString>;
billingAdminArea2: z.ZodString;
billingAdminArea1: z.ZodString;
billingPostalCode: z.ZodString;
billingCountryCode: z.ZodString;
paymentCardNumber: z.ZodOptional<z.ZodString>;
paymentCardNumberDisplay: z.ZodOptional<z.ZodString>;
paymentCardType: z.ZodOptional<z.ZodString>;
paymentExpiryDate: z.ZodOptional<z.ZodString>;
paymentMonth: z.ZodOptional<z.ZodNullable<z.ZodString>>;
paymentYear: z.ZodOptional<z.ZodNullable<z.ZodString>>;
paymentSecurityCode: z.ZodOptional<z.ZodString>;
paymentNameOnCard: z.ZodOptional<z.ZodString>;
notes: z.ZodOptional<z.ZodString>;
pickupDate: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodDate]>>>;
pickupTime: z.ZodOptional<z.ZodNullable<z.ZodString>>;
pickupLocationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
pickupLeadTime: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
pickupTimezone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
tipAmount: z.ZodOptional<z.ZodNumber>;
tipPercentage: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
paymentMethod: z.ZodString;
stripePaymentIntent: z.ZodOptional<z.ZodString>;
stripePaymentIntentId: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
paymentMethod: string;
contactEmail: string;
deliveryMethod: DeliveryMethods;
paymentUseShippingAddress: boolean;
shippingFirstName: string;
shippingLastName: string;
shippingAddressLine1: string;
shippingAdminArea2: string;
shippingAdminArea1: string;
shippingPostalCode: string;
shippingCountryCode: string;
billingFirstName: string;
billingLastName: string;
billingAddressLine1: string;
billingAdminArea2: string;
billingAdminArea1: string;
billingPostalCode: string;
billingCountryCode: string;
notes?: string | undefined;
tipAmount?: number | undefined;
shippingPhone?: string | undefined;
shippingAddressLine2?: string | undefined;
shippingAddressLine3?: string | undefined;
shippingAdminArea4?: string | undefined;
shippingAdminArea3?: string | undefined;
shippingMethod?: string | undefined;
shippingMethodAutoSelected?: boolean | undefined;
billingPhone?: string | undefined;
billingAddressLine2?: string | undefined;
billingAddressLine3?: string | undefined;
billingAdminArea4?: string | undefined;
billingAdminArea3?: string | undefined;
paymentCardNumber?: string | undefined;
paymentCardNumberDisplay?: string | undefined;
paymentCardType?: string | undefined;
paymentExpiryDate?: string | undefined;
paymentMonth?: string | null | undefined;
paymentYear?: string | null | undefined;
paymentSecurityCode?: string | undefined;
paymentNameOnCard?: string | undefined;
pickupDate?: string | Date | null | undefined;
pickupTime?: string | null | undefined;
pickupLocationId?: string | null | undefined;
pickupLeadTime?: number | null | undefined;
pickupTimezone?: string | null | undefined;
tipPercentage?: number | null | undefined;
stripePaymentIntent?: string | undefined;
stripePaymentIntentId?: string | undefined;
}, {
paymentMethod: string;
contactEmail: string;
deliveryMethod: DeliveryMethods;
shippingFirstName: string;
shippingLastName: string;
shippingAddressLine1: string;
shippingAdminArea2: string;
shippingAdminArea1: string;
shippingPostalCode: string;
shippingCountryCode: string;
billingFirstName: string;
billingLastName: string;
billingAddressLine1: string;
billingAdminArea2: string;
billingAdminArea1: string;
billingPostalCode: string;
billingCountryCode: string;
notes?: string | undefined;
tipAmount?: number | undefined;
paymentUseShippingAddress?: boolean | undefined;
shippingPhone?: string | undefined;
shippingAddressLine2?: string | undefined;
shippingAddressLine3?: string | undefined;
shippingAdminArea4?: string | undefined;
shippingAdminArea3?: string | undefined;
shippingMethod?: string | undefined;
shippingMethodAutoSelected?: boolean | undefined;
billingPhone?: string | undefined;
billingAddressLine2?: string | undefined;
billingAddressLine3?: string | undefined;
billingAdminArea4?: string | undefined;
billingAdminArea3?: string | undefined;
paymentCardNumber?: string | undefined;
paymentCardNumberDisplay?: string | undefined;
paymentCardType?: string | undefined;
paymentExpiryDate?: string | undefined;
paymentMonth?: string | null | undefined;
paymentYear?: string | null | undefined;
paymentSecurityCode?: string | undefined;
paymentNameOnCard?: string | undefined;
pickupDate?: string | Date | null | undefined;
pickupTime?: string | null | undefined;
pickupLocationId?: string | null | undefined;
pickupLeadTime?: number | null | undefined;
pickupTimezone?: string | null | undefined;
tipPercentage?: number | null | undefined;
stripePaymentIntent?: string | undefined;
stripePaymentIntentId?: string | undefined;
}>;
type CheckoutFormSchema = Partial<{ [K in keyof z.infer<typeof baseCheckoutSchema>]: z.ZodTypeAny }> & z.ZodRawShape;
type CheckoutFormData = z.infer<typeof baseCheckoutSchema>;
interface CheckoutProps {
session?: CheckoutSession | undefined;
appearance?: Appearance;
isCheckoutDisabled?: boolean;
stripeConfig?: StripeConfig;
godaddyPaymentsConfig?: GodaddyPaymentsConfig;
squareConfig?: SquareConfig;
paypalConfig?: PayPalConfig;
mercadoPagoConfig?: MercadoPagoConfig;
ccavenueConfig?: CCAvenueConfig;
layout?: LayoutSection[];
direction?: 'ltr' | 'rtl';
showStoreHours?: boolean;
enableTracking?: boolean;
trackingProperties?: TrackingProperties;
targets?: Partial<Record<Target$1, (session?: CheckoutSession | null) => ReactNode>>;
checkoutFormSchema?: CheckoutFormSchema;
defaultValues?: Pick<CheckoutFormData, 'contactEmail'>;
isLoading?: boolean;
loadingFallback?: ReactNode;
}
declare function Checkout(props: CheckoutProps): react_jsx_runtime0.JSX.Element;
//#endregion
//#region src/components/checkout/express-checkout/express-checkout.d.ts
interface ExpressCheckoutAppearance {
theme?: Theme;
elements?: CheckoutElements;
variables?: Omit<GoDaddyVariables, 'checkout'>;
}
interface ExpressCheckoutProps {
session: CheckoutSession | undefined;
appearance?: ExpressCheckoutAppearance;
stripeConfig?: CheckoutProps['stripeConfig'];
godaddyPaymentsConfig?: CheckoutProps['godaddyPaymentsConfig'];
squareConfig?: CheckoutProps['squareConfig'];
paypalConfig?: CheckoutProps['paypalConfig'];
direction?: 'ltr' | 'rtl';
enableTracking?: boolean;
targets?: Partial<Record<string, () => ReactNode>>;
}
declare function DraftOrderExpressCheckout(props: ExpressCheckoutProps): react_jsx_runtime0.JSX.Element | null;
//#endregion
//#region src/components/checkout/line-items/line-items.d.ts
interface Note {
content: string | null;
id: string | null;
}
interface CostAdjustment {
currencyCode?: string;
value?: number;
}
interface AddonValue {
amountIncreased?: number;
costAdjustment?: CostAdjustment;
name?: string;
}
interface SelectedAddon {
attribute?: string;
sku?: string;
values?: AddonValue[];
}
interface SelectedOption {
attribute?: string;
values?: string[];
}
type ProductDiscount = {
amount: {
currencyCode: string;
value: number;
};
code: string;
name: string;
ratePercentage: string | null;
};
type Product = Partial<SKUProduct> & {
image: string;
quantity: number;
originalPrice: number;
price: number;
notes?: Note[] | null;
addons?: SelectedAddon[];
selectedOptions?: SelectedOption[];
discounts?: ProductDiscount[];
};
interface DraftOrderLineItemsProps {
items: Product[];
currencyCode?: string;
inputInMinorUnits?: boolean;
onRemoveFromCart?: (itemId: string) => void;
isRemovingFromCart?: boolean;
removingItemId?: string;
}
declare function DraftOrderLineItems({
items,
currencyCode,
inputInMinorUnits,
onRemoveFromCart,
isRemovingFromCart,
removingItemId
}: DraftOrderLineItemsProps): react_jsx_runtime0.JSX.Element;
//#endregion
//#region src/components/checkout/payment/utils/use-is-payment-disabled.d.ts
declare function useIsPaymentDisabled(): boolean;
//#endregion
//#region src/components/checkout/totals/totals.d.ts
interface DraftOrderTotalsProps {
subtotal?: number;
discount?: number;
isDiscountLoading?: boolean;
shipping?: number;
isShippingLoading?: boolean;
totalSavings?: number;
currencyCode?: string;
itemCount?: number;
total?: number;
tip?: number;
taxes?: number;
includedTaxTotal?: number;
isTaxLoading?: boolean;
fees?: number;
isFeeLoading?: boolean;
enableFees?: boolean | null;
enableTaxes?: boolean | null;
enableDiscounts?: boolean | null;
enableShipping?: boolean | null;
inputInMinorUnits?: boolean;
}
interface TotalLineItemProps {
title: string;
description?: string;
value: number;
currencyCode?: string;
inputInMinorUnits?: boolean;
}
declare function TotalLineItem({
title,
description,
value,
currencyCode,
inputInMinorUnits
}: TotalLineItemProps): react_jsx_runtime0.JSX.Element;
declare function DraftOrderTotals({
subtotal,
discount,
shipping,
currencyCode,
itemCount,
total,
tip,
taxes,
includedTaxTotal,
fees,
enableDiscounts,
enableTaxes,
enableFees,
isTaxLoading,
isShippingLoading,
isDiscountLoading,
isFeeLoading,
enableShipping,
inputInMinorUnits
}: DraftOrderTotalsProps): react_jsx_runtime0.JSX.Element;
//#endregion
//#region src/components/checkout/utils/query-keys.d.ts
declare const checkoutQueryKeys: {
draftOrder: (sessionId?: string | null) => readonly ["draft-order", {
readonly sessionId: string | null | undefined;
}];
draftOrderProducts: (sessionId?: string | null) => readonly ["draft-order-products", {
readonly sessionId: string | null | undefined;
}];
draftOrderShippingMethods: (sessionId?: string | null) => readonly ["draft-order-shipping-methods", {
readonly sessionId: string | null | undefined;
}];
};
//#endregion
//#region src/components/storefront/cart.d.ts
interface CartProps {
open: boolean;
onOpenChange: (open: boolean) => void;
onCheckout?: (orderId: string) => void;
isCheckingOut?: boolean;
}
declare function Cart({
open,
onOpenChange,
onCheckout,
isCheckingOut
}: CartProps): react_jsx_runtime0.JSX.Element;
//#endregion
//#region src/components/storefront/cart-line-items.d.ts
declare function CartLineItems({
...props
}: DraftOrderLineItemsProps): react_jsx_runtime0.JSX.Element;
//#endregion
//#region src/components/storefront/cart-totals.d.ts
declare function CartTotals({
...props
}: Omit<DraftOrderTotalsProps, 'enableDiscounts'>): react_jsx_runtime0.JSX.Element;
//#endregion
//#region src/components/storefront/product-card.d.ts
interface ProductCardProps {
product?: SKUGroup;
productId?: string;
storeId?: string;
clientId?: string;
href?: string;
getProductHref?: (productId: string) => string;
onAddToCartSuccess?: () => void;
onAddToCartError?: (error: Error) => void;
}
declare function ProductCard({
product: productProp,
productId,
storeId: storeIdProp,
clientId: clientIdProp,
href: hrefProp,
getProductHref,
onAddToCartSuccess,
onAddToCartError
}: ProductCardProps): react_jsx_runtime0.JSX.Element;
//#endregion
//#region src/components/storefront/product-details.d.ts
interface ProductDetailsProps {
productId: string;
storeId?: string;
clientId?: string;
onAddToCartSuccess?: () => void;
onAddToCartError?: (error: Error) => void;
}
declare function ProductDetails({
productId,
storeId: storeIdProp,
clientId: clientIdProp,
onAddToCartSuccess,
onAddToCartError
}: ProductDetailsProps): react_jsx_runtime0.JSX.Element;
//#endregion
//#region src/components/storefront/product-grid.d.ts
interface ProductGridProps {
storeId?: string;
clientId?: string;
/** Filter products by specific product IDs */
productIds?: string[];
/** Filter products by category IDs (maps to listId in GraphQL) */
categoryIds?: string[];
enablePagination?: boolean;
getProductHref?: (productId: string) => string;
onAddToCartSuccess?: () => void;
onAddToCartError?: (error: Error) => void;
}
declare function ProductGrid({
storeId: storeIdProp,
clientId: clientIdProp,
productIds,
categoryIds,
enablePagination,
getProductHref,
onAddToCartSuccess,
onAddToCartError
}: ProductGridProps): react_jsx_runtime0.JSX.Element;
//#endregion
//#region src/components/storefront/product-search.d.ts
interface ProductSearchProps {
showButton?: boolean;
onSearch?: (query: string) => void;
}
declare function ProductSearch({
showButton,
onSearch
}: ProductSearchProps): react_jsx_runtime0.JSX.Element;
//#endregion
//#region src/components/checkout/utils/format-currency.d.ts
interface FormatCurrencyOptions {
/** Numeric amount to format or convert */
amount: number;
/** ISO 4217 currency code (e.g. 'USD', 'VND', 'CLP') */
currencyCode: string;
/** Optional locale, defaults to 'en-US' */
locale?: string;
/**
* Indicates whether the input is in cents (minor units).
* - true → input is in cents/minor units, will be converted to dollars/major units for formatting (default)
* - false → input is already in dollars/major units, will be formatted as-is
*/
inputInMinorUnits?: boolean;
/**
* Return a machine-parseable major-unit string instead of a localized
* currency string.
*
* - `true` → always uses `en-US` formatting (`.` decimal separator, no
* thousands grouping, no currency symbol) so the result is
* safe to pass to `Number.parseFloat`. The `locale` option
* is intentionally ignored in this mode — using a localized
* separator (e.g. `"10,50"` for `fr-FR`) would silently
* corrupt the value when parsed back to a number.
* Example: `{ amount: 1050, currencyCode: 'USD', returnRaw: true }` → `"10.50"`
* - `false` → returns the full localized currency string (default).
* Example: `{ amount: 1050, currencyCode: 'USD' }` → `"$10.50"`
*
* Use `returnRaw: true` when feeding the value into a payment SDK or a
* numeric input. For human-readable display, leave it `false`.
*/
returnRaw?: boolean;
}
/**
* Formats a currency amount.
*
* - When `inputInMinorUnits = true` (default): converts from minor units (cents) and returns formatted string like "$123.45"
* - When `inputInMinorUnits = false`: formats major units (dollars) directly and returns formatted string like "$123.45"
* - When `returnRaw = true`: returns a parseable major-unit string in en-US
* format (e.g. "123.45"), regardless of `locale`. See {@link FormatCurrencyOptions.returnRaw}.
*/
declare function formatCurrency({
amount,
currencyCode,
locale,
inputInMinorUnits,
returnRaw
}: FormatCurrencyOptions): string;
/**
* Converts a currency amount from major units (dollars) to minor units (cents).
*
* This is the reverse operation of formatCurrency with inputInMinorUnits=true.
* It properly handles different currency precisions:
* - 2 decimals (USD, EUR, etc.): multiply by 100
* - 0 decimals (JPY, KRW, VND, etc.): multiply by 1
* - 3 decimals (KWD, BHD, JOD, OMR): multiply by 1000
*
* Returns 0 for NaN, negative, null-ish, or otherwise unparseable input
* so callers don't need to guard individually.
*
* @param amount - The amount in major units (e.g., "10.50" or 10.50)
* @param currencyCode - ISO 4217 currency code (e.g., 'USD', 'JPY', 'KWD')
* @returns The amount in minor units (e.g., 1050 for USD, 10 for JPY, 10500 for KWD), or 0 for invalid input
*/
declare function convertMajorToMinorUnits(amount: number | string, currencyCode: string): number;
/**
* Hook that returns a formatCurrency function using the locale from GoDaddyProvider context.
* The returned function has the same signature as formatCurrency, but uses the context locale as default.
*/
declare function useFormatCurrency(): (options: FormatCurrencyOptions) => string;
/**
* Hook that returns a convertMajorToMinorUnits function.
* This follows the same pattern as useFormatCurrency for consistency.
* Note: Locale is not used in currency conversion (only in display formatting),
* but we access context to maintain the same hook pattern.
*/
declare function useConvertMajorToMinorUnits(): (amount: number | string, currencyCode: string) => number;
//#endregion
export { $Values, AddCartOrderInput, AddLineItemBySkuIdInput, Address, ApplyCheckoutSessionDeliveryMethodInput, ApplyCheckoutSessionDiscountInput, ApplyCheckoutSessionFulfillmentLocationInput, ApplyCheckoutSessionShippingMethodInput, ApplyDiscountCodesInput, AuthorizeCheckoutSessionInput, AvailablePaymentProviders, CCAvenueConfig, CSSVariables, CalculateCheckoutSessionTaxesInput, CalculatedAdjustments, CalculatedTaxes, Cart, CartDiscount, CartLineItem, CartLineItemDetails, CartLineItemTotals, CartLineItems, CartNote, CartOrder, CartOrderTotals, CartShippingInfo, CartTax, CartTotals, Checkout, CheckoutElements, CheckoutFormData, CheckoutFormSchema, CheckoutProps, CheckoutSession, CheckoutSessionAuth, CheckoutSessionInput, CheckoutSessionLocation, CheckoutSessionOptions, CheckoutSessionResult, CheckoutType, ConfirmCheckoutMutationInput, DeleteLineItemByIdInput, DomBundleUiExtensionRuntime, DomExtensionContract, DomExtensionMountInput, DomExtensionUpdateInput, DraftOrder, DraftOrderExpressCheckout, DraftOrderLineItems, type DraftOrderLineItemsProps, DraftOrderPriceAdjustmentsQueryInput, DraftOrderSession, DraftOrderTotals, type DraftOrderTotalsProps, EnabledStoreUiExtensionApp, EnabledStoreUiExtensionsData, EnabledUiExtensionApp, type ExpressCheckoutProps, type FormatCurrencyOptions, GetCheckoutSessionShippingRatesInput, GetCheckoutSessionTaxesInput, GoDaddyAppearance, GoDaddyProvider, GoDaddyProviderProps, GoDaddyTheme, GoDaddyVariables, GodaddyPaymentsConfig, LayoutSection, LayoutSections, LinkComponentProps, MercadoPagoConfig, MutationVerifyAddress, PayPalConfig, PaymentMethodConfig, PaymentMethodKey, PaymentMethodType, PaymentMethodValue, PaymentMethods, PaymentProvider, type Product, ProductCard, type ProductCardProps, ProductDetails, type ProductDetailsProps, ProductGrid, ProductSearch, type ProductSearchProps, SKU, SKUAttributeValue, SKUGroup, SKUGroupAttribute, SKUGroupAttributeValue, SKUGroupSKU, SKUInventoryCount, SKUMedia, SKUPrice, SKUProduct, ShippingLines, ShippingMethod, SkuGroupInput, SkuGroupsInput, SkuInput, SquareConfig, StoreHours, StripeConfig, Target, TargetProps, TotalLineItem, type TotalLineItemProps, Totals, UiExtension, UiExtensionActionRequest, UiExtensionAppRelease, UiExtensionCapabilities, UiExtensionComponentNode, UiExtensionComponentTree, UiExtensionContext, UiExtensionInitialProps, UiExtensionRuntime, UiExtensionRuntimeError, UiExtensionRuntimeErrorCode, UiExtensionRuntimeHost, UiExtensionRuntimeHostProps, UiExtensionRuntimeMountInput, UiExtensionRuntimeType, UiExtensionRuntimeUpdateInput, UpdateCartOrderInput, UpdateDraftOrderInput, UpdateLineItemByIdInput, UseEnabledStoreUiExtensionsOptions, baseCheckoutSchema, buildUiExtensionContext, checkoutContext, checkoutQueryKeys, convertMajorToMinorUnits, formatCurrency, getUiExtensionScriptUrl, groupAppsByUiExtensionTarget, queryClient, redirectToSuccessUrl, useCheckoutContext, useConvertMajorToMinorUnits, useEnabledStoreUiExtensions, useFormatCurrency, useGoDaddyContext, useIsPaymentDisabled, withReleaseUiExtensions };