@clickmax/checkout-react 12.5.17 → 12.5.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -106,7 +106,23 @@ Every component takes `className` and a `children` render function. With the fun
106
106
  </PersonalDataFields>
107
107
  ```
108
108
 
109
- The same state is available through hooks: `useOfferItem`, `useOrderBumps`, `usePersonalData`, `useAddress`, `useFreight`, `usePayment`, `useCoupon`, `useSummary`, `useSubmit`, `usePix`, `useBoleto`, `useCountdown`, `useUpsell`, and `useCheckout` for everything.
109
+ The same state is available through hooks: `useOfferItem`, `useRecurrence`, `useOrderBumps`, `usePersonalData`, `useAddress`, `useFreight`, `usePayment`, `useCoupon`, `useSummary`, `useSubmit`, `usePix`, `useBoleto`, `useCountdown`, `useSocialProof`, `useUpsell`, and `useCheckout` for everything.
110
+
111
+ ## Social proof
112
+
113
+ When the seller turns social proof on for the offer, `SocialProof` shows one balloon at a time: recent purchases and charges first ("***na S. bought", with city and time), then the counts the seller enabled ("12 people purchased in the last 24 hours", views, order bumps), up to the seller's maximum of balloons. The window and the minimum of each count come from the offer settings and are applied by the API, so a count below its minimum never reaches the page.
114
+
115
+ ```tsx
116
+ <SocialProof className="fixed bottom-6 left-6 z-20 max-w-sm" />
117
+ ```
118
+
119
+ The first balloon shows 8 seconds after the page loads, each one stays 5 seconds (longer while the pointer or focus is on it) and the next comes 10 seconds later. The close button hides them for the rest of the visit, and none shows after the buyer sends the payment. Counts load once per visit and recent activity every 15 seconds, only while `SocialProof` is mounted: render it once per page. The default markup is a live region (`data-cx-checkout="social-proof"`) that you position; with a render function, `useSocialProof()` gives `balloon` (`parts` with the bold pieces, `icon`, `place`, `time`), `leaving`, `setEngaged` and `dismiss`.
120
+
121
+ ## Notices, coupons and audiences
122
+
123
+ `CheckoutNotices` shows what the buyer must know about the offer: not for sale (with the seller's support email), waiting for approval, email outside the offer's audience, free trial already used, and the free Clickmax account an affiliate-split purchase creates. `useCheckout().availability.status` tells whether to hide the form; the submit buttons stay disabled and `submit` fails without calling the API while the offer is not for sale or the email is outside its audience.
124
+
125
+ Once the buyer's email settles (600 ms after typing stops), the checkout asks the server for the best automatic coupon of that email and applies it when it beats the coupon already applied; `coupon.source` is `'auto'` and `CouponField` shows it even when the offer hides the coupon field. The same email is checked against restricted audiences: bumps outside it are disabled and leave the order (`ineligible: true`).
110
126
 
111
127
  ## Callbacks
112
128
 
@@ -160,6 +176,18 @@ Events wait for the visitor route, whose session id builds the ids. `initiateChe
160
176
 
161
177
  For an offer with `isOTO`, render `UpsellAcceptButton` and `UpsellDeclineButton`. A page with no Clickmax page configuration declares the kind of page with `getPublicOffer({ offer, mode: 'upsell' })` (or `'downsell'`), which sets `isOTO`. The declaration only changes the interface: buying without card data still needs the previous purchase in the same browser. A returning buyer with a saved card buys with one click; otherwise render the buyer form and `CardFields` as in a regular checkout.
162
178
 
179
+ ## Subscriptions and installments
180
+
181
+ For a recurring offer, `Price` adds the period suffix ("/mês", "/ano") and `Recurrence` (rendered by `OfferItem`) shows the free trial with what is charged after it, following the installment the buyer picked, and the charge limit when the subscription ends on its own. During a free trial the price today is zero. `useRecurrence()` gives the terms (`frequency`, `interval`, `gracePeriod`, `tolerancePeriod`, `maxCharges`) and the ready texts; it is `undefined` for one-time offers.
182
+
183
+ When the seller highlights the installment (`offer.highlightInstallment`), `Price` leads with "12x R$ 49,70" and the cash price follows (`data-highlight="true"`). Order bumps with a free trial show "R$ 0,00 por 30 dias" and the later charge (`bump.trial`), with the seller's own texts when set.
184
+
185
+ ## Address and pix after a reload
186
+
187
+ For Brazilian buyers, a complete zip code fills street, neighborhood, city and state through ViaCEP. Pass `zipCodeLookup` to use your own lookup, or `false` to turn it off; `useAddress().lookup.status` tells when it runs.
188
+
189
+ A generated pix is kept in the tab's `sessionStorage` (code, QR code, amount and expiry only, nothing about the buyer). When the buyer reloads the page, the provider shows it again after hydration and keeps checking it, so `onApproved` still fires once it is paid; `onPixGenerated` does not fire again (`usePix().restored`). Turn it off with `restorePendingPix={false}`, for example in previews.
190
+
163
191
  ## Prices
