bitsnap-react 1.17.0 → 1.18.1

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.
Files changed (130) hide show
  1. package/AGENTS.md +85 -0
  2. package/README.md +84 -0
  3. package/dist/CartProvider-CC6YIZVS.js +2 -0
  4. package/dist/CartProvider-CC6YIZVS.js.map +1 -0
  5. package/dist/CartProvider-ECQQH3PS.css +2 -0
  6. package/dist/CartProvider-ECQQH3PS.css.map +1 -0
  7. package/dist/CartProvider-ZL65WZN6.mjs +2 -0
  8. package/dist/PanelModelFiles-4B2HYGIE.mjs +2 -0
  9. package/dist/PanelModelFiles-4B2HYGIE.mjs.map +1 -0
  10. package/dist/PanelModelFiles-EKQRLF46.js +2 -0
  11. package/dist/PanelModelFiles-EKQRLF46.js.map +1 -0
  12. package/dist/analytics.js +1 -1
  13. package/dist/analytics.js.map +1 -1
  14. package/dist/analytics.mjs +1 -1
  15. package/dist/catalog.css +1 -1
  16. package/dist/catalog.css.map +1 -1
  17. package/dist/catalog.d.mts +2 -0
  18. package/dist/catalog.d.ts +2 -0
  19. package/dist/catalog.js +1 -1
  20. package/dist/catalog.js.map +1 -1
  21. package/dist/catalog.mjs +1 -1
  22. package/dist/{chunk-4BL7TLK3.js → chunk-2XSLIZ27.js} +2 -2
  23. package/dist/chunk-2XSLIZ27.js.map +1 -0
  24. package/dist/{chunk-SYN5KU3O.js → chunk-5OCGXVLC.js} +2 -2
  25. package/dist/chunk-5OCGXVLC.js.map +1 -0
  26. package/dist/{chunk-A6VCP3A4.mjs → chunk-5YN752OV.mjs} +2 -2
  27. package/dist/{chunk-X3LVYIJR.mjs → chunk-62WDFH7K.mjs} +2 -2
  28. package/dist/chunk-6Q3VGPSF.js.map +1 -1
  29. package/dist/chunk-7BG22YBF.js +5 -0
  30. package/dist/chunk-7BG22YBF.js.map +1 -0
  31. package/dist/{chunk-5FZAROP6.js → chunk-AHISXVEE.js} +2 -2
  32. package/dist/chunk-AHISXVEE.js.map +1 -0
  33. package/dist/{chunk-MIMQTH2G.js → chunk-DR7WYI37.js} +2 -2
  34. package/dist/chunk-DR7WYI37.js.map +1 -0
  35. package/dist/chunk-EOFJAQPT.js +2 -0
  36. package/dist/chunk-EOFJAQPT.js.map +1 -0
  37. package/dist/{chunk-C3BBJOVV.js → chunk-G4SEOVLD.js} +2 -2
  38. package/dist/chunk-G4SEOVLD.js.map +1 -0
  39. package/dist/{chunk-2UDAB2C5.mjs → chunk-GKJURMDO.mjs} +2 -2
  40. package/dist/{chunk-2UDAB2C5.mjs.map → chunk-GKJURMDO.mjs.map} +1 -1
  41. package/dist/{chunk-M2G74N43.mjs → chunk-IGQZP4YR.mjs} +2 -2
  42. package/dist/chunk-JSDGZ4NY.js.map +1 -1
  43. package/dist/chunk-KOYBZORL.js.map +1 -1
  44. package/dist/{chunk-ESF5ZVVF.js → chunk-N3B25GTY.js} +2 -2
  45. package/dist/chunk-N3B25GTY.js.map +1 -0
  46. package/dist/chunk-OFPRIENJ.mjs +2 -0
  47. package/dist/chunk-OFPRIENJ.mjs.map +1 -0
  48. package/dist/chunk-Q337IQNA.js +2 -0
  49. package/dist/chunk-Q337IQNA.js.map +1 -0
  50. package/dist/{chunk-BZXV77PT.mjs → chunk-UTUPPMLK.mjs} +2 -2
  51. package/dist/{chunk-L7Q7OKM5.mjs → chunk-VWA3ZCNI.mjs} +2 -2
  52. package/dist/chunk-W3RGQYPD.js.map +1 -1
  53. package/dist/chunk-YGE2223J.mjs +5 -0
  54. package/dist/chunk-YGE2223J.mjs.map +1 -0
  55. package/dist/{chunk-HKNWW37T.mjs → chunk-ZKT4N553.mjs} +2 -2
  56. package/dist/chunk-ZM5T4TQW.mjs +2 -0
  57. package/dist/chunk-ZM5T4TQW.mjs.map +1 -0
  58. package/dist/consent.js.map +1 -1
  59. package/dist/course.d.mts +10 -0
  60. package/dist/course.d.ts +10 -0
  61. package/dist/course.js +1 -1
  62. package/dist/course.js.map +1 -1
  63. package/dist/course.mjs +1 -1
  64. package/dist/course.mjs.map +1 -1
  65. package/dist/embed/analytics.js +1 -1
  66. package/dist/errors.js.map +1 -1
  67. package/dist/index.css +1 -1
  68. package/dist/index.css.map +1 -1
  69. package/dist/index.d.mts +272 -2
  70. package/dist/index.d.ts +272 -2
  71. package/dist/index.js +1 -1
  72. package/dist/index.js.map +1 -1
  73. package/dist/index.mjs +1 -1
  74. package/dist/index.mjs.map +1 -1
  75. package/dist/internal.js.map +1 -1
  76. package/dist/methods-7DWKFCPK.js +2 -0
  77. package/dist/methods-7DWKFCPK.js.map +1 -0
  78. package/dist/methods-DQTADIN4.mjs +2 -0
  79. package/dist/methods-OJEZREBK.css +2 -0
  80. package/dist/methods-OJEZREBK.css.map +1 -0
  81. package/dist/model-files-client-P4PORZJ6.js.map +1 -1
  82. package/dist/models.js.map +1 -1
  83. package/dist/returns.js +1 -1
  84. package/dist/returns.js.map +1 -1
  85. package/dist/returns.mjs +1 -1
  86. package/dist/viewer3d.css +1 -1
  87. package/dist/viewer3d.css.map +1 -1
  88. package/dist/viewer3d.js.map +1 -1
  89. package/dist/viewer3d.mjs +1 -1
  90. package/package.json +4 -3
  91. package/dist/CartProvider-DGRZDTYC.mjs +0 -2
  92. package/dist/CartProvider-PDEV6GCV.css +0 -2
  93. package/dist/CartProvider-PDEV6GCV.css.map +0 -1
  94. package/dist/CartProvider-YVOHSMPE.js +0 -2
  95. package/dist/CartProvider-YVOHSMPE.js.map +0 -1
  96. package/dist/PanelModelFiles-NYCOFPLY.js +0 -2
  97. package/dist/PanelModelFiles-NYCOFPLY.js.map +0 -1
  98. package/dist/PanelModelFiles-RV7OHUUZ.mjs +0 -2
  99. package/dist/PanelModelFiles-RV7OHUUZ.mjs.map +0 -1
  100. package/dist/chunk-2NL5FCXC.mjs +0 -4
  101. package/dist/chunk-2NL5FCXC.mjs.map +0 -1
  102. package/dist/chunk-4BL7TLK3.js.map +0 -1
  103. package/dist/chunk-4ETIDGYZ.mjs +0 -2
  104. package/dist/chunk-4ETIDGYZ.mjs.map +0 -1
  105. package/dist/chunk-555KFWGY.js +0 -4
  106. package/dist/chunk-555KFWGY.js.map +0 -1
  107. package/dist/chunk-5FZAROP6.js.map +0 -1
  108. package/dist/chunk-6GCCNBEU.js +0 -2
  109. package/dist/chunk-6GCCNBEU.js.map +0 -1
  110. package/dist/chunk-7RXW6XFY.js +0 -2
  111. package/dist/chunk-7RXW6XFY.js.map +0 -1
  112. package/dist/chunk-C3BBJOVV.js.map +0 -1
  113. package/dist/chunk-ESF5ZVVF.js.map +0 -1
  114. package/dist/chunk-MIMQTH2G.js.map +0 -1
  115. package/dist/chunk-SYN5KU3O.js.map +0 -1
  116. package/dist/chunk-VNYHJT6V.mjs +0 -2
  117. package/dist/chunk-VNYHJT6V.mjs.map +0 -1
  118. package/dist/methods-3W34GRYL.js +0 -2
  119. package/dist/methods-3W34GRYL.js.map +0 -1
  120. package/dist/methods-LUJSKSQ4.mjs +0 -2
  121. package/dist/methods-QAZED7TJ.css +0 -2
  122. package/dist/methods-QAZED7TJ.css.map +0 -1
  123. /package/dist/{CartProvider-DGRZDTYC.mjs.map → CartProvider-ZL65WZN6.mjs.map} +0 -0
  124. /package/dist/{chunk-A6VCP3A4.mjs.map → chunk-5YN752OV.mjs.map} +0 -0
  125. /package/dist/{chunk-X3LVYIJR.mjs.map → chunk-62WDFH7K.mjs.map} +0 -0
  126. /package/dist/{chunk-M2G74N43.mjs.map → chunk-IGQZP4YR.mjs.map} +0 -0
  127. /package/dist/{chunk-BZXV77PT.mjs.map → chunk-UTUPPMLK.mjs.map} +0 -0
  128. /package/dist/{chunk-L7Q7OKM5.mjs.map → chunk-VWA3ZCNI.mjs.map} +0 -0
  129. /package/dist/{chunk-HKNWW37T.mjs.map → chunk-ZKT4N553.mjs.map} +0 -0
  130. /package/dist/{methods-LUJSKSQ4.mjs.map → methods-DQTADIN4.mjs.map} +0 -0
package/dist/index.d.mts CHANGED
@@ -4,7 +4,7 @@ import { S as SlotAppearance, A as AppearanceElements } from './appearance-core-
4
4
  export { PRODUCT_LIST_SLOT_NAMES, ProductList, ProductListAppearance, ProductListAppearanceElements, ProductListAppearanceTokens, ProductListData, ProductListItemContext, ProductListProps, ProductListSlotAppearance, ProductListSlotName, ProductListTextKey, ProductListTexts, ProductListTheme, PublicListProduct, UseProductsOptions, UseProductsResult, formatProductPrice, useProducts } from './catalog.mjs';
5
5
  export { BitsnapReturns, BitsnapReturnsProps, BitsnapReturnsProvider, BitsnapReturnsProviderProps, CreateReturnInput, Environment, LegacyCreateReturnInput, LegacyReturnsTexts, LegacyReturnsTheme, ReturnsAppearanceProvider, ReturnsChallenge, ReturnsCodeStep, ReturnsCodeStepProps, ReturnsConfirmation, ReturnsConfirmationProps, ReturnsEmailStep, ReturnsEmailStepProps, ReturnsEnvironment, ReturnsEnvironmentInput, ReturnsMyReturnDetail, ReturnsMyReturnDetailProps, ReturnsMyReturnsList, ReturnsMyReturnsListProps, ReturnsOrderDetail, ReturnsOrderDetailProps, ReturnsOrderList, ReturnsOrderListProps, ReturnsProvider, ReturnsProviderProps, ReturnsResult, ReturnsResultProps, ReturnsSessionStatus, ReturnsTextsInput, SelectedReturnLine, UseCreateReturnResult, UseMyReturnResult, UseMyReturnsResult, UseReturnOrdersResult, UseReturnSessionResult, UseReturnableOrderResult, useCreateReturn, useMyReturn, useMyReturns, useReturnOrders, useReturnSession, useReturnableOrder, useReturnsAppearance, useReturnsSlot, useReturnsText } from './returns.mjs';
6
6
  export { b as RETURNS_SLOT_NAMES, R as ReturnsAppearance, c as ReturnsAppearanceElements, d as ReturnsAppearanceTokens, e as ReturnsSlotAppearance, f as ReturnsSlotName, h as ReturnsTextKey, a as ReturnsTexts, g as ReturnsTheme } from './texts-LGhuQfA9.mjs';
7
- import { ReactNode } from 'react';
7
+ import { CSSProperties, ReactNode } from 'react';
8
8
  import z__default from 'zod';
9
9
  import { P as PanelLoginProps, a as PanelProps, G as GetThemeOutput } from './types-D6LsoycW.mjs';
10
10
  export { b as PanelScreen, c as PanelSearchParamsType } from './types-D6LsoycW.mjs';
@@ -207,6 +207,26 @@ type CheckoutTexts = {
207
207
  paymentMethodCodDescription: string;
208
208
  /** Error shown when the shop refused cash on delivery for the order. */
209
209
  paymentMethodCodUnavailable: string;
210
+ /** Status while the provider confirms a payment started from an express button. */
211
+ expressPending: string;
212
+ /** Status after the provider confirmed the payment. */
213
+ expressConfirmed: string;
214
+ /** Status when the provider reports a failed payment. */
215
+ expressFailed: string;
216
+ /** Status when the buyer cancelled the provider's payment flow. */
217
+ expressCancelled: string;
218
+ /** Shown while the payment is still unconfirmed after a page return. */
219
+ expressPendingLong: string;
220
+ /** Error shown when the provider's button could not be loaded. */
221
+ expressLoadFailed: string;
222
+ /** Error shown when the cart cannot be paid with this provider right now. */
223
+ expressCartUnavailable: string;
224
+ /** Error shown when another tab/provider changed the same cart line. */
225
+ expressCartConflict: string;
226
+ /** Shown when the server total changed between mounting and paying. */
227
+ expressPriceChanged: string;
228
+ /** Error shown when a product could not be added before the InPost binding. */
229
+ expressProductUnavailable: string;
210
230
  };
211
231
 
