@clickmax/checkout-react 12.5.16 → 12.5.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -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,53 @@ 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>;
269
+ /**
270
+ * Records the buyer as a lead before the purchase, which starts cart abandonment. Browser only
271
+ * (uses cookies). Send `funnelCreatedLead: true` after the first capture of the visit.
272
+ */
273
+ trackLead(body: CheckoutLeadRequest, options?: CheckoutCallOptions): Promise<void>;
274
+ /** Records the payment step (method picked, card touched) for cart abandonment. Browser only. */
275
+ trackInteraction(body: CheckoutInteractionRequest, options?: CheckoutCallOptions): Promise<void>;
276
+ /**
277
+ * Sends a pixel event to the ad platform's conversions API, with the event id the browser pixel
278
+ * used. `dispatched` is `false` when no pixel of the offer takes it.
279
+ */
280
+ dispatchPixelEvent(body: CheckoutPixelDispatchRequest, options?: CheckoutCallOptions): Promise<{
281
+ dispatched: boolean;
282
+ reason?: string;
283
+ }>;
224
284
  }
225
285
 
226
286
  /** A non-2xx answer or a network failure of a checkout API call. */
@@ -255,6 +315,12 @@ export declare interface CheckoutCallbacks {
255
315
  onUpsellDeclined?: (event: {
256
316
  downsellUrl: string | undefined;
257
317
  }) => void;
318
+ /**
319
+ * An offer pixel should fire in the browser. The package does not load `fbq` or `gtag`: the host
320
+ * fires each pixel with the `eventId` given. Called only when some offer pixel tracks the event,
321
+ * once per event per mount (every approved purchase for `purchase`).
322
+ */
323
+ onPixelEvent?: (event: CheckoutPixelEvent) => void;
258
324
  }
259
325
 
260
326
  /** Per-call options of every {@link CheckoutApi} method. */
@@ -293,6 +359,11 @@ export declare interface CheckoutContextValue {
293
359
  validate: () => boolean;
294
360
  /** Whether the purchase sends typed data (`false` while buying with saved one-click data). */
295
361
  isActive: boolean;
362
+ /**
363
+ * Records the buyer as a lead (cart abandonment) once the email is valid. Call it when a field
364
+ * loses focus; the field props of `PersonalDataFields` already do. Bursts are grouped.
365
+ */
366
+ captureLead: () => void;
296
367
  };