164
192
 
165
193
  All amounts are integers in cents. `useSummary().formatted` and `formatMoney(cents, locale)` format them. Until the server pricing answers, the summary shows the offer's own prices and `isEstimate` is `true`.
package/dist/index.d.ts CHANGED
@@ -17,6 +17,10 @@ export declare interface AddressFieldsProps {
17
17
  export declare interface AddressRenderState {
18
18
  fields: Record<keyof AddressValues, FieldState>;
19
19
  required: boolean;
20
+ /** Zip code lookup filling the rest of the address; `loading` while it runs. */
21
+ lookup: {
22
+ status: 'idle' | 'loading' | 'success' | 'error';
23
+ };
20
24
  }
21
25
 
22
26
  /** Delivery or billing address typed by the buyer. */
@@ -44,6 +48,9 @@ export declare interface ApprovedPurchase {
44
48
  /** Loading state of a value the browser fetches. */
45
49
  export declare type AsyncStatus = 'idle' | 'loading' | 'success' | 'error';
46
50
 
51
+ /** Coupon the offer gives a buyer email on its own; `discount` is in cents. */
52
+ export declare type AutoCoupon = NonNullable<FindCheckoutAutoCoupon2xx['coupon']>;
53
+
47
54
  /** A boleto issued for the purchase. */
48
55
  export declare interface BoletoCharge {
49
56
  transactionId: string;
@@ -166,6 +173,12 @@ export declare type CardValidationError = {
166
173
  message: string;
167
174
  };
168
175
 
176
+ declare type CheckCheckoutOfferEligibility2xx = {
177
+ eligible: boolean;
178
+ ineligibleOrderBumpIds: string[];
179
+ trialAvailable: boolean;
180
+ };
181
+
169
182
  /**
170
183
  * Typed client of the checkout routes of the payments API. `CheckoutProvider` creates one from
171
184
  * its `transport`; create your own to fetch the public offer on the server before rendering.
@@ -221,6 +234,38 @@ export declare interface CheckoutApi {
221
234
  getPurchaseStatus(jobId: string, options?: CheckoutCallOptions): Promise<PurchaseStatus>;
222
235
  /** Purchase details, used to learn when a pix was paid. */
223
236
  getPurchaseDetails(transactionId: string, options?: CheckoutCallOptions): Promise<CheckoutDetails>;
237
+ /**
238
+ * Social proof counts of the offer, each in its configured window. Empty when the seller turned
239
+ * social proof off or no count reaches its minimum.
240
+ */
241
+ getSocialProof(params: {
242
+ offer: string;
243
+ }, options?: CheckoutCallOptions): Promise<{
244
+ items: SocialProofCount[];
245
+ }>;
246
+ /** Recent purchases and charges of the offer, newest first. Empty when turned off. */
247
+ getRecentActivity(params: {
248
+ offer: string;
249
+ }, options?: CheckoutCallOptions): Promise<{
250
+ items: RecentActivity[];
251
+ }>;
252
+ /**
253
+ * Best automatic coupon of the offer for a buyer email (a discount the seller reserved for an
254
+ * audience), or `null`. Browser only.
255
+ */
256
+ findAutoCoupon(body: {
257
+ offerHash: string;
258
+ buyerEmail: string;
259
+ }, options?: CheckoutCallOptions): Promise<AutoCoupon | null>;
260
+ /**
261
+ * Whether a buyer email may buy an offer with a restricted audience, which of the given bumps
262
+ * it may not buy, and whether it may still use the offer's free trial.
263
+ */
264
+ checkEligibility(body: {
265
+ offerHash: string;
266
+ buyerEmail: string;
267
+ orderBumpIds?: string[];
268
+ }, options?: CheckoutCallOptions): Promise<OfferEligibility>;
224
269
  /**
225
270
  * Records the buyer as a lead before the purchase, which starts cart abandonment. Browser only
226
271
  * (uses cookies). Send `funnelCreatedLead: true` after the first capture of the visit.
@@ -326,6 +371,10 @@ export declare interface CheckoutContextValue {
326
371
  setValue: (field: keyof AddressValues, value: string) => void;
327
372
  validate: () => boolean;
328
373
  required: boolean;
374
+ /** Zip code lookup that fills the rest of the address (Brazilian buyers only). */
375
+ lookup: {
376
+ status: AsyncStatus;
377
+ };
329
378
  };
330
379
  bumps: {
331
380
  items: OrderBumpState[];
@@ -342,9 +391,32 @@ export declare interface CheckoutContextValue {
342
391
  status: AsyncStatus;
343
392
  data: CheckoutPricing | undefined;
344
393
  };
394
+ /** Subscription terms; `undefined` for one-time offers. */
395
+ recurrence: OfferRecurrence | undefined;
345
396
  summary: CheckoutSummary;
397
+ /** Whether the offer is for sale. Read from the public offer, so it renders on the server. */
398
+ availability: {
399
+ status: 'available' | 'unavailable' | 'pendingApproval';
400
+ supportEmail: string | undefined;
401
+ };
402
+ /**
403
+ * Audience check of the buyer's email, run once it settles. Only an explicit refusal counts:
404
+ * before the answer (or if it fails) nothing is blocked, and the purchase decides in the end.
405
+ */
406
+ eligibility: {
407
+ offerBlocked: boolean;
408
+ ineligibleBumpIds: string[];
409
+ /** `false` when this email already used the offer's free trial and is charged today. */
410
+ trialAvailable: boolean;
411
+ };
412
+ /** Notices for the buyer, most important first. */
413
+ notices: CheckoutNotice[];
414
+ /** Why the purchase cannot be submitted now (offer not for sale, email outside the audience). */
415
+ purchaseBlocked: string | undefined;
346
416
  coupon: {
347
417
  code: string | undefined;
418
+ /** Where the applied coupon came from; an automatic one shows even when the field is off. */
419
+ source: CouponSource | undefined;
348
420
  status: 'idle' | 'validating' | 'valid' | 'invalid';
349
421
  result: CouponValidation | undefined;
350
422
  apply: (code: string) => Promise<boolean>;
@@ -382,6 +454,18 @@ export declare interface CheckoutContextValue {
382
454
  */
383
455
  cardInteracted: () => void;
384
456
  };
457
+ /** Visit-wide state of the social proof balloons; the balloons themselves are `useSocialProof`. */
458
+ socialProof: {
459
+ /** The seller turned social proof on for this offer. */
460
+ enabled: boolean;
461
+ /**
462
+ * No balloon shows anymore: the buyer closed them in this visit (kept in `sessionStorage`) or
463
+ * sent the payment. `false` on the server and in the first client render.
464
+ */
465
+ stopped: boolean;
466
+ /** Closes the balloons for the rest of the visit. */
467
+ dismiss: () => void;
468
+ };
385
469
  submission: SubmissionState;
386
470
  submit: (options?: SubmitOptions) => Promise<SubmitOutcome>;
387
471
  /** Clears a pix, boleto or error so the buyer can try again. */
@@ -474,12 +558,103 @@ export declare interface CheckoutMessages extends ValidationMessages {
474
558
  pixExpired: string;
475
559
  /** The offer only sells to a chosen audience and this email is not part of it. */
476
560
  offerBuyerNotEligible: string;
561
+ /** Title of the notice when the offer cannot be bought (seller pending, offer off sale). */
562
+ checkoutUnavailableTitle: string;
563
+ /** Body of that notice; the seller's support email follows when there is one. */
564
+ checkoutUnavailable: string;
565
+ /** The offer or a bump is waiting for approval and cannot be sold yet. */
566
+ offerPendingApproval: string;
567
+ /** This email already used the product's free trial and is charged today. */
568
+ trialUnavailable: string;
569
+ /** The purchase creates a free Clickmax account for the buyer to recommend the product. */
570
+ affiliateAccountNotice: string;
477
571
  /** Heading of the required order bumps. */
478
572
  includedInOrder: string;
479
573
  /** Default title of the optional bumps when there is one. */
480
574
  specialOffer: string;
481
575
  /** Default title of the optional bumps when there are several. */
482
576
  specialOffers: string;
577
+ /** Price suffixes of a subscription, by frequency. */
578
+ perMonth: string;
579
+ perYear: string;
580
+ perQuarter: string;
581
+ perSemester: string;
582
+ /** Free trial of the offer. `{days}` = trial length. */
583
+ freeTrial: string;
584
+ /** Price after the trial, paid in one charge. `{price}` = price with frequency suffix. */
585
+ postTrialPrice: string;
586
+ /**
587
+ * Price after the trial, in installments. `{installments}` = count, `{value}` = one installment,
588
+ * `{price}` = cycle total with frequency suffix.
589
+ */
590
+ postTrialInstallments: string;
591
+ /** Subscription that ends on its own. `{count}` = number of charges, today's included. */
592
+ chargeLimit: string;
593
+ /** Subscription limited to the purchase charge. */
594
+ chargeLimitSingle: string;
595
+ /** Default highlight of a bump with a free trial. `{free}` = zero amount, `{days}` = length. */
596
+ bumpTrialHighlight: string;
597
+ /** Default charge after a bump trial. `{price}` = price with frequency suffix. */
598
+ bumpTrialAfter: string;
599
+ /** Accessible name of the social proof region. */
600
+ socialProofRegion: string;
601
+ /** Label of the button that closes the social proof balloons for the visit. */
602
+ socialProofClose: string;
603
+ /** `{item}` of an order bump count when the offer has more than one bump. */
604
+ socialProofExtraItem: string;
605
+ /** Count balloons. `**` marks bold; `{n}`, `{window}` and `{item}` are replaced. */
606
+ socialProofViewsOne: string;
607
+ socialProofViewsOther: string;
608
+ socialProofPurchasesOne: string;
609
+ socialProofPurchasesOther: string;
610
+ socialProofOrderBumpOne: string;
611
+ socialProofOrderBumpOther: string;
612
+ /** `{window}` of each count window. */
613
+ socialProofWindow10m: string;
614
+ socialProofWindow1h: string;
615
+ socialProofWindow12h: string;
616
+ socialProofWindow24h: string;
617
+ socialProofWindow48h: string;
618
+ socialProofWindow7d: string;
619
+ /** Recent activity, after the buyer name. */
620
+ socialProofActionPurchase: string;
621
+ socialProofActionPix: string;
622
+ socialProofActionBoleto: string;
623
+ }
624
+
625
+ /** A message the buyer should see about the offer or the purchase. */
626
+ export declare interface CheckoutNotice {
627
+ /**
628
+ * `unavailable`: the offer cannot be bought (replace the form with it). `pendingApproval`: the
629
+ * offer waits for approval. `offerIneligible`: the email is outside the offer's audience.
630
+ * `trialUnavailable`: the email already used the free trial. `affiliateAccount`: the purchase
631
+ * creates a free account for the buyer to recommend the product.
632
+ */
633
+ kind: 'unavailable' | 'pendingApproval' | 'offerIneligible' | 'trialUnavailable' | 'affiliateAccount';
634
+ title: string | undefined;
635
+ message: string;
636
+ /** Seller support email, on `unavailable` when the seller has one. */
637
+ supportEmail: string | undefined;
638
+ }
639
+
640
+ /**
641
+ * Notices about the offer and the buyer: offer not for sale (with the seller's support email),
642
+ * offer waiting for approval, email outside the offer's audience, free trial already used, and
643
+ * the free account an affiliate-split purchase creates. Renders nothing when there is none.
644
+ *
645
+ * `unavailable` and `pendingApproval` come from the public offer and render on the server; the
646
+ * others appear once the buyer's email is checked. The submit button stays disabled while the
647
+ * offer is not for sale or the email is outside its audience.
648
+ */
649
+ export declare function CheckoutNotices({ className, children }: CheckoutNoticesProps): ReactNode;
650
+
651
+ /** Props of {@link CheckoutNotices}. */
652
+ export declare interface CheckoutNoticesProps {
653
+ className?: string;
654
+ /** Renders the notices instead of the default markup. */
655
+ children?: RenderProp<{
656
+ notices: CheckoutNotice[];
657
+ }>;
483
658
  }
484
659
 
485
660
  /** One pixel configured on the offer. */
@@ -565,6 +740,16 @@ export declare interface CheckoutProviderProps extends CheckoutCallbacks {
565
740
  requireEmailConfirmation?: boolean;
566
741
  /** Interval between checks of a pending pix, in milliseconds. Defaults to 5 seconds. */
567
742
  pixPollIntervalMs?: number;
743
+ /**
744
+ * Keeps a generated pix in the tab's `sessionStorage` and shows it again (still polling) when
745
+ * the buyer reloads the page. Defaults to `true`; turn it off in previews and editors.
746
+ */
747
+ restorePendingPix?: boolean;
748
+ /**
749
+ * Fills street, neighborhood, city and state when a Brazilian buyer types a complete zip code.
750
+ * Defaults to ViaCEP; pass your own lookup or `false` to turn it off.
751
+ */
752
+ zipCodeLookup?: ZipCodeLookup | false;
568
753
  children?: ReactNode;
569
754
  }
570
755
 
@@ -646,7 +831,10 @@ export declare interface CountdownTimerProps {
646
831
 
647
832
  declare type CouponErrorTypeSchema = 'not_found' | 'inactive' | 'expired' | 'not_started' | 'max_uses_reached' | 'max_uses_per_user_reached' | 'offer_not_eligible' | 'buyer_not_eligible';
648
833
 
649
- /** Coupon input. Renders nothing when the offer does not accept coupons. */
834
+ /**
835
+ * Coupon input. Renders nothing when the offer does not accept coupons, except for a coupon the
836
+ * offer applied on its own for the buyer's email, which still shows (and still counts).
837
+ */
650
838
  export declare function CouponField({ className, children }: CouponFieldProps): ReactNode;
651
839
 
652
840
  /** Props of {@link CouponField}. */
@@ -655,6 +843,9 @@ export declare interface CouponFieldProps {
655
843
  children?: RenderProp<ReturnType<typeof useCoupon>>;
656
844
  }
657
845
 
846
+ /** Where the applied coupon came from. */
847
+ export declare type CouponSource = 'manual' | 'link' | 'auto';
848
+
658
849
  /** Result of a coupon validation. */
659
850
  export declare type CouponValidation = ValidateCheckoutCoupon2xx;
660
851
 
@@ -837,6 +1028,18 @@ export declare interface FieldState {
837
1028
  error: string | undefined;
838
1029
  }
839
1030
 
1031
+ declare type FindCheckoutAutoCoupon2xx = {
1032
+ coupon: FindCheckoutAutoCoupon2xxCoupon;
1033
+ };
1034
+
1035
+ declare type FindCheckoutAutoCoupon2xxCoupon = {
1036
+ code: string;
1037
+ discountType: DiscountTypeSchema;
1038
+ discountValue: number;
1039
+ /** @minimum 0 */
1040
+ discount: number;
1041
+ } | null;
1042
+
840
1043
  /**
841
1044
  * Formats an amount in cents. The currency is the offer's (always BRL today); only the separators
842
1045
  * follow the locale, so the same price reads the same on the server and in the browser.
@@ -967,6 +1170,34 @@ declare type GetCheckoutPricing2xxItemsItemInstallmentsItem = {
967
1170
 
968
1171
  declare type GetCheckoutPricing2xxItemsItemType = 'main' | 'orderBump';
969
1172
 
1173
+ declare type GetCheckoutRecentActivity2xx = {
1174
+ items: GetCheckoutRecentActivity2xxItemsItem[];
1175
+ };
1176
+
1177
+ declare type GetCheckoutRecentActivity2xxItemsItem = {
1178
+ id: string;
1179
+ action: GetCheckoutRecentActivity2xxItemsItemAction;
1180
+ name: string;
1181
+ city?: string;
1182
+ country?: string;
1183
+ occurredAt: string;
1184
+ };
1185
+
1186
+ declare type GetCheckoutRecentActivity2xxItemsItemAction = 'purchase' | 'pix' | 'boleto';
1187
+
1188
+ declare type GetCheckoutSocialProof2xx = {
1189
+ items: GetCheckoutSocialProof2xxItemsItem[];
1190
+ };
1191
+
1192
+ declare type GetCheckoutSocialProof2xxItemsItem = {
1193
+ type: GetCheckoutSocialProof2xxItemsItemType;
1194
+ /** @minimum 0 */
1195
+ count: number;
1196
+ window: string;
1197
+ };
1198
+
1199
+ declare type GetCheckoutSocialProof2xxItemsItemType = 'views' | 'purchases' | 'orderBumpPurchases';
1200
+
970
1201
  declare const getCheckoutStatus: (id: string, options?: Parameters<typeof http>[1]) => Promise<GetCheckoutStatus2xx>;
971
1202
 
972
1203
  declare type GetCheckoutStatus2xx = {
@@ -1180,6 +1411,7 @@ declare type GetPublicOfferCheckout2xxCheckoutPlugins = {
1180
1411
  reviews?: GetPublicOfferCheckout2xxCheckoutPluginsReviews;
1181
1412
  video?: GetPublicOfferCheckout2xxCheckoutPluginsVideo;
1182
1413
  chat?: GetPublicOfferCheckout2xxCheckoutPluginsChat;
1414
+ oneClickBuy?: GetPublicOfferCheckout2xxCheckoutPluginsOneClickBuy;
1183
1415
  combo?: GetPublicOfferCheckout2xxCheckoutPluginsCombo;
1184
1416
  } | null;
1185
1417
 
@@ -1212,6 +1444,10 @@ declare type GetPublicOfferCheckout2xxCheckoutPluginsDiscountPopup = {
1212
1444
  text: string;
1213
1445
  };
1214
1446
 
1447
+ declare type GetPublicOfferCheckout2xxCheckoutPluginsOneClickBuy = {
1448
+ enabled: boolean;
1449
+ };
1450
+
1215
1451
  declare type GetPublicOfferCheckout2xxCheckoutPluginsReviews = {
1216
1452
  enabled: boolean;
1217
1453
  /** @maxItems 10 */
@@ -2265,6 +2501,9 @@ declare type OfferCheckoutBodyBuyerTelephone = {
2265
2501
  /** Per-visitor checkout data, fetched in the browser after hydration. */
2266
2502
  export declare type OfferCheckoutVisitor = GetOfferCheckoutVisitor2xx;
2267
2503
 
2504
+ /** Audience check of a buyer email against an offer and its bumps. */
2505
+ export declare type OfferEligibility = CheckCheckoutOfferEligibility2xx;
2506
+
2268
2507
  /** Name, image and price of the offer. Renders on the server from the public offer data. */
2269
2508
  export declare function OfferItem({ className, children }: OfferItemProps): ReactNode;
2270
2509
 
@@ -2293,6 +2532,28 @@ export declare interface OfferItemState {
2293
2532
  value: number;
2294
2533
  formattedValue: string;
2295
2534
  } | undefined;
2535
+ /**
2536
+ * The seller asked to lead with the installment ("12x R$ 49,70", cash price below) instead of the
2537
+ * cash price. Only meaningful when `maxInstallment` is above 1.
2538
+ */
2539
+ highlightInstallment: boolean;
2540
+ /** Price suffix of a subscription ("/mês"); empty for one-time offers. */
2541
+ perFrequency: string;
2542
+ /** Days of free trial; `0` when the buyer pays today. During a trial the price today is zero. */
2543
+ freeTrialDays: number;
2544
+ }
2545
+
2546
+ /** Subscription terms of a recurring offer (`offer.methods.recurrence`). */
2547
+ export declare interface OfferRecurrence {
2548
+ /** `monthly`, `quarterly`, `semi-annually`, `yearly`. */
2549
+ frequency: string;
2550
+ interval: number;
2551
+ /** Days of free trial before the first charge; `0` = charged today. */
2552
+ gracePeriod: number;
2553
+ /** Days a failed renewal may stay unpaid before the subscription is canceled. */
2554
+ tolerancePeriod: number;
2555
+ /** Charges before the subscription ends on its own, today's included; `null` = until canceled. */
2556
+ maxCharges: number | null;
2296
2557
  }
2297
2558
 
2298
2559
  /** Saved buyer data of a returning visitor, used to buy with one click. */
@@ -2338,8 +2599,19 @@ export declare interface OrderBumpState {
2338
2599
  selected: boolean;
2339
2600
  /** Always included; cannot be removed. */
2340
2601
  required: boolean;
2341
- /** Paying with the current method excludes this bump. */
2602
+ /** The bump sells to a chosen audience and the buyer's email is not part of it. */
2603
+ ineligible: boolean;
2604
+ /** Cannot be selected: the current method excludes it, or the buyer is not eligible. */
2342
2605
  disabled: boolean;
2606
+ /**
2607
+ * Free trial of a subscription bump: nothing is charged today. `highlight` ("R$ 0,00 por 30
2608
+ * dias") and `after` ("Depois, R$ 49,90/mês") use the seller's texts when set.
2609
+ */
2610
+ trial: {
2611
+ days: number;
2612
+ highlight: string;
2613
+ after: string;
2614
+ } | undefined;
2343
2615
  }
2344
2616
 
2345
2617
  /** Subtotal, discounts, fees, freight and total of the current selection. */
@@ -2446,6 +2718,11 @@ export declare interface PixCharge {
2446
2718
  /** When the code stops being payable, if the API sent it. */
2447
2719
  expiresAt: Date | undefined;
2448
2720
  totalAmount: number;
2721
+ /**
2722
+ * `true` when the pix came back from the tab's storage after a reload. A restored pix does not
2723
+ * fire `onPixGenerated` again.
2724
+ */
2725
+ restored?: boolean;
2449
2726
  }
2450
2727
 
2451
2728
  /** QR code and copy-and-paste code of a pending pix, with its countdown. */
@@ -2457,7 +2734,11 @@ export declare interface PixPaymentProps {
2457
2734
  children?: RenderProp<ReturnType<typeof usePix>>;
2458
2735
  }
2459
2736
 
2460
- /** Price of the offer, with the original price struck through when there is a discount. */
2737
+ /**
2738
+ * Price of the offer, with the original price struck through when there is a discount. A
2739
+ * subscription carries its suffix ("/mês"); during a free trial the price today is zero. When the
2740
+ * seller highlights the installment, it leads and the cash price follows (`data-highlight`).
2741
+ */
2461
2742
  export declare function Price({ className, children }: PriceProps): ReactNode;
2462
2743
 
2463
2744
  /** Props of {@link Price}. */
@@ -2482,9 +2763,96 @@ export declare type PurchaseResponse = OfferCheckout2xx;
2482
2763
  /** Answer of the async purchase status route. `result` is set once the purchase finished. */
2483
2764
  export declare type PurchaseStatus = Awaited<ReturnType<typeof getCheckoutStatus>>;
2484
2765
 
2766
+ /** One recent purchase or charge of the offer. `name` comes masked, such as `***dro B. R.`. */
2767
+ export declare type RecentActivity = GetCheckoutRecentActivity2xx['items'][number];
2768
+
2769
+ /**
2770
+ * Subscription terms: the free trial with what is charged after it (following the selected
2771
+ * installment) and the charge limit. Renders nothing for one-time offers or a subscription with
2772
+ * neither.
2773
+ */
2774
+ export declare function Recurrence({ className, children }: RecurrenceProps): ReactNode;
2775
+
2776
+ /** Props of {@link Recurrence}. */
2777
+ export declare interface RecurrenceProps {
2778
+ className?: string;
2779
+ children?: RenderProp<RecurrenceState>;
2780
+ }
2781
+
2782
+ /** Subscription terms with the texts the standard checkout shows. */
2783
+ export declare interface RecurrenceState extends OfferRecurrence {
2784
+ /** Price suffix ("/mês"); empty for an unknown frequency. */
2785
+ perFrequency: string;
2786
+ /** "Grátis por 7 dias." when the offer has a free trial. */
2787
+ trialText: string | undefined;
2788
+ /**
2789
+ * What is charged after the trial, following the installment the buyer picked: "Após este
2790
+ * período, sua assinatura será cobrada em 12x de R$ 49,70 (R$ 596,40/ano)."
2791
+ */
2792
+ postTrialText: string | undefined;
2793
+ /** "Assinatura com 3 cobranças, contando a de hoje..." when the subscription ends on its own. */
2794
+ chargeLimitText: string | undefined;
2795
+ }
2796
+
2485
2797
  /** Render prop: receives the component state and returns the markup. */
2486
2798
  export declare type RenderProp<State> = (state: State) => ReactNode;
2487
2799
 
2800
+ /**
2801
+ * Social proof balloons ("12 people bought in the last 24 hours", "***dro B. R. bought"), one at
2802
+ * a time, with a close button that hides them for the visit. Renders nothing when the seller turned
2803
+ * social proof off or after the buyer closed it or sent the payment. Positioning is the page's:
2804
+ * the default markup is a live region (`data-cx-checkout="social-proof"`) to place where it fits.
2805
+ * Render it once per page.
2806
+ */
2807
+ export declare function SocialProof({ className, children }: SocialProofProps): ReactNode;
2808
+
2809
+ /** A social proof balloon ready to render, in the checkout locale. */
2810
+ export declare interface SocialProofBalloon {
2811
+ /** Stable per balloon shown; use it as the React key. */
2812
+ id: string;
2813
+ kind: 'count' | 'activity';
2814
+ icon: SocialProofIcon;
2815
+ parts: SocialProofTextPart[];
2816
+ /** `parts` joined, without markup. */
2817
+ text: string;
2818
+ /** City and country of a recent activity, when known. */
2819
+ place: string | undefined;
2820
+ /** Time of a recent activity in the browser time zone. */
2821
+ time: string | undefined;
2822
+ }
2823
+
2824
+ /** One social proof count, already filtered by the API (type on, count at or above its minimum). */
2825
+ export declare type SocialProofCount = GetCheckoutSocialProof2xx['items'][number];
2826
+
2827
+ /** Icon of a social proof balloon: the count type or the recent activity action. */
2828
+ export declare type SocialProofIcon = SocialProofCount['type'] | RecentActivity['action'];
2829
+
2830
+ /** Props of {@link SocialProof}. */
2831
+ export declare interface SocialProofProps {
2832
+ className?: string;
2833
+ children?: RenderProp<SocialProofState>;
2834
+ }
2835
+
2836
+ /** State of {@link useSocialProof}. */
2837
+ export declare interface SocialProofState {
2838
+ /** The seller turned social proof on and the buyer has not closed it nor sent the payment. */
2839
+ enabled: boolean;
2840
+ /** Balloon on screen, `undefined` between balloons and after the last one. */
2841
+ balloon: SocialProofBalloon | undefined;
2842
+ /** The balloon is on its way out (200 ms): play the exit animation. */
2843
+ leaving: boolean;
2844
+ /** Pointer or focus on the balloon: holds it on screen while `true`. */
2845
+ setEngaged: (engaged: boolean) => void;
2846
+ /** Closes the balloons for the rest of the visit. */
2847
+ dismiss: () => void;
2848
+ }
2849
+
2850
+ /** Piece of a balloon text; `strong` parts are the bold ones (count, buyer name). */
2851
+ export declare interface SocialProofTextPart {
2852
+ text: string;
2853
+ strong: boolean;
2854
+ }
2855
+
2488
2856
  /** State of the purchase attempt. */
2489
2857
  export declare interface SubmissionState {
2490
2858
  status: SubmissionStatus;
@@ -2698,6 +3066,8 @@ export declare function usePersonalData(): CheckoutContextValue['personalData']
2698
3066
  /** The pix waiting for payment, if any, with its countdown and a copy helper. */
2699
3067
  export declare function usePix(): {
2700
3068
  pix: PixCharge | undefined;
3069
+ /** `true` when the pix came back after a page reload. */
3070
+ restored: boolean;
2701
3071
  secondsLeft: number | undefined;
2702
3072
  expired: boolean;
2703
3073
  copy: () => Promise<boolean>;
@@ -2705,12 +3075,28 @@ export declare function usePix(): {
2705
3075
  regenerate: () => ReturnType<CheckoutContextValue['submit']>;
2706
3076
  };
2707
3077
 
3078
+ /** Period, free trial and charge limit of a recurring offer; `undefined` for one-time offers. */
3079
+ export declare function useRecurrence(): RecurrenceState | undefined;
3080
+
3081
+ /**
3082
+ * Social proof balloons of the offer, one at a time: recent purchases first (newest first), then
3083
+ * the counts (purchases, views, order bumps), up to the seller's maximum of balloons. Window and
3084
+ * minimum per type are applied by the API.
3085
+ *
3086
+ * Fetches the counts once per visit and the recent activity every 15 s, both after hydration and
3087
+ * only while mounted, so render it once per page (`SocialProof` does). Pauses while the tab is
3088
+ * hidden, and stops for good when the buyer closes it or sends the payment.
3089
+ */
3090
+ export declare function useSocialProof(): SocialProofState;
3091
+
2708
3092
  /** Purchase state and the function that submits it. */
2709
3093
  export declare function useSubmit(): {
2710
3094
  submit: CheckoutContextValue['submit'];
2711
3095
  reset: CheckoutContextValue['reset'];
2712
3096
  submission: CheckoutContextValue['submission'];
2713
3097
  isSubmitting: boolean;
3098
+ /** Why the purchase cannot go now (see `CheckoutNotices`); `submit` fails with it. */
3099
+ blocked: string | undefined;
2714
3100
  };
2715
3101
 
2716
3102
  /** Totals of the current selection, with formatted values. */
@@ -2752,4 +3138,18 @@ declare interface ValidationMessages {
2752
3138
  state: string;
2753
3139
  }
2754
3140
 
3141
+ /**
3142
+ * Default lookup: ViaCEP, the public service the standard checkout uses. Called straight from the
3143
+ * browser (no payments route), so it works on any host.
3144
+ */
3145
+ export declare const viaCepLookup: ZipCodeLookup;
3146
+
3147
+ /**
3148
+ * Finds the address of a Brazilian zip code (8 digits). Returns the fields it knows, or
3149
+ * `undefined` when the zip code does not exist. Rejects on network errors.
3150
+ */
3151
+ export declare type ZipCodeLookup = (zipCode: string, options: {
3152
+ signal: AbortSignal;
3153
+ }) => Promise<Partial<Pick<AddressValues, 'street' | 'neighborhood' | 'city' | 'state'>> | undefined>;
3154
+
2755
3155
  export { }