212
232
  type BitsnapCartProps = {
@@ -265,6 +285,256 @@ type Props$2 = {
265
285
  };
266
286
  declare function Wrapper$1(props: Props$2): react_jsx_runtime.JSX.Element;
267
287
 
288
+ type CartEnvironment = "test" | "production";
289
+ type CartSnapshotLine = {
290
+ lineId: string;
291
+ /** The id the cart was uploaded with; the same id `/buy` takes. */
292
+ productId: string;
293
+ variantId: string;
294
+ quantity: number;
295
+ name: string;
296
+ imageUrl?: string;
297
+ unitPriceMinor: number;
298
+ lineTotalMinor: number;
299
+ tax?: number;
300
+ currency: string;
301
+ };
302
+ type CartSnapshot = {
303
+ cartId: string;
304
+ revision: number;
305
+ status: "open" | "bound" | "checkout" | "ordered" | "expired";
306
+ environment: CartEnvironment;
307
+ currency: string;
308
+ locale: string;
309
+ lines: CartSnapshotLine[];
310
+ subtotalMinor: number;
311
+ deliveryMinor: number;
312
+ discountMinor: number;
313
+ totalMinor: number;
314
+ couponCode?: string;
315
+ expiresAt: number;
316
+ };
317
+
318
+ type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
319
+
320
+ /** Official `binding_place` values this SDK exposes. */
321
+ declare const INPOST_BINDING_PLACES: readonly ["PRODUCT_CARD", "BASKET_SUMMARY", "MINICART_PAGE", "CHECKOUT_PAGE", "ORDER_CREATE", "THANK_YOU_PAGE"];
322
+ type InPostBindingPlace = (typeof INPOST_BINDING_PLACES)[number];
323
+
324
+ /**
325
+ * React glue between the express client and the buttons. Everything is
326
+ * browser-only: nothing is requested while rendering on the server, and no
327
+ * state is shared between two projects or two hosts.
328
+ */
329
+ type ExpressItem = {
330
+ id: string;
331
+ quantity: number;
332
+ };
333
+
334
+ /**
335
+ * InPost Pay on a product page or in a cart.
336
+ *
337
+ * The button is the official InPost Pay widget: this component renders its
338
+ * documented `<inpost-izi-button>` element, loads the widget lazily in the
339
+ * browser and gives it the documented callbacks. The basket itself is durable
340
+ * on Bitsnap: the first click uploads the cart, binds it through the InPost
341
+ * merchant API (server side) and returns only the basket key the widget needs.
342
+ *
343
+ * Nothing renders unless the backend says the provider is available with a
344
+ * public `merchantClientId`; a 501, an old backend or a missing credential
345
+ * shows no button at all.
346
+ */
347
+ type InPostPayButtonProps = {
348
+ /**
349
+ * The Bitsnap project of the cart. Optional when the page already called
350
+ * `setProjectID(projectID)`; given here it is configured for the page.
351
+ */
352
+ projectID?: string;
353
+ /** Bitsnap host; defaults to the configured one. */
354
+ host?: string;
355
+ locale?: string;
356
+ /** Text overrides, as on `BitsnapCheckout`. */
357
+ texts?: Partial<CheckoutTexts>;
358
+ /** Checkout appearance tokens and slots for the status line. */
359
+ appearance?: CheckoutAppearance;
360
+ /**
361
+ * Explicit cart lines (a custom cart layout that is not the Bitsnap drawer).
362
+ * The SDK uploads and prices them; it never edits the merchant's own state.
363
+ * Omitted: the Bitsnap cart is the basket.
364
+ */
365
+ items?: ExpressItem[];
366
+ /** Product to add to the basket on click (product page placement). */
367
+ productId?: string;
368
+ /** Quantity of `productId`; default 1. */
369
+ quantity?: number;
370
+ /** Official widget placement; defaults to PRODUCT_CARD with `productId`, else BASKET_SUMMARY. */
371
+ bindingPlace?: InPostBindingPlace;
372
+ /** Official widget `variation` attribute (visual variant). */
373
+ variation?: string;
374
+ className?: string;
375
+ style?: CSSProperties;
376
+ /** Analytics of the buttons; on by default, `false` opts out. */
377
+ analytics?: AnalyticsOption;
378
+ /**
379
+ * Called after the browser's `orderCreated` event when the server status has
380
+ * been checked. The event is only a hint: `status` is `completed` only when
381
+ * the signed server-side order state confirms it.
382
+ */
383
+ onOrderCreated?: (info: {
384
+ providerOrderId?: string;
385
+ status?: "pending" | "completed" | "cancelled" | "failed";
386
+ }) => void;
387
+ /** After InPost changed the basket in its app; the canonical snapshot. */
388
+ onBasketChanged?: (snapshot: CartSnapshot) => void;
389
+ /** Test/custom fetch (for example a mocked storefront). */
390
+ fetch?: FetchLike;
391
+ /** Bounds for the server confirmation (tests use a fake sleep). */
392
+ confirmation?: {
393
+ timeoutMs?: number;
394
+ intervalMs?: number;
395
+ sleep?: (ms: number) => Promise<void>;
396
+ now?: () => number;
397
+ };
398
+ };
399
+ /**
400
+ * Standalone InPost Pay button for a product or cart page. Inside
401
+ * `<BitsnapCheckout>` the checkout renders this component itself.
402
+ */
403
+ declare function InPostPayButton(props: InPostPayButtonProps): react_jsx_runtime.JSX.Element;
404
+
405
+ /**
406
+ * Loader of the official Revolut Checkout embed script.
407
+ *
408
+ * The script is loaded only in the browser and only when a Revolut Pay button
409
+ * is about to render: it never runs during server rendering and never lands in
410
+ * the initial bundle of a page without the button. One `<script>` per mode is
411
+ * shared by every button on the page, including two shops using different
412
+ * public keys (the SDK is keyed per `payments()` call, not globally).
413
+ */
414
+ type RevolutMode = "prod" | "sandbox";
415
+ type RevolutPaymentEvent = {
416
+ type: "success";
417
+ orderId: string;
418
+ } | {
419
+ type: "error";
420
+ error: {
421
+ message?: string;
422
+ };
423
+ orderId: string;
424
+ } | {
425
+ type: "cancel";
426
+ dropOffState?: string;
427
+ orderId?: string;
428
+ };
429
+ type RevolutPayButtonStyle = {
430
+ height?: string;
431
+ size?: "large" | "small";
432
+ radius?: "none" | "small" | "large" | "round";
433
+ variant?: "dark" | "light" | "light-outlined";
434
+ action?: "donate" | "pay" | "subscribe" | "buy";
435
+ };
436
+ type RevolutPayPaymentOptions = {
437
+ currency: string;
438
+ totalAmount: number;
439
+ createOrder: () => Promise<{
440
+ publicId: string;
441
+ }>;
442
+ buttonStyle?: RevolutPayButtonStyle;
443
+ mobileRedirectUrls?: {
444
+ success: string;
445
+ failure: string;
446
+ cancel: string;
447
+ };
448
+ redirectUrls?: {
449
+ success: string;
450
+ failure: string;
451
+ cancel: string;
452
+ };
453
+ validate?: () => Promise<boolean> | boolean;
454
+ };
455
+ type RevolutPayModule = {
456
+ mount: (target: string | HTMLElement | null, options: RevolutPayPaymentOptions) => void;
457
+ on: {
458
+ (event: "click", callback: () => void): void;
459
+ (event: "payment", callback: (payload: RevolutPaymentEvent) => void): void;
460
+ };
461
+ destroy: () => void;
462
+ };
463
+ type RevolutPaymentsModule = {
464
+ revolutPay: RevolutPayModule;
465
+ destroy?: () => void;
466
+ };
467
+ type RevolutCheckoutNamespace = {
468
+ payments: (options: {
469
+ publicToken: string;
470
+ mode?: RevolutMode;
471
+ locale?: string;
472
+ }) => Promise<RevolutPaymentsModule>;
473
+ };
474
+ declare global {
475
+ interface Window {
476
+ RevolutCheckout?: RevolutCheckoutNamespace;
477
+ }
478
+ }
479
+
480
+ /**
481
+ * Revolut Pay, mounted through the official Revolut Checkout embed script.
482
+ *
483
+ * The SDK is lazy: it loads only after Bitsnap says the provider is available
484
+ * with a public `publicKey`, and only in the browser. The order is created by
485
+ * the server (`createOrder` calls Bitsnap), never by the browser's numbers.
486
+ *
487
+ * A widget `success` event is a UX signal only: the button shows "confirming"
488
+ * and asks Bitsnap (`revolut/status`) until the verified webhook settles the
489
+ * order. Only then are the purchased lines removed from the cart. Cancel,
490
+ * failure and timeout keep the cart exactly as it was.
491
+ */
492
+ type RevolutPaymentOutcome = {
493
+ status: "completed";
494
+ orderId?: string;
495
+ } | {
496
+ status: "pending";
497
+ } | {
498
+ status: "failed";
499
+ } | {
500
+ status: "cancelled";
501
+ };
502
+ type RevolutPayButtonProps = {
503
+ /** Bitsnap project; optional when the page called `setProjectID(...)`. */
504
+ projectID?: string;
505
+ host?: string;
506
+ locale?: string;
507
+ texts?: Partial<CheckoutTexts>;
508
+ appearance?: CheckoutAppearance;
509
+ /** Explicit cart lines for a custom cart layout; omitted: the Bitsnap cart. */
510
+ items?: ExpressItem[];
511
+ /** Product page support: uploads this product (with `quantity`) as the cart. */
512
+ productId?: string;
513
+ quantity?: number;
514
+ country?: string;
515
+ couponCode?: string;
516
+ /** Page the buyer returns to; defaults to the current page. */
517
+ returnUrl?: string;
518
+ cancelUrl?: string;
519
+ /** Official Revolut button appearance. */
520
+ buttonStyle?: RevolutPayButtonStyle;
521
+ className?: string;
522
+ style?: CSSProperties;
523
+ analytics?: AnalyticsOption;
524
+ /** Called with the browser-level outcome; `completed` is server-confirmed. */
525
+ onPaymentResult?: (outcome: RevolutPaymentOutcome) => void;
526
+ fetch?: FetchLike;
527
+ /** Polling bounds for the server confirmation (tests use a fake sleep). */
528
+ confirmation?: {
529
+ timeoutMs?: number;
530
+ intervalMs?: number;
531
+ sleep?: (ms: number) => Promise<void>;
532
+ now?: () => number;
533
+ };
534
+ };
535
+ /** Standalone Revolut Pay button for a product or cart page. */
536
+ declare function RevolutPayButton(props: RevolutPayButtonProps): react_jsx_runtime.JSX.Element;
537
+
268
538
  type PublicNotificationGroup = {
269
539
  id: string;
270
540
  isOn?: boolean;
@@ -697,4 +967,4 @@ declare function persistReturnURL(returnURL: string | null): void;
697
967
  declare function readPersistedReturnURL(): string | null;
698
968
  declare function buildAccessTokenRedirect(returnURL: string, accessToken: string): string;
699
969
 
700
- export { AnalyticsOption, Wrapper$2 as ApplePayButton, type Props$3 as ApplePayButtonProps, Bitsnap, type BitsnapCartProps, BitsnapCart as BitsnapCheckout, type BuyErrorData, CHECKOUT_SLOT_NAMES, type CheckoutAppearance, type CheckoutAppearanceElements, type CheckoutAppearanceTokens, type CheckoutSlotAppearance, type CheckoutSlotName, type CheckoutTexts, type CheckoutTheme, type ComponentClassNames, type CreateCheckoutResult, type CustomizationTexts, GetThemeOutput, Wrapper$1 as GooglePayButton, type Props$2 as GooglePayButtonProps, ITEM_IDS_NOT_FOUND, type LinkRequest, type NotificationGroup, Wrapper as NotificationsComponent, type Props$1 as NotificationsComponentProps, type NotificationsComponentPublicProps, PanelPage as Panel, type PanelConfig, PanelLogin, PanelLoginProps, PanelProps, PanelProvider, type PublicNotificationGroup, PublicOrderPage, buildAccessTokenRedirect, createCheckout, createPaymentURL, getAllowedReturnOrigins, getLocale, getPanelConfig, getPaymentMethodChoice, getReferenceIfPossible, getReturnURLFromSearch, injectReferenceToRequestIfNeeded, persistReturnURL, readPersistedReturnURL, setAllowedReturnOrigins, setCustomHost, setHost, setLocale, setLoginURL, setPanelConfig, setProjectID as setPanelProjectID, setProjectID$1 as setProjectID, setTheme, usePanelConfig };
970
+ export { AnalyticsOption, Wrapper$2 as ApplePayButton, type Props$3 as ApplePayButtonProps, Bitsnap, type BitsnapCartProps, BitsnapCart as BitsnapCheckout, type BuyErrorData, CHECKOUT_SLOT_NAMES, type CheckoutAppearance, type CheckoutAppearanceElements, type CheckoutAppearanceTokens, type CheckoutSlotAppearance, type CheckoutSlotName, type CheckoutTexts, type CheckoutTheme, type ComponentClassNames, type CreateCheckoutResult, type CustomizationTexts, type ExpressItem, GetThemeOutput, Wrapper$1 as GooglePayButton, type Props$2 as GooglePayButtonProps, ITEM_IDS_NOT_FOUND, InPostPayButton, type InPostPayButtonProps, type LinkRequest, type NotificationGroup, Wrapper as NotificationsComponent, type Props$1 as NotificationsComponentProps, type NotificationsComponentPublicProps, PanelPage as Panel, type PanelConfig, PanelLogin, PanelLoginProps, PanelProps, PanelProvider, type PublicNotificationGroup, PublicOrderPage, RevolutPayButton, type RevolutPayButtonProps, type RevolutPaymentOutcome, buildAccessTokenRedirect, createCheckout, createPaymentURL, getAllowedReturnOrigins, getLocale, getPanelConfig, getPaymentMethodChoice, getReferenceIfPossible, getReturnURLFromSearch, injectReferenceToRequestIfNeeded, persistReturnURL, readPersistedReturnURL, setAllowedReturnOrigins, setCustomHost, setHost, setLocale, setLoginURL, setPanelConfig, setProjectID as setPanelProjectID, setProjectID$1 as setProjectID, setTheme, usePanelConfig };
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import { S as SlotAppearance, A as AppearanceElements } from './appearance-core-
4
4
  export { PRODUCT_LIST_SLOT_NAMES, ProductList, ProductListAppearance, ProductListAppearanceElements, ProductListAppearanceTokens, ProductListData, ProductListItemContext, ProductListProps, ProductListSlotAppearance, ProductListSlotName, ProductListTextKey, ProductListTexts, ProductListTheme, PublicListProduct, UseProductsOptions, UseProductsResult, formatProductPrice, useProducts } from './catalog.js';
5
5
  export { BitsnapReturns, BitsnapReturnsProps, BitsnapReturnsProvider, BitsnapReturnsProviderProps, CreateReturnInput, Environment, LegacyCreateReturnInput, LegacyReturnsTexts, LegacyReturnsTheme, ReturnsAppearanceProvider, ReturnsChallenge, ReturnsCodeStep, ReturnsCodeStepProps, ReturnsConfirmation, ReturnsConfirmationProps, ReturnsEmailStep, ReturnsEmailStepProps, ReturnsEnvironment, ReturnsEnvironmentInput, ReturnsMyReturnDetail, ReturnsMyReturnDetailProps, ReturnsMyReturnsList, ReturnsMyReturnsListProps, ReturnsOrderDetail, ReturnsOrderDetailProps, ReturnsOrderList, ReturnsOrderListProps, ReturnsProvider, ReturnsProviderProps, ReturnsResult, ReturnsResultProps, ReturnsSessionStatus, ReturnsTextsInput, SelectedReturnLine, UseCreateReturnResult, UseMyReturnResult, UseMyReturnsResult, UseReturnOrdersResult, UseReturnSessionResult, UseReturnableOrderResult, useCreateReturn, useMyReturn, useMyReturns, useReturnOrders, useReturnSession, useReturnableOrder, useReturnsAppearance, useReturnsSlot, useReturnsText } from './returns.js';
6
6
  export { b as RETURNS_SLOT_NAMES, R as ReturnsAppearance, c as ReturnsAppearanceElements, d as ReturnsAppearanceTokens, e as ReturnsSlotAppearance, f as ReturnsSlotName, h as ReturnsTextKey, a as ReturnsTexts, g as ReturnsTheme } from './texts-m6XQGZ6w.js';
7
- import { ReactNode } from 'react';
7
+ import { CSSProperties, ReactNode } from 'react';
8
8
  import z__default from 'zod';
9
9
  import { P as PanelLoginProps, a as PanelProps, G as GetThemeOutput } from './types-ClFCVzk_.js';
10
10
  export { b as PanelScreen, c as PanelSearchParamsType } from './types-ClFCVzk_.js';
@@ -207,6 +207,26 @@ type CheckoutTexts = {
207
207
  paymentMethodCodDescription: string;
208
208
  /** Error shown when the shop refused cash on delivery for the order. */
209
209
  paymentMethodCodUnavailable: string;
210
+ /** Status while the provider confirms a payment started from an express button. */
211
+ expressPending: string;
212
+ /** Status after the provider confirmed the payment. */
213
+ expressConfirmed: string;
214
+ /** Status when the provider reports a failed payment. */
215
+ expressFailed: string;
216
+ /** Status when the buyer cancelled the provider's payment flow. */
217
+ expressCancelled: string;
218
+ /** Shown while the payment is still unconfirmed after a page return. */
219
+ expressPendingLong: string;
220
+ /** Error shown when the provider's button could not be loaded. */
221
+ expressLoadFailed: string;
222
+ /** Error shown when the cart cannot be paid with this provider right now. */
223
+ expressCartUnavailable: string;
224
+ /** Error shown when another tab/provider changed the same cart line. */
225
+ expressCartConflict: string;
226
+ /** Shown when the server total changed between mounting and paying. */
227
+ expressPriceChanged: string;
228
+ /** Error shown when a product could not be added before the InPost binding. */
229
+ expressProductUnavailable: string;
210
230
  };
211
231
 
212
232
  type BitsnapCartProps = {
@@ -265,6 +285,256 @@ type Props$2 = {
265
285
  };
266
286
  declare function Wrapper$1(props: Props$2): react_jsx_runtime.JSX.Element;
267
287
 
288
+ type CartEnvironment = "test" | "production";
289
+ type CartSnapshotLine = {
290
+ lineId: string;
291
+ /** The id the cart was uploaded with; the same id `/buy` takes. */
292
+ productId: string;
293
+ variantId: string;
294
+ quantity: number;
295
+ name: string;
296
+ imageUrl?: string;
297
+ unitPriceMinor: number;
298
+ lineTotalMinor: number;
299
+ tax?: number;
300
+ currency: string;
301
+ };
302
+ type CartSnapshot = {
303
+ cartId: string;
304
+ revision: number;
305
+ status: "open" | "bound" | "checkout" | "ordered" | "expired";
306
+ environment: CartEnvironment;
307
+ currency: string;
308
+ locale: string;
309
+ lines: CartSnapshotLine[];
310
+ subtotalMinor: number;
311
+ deliveryMinor: number;
312
+ discountMinor: number;
313
+ totalMinor: number;
314
+ couponCode?: string;
315
+ expiresAt: number;
316
+ };
317
+
318
+ type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
319
+
320
+ /** Official `binding_place` values this SDK exposes. */
321
+ declare const INPOST_BINDING_PLACES: readonly ["PRODUCT_CARD", "BASKET_SUMMARY", "MINICART_PAGE", "CHECKOUT_PAGE", "ORDER_CREATE", "THANK_YOU_PAGE"];
322
+ type InPostBindingPlace = (typeof INPOST_BINDING_PLACES)[number];
323
+
324
+ /**
325
+ * React glue between the express client and the buttons. Everything is
326
+ * browser-only: nothing is requested while rendering on the server, and no
327
+ * state is shared between two projects or two hosts.
328
+ */
329
+ type ExpressItem = {
330
+ id: string;
331
+ quantity: number;
332
+ };
333
+
334
+ /**
335
+ * InPost Pay on a product page or in a cart.
336
+ *
337
+ * The button is the official InPost Pay widget: this component renders its
338
+ * documented `<inpost-izi-button>` element, loads the widget lazily in the
339
+ * browser and gives it the documented callbacks. The basket itself is durable
340
+ * on Bitsnap: the first click uploads the cart, binds it through the InPost
341
+ * merchant API (server side) and returns only the basket key the widget needs.
342
+ *
343
+ * Nothing renders unless the backend says the provider is available with a
344
+ * public `merchantClientId`; a 501, an old backend or a missing credential
345
+ * shows no button at all.
346
+ */
347
+ type InPostPayButtonProps = {
348
+ /**
349
+ * The Bitsnap project of the cart. Optional when the page already called
350
+ * `setProjectID(projectID)`; given here it is configured for the page.
351
+ */
352
+ projectID?: string;
353
+ /** Bitsnap host; defaults to the configured one. */
354
+ host?: string;
355
+ locale?: string;
356
+ /** Text overrides, as on `BitsnapCheckout`. */
357
+ texts?: Partial<CheckoutTexts>;
358
+ /** Checkout appearance tokens and slots for the status line. */
359
+ appearance?: CheckoutAppearance;
360
+ /**
361
+ * Explicit cart lines (a custom cart layout that is not the Bitsnap drawer).
362
+ * The SDK uploads and prices them; it never edits the merchant's own state.
363
+ * Omitted: the Bitsnap cart is the basket.
364
+ */
365
+ items?: ExpressItem[];
366
+ /** Product to add to the basket on click (product page placement). */
367
+ productId?: string;
368
+ /** Quantity of `productId`; default 1. */
369
+ quantity?: number;
370
+ /** Official widget placement; defaults to PRODUCT_CARD with `productId`, else BASKET_SUMMARY. */
371
+ bindingPlace?: InPostBindingPlace;
372
+ /** Official widget `variation` attribute (visual variant). */
373
+ variation?: string;
374
+ className?: string;
375
+ style?: CSSProperties;
376
+ /** Analytics of the buttons; on by default, `false` opts out. */
377
+ analytics?: AnalyticsOption;
378
+ /**
379
+ * Called after the browser's `orderCreated` event when the server status has
380
+ * been checked. The event is only a hint: `status` is `completed` only when
381
+ * the signed server-side order state confirms it.
382
+ */
383
+ onOrderCreated?: (info: {
384
+ providerOrderId?: string;
385
+ status?: "pending" | "completed" | "cancelled" | "failed";
386
+ }) => void;
387
+ /** After InPost changed the basket in its app; the canonical snapshot. */
388
+ onBasketChanged?: (snapshot: CartSnapshot) => void;
389
+ /** Test/custom fetch (for example a mocked storefront). */
390
+ fetch?: FetchLike;
391
+ /** Bounds for the server confirmation (tests use a fake sleep). */
392
+ confirmation?: {
393
+ timeoutMs?: number;
394
+ intervalMs?: number;
395
+ sleep?: (ms: number) => Promise<void>;
396
+ now?: () => number;
397
+ };
398
+ };
399
+ /**
400
+ * Standalone InPost Pay button for a product or cart page. Inside
401
+ * `<BitsnapCheckout>` the checkout renders this component itself.
402
+ */
403
+ declare function InPostPayButton(props: InPostPayButtonProps): react_jsx_runtime.JSX.Element;
404
+
405
+ /**
406
+ * Loader of the official Revolut Checkout embed script.
407
+ *
408
+ * The script is loaded only in the browser and only when a Revolut Pay button
409
+ * is about to render: it never runs during server rendering and never lands in
410
+ * the initial bundle of a page without the button. One `<script>` per mode is
411
+ * shared by every button on the page, including two shops using different
412
+ * public keys (the SDK is keyed per `payments()` call, not globally).
413
+ */
414
+ type RevolutMode = "prod" | "sandbox";
415
+ type RevolutPaymentEvent = {
416
+ type: "success";
417
+ orderId: string;
418
+ } | {
419
+ type: "error";
420
+ error: {
421
+ message?: string;
422
+ };
423
+ orderId: string;
424
+ } | {
425
+ type: "cancel";
426
+ dropOffState?: string;
427
+ orderId?: string;
428
+ };
429
+ type RevolutPayButtonStyle = {
430
+ height?: string;
431
+ size?: "large" | "small";
432
+ radius?: "none" | "small" | "large" | "round";
433
+ variant?: "dark" | "light" | "light-outlined";
434
+ action?: "donate" | "pay" | "subscribe" | "buy";
435
+ };
436
+ type RevolutPayPaymentOptions = {
437
+ currency: string;
438
+ totalAmount: number;
439
+ createOrder: () => Promise<{
440
+ publicId: string;
441
+ }>;
442
+ buttonStyle?: RevolutPayButtonStyle;
443
+ mobileRedirectUrls?: {
444
+ success: string;
445
+ failure: string;
446
+ cancel: string;
447
+ };
448
+ redirectUrls?: {
449
+ success: string;
450
+ failure: string;
451
+ cancel: string;
452
+ };
453
+ validate?: () => Promise<boolean> | boolean;
454
+ };
455
+ type RevolutPayModule = {
456
+ mount: (target: string | HTMLElement | null, options: RevolutPayPaymentOptions) => void;
457
+ on: {
458
+ (event: "click", callback: () => void): void;
459
+ (event: "payment", callback: (payload: RevolutPaymentEvent) => void): void;
460
+ };
461
+ destroy: () => void;
462
+ };
463
+ type RevolutPaymentsModule = {
464
+ revolutPay: RevolutPayModule;
465
+ destroy?: () => void;
466
+ };
467
+ type RevolutCheckoutNamespace = {
468
+ payments: (options: {
469
+ publicToken: string;
470
+ mode?: RevolutMode;
471
+ locale?: string;
472
+ }) => Promise<RevolutPaymentsModule>;
473
+ };
474
+ declare global {
475
+ interface Window {
476
+ RevolutCheckout?: RevolutCheckoutNamespace;
477
+ }
478
+ }
479
+
480
+ /**
481
+ * Revolut Pay, mounted through the official Revolut Checkout embed script.
482
+ *
483
+ * The SDK is lazy: it loads only after Bitsnap says the provider is available
484
+ * with a public `publicKey`, and only in the browser. The order is created by
485
+ * the server (`createOrder` calls Bitsnap), never by the browser's numbers.
486
+ *
487
+ * A widget `success` event is a UX signal only: the button shows "confirming"
488
+ * and asks Bitsnap (`revolut/status`) until the verified webhook settles the
489
+ * order. Only then are the purchased lines removed from the cart. Cancel,
490
+ * failure and timeout keep the cart exactly as it was.
491
+ */
492
+ type RevolutPaymentOutcome = {
493
+ status: "completed";
494
+ orderId?: string;
495
+ } | {
496
+ status: "pending";
497
+ } | {
498
+ status: "failed";
499
+ } | {
500
+ status: "cancelled";
501
+ };
502
+ type RevolutPayButtonProps = {
503
+ /** Bitsnap project; optional when the page called `setProjectID(...)`. */
504
+ projectID?: string;
505
+ host?: string;
506
+ locale?: string;
507
+ texts?: Partial<CheckoutTexts>;
508
+ appearance?: CheckoutAppearance;
509
+ /** Explicit cart lines for a custom cart layout; omitted: the Bitsnap cart. */
510
+ items?: ExpressItem[];
511
+ /** Product page support: uploads this product (with `quantity`) as the cart. */
512
+ productId?: string;
513
+ quantity?: number;
514
+ country?: string;
515
+ couponCode?: string;
516
+ /** Page the buyer returns to; defaults to the current page. */
517
+ returnUrl?: string;
518
+ cancelUrl?: string;
519
+ /** Official Revolut button appearance. */
520
+ buttonStyle?: RevolutPayButtonStyle;
521
+ className?: string;
522
+ style?: CSSProperties;
523
+ analytics?: AnalyticsOption;
524
+ /** Called with the browser-level outcome; `completed` is server-confirmed. */
525
+ onPaymentResult?: (outcome: RevolutPaymentOutcome) => void;
526
+ fetch?: FetchLike;
527
+ /** Polling bounds for the server confirmation (tests use a fake sleep). */
528
+ confirmation?: {
529
+ timeoutMs?: number;
530
+ intervalMs?: number;
531
+ sleep?: (ms: number) => Promise<void>;
532
+ now?: () => number;
533
+ };
534
+ };
535
+ /** Standalone Revolut Pay button for a product or cart page. */
536
+ declare function RevolutPayButton(props: RevolutPayButtonProps): react_jsx_runtime.JSX.Element;
537
+
268
538
  type PublicNotificationGroup = {
269
539
  id: string;
270
540
  isOn?: boolean;
@@ -697,4 +967,4 @@ declare function persistReturnURL(returnURL: string | null): void;
697
967
  declare function readPersistedReturnURL(): string | null;
698
968
  declare function buildAccessTokenRedirect(returnURL: string, accessToken: string): string;
699
969
 
700
- export { AnalyticsOption, Wrapper$2 as ApplePayButton, type Props$3 as ApplePayButtonProps, Bitsnap, type BitsnapCartProps, BitsnapCart as BitsnapCheckout, type BuyErrorData, CHECKOUT_SLOT_NAMES, type CheckoutAppearance, type CheckoutAppearanceElements, type CheckoutAppearanceTokens, type CheckoutSlotAppearance, type CheckoutSlotName, type CheckoutTexts, type CheckoutTheme, type ComponentClassNames, type CreateCheckoutResult, type CustomizationTexts, GetThemeOutput, Wrapper$1 as GooglePayButton, type Props$2 as GooglePayButtonProps, ITEM_IDS_NOT_FOUND, type LinkRequest, type NotificationGroup, Wrapper as NotificationsComponent, type Props$1 as NotificationsComponentProps, type NotificationsComponentPublicProps, PanelPage as Panel, type PanelConfig, PanelLogin, PanelLoginProps, PanelProps, PanelProvider, type PublicNotificationGroup, PublicOrderPage, buildAccessTokenRedirect, createCheckout, createPaymentURL, getAllowedReturnOrigins, getLocale, getPanelConfig, getPaymentMethodChoice, getReferenceIfPossible, getReturnURLFromSearch, injectReferenceToRequestIfNeeded, persistReturnURL, readPersistedReturnURL, setAllowedReturnOrigins, setCustomHost, setHost, setLocale, setLoginURL, setPanelConfig, setProjectID as setPanelProjectID, setProjectID$1 as setProjectID, setTheme, usePanelConfig };
970
+ export { AnalyticsOption, Wrapper$2 as ApplePayButton, type Props$3 as ApplePayButtonProps, Bitsnap, type BitsnapCartProps, BitsnapCart as BitsnapCheckout, type BuyErrorData, CHECKOUT_SLOT_NAMES, type CheckoutAppearance, type CheckoutAppearanceElements, type CheckoutAppearanceTokens, type CheckoutSlotAppearance, type CheckoutSlotName, type CheckoutTexts, type CheckoutTheme, type ComponentClassNames, type CreateCheckoutResult, type CustomizationTexts, type ExpressItem, GetThemeOutput, Wrapper$1 as GooglePayButton, type Props$2 as GooglePayButtonProps, ITEM_IDS_NOT_FOUND, InPostPayButton, type InPostPayButtonProps, type LinkRequest, type NotificationGroup, Wrapper as NotificationsComponent, type Props$1 as NotificationsComponentProps, type NotificationsComponentPublicProps, PanelPage as Panel, type PanelConfig, PanelLogin, PanelLoginProps, PanelProps, PanelProvider, type PublicNotificationGroup, PublicOrderPage, RevolutPayButton, type RevolutPayButtonProps, type RevolutPaymentOutcome, buildAccessTokenRedirect, createCheckout, createPaymentURL, getAllowedReturnOrigins, getLocale, getPanelConfig, getPaymentMethodChoice, getReferenceIfPossible, getReturnURLFromSearch, injectReferenceToRequestIfNeeded, persistReturnURL, readPersistedReturnURL, setAllowedReturnOrigins, setCustomHost, setHost, setLocale, setLoginURL, setPanelConfig, setProjectID as setPanelProjectID, setProjectID$1 as setProjectID, setTheme, usePanelConfig };