@clickmax/checkout-react 0.0.0-stage → 0.0.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.
@@ -0,0 +1,2405 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ /**
4
+ * Address of the buyer. Renders nothing when the offer does not ask for one (and while a
5
+ * returning buyer buys with saved data). Physical offers quote freight from the zip code.
6
+ */
7
+ export declare function AddressFields({ className, labels, children }: AddressFieldsProps): ReactNode;
8
+
9
+ /** Props of {@link AddressFields}. */
10
+ export declare interface AddressFieldsProps {
11
+ className?: string;
12
+ labels?: Partial<Record<keyof AddressValues, string>>;
13
+ children?: RenderProp<AddressRenderState>;
14
+ }
15
+
16
+ /** State of {@link AddressFields}. */
17
+ export declare interface AddressRenderState {
18
+ fields: Record<keyof AddressValues, FieldState>;
19
+ required: boolean;
20
+ }
21
+
22
+ /** Delivery or billing address typed by the buyer. */
23
+ export declare interface AddressValues {
24
+ zipCode: string;
25
+ street: string;
26
+ number: string;
27
+ complement: string;
28
+ neighborhood: string;
29
+ city: string;
30
+ state: string;
31
+ /** ISO 3166-1 alpha-2 country, `BR` by default. */
32
+ country: string;
33
+ }
34
+
35
+ /** Payload of `onApproved`. */
36
+ export declare interface ApprovedPurchase {
37
+ transactionId: string;
38
+ totalAmount: number;
39
+ method: PaymentMethod | 'free' | 'subscription';
40
+ /** `true` when the purchase was the one-time offer (upsell or downsell). */
41
+ isUpsell: boolean;
42
+ }
43
+
44
+ /** Loading state of a value the browser fetches. */
45
+ export declare type AsyncStatus = 'idle' | 'loading' | 'success' | 'error';
46
+
47
+ /** A boleto issued for the purchase. */
48
+ export declare interface BoletoCharge {
49
+ transactionId: string;
50
+ boletoUrl: string;
51
+ barcode: string;
52
+ totalAmount: number;
53
+ }
54
+
55
+ /** Link and barcode of an issued boleto. */
56
+ export declare function BoletoPayment({ className, children }: BoletoPaymentProps): ReactNode;
57
+
58
+ /** Props of {@link BoletoPayment}. */
59
+ export declare interface BoletoPaymentProps {
60
+ className?: string;
61
+ children?: RenderProp<ReturnType<typeof useBoleto>>;
62
+ }
63
+
64
+ export declare type CardBrand = 'visa' | 'mastercard' | 'amex' | 'elo' | 'hipercard' | 'diners' | 'discover' | 'jcb' | 'unknown';
65
+
66
+ export declare type CardChangeEvent = {
67
+ elementType: 'card';
68
+ empty: boolean;
69
+ complete: boolean;
70
+ brand: CardBrand;
71
+ error?: CardValidationError;
72
+ };
73
+
74
+ export declare type CardElement = {
75
+ mount: (target: HTMLElement | string) => void;
76
+ unmount: () => void;
77
+ destroy: () => void;
78
+ update: (options: CardElementOptions) => void;
79
+ focus: () => void;
80
+ blur: () => void;
81
+ clear: () => void;
82
+ on: <E extends CardElementEvent>(event: E, handler: Handler<E>) => CardElement;
83
+ off: <E extends CardElementEvent>(event: E, handler?: Handler<E>) => CardElement;
84
+ tokenize: (request: TokenizeRequest) => Promise<TokenizeResult>;
85
+ /** Último `change` recebido, útil para validar o formulário inteiro no submit. */
86
+ readonly state: CardChangeEvent | undefined;
87
+ };
88
+
89
+ declare type CardElementEvent = keyof CardElementEventMap;
90
+
91
+ /**
92
+ * Parent side of Clickmax Elements: runs on the seller's page, mounts the secure card frame and
93
+ * talks to it over `postMessage`. Card data never leaves the frame.
94
+ */
95
+ export declare type CardElementEventMap = {
96
+ ready: {
97
+ elementType: 'card';
98
+ };
99
+ change: CardChangeEvent;
100
+ focus: {
101
+ elementType: 'card';
102
+ field: CardField;
103
+ };
104
+ blur: {
105
+ elementType: 'card';
106
+ field: CardField;
107
+ };
108
+ escape: {
109
+ elementType: 'card';
110
+ };
111
+ loaderror: {
112
+ elementType: 'card';
113
+ message: string;
114
+ };
115
+ };
116
+
117
+ declare type CardElementOptions = {
118
+ appearance?: ElementsAppearance;
119
+ locale?: ElementsLocale;
120
+ disabled?: boolean;
121
+ };
122
+
123
+ declare type CardErrorCode = 'invalid_number' | 'incomplete_number' | 'invalid_expiry' | 'incomplete_expiry' | 'expired_card' | 'invalid_cvc' | 'incomplete_cvc';
124
+
125
+ declare type CardField = 'number' | 'expiry' | 'cvc';
126
+
127
+ /**
128
+ * Card number, expiry and CVC in a secure frame served by Clickmax. The page never sees the card:
129
+ * the frame tokenizes it and the purchase sends only the token. Mounts in the browser only; the
130
+ * server renders an empty container.
131
+ *
132
+ * Needs `paymentsOrigin` on `CheckoutProvider`. Renders nothing for a returning buyer paying
133
+ * with the saved card (see `savedCard`).
134
+ */
135
+ export declare function CardFields(props: CardFieldsProps): ReactNode;
136
+
137
+ /** Props of {@link CardFields}. */
138
+ export declare interface CardFieldsProps {
139
+ /** Look of the hosted fields. Only these tokens cross into the secure frame; no free CSS. */
140
+ appearance?: ElementsAppearance;
141
+ /** Disables the fields. */
142
+ disabled?: boolean;
143
+ className?: string;
144
+ /** Fires once the fields are interactive. */
145
+ onReady?: () => void;
146
+ /** Validation state of the fields; never carries card data. */
147
+ onChange?: (event: CardChangeEvent) => void;
148
+ onFocus?: (event: CardElementEventMap['focus']) => void;
149
+ onBlur?: (event: CardElementEventMap['blur']) => void;
150
+ /** The secure frame could not load. */
151
+ onLoadError?: (event: CardElementEventMap['loaderror']) => void;
152
+ /**
153
+ * Rendered instead of the fields when the buyer pays with a saved card (one-click). Defaults to
154
+ * nothing.
155
+ */
156
+ savedCard?: (card: {
157
+ brand: string;
158
+ lastDigits: string;
159
+ useAnother: () => void;
160
+ }) => ReactNode;
161
+ }
162
+
163
+ export declare type CardValidationError = {
164
+ field: CardField;
165
+ code: CardErrorCode;
166
+ message: string;
167
+ };
168
+
169
+ /**
170
+ * Typed client of the checkout routes of the payments API. `CheckoutProvider` creates one from
171
+ * its `transport`; create your own to fetch the public offer on the server before rendering.
172
+ *
173
+ * @example
174
+ * const api = createCheckoutApi({ baseUrl: 'https://example.com/__clickmax/payments' })
175
+ * const offer = await api.getPublicOffer({ offer: 'abc123' })
176
+ */
177
+ export declare interface CheckoutApi {
178
+ /**
179
+ * Public, cacheable offer data. Safe to call on the server; sends no cookie.
180
+ *
181
+ * `bumps`, `bumpTitle` and `mode` declare the checkout in code, for pages with no `pageId`
182
+ * (they win over the page configuration when both are sent). The server checks that every bump
183
+ * belongs to the seller of the offer and drops the ones that cannot be sold right now.
184
+ */
185
+ getPublicOffer(params: {
186
+ offer: string;
187
+ pageId?: string;
188
+ } & CheckoutDeclaration, options?: CheckoutCallOptions): Promise<PublicOfferCheckout>;
189
+ /** Visitor data: one-click buy, session id and affiliate status. Browser only (uses cookies). */
190
+ getVisitor(params: {
191
+ offer: string;
192
+ affiliateHash?: string;
193
+ }, options?: CheckoutCallOptions): Promise<OfferCheckoutVisitor>;
194
+ /** Prices, installments and coupon result for a selection, computed by the server. */
195
+ getPricing(body: {
196
+ offerHash: string;
197
+ orderBumpIds?: string[];
198
+ previewOrderBumpIds?: string[];
199
+ couponCode?: string;
200
+ buyerEmail?: string;
201
+ }, options?: CheckoutCallOptions): Promise<CheckoutPricing>;
202
+ /** Checks a coupon against the offer (and the buyer, when the email is known). */
203
+ validateCoupon(body: {
204
+ code: string;
205
+ offerHash: string;
206
+ buyerEmail?: string;
207
+ }, options?: CheckoutCallOptions): Promise<CouponValidation>;
208
+ /** Freight options of a physical offer for a zip code. */
209
+ getFreightQuote(params: {
210
+ offerHash: string;
211
+ zipCode: string;
212
+ }, options?: CheckoutCallOptions): Promise<FreightQuote>;
213
+ /** Anti-CSRF token required by the purchase. */
214
+ getCsrfToken(options?: CheckoutCallOptions): Promise<string>;
215
+ /** Submits a purchase. `idempotencyKey` must stay the same across retries of one attempt. */
216
+ purchase(body: PurchaseRequest, headers: {
217
+ idempotencyKey: string;
218
+ csrfToken: string;
219
+ }, options?: CheckoutCallOptions): Promise<PurchaseResponse>;
220
+ /** Status of a purchase the API accepted for async processing. */
221
+ getPurchaseStatus(jobId: string, options?: CheckoutCallOptions): Promise<PurchaseStatus>;
222
+ /** Purchase details, used to learn when a pix was paid. */
223
+ getPurchaseDetails(transactionId: string, options?: CheckoutCallOptions): Promise<CheckoutDetails>;
224
+ }
225
+
226
+ /** A non-2xx answer or a network failure of a checkout API call. */
227
+ export declare class CheckoutApiError extends Error {
228
+ /** HTTP status, or `0` when the request never got an answer. */
229
+ readonly status: number;
230
+ /** Machine-readable code from the API body, when it sends one. */
231
+ readonly code: string | undefined;
232
+ /** Parsed response body, when it is JSON. */
233
+ readonly body: unknown;
234
+ constructor(init: {
235
+ status: number;
236
+ message: string;
237
+ code?: string;
238
+ body?: unknown;
239
+ });
240
+ }
241
+
242
+ /** Callbacks for what happens in the checkout. All optional; none of them can block the flow. */
243
+ export declare interface CheckoutCallbacks {
244
+ /** A card or free purchase was approved, or a pix was paid. */
245
+ onApproved?: (purchase: ApprovedPurchase) => void;
246
+ /** The purchase was refused. */
247
+ onDeclined?: (purchase: DeclinedPurchase) => void;
248
+ /** A pix code was generated and is waiting for payment. */
249
+ onPixGenerated?: (pix: PixCharge) => void;
250
+ /** A boleto was issued. */
251
+ onBoletoGenerated?: (boleto: BoletoCharge) => void;
252
+ /** The buyer accepted the one-time offer and it was approved. */
253
+ onUpsellAccepted?: (purchase: ApprovedPurchase) => void;
254
+ /** The buyer declined the one-time offer. */
255
+ onUpsellDeclined?: (event: {
256
+ downsellUrl: string | undefined;
257
+ }) => void;
258
+ }
259
+
260
+ /** Per-call options of every {@link CheckoutApi} method. */
261
+ export declare interface CheckoutCallOptions {
262
+ signal?: AbortSignal;
263
+ }
264
+
265
+ /** Everything a checkout component reads. Use the focused hooks instead of this when possible. */
266
+ export declare interface CheckoutContextValue {
267
+ offer: PublicOfferCheckout;
268
+ api: CheckoutApi;
269
+ locale: CheckoutLocale;
270
+ messages: CheckoutMessages;
271
+ location: CheckoutLocation;
272
+ paymentsOrigin: string | undefined;
273
+ /** `false` during SSR and the first client render, `true` after hydration. */
274
+ isHydrated: boolean;
275
+ visitor: {
276
+ status: AsyncStatus;
277
+ data: OfferCheckoutVisitor | undefined;
278
+ };
279
+ /** Affiliate hash that goes with the purchase; empty when the affiliation is suspended. */
280
+ affiliateHash: string | undefined;
281
+ /** Offer pixels, with event ids once the visitor is known. */
282
+ pixels: CheckoutPixel[];
283
+ oneClick: {
284
+ data: OneClickBuy | undefined;
285
+ /** The buyer chose to edit the saved data instead of buying with it. */
286
+ editing: boolean;
287
+ setEditing: (editing: boolean) => void;
288
+ };
289
+ personalData: {
290
+ values: PersonalDataValues;
291
+ errors: FieldErrors<PersonalDataValues>;
292
+ setValue: (field: keyof PersonalDataValues, value: string) => void;
293
+ validate: () => boolean;
294
+ /** Whether the purchase sends typed data (`false` while buying with saved one-click data). */
295
+ isActive: boolean;
296
+ };
297
+ address: {
298
+ values: AddressValues;
299
+ errors: FieldErrors<AddressValues>;
300
+ setValue: (field: keyof AddressValues, value: string) => void;
301
+ validate: () => boolean;
302
+ required: boolean;
303
+ };
304
+ bumps: {
305
+ items: OrderBumpState[];
306
+ /** Bumps always in the order ("Included in your order"), with no checkbox. */
307
+ required: OrderBumpState[];
308
+ /** Bumps the buyer may add. Empty when every bump is required. */
309
+ optional: OrderBumpState[];
310
+ /** Title of the optional bumps: the seller's, or the translated default when empty. */
311
+ title: string;
312
+ selectedIds: string[];
313
+ toggle: (id: string, selected?: boolean) => void;
314
+ };
315
+ pricing: {
316
+ status: AsyncStatus;
317
+ data: CheckoutPricing | undefined;
318
+ };
319
+ summary: CheckoutSummary;
320
+ coupon: {
321
+ code: string | undefined;
322
+ status: 'idle' | 'validating' | 'valid' | 'invalid';
323
+ result: CouponValidation | undefined;
324
+ apply: (code: string) => Promise<boolean>;
325
+ remove: () => void;
326
+ };
327
+ freight: {
328
+ enabled: boolean;
329
+ status: AsyncStatus;
330
+ quote: FreightQuote | undefined;
331
+ method: FreightMethod | undefined;
332
+ select: (method: FreightMethod) => void;
333
+ };
334
+ payment: {
335
+ methods: PaymentMethod[];
336
+ method: PaymentMethod | undefined;
337
+ setMethod: (method: PaymentMethod) => void;
338
+ installments: InstallmentOption[];
339
+ installment: number;
340
+ setInstallment: (installment: number) => void;
341
+ /** Saved card of a returning buyer, when the purchase can use it. */
342
+ savedCard: {
343
+ brand: string;
344
+ lastDigits: string;
345
+ } | undefined;
346
+ useSavedCard: boolean;
347
+ setUseSavedCard: (use: boolean) => void;
348
+ cardHolderName: string;
349
+ setCardHolderName: (name: string) => void;
350
+ /** Registered by `CardFields`; `undefined` until the iframe mounts. */
351
+ card: CardElement | undefined;
352
+ registerCard: (card: CardElement | undefined) => void;
353
+ };
354
+ submission: SubmissionState;
355
+ submit: (options?: SubmitOptions) => Promise<SubmitOutcome>;
356
+ /** Clears a pix, boleto or error so the buyer can try again. */
357
+ reset: () => void;
358
+ callbacks: CheckoutCallbacks;
359
+ }
360
+
361
+ /**
362
+ * Checkout declared in the page code instead of a page configuration.
363
+ *
364
+ * @example
365
+ * api.getPublicOffer({
366
+ * offer: 'MAIN',
367
+ * bumps: [{ offer: 'B1', required: true }, { offer: 'B2' }],
368
+ * bumpTitle: 'Leve também',
369
+ * })
370
+ */
371
+ export declare interface CheckoutDeclaration {
372
+ /** Order bumps in display order (at most 10). Empty or absent = no bumps declared. */
373
+ bumps?: readonly DeclaredOrderBump[];
374
+ /** Title of the optional bumps. Empty uses the translated default. */
375
+ bumpTitle?: string;
376
+ /**
377
+ * Kind of page. `upsell` and `downsell` turn on the one-click interface (`offer.isOTO`);
378
+ * charging without card data still needs the cookie of the previous purchase.
379
+ */
380
+ mode?: 'checkout' | 'upsell' | 'downsell';
381
+ }
382
+
383
+ /** Purchase details, as read while waiting for a pix payment. */
384
+ export declare type CheckoutDetails = GetCheckoutDetails2xx;
385
+
386
+ /** Message of a declined or failed purchase. Renders nothing otherwise. */
387
+ export declare function CheckoutError({ className, children }: CheckoutErrorProps): ReactNode;
388
+
389
+ /** Props of {@link CheckoutError}. */
390
+ export declare interface CheckoutErrorProps {
391
+ className?: string;
392
+ children?: RenderProp<{
393
+ message: string;
394
+ code: string | undefined;
395
+ }>;
396
+ }
397
+
398
+ /** Locale of texts and number formatting. */
399
+ export declare type CheckoutLocale = 'pt-BR' | 'en' | 'es';
400
+
401
+ /**
402
+ * What the host page knows about where the checkout is rendered. It replaces router access: the
403
+ * host (a framework route, a static site, a plugin) reads its own URL and fills this in.
404
+ */
405
+ export declare interface CheckoutLocation {
406
+ /** Id of the page that hosts the checkout, sent with the purchase for attribution. */
407
+ pageId?: string;
408
+ /** URL of the page that hosts the checkout. Defaults to `window.location.href` in the browser. */
409
+ pageUrl?: string;
410
+ /** Affiliate hash from the link (`?a=`). Dropped when the affiliation is suspended. */
411
+ affiliateHash?: string;
412
+ /** Coupon from the link, applied once after hydration. */
413
+ couponCode?: string;
414
+ /** Where "decline" in a one-time offer sends the buyer. */
415
+ downsellUrl?: string;
416
+ /** Values to prefill the personal data form with. */
417
+ prefill?: Partial<PersonalDataValues>;
418
+ tracking?: CheckoutTracking;
419
+ }
420
+
421
+ /** Every text the package renders or returns. Override any of them through `messages`. */
422
+ export declare interface CheckoutMessages extends ValidationMessages {
423
+ csrfUnavailable: string;
424
+ recaptchaUnavailable: string;
425
+ cardNotReady: string;
426
+ cardIncomplete: string;
427
+ methodUnavailable: string;
428
+ purchaseFailed: string;
429
+ purchaseTimeout: string;
430
+ pixExpired: string;
431
+ /** Heading of the required order bumps. */
432
+ includedInOrder: string;
433
+ /** Default title of the optional bumps when there is one. */
434
+ specialOffer: string;
435
+ /** Default title of the optional bumps when there are several. */
436
+ specialOffers: string;
437
+ }
438
+
439
+ /** One pixel configured on the offer. */
440
+ export declare type CheckoutPixel = GetPublicOfferCheckout2xx['pixels'][number];
441
+
442
+ /** Server-computed prices, installments and coupon result for the current selection. */
443
+ export declare type CheckoutPricing = GetCheckoutPricing2xx;
444
+
445
+ /**
446
+ * Root of the checkout. Renders nothing itself; every component and hook reads from it.
447
+ *
448
+ * SSR: the first render uses only `offer` (and `initialPricing`), so the server HTML and the
449
+ * first client render match. After hydration the provider loads the visitor (one-click data,
450
+ * session id, affiliate status), the server pricing and an initial coupon, and only the parts that
451
+ * depend on them re-render.
452
+ */
453
+ export declare function CheckoutProvider(props: CheckoutProviderProps): ReactNode;
454
+
455
+ /** Props of {@link CheckoutProvider}. */
456
+ export declare interface CheckoutProviderProps extends CheckoutCallbacks {
457
+ /**
458
+ * Public offer data, fetched before render (prerender, SSR or a server loader). Everything the
459
+ * first paint needs (name, price, bumps, installments) comes from here, so the provider never
460
+ * fetches during render.
461
+ */
462
+ offer: PublicOfferCheckout;
463
+ /** Where the checkout routes live. Defaults to `{ baseUrl: '/__clickmax/payments' }`. */
464
+ transport?: CheckoutTransport;
465
+ /**
466
+ * Origin that serves the hosted card fields, such as `https://payments.example.com`. Required
467
+ * only when the page renders `CardFields`.
468
+ */
469
+ paymentsOrigin?: string;
470
+ /** What the host page knows about the visit: affiliate, coupon, page id, tracking, prefill. */
471
+ location?: CheckoutLocation;
472
+ /** Locale of texts and number formatting. Defaults to `pt-BR`. */
473
+ locale?: CheckoutLocale;
474
+ /** Overrides any text the package returns. */
475
+ messages?: Partial<CheckoutMessages>;
476
+ /**
477
+ * Pricing computed on the server at prerender time. Without it, the first paint uses the
478
+ * offer's own prices and the server pricing replaces them after hydration.
479
+ */
480
+ initialPricing?: CheckoutPricing;
481
+ /**
482
+ * Returns a reCAPTCHA v3 token for the action `checkout`. The purchase route requires one in
483
+ * production; the host decides how to load reCAPTCHA.
484
+ */
485
+ getRecaptchaToken?: () => Promise<string>;
486
+ /** Asks the buyer to type the email twice. Defaults to `false`. */
487
+ requireEmailConfirmation?: boolean;
488
+ /** Interval between checks of a pending pix, in milliseconds. Defaults to 5 seconds. */
489
+ pixPollIntervalMs?: number;
490
+ children?: ReactNode;
491
+ }
492
+
493
+ /** Totals of the current selection, in cents. */
494
+ export declare interface CheckoutSummary {
495
+ subtotal: number;
496
+ offerDiscount: number;
497
+ couponDiscount: number;
498
+ platformFee: number;
499
+ freight: number;
500
+ total: number;
501
+ /** `true` while the server pricing has not answered yet and the offer's prices are shown. */
502
+ isEstimate: boolean;
503
+ }
504
+
505
+ /** Buyer telephone split as the payments API expects it. */
506
+ export declare interface CheckoutTelephone {
507
+ countryCode: string;
508
+ areaCode: string;
509
+ number: string;
510
+ }
511
+
512
+ /** Tracking parameters of the visit, forwarded with the purchase. */
513
+ export declare interface CheckoutTracking {
514
+ utmSource?: string;
515
+ utmMedium?: string;
516
+ utmCampaign?: string;
517
+ utmTerm?: string;
518
+ utmContent?: string;
519
+ src?: string;
520
+ sck?: string;
521
+ referrer?: string;
522
+ landingUrl?: string;
523
+ /** Meta browser ids (`_fbp`, `_fbc` cookies) for server-side dedup. */
524
+ clientFbp?: string;
525
+ clientFbc?: string;
526
+ /** Any other query parameter the seller tracks. */
527
+ extraParams?: Record<string, string>;
528
+ }
529
+
530
+ /**
531
+ * Where and how the checkout calls the payments API. Every call goes through one base URL, so a
532
+ * site can route them through its own origin (a same-domain proxy) instead of a separate host.
533
+ */
534
+ export declare interface CheckoutTransport {
535
+ /**
536
+ * Base URL every checkout route is appended to, such as `/__clickmax/payments` or
537
+ * `https://payments-api.example.com`. Relative values resolve against the page origin.
538
+ */
539
+ readonly baseUrl: string;
540
+ /** `fetch` implementation; defaults to `globalThis.fetch`, looked up on each call. */
541
+ readonly fetch?: typeof globalThis.fetch;
542
+ /**
543
+ * Cookie policy of every request. Defaults to `same-origin`, right for a same-domain proxy.
544
+ * Use `include` when the base URL is on another origin that answers with CORS credentials.
545
+ */
546
+ readonly credentials?: RequestCredentials;
547
+ /** Extra headers sent with every request. */
548
+ readonly headers?: Readonly<Record<string, string>>;
549
+ }
550
+
551
+ export declare class ClickmaxElementsError extends Error {
552
+ readonly code: TokenizeError['code'] | 'timeout' | 'destroyed';
553
+ constructor(code: ClickmaxElementsError['code'], message: string);
554
+ }
555
+
556
+ /** Urgency countdown. Shown only when the offer enables the timer, unless `force`. */
557
+ export declare function CountdownTimer({ seconds, force, className, children, }: CountdownTimerProps): ReactNode;
558
+
559
+ /** Props of {@link CountdownTimer}. */
560
+ export declare interface CountdownTimerProps {
561
+ /** Length of the countdown in seconds. Defaults to 10 minutes. */
562
+ seconds?: number;
563
+ /** Shows the timer even when the offer does not ask for one. */
564
+ force?: boolean;
565
+ className?: string;
566
+ children?: RenderProp<ReturnType<typeof useCountdown>>;
567
+ }
568
+
569
+ declare type CouponErrorTypeSchema = 'not_found' | 'inactive' | 'expired' | 'not_started' | 'max_uses_reached' | 'max_uses_per_user_reached' | 'offer_not_eligible' | 'buyer_not_eligible';
570
+
571
+ /** Coupon input. Renders nothing when the offer does not accept coupons. */
572
+ export declare function CouponField({ className, children }: CouponFieldProps): ReactNode;
573
+
574
+ /** Props of {@link CouponField}. */
575
+ export declare interface CouponFieldProps {
576
+ className?: string;
577
+ children?: RenderProp<ReturnType<typeof useCoupon>>;
578
+ }
579
+
580
+ /** Result of a coupon validation. */
581
+ export declare type CouponValidation = ValidateCheckoutCoupon2xx;
582
+
583
+ /**
584
+ * Creates a {@link CheckoutApi} bound to a transport.
585
+ *
586
+ * @param transport Base URL and fetch settings of every call.
587
+ */
588
+ export declare function createCheckoutApi(transport: CheckoutTransport): CheckoutApi;
589
+
590
+ declare type DateSchema = string;
591
+
592
+ /** One order bump declared in code: the hash of its offer, and whether it is always included. */
593
+ export declare interface DeclaredOrderBump {
594
+ /** Hash of the bump offer. */
595
+ offer: string;
596
+ /** Always in the order, with no checkbox. Defaults to `false`. */
597
+ required?: boolean;
598
+ }
599
+
600
+ /** Payload of `onDeclined`. */
601
+ export declare interface DeclinedPurchase {
602
+ method: PaymentMethod;
603
+ /** HTTP status of the refusal, `0` for network failures. */
604
+ status: number;
605
+ code: string | undefined;
606
+ message: string;
607
+ }
608
+
609
+ /** Base URL used when the provider gets no `transport`: the same-domain proxy of a site. */
610
+ export declare const DEFAULT_PAYMENTS_BASE_URL = "/__clickmax/payments";
611
+
612
+ declare type DiscountTypeSchema = 'percentage' | 'fixed';
613
+
614
+ export declare type ElementsAppearance = {
615
+ variables?: ElementsAppearanceVariables;
616
+ /** Só folhas do Google Fonts, que é o que a CSP do payments libera. */
617
+ fonts?: Array<{
618
+ cssSrc: string;
619
+ }>;
620
+ layout?: 'stacked' | 'row';
621
+ /** Mostra os rótulos acima dos campos. Sem rótulo visível, o rótulo fica só para leitor de tela. */
622
+ labels?: 'above' | 'hidden';
623
+ };
624
+
625
+ /**
626
+ * Tokens fechados de aparência. Não existe campo de CSS livre: cada valor é validado por tipo no
627
+ * iframe (`sanitizeAppearance`) e vira variável CSS, nunca texto concatenado numa folha.
628
+ */
629
+ export declare type ElementsAppearanceVariables = {
630
+ colorText?: string;
631
+ colorPlaceholder?: string;
632
+ colorBackground?: string;
633
+ colorBorder?: string;
634
+ colorFocus?: string;
635
+ colorDanger?: string;
636
+ colorLabel?: string;
637
+ fontFamily?: string;
638
+ fontSizeBase?: string;
639
+ fontWeight?: string | number;
640
+ borderRadius?: string;
641
+ borderWidth?: string;
642
+ spacing?: string;
643
+ inputHeight?: string;
644
+ };
645
+
646
+ /** Exatamente a entrada `cards.<gateway>` que a rota de compra aceita. */
647
+ declare type ElementsGatewayCard = {
648
+ cardId: string;
649
+ customerId: string;
650
+ holderName: string;
651
+ brand: string;
652
+ lastDigits: string;
653
+ firstDigits: string;
654
+ expirationMonth: string;
655
+ expirationYear: string;
656
+ paymentMethodId?: string;
657
+ };
658
+
659
+ declare type ElementsLocale = 'pt-BR' | 'en' | 'es';
660
+
661
+ /** Field errors keyed by field name. A field without an entry is valid. */
662
+ export declare type FieldErrors<T> = Partial<Record<keyof T, string>>;
663
+
664
+ /** Props for one field input, ready to spread on an `<input>`. */
665
+ export declare interface FieldProps {
666
+ id: string;
667
+ name: string;
668
+ value: string;
669
+ onChange: (event: {
670
+ target: {
671
+ value: string;
672
+ };
673
+ }) => void;
674
+ 'aria-invalid': boolean;
675
+ 'aria-describedby': string | undefined;
676
+ autoComplete: string;
677
+ inputMode?: 'text' | 'email' | 'tel' | 'numeric';
678
+ }
679
+
680
+ /** One field: input props, label-friendly id and error. */
681
+ export declare interface FieldState {
682
+ props: FieldProps;
683
+ error: string | undefined;
684
+ }
685
+
686
+ /**
687
+ * Formats an amount in cents. The currency is the offer's (always BRL today); only the separators
688
+ * follow the locale, so the same price reads the same on the server and in the browser.
689
+ *
690
+ * @param cents Integer amount in cents, as every checkout price comes from the API.
691
+ * @param locale Number formatting locale.
692
+ */
693
+ export declare function formatMoney(cents: number, locale?: CheckoutLocale): string;
694
+
695
+ /** Freight method accepted by the purchase. */
696
+ export declare type FreightMethod = NonNullable<OfferCheckoutBody['freightMethod']>;
697
+
698
+ /** One freight option. */
699
+ export declare type FreightOption = GetOfferFreightQuote2xx['freights'][number];
700
+
701
+ /** Freight options of a physical offer, once the zip code is known. */
702
+ export declare function FreightOptions({ className, children }: FreightOptionsProps): ReactNode;
703
+
704
+ /** Props of {@link FreightOptions}. */
705
+ export declare interface FreightOptionsProps {
706
+ className?: string;
707
+ children?: RenderProp<ReturnType<typeof useFreight> & {
708
+ formatMoney: (cents: number) => string;
709
+ }>;
710
+ }
711
+
712
+ /** Freight options for a zip code. */
713
+ export declare type FreightQuote = GetOfferFreightQuote2xx;
714
+
715
+ declare type GetCheckoutDetails2xx = ({
716
+ type: 'subscription';
717
+ } | {
718
+ type: 'credit';
719
+ } | {
720
+ type: 'boleto';
721
+ boletoUrl: string;
722
+ barcode: string;
723
+ expiresAt?: string;
724
+ } | {
725
+ type: 'pix';
726
+ qrcodeUrl: string;
727
+ code: string;
728
+ } | {
729
+ type: 'free';
730
+ }) & {
731
+ planId?: string;
732
+ status: TransactionStatusSchema;
733
+ /** @minimum 0 */
734
+ amount: number;
735
+ buyerEmail: string;
736
+ sellerName: string;
737
+ sellerEmail: string;
738
+ createdAt: DateSchema;
739
+ product: string;
740
+ thumbnailImage?: string;
741
+ coverImage?: string;
742
+ };
743
+
744
+ declare type GetCheckoutPricing2xx = {
745
+ items: GetCheckoutPricing2xxItemsItem[];
746
+ /** @minimum 0 */
747
+ subtotal: number;
748
+ /** @minimum 0 */
749
+ offerDiscount: number;
750
+ /** @minimum 0 */
751
+ couponDiscount: number;
752
+ /** @minimum 0 */
753
+ total: number;
754
+ /** @minimum 0 */
755
+ platformFixedFee: number;
756
+ installments: GetCheckoutPricing2xxInstallmentsItem[];
757
+ coupon?: GetCheckoutPricing2xxCoupon;
758
+ gracePeriod?: number;
759
+ isRecurrent: boolean;
760
+ availableMethods: GetCheckoutPricing2xxAvailableMethods;
761
+ };
762
+
763
+ declare type GetCheckoutPricing2xxAvailableMethods = {
764
+ credit: boolean;
765
+ pix: boolean;
766
+ boleto: boolean;
767
+ };
768
+
769
+ declare type GetCheckoutPricing2xxCoupon = {
770
+ valid: boolean;
771
+ code?: string;
772
+ discountType?: DiscountTypeSchema;
773
+ discountValue?: number;
774
+ errorType?: CouponErrorTypeSchema;
775
+ pendingBuyerCheck?: boolean;
776
+ };
777
+
778
+ declare type GetCheckoutPricing2xxInstallmentsItem = {
779
+ /**
780
+ * @minimum 1
781
+ * @maximum 12
782
+ */
783
+ installment: number;
784
+ /** @minimum 0 */
785
+ value: number;
786
+ /** @minimum 0 */
787
+ total: number;
788
+ };
789
+
790
+ declare type GetCheckoutPricing2xxItemsItem = {
791
+ id: string;
792
+ name: string;
793
+ type: GetCheckoutPricing2xxItemsItemType;
794
+ /** @minimum 0 */
795
+ originalPrice: number;
796
+ /** @minimum 0 */
797
+ effectivePrice: number;
798
+ installments: GetCheckoutPricing2xxItemsItemInstallmentsItem[];
799
+ isRecurrent: boolean;
800
+ /** @nullable */
801
+ recurrenceFrequency?: string | null;
802
+ };
803
+
804
+ declare type GetCheckoutPricing2xxItemsItemInstallmentsItem = {
805
+ /**
806
+ * @minimum 1
807
+ * @maximum 12
808
+ */
809
+ installment: number;
810
+ /** @minimum 0 */
811
+ value: number;
812
+ };
813
+
814
+ declare type GetCheckoutPricing2xxItemsItemType = 'main' | 'orderBump';
815
+
816
+ declare const getCheckoutStatus: (id: string, options?: Parameters<typeof http>[1]) => Promise<GetCheckoutStatus2xx>;
817
+
818
+ declare type GetCheckoutStatus2xx = {
819
+ message: string;
820
+ error?: string;
821
+ result?: GetCheckoutStatus2xxResult;
822
+ position?: number;
823
+ };
824
+
825
+ declare type GetCheckoutStatus2xxResult = ({
826
+ type: 'credit';
827
+ } | {
828
+ type: 'boleto';
829
+ boletoUrl: string;
830
+ barcode: string;
831
+ } | {
832
+ type: 'pix';
833
+ qrcodeUrl: string;
834
+ code: string;
835
+ expirationDateTime?: DateSchema;
836
+ recurring?: {
837
+ frequency: string;
838
+ authorizationUrl?: string;
839
+ authorized?: boolean;
840
+ };
841
+ } | {
842
+ type: 'free';
843
+ } | {
844
+ type: 'subscription';
845
+ }) & {
846
+ id: string;
847
+ /** @minimum 0 */
848
+ totalAmount: number;
849
+ planId?: string;
850
+ };
851
+
852
+ declare type GetOfferCheckoutVisitor2xx = {
853
+ oneClickBuy?: GetOfferCheckoutVisitor2xxOneClickBuy;
854
+ sourceId: string;
855
+ isAffiliationSuspended: boolean;
856
+ };
857
+
858
+ declare type GetOfferCheckoutVisitor2xxOneClickBuy = {
859
+ name: string;
860
+ /**
861
+ * @minLength 5
862
+ * @maxLength 255
863
+ */
864
+ email: string;
865
+ /**
866
+ * @minLength 11
867
+ * @maxLength 14
868
+ * @nullable
869
+ * @pattern ^([0-9]{11}|[0-9]{14})$
870
+ */
871
+ document?: string | null;
872
+ telephone: GetOfferCheckoutVisitor2xxOneClickBuyTelephone;
873
+ address: GetOfferCheckoutVisitor2xxOneClickBuyAddress;
874
+ card?: GetOfferCheckoutVisitor2xxOneClickBuyCard;
875
+ lastPaymentMethod?: GetOfferCheckoutVisitor2xxOneClickBuyLastPaymentMethod;
876
+ /**
877
+ * @minimum 1
878
+ * @maximum 12
879
+ */
880
+ lastInstallment?: number;
881
+ };
882
+
883
+ declare type GetOfferCheckoutVisitor2xxOneClickBuyAddress = {
884
+ /** @nullable */
885
+ street?: string | null;
886
+ /** @nullable */
887
+ number?: string | null;
888
+ /** @nullable */
889
+ complement?: string | null;
890
+ /** @nullable */
891
+ neighborhood?: string | null;
892
+ /** @nullable */
893
+ city?: string | null;
894
+ /**
895
+ * @maxLength 100
896
+ * @nullable
897
+ */
898
+ state?: string | null;
899
+ /**
900
+ * @minLength 2
901
+ * @maxLength 2
902
+ * @nullable
903
+ * @pattern ^[A-Z]{2}$
904
+ */
905
+ country?: string | null;
906
+ /**
907
+ * @minLength 3
908
+ * @maxLength 12
909
+ * @nullable
910
+ */
911
+ zipCode?: string | null;
912
+ /** @nullable */
913
+ referencePoint?: string | null;
914
+ };
915
+
916
+ declare type GetOfferCheckoutVisitor2xxOneClickBuyCard = {
917
+ brand: string;
918
+ /**
919
+ * @minLength 2
920
+ * @maxLength 6
921
+ * @pattern ^[0-9]{2,6}$
922
+ */
923
+ lastDigits: string;
924
+ };
925
+
926
+ declare type GetOfferCheckoutVisitor2xxOneClickBuyLastPaymentMethod = 'credit' | 'pix' | 'boleto';
927
+
928
+ declare type GetOfferCheckoutVisitor2xxOneClickBuyTelephone = {
929
+ countryCode: string;
930
+ areaCode: string;
931
+ number: string;
932
+ };
933
+
934
+ declare type GetOfferFreightQuote2xx = {
935
+ type: string;
936
+ freights: GetOfferFreightQuote2xxFreightsItem[];
937
+ };
938
+
939
+ declare type GetOfferFreightQuote2xxFreightsItem = {
940
+ method: string;
941
+ /** @minimum 0 */
942
+ value: number;
943
+ /** @minimum 0 */
944
+ days?: number;
945
+ };
946
+
947
+ declare type GetPublicOfferCheckout2xx = {
948
+ pixels: GetPublicOfferCheckout2xxPixelsItem[];
949
+ orderBumps: GetPublicOfferCheckout2xxOrderBumpsItem[];
950
+ isPreview: boolean;
951
+ isSellerPending: boolean;
952
+ isAnyOfferPending: boolean;
953
+ isOfferUnavailable: boolean;
954
+ isRecurrent: boolean;
955
+ hash: string;
956
+ /** @maxLength 1000 */
957
+ name: string;
958
+ /**
959
+ * @maxLength 120
960
+ * @nullable
961
+ */
962
+ checkoutTitle?: string | null;
963
+ requiredAddress: boolean;
964
+ isPhysical: boolean;
965
+ /** @nullable */
966
+ freightConfig?: GetPublicOfferCheckout2xxFreightConfig;
967
+ /** @nullable */
968
+ socialProof?: GetPublicOfferCheckout2xxSocialProof;
969
+ /**
970
+ * @maxLength 1000
971
+ * @nullable
972
+ */
973
+ description?: string | null;
974
+ methods: GetPublicOfferCheckout2xxMethods;
975
+ showTimer: boolean;
976
+ showCoupon: boolean;
977
+ highlightInstallment: boolean;
978
+ passPlatformFee: boolean;
979
+ showDescription: boolean;
980
+ productId: string;
981
+ /** @nullable */
982
+ externalId?: string | null;
983
+ gatewayName?: string;
984
+ /** @minimum 500 */
985
+ originalPrice: number;
986
+ /**
987
+ * @minimum 500
988
+ * @nullable
989
+ */
990
+ newPrice?: number | null;
991
+ thumbnailImage?: string;
992
+ coverImage?: string;
993
+ sideImage?: string;
994
+ /** @nullable */
995
+ bannerDesktop?: string | null;
996
+ /** @nullable */
997
+ bannerMobile?: string | null;
998
+ /**
999
+ * @minimum 0
1000
+ * @maximum 12
1001
+ */
1002
+ defaultInstallment: number;
1003
+ /** @nullable */
1004
+ supportEmail?: string | null;
1005
+ configs?: GetPublicOfferCheckout2xxConfigs;
1006
+ showAffiliateAccountNotice: boolean;
1007
+ isOTO: boolean;
1008
+ };
1009
+
1010
+ declare type GetPublicOfferCheckout2xxConfigs = {
1011
+ opt: GetPublicOfferCheckout2xxConfigsOpt;
1012
+ oto?: GetPublicOfferCheckout2xxConfigsOto;
1013
+ general: GetPublicOfferCheckout2xxConfigsGeneral;
1014
+ steps: GetPublicOfferCheckout2xxConfigsSteps;
1015
+ product: GetPublicOfferCheckout2xxConfigsProduct;
1016
+ address: GetPublicOfferCheckout2xxConfigsAddress;
1017
+ payments: GetPublicOfferCheckout2xxConfigsPayments;
1018
+ summary: GetPublicOfferCheckout2xxConfigsSummary;
1019
+ orderBump: GetPublicOfferCheckout2xxConfigsOrderBump;
1020
+ buttons: GetPublicOfferCheckout2xxConfigsButtons;
1021
+ loader: GetPublicOfferCheckout2xxConfigsLoader;
1022
+ };
1023
+
1024
+ declare type GetPublicOfferCheckout2xxConfigsAddress = {
1025
+ showAddress: boolean;
1026
+ showShipping?: boolean;
1027
+ titleText: string;
1028
+ };
1029
+
1030
+ declare type GetPublicOfferCheckout2xxConfigsButtons = {
1031
+ style: PaymentsCustomCheckoutConfigsButtonStyleEnumSchema;
1032
+ text: GetPublicOfferCheckout2xxConfigsButtonsText;
1033
+ downsell: GetPublicOfferCheckout2xxConfigsButtonsDownsell;
1034
+ legalTerms: GetPublicOfferCheckout2xxConfigsButtonsLegalTerms;
1035
+ redirectOnFinish: GetPublicOfferCheckout2xxConfigsButtonsRedirectOnFinish;
1036
+ buttonStyle: GetPublicOfferCheckout2xxConfigsButtonsButtonStyle;
1037
+ border: GetPublicOfferCheckout2xxConfigsButtonsBorder;
1038
+ borderRadius: GetPublicOfferCheckout2xxConfigsButtonsBorderRadius;
1039
+ textShadow: GetPublicOfferCheckout2xxConfigsButtonsTextShadow;
1040
+ shadow: GetPublicOfferCheckout2xxConfigsButtonsShadow;
1041
+ };
1042
+
1043
+ declare type GetPublicOfferCheckout2xxConfigsButtonsBorder = {
1044
+ borderTop: string;
1045
+ borderLeft: string;
1046
+ borderRight: string;
1047
+ borderBottom: string;
1048
+ borderStyle: string;
1049
+ borderColor: string;
1050
+ borderWidth: string;
1051
+ };
1052
+
1053
+ declare type GetPublicOfferCheckout2xxConfigsButtonsBorderRadius = {
1054
+ topLeft: string;
1055
+ topRight: string;
1056
+ bottomLeft: string;
1057
+ bottomRight: string;
1058
+ };
1059
+
1060
+ declare type GetPublicOfferCheckout2xxConfigsButtonsButtonStyle = {
1061
+ state: PaymentsCustomCheckoutConfigsButtonStyleStateEnumSchema;
1062
+ default: GetPublicOfferCheckout2xxConfigsButtonsButtonStyleDefault;
1063
+ hover: GetPublicOfferCheckout2xxConfigsButtonsButtonStyleHover;
1064
+ pressed: GetPublicOfferCheckout2xxConfigsButtonsButtonStylePressed;
1065
+ };
1066
+
1067
+ declare type GetPublicOfferCheckout2xxConfigsButtonsButtonStyleDefault = {
1068
+ backgroundColor: string;
1069
+ textColor: string;
1070
+ fontSize: string;
1071
+ fontFamily: string;
1072
+ fontWeight: string;
1073
+ letterSpacing: string;
1074
+ lineHeight: string;
1075
+ textTransform: PaymentsCustomCheckoutConfigsTextTransformEnumSchema;
1076
+ textDecoration: string;
1077
+ };
1078
+
1079
+ declare type GetPublicOfferCheckout2xxConfigsButtonsButtonStyleHover = {
1080
+ backgroundColor: string;
1081
+ textColor: string;
1082
+ fontSize: string;
1083
+ fontFamily: string;
1084
+ fontWeight: string;
1085
+ letterSpacing: string;
1086
+ lineHeight: string;
1087
+ textTransform: string;
1088
+ textDecoration: string;
1089
+ };
1090
+
1091
+ declare type GetPublicOfferCheckout2xxConfigsButtonsButtonStylePressed = {
1092
+ backgroundColor: string;
1093
+ textColor: string;
1094
+ fontSize: string;
1095
+ fontFamily: string;
1096
+ fontWeight: string;
1097
+ letterSpacing: string;
1098
+ lineHeight: string;
1099
+ textTransform: string;
1100
+ textDecoration: string;
1101
+ };
1102
+
1103
+ declare type GetPublicOfferCheckout2xxConfigsButtonsDownsell = {
1104
+ show: boolean;
1105
+ text: string;
1106
+ url: string;
1107
+ };
1108
+
1109
+ declare type GetPublicOfferCheckout2xxConfigsButtonsLegalTerms = {
1110
+ show: boolean;
1111
+ text: string;
1112
+ fontFamily: string;
1113
+ fontSize: string;
1114
+ color: string;
1115
+ rounded: string;
1116
+ };
1117
+
1118
+ declare type GetPublicOfferCheckout2xxConfigsButtonsRedirectOnFinish = {
1119
+ show: boolean;
1120
+ url: string;
1121
+ };
1122
+
1123
+ declare type GetPublicOfferCheckout2xxConfigsButtonsShadow = {
1124
+ shadowColor: string;
1125
+ shadowBlur: string;
1126
+ shadowStyle: string;
1127
+ shadowX: string;
1128
+ shadowY: string;
1129
+ };
1130
+
1131
+ declare type GetPublicOfferCheckout2xxConfigsButtonsText = {
1132
+ step1: string;
1133
+ step2: string;
1134
+ step3: string;
1135
+ };
1136
+
1137
+ declare type GetPublicOfferCheckout2xxConfigsButtonsTextShadow = {
1138
+ shadowColor: string;
1139
+ shadowBlur: string;
1140
+ shadowStyle: string;
1141
+ shadowX: string;
1142
+ shadowY: string;
1143
+ };
1144
+
1145
+ declare type GetPublicOfferCheckout2xxConfigsGeneral = {
1146
+ showCTA: boolean;
1147
+ cta: GetPublicOfferCheckout2xxConfigsGeneralCta;
1148
+ typography: GetPublicOfferCheckout2xxConfigsGeneralTypography;
1149
+ dimensions: GetPublicOfferCheckout2xxConfigsGeneralDimensions;
1150
+ background: GetPublicOfferCheckout2xxConfigsGeneralBackground;
1151
+ border: GetPublicOfferCheckout2xxConfigsGeneralBorder;
1152
+ borderRadius: GetPublicOfferCheckout2xxConfigsGeneralBorderRadius;
1153
+ shadow: GetPublicOfferCheckout2xxConfigsGeneralShadow;
1154
+ inputs: GetPublicOfferCheckout2xxConfigsGeneralInputs;
1155
+ };
1156
+
1157
+ declare type GetPublicOfferCheckout2xxConfigsGeneralBackground = {
1158
+ color: string;
1159
+ };
1160
+
1161
+ declare type GetPublicOfferCheckout2xxConfigsGeneralBorder = {
1162
+ borderTop: string;
1163
+ borderLeft: string;
1164
+ borderRight: string;
1165
+ borderBottom: string;
1166
+ borderStyle: string;
1167
+ borderColor: string;
1168
+ borderWidth: string;
1169
+ };
1170
+
1171
+ declare type GetPublicOfferCheckout2xxConfigsGeneralBorderRadius = {
1172
+ topLeft: string;
1173
+ topRight: string;
1174
+ bottomLeft: string;
1175
+ bottomRight: string;
1176
+ };
1177
+
1178
+ declare type GetPublicOfferCheckout2xxConfigsGeneralCta = {
1179
+ fontFamily: string;
1180
+ fontSize: string;
1181
+ backgroundColor: string;
1182
+ textColor: string;
1183
+ borders: string;
1184
+ };
1185
+
1186
+ declare type GetPublicOfferCheckout2xxConfigsGeneralDimensions = {
1187
+ width: string;
1188
+ marginX: string;
1189
+ padding?: GetPublicOfferCheckout2xxConfigsGeneralDimensionsPadding;
1190
+ };
1191
+
1192
+ declare type GetPublicOfferCheckout2xxConfigsGeneralDimensionsPadding = {
1193
+ desktop: GetPublicOfferCheckout2xxConfigsGeneralDimensionsPaddingDesktop;
1194
+ mobile: GetPublicOfferCheckout2xxConfigsGeneralDimensionsPaddingMobile;
1195
+ };
1196
+
1197
+ declare type GetPublicOfferCheckout2xxConfigsGeneralDimensionsPaddingDesktop = {
1198
+ top: string;
1199
+ bottom: string;
1200
+ left: string;
1201
+ right: string;
1202
+ };
1203
+
1204
+ declare type GetPublicOfferCheckout2xxConfigsGeneralDimensionsPaddingMobile = {
1205
+ top: string;
1206
+ bottom: string;
1207
+ left: string;
1208
+ right: string;
1209
+ };
1210
+
1211
+ declare type GetPublicOfferCheckout2xxConfigsGeneralInputs = {
1212
+ typography: GetPublicOfferCheckout2xxConfigsGeneralInputsTypography;
1213
+ color: GetPublicOfferCheckout2xxConfigsGeneralInputsColor;
1214
+ border: GetPublicOfferCheckout2xxConfigsGeneralInputsBorder;
1215
+ borderRadius: GetPublicOfferCheckout2xxConfigsGeneralInputsBorderRadius;
1216
+ };
1217
+
1218
+ declare type GetPublicOfferCheckout2xxConfigsGeneralInputsBorder = {
1219
+ borderTop: string;
1220
+ borderLeft: string;
1221
+ borderRight: string;
1222
+ borderBottom: string;
1223
+ borderStyle: string;
1224
+ borderColor: string;
1225
+ borderWidth: string;
1226
+ };
1227
+
1228
+ declare type GetPublicOfferCheckout2xxConfigsGeneralInputsBorderRadius = {
1229
+ topLeft: string;
1230
+ topRight: string;
1231
+ bottomLeft: string;
1232
+ bottomRight: string;
1233
+ };
1234
+
1235
+ declare type GetPublicOfferCheckout2xxConfigsGeneralInputsColor = {
1236
+ backgroundColor: string;
1237
+ backgroundActiveColor: string;
1238
+ };
1239
+
1240
+ declare type GetPublicOfferCheckout2xxConfigsGeneralInputsTypography = {
1241
+ fontFamily: string;
1242
+ fontWeight: string;
1243
+ fontSize: string;
1244
+ fontColor: string;
1245
+ letterSpacing: string;
1246
+ colorPlaceholder: string;
1247
+ };
1248
+
1249
+ declare type GetPublicOfferCheckout2xxConfigsGeneralShadow = {
1250
+ shadowColor: string;
1251
+ shadowBlur: string;
1252
+ shadowStyle: string;
1253
+ shadowX: string;
1254
+ shadowY: string;
1255
+ };
1256
+
1257
+ declare type GetPublicOfferCheckout2xxConfigsGeneralTypography = {
1258
+ fontFamily: string;
1259
+ fontWeight: string;
1260
+ fontSize: string;
1261
+ fontColor: string;
1262
+ letterSpacing: string;
1263
+ lineHeight: string;
1264
+ color: string;
1265
+ textTransform: string;
1266
+ textDecoration: string;
1267
+ textAlign: string;
1268
+ opacity: string;
1269
+ linkColor: string;
1270
+ };
1271
+
1272
+ declare type GetPublicOfferCheckout2xxConfigsLoader = {
1273
+ titleText: string;
1274
+ buttonColor: string;
1275
+ colorText: string;
1276
+ iconColor: string;
1277
+ iconColor2: string;
1278
+ };
1279
+
1280
+ declare type GetPublicOfferCheckout2xxConfigsOpt = {
1281
+ pageId: string;
1282
+ };
1283
+
1284
+ declare type GetPublicOfferCheckout2xxConfigsOrderBump = {
1285
+ ids: string[];
1286
+ required: string[];
1287
+ showOrderBump: boolean;
1288
+ cardStyle: PaymentsCustomCheckoutConfigsCardStyleEnumSchema;
1289
+ showImage: boolean;
1290
+ showDescription: boolean;
1291
+ descriptionOrderBump: string[];
1292
+ title?: string;
1293
+ headerDescription: string;
1294
+ backgroundColor: string;
1295
+ borderColor: string;
1296
+ backgroundColorItem?: string;
1297
+ borderColorItem?: string;
1298
+ typography: {
1299
+ fontFamily: string;
1300
+ fontSize: string;
1301
+ titleColor: string;
1302
+ descriptionFontSize: string;
1303
+ descriptionColor: string;
1304
+ };
1305
+ price: {
1306
+ baseColor: string;
1307
+ initBaseColor: string;
1308
+ valueColor: string;
1309
+ };
1310
+ showCategoryTitle: boolean;
1311
+ categoryTitle: string;
1312
+ } & ({
1313
+ ids: string[];
1314
+ required: string[];
1315
+ showOrderBump: boolean;
1316
+ cardStyle: 'classic' | 'modern';
1317
+ showImage: boolean;
1318
+ showDescription: boolean;
1319
+ descriptionOrderBump: string[];
1320
+ title?: string;
1321
+ headerDescription?: string;
1322
+ backgroundColor: string;
1323
+ borderColor: string;
1324
+ backgroundColorItem?: string;
1325
+ borderColorItem?: string;
1326
+ typography: {
1327
+ fontFamily: string;
1328
+ fontSize: string;
1329
+ titleColor: string;
1330
+ descriptionFontSize: string;
1331
+ descriptionColor: string;
1332
+ };
1333
+ price: {
1334
+ baseColor: string;
1335
+ initBaseColor: string;
1336
+ valueColor: string;
1337
+ };
1338
+ showCategoryTitle: boolean;
1339
+ categoryTitle: string;
1340
+ });
1341
+
1342
+ declare type GetPublicOfferCheckout2xxConfigsOto = {
1343
+ mode: PaymentsCustomCheckoutConfigsModeEnumSchema;
1344
+ };
1345
+
1346
+ declare type GetPublicOfferCheckout2xxConfigsPayments = {
1347
+ showCreditCard: boolean;
1348
+ showFlagsCreditCard: boolean;
1349
+ showPreviewCreditCard: boolean;
1350
+ showPix: boolean;
1351
+ showTicket: boolean;
1352
+ showTitle: boolean;
1353
+ titleText: string;
1354
+ };
1355
+
1356
+ declare type GetPublicOfferCheckout2xxConfigsProduct = {
1357
+ id: string;
1358
+ offerId?: string;
1359
+ hash?: string;
1360
+ name?: string;
1361
+ value?: number;
1362
+ srcImage?: string | null;
1363
+ productId?: string;
1364
+ productName?: string;
1365
+ productDescription?: string | null;
1366
+ productType?: string;
1367
+ productCategory?: string;
1368
+ productClass?: string;
1369
+ style: PaymentsCustomCheckoutConfigsProductStyleEnumSchema;
1370
+ showImage: boolean;
1371
+ typography: GetPublicOfferCheckout2xxConfigsProductTypography;
1372
+ price: GetPublicOfferCheckout2xxConfigsProductPrice;
1373
+ categoryTitle: GetPublicOfferCheckout2xxConfigsProductCategoryTitle;
1374
+ showOtoProduct?: boolean;
1375
+ };
1376
+
1377
+ declare type GetPublicOfferCheckout2xxConfigsProductCategoryTitle = {
1378
+ show: boolean;
1379
+ text: string;
1380
+ };
1381
+
1382
+ declare type GetPublicOfferCheckout2xxConfigsProductPrice = {
1383
+ baseColor: string;
1384
+ initBaseColor: string;
1385
+ valueColor: string;
1386
+ };
1387
+
1388
+ declare type GetPublicOfferCheckout2xxConfigsProductTypography = {
1389
+ fontFamily: string;
1390
+ fontSize: string;
1391
+ fontColor: string;
1392
+ };
1393
+
1394
+ declare type GetPublicOfferCheckout2xxConfigsSteps = {
1395
+ preview: string;
1396
+ stepsLength: PaymentsCustomCheckoutConfigsStepsLengthEnumSchema;
1397
+ showTerms: boolean;
1398
+ textTerm: string;
1399
+ colorTerm: string;
1400
+ orientation: PaymentsCustomCheckoutConfigsOrientationEnumSchema;
1401
+ stepperStyle: PaymentsCustomCheckoutConfigsStepperStyleEnumSchema;
1402
+ title: GetPublicOfferCheckout2xxConfigsStepsTitle;
1403
+ subtitle: GetPublicOfferCheckout2xxConfigsStepsSubtitle;
1404
+ color: GetPublicOfferCheckout2xxConfigsStepsColor;
1405
+ returnButton: GetPublicOfferCheckout2xxConfigsStepsReturnButton;
1406
+ };
1407
+
1408
+ declare type GetPublicOfferCheckout2xxConfigsStepsColor = {
1409
+ state: PaymentsCustomCheckoutConfigsColorStateEnumSchema;
1410
+ active: GetPublicOfferCheckout2xxConfigsStepsColorActive;
1411
+ inactive: GetPublicOfferCheckout2xxConfigsStepsColorInactive;
1412
+ };
1413
+
1414
+ declare type GetPublicOfferCheckout2xxConfigsStepsColorActive = {
1415
+ background: string;
1416
+ title: string;
1417
+ subtitle: string;
1418
+ backgroundNumber: string;
1419
+ number: string;
1420
+ arrow: string;
1421
+ };
1422
+
1423
+ declare type GetPublicOfferCheckout2xxConfigsStepsColorInactive = {
1424
+ background: string;
1425
+ title: string;
1426
+ subtitle: string;
1427
+ backgroundNumber: string;
1428
+ number: string;
1429
+ arrow: string;
1430
+ };
1431
+
1432
+ declare type GetPublicOfferCheckout2xxConfigsStepsReturnButton = {
1433
+ color: string;
1434
+ fontSize: string;
1435
+ iconSize: string;
1436
+ fontFamily: string;
1437
+ };
1438
+
1439
+ declare type GetPublicOfferCheckout2xxConfigsStepsSubtitle = {
1440
+ show: boolean;
1441
+ step1: string;
1442
+ step2: string;
1443
+ step3: string;
1444
+ width: string;
1445
+ };
1446
+
1447
+ declare type GetPublicOfferCheckout2xxConfigsStepsTitle = {
1448
+ step1: string;
1449
+ step2: string;
1450
+ step3: string;
1451
+ width: string;
1452
+ numberWidth: string;
1453
+ };
1454
+
1455
+ declare type GetPublicOfferCheckout2xxConfigsSummary = {
1456
+ showSummary: boolean;
1457
+ summaryStyle: PaymentsCustomCheckoutConfigsSummaryStyleEnumSchema;
1458
+ showCategoryTitle: boolean;
1459
+ titleText: string;
1460
+ };
1461
+
1462
+ /**
1463
+ * @nullable
1464
+ */
1465
+ declare type GetPublicOfferCheckout2xxFreightConfig = {
1466
+ type: GetPublicOfferCheckout2xxFreightConfigType;
1467
+ /** @minimum 0 */
1468
+ preparationDay: number;
1469
+ /** @minimum 0 */
1470
+ startDay: number;
1471
+ /** @minimum 1 */
1472
+ endDay: number;
1473
+ /** @minimum 1 */
1474
+ fixedPrice?: number;
1475
+ /** @items.pattern ^[A-Z]{2}$ */
1476
+ freeStates?: string[];
1477
+ /** @items.pattern ^[A-Z]{2}$ */
1478
+ blockedStates?: string[];
1479
+ isPac?: boolean;
1480
+ /**
1481
+ * @minimum 1
1482
+ * @maximum 100000
1483
+ */
1484
+ pacFallbackPrice?: number;
1485
+ /**
1486
+ * @minimum 1
1487
+ * @maximum 100
1488
+ */
1489
+ pacFallbackEndDay?: number;
1490
+ isSedex?: boolean;
1491
+ /**
1492
+ * @minimum 1
1493
+ * @maximum 100000
1494
+ */
1495
+ sedexFallbackPrice?: number;
1496
+ /**
1497
+ * @minimum 1
1498
+ * @maximum 100
1499
+ */
1500
+ sedexFallbackEndDay?: number;
1501
+ /** @pattern ^\d{8}$ */
1502
+ zipCode?: string;
1503
+ /**
1504
+ * @minimum 0.1
1505
+ * @maximum 30
1506
+ */
1507
+ weight?: number;
1508
+ /**
1509
+ * @minimum 1
1510
+ * @maximum 100
1511
+ */
1512
+ length?: number;
1513
+ /**
1514
+ * @minimum 10
1515
+ * @maximum 100
1516
+ */
1517
+ width?: number;
1518
+ /**
1519
+ * @minimum 1
1520
+ * @maximum 100
1521
+ */
1522
+ height?: number;
1523
+ } | null;
1524
+
1525
+ declare type GetPublicOfferCheckout2xxFreightConfigType = 'shipping_company' | 'fixed' | 'free';
1526
+
1527
+ declare type GetPublicOfferCheckout2xxMethods = {
1528
+ pix: {
1529
+ active: boolean;
1530
+ };
1531
+ boleto: {
1532
+ active: boolean;
1533
+ };
1534
+ /** @nullable */
1535
+ recurrence: null;
1536
+ credit: {
1537
+ active: boolean;
1538
+ installments: {
1539
+ /**
1540
+ * @minimum 1
1541
+ * @maximum 12
1542
+ */
1543
+ installment: number;
1544
+ /** @minimum 0 */
1545
+ value: number;
1546
+ }[];
1547
+ };
1548
+ } | {
1549
+ pix: {
1550
+ active: boolean;
1551
+ };
1552
+ boleto: {
1553
+ active: false;
1554
+ };
1555
+ recurrence: {
1556
+ frequency: string;
1557
+ /** @minimum 0 */
1558
+ interval: number;
1559
+ /** @minimum 0 */
1560
+ duration: number;
1561
+ /** @minimum 0 */
1562
+ tolerancePeriod: number;
1563
+ /** @minimum 0 */
1564
+ gracePeriod: number;
1565
+ /**
1566
+ * @minimum 1
1567
+ * @maximum 12
1568
+ * @nullable
1569
+ */
1570
+ maxCharges?: number | null;
1571
+ };
1572
+ credit: {
1573
+ active: true;
1574
+ installments: {
1575
+ /**
1576
+ * @minimum 1
1577
+ * @maximum 12
1578
+ */
1579
+ installment: number;
1580
+ /** @minimum 0 */
1581
+ value: number;
1582
+ }[];
1583
+ };
1584
+ } | {
1585
+ pix: {
1586
+ active: boolean;
1587
+ };
1588
+ boleto: {
1589
+ active: boolean;
1590
+ };
1591
+ recurrence: {
1592
+ frequency: string;
1593
+ /** @minimum 0 */
1594
+ interval: number;
1595
+ /** @minimum 0 */
1596
+ duration: number;
1597
+ /** @minimum 0 */
1598
+ tolerancePeriod: number;
1599
+ /** @minimum 0 */
1600
+ gracePeriod: number;
1601
+ /**
1602
+ * @minimum 1
1603
+ * @maximum 12
1604
+ * @nullable
1605
+ */
1606
+ maxCharges?: number | null;
1607
+ };
1608
+ credit: {
1609
+ active: boolean;
1610
+ installments: {
1611
+ /**
1612
+ * @minimum 1
1613
+ * @maximum 12
1614
+ */
1615
+ installment: number;
1616
+ /** @minimum 0 */
1617
+ value: number;
1618
+ }[];
1619
+ };
1620
+ };
1621
+
1622
+ declare type GetPublicOfferCheckout2xxOrderBumpsItem = {
1623
+ id: string;
1624
+ /** @maxLength 1000 */
1625
+ name: string;
1626
+ /**
1627
+ * @maxLength 1000
1628
+ * @nullable
1629
+ */
1630
+ description?: string | null;
1631
+ /** @minimum 500 */
1632
+ originalPrice: number;
1633
+ /**
1634
+ * @minimum 500
1635
+ * @nullable
1636
+ */
1637
+ newPrice?: number | null;
1638
+ thumbnailImage: string;
1639
+ installments: GetPublicOfferCheckout2xxOrderBumpsItemInstallmentsItem[];
1640
+ isRecurrent: boolean;
1641
+ /** @nullable */
1642
+ recurrenceFrequency?: string | null;
1643
+ /**
1644
+ * @minimum 1
1645
+ * @maximum 12
1646
+ * @nullable
1647
+ */
1648
+ maxInstallments?: number | null;
1649
+ paymentMethods: GetPublicOfferCheckout2xxOrderBumpsItemPaymentMethods;
1650
+ };
1651
+
1652
+ declare type GetPublicOfferCheckout2xxOrderBumpsItemInstallmentsItem = {
1653
+ /**
1654
+ * @minimum 1
1655
+ * @maximum 12
1656
+ */
1657
+ installment: number;
1658
+ /** @minimum 0 */
1659
+ value: number;
1660
+ };
1661
+
1662
+ declare type GetPublicOfferCheckout2xxOrderBumpsItemPaymentMethods = {
1663
+ credit: boolean;
1664
+ pix: boolean;
1665
+ boleto: boolean;
1666
+ };
1667
+
1668
+ declare type GetPublicOfferCheckout2xxPixelsItem = {
1669
+ id: string;
1670
+ service: 'facebook' | 'google_ads';
1671
+ serviceId: string;
1672
+ eventsConfig: GetPublicOfferCheckout2xxPixelsItemEventsConfig;
1673
+ eventLabels?: GetPublicOfferCheckout2xxPixelsItemEventLabels;
1674
+ eventIds?: GetPublicOfferCheckout2xxPixelsItemEventIds;
1675
+ };
1676
+
1677
+ declare type GetPublicOfferCheckout2xxPixelsItemEventIds = {
1678
+ initiateCheckout?: string;
1679
+ addToCart?: string;
1680
+ addPaymentInfo?: string;
1681
+ };
1682
+
1683
+ declare type GetPublicOfferCheckout2xxPixelsItemEventLabels = {
1684
+ /** @maxLength 255 */
1685
+ pageView?: string;
1686
+ /** @maxLength 255 */
1687
+ initiateCheckout?: string;
1688
+ /** @maxLength 255 */
1689
+ addPaymentInfo?: string;
1690
+ /** @maxLength 255 */
1691
+ purchase?: string;
1692
+ };
1693
+
1694
+ declare type GetPublicOfferCheckout2xxPixelsItemEventsConfig = {
1695
+ pageView?: GetPublicOfferCheckout2xxPixelsItemEventsConfigPageView;
1696
+ initiateCheckout?: GetPublicOfferCheckout2xxPixelsItemEventsConfigInitiateCheckout;
1697
+ addPaymentInfo?: GetPublicOfferCheckout2xxPixelsItemEventsConfigAddPaymentInfo;
1698
+ purchase?: GetPublicOfferCheckout2xxPixelsItemEventsConfigPurchase;
1699
+ };
1700
+
1701
+ declare type GetPublicOfferCheckout2xxPixelsItemEventsConfigAddPaymentInfo = {
1702
+ enabled: boolean;
1703
+ };
1704
+
1705
+ declare type GetPublicOfferCheckout2xxPixelsItemEventsConfigInitiateCheckout = {
1706
+ enabled: boolean;
1707
+ afterPersonalData?: boolean;
1708
+ };
1709
+
1710
+ declare type GetPublicOfferCheckout2xxPixelsItemEventsConfigPageView = {
1711
+ enabled: boolean;
1712
+ };
1713
+
1714
+ declare type GetPublicOfferCheckout2xxPixelsItemEventsConfigPurchase = {
1715
+ enabled: boolean;
1716
+ paymentMethods: GetPublicOfferCheckout2xxPixelsItemEventsConfigPurchasePaymentMethods;
1717
+ };
1718
+
1719
+ declare type GetPublicOfferCheckout2xxPixelsItemEventsConfigPurchasePaymentMethods = {
1720
+ credit: boolean;
1721
+ pix: boolean;
1722
+ boleto: boolean;
1723
+ };
1724
+
1725
+ /**
1726
+ * @nullable
1727
+ */
1728
+ declare type GetPublicOfferCheckout2xxSocialProof = {
1729
+ enabled: boolean;
1730
+ types: GetPublicOfferCheckout2xxSocialProofTypesItem[];
1731
+ window: GetPublicOfferCheckout2xxSocialProofWindow;
1732
+ /** @minimum 1 */
1733
+ minCount: number;
1734
+ /** @minimum 1 */
1735
+ maxBalloons: number;
1736
+ } | null;
1737
+
1738
+ declare type GetPublicOfferCheckout2xxSocialProofTypesItem = 'views' | 'purchases' | 'orderBumpPurchases' | 'recentActivity';
1739
+
1740
+ declare type GetPublicOfferCheckout2xxSocialProofWindow = '1h' | '12h' | '24h' | '48h';
1741
+
1742
+ declare type Handler<E extends CardElementEvent> = (event: CardElementEventMap[E]) => void;
1743
+
1744
+ /**
1745
+ * Orval mutator used by every generated checkout operation. Orval counts this function's
1746
+ * parameters to type `options`, so it must keep exactly two.
1747
+ *
1748
+ * @param url Path and query relative to the base URL, such as `/checkout/offer/public?offer=x`.
1749
+ * @param options Method and body from the generated code plus the transport.
1750
+ */
1751
+ declare function http<T>(url: string, options: HttpOptions): Promise<T>;
1752
+
1753
+ /** Second argument of {@link http}; the generated operations type their `options` from it. */
1754
+ declare type HttpOptions = {
1755
+ transport?: CheckoutTransport;
1756
+ method?: string;
1757
+ body?: RequestInit['body'];
1758
+ headers?: RequestInit['headers'];
1759
+ signal?: AbortSignal;
1760
+ };
1761
+
1762
+ /** One installment option, values in cents. */
1763
+ export declare interface InstallmentOption {
1764
+ installment: number;
1765
+ value: number;
1766
+ total: number;
1767
+ }
1768
+
1769
+ /** Installment options of a card purchase, computed by the server. */
1770
+ export declare function Installments({ className, children }: InstallmentsProps): ReactNode;
1771
+
1772
+ /** Props of {@link Installments}. */
1773
+ export declare interface InstallmentsProps {
1774
+ className?: string;
1775
+ children?: RenderProp<{
1776
+ options: Array<{
1777
+ installment: number;
1778
+ value: number;
1779
+ total: number;
1780
+ label: string;
1781
+ }>;
1782
+ installment: number;
1783
+ select: (installment: number) => void;
1784
+ }>;
1785
+ }
1786
+
1787
+ /**
1788
+ * Validates a Brazilian CPF (11 digits) or CNPJ (14 digits), with or without punctuation.
1789
+ *
1790
+ * @param value Document as typed.
1791
+ */
1792
+ export declare function isValidDocument(value: string): boolean;
1793
+
1794
+ declare type LanguageSchema = 'pt' | 'en' | 'es';
1795
+
1796
+ declare type OfferCheckout2xx = ({
1797
+ type: 'credit';
1798
+ } | {
1799
+ type: 'boleto';
1800
+ boletoUrl: string;
1801
+ barcode: string;
1802
+ } | {
1803
+ type: 'pix';
1804
+ qrcodeUrl: string;
1805
+ code: string;
1806
+ expirationDateTime?: DateSchema;
1807
+ recurring?: {
1808
+ frequency: string;
1809
+ authorizationUrl?: string;
1810
+ authorized?: boolean;
1811
+ };
1812
+ } | {
1813
+ type: 'free';
1814
+ } | {
1815
+ type: 'subscription';
1816
+ }) & {
1817
+ id: string;
1818
+ /** @minimum 0 */
1819
+ totalAmount: number;
1820
+ planId?: string;
1821
+ } | {
1822
+ message: string;
1823
+ jobId: string;
1824
+ };
1825
+
1826
+ declare type OfferCheckoutBody = ({
1827
+ type: 'credit';
1828
+ /**
1829
+ * @minimum 1
1830
+ * @maximum 12
1831
+ */
1832
+ installments: number;
1833
+ card?: {
1834
+ cardNumber: string;
1835
+ holderName: string;
1836
+ /**
1837
+ * @minLength 2
1838
+ * @maxLength 2
1839
+ * @pattern ^[0-9]{2}$
1840
+ */
1841
+ expirationMonth: string;
1842
+ /**
1843
+ * @minLength 4
1844
+ * @maxLength 4
1845
+ * @pattern ^[0-9]{4}$
1846
+ */
1847
+ expirationYear: string;
1848
+ securityCode: string;
1849
+ };
1850
+ cards?: {
1851
+ [key: string]: {
1852
+ cardId: string;
1853
+ customerId: string;
1854
+ holderName: string;
1855
+ brand: string;
1856
+ lastDigits: string;
1857
+ firstDigits: string;
1858
+ expirationMonth: string;
1859
+ expirationYear: string;
1860
+ paymentMethodId?: string;
1861
+ };
1862
+ };
1863
+ } | {
1864
+ type: 'pix';
1865
+ } | {
1866
+ type: 'boleto';
1867
+ }) & {
1868
+ offer: string;
1869
+ orderBumpIds?: string[];
1870
+ affiliateHash?: string;
1871
+ linkCheckout: string;
1872
+ recaptcha: string;
1873
+ couponCode?: string;
1874
+ freightMethod?: TransactionFreightMethod;
1875
+ isForeign?: boolean;
1876
+ language?: LanguageSchema;
1877
+ /** @maxLength 255 */
1878
+ clientFbp?: string;
1879
+ /** @maxLength 255 */
1880
+ clientFbc?: string;
1881
+ utmSource?: string;
1882
+ utmMedium?: string;
1883
+ utmCampaign?: string;
1884
+ utmTerm?: string;
1885
+ utmContent?: string;
1886
+ extraParams?: TrackingExtraParamsSchema;
1887
+ src?: string;
1888
+ sck?: string;
1889
+ pageId?: string;
1890
+ referrer?: string;
1891
+ landingUrl?: string;
1892
+ buyer?: OfferCheckoutBodyBuyer;
1893
+ };
1894
+
1895
+ declare type OfferCheckoutBodyBuyer = {
1896
+ name: string;
1897
+ /**
1898
+ * @minLength 5
1899
+ * @maxLength 255
1900
+ */
1901
+ email: string;
1902
+ /**
1903
+ * @minLength 11
1904
+ * @maxLength 14
1905
+ * @nullable
1906
+ * @pattern ^([0-9]{11}|[0-9]{14})$
1907
+ */
1908
+ document?: string | null;
1909
+ telephone: OfferCheckoutBodyBuyerTelephone;
1910
+ address?: OfferCheckoutBodyBuyerAddress;
1911
+ };
1912
+
1913
+ declare type OfferCheckoutBodyBuyerAddress = {
1914
+ /** @nullable */
1915
+ street?: string | null;
1916
+ /** @nullable */
1917
+ number?: string | null;
1918
+ /** @nullable */
1919
+ complement?: string | null;
1920
+ /** @nullable */
1921
+ neighborhood?: string | null;
1922
+ /** @nullable */
1923
+ city?: string | null;
1924
+ /**
1925
+ * @maxLength 100
1926
+ * @nullable
1927
+ */
1928
+ state?: string | null;
1929
+ /**
1930
+ * @minLength 2
1931
+ * @maxLength 2
1932
+ * @nullable
1933
+ * @pattern ^[A-Z]{2}$
1934
+ */
1935
+ country?: string | null;
1936
+ /**
1937
+ * @minLength 3
1938
+ * @maxLength 12
1939
+ * @nullable
1940
+ */
1941
+ zipCode?: string | null;
1942
+ /** @nullable */
1943
+ referencePoint?: string | null;
1944
+ };
1945
+
1946
+ declare type OfferCheckoutBodyBuyerTelephone = {
1947
+ countryCode: string;
1948
+ areaCode: string;
1949
+ number: string;
1950
+ };
1951
+
1952
+ /** Per-visitor checkout data, fetched in the browser after hydration. */
1953
+ export declare type OfferCheckoutVisitor = GetOfferCheckoutVisitor2xx;
1954
+
1955
+ /** Name, image and price of the offer. Renders on the server from the public offer data. */
1956
+ export declare function OfferItem({ className, children }: OfferItemProps): ReactNode;
1957
+
1958
+ /** Props of {@link OfferItem}. */
1959
+ export declare interface OfferItemProps {
1960
+ className?: string;
1961
+ children?: RenderProp<OfferItemState>;
1962
+ }
1963
+
1964
+ /** The main item of the offer and its price, ready to render. Available in SSR. */
1965
+ export declare interface OfferItemState {
1966
+ name: string;
1967
+ description: string | null | undefined;
1968
+ imageUrl: string | undefined;
1969
+ /** Price the buyer pays for the main item, in cents (server pricing once loaded). */
1970
+ price: number;
1971
+ /** Price before the offer discount, in cents. */
1972
+ originalPrice: number;
1973
+ hasDiscount: boolean;
1974
+ formattedPrice: string;
1975
+ formattedOriginalPrice: string;
1976
+ isRecurrent: boolean;
1977
+ /** Highest installment count and its value, for "12x of ..." labels. */
1978
+ maxInstallment: {
1979
+ installment: number;
1980
+ value: number;
1981
+ formattedValue: string;
1982
+ } | undefined;
1983
+ }
1984
+
1985
+ /** Saved buyer data of a returning visitor, used to buy with one click. */
1986
+ export declare type OneClickBuy = NonNullable<GetOfferCheckoutVisitor2xx['oneClickBuy']>;
1987
+
1988
+ /** One order bump of the offer. */
1989
+ export declare type OrderBump = GetPublicOfferCheckout2xx['orderBumps'][number];
1990
+
1991
+ /** State passed to each order bump render. */
1992
+ export declare interface OrderBumpRenderState extends OrderBumpState {
1993
+ formattedPrice: string;
1994
+ formattedOriginalPrice: string;
1995
+ toggle: (selected?: boolean) => void;
1996
+ }
1997
+
1998
+ /**
1999
+ * Order bumps of the offer. Required bumps are listed under "Included in your order", with no
2000
+ * checkbox, and are already in the total. The optional ones follow under the seller's title (or
2001
+ * the translated default), each with a checkbox; that block is hidden when every bump is
2002
+ * required. With `children`, each bump is rendered by it instead.
2003
+ */
2004
+ export declare function OrderBumps({ className, children }: OrderBumpsProps): ReactNode;
2005
+
2006
+ /** Props of {@link OrderBumps}. */
2007
+ export declare interface OrderBumpsProps {
2008
+ className?: string;
2009
+ /** Renders one bump. Required bumps come first and have `required: true`. */
2010
+ children?: RenderProp<OrderBumpRenderState>;
2011
+ }
2012
+
2013
+ /** One order bump with its selection state. */
2014
+ export declare interface OrderBumpState {
2015
+ id: string;
2016
+ name: string;
2017
+ description: string | null | undefined;
2018
+ imageUrl: string;
2019
+ /** Price before the offer discount, in cents. */
2020
+ originalPrice: number;
2021
+ /** Price the buyer pays, in cents. */
2022
+ price: number;
2023
+ isRecurrent: boolean;
2024
+ recurrenceFrequency: string | null | undefined;
2025
+ selected: boolean;
2026
+ /** Always included; cannot be removed. */
2027
+ required: boolean;
2028
+ /** Paying with the current method excludes this bump. */
2029
+ disabled: boolean;
2030
+ }
2031
+
2032
+ /** Subtotal, discounts, fees, freight and total of the current selection. */
2033
+ export declare function OrderSummary({ className, children }: OrderSummaryProps): ReactNode;
2034
+
2035
+ /** Props of {@link OrderSummary}. */
2036
+ export declare interface OrderSummaryProps {
2037
+ className?: string;
2038
+ children?: RenderProp<ReturnType<typeof useSummary>>;
2039
+ }
2040
+
2041
+ /**
2042
+ * Splits a phone into the parts the payments API expects. Without a leading `+`, the number is
2043
+ * read as Brazilian. Brazilian numbers take the first two national digits as the area code; other
2044
+ * countries keep the whole national number and send the country code only.
2045
+ *
2046
+ * Returns `undefined` when the number is too short to be real.
2047
+ *
2048
+ * @param value Phone as typed, such as `+55 (11) 91234-5678` or `11912345678`.
2049
+ * @param defaultCountryCode Country code assumed without `+`. Defaults to `55`.
2050
+ */
2051
+ export declare function parseTelephone(value: string, defaultCountryCode?: string): CheckoutTelephone | undefined;
2052
+
2053
+ /** Payment methods the checkout can submit. */
2054
+ export declare type PaymentMethod = 'credit' | 'pix' | 'boleto';
2055
+
2056
+ /** Payment methods available for the current selection (decided by the server). */
2057
+ export declare function PaymentMethods({ className, labels, children }: PaymentMethodsProps): ReactNode;
2058
+
2059
+ /** Props of {@link PaymentMethods}. */
2060
+ export declare interface PaymentMethodsProps {
2061
+ className?: string;
2062
+ labels?: Partial<Record<PaymentMethod, string>>;
2063
+ children?: RenderProp<{
2064
+ methods: PaymentMethod[];
2065
+ method: PaymentMethod | undefined;
2066
+ select: (method: PaymentMethod) => void;
2067
+ }>;
2068
+ }
2069
+
2070
+ declare type PaymentsCustomCheckoutConfigsButtonStyleEnumSchema = 'square' | 'rounded' | 'circle';
2071
+
2072
+ declare type PaymentsCustomCheckoutConfigsButtonStyleStateEnumSchema = 'default' | 'hover' | 'pressed';
2073
+
2074
+ declare type PaymentsCustomCheckoutConfigsCardStyleEnumSchema = 'classic' | 'modern';
2075
+
2076
+ declare type PaymentsCustomCheckoutConfigsColorStateEnumSchema = 'active' | 'inactive';
2077
+
2078
+ declare type PaymentsCustomCheckoutConfigsModeEnumSchema = 'auto' | 'forceOn' | 'forceOff';
2079
+
2080
+ declare type PaymentsCustomCheckoutConfigsOrientationEnumSchema = 'horizontal' | 'vertical' | 'hidden';
2081
+
2082
+ declare type PaymentsCustomCheckoutConfigsProductStyleEnumSchema = 'medium' | 'small';
2083
+
2084
+ declare type PaymentsCustomCheckoutConfigsStepperStyleEnumSchema = 'side-arrow' | 'bottom-arrow' | 'emphasis' | 'no-arrow';
2085
+
2086
+ declare type PaymentsCustomCheckoutConfigsStepsLengthEnumSchema = '1' | '2' | '3';
2087
+
2088
+ declare type PaymentsCustomCheckoutConfigsSummaryStyleEnumSchema = 'open' | 'summary';
2089
+
2090
+ declare type PaymentsCustomCheckoutConfigsTextTransformEnumSchema = 'none' | 'uppercase' | 'lowercase' | 'capitalize';
2091
+
2092
+ /** Name, email, phone and document of the buyer. */
2093
+ export declare function PersonalDataFields({ className, labels, children, }: PersonalDataFieldsProps): ReactNode;
2094
+
2095
+ /** Props of {@link PersonalDataFields}. */
2096
+ export declare interface PersonalDataFieldsProps {
2097
+ className?: string;
2098
+ /** Field labels of the default markup. */
2099
+ labels?: Partial<Record<keyof PersonalDataValues, string>>;
2100
+ children?: RenderProp<PersonalDataRenderState>;
2101
+ }
2102
+
2103
+ /** State of {@link PersonalDataFields}. */
2104
+ export declare interface PersonalDataRenderState {
2105
+ fields: Record<keyof PersonalDataValues, FieldState>;
2106
+ /** Saved data of a returning buyer, shown instead of the fields until they choose to edit. */
2107
+ oneClick: {
2108
+ name: string;
2109
+ email: string;
2110
+ edit: () => void;
2111
+ } | undefined;
2112
+ }
2113
+
2114
+ /** Personal data typed by the buyer. Every value is the raw text of its field. */
2115
+ export declare interface PersonalDataValues {
2116
+ name: string;
2117
+ email: string;
2118
+ /** Optional confirmation; validated only when `requireEmailConfirmation` is on. */
2119
+ confirmEmail: string;
2120
+ /** Phone with country code, such as `+55 11 91234-5678`. Without `+`, Brazil is assumed. */
2121
+ phone: string;
2122
+ /** CPF or CNPJ. Optional for foreign buyers. */
2123
+ document: string;
2124
+ }
2125
+
2126
+ /** A pix charge waiting for payment. */
2127
+ export declare interface PixCharge {
2128
+ transactionId: string;
2129
+ /** Pix copy-and-paste code. */
2130
+ code: string;
2131
+ /** Image URL of the QR code. */
2132
+ qrcodeUrl: string;
2133
+ /** When the code stops being payable, if the API sent it. */
2134
+ expiresAt: Date | undefined;
2135
+ totalAmount: number;
2136
+ }
2137
+
2138
+ /** QR code and copy-and-paste code of a pending pix, with its countdown. */
2139
+ export declare function PixPayment({ className, children }: PixPaymentProps): ReactNode;
2140
+
2141
+ /** Props of {@link PixPayment}. */
2142
+ export declare interface PixPaymentProps {
2143
+ className?: string;
2144
+ children?: RenderProp<ReturnType<typeof usePix>>;
2145
+ }
2146
+
2147
+ /** Price of the offer, with the original price struck through when there is a discount. */
2148
+ export declare function Price({ className, children }: PriceProps): ReactNode;
2149
+
2150
+ /** Props of {@link Price}. */
2151
+ export declare interface PriceProps {
2152
+ className?: string;
2153
+ children?: RenderProp<OfferItemState>;
2154
+ }
2155
+
2156
+ /**
2157
+ * Public, cacheable checkout data of one offer: name, prices, order bumps, payment methods and
2158
+ * layout configs. Fetch it on the server (prerender) and pass it to `CheckoutProvider`; it holds
2159
+ * nothing about the visitor.
2160
+ */
2161
+ export declare type PublicOfferCheckout = GetPublicOfferCheckout2xx;
2162
+
2163
+ /** Request body of the purchase. */
2164
+ export declare type PurchaseRequest = OfferCheckoutBody;
2165
+
2166
+ /** What the API answers right after the purchase is accepted for processing. */
2167
+ export declare type PurchaseResponse = OfferCheckout2xx;
2168
+
2169
+ /** Answer of the async purchase status route. `result` is set once the purchase finished. */
2170
+ export declare type PurchaseStatus = Awaited<ReturnType<typeof getCheckoutStatus>>;
2171
+
2172
+ /** Render prop: receives the component state and returns the markup. */
2173
+ export declare type RenderProp<State> = (state: State) => ReactNode;
2174
+
2175
+ /** State of the purchase attempt. */
2176
+ export declare interface SubmissionState {
2177
+ status: SubmissionStatus;
2178
+ /** Message for `declined` and `error`, ready to show. */
2179
+ error: string | undefined;
2180
+ /** Code of the refusal, when the API sends one. */
2181
+ errorCode: string | undefined;
2182
+ pix: PixCharge | undefined;
2183
+ boleto: BoletoCharge | undefined;
2184
+ transactionId: string | undefined;
2185
+ }
2186
+
2187
+ /** Where the purchase is. */
2188
+ export declare type SubmissionStatus = 'idle' | 'submitting' | 'processing' | 'approved' | 'pix_pending' | 'boleto_issued' | 'declined' | 'error';
2189
+
2190
+ /** Submits the purchase with the selected method. */
2191
+ export declare function SubmitButton({ className, label, children, }: SubmitButtonProps): ReactNode;
2192
+
2193
+ /** Props of {@link SubmitButton}. */
2194
+ export declare interface SubmitButtonProps {
2195
+ className?: string;
2196
+ /** Text of the default button. */
2197
+ label?: ReactNode;
2198
+ children?: RenderProp<ReturnType<typeof useSubmit>>;
2199
+ }
2200
+
2201
+ /** Options of one `submit` call. */
2202
+ export declare interface SubmitOptions {
2203
+ /** Pays with this method instead of the selected one (e.g. "pay with pix" buttons). */
2204
+ method?: PaymentMethod;
2205
+ }
2206
+
2207
+ /** How `submit` ended. The same information also lands in `submission` and the callbacks. */
2208
+ export declare type SubmitOutcome = {
2209
+ status: 'approved';
2210
+ purchase: ApprovedPurchase;
2211
+ } | {
2212
+ status: 'pix_pending';
2213
+ transactionId: string;
2214
+ } | {
2215
+ status: 'boleto_issued';
2216
+ transactionId: string;
2217
+ } | {
2218
+ status: 'invalid';
2219
+ }
2220
+ /** Another attempt is still running; this call did nothing. */
2221
+ | {
2222
+ status: 'busy';
2223
+ } | {
2224
+ status: 'declined';
2225
+ message: string;
2226
+ code: string | undefined;
2227
+ } | {
2228
+ status: 'error';
2229
+ message: string;
2230
+ };
2231
+
2232
+ /** Dados do comprador que a Ticto exige para criar o customer antes de cifrar o cartão. */
2233
+ declare type TokenizeBilling = {
2234
+ holderName: string;
2235
+ name: string;
2236
+ email: string;
2237
+ /** CPF ou CNPJ, só dígitos. Vazio para comprador estrangeiro. */
2238
+ document?: string;
2239
+ isForeign?: boolean;
2240
+ };
2241
+
2242
+ declare type TokenizeError = {
2243
+ code: TokenizeErrorCode;
2244
+ message: string;
2245
+ };
2246
+
2247
+ declare type TokenizeErrorCode = 'validation_error' | 'tokenization_error' | 'not_ready' | 'busy';
2248
+
2249
+ declare type TokenizeRequest = {
2250
+ billing: TokenizeBilling;
2251
+ offerCode?: string;
2252
+ };
2253
+
2254
+ declare type TokenizeResult = {
2255
+ gateway: string;
2256
+ card: ElementsGatewayCard;
2257
+ brand: CardBrand;
2258
+ };
2259
+
2260
+ declare type TrackingExtraParamsSchema = {
2261
+ vkSource?: string;
2262
+ vkAdId?: string;
2263
+ cmxAngle?: string;
2264
+ };
2265
+
2266
+ declare type TransactionFreightMethod = 'pac' | 'sedex' | 'by_producer';
2267
+
2268
+ declare type TransactionStatusSchema = 'canceled' | 'chargedBack' | 'dispute' | 'failed' | 'paid' | 'pending' | 'refunded' | 'refunding' | 'refund_rejected';
2269
+
2270
+ /** Buys the one-time offer. A returning buyer with a saved card buys with one click. */
2271
+ export declare function UpsellAcceptButton({ className, label, children, }: UpsellAcceptButtonProps): ReactNode;
2272
+
2273
+ /** Props of {@link UpsellAcceptButton}. */
2274
+ export declare interface UpsellAcceptButtonProps {
2275
+ className?: string;
2276
+ label?: ReactNode;
2277
+ children?: RenderProp<ReturnType<typeof useUpsell> & {
2278
+ isSubmitting: boolean;
2279
+ }>;
2280
+ }
2281
+
2282
+ /** Declines the one-time offer. */
2283
+ export declare function UpsellDeclineButton({ className, label, navigate, children, }: UpsellDeclineButtonProps): ReactNode;
2284
+
2285
+ /** Props of {@link UpsellDeclineButton}. */
2286
+ export declare interface UpsellDeclineButtonProps {
2287
+ className?: string;
2288
+ label?: ReactNode;
2289
+ /**
2290
+ * Sends the buyer to the downsell URL after `onUpsellDeclined`. Defaults to `true`; turn it off
2291
+ * when the host navigates by itself.
2292
+ */
2293
+ navigate?: boolean;
2294
+ children?: RenderProp<ReturnType<typeof useUpsell>>;
2295
+ }
2296
+
2297
+ /** Address fields. `required` is `false` for offers that do not ask for an address. */
2298
+ export declare function useAddress(): CheckoutContextValue['address'];
2299
+
2300
+ /** The boleto issued for the purchase, if any. */
2301
+ export declare function useBoleto(): {
2302
+ boleto: BoletoCharge | undefined;
2303
+ };
2304
+
2305
+ /** Reads the checkout. Throws outside `CheckoutProvider`. */
2306
+ export declare function useCheckout(): CheckoutContextValue;
2307
+
2308
+ /**
2309
+ * Countdown that starts at `seconds` when the page hydrates. The server renders `seconds`, so the
2310
+ * prerendered HTML and the first client render match.
2311
+ *
2312
+ * @param requestedSeconds Length of the countdown. Defaults to 10 minutes.
2313
+ */
2314
+ export declare function useCountdown(requestedSeconds?: number): {
2315
+ secondsLeft: number;
2316
+ minutes: string;
2317
+ seconds: string;
2318
+ expired: boolean;
2319
+ /** Whether the offer asks to show a timer. */
2320
+ enabled: boolean;
2321
+ };
2322
+
2323
+ /** Coupon applied to the purchase. Validation and discount come from the server. */
2324
+ export declare function useCoupon(): CheckoutContextValue['coupon'] & {
2325
+ enabled: boolean;
2326
+ };
2327
+
2328
+ /** Formats cents with the checkout locale. */
2329
+ export declare function useFormatMoney(): (cents: number) => string;
2330
+
2331
+ /** Freight quote of physical offers, loaded when the zip code is complete. */
2332
+ export declare function useFreight(): CheckoutContextValue['freight'];
2333
+
2334
+ /** Main item and price of the offer. */
2335
+ export declare function useOfferItem(): OfferItemState;
2336
+
2337
+ /** Order bumps and their selection. */
2338
+ export declare function useOrderBumps(): CheckoutContextValue['bumps'];
2339
+
2340
+ /** Payment method, installments and card state. */
2341
+ export declare function usePayment(): CheckoutContextValue['payment'];
2342
+
2343
+ /** Personal data fields plus the saved one-click data of a returning buyer. */
2344
+ export declare function usePersonalData(): CheckoutContextValue['personalData'] & {
2345
+ oneClick: CheckoutContextValue['oneClick'];
2346
+ };
2347
+
2348
+ /** The pix waiting for payment, if any, with its countdown and a copy helper. */
2349
+ export declare function usePix(): {
2350
+ pix: PixCharge | undefined;
2351
+ secondsLeft: number | undefined;
2352
+ expired: boolean;
2353
+ copy: () => Promise<boolean>;
2354
+ /** Generates a new pix (after expiry, for example). */
2355
+ regenerate: () => ReturnType<CheckoutContextValue['submit']>;
2356
+ };
2357
+
2358
+ /** Purchase state and the function that submits it. */
2359
+ export declare function useSubmit(): {
2360
+ submit: CheckoutContextValue['submit'];
2361
+ reset: CheckoutContextValue['reset'];
2362
+ submission: CheckoutContextValue['submission'];
2363
+ isSubmitting: boolean;
2364
+ };
2365
+
2366
+ /** Totals of the current selection, with formatted values. */
2367
+ export declare function useSummary(): CheckoutContextValue['summary'] & {
2368
+ formatted: Record<'subtotal' | 'offerDiscount' | 'couponDiscount' | 'platformFee' | 'freight' | 'total', string>;
2369
+ };
2370
+
2371
+ /**
2372
+ * One-time offer (upsell or downsell) actions. Accepting submits the offer like any purchase; a
2373
+ * returning buyer with saved data and card buys with one click.
2374
+ */
2375
+ export declare function useUpsell(): {
2376
+ isOneTimeOffer: boolean;
2377
+ /** The buyer's saved data and card are known, so accepting needs no form. */
2378
+ canBuyWithOneClick: boolean;
2379
+ accept: CheckoutContextValue['submit'];
2380
+ /** Calls `onUpsellDeclined` and returns where the seller wants the buyer to go next. */
2381
+ decline: () => string | undefined;
2382
+ };
2383
+
2384
+ declare type ValidateCheckoutCoupon2xx = {
2385
+ valid: boolean;
2386
+ code?: string;
2387
+ discountType?: DiscountTypeSchema;
2388
+ discountValue?: number;
2389
+ errorType?: CouponErrorTypeSchema;
2390
+ pendingBuyerCheck?: boolean;
2391
+ };
2392
+
2393
+ /** Texts of validation errors, one per rule. */
2394
+ declare interface ValidationMessages {
2395
+ required: string;
2396
+ fullName: string;
2397
+ email: string;
2398
+ emailMismatch: string;
2399
+ phone: string;
2400
+ document: string;
2401
+ zipCode: string;
2402
+ state: string;
2403
+ }
2404
+
2405
+ export { }