297
368
  address: {
298
369
  values: AddressValues;
@@ -300,6 +371,10 @@ export declare interface CheckoutContextValue {
300
371
  setValue: (field: keyof AddressValues, value: string) => void;
301
372
  validate: () => boolean;
302
373
  required: boolean;
374
+ /** Zip code lookup that fills the rest of the address (Brazilian buyers only). */
375
+ lookup: {
376
+ status: AsyncStatus;
377
+ };
303
378
  };
304
379
  bumps: {
305
380
  items: OrderBumpState[];
@@ -316,9 +391,32 @@ export declare interface CheckoutContextValue {
316
391
  status: AsyncStatus;
317
392
  data: CheckoutPricing | undefined;
318
393
  };
394
+ /** Subscription terms; `undefined` for one-time offers. */
395
+ recurrence: OfferRecurrence | undefined;
319
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;
320
416
  coupon: {
321
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;
322
420
  status: 'idle' | 'validating' | 'valid' | 'invalid';
323
421
  result: CouponValidation | undefined;
324
422
  apply: (code: string) => Promise<boolean>;
@@ -350,6 +448,23 @@ export declare interface CheckoutContextValue {
350
448
  /** Registered by `CardFields`; `undefined` until the iframe mounts. */
351
449
  card: CardElement | undefined;
352
450
  registerCard: (card: CardElement | undefined) => void;
451
+ /**
452
+ * The buyer started typing the card: records the payment step and the `addPaymentInfo` pixel
453
+ * event. `CardFields` calls it on focus; call it yourself only with your own card iframe.
454
+ */
455
+ cardInteracted: () => void;
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;
353
468
  };
354
469
  submission: SubmissionState;
355
470
  submit: (options?: SubmitOptions) => Promise<SubmitOutcome>;
@@ -395,6 +510,12 @@ export declare interface CheckoutErrorProps {
395
510
  }>;
396
511
  }
397
512
 
513
+ /** Body of the payment interaction record. */
514
+ export declare type CheckoutInteractionRequest = TrackCheckoutInteractionBody;
515
+
516
+ /** Body of the lead capture. */
517
+ export declare type CheckoutLeadRequest = TrackCheckoutLeadsBody;
518
+
398
519
  /** Locale of texts and number formatting. */
399
520
  export declare type CheckoutLocale = 'pt-BR' | 'en' | 'es';
400
521
 
@@ -413,6 +534,13 @@ export declare interface CheckoutLocation {
413
534
  couponCode?: string;
414
535
  /** Where "decline" in a one-time offer sends the buyer. */
415
536
  downsellUrl?: string;
537
+ /**
538
+ * Visitor id of the site's own analytics (the `cm.v` key of the Clickmax runtime). Goes with the
539
+ * lead and the payment interaction, so cart abandonment links them to the visit.
540
+ */
541
+ visitorId?: string;
542
+ /** Session id of the site's own analytics (the `cm.s` key of the Clickmax runtime). */
543
+ sessionId?: string;
416
544
  /** Values to prefill the personal data form with. */
417
545
  prefill?: Partial<PersonalDataValues>;
418
546
  tracking?: CheckoutTracking;
@@ -430,17 +558,140 @@ export declare interface CheckoutMessages extends ValidationMessages {
430
558
  pixExpired: string;
431
559
  /** The offer only sells to a chosen audience and this email is not part of it. */
432
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;
433
571
  /** Heading of the required order bumps. */
434
572
  includedInOrder: string;
435
573
  /** Default title of the optional bumps when there is one. */
436
574
  specialOffer: string;
437
575
  /** Default title of the optional bumps when there are several. */
438
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
+ }>;
439
658
  }
440
659
 
441
660
  /** One pixel configured on the offer. */
442
661
  export declare type CheckoutPixel = GetPublicOfferCheckout2xx['pixels'][number];
443
662
 
663
+ /** Body of a pixel event sent to the conversions API. */
664
+ export declare type CheckoutPixelDispatchRequest = DispatchCheckoutPixelEventBody;
665
+
666
+ /** Payload of `onPixelEvent`. */
667
+ export declare interface CheckoutPixelEvent {
668
+ name: CheckoutPixelEventName;
669
+ /** Offer pixels set to track this event. Never empty. */
670
+ pixels: CheckoutPixelTarget[];
671
+ /** Set on `addPaymentInfo` and `purchase`. */
672
+ paymentMethod?: PaymentMethod;
673
+ /** Set on `purchase`, in cents. */
674
+ amountCents?: number;
675
+ currency?: 'BRL';
676
+ /** Set on `purchase`. */
677
+ transactionId?: string;
678
+ }
679
+
680
+ /** Pixel events the checkout reports, named as in the offer's pixel settings. */
681
+ export declare type CheckoutPixelEventName = 'pageView' | 'initiateCheckout' | 'addPaymentInfo' | 'purchase';
682
+
683
+ /** One offer pixel that tracks an event, with the id the browser pixel must send. */
684
+ export declare interface CheckoutPixelTarget {
685
+ pixel: CheckoutPixel;
686
+ /**
687
+ * Event id for the browser pixel (`eventID` in `fbq`, `transaction_id` in `gtag`). The
688
+ * conversions API gets the same id, which is how the platform drops the duplicate.
689
+ */
690
+ eventId: string;
691
+ /** Conversion label the seller set for this event (Google Ads), when any. */
692
+ label: string | undefined;
693
+ }
694
+
444
695
  /** Server-computed prices, installments and coupon result for the current selection. */
445
696
  export declare type CheckoutPricing = GetCheckoutPricing2xx;
446
697
 
@@ -489,6 +740,16 @@ export declare interface CheckoutProviderProps extends CheckoutCallbacks {
489
740
  requireEmailConfirmation?: boolean;
490
741
  /** Interval between checks of a pending pix, in milliseconds. Defaults to 5 seconds. */
491
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;
492
753
  children?: ReactNode;
493
754
  }
494
755
 
@@ -570,7 +831,10 @@ export declare interface CountdownTimerProps {
570
831
 
571
832
  declare type CouponErrorTypeSchema = 'not_found' | 'inactive' | 'expired' | 'not_started' | 'max_uses_reached' | 'max_uses_per_user_reached' | 'offer_not_eligible' | 'buyer_not_eligible';
572
833
 
573
- /** 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
+ */
574
838
  export declare function CouponField({ className, children }: CouponFieldProps): ReactNode;
575
839
 
576
840
  /** Props of {@link CouponField}. */
@@ -579,6 +843,9 @@ export declare interface CouponFieldProps {
579
843
  children?: RenderProp<ReturnType<typeof useCoupon>>;
580
844
  }
581
845
 
846
+ /** Where the applied coupon came from. */
847
+ export declare type CouponSource = 'manual' | 'link' | 'auto';
848
+
582
849
  /** Result of a coupon validation. */
583
850
  export declare type CouponValidation = ValidateCheckoutCoupon2xx;
584
851
 
@@ -613,6 +880,80 @@ export declare const DEFAULT_PAYMENTS_BASE_URL = "/__clickmax/payments";
613
880
 
614
881
  declare type DiscountTypeSchema = 'percentage' | 'fixed';
615
882
 
883
+ declare type DispatchCheckoutPixelEventBody = {
884
+ offerHash: string;
885
+ canonicalEvent: DispatchCheckoutPixelEventBodyCanonicalEvent;
886
+ eventId: string;
887
+ buyer?: DispatchCheckoutPixelEventBodyBuyer;
888
+ /** @minimum 0 */
889
+ amountCents?: number;
890
+ currency?: DispatchCheckoutPixelEventBodyCurrency;
891
+ /** @maxLength 255 */
892
+ clientFbp?: string;
893
+ /** @maxLength 255 */
894
+ clientFbc?: string;
895
+ /**
896
+ * @maxLength 2048
897
+ * @pattern ^https?://
898
+ */
899
+ eventSourceUrl?: string;
900
+ };
901
+
902
+ declare type DispatchCheckoutPixelEventBodyBuyer = {
903
+ /**
904
+ * @minLength 5
905
+ * @maxLength 255
906
+ */
907
+ email?: string;
908
+ name?: string;
909
+ document?: string;
910
+ telephone?: DispatchCheckoutPixelEventBodyBuyerTelephone;
911
+ address?: DispatchCheckoutPixelEventBodyBuyerAddress;
912
+ };
913
+
914
+ declare type DispatchCheckoutPixelEventBodyBuyerAddress = {
915
+ /** @nullable */
916
+ street?: string | null;
917
+ /** @nullable */
918
+ number?: string | null;
919
+ /** @nullable */
920
+ complement?: string | null;
921
+ /** @nullable */
922
+ neighborhood?: string | null;
923
+ /** @nullable */
924
+ city?: string | null;
925
+ /**
926
+ * @maxLength 100
927
+ * @nullable
928
+ */
929
+ state?: string | null;
930
+ /**
931
+ * @minLength 2
932
+ * @maxLength 2
933
+ * @nullable
934
+ * @pattern ^[A-Z]{2}$
935
+ */
936
+ country?: string | null;
937
+ /**
938
+ * @minLength 3
939
+ * @maxLength 12
940
+ * @nullable
941
+ */
942
+ zipCode?: string | null;
943
+ /** @nullable */
944
+ referencePoint?: string | null;
945
+ };
946
+
947
+ declare type DispatchCheckoutPixelEventBodyBuyerTelephone = {
948
+ countryCode: string;
949
+ areaCode: string;
950
+ number: string;
951
+ };
952
+
953
+ declare type DispatchCheckoutPixelEventBodyCanonicalEvent = 'initiateCheckout' | 'addPaymentInfo';
954
+
955
+ declare type DispatchCheckoutPixelEventBodyCurrency = 'BRL' | 'USD' | 'EUR';
956
+
616
957
  export declare type ElementsAppearance = {
617
958
  variables?: ElementsAppearanceVariables;
618
959
  /** Só folhas do Google Fonts, que é o que a CSP do payments libera. */
@@ -677,6 +1018,8 @@ export declare interface FieldProps {
677
1018
  'aria-describedby': string | undefined;
678
1019
  autoComplete: string;
679
1020
  inputMode?: 'text' | 'email' | 'tel' | 'numeric';
1021
+ /** Set on personal data fields: leaving one records the buyer as a lead. */
1022
+ onBlur?: () => void;
680
1023
  }
681
1024
 
682
1025
  /** One field: input props, label-friendly id and error. */
@@ -685,6 +1028,18 @@ export declare interface FieldState {
685
1028
  error: string | undefined;
686
1029
  }
687
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
+
688
1043
  /**
689
1044
  * Formats an amount in cents. The currency is the offer's (always BRL today); only the separators
690
1045
  * follow the locale, so the same price reads the same on the server and in the browser.
@@ -815,6 +1170,34 @@ declare type GetCheckoutPricing2xxItemsItemInstallmentsItem = {
815
1170
 
816
1171
  declare type GetCheckoutPricing2xxItemsItemType = 'main' | 'orderBump';
817
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
+
818
1201
  declare const getCheckoutStatus: (id: string, options?: Parameters<typeof http>[1]) => Promise<GetCheckoutStatus2xx>;
819
1202
 
820
1203
  declare type GetCheckoutStatus2xx = {
@@ -1028,6 +1411,7 @@ declare type GetPublicOfferCheckout2xxCheckoutPlugins = {
1028
1411
  reviews?: GetPublicOfferCheckout2xxCheckoutPluginsReviews;
1029
1412
  video?: GetPublicOfferCheckout2xxCheckoutPluginsVideo;
1030
1413
  chat?: GetPublicOfferCheckout2xxCheckoutPluginsChat;
1414
+ oneClickBuy?: GetPublicOfferCheckout2xxCheckoutPluginsOneClickBuy;
1031
1415
  combo?: GetPublicOfferCheckout2xxCheckoutPluginsCombo;
1032
1416
  } | null;
1033
1417
 
@@ -1060,6 +1444,10 @@ declare type GetPublicOfferCheckout2xxCheckoutPluginsDiscountPopup = {
1060
1444
  text: string;
1061
1445
  };
1062
1446
 
1447
+ declare type GetPublicOfferCheckout2xxCheckoutPluginsOneClickBuy = {
1448
+ enabled: boolean;
1449
+ };
1450
+
1063
1451
  declare type GetPublicOfferCheckout2xxCheckoutPluginsReviews = {
1064
1452
  enabled: boolean;
1065
1453
  /** @maxItems 10 */
@@ -2113,6 +2501,9 @@ declare type OfferCheckoutBodyBuyerTelephone = {
2113
2501
  /** Per-visitor checkout data, fetched in the browser after hydration. */
2114
2502
  export declare type OfferCheckoutVisitor = GetOfferCheckoutVisitor2xx;
2115
2503
 
2504
+ /** Audience check of a buyer email against an offer and its bumps. */
2505
+ export declare type OfferEligibility = CheckCheckoutOfferEligibility2xx;
2506
+
2116
2507
  /** Name, image and price of the offer. Renders on the server from the public offer data. */
2117
2508
  export declare function OfferItem({ className, children }: OfferItemProps): ReactNode;
2118
2509
 
@@ -2141,6 +2532,28 @@ export declare interface OfferItemState {
2141
2532
  value: number;
2142
2533
  formattedValue: string;
2143
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;
2144
2557
  }
2145
2558
 
2146
2559
  /** Saved buyer data of a returning visitor, used to buy with one click. */
@@ -2186,8 +2599,19 @@ export declare interface OrderBumpState {
2186
2599
  selected: boolean;
2187
2600
  /** Always included; cannot be removed. */
2188
2601
  required: boolean;
2189
- /** 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. */
2190
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;
2191
2615
  }
2192
2616
 
2193
2617
  /** Subtotal, discounts, fees, freight and total of the current selection. */
@@ -2294,6 +2718,11 @@ export declare interface PixCharge {
2294
2718
  /** When the code stops being payable, if the API sent it. */
2295
2719
  expiresAt: Date | undefined;
2296
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;
2297
2726
  }
2298
2727
 
2299
2728
  /** QR code and copy-and-paste code of a pending pix, with its countdown. */
@@ -2305,7 +2734,11 @@ export declare interface PixPaymentProps {
2305
2734
  children?: RenderProp<ReturnType<typeof usePix>>;
2306
2735
  }
2307
2736
 
2308
- /** 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
+ */
2309
2742
  export declare function Price({ className, children }: PriceProps): ReactNode;
2310
2743
 
2311
2744
  /** Props of {@link Price}. */
@@ -2330,9 +2763,96 @@ export declare type PurchaseResponse = OfferCheckout2xx;
2330
2763
  /** Answer of the async purchase status route. `result` is set once the purchase finished. */
2331
2764
  export declare type PurchaseStatus = Awaited<ReturnType<typeof getCheckoutStatus>>;
2332
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
+
2333
2797
  /** Render prop: receives the component state and returns the markup. */
2334
2798
  export declare type RenderProp<State> = (state: State) => ReactNode;
2335
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
+
2336
2856
  /** State of the purchase attempt. */
2337
2857
  export declare interface SubmissionState {
2338
2858
  status: SubmissionStatus;
@@ -2418,6 +2938,42 @@ declare type TokenizeResult = {
2418
2938
  brand: CardBrand;
2419
2939
  };
2420
2940
 
2941
+ declare type TrackCheckoutInteractionBody = {
2942
+ hash: string;
2943
+ selectedPaymentMethod?: TrackCheckoutInteractionBodySelectedPaymentMethod;
2944
+ cardInteracted?: boolean;
2945
+ visitorId?: string;
2946
+ };
2947
+
2948
+ declare type TrackCheckoutInteractionBodySelectedPaymentMethod = 'credit' | 'pix' | 'boleto';
2949
+
2950
+ declare type TrackCheckoutLeadsBody = {
2951
+ hash: string;
2952
+ /**
2953
+ * @minLength 5
2954
+ * @maxLength 255
2955
+ */
2956
+ email: string;
2957
+ fullName?: string;
2958
+ telephone?: string;
2959
+ document?: string;
2960
+ affiliateHash?: string;
2961
+ funnelCreatedLead: boolean;
2962
+ visitorId?: string;
2963
+ sessionId?: string;
2964
+ utmSource?: string;
2965
+ utmMedium?: string;
2966
+ utmCampaign?: string;
2967
+ utmTerm?: string;
2968
+ utmContent?: string;
2969
+ extraParams?: TrackingExtraParamsSchema;
2970
+ src?: string;
2971
+ sck?: string;
2972
+ pageId?: string;
2973
+ referrer?: string;
2974
+ landingUrl?: string;
2975
+ };
2976
+
2421
2977
  declare type TrackingExtraParamsSchema = {
2422
2978
  vkSource?: string;
2423
2979
  vkAdId?: string;
@@ -2510,6 +3066,8 @@ export declare function usePersonalData(): CheckoutContextValue['personalData']
2510
3066
  /** The pix waiting for payment, if any, with its countdown and a copy helper. */
2511
3067
  export declare function usePix(): {
2512
3068
  pix: PixCharge | undefined;
3069
+ /** `true` when the pix came back after a page reload. */
3070
+ restored: boolean;
2513
3071
  secondsLeft: number | undefined;
2514
3072
  expired: boolean;
2515
3073
  copy: () => Promise<boolean>;
@@ -2517,12 +3075,28 @@ export declare function usePix(): {
2517
3075
  regenerate: () => ReturnType<CheckoutContextValue['submit']>;
2518
3076
  };
2519
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
+
2520
3092
  /** Purchase state and the function that submits it. */
2521
3093
  export declare function useSubmit(): {
2522
3094
  submit: CheckoutContextValue['submit'];
2523
3095
  reset: CheckoutContextValue['reset'];
2524
3096
  submission: CheckoutContextValue['submission'];
2525
3097
  isSubmitting: boolean;
3098
+ /** Why the purchase cannot go now (see `CheckoutNotices`); `submit` fails with it. */
3099
+ blocked: string | undefined;
2526
3100
  };
2527
3101
 
2528
3102
  /** Totals of the current selection, with formatted values. */
@@ -2564,4 +3138,18 @@ declare interface ValidationMessages {
2564
3138
  state: string;
2565
3139
  }
2566
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
+
2567
3155
  export